fix(hub-ui): make json-render an optional peer - #235
Merged
Conversation
hub-ui's only source-level use of @devframes/json-render is a side-effect import for declaration merging (registering the 'json-render' dock entry type). Dist (runtime and .d.mts) never references json-render, so keeping it a required peer just forces every hub-ui install to auto-install the zod closure it pulls in, even for hosts that never render a json-render dock. Mirror the optional-peer shape @devframes/json-render already uses for its own optional @devframes/hub peer: keep @devframes/json-render in peerDependencies (for the workspace build graph and consumer typing) but mark it optional via peerDependenciesMeta. Hosts that render json-render docks now install @devframes/json-render(-ui) explicitly, which every existing example already does.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Intent
hub-ui's only source-level use of
@devframes/json-renderis a single side-effect import for declaration merging (src/client/types.ts), registering the'json-render'dock entry type on the hub's open dock union. All other mentions insrc/are comments/strings. Butpackage.jsondeclared it a non-optional peer, so npm≥7 auto-installs it — dragging the zod closure (~6 MB: zod 4.6 MB +@json-render/core0.9 MB +@json-render/vue) into every hub-ui install, even hosts that never render a json-render dock.Changes
packages/hub-ui/package.json:@devframes/json-renderstays inpeerDependencies(so the workspace build graph still typechecks and consumers still get the type) but is now markedoptional: trueviapeerDependenciesMeta, mirroring the shapepackages/json-render/package.jsonalready uses for its own optional@devframes/hubpeer.packages/hub-ui/src/client/types.ts: kept the plain (non-import type) side-effect import — TS rejects a type-only side-effect import since there are no bindings to mark as type-only — and added a comment explaining why, and that it's fully erased at build time regardless.Verification
dist/index.mjs,dist/index.d.mts,dist/client/embedded.js, anddist/client/standalone/**have zerojson-renderreferences, both before and after this change — the declaration merge never leaked into the published build, so demoting the peer is consumer-invisible.hub-vite-minimal,hub-next-minimal,hub-rsbuild-minimal,hub-vite,hub-next) already declares@devframes/json-renderand@devframes/json-render-uiexplicitly in its ownpackage.json— none relied on the transitive peer, so no example changes were needed.docs/guide/hub-initiate.md's renderer-modules section already cross-links todocs/guide/json-render.md, which spells out the two-package install — no doc gaps to close.pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm build— all green except one pre-existing, unrelatedtsnapisnapshot flake in@devframes/plugin-assets(a nondeterministic union-member ordering in generated.d.ts, reproduced identically on the unmodified base commit viagit stash).Created with the help of an agent.