fix(deps): remove mermaid as hard runtime dependency#502
Open
sleitor wants to merge 2 commits intovercel:mainfrom
Open
fix(deps): remove mermaid as hard runtime dependency#502sleitor wants to merge 2 commits intovercel:mainfrom
sleitor wants to merge 2 commits intovercel:mainfrom
Conversation
mermaid was in dependencies but is only used as an import type in the
core package. All runtime usage lives in @streamdown/mermaid plugin.
Replace import type { MermaidConfig } from 'mermaid' with a local
structural type so no type-level coupling remains in the dist bundle.
Fixes vercel#501
Contributor
|
@sleitor is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
…kage Fix download-button.tsx, fullscreen-button.tsx, and mermaid.test.tsx which still imported MermaidConfig directly from the 'mermaid' package. All three now use the local structural type from lib/plugin-types.ts. Addresses VADE review feedback on vercel#502.
Contributor
Author
|
Good catch from VADE! Fixed in 56e02a1 — |
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.
Problem
Fixes #501
mermaidis listed independenciesof the corestreamdownpackage, but it is never actually imported at runtime — onlyimport type { MermaidConfig }appears in source files. The actual mermaid runtime is exclusively owned by the optional@streamdown/mermaidplugin package.This forces ~75 MB of mermaid into every install of
streamdown, even for users who have no interest in diagram rendering.Fix
Remove
mermaidfromdependenciesinpackages/streamdown/package.json.Replace
import type { MermaidConfig } from 'mermaid'in three files with a local structural type:Since the config is only ever passed through to the plugin (never inspected in core), this is fully compatible. Users who want exhaustive type-safety can still
import type { MermaidConfig } from 'mermaid'— TypeScript's structural typing ensures it remains assignable.Add changeset (patch bump for
streamdown).Verification
pnpm build✅ —dist/index.d.tsno longer containsfrom 'mermaid'pnpm test✅ — 982/982 tests passpnpm biome check✅