@nifrajs/web 2.14.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/boundary.d.ts +158 -0
  2. package/dist/boundary.d.ts.map +1 -0
  3. package/dist/boundary.js +237 -0
  4. package/dist/boundary.js.map +1 -0
  5. package/dist/build-plan.d.ts +228 -0
  6. package/dist/build-plan.d.ts.map +1 -0
  7. package/dist/build-plan.js +514 -0
  8. package/dist/build-plan.js.map +1 -0
  9. package/dist/build-vite.d.ts +2 -1
  10. package/dist/build-vite.d.ts.map +1 -1
  11. package/dist/build-vite.js +5 -3
  12. package/dist/build-vite.js.map +1 -1
  13. package/dist/build.d.ts +2 -197
  14. package/dist/build.d.ts.map +1 -1
  15. package/dist/build.js +92 -515
  16. package/dist/build.js.map +1 -1
  17. package/dist/chunk-names.d.ts.map +1 -1
  18. package/dist/chunk-names.js +3 -2
  19. package/dist/chunk-names.js.map +1 -1
  20. package/dist/dev-ssr-graph.d.ts.map +1 -1
  21. package/dist/dev-ssr-graph.js +63 -28
  22. package/dist/dev-ssr-graph.js.map +1 -1
  23. package/dist/diagnostic.d.ts.map +1 -1
  24. package/dist/diagnostic.js +9 -2
  25. package/dist/diagnostic.js.map +1 -1
  26. package/dist/fonts-google.d.ts.map +1 -1
  27. package/dist/fonts-google.js +3 -1
  28. package/dist/fonts-google.js.map +1 -1
  29. package/dist/fs.d.ts.map +1 -1
  30. package/dist/fs.js +2 -1
  31. package/dist/fs.js.map +1 -1
  32. package/dist/index.d.ts +16 -589
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +23 -1824
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal/codegen.d.ts +68 -0
  37. package/dist/internal/codegen.d.ts.map +1 -0
  38. package/dist/internal/codegen.js +317 -0
  39. package/dist/internal/codegen.js.map +1 -0
  40. package/dist/internal/fetcher-runtime.d.ts +19 -0
  41. package/dist/internal/fetcher-runtime.d.ts.map +1 -0
  42. package/dist/internal/fetcher-runtime.js +26 -0
  43. package/dist/internal/fetcher-runtime.js.map +1 -0
  44. package/dist/internal/head-merge.d.ts +2 -0
  45. package/dist/internal/head-merge.d.ts.map +1 -1
  46. package/dist/internal/head-merge.js +17 -1
  47. package/dist/internal/head-merge.js.map +1 -1
  48. package/dist/internal/identity-policy.d.ts +51 -0
  49. package/dist/internal/identity-policy.d.ts.map +1 -0
  50. package/dist/internal/identity-policy.js +67 -0
  51. package/dist/internal/identity-policy.js.map +1 -0
  52. package/dist/internal/parity.d.ts +104 -8
  53. package/dist/internal/parity.d.ts.map +1 -1
  54. package/dist/internal/parity.js +472 -56
  55. package/dist/internal/parity.js.map +1 -1
  56. package/dist/internal/query-runtime.d.ts +8 -0
  57. package/dist/internal/query-runtime.d.ts.map +1 -0
  58. package/dist/internal/query-runtime.js +29 -0
  59. package/dist/internal/query-runtime.js.map +1 -0
  60. package/dist/internal/render-document.d.ts +372 -0
  61. package/dist/internal/render-document.d.ts.map +1 -0
  62. package/dist/internal/render-document.js +744 -0
  63. package/dist/internal/render-document.js.map +1 -0
  64. package/dist/internal/runtime-contract.d.ts +48 -0
  65. package/dist/internal/runtime-contract.d.ts.map +1 -0
  66. package/dist/internal/runtime-contract.js +27 -0
  67. package/dist/internal/runtime-contract.js.map +1 -0
  68. package/dist/internal/web-app.d.ts +171 -0
  69. package/dist/internal/web-app.d.ts.map +1 -0
  70. package/dist/internal/web-app.js +844 -0
  71. package/dist/internal/web-app.js.map +1 -0
  72. package/dist/islands.d.ts +50 -2
  73. package/dist/islands.d.ts.map +1 -1
  74. package/dist/islands.js +96 -36
  75. package/dist/islands.js.map +1 -1
  76. package/dist/manifest.d.ts +41 -6
  77. package/dist/manifest.d.ts.map +1 -1
  78. package/dist/manifest.js.map +1 -1
  79. package/dist/module-graph.d.ts.map +1 -1
  80. package/dist/module-graph.js +22 -9
  81. package/dist/module-graph.js.map +1 -1
  82. package/dist/nano.d.ts +125 -0
  83. package/dist/nano.d.ts.map +1 -0
  84. package/dist/nano.js +190 -0
  85. package/dist/nano.js.map +1 -0
  86. package/dist/plugins/css-modules.js +2 -2
  87. package/dist/plugins/css-modules.js.map +1 -1
  88. package/dist/plugins/kit.d.ts +12 -0
  89. package/dist/plugins/kit.d.ts.map +1 -1
  90. package/dist/plugins/kit.js +62 -12
  91. package/dist/plugins/kit.js.map +1 -1
  92. package/dist/plugins/postcss.js +2 -2
  93. package/dist/plugins/postcss.js.map +1 -1
  94. package/dist/plugins/scss.js +2 -2
  95. package/dist/plugins/scss.js.map +1 -1
  96. package/dist/plugins/stylex.d.ts +70 -0
  97. package/dist/plugins/stylex.d.ts.map +1 -0
  98. package/dist/plugins/stylex.js +166 -0
  99. package/dist/plugins/stylex.js.map +1 -0
  100. package/dist/plugins/svg.js +2 -2
  101. package/dist/plugins/svg.js.map +1 -1
  102. package/dist/render-seam.d.ts +5 -0
  103. package/dist/render-seam.d.ts.map +1 -1
  104. package/dist/render-seam.js +10 -0
  105. package/dist/render-seam.js.map +1 -1
  106. package/dist/router.d.ts +11 -1
  107. package/dist/router.d.ts.map +1 -1
  108. package/dist/router.js +254 -47
  109. package/dist/router.js.map +1 -1
  110. package/dist/vite.d.ts.map +1 -1
  111. package/dist/vite.js +34 -16
  112. package/dist/vite.js.map +1 -1
  113. package/package.json +49 -2
  114. package/src/boundary.ts +407 -0
  115. package/src/build-plan.ts +741 -0
  116. package/src/build-vite.ts +6 -7
  117. package/src/build.ts +120 -730
  118. package/src/chunk-names.ts +3 -2
  119. package/src/dev-ssr-graph.ts +63 -28
  120. package/src/diagnostic.ts +14 -2
  121. package/src/fonts-google.ts +3 -1
  122. package/src/fs.ts +2 -1
  123. package/src/index.ts +107 -2553
  124. package/src/internal/codegen.ts +400 -0
  125. package/src/internal/fetcher-runtime.ts +36 -0
  126. package/src/internal/head-merge.ts +19 -1
  127. package/src/internal/identity-policy.ts +94 -0
  128. package/src/internal/parity.ts +603 -71
  129. package/src/internal/query-runtime.ts +31 -0
  130. package/src/internal/render-document.ts +1116 -0
  131. package/src/internal/runtime-contract.ts +54 -0
  132. package/src/internal/web-app.ts +1114 -0
  133. package/src/islands.ts +106 -40
  134. package/src/manifest.ts +50 -3
  135. package/src/module-graph.ts +23 -9
  136. package/src/nano.ts +246 -0
  137. package/src/plugins/css-modules.ts +2 -2
  138. package/src/plugins/kit.ts +65 -12
  139. package/src/plugins/postcss.ts +2 -2
  140. package/src/plugins/scss.ts +2 -2
  141. package/src/plugins/stylex.ts +298 -0
  142. package/src/plugins/svg.ts +2 -2
  143. package/src/render-seam.ts +6 -0
  144. package/src/router.ts +293 -51
  145. package/src/vite.ts +41 -15
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-plan.d.ts","sourceRoot":"","sources":["../src/build-plan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC;;6GAEyG;IACzG,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;IAC5D;;kEAE8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC;;;sEAGkE;IAClE,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC;;;;;uEAKmE;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;CACnE;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACv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,mBAAmB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,UAAU,CAW5E;AAED,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA0B3D;AAUD,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B;uDACmD;IACnD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC;qEACiE;IACjE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAClC;AAaD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAMxF;AAED,kGAAkG;AAClG,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3E;AAuBD,6GAA6G;AAC7G,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAS5D;AAED,gHAAgH;AAChH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAWjF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,aAAa,CAOf;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,YAAY,SAAuB,GAClC,MAAM,GAAG,SAAS,CAiBpB"}
@@ -0,0 +1,514 @@
1
+ import { basename as pathBasename } from "node:path";
2
+ // ===================================================================================================
3
+ // `nifra build --target` - package the engine above into one command that emits a full deploy dir.
4
+ //
5
+ // An app already declares everything the build needs through nifra's conventions: `adapter` +
6
+ // `clientModule` (nifra.config.ts / framework.ts), an optional `backend` (backend.ts), and `routes/`.
7
+ // The ONLY thing apps used to hand-write per target was the server entry (`_worker.ts`, `server-bun.ts`,
8
+ // …) - so we GENERATE it here (per target) instead of asking each app to ship five near-identical files.
9
+ // ===================================================================================================
10
+ /** A deploy target `nifra build --target <t>` can emit. `static` is pure SSG (no server). */
11
+ export const BUILD_TARGETS = ["bun", "node", "deno", "cf-pages", "vercel", "static"];
12
+ /** A type guard narrowing an arbitrary string to a {@link BuildTarget}. */
13
+ export function isBuildTarget(value) {
14
+ return BUILD_TARGETS.includes(value);
15
+ }
16
+ const finalPathSegment = (path) => {
17
+ // Do not use a repeated, unanchored regex here: a separator-heavy path followed by a
18
+ // non-separator can make the regex engine retry every possible start position (ReDoS).
19
+ let end = path.length;
20
+ while (end > 0) {
21
+ const code = path.charCodeAt(end - 1);
22
+ if (code !== 0x2f && code !== 0x5c)
23
+ break;
24
+ end -= 1;
25
+ }
26
+ const trimmed = path.slice(0, end);
27
+ const slash = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
28
+ return slash === -1 ? trimmed : trimmed.slice(slash + 1);
29
+ };
30
+ /**
31
+ * Resolve the target-specific deploy shape before any bundling starts. Keeping this decision pure
32
+ * means Bun and Vite strategies share the same output filename, server target, and hand-off text;
33
+ * the filesystem emitter only has to execute the plan.
34
+ */
35
+ export function planBuildTarget(target, outDir) {
36
+ if (target === "static") {
37
+ return {
38
+ target,
39
+ kind: "static",
40
+ serverTarget: undefined,
41
+ outputFile: undefined,
42
+ run: `static site → ${outDir} (serve the directory with any static host)`,
43
+ };
44
+ }
45
+ if (target === "cf-pages") {
46
+ return {
47
+ target,
48
+ kind: "server",
49
+ serverTarget: "browser",
50
+ outputFile: "_worker.js",
51
+ run: `Cloudflare Pages → ${outDir} (deploy: wrangler pages deploy ${finalPathSegment(outDir)})`,
52
+ };
53
+ }
54
+ if (target === "vercel") {
55
+ return {
56
+ target,
57
+ kind: "server",
58
+ serverTarget: "browser",
59
+ outputFile: "index.js",
60
+ run: `Vercel edge function → ${outDir}/index.js (wrap with your vercel.json or Build Output API)`,
61
+ };
62
+ }
63
+ return {
64
+ target,
65
+ kind: "server",
66
+ serverTarget: target === "node" ? "node" : target === "bun" ? "bun" : "browser",
67
+ outputFile: "server.js",
68
+ run: `${target} server → ${outDir} (run: ${target === "node" ? "node" : target} ${finalPathSegment(outDir)}/server.js)`,
69
+ };
70
+ }
71
+ const basename = (path) => pathBasename(path);
72
+ const nodeBuiltinOf = (im) => {
73
+ if (im.original?.startsWith("node:"))
74
+ return im.original;
75
+ if (im.path?.startsWith("node:"))
76
+ return im.path;
77
+ return undefined;
78
+ };
79
+ /**
80
+ * BFS the metafile import graph for the SHORTEST user-module path that pulls `builtin` into the
81
+ * bundle, returning it as display labels `[entryFile, …as-written specifiers…, builtin]`. The frontier
82
+ * starts at every `entryInput` (the route/user entrypoints) so the reported chain begins where the dev
83
+ * actually wrote `import` - the actionable root, not an arbitrary internal module. Traversal crosses
84
+ * only NON-`node:` edges (so Bun's polyfill chain never extends the path) and stops at the first edge
85
+ * whose target is the builtin. Returns `[builtin]` if no entry reaches it (defensive; a flagged builtin
86
+ * is reachable by construction). Pure - operates on the graph, never the emitted text.
87
+ */
88
+ function shortestBuiltinChain(inputs, entryInputs, builtin) {
89
+ const seen = new Set(entryInputs);
90
+ let frontier = entryInputs.map((node) => ({ node, chain: [node] }));
91
+ while (frontier.length > 0) {
92
+ const next = [];
93
+ for (const { node, chain } of frontier) {
94
+ for (const im of inputs[node]?.imports ?? []) {
95
+ // The builtin reached via THIS edge → the chain ends here (append the builtin label). Match on
96
+ // the same `node:` detection the finding used (`original` first, then resolved `path`).
97
+ if (nodeBuiltinOf(im) === builtin)
98
+ return [...chain, builtin];
99
+ const target = im.path;
100
+ // Only follow edges into user (non-`node:`) modules that exist in the input graph and haven't
101
+ // been visited - so the polyfill subtree can't lengthen the path and there are no cycles.
102
+ if (target === undefined ||
103
+ target.startsWith("node:") ||
104
+ inputs[target] === undefined ||
105
+ seen.has(target)) {
106
+ continue;
107
+ }
108
+ seen.add(target);
109
+ // Display the hop by its as-written specifier (`../db/client.ts`, `postgres`), falling back to
110
+ // the resolved path - that's what the dev recognizes in their source, not the resolved path.
111
+ next.push({ node: target, chain: [...chain, im.original ?? target] });
112
+ }
113
+ }
114
+ frontier = next;
115
+ }
116
+ return [builtin];
117
+ }
118
+ /**
119
+ * Scan a build's metafile for any `node:` builtin that a USER module pulled into a CLIENT output
120
+ * chunk, returning a sorted, deduped list of {@link NodeBuiltinFinding}s. Three graph facts combine so
121
+ * the report is precise AND actionable:
122
+ * 1. **What the user wrote** - only builtins imported by a NON-`node:` input count, so Bun's own
123
+ * polyfill chain (`node:crypto` → `node:buffer`/`node:stream`/…) doesn't bury the real cause.
124
+ * 2. **Where it landed** - the chunk is read from the per-output `inputs`, so the error names the
125
+ * emitted file to look at.
126
+ * 3. **How it got there** - the shortest import chain from a user entry to the builtin
127
+ * (`shortestBuiltinChain`), so the error points straight at the offending `import` line instead of
128
+ * leaving the dev to grep the dependency tree (the DX gap this closes).
129
+ * Graph-based (never the emitted text), so it survives minification and can't be fooled by a string
130
+ * literal that merely contains `"node:crypto"`. Pure + exported for unit testing. Empty ⇒ clean.
131
+ */
132
+ export function detectNodeBuiltinsInClient(graph) {
133
+ const inputs = graph.modules;
134
+ // (1) The builtins a user (non-polyfill) module imports directly - the ones the author controls.
135
+ const userImported = new Set();
136
+ for (const [inputKey, input] of Object.entries(inputs)) {
137
+ if (inputKey.startsWith("node:"))
138
+ continue; // a polyfill importing another builtin - not the cause
139
+ for (const im of input.imports ?? []) {
140
+ const builtin = nodeBuiltinOf(im);
141
+ if (builtin !== undefined)
142
+ userImported.add(builtin);
143
+ }
144
+ }
145
+ // The entry inputs (route/user entrypoints) - the chain BFS starts here so the reported path begins
146
+ // at the file the dev wrote an `import` in. Each output's `entryPoint` is one such input.
147
+ const entryInputs = [
148
+ ...new Set(Object.values(graph.chunks)
149
+ .map((output) => output.entryPoint)
150
+ .filter((entry) => entry !== undefined && !entry.startsWith("node:"))),
151
+ ];
152
+ // The chain per builtin is independent of the chunk, so compute it once per builtin (memoized).
153
+ const chains = new Map();
154
+ const chainFor = (builtin) => {
155
+ const cached = chains.get(builtin);
156
+ if (cached !== undefined)
157
+ return cached;
158
+ const chain = shortestBuiltinChain(inputs, entryInputs, builtin);
159
+ chains.set(builtin, chain);
160
+ return chain;
161
+ };
162
+ // (2) Locate which emitted chunk each user-imported builtin reached, via the per-output `inputs`.
163
+ const findings = new Map();
164
+ for (const [outputPath, output] of Object.entries(graph.chunks)) {
165
+ for (const inputKey of output.modules) {
166
+ if (!userImported.has(inputKey))
167
+ continue;
168
+ const chunk = basename(outputPath);
169
+ findings.set(`${inputKey}\0${chunk}`, {
170
+ builtin: inputKey,
171
+ chunk,
172
+ chain: chainFor(inputKey),
173
+ });
174
+ }
175
+ }
176
+ return [...findings.values()].sort((a, b) => a.builtin === b.builtin ? a.chunk.localeCompare(b.chunk) : a.builtin.localeCompare(b.builtin));
177
+ }
178
+ // ---------------------------------------------------------------------------------------------------
179
+ // `server-only` poison-import guard (§3.3/§5.1). The complement to the `.server` convention + the
180
+ // node-builtin guard: a module of PURE server logic with NO `node:` import (a secret-bearing constant,
181
+ // a server-only API call) that an author wants to FAIL LOUD if it reaches the client opts in with a
182
+ // side-effect `import "@nifrajs/web/server-only"` (Next's `import "server-only"`). On the SERVER build
183
+ // the marker is an empty no-op; the CLIENT build detects - via the SAME Bun metafile graph the
184
+ // node-builtin guard walks - any module that imports the marker AND lands in a client chunk, and fails
185
+ // the build with the import chain. Graph-based (never the emitted text), so it survives minification.
186
+ // ---------------------------------------------------------------------------------------------------
187
+ /** The marker specifier an author imports to opt a module into the client-leak guard. Matched on the
188
+ * import edge's *as-written* `original` first (the robust signal: it's exactly what the author typed,
189
+ * before Bun resolves it to `src/server-only.ts` / `dist/server-only.js`). */
190
+ export const SERVER_ONLY_MARKER = "@nifrajs/web/server-only";
191
+ const isServerOnlyMarkerImport = (im) => {
192
+ if (im.original === SERVER_ONLY_MARKER)
193
+ return true;
194
+ return im.path !== undefined && /(^|\/)server-only\.[cm]?[jt]s$/.test(im.path);
195
+ };
196
+ /** True when an INPUT graph key is the marker module file itself (`…/server-only.{ts,js}` under web).
197
+ * Excluded from the "marked" set - the marker is the import target, not an opt-in module. */
198
+ const isServerOnlyMarkerModule = (inputKey) => /(^|\/)server-only\.[cm]?[jt]s$/.test(inputKey);
199
+ /**
200
+ * Build a resolver from an import EDGE to its INPUT-GRAPH KEY. Bun's metafile records edge `path`s as
201
+ * ABSOLUTE paths but keys `inputs` by CWD-RELATIVE paths, so a raw `inputs[im.path]` lookup misses
202
+ * every user edge in a real build. The resolver: (1) an exact key match (the synthetic-metafile / unit
203
+ * case); else (2) the input key the absolute path ends with (`…/secrets.ts` → `packages/web/.../secrets.ts`).
204
+ * The longest-suffix match is taken so a shorter key can't shadow a more specific one. Pure.
205
+ */
206
+ function inputKeyResolver(inputs) {
207
+ const keys = Object.keys(inputs);
208
+ return (im) => {
209
+ const path = im.path;
210
+ if (path === undefined)
211
+ return undefined;
212
+ if (inputs[path] !== undefined)
213
+ return path;
214
+ let best;
215
+ for (const key of keys) {
216
+ if (path.endsWith(`/${key}`) && (best === undefined || key.length > best.length))
217
+ best = key;
218
+ }
219
+ return best;
220
+ };
221
+ }
222
+ /**
223
+ * BFS the metafile import graph for the SHORTEST user-module path that reaches a module which imports
224
+ * the `server-only` marker, returning it as display labels `[entryFile, …as-written specifiers…,
225
+ * "<module> (marked server-only)"]`. Mirrors {@link shortestBuiltinChain}: the frontier starts at
226
+ * every `entryInput` so the chain begins at the file the dev wrote an `import` in; traversal crosses
227
+ * only NON-`node:` user edges (no cycles via `seen`); it stops at the first node whose import set
228
+ * contains the marker (the marked module - the actionable tail), labelling that node by the as-written
229
+ * specifier the previous hop used to reach it. Pure - operates on the graph, never the emitted text.
230
+ */
231
+ function shortestServerOnlyChain(inputs, entryInputs, markedModule, resolveTarget) {
232
+ // The label for the marked module's tail: its as-written specifier (filled when we cross the edge
233
+ // that reaches it) suffixed with `(marked server-only)`; the entry case uses the entry key itself.
234
+ const tail = (label) => `${label} (marked server-only)`;
235
+ // An entry that is ITSELF the marked module - the chain is just that one node.
236
+ if (entryInputs.includes(markedModule))
237
+ return [tail(markedModule)];
238
+ const seen = new Set(entryInputs);
239
+ let frontier = entryInputs.map((node) => ({ node, chain: [node] }));
240
+ while (frontier.length > 0) {
241
+ const next = [];
242
+ for (const { node, chain } of frontier) {
243
+ for (const im of inputs[node]?.imports ?? []) {
244
+ // Resolve the edge's `path` to the matching INPUT-GRAPH KEY - in a real build the edge `path`
245
+ // is absolute while the input keys are cwd-relative, so a raw equality/lookup would miss every
246
+ // multi-hop user edge (and the chain would degrade to just the tail). The resolver maps both.
247
+ const target = resolveTarget(im);
248
+ if (target === undefined || target.startsWith("node:"))
249
+ continue;
250
+ // The marked module reached via THIS edge → the chain ends here (label it as the marked tail
251
+ // using the as-written specifier the author wrote, falling back to the resolved key).
252
+ if (target === markedModule)
253
+ return [...chain, tail(im.original ?? target)];
254
+ if (seen.has(target))
255
+ continue;
256
+ seen.add(target);
257
+ next.push({ node: target, chain: [...chain, im.original ?? target] });
258
+ }
259
+ }
260
+ frontier = next;
261
+ }
262
+ return [tail(markedModule)];
263
+ }
264
+ /**
265
+ * Scan a build's metafile for any module that opts into the `server-only` marker (a side-effect
266
+ * `import "@nifrajs/web/server-only"`) yet landed in a CLIENT output chunk, returning a sorted, deduped
267
+ * list of {@link ServerOnlyFinding}s. Mirrors {@link detectNodeBuiltinsInClient}: it reads the SAME
268
+ * graph facts - which inputs import the marker (the "marked" modules), which chunk each landed in (the
269
+ * per-output `inputs`), and the shortest import chain from a user entry to it. The marker module ITSELF
270
+ * (which imports nothing) is excluded - only the modules that *opt in* are flagged. Pure + exported for
271
+ * unit testing. Empty ⇒ clean.
272
+ */
273
+ export function detectServerOnlyInClient(graph) {
274
+ const inputs = graph.modules;
275
+ // (1) The modules that import the marker - the ones the author opted into the guard. The marker
276
+ // module itself is skipped: it's the import TARGET, not an opt-in (it imports nothing of its own).
277
+ const marked = new Set();
278
+ for (const [inputKey, input] of Object.entries(inputs)) {
279
+ if (isServerOnlyMarkerModule(inputKey))
280
+ continue;
281
+ if ((input.imports ?? []).some(isServerOnlyMarkerImport))
282
+ marked.add(inputKey);
283
+ }
284
+ if (marked.size === 0)
285
+ return [];
286
+ const entryInputs = [
287
+ ...new Set(Object.values(graph.chunks)
288
+ .map((output) => output.entryPoint)
289
+ .filter((entry) => entry !== undefined && !entry.startsWith("node:"))),
290
+ ];
291
+ // The entry inputs - the chain BFS starts here, so the reported path begins at the file the dev
292
+ // wrote an `import` in. Same derivation as the node-builtin guard.
293
+ const resolveTarget = inputKeyResolver(inputs);
294
+ const chains = new Map();
295
+ const chainFor = (module) => {
296
+ const cached = chains.get(module);
297
+ if (cached !== undefined)
298
+ return cached;
299
+ const chain = shortestServerOnlyChain(inputs, entryInputs, module, resolveTarget);
300
+ chains.set(module, chain);
301
+ return chain;
302
+ };
303
+ // (2) Locate which emitted chunk each marked module reached, via the per-output `inputs`.
304
+ const findings = new Map();
305
+ for (const [outputPath, output] of Object.entries(graph.chunks)) {
306
+ for (const inputKey of output.modules) {
307
+ if (!marked.has(inputKey))
308
+ continue;
309
+ const chunk = basename(outputPath);
310
+ findings.set(`${inputKey}\0${chunk}`, { chunk, chain: chainFor(inputKey) });
311
+ }
312
+ }
313
+ return [...findings.values()].sort((a, b) => {
314
+ const am = a.chain[a.chain.length - 1] ?? "";
315
+ const bm = b.chain[b.chain.length - 1] ?? "";
316
+ return am === bm ? a.chunk.localeCompare(b.chunk) : am.localeCompare(bm);
317
+ });
318
+ }
319
+ // ---------------------------------------------------------------------------------------------------
320
+ // Guard MESSAGES - one owner for both production pipelines. The Bun build and the Vite/Rollup leak-guard
321
+ // plugin both call these, so a leak reads IDENTICALLY whichever bundler produced it. A second bundler
322
+ // must not grow a second, subtly-different wording of a security error; that is exactly the "mostly
323
+ // ported" outcome the neutral graph seam exists to prevent.
324
+ // ---------------------------------------------------------------------------------------------------
325
+ /** The build-failing message for `node:` builtins that reached the client bundle. `undefined` ⇒ clean. */
326
+ export function formatNodeBuiltinLeak(findings) {
327
+ if (findings.length === 0)
328
+ return undefined;
329
+ const lines = findings.map((finding) => finding.chain.length > 1
330
+ ? ` - ${finding.builtin} reached the client bundle via ${finding.chain.join(" → ")} (chunk: ${finding.chunk})`
331
+ : ` - ${finding.builtin} reached the client bundle via ${finding.chunk}`);
332
+ return (`[nifra/web] Node built-in(s) in the client bundle - move them behind a server-only path ` +
333
+ `(a loader/action runs on the server; import the \`node:\` module there, not at a route's ` +
334
+ `top level):\n${lines.join("\n")}`);
335
+ }
336
+ /** The build-failing message for `server-only`-marked modules that reached the client. `undefined` ⇒ clean. */
337
+ export function formatServerOnlyLeak(findings) {
338
+ if (findings.length === 0)
339
+ return undefined;
340
+ const lines = findings.map((finding) => finding.chain.length > 1
341
+ ? ` - server-only module reached the client bundle via ${finding.chain.join(" → ")} (chunk: ${finding.chunk})`
342
+ : ` - server-only module reached the client bundle via ${finding.chunk}`);
343
+ return (`[nifra/web] server-only module(s) in the client bundle - a module marked ` +
344
+ `\`import "${SERVER_ONLY_MARKER}"\` reached the browser. Move it behind a server-only path ` +
345
+ `(reach it via a loader/action, or rename it \`*.server.ts\`), so its server logic never ships ` +
346
+ `to the client:\n${lines.join("\n")}`);
347
+ }
348
+ /**
349
+ * Aggregate a list of measured chunks into a {@link SizeReport}: sort biggest-gzip-first (ties broken
350
+ * by raw bytes, then name for stable output) and sum the totals. Pure - the measurement (reading the
351
+ * file + gzipping it) happens in the orchestrator; this is the deterministic, unit-testable core.
352
+ */
353
+ export function aggregateSizeReport(chunks) {
354
+ const sorted = [...chunks].sort((a, b) => b.gzip - a.gzip || b.bytes - a.bytes || a.name.localeCompare(b.name));
355
+ let totalBytes = 0;
356
+ let totalGzip = 0;
357
+ for (const chunk of sorted) {
358
+ totalBytes += chunk.bytes;
359
+ totalGzip += chunk.gzip;
360
+ }
361
+ return { chunks: sorted, totalBytes, totalGzip };
362
+ }
363
+ /** Human-readable byte count: `B`/`KB`/`MB` with one decimal above 1 KB (e.g. `12.3 KB`). Pure. */
364
+ export function formatBytes(bytes) {
365
+ if (bytes < 1024)
366
+ return `${bytes} B`;
367
+ if (bytes < 1024 * 1024)
368
+ return `${(bytes / 1024).toFixed(1)} KB`;
369
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
370
+ }
371
+ /**
372
+ * Render a {@link SizeReport} as a terse aligned table (biggest first) with a totals row - the text
373
+ * `nifra build --report` prints. Pure (string in, string out) so the formatting is unit-testable.
374
+ */
375
+ export function renderSizeReport(report) {
376
+ const rows = report.chunks.map((chunk) => ({
377
+ name: chunk.name,
378
+ raw: formatBytes(chunk.bytes),
379
+ gz: formatBytes(chunk.gzip),
380
+ }));
381
+ // Column widths from the header + every row + the totals label, so the table never clips a value.
382
+ const nameW = Math.max(5, ...rows.map((row) => row.name.length), "Total".length);
383
+ const rawW = Math.max(3, ...rows.map((row) => row.raw.length), formatBytes(report.totalBytes).length);
384
+ const gzW = Math.max(4, ...rows.map((row) => row.gz.length), formatBytes(report.totalGzip).length);
385
+ const padEnd = (value, width) => value + " ".repeat(Math.max(0, width - value.length));
386
+ const padStart = (value, width) => " ".repeat(Math.max(0, width - value.length)) + value;
387
+ const line = (name, raw, gzip) => ` ${padEnd(name, nameW)} ${padStart(raw, rawW)} ${padStart(gzip, gzW)}`;
388
+ return [
389
+ line("Chunk", "Raw", "Gzip"),
390
+ line("-".repeat(nameW), "-".repeat(rawW), "-".repeat(gzW)),
391
+ ...rows.map((row) => line(row.name, row.raw, row.gz)),
392
+ line("Total", formatBytes(report.totalBytes), formatBytes(report.totalGzip)),
393
+ ].join("\n");
394
+ }
395
+ // The route-relative file keys the generated manifest's route map declares. Both shapes are matched by
396
+ // their VALUE: eager ` "routes/x.tsx": m0,` and lazy ` "routes/x.tsx": () => import("./routes/x"),`.
397
+ // The KEY (not the import specifier) is the route identity `discoverRoutes` produces, extension and all;
398
+ // the import specifier is emitted extensionless (so a bare `tsc` compiles the manifest) and could not be
399
+ // mapped back to the exact `.tsx`/`.ts` key. The baked `routeStyles` JSON is a single line, so its keys
400
+ // are never at an indented line start and never match. `[ \t]+` (not `\s+`) so the `m` anchor stays on
401
+ // the same line and one route-map entry cannot span two lines of source.
402
+ const MANIFEST_ROUTE_ENTRY = /^[ \t]+(["'])([^"'\n]+)\1\s*:\s*(?:m\d+\b|\(\s*\)\s*=>\s*import\b)/gm;
403
+ // The baked client-entry line: `export const clientEntry = "…"`.
404
+ const MANIFEST_CLIENT_ENTRY = /export\s+const\s+clientEntry\s*=\s*["']([^"']+)["']/;
405
+ /**
406
+ * Extract the route-relative file list a committed server-manifest declares, as the same
407
+ * `routes/`-relative keys `discoverRoutes` produces (e.g. `docs/index.tsx`). Reads the route map's KEYS,
408
+ * which carry the file extension and no directory prefix - exactly discovery's shape - so the result is
409
+ * independent of the specifier prefix the manifest happened to import with. The `@nifrajs/web` import and
410
+ * the baked `clientEntry`/`styles`/`routeStyles` lines carry no route-map entry and are ignored.
411
+ *
412
+ * `_routesPrefix` is accepted for call-site compatibility but no longer needed: the keys are already
413
+ * prefix-free. Pure - operates on source text.
414
+ */
415
+ export function parseManifestRouteFiles(source, _routesPrefix) {
416
+ const files = new Set();
417
+ for (const match of source.matchAll(MANIFEST_ROUTE_ENTRY)) {
418
+ if (match[2] !== undefined)
419
+ files.add(match[2]);
420
+ }
421
+ return [...files].sort();
422
+ }
423
+ /** The baked `clientEntry` URL in a committed server-manifest, or `undefined` if absent. Pure. */
424
+ export function parseManifestClientEntry(source) {
425
+ return MANIFEST_CLIENT_ENTRY.exec(source)?.[1];
426
+ }
427
+ // The baked asset lines `generateServerManifest` emits: `export const styles = […]` then
428
+ // `export const routeStyles = {…}`, each a JSON literal running to the next `export const`. Extracted
429
+ // with `indexOf` slicing rather than a lazy `[\s\S]*?` regex: the slice is multi-line by nature (a
430
+ // formatter can wrap a long `routeStyles` map, and missing it would silently DROP every baked
431
+ // stylesheet on re-sync), and a lazy scan re-walks the file per unterminated opener - quadratic.
432
+ function bakedManifestLiteral(source, name) {
433
+ const opener = `export const ${name} = `;
434
+ const start = source.indexOf(opener);
435
+ if (start === -1)
436
+ return undefined;
437
+ const from = start + opener.length;
438
+ const end = source.indexOf("\nexport const ", from);
439
+ return end === -1 ? undefined : source.slice(from, end);
440
+ }
441
+ /** Parse a baked JSON literal captured from a committed manifest, tolerating a formatter's TRAILING COMMAS
442
+ * (biome/prettier add one when wrapping a multi-line array/object; strict `JSON.parse` would reject it).
443
+ * Only a comma immediately before a closing `]`/`}` is stripped, so commas inside string values are safe. */
444
+ function parseManifestLiteral(raw) {
445
+ return JSON.parse(raw.replace(/,(\s*[\]}])/g, "$1"));
446
+ }
447
+ /** The baked top-level `styles` array in a committed server-manifest (empty if absent/unparseable). Pure. */
448
+ export function parseManifestStyles(source) {
449
+ const raw = bakedManifestLiteral(source, "styles");
450
+ if (raw === undefined)
451
+ return [];
452
+ try {
453
+ const value = parseManifestLiteral(raw);
454
+ return Array.isArray(value) ? value : [];
455
+ }
456
+ catch {
457
+ return [];
458
+ }
459
+ }
460
+ /** The baked per-route `routeStyles` map in a committed server-manifest (empty if absent/unparseable). Pure. */
461
+ export function parseManifestRouteStyles(source) {
462
+ const raw = bakedManifestLiteral(source, "routeStyles");
463
+ if (raw === undefined)
464
+ return {};
465
+ try {
466
+ const value = parseManifestLiteral(raw);
467
+ return value !== null && typeof value === "object" && !Array.isArray(value)
468
+ ? value
469
+ : {};
470
+ }
471
+ catch {
472
+ return {};
473
+ }
474
+ }
475
+ /**
476
+ * Diff the route files a committed server-manifest imports against the files freshly discovered in
477
+ * `routes/`. Returns the `missing` (in routes/, not in manifest - stale manifest) and `extra` (in
478
+ * manifest, gone from routes/ - dangling import) sets. Empty arrays ⇒ in sync. Pure - the caller
479
+ * supplies both file lists (the committed source is parsed via {@link parseManifestRouteFiles}; the
480
+ * fresh list comes from `discoverRoutes`). Lists need not be pre-sorted; the result is sorted.
481
+ */
482
+ export function diffManifestRoutes(manifestFiles, discoveredFiles) {
483
+ const inManifest = new Set(manifestFiles);
484
+ const inRoutes = new Set(discoveredFiles);
485
+ return {
486
+ missing: discoveredFiles.filter((file) => !inManifest.has(file)).sort(),
487
+ extra: manifestFiles.filter((file) => !inRoutes.has(file)).sort(),
488
+ };
489
+ }
490
+ /** True when a drift report is clean (no missing + no extra routes). */
491
+ export function isManifestInSync(drift) {
492
+ return drift.missing.length === 0 && drift.extra.length === 0;
493
+ }
494
+ /**
495
+ * Format a {@link ManifestDrift} as a named, actionable error message, or `undefined` when in sync.
496
+ * Names the exact missing/extra routes + the one fix (regenerate the manifest by re-running the build).
497
+ * `manifestPath` is shown for the dev to locate the stale file. Pure.
498
+ */
499
+ export function formatManifestDrift(drift, manifestPath = "server-manifest.ts") {
500
+ if (isManifestInSync(drift))
501
+ return undefined;
502
+ const lines = [
503
+ `[nifra/web] server-manifest drift - \`${manifestPath}\` is out of sync with routes/.`,
504
+ ];
505
+ if (drift.missing.length > 0) {
506
+ lines.push(` Missing (in routes/, not in the manifest - these routes won't be served): ${drift.missing.join(", ")}`);
507
+ }
508
+ if (drift.extra.length > 0) {
509
+ lines.push(` Extra (imported by the manifest, gone from routes/ - a dangling import): ${drift.extra.join(", ")}`);
510
+ }
511
+ lines.push(" Fix: re-run the build to regenerate the server manifest, then commit it.");
512
+ return lines.join("\n");
513
+ }
514
+ //# sourceMappingURL=build-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-plan.js","sourceRoot":"","sources":["../src/build-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AAsCpD,sGAAsG;AACtG,mGAAmG;AACnG,EAAE;AACF,8FAA8F;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,CAAC,CAAC,IAAI,EAAE;KAClE,CAAA;AACH,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,gBAAgB,CAAC,KAAoB;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAoB,EACpB,YAAY,GAAG,oBAAoB;IAEnC,IAAI,gBAAgB,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAC7C,MAAM,KAAK,GAAG;QACZ,yCAAyC,YAAY,iCAAiC;KACvF,CAAA;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CACR,+EAA+E,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC1G,CAAA;IACH,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CACR,8EAA8E,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvG,CAAA;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;IACxF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -1,4 +1,5 @@
1
- import { type BuildClientOptions, type BuildManifest, type BuildTarget, type BuildTargetOptions, type BuildTargetResult, type Bundler, type ServerBuild } from "./build.js";
1
+ import { type BuildClientOptions, type BuildTargetOptions, type BuildTargetResult } from "./build.js";
2
+ import type { BuildManifest, BuildTarget, Bundler, ServerBuild } from "./build-plan.js";
2
3
  /** Options for {@link buildClientVite} - the Bun {@link BuildClientOptions} minus Bun-plugin specifics,
3
4
  * plus the Vite plugin list the app injects for its transforms. */
4
5
  export interface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CAC7B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
@@ -22,6 +22,7 @@ import { dirname, join, relative, resolve as resolvePath } from "node:path";
22
22
  import { buildTargetWith, copyPublicDir, publicEnvDefines, } from "./build.js";
23
23
  import { discoverRoutes } from "./fs.js";
24
24
  import { generateClientEntry, generateServerManifest } from "./index.js";
25
+ import { viteDedupePackages } from "./internal/identity-policy.js";
25
26
  import { assertDevelopmentProductionParity, assertIdentityParity, collectDevelopmentParityInput, } from "./internal/parity.js";
26
27
  import { vitePublicEnvPrefix } from "./internal/server-boundary.js";
27
28
  import { importVite, isViteUnresolved } from "./internal/vite-import.js";
@@ -147,9 +148,10 @@ export async function buildClientVite(options) {
147
148
  ...(options.define ?? {}),
148
149
  },
149
150
  resolve: {
150
- // Mirror the Bun build's reactDedupePlugin: one physical react/react-dom, or a hook-using route
151
- // gets a second dispatcher. No-op when the app isn't React.
152
- dedupe: ["react", "react-dom"],
151
+ // Same framework coverage as the Bun build's dedupe plugins, from the one policy table: one
152
+ // physical copy of react/react-dom, preact, and svelte, or a hook-using route gets a second
153
+ // dispatcher/options global. No-op per framework the app does not use.
154
+ dedupe: [...viteDedupePackages()],
153
155
  ...(options.conditions ? { conditions: [...options.conditions] } : {}),
154
156
  },
155
157
  css: {