fix: stop requiring shiki for type-checking streamdown#565
Open
ghostyfreak wants to merge 1 commit into
Open
Conversation
Re-exported BundledLanguage, BundledTheme, and ThemeRegistrationAny from local structural types instead of importing them from shiki. Consumers no longer need to install shiki solely to satisfy TypeScript when using the published declarations. Runtime highlighting remains in @streamdown/code, which still depends on shiki. CodeHighlighterPlugin methods use method syntax so plugins with narrower Shiki unions stay assignable. Fixes vercel#562
Contributor
|
@ghostyfreak is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
streamdownre-exportedBundledLanguage,BundledTheme, andThemeRegistrationAnyfromshikiin its published type declarations, butshikiwas only adevDependency. Consumers who installstreamdownand runtsc(especially withskipLibCheck: false) hit:even when they never use Shiki directly. Runtime highlighting already lives in
@streamdown/code(which correctly depends onshiki); core streamdown only needed those types for its plugin API.This PR defines local structural types for the re-exports so published
.d.tsfiles no longer import fromshiki.Type of Change
Related Issues
Fixes #562
Changes Made
lib/shiki-types.tswith localBundledLanguage,BundledTheme, andThemeRegistrationAnytypesplugin-types/ package entry instead offrom "shiki"shikidevDependencyfromstreamdownCodeHighlighterPluginso plugins from@streamdown/code(narrower Shiki language/theme unions) remain assignableTesting
Verification
pnpm --filter streamdown test— 982 tests passedpnpm --filter streamdown build— publisheddist/index.d.tshas nofrom 'shiki'importshiki, butshikiis only a devDependency #562):shikitscwithskipLibCheck: falseno longer reportsCannot find module 'shiki'streamdown@2.5.0under the same config, the shiki module errors still appearstreamdown+@streamdown/codeand confirmed<Streamdown plugins={{ code }} />type-checksChecklist
pnpm changeset)Changeset
Additional Notes
BundledLanguage/BundledThemeare intentionally widened tostringon the core package surface. Precise Shiki unions remain available from@streamdown/code/shikifor apps that install the highlighter plugin. This avoids pulling the largeshikipackage into every streamdown consumer solely for types.