Split the Shiki highlighter from the plain token helpers - #4467
Merged
Conversation
🦋 Changeset detectedLatest commit: 182087c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
nolannbiron
marked this pull request as ready for review
August 5, 2026 14:54
peterwhite
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ClientCodeBlockimportsplain-highlight.ts, which pulledgetHighlightTokensText,parseDiffNotationandtruncateHighlightTokensfromhighlight.ts. That module importsshiki/core,shiki/engine/javascript,shiki/langsandshiki/themes, so the whole Shiki bundle landed in the initial client payload of every docs page — defeating the lazyimport('./highlight')thatClientCodeBlockalready does.The token and plain-text helpers need no Shiki values (the
shiki/coreimports they use are types, erased at build), so they move tohighlight-tokens.ts.highlight.tskeeps the highlighter itself and re-exports the helpers, so existing importers are unchanged. This also breaks thehighlight.ts↔plain-highlight.tsimport cycle.Initial client JS for the docs route (
/sites/static/[mode]/[siteURL]/[siteData]/(content)/[pagePath]), measured on a production build:mainSizes are minified and uncompressed on disk; over the wire the saving is roughly a third of that.
First of several changes coming out of the Lighthouse audit in DOCS-6253, where a docs page executes ~9.1 s of JavaScript on a mid-range phone.