@nifrajs/web-react 2.7.0 → 2.8.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.
|
@@ -65,6 +65,16 @@ export declare function assertSingleReactCore(reactDomServerPath: string, resolv
|
|
|
65
65
|
* without depending on the machine's node_modules layout.
|
|
66
66
|
*/
|
|
67
67
|
export declare function loadReactDomServer(resolve?: ResolveSync | undefined): Promise<ReactDomServer>;
|
|
68
|
+
/**
|
|
69
|
+
* Whether this module is executing from inside a bundle rather than as its own file. Bundling rewrites
|
|
70
|
+
* `import.meta.url` to the OUTPUT file (`server-bun.js`, `server.mjs`, …), so when the basename is no
|
|
71
|
+
* longer `react-dom-server.*` (the `.ts` source under the Bun workspace runtime, the `.js` in the
|
|
72
|
+
* published dist), this module has been concatenated into a bundle. The second, marker-free layer of
|
|
73
|
+
* bundle detection: it catches a server bundled by hand (`bun build --target bun` without `buildServer`),
|
|
74
|
+
* which keeps `Bun.resolveSync` but never defines `NIFRA_SSR_BUNDLED`. `url` is injectable for tests;
|
|
75
|
+
* runtime callers pass nothing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function moduleLooksBundled(url?: string): boolean;
|
|
68
78
|
/**
|
|
69
79
|
* The resolver `loadReactDomServer` uses by default, or `undefined` when re-rooting must NOT happen - a
|
|
70
80
|
* non-Bun host (no `Bun.resolveSync`; the static import is the only path) OR a BUNDLED SSR output.
|
|
@@ -73,7 +83,13 @@ export declare function loadReactDomServer(resolve?: ResolveSync | undefined): P
|
|
|
73
83
|
* a SECOND react-dom from disk (a `target:"bun"` bundle still has `Bun.resolveSync`), giving the bundled
|
|
74
84
|
* components a foreign/null hook dispatcher → the `…H.useRef of null` crash. The marker is read here (per
|
|
75
85
|
* call, not at module load) so it stays driveable from a test. Unbundled Bun runtimes don't set it, so
|
|
76
|
-
* dev/start still re-root. Exported for unit testing the gate.
|
|
86
|
+
* dev/start still re-root. Exported for unit testing the gate.
|
|
87
|
+
*
|
|
88
|
+
* A bundle produced WITHOUT `buildServer` has no marker, so `moduleLooksBundled` backstops it: re-rooting
|
|
89
|
+
* inside such a bundle re-imports react-dom from disk, where the dev/prod switch reads the RUNTIME
|
|
90
|
+
* `NODE_ENV` - with hooks that is the dual-core crash, without hooks it silently renders with development
|
|
91
|
+
* React (a large SSR slowdown that looks like a runtime regression). Bundled output takes the static
|
|
92
|
+
* import, whose react-dom the bundle already inlined and deduped. */
|
|
77
93
|
export declare function bunResolverFn(): ResolveSync | undefined;
|
|
78
94
|
export {};
|
|
79
95
|
//# sourceMappingURL=react-dom-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-dom-server.d.ts","sourceRoot":"","sources":["../src/react-dom-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;wFACwF;AACxF,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAA;IACvC,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAA;CAC7E;AA6CD;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAIxD;AAED,6EAA6E;AAC7E,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAwB,GACnD,IAAI,CAsBN;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,WAAW,GAAG,SAA2B,GACjD,OAAO,CAAC,cAAc,CAAC,CAyBzB;AAED;;;;;;;;
|
|
1
|
+
{"version":3,"file":"react-dom-server.d.ts","sourceRoot":"","sources":["../src/react-dom-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;wFACwF;AACxF,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAA;IACvC,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAA;CAC7E;AA6CD;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAIxD;AAED,6EAA6E;AAC7E,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAwB,GACnD,IAAI,CAsBN;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,WAAW,GAAG,SAA2B,GACjD,OAAO,CAAC,cAAc,CAAC,CAyBzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAwB,GAAG,OAAO,CAGzE;AAED;;;;;;;;;;;;;;qEAcqE;AACrE,wBAAgB,aAAa,IAAI,WAAW,GAAG,SAAS,CAMvD"}
|
package/dist/react-dom-server.js
CHANGED
|
@@ -143,6 +143,19 @@ export async function loadReactDomServer(resolve = bunResolverFn()) {
|
|
|
143
143
|
// bundler include it (it's a constant), and at runtime resolves the copy visible to this package.
|
|
144
144
|
return (await import("react-dom/server"));
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Whether this module is executing from inside a bundle rather than as its own file. Bundling rewrites
|
|
148
|
+
* `import.meta.url` to the OUTPUT file (`server-bun.js`, `server.mjs`, …), so when the basename is no
|
|
149
|
+
* longer `react-dom-server.*` (the `.ts` source under the Bun workspace runtime, the `.js` in the
|
|
150
|
+
* published dist), this module has been concatenated into a bundle. The second, marker-free layer of
|
|
151
|
+
* bundle detection: it catches a server bundled by hand (`bun build --target bun` without `buildServer`),
|
|
152
|
+
* which keeps `Bun.resolveSync` but never defines `NIFRA_SSR_BUNDLED`. `url` is injectable for tests;
|
|
153
|
+
* runtime callers pass nothing.
|
|
154
|
+
*/
|
|
155
|
+
export function moduleLooksBundled(url = import.meta.url) {
|
|
156
|
+
const base = url.split(/[/\\]/).pop() ?? "";
|
|
157
|
+
return !base.startsWith("react-dom-server.");
|
|
158
|
+
}
|
|
146
159
|
/**
|
|
147
160
|
* The resolver `loadReactDomServer` uses by default, or `undefined` when re-rooting must NOT happen - a
|
|
148
161
|
* non-Bun host (no `Bun.resolveSync`; the static import is the only path) OR a BUNDLED SSR output.
|
|
@@ -151,10 +164,18 @@ export async function loadReactDomServer(resolve = bunResolverFn()) {
|
|
|
151
164
|
* a SECOND react-dom from disk (a `target:"bun"` bundle still has `Bun.resolveSync`), giving the bundled
|
|
152
165
|
* components a foreign/null hook dispatcher → the `…H.useRef of null` crash. The marker is read here (per
|
|
153
166
|
* call, not at module load) so it stays driveable from a test. Unbundled Bun runtimes don't set it, so
|
|
154
|
-
* dev/start still re-root. Exported for unit testing the gate.
|
|
167
|
+
* dev/start still re-root. Exported for unit testing the gate.
|
|
168
|
+
*
|
|
169
|
+
* A bundle produced WITHOUT `buildServer` has no marker, so `moduleLooksBundled` backstops it: re-rooting
|
|
170
|
+
* inside such a bundle re-imports react-dom from disk, where the dev/prod switch reads the RUNTIME
|
|
171
|
+
* `NODE_ENV` - with hooks that is the dual-core crash, without hooks it silently renders with development
|
|
172
|
+
* React (a large SSR slowdown that looks like a runtime regression). Bundled output takes the static
|
|
173
|
+
* import, whose react-dom the bundle already inlined and deduped. */
|
|
155
174
|
export function bunResolverFn() {
|
|
156
175
|
if (process.env.NIFRA_SSR_BUNDLED === "1")
|
|
157
176
|
return undefined;
|
|
177
|
+
if (moduleLooksBundled())
|
|
178
|
+
return undefined;
|
|
158
179
|
return hasBunResolveSync && bunResolver?.resolveSync !== undefined
|
|
159
180
|
? bunResolver.resolveSync.bind(bunResolver)
|
|
160
181
|
: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-dom-server.js","sourceRoot":"","sources":["../src/react-dom-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;AAeH,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;IACrE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,cAAc,GAAI,UAA2C,CAAC,OAAO,CAAA;IAC3E,MAAM,EAAE,GAAG,cAAc,EAAE,gBAAgB,EAAE,CAAC,SAAS,CAE1C,CAAA;IACb,OAAO,EAAE,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;AACzC,CAAC;AASD,MAAM,WAAW,GAAI,UAA6C,CAAC,GAAG,CAAA;AACtE,MAAM,iBAAiB,GAAG,OAAO,WAAW,EAAE,WAAW,KAAK,UAAU,CAAA;AAExE,uGAAuG;AACvG,qGAAqG;AACrG,8EAA8E;AAC9E,IAAI,MAA2C,CAAA;AAE/C;;;;;;GAMG;AACH,SAAS,OAAO;IACd,OAAO,OA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
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/web-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "React render adapter for @nifrajs/web - SSR + hydration (Bun-native JSX, no Babel).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@nifrajs/core": "2.
|
|
89
|
-
"@nifrajs/i18n": "2.
|
|
90
|
-
"@nifrajs/image": "2.
|
|
91
|
-
"@nifrajs/web": "2.
|
|
88
|
+
"@nifrajs/core": "2.8.0",
|
|
89
|
+
"@nifrajs/i18n": "2.8.0",
|
|
90
|
+
"@nifrajs/image": "2.8.0",
|
|
91
|
+
"@nifrajs/web": "2.8.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"react": "^19.0.0",
|
package/src/react-dom-server.ts
CHANGED
|
@@ -172,6 +172,20 @@ export async function loadReactDomServer(
|
|
|
172
172
|
return (await import("react-dom/server")) as ReactDomServer
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Whether this module is executing from inside a bundle rather than as its own file. Bundling rewrites
|
|
177
|
+
* `import.meta.url` to the OUTPUT file (`server-bun.js`, `server.mjs`, …), so when the basename is no
|
|
178
|
+
* longer `react-dom-server.*` (the `.ts` source under the Bun workspace runtime, the `.js` in the
|
|
179
|
+
* published dist), this module has been concatenated into a bundle. The second, marker-free layer of
|
|
180
|
+
* bundle detection: it catches a server bundled by hand (`bun build --target bun` without `buildServer`),
|
|
181
|
+
* which keeps `Bun.resolveSync` but never defines `NIFRA_SSR_BUNDLED`. `url` is injectable for tests;
|
|
182
|
+
* runtime callers pass nothing.
|
|
183
|
+
*/
|
|
184
|
+
export function moduleLooksBundled(url: string = import.meta.url): boolean {
|
|
185
|
+
const base = url.split(/[/\\]/).pop() ?? ""
|
|
186
|
+
return !base.startsWith("react-dom-server.")
|
|
187
|
+
}
|
|
188
|
+
|
|
175
189
|
/**
|
|
176
190
|
* The resolver `loadReactDomServer` uses by default, or `undefined` when re-rooting must NOT happen - a
|
|
177
191
|
* non-Bun host (no `Bun.resolveSync`; the static import is the only path) OR a BUNDLED SSR output.
|
|
@@ -180,9 +194,16 @@ export async function loadReactDomServer(
|
|
|
180
194
|
* a SECOND react-dom from disk (a `target:"bun"` bundle still has `Bun.resolveSync`), giving the bundled
|
|
181
195
|
* components a foreign/null hook dispatcher → the `…H.useRef of null` crash. The marker is read here (per
|
|
182
196
|
* call, not at module load) so it stays driveable from a test. Unbundled Bun runtimes don't set it, so
|
|
183
|
-
* dev/start still re-root. Exported for unit testing the gate.
|
|
197
|
+
* dev/start still re-root. Exported for unit testing the gate.
|
|
198
|
+
*
|
|
199
|
+
* A bundle produced WITHOUT `buildServer` has no marker, so `moduleLooksBundled` backstops it: re-rooting
|
|
200
|
+
* inside such a bundle re-imports react-dom from disk, where the dev/prod switch reads the RUNTIME
|
|
201
|
+
* `NODE_ENV` - with hooks that is the dual-core crash, without hooks it silently renders with development
|
|
202
|
+
* React (a large SSR slowdown that looks like a runtime regression). Bundled output takes the static
|
|
203
|
+
* import, whose react-dom the bundle already inlined and deduped. */
|
|
184
204
|
export function bunResolverFn(): ResolveSync | undefined {
|
|
185
205
|
if (process.env.NIFRA_SSR_BUNDLED === "1") return undefined
|
|
206
|
+
if (moduleLooksBundled()) return undefined
|
|
186
207
|
return hasBunResolveSync && bunResolver?.resolveSync !== undefined
|
|
187
208
|
? bunResolver.resolveSync.bind(bunResolver)
|
|
188
209
|
: undefined
|