fix: bundle remark/unified deps to resolve Vitest jsdom compatibility#45
Open
DavidsonRafaelK wants to merge 1 commit into
Open
fix: bundle remark/unified deps to resolve Vitest jsdom compatibility#45DavidsonRafaelK wants to merge 1 commit into
DavidsonRafaelK wants to merge 1 commit into
Conversation
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
Fixes #27 —
solid-markdownv2 causesTypeError: util.deprecate is not a functionwhen used in Vitest with ajsdomenvironment.The root cause is that
remark-parse,unified, and other runtime deps are listed underdependencies, so they are not bundled into the library output. Consumers' bundlers have to resolve them directly, and when Vitest resolvesmicromark(a transitive dep ofremark-parse) with the"development"export condition, it pulls indebug→ Node.jsutil— which is externalized in jsdom and breaks.What changes
Moved all runtime dependencies (
remark-parse,remark-rehype,unified,vfile,unist-util-visit,property-information,comma-separated-tokens,space-separated-tokens,style-to-object) fromdependenciestodevDependencies.tsupautomatically externalizes packages independenciesbut bundles packages indevDependencies. With this change, the entire unified/remark pipeline is bundled intodist/, so consumers never resolvemicromarkthemselves — the issue goes away entirely.solid-jsstays as the onlypeerDependency, nothing else changes.Known issues
pnpm-lock.yamlis not updated in this PR since it would need a freshpnpm install. The lockfile will be regenerated on the next install.Notes for review
package.jsonis changed — no source code modifications needed.unifiedorremark-parsewith their own copies may see slightly larger bundle sizes, but this is the standard approach for Solid component libraries usingtsup-preset-solid.