You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e2db2c7
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(signals): chunk only the prod ESM dist, keep dev/node flat
The per-module tree only pays off for bundlers, which are the sole
consumers of the prod ESM path and scope-hoist it back into one module.
Serving the tree everywhere charged real costs elsewhere: vitest's
per-module SSR transform made the flush hot path ~2x slower (the CodSpeed
-47% on update-partial was this artifact, not the hook refactor, which
measures 0-5% in flat-vs-flat comparison), and unbundled node consumers
paid ~10% per-module-boundary overhead that CJS require can't ever
recoup through tree-shaking. Dev and node CJS return to flat single
files; dist/prod stays a preserveModules tree.
Co-authored-by: Cursor <[email protected]>
Copy file name to clipboardExpand all lines: .changeset/pay-for-use-treeshaking-phase-1.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
"@solidjs/signals": patch
3
3
---
4
4
5
-
Make `affects()` and `isPending()`/`latest()` pay-for-use (#2883, phase 1). The affects mark engine and sentinel propagation move out of `async.ts`/`scheduler.ts` into the `affects` feature module, and the whole isPending/latest verdict layer (probe, companions, re-ask classification, the `latest()` read path) moves to a new internal `verdict` module; both install nullable `GlobalQueue` hooks on import, so bundles that never import these APIs never ship their machinery. The published dist is now a per-module tree (`dist/dev/`, `dist/prod/`, `dist/node/`) instead of one flat file — statement-level tree-shaking can never drop a flat file's top-level hook installs, so the split is what makes the hooks pay off for npm consumers. `_`-prefixed property mangling runs as a single sequential pass with one shared name cache per tree, keeping mangled names consistent across module files.
5
+
Make `affects()` and `isPending()`/`latest()` pay-for-use (#2883, phase 1). The affects mark engine and sentinel propagation move out of `async.ts`/`scheduler.ts` into the `affects` feature module, and the whole isPending/latest verdict layer (probe, companions, re-ask classification, the `latest()` read path) moves to a new internal `verdict` module; both install nullable `GlobalQueue` hooks on import, so bundles that never import these APIs never ship their machinery. The prod ESM dist is now a per-module tree (`dist/prod/`) instead of one flat file — statement-level tree-shaking can never drop a flat file's top-level hook installs, so the split is what makes the hooks pay off for npm consumers. It is the only output that changes shape: bundlers are its sole consumers and scope-hoist it back into one module, so nobody pays the per-module-boundary call cost at runtime. Dev (`dist/dev.js`) and node CJS (`dist/node.cjs`) stay flat single files — dev bundle size doesn't matter and CJS can't tree-shake, while the flat hot path stays fast for unbundled and test-transformed consumers. `_`-prefixed property mangling runs as a single sequential pass with one shared name cache per prod output, keeping mangled names consistent across module files.
6
6
7
7
Measured on a minimal app (render + one signal) bundled from the published dist: 12.7 → 11.4 KB gzip. Core-primitives floor from src: 8.9 → 8.2 KB gzip. Apps importing every feature pay ~0.7 KB min of hook shims. A new `treeshake` test guards the retained-module graph and the floor's byte ceiling so re-coupling fails CI.
0 commit comments