Skip to content

Commit 893834c

Browse files
ryansolidClaude via Cursor
andauthored
size: router scenarios on @solidjs/router 2.0.0-next.37 (#3909)
* chore(size): router scenarios on @solidjs/router 2.0.0-next.37, resolved through the `solid` condition Re-pin the size harness's router from 2.0.0-next.35 to 2.0.0-next.37 (solid-router#660: pay-for-use `isRouting`; `data-pending` on plain anchors is opt-in through `links: pendingLinks`) and re-base the two `+ router` scenarios. The scenarios now resolve the router through its `solid` export condition — `dist/index.jsx` plus the per-module output, the two JSX modules compiled by the measured checkout's compiler — the way @solidjs/vite-plugin resolves it, instead of the flat `default` build, whose `inlineDynamicImports` turned the lazy server-form fallback into a static edge to the action layer. Local, next @ 8d23a5a (brotli / minified): page: base + router 45,996 / 144,238 -> 41,244 / 129,175 (-4,752 / -15,063) page: live + router 47,326 / 148,683 -> 46,919 / 142,472 ( -407 / -6,211) Of which next.37 alone (flat build): base -2,065 / -6,621 — signals' `core/lanes.js` and `core/verdict.js` leave a page that renders no pending state; live +21 / +250 — that page reads `isPending`/`latest` itself, so nothing leaves and the router's own seam costs +250. The `solid` condition alone: base -2,687 / -8,442, live -428 / -6,461 (the server-form fallback becomes the lazy `serverForms.js` chunk). Caps lowered to local measured + 10 B at the 0.01 KB step: 46.02 -> 41.26 KB (recorded minified 129,175) and 47.29 -> 46.93 KB (142,472). No changeset: tooling only. Co-authored-by: Claude via Cursor <[email protected]> * chore(size): record CI confirmation of the router caps (Size run 37751396603) Co-authored-by: Claude via Cursor <[email protected]> --------- Co-authored-by: Claude via Cursor <[email protected]>
1 parent 469733e commit 893834c

5 files changed

Lines changed: 138 additions & 16 deletions

File tree

‎scripts/size/README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,25 @@ registry for nothing. The router's own modules report as the `other`
136136
package. These are not floors: their caps are inline, and the two page
137137
floors stay the gate on the runtime alone.
138138

139+
The router is resolved through its **`solid` export condition**
140+
(`solidConditions` in `scenarios.js`: `solid` ahead of Rolldown's browser
141+
set, the order `@solidjs/vite-plugin` gives Vite), which is `dist/index.jsx`
142+
plus the router's per-module output — two of those modules are JSX, compiled
143+
at measure time by the measured checkout's compiler like a compiled
144+
scenario's fixtures (the scenarios set `compile`), hydratable as an SSR'd
145+
app compiles them. That is what a Vite application ships. The package's
146+
`default` condition is a flat `dist/index.js` rolled up with
147+
`inlineDynamicImports`, which turns the lazy server-form fallback
148+
(`data/events`' `import("./serverForms.js")`) into a static edge to the
149+
action layer, `query` and the flight consumer — eager there, a lazy chunk
150+
under `solid`. Until 2026-10-08 (router `2.0.0-next.35`) the scenarios
151+
resolved the flat build and overstated the router by 2.7 KB brotli / 8.4 KB
152+
minified on the base page; the switch to `solid` landed with the
153+
`2.0.0-next.37` re-base (the dated notes in `scenarios.js` separate the two).
154+
Under `solid` the live + router page's eager graph is two chunks (Rolldown
155+
hoists the runtime the entry shares with the lazy server-form chunk into a
156+
statically-imported chunk), counted the way the compiled live page is.
157+
139158
## Compiled scenarios
140159

141160
The hand-written `app:` fixtures call the runtime directly and never compile

‎scripts/size/package-lock.json‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/size/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "cd ../.. && pnpm install --frozen-lockfile && pnpm build"
1313
},
1414
"devDependencies": {
15-
"@solidjs/router": "2.0.0-next.35",
15+
"@solidjs/router": "2.0.0-next.37",
1616
"rolldown": "1.2.11"
1717
}
1818
}

‎scripts/size/sc-router-app.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
// The instance, its routes and the route components are all reachable from
1313
// the root, so the router's runtime — matching, the integration, the
1414
// context, preloading, link claims — is retained, not just its imports.
15+
// Since `2.0.0-next.37` `data-pending` on anchors is opt-in
16+
// (`createRouter({ routes, links: pendingLinks })`) and nothing in the
17+
// router's navigation core reads `isPending` / `latest`; this page does not
18+
// opt in — it measures a router whose app renders no pending state (the
19+
// scenario's ledger note has the opt-in's cost).
1520
import {
1621
hydrate,
1722
Show,

‎scripts/size/scenarios.js‎

Lines changed: 107 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ const pageAlias = {
104104
...alias
105105
};
106106

107+
// The `solid` export condition (2026-10-08): how a Vite application resolves
108+
// `@solidjs/router` — @solidjs/vite-plugin puts `solid` ahead of the client
109+
// defaults (`['solid', ...defaultClientConditions]`), so the router's
110+
// `exports["."]` selects `dist/index.jsx` and its per-module output (two of
111+
// them JSX, compiled by the app's compiler — here the measured checkout's,
112+
// hydratable, through the scenario's `compile`) instead of the flat
113+
// `default` build, `dist/index.js`. The flat build is rolled up with
114+
// `inlineDynamicImports`, which turns `data/events`' lazy
115+
// `import("./serverForms.js")` — the server-form fallback — into a static
116+
// edge to `data/action`, `data/query`, signals' `action` and the flight
117+
// consumer; a Vite app ships that as a lazy chunk. Rolldown's own browser set
118+
// is `["import", "browser", "default"]`; `conditions` replaces it, so the set
119+
// is spelled out with `solid` first. Only the router has a `solid` condition
120+
// in these graphs — seroval and everything else resolve as before.
121+
const solidConditions = ["solid", "import", "browser", "default"];
122+
107123
// Observe tier (documentation/plans/observe-tier-plan.md): the artifacts the
108124
// `observe` export condition selects — wiring kept (attribution hook sites,
109125
// owner labels, edge counters, the diagnostics channel), checks folded. Its
@@ -4465,9 +4481,10 @@ module.exports = [
44654481
// The base page as an application ships it: with a router. The two page
44664482
// floors above carry no router, so the "base case" they gate is a page
44674483
// nobody deploys; this scenario is the same composition plus
4468-
// `@solidjs/router` 2.0 (`2.0.0-next.35`, pinned exactly in this
4469-
// directory's package.json — the Solid 2 line; a router upgrade is a
4470-
// re-base recorded like a Rolldown upgrade) with `createRouter`, two
4484+
// `@solidjs/router` 2.0 (`2.0.0-next.35` at landing, `2.0.0-next.37`
4485+
// since 2026-10-08, pinned exactly in this directory's package.json —
4486+
// the Solid 2 line; a router upgrade is a re-base recorded like a
4487+
// Rolldown upgrade, below) with `createRouter`, two
44714488
// routes (one `preload`, one lazy), the instance as the hydrated root
44724489
// and `useNavigate` in a route component. Not a floor: an inline cap,
44734490
// and the router's growth is the router's — this scenario attributes it
@@ -4506,9 +4523,58 @@ module.exports = [
45064523
// into it while it is live (`liveTx`, `holdNode`). Cap set at measured + 10
45074524
// B rounded up to 0.01 KB. Accepted by the maintainer 2026-10-07 on the
45084525
// condition hello world stays under 10 KB.
4509-
limit: "46.02 KB",
4510-
capMinified: 144223,
4511-
alias: pageAlias
4526+
// Router 2.0.0-next.35 -> 2.0.0-next.37 and the `solid` condition
4527+
// (2026-10-08, next @ 8d23a5a13): 46.02 KB -> 41.26 KB. Two changes,
4528+
// measured apart (local bytes; minified exact, brotli ±tens vs CI):
4529+
// 1. next.37 (solid-router#660, pay-for-use `isRouting`): on the flat
4530+
// build 45,996 / 144,238 -> 43,931 / 137,617 (−2,065 B br / −6,621
4531+
// B minified). The router's navigation core no longer reads
4532+
// `isPending` / `latest` — intent, the redirect hop count, the
4533+
// leave-guard destination and scroll restoration use its own
4534+
// location writes and `onSettled` — so signals' verdict machinery
4535+
// left this page entirely: `core/lanes.js` −5,150 and
4536+
// `core/verdict.js` −2,585 (signals 41,698 -> 34,081). The router's
4537+
// own bytes grew +487 (27,395 -> 27,882): scroll restoration now
4538+
// hands a server-rendered document load back to the browser's
4539+
// native restore and settles traversals through `onSettled`
4540+
// (`routers/scrollRestoration.js` 868 -> 1,238 under `solid`), and
4541+
// the settle-based coordination replaces the verdict reads
4542+
// (`routing.js` itself shrank, 6,915 -> 6,531); `pending.js` — the
4543+
// opt-in readers — is exported and shaken. `data-pending` on plain
4544+
// anchors is opt-in now
4545+
// (`createRouter({ routes, links: pendingLinks })`); this fixture
4546+
// never opted in — next.35 applied it by default — so it measures
4547+
// the default. With the opt-in (measured, not a scenario): +8,635 /
4548+
// +4,301 under `solid` — `pending.js` 532 and lanes + verdict back
4549+
// (≈7.5 K minified), plus Rolldown hoisting the shared runtime into a
4550+
// statically-imported chunk again (two brotli streams). That is the
4551+
// shape the live + router scenario already carries, so no third
4552+
// router scenario.
4553+
// 2. The `solid` export condition (solidConditions above; this is what
4554+
// a Vite app ships): 43,931 / 137,617 -> 41,244 / 129,175 (−2,687 /
4555+
// −8,442). The flat `default` build inlines the server-form fallback;
4556+
// under `solid` it is the lazy `serverForms.js` chunk (8,972 B
4557+
// minified / 3,583 B br: `data/serverForms`, `data/action`,
4558+
// `data/query`, signals' `core/action.js`, the flight consumer).
4559+
// The router is 20,237 B minified eager here (`routing.js` 6,531,
4560+
// `utils.js` 2,785, `routers/factory.jsx` 2,622, `data/events.js`
4561+
// 2,068, `routers/components.jsx` 1,338, `claims.js` 1,263,
4562+
// `routers/scrollRestoration.js` 1,238, `routers/history.js` 1,051,
4563+
// `paths.js` 460, `serverRouteShared.js` 435), 28,327 on the flat
4564+
// build. On next.35 the condition alone was worth −623 / −7,195
4565+
// (45,373 / 137,043; there the entry split into two eager chunks).
4566+
// The ledger before this line is flat-build bytes; deltas must not
4567+
// be read across it.
4568+
// Against the base page's 33,910 / 105,413 the router's marginal is
4569+
// now +7,334 B br / +23,762 B minified (was +12,086 / +38,825). One
4570+
// eager chunk. Cap at measured + 10 B rounded up to 0.01 KB; recorded
4571+
// minified 129,175 B. CI-confirmed to the byte (Size run 37751396603:
4572+
// 41,244 / 129,175).
4573+
limit: "41.26 KB",
4574+
capMinified: 129175,
4575+
alias: pageAlias,
4576+
conditions: solidConditions,
4577+
compile: { hydratable: true }
45124578
},
45134579
{
45144580
name: "page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate)",
@@ -4535,9 +4601,41 @@ module.exports = [
45354601
// into it while it is live (`liveTx`, `holdNode`). Cap set at measured + 10
45364602
// B rounded up to 0.01 KB. Accepted by the maintainer 2026-10-07 on the
45374603
// condition hello world stays under 10 KB.
4538-
limit: "47.29 KB",
4539-
capMinified: 148668,
4540-
alias: pageAlias
4604+
// Router 2.0.0-next.35 -> 2.0.0-next.37 and the `solid` condition
4605+
// (2026-10-08, next @ 8d23a5a13; see the base + router note): 47.29 KB
4606+
// -> 46.93 KB. Measured apart (local bytes):
4607+
// 1. next.37 on the flat build: 47,326 / 148,683 -> 47,347 / 148,933
4608+
// (+21 B br / +250 B minified). Nothing left: this page reads
4609+
// `isPending` / `latest` on its own signal and ships an `action`, so
4610+
// signals' lanes (5,171) and verdict (2,596) are the page's, not the
4611+
// router's — what left the base page is exactly what this page keeps
4612+
// for itself. The +250 is the router's own (27,512 -> 27,801), the
4613+
// price of the pay-for-use seam on a page that pays for use.
4614+
// 2. The `solid` condition: 47,347 / 148,933 -> 46,919 / 142,472 (−428
4615+
// / −6,461). The server-form fallback is the lazy `serverForms.js`
4616+
// chunk (8,283 / 3,310; smaller than on the base page because
4617+
// signals' `action` is already eager here). The eager graph is TWO
4618+
// chunks on this page: Rolldown hoists the runtime the entry shares
4619+
// with that lazy chunk into `client.js` (85,618 / 27,801), imported
4620+
// statically by the entry (56,854 / 19,118) — counted, as bundle.mjs
4621+
// counts it (the compiled live page splits the same way). Two brotli
4622+
// streams cost 1,393 B over the same bytes as one (45,526), which is
4623+
// why −6,461 minified is only −428 br. The base + router page does
4624+
// not split: with lanes/verdict out of its entry, nothing the lazy
4625+
// chunk needs is shared.
4626+
// With `links: pendingLinks` (measured, not a scenario): +516 /
4627+
// +154 — `pending.js` 532 and the claims plugin's wiring; the verdict
4628+
// machinery is already here.
4629+
// Against the live page's 37,610 / 117,456 the router's marginal is
4630+
// now +9,309 B br / +25,016 B minified (was +9,716 / +31,227). Cap at
4631+
// measured + 10 B rounded up to 0.01 KB; recorded minified 142,472 B.
4632+
// CI-confirmed to the byte, two chunks included (Size run 37751396603:
4633+
// 46,919 / 142,472; `client.js` 85,618 / 27,801).
4634+
limit: "46.93 KB",
4635+
capMinified: 142472,
4636+
alias: pageAlias,
4637+
conditions: solidConditions,
4638+
compile: { hydratable: true }
45414639
},
45424640
{
45434641
name: "server: floor (getRequestEvent + isServer)",

0 commit comments

Comments
 (0)