feat: add @shikijs/stream and @shikijs/magic-move packages#1283
Merged
Conversation
Ports antfu/shiki-stream and shikijs/shiki-magic-move into the monorepo
as official packages under the @shikijs/* namespace. Implementation and
playgrounds are kept verbatim from upstream; only package identity and
monorepo integration changed.
Packages:
- @shikijs/stream (was shiki-stream): streaming colorization,
Vue/React/Solid renderer subpaths. Useful for highlighting LLM
output and other text streams.
- @shikijs/magic-move (was shiki-magic-move): smoothly animated code
blocks, with Vue/React/Solid/Svelte/web-component adapters.
Source rewrites (minimum needed for rename):
- magic-move src/index.ts: error message refers to new package name.
- magic-move .svelte components: cross-subpath imports updated to
@shikijs/magic-move/{types,core,renderer}.
Infra:
- pnpm-workspace.yaml: catalog entries for unbuild, framework plugins,
babel presets; semver override to satisfy trust-policy
(vite-plugin-solid -> @babel/core pulls in semver@6.3.1 which lacks
provenance).
- tsconfig.json: jsx: preserve and allowImportingTsExtensions for the
Solid .tsx re-exports; paths for both packages and all subpaths.
- test/exports.test.ts: filter framework-adapter subpaths (their
toolchains aren't loaded in the root vitest env) and the magic-move
bare entry (throws by design upstream).
- docs/packages/{stream,magic-move}.md: new doc pages modeled on the
existing transformers/monaco pages.
- docs/.vitepress/config.ts: INTEGRATIONS sidebar entries.
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1283 +/- ##
=======================================
Coverage 89.50% 89.50%
=======================================
Files 79 79
Lines 3516 3516
Branches 1000 1000
=======================================
Hits 3147 3147
Misses 331 331
Partials 38 38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Lint fixes for the @shikijs/stream and @shikijs/magic-move port: - eslint.config.js: disable ts/explicit-function-return-type for the two new packages, matching the existing override pattern for Vue files and docs. The new packages ship framework adapter components whose return types are inferred from JSX. - packages/stream/src/react/renderer.ts: drop two upstream eslint-disable directives that target react-hooks-extra/* rules. The plugins they reference are not loaded in this monorepo's lint env, so the directives surface as 'rule not found' errors. - pnpm-workspace.yaml: move overrides after packages (yaml/sort-keys) and remove the duplicate diff-match-patch-es catalog entry; the pre-existing testing catalog already has it. - packages/magic-move/package.json: route diff-match-patch-es through catalog:testing to consolidate on the existing entry. - tsconfig.json: reorder allowImportingTsExtensions after types (jsonc/sort-keys). - vitest.config.ts: exclude packages/stream and packages/magic-move from coverage, matching the existing precedent for packages/cli, packages/monaco, and packages/vitepress-twoslash (integration packages hard to cover via unit tests). Fixes codecov/patch and codecov/project.
1 task
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.
Summary
Ports two community packages — antfu/shiki-stream and shikijs/shiki-magic-move — into this monorepo as official
@shikijs/*packages.shiki-stream@shikijs/streamshiki-magic-move@shikijs/magic-moveImplementation and playgrounds are preserved verbatim from upstream; only package identity and monorepo integration changed.
What's in each package
@shikijs/stream— streaming colorization, useful for highlighting LLM output and other text streams. Exposes:.— core (CodeToTokenTransformStream,RecallToken, etc.)./vue,./react,./solid— renderer components@shikijs/magic-move— smoothly animated code blocks (used by Slidev). Exposes:./core,./renderer,./types,./style.css— framework-agnostic./vue,./react,./solid,./svelte— framework adaptersdist/web-component.mjs)Source rewrites (minimum needed for the rename)
packages/magic-move/src/index.ts— error message refers to@shikijs/magic-movepackages/magic-move/src/svelte/*.svelte— cross-subpath imports updated (shiki-magic-move/types→@shikijs/magic-move/types, etc.). These are runtime imports that Svelte's bundler resolves against the published package name, so they have to match the new name.CSS class names (
shiki-magic-move-*,shiki-stream) and custom-element tag names (shiki-magic-move,shiki-magic-move-precompiled,shiki-magic-move-renderer) are kept as-is because they are public CSS / DOM API surfaces — changing them would break downstream consumers.Monorepo infrastructure changes
pnpm-workspace.yamlunbuild, framework Vite plugins (Vue / React / Solid / Svelte), and babel presets (@babel/preset-typescript,@babel/preset-react,babel-preset-solid).overrides: { semver: ^7.8.0 }to satisfy the workspace'strustPolicy: no-downgrade—vite-plugin-solid → @babel/corepulls insemver@6.3.1, which lacks provenance. Both upstreams already pin semver to^7.xin their ownresolutionsfor the same reason.tsconfig.jsonjsx: preserveandallowImportingTsExtensions: trueto support the Solid.tsxre-exports (packages/stream/src/solid/index.tsdoesexport * from './renderer.tsx').pathsentries for@shikijs/stream{,/vue,/react,/solid}and@shikijs/magic-move{,/core,/renderer,/types,/vue,/react,/solid,/svelte}.test/exports.test.ts— extended the existingresolveExportEntriesfilter to skip framework-adapter subpaths (./vue,./react,./solid,./svelte) because the root vitest env doesn't load the Solid / Svelte / React JSX toolchains. Also skips the@shikijs/magic-movebare entry which intentionally throws by upstream design.docs/.vitepress/config.ts— addedStreamandMagic Moveentries to theINTEGRATIONSarray (nav + sidebar).docs/packages/stream.md,docs/packages/magic-move.md, modeled on the existingtransformers.md/monaco.mdpattern.Verification
pnpm install✅ cleanpnpm -r run build✅ all 21 workspace packages including both new onespnpm typecheck(vue-tsc) ✅ zero errorspnpm exec vitest run packages/stream packages/magic-move test/exports.test.ts✅ 4 files / 23 tests passPre-existing notes (not introduced by this PR)
packages/shiki/test/bundle.test.ts > bundle-fullis slow under workspace contention — passes in ~8s in isolation but can time out at the 30s default when the full workspace runs in parallel. Pre-existing flake, not caused by this change.vitest -u(engine-javascript record + a Vue grammar HTML snapshot in shiki tests). Both are upstream drift that already exists on main — reverted, out of scope here.Follow-ups (deliberately out of scope)
shiki-stream,shiki-magic-move) that point at the new@shikijs/*names — needs an explicit release step.https://github.com/antfu/shiki-stream). Kept as-is per the migration spec; easy to update later if you want them to point at this monorepo.