perf: deflate dts rollups by splitting published types out of framework type graphs - #237
Merged
Conversation
…rk type graphs
- hub-ui: move DevframeBranding/DevframeDockPreferences/EmbeddedVisibility
into a Vue-free src/types.ts; client modules import from there instead of
the node entry importing types from Vue-using client files. Drops
dist/index.d.mts from 939 KB to 6.6 KB.
- plugin-messages: mark vue neverBundle on the client dts-only build so
useMessages()'s Reactive<MessagesState> stays an import('vue') reference
instead of inlining Vue's entire reactivity/runtime-core type surface.
Drops dist/client/index.d.mts from 935 KB to 2.1 KB. No JS output change
(useMessages genuinely returns a Vue-reactive value; the browser bundle
is still built separately by Vite with vue inlined as before).
✅ 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.
Summary
Deflates two ~0.9 MB declaration rollups that inlined a full framework's type surface for the sake of a handful of published types.
@devframes/hub-uidist/index.d.mtswas 939 KB — the node entry (createUi()) only publishes three config types (DevframeBranding,DevframeDockPreferences,EmbeddedVisibility), but they were previously defined inside client modules that importvue(./client/state/branding, in particular). tsdown's dts bundler followed that type chain and inlined Vue's entire runtime-core/reactivity declaration surface to describe them.Fix: moved the three published types into a new Vue-free
packages/hub-ui/src/types.ts, and flipped the import direction — the client modules (state/branding.ts,embedded/visibility.ts) now import their type fromsrc/types.tsinstead of the node entry importing from them.client/dock-preferences.ts(pure types, no other consumers) was folded directly intosrc/types.ts. No client module is reachable from the node entry's type graph anymore.Result:
dist/index.d.mts→ 6.6 KB.@devframes/plugin-messagesdist/client/index.d.mtswas 935 KB. Diagnosis: unlike this package's other exports,useMessages()genuinely returnsReactive<MessagesState>— a real Vue reactivity type, not a documentation-only import (the panel is a Vue app;mountMessages()mounts it withcreateApp). Sincevuewasn't marked external for this build, the dts bundler inlined Vue's whole reactivity/runtime-core surface just to spell outReactive<T>.This isn't the same pathology as hub-ui — it's a load-bearing framework type on a genuinely Vue-authored client entry, so relocating the type wouldn't help (
Reactive<T>still has to come fromvueeither way). Per the plan's third option, I markedvueasdeps.neverBundleon this build's dts-only config (dts: { emitDtsOnly: true }, so it has zero effect on JS output — the actual client bundle is still produced separately by the Vite lib build, with Vue inlined exactly as before). The declaration now referencesimport('vue').Reactive<...>instead of inlining it.Result:
dist/client/index.d.mts→ 2.1 KB.Sibling sweep
find packages plugins -path '*/dist/*' -name '*.d.mts' -size +200kreturns nothing after the fix — no other package exhibits this pathology (largest remaining isjson-render-ui/dist/spa.d.mtsat 122 KB, unrelated).Verification
tsnapiAPI snapshots (pnpm test) pass unchanged — the public shape of both packages is identical, this is purely a build/packaging fix.pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm buildall pass (102 test files / 1132 tests, 30/30 typecheck tasks, 23/23 build tasks).Note on plan location
This repo's
plan-038-dts-deflationworktree was branched from a plan file that isn't present under this worktree'splans/directory, so status is reported here instead of inplans/README.mdper the task instructions.Created with the help of an agent.