Skip to content

Update shiki to v4#442

Merged
delucis merged 4 commits into
expressive-code:mainfrom
ocavue-forks:ocavue-shiki-v4
May 4, 2026
Merged

Update shiki to v4#442
delucis merged 4 commits into
expressive-code:mainfrom
ocavue-forks:ocavue-shiki-v4

Conversation

@ocavue
Copy link
Copy Markdown
Contributor

@ocavue ocavue commented May 4, 2026

Closes #434

Summary

Shiki v4 changed how its bundles are split, and that broke the Astro Cloudflare bundle optimizations.

This PR fixes the regression where the worker bundle started including:

  • unused language chunks
  • the WASM engine even when engine: 'javascript' was selected
  • a much larger total bundle

Why

Two things changed in Shiki v4:

  • importing runtime values from the shiki root can pull in both regex engines
  • bundled language data now lives in langs-bundle-full-*, not just langs.mjs

That means the old code no longer removed the extra engine and extra language chunks correctly.

What Changed

  • switched plugin-shiki runtime imports to narrower Shiki entrypoints
  • updated the Astro Vite transform to also trim langs-bundle-full-*

Test

  • pnpm exec vitest run test/integration.test.ts

@netlify
Copy link
Copy Markdown

netlify Bot commented May 4, 2026

Deploy Preview for expressive-code ready!

Name Link
🔨 Latest commit 68e26ea
🔍 Latest deploy log https://app.netlify.com/projects/expressive-code/deploys/69f88a566d092c0008502b57
😎 Deploy Preview https://deploy-preview-442--expressive-code.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ocavue ocavue marked this pull request as ready for review May 4, 2026 11:12
Copy link
Copy Markdown
Collaborator

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ocavue! Looks like there’s a test failure related to excluding Shiki code from SSR bundles — would you be able to take a look?

Edit: oh looks like you just did! Thanks! For some reason CI checks aren’t running or showing up for me to approve though… thanks GitHub.

# Conflicts:
#	docs/package.json
#	pnpm-lock.yaml
@ocavue
Copy link
Copy Markdown
Contributor Author

ocavue commented May 4, 2026

For some reason CI checks aren’t running

This might be because of the conflict between my branch and origin/main. I just resolved the conflict.

@ocavue ocavue requested a review from delucis May 4, 2026 11:48
@delucis
Copy link
Copy Markdown
Collaborator

delucis commented May 4, 2026

This might be because of the conflict between my branch and origin/main.

Interesting — I’ve never seen GitHub do that, but tests are indeed running now 🎉

@ocavue
Copy link
Copy Markdown
Contributor Author

ocavue commented May 4, 2026

FYI, if you use pull_request in .github/workflows/ci.yml, GitHub will try to run the workflow on the merged branch (i.e., not my dev branch).

https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request
Workflows will not run on pull_request activity if the pull request has a merge conflict. The merge conflict must be resolved first. Conversely, workflows with the pull_request_target event will run even if the pull request has a merge conflict. Before using the pull_request_target trigger, you should be aware of the security risks. For more information, see pull_request_target.

Copy link
Copy Markdown
Collaborator

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ocavue — tests are passing 🎉

One comment on the changeset but otherwise LGTM.

Comment thread .changeset/shiki-v4.md
Co-authored-by: Chris Swithinbank <[email protected]>
@delucis delucis merged commit 1ff2c57 into expressive-code:main May 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update shiki to v4

2 participants