@se-studio/project-build 1.1.16 → 1.1.17
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.
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ pnpm setailwind
|
|
|
51
51
|
|
|
52
52
|
### Dest Flight debug-info patch
|
|
53
53
|
|
|
54
|
-
React dest Flight copies unnamed `_debugInfo` without dedup, which can OOM `next dest` on large CMS pages. Call this at the top of the app `next.config.ts`. Next loads that file for `pnpm dev`, `pnpm dev:dev`, and a raw `next dev` (local smoke and cloud agents) before dest starts. `predev` does not run for `dev:dev`.
|
|
54
|
+
React dest Flight copies unnamed `_debugInfo` without dedup, which can OOM `next dest` on large CMS pages. The rewrite dedupes the copy so each receiving chunk keeps each unnamed entry once. Call this at the top of the app `next.config.ts`. Next loads that file for `pnpm dev`, `pnpm dev:dev`, and a raw `next dev` (local smoke and cloud agents) before dest starts. `predev` does not run for `dev:dev`.
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
57
|
import { ensureNextDevFlightPatch } from '@se-studio/project-build/patch-next-dev';
|
|
@@ -5,23 +5,30 @@
|
|
|
5
5
|
* In `next dest`, the SSR pass consumes the RSC payload with React's
|
|
6
6
|
* development flight client. Its `transferReferencedDebugInfo` copies every
|
|
7
7
|
* unnamed `_debugInfo` entry from a referenced (outlined) chunk into the
|
|
8
|
-
* referencing chunk's array
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* referencing chunk's array. Next 16.3.8 does that with no deduplication, so
|
|
9
|
+
* large cross-referenced pages grow those arrays until the dest server dies
|
|
10
|
+
* at the V8 heap limit (~16GB). React #37481 copies each entry once per
|
|
11
|
+
* receiving chunk; this rewrites the whole function to that rule, including
|
|
12
|
+
* runtimes previously no-op'd with `if (false)`. Both webpack and Turbopack
|
|
13
|
+
* dest are affected. Production builds are unaffected.
|
|
12
14
|
*
|
|
13
15
|
* Walk from cwd up looking for node_modules/next (app or monorepo root).
|
|
14
16
|
* Write + rename, never in place: pnpm may hardlink files into its store.
|
|
15
17
|
*
|
|
16
18
|
* Idempotent. If a future Next version no longer contains the pattern, prints
|
|
17
|
-
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.
|
|
19
|
+
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.ts
|
|
20
|
+
* after checking upstream.
|
|
18
21
|
*
|
|
19
22
|
* Usage (from an app with `next` installed):
|
|
20
23
|
* patch-next-flight-debuginfo
|
|
21
24
|
*/
|
|
22
25
|
/** biome-ignore-all lint/suspicious/noConsole: CLI status */
|
|
23
|
-
|
|
24
|
-
export declare const
|
|
26
|
+
/** Next 16.3.8 `transferReferencedDebugInfo`, matched in full. */
|
|
27
|
+
export declare const ORIGINAL_FUNCTION = "function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){referencedChunk=referencedChunk._debugInfo,parentChunk=parentChunk._debugInfo;for(var i=0;i<referencedChunk.length;++i){var debugInfoEntry=referencedChunk[i];null==debugInfoEntry.name&&parentChunk.push(debugInfoEntry)}}}";
|
|
28
|
+
/** Same function after the previous `if(false)` no-op rewrite. */
|
|
29
|
+
export declare const NOOP_FUNCTION = "function transferReferencedDebugInfo(parentChunk,referencedChunk){if(false){referencedChunk=referencedChunk._debugInfo,parentChunk=parentChunk._debugInfo;for(var i=0;i<referencedChunk.length;++i){var debugInfoEntry=referencedChunk[i];null==debugInfoEntry.name&&parentChunk.push(debugInfoEntry)}}}";
|
|
30
|
+
/** Once-per-entry copy from React #37481, without constructor or fulfillReference edits. */
|
|
31
|
+
export declare const DEDUP_FUNCTION = "function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){var referencedDebugInfo=referencedChunk._debugInfo,receivingDebugInfo=parentChunk._debugInfo,received=parentChunk._receivedDebugInfo;null==received&&(received=parentChunk._receivedDebugInfo=new Set);for(var i=0;i<referencedDebugInfo.length;++i){var debugInfoEntry=referencedDebugInfo[i];null==debugInfoEntry.name&&!received.has(debugInfoEntry)&&(received.add(debugInfoEntry),receivingDebugInfo.push(debugInfoEntry))}}}";
|
|
25
32
|
export declare const RUNTIME_FILES: readonly ['app-page.runtime.dev.js', 'app-page-turbo.runtime.dev.js', 'app-page-experimental.runtime.dev.js', 'app-page-turbo-experimental.runtime.dev.js'];
|
|
26
33
|
export interface PatchNextFlightDebugInfoResult {
|
|
27
34
|
patched: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-next-flight-debuginfo.d.ts","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"patch-next-flight-debuginfo.d.ts","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,6DAA6D;AAM7D,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,0TAC2R,CAAC;AAE1T,kEAAkE;AAClE,eAAO,MAAM,aAAa,6SACkR,CAAC;AAE7S,4FAA4F;AAC5F,eAAO,MAAM,cAAc,ggBACoe,CAAC;AAEhgB,eAAO,MAAM,aAAa,YACxB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,4CAA4C,CACpC,CAAC;AAEX,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAazD;AAED,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAsB,GAC1B,8BAA8B,CAqChC;AAED,wBAAgB,IAAI,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAYxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAerF"}
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* In `next dest`, the SSR pass consumes the RSC payload with React's
|
|
6
6
|
* development flight client. Its `transferReferencedDebugInfo` copies every
|
|
7
7
|
* unnamed `_debugInfo` entry from a referenced (outlined) chunk into the
|
|
8
|
-
* referencing chunk's array
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* referencing chunk's array. Next 16.3.8 does that with no deduplication, so
|
|
9
|
+
* large cross-referenced pages grow those arrays until the dest server dies
|
|
10
|
+
* at the V8 heap limit (~16GB). React #37481 copies each entry once per
|
|
11
|
+
* receiving chunk; this rewrites the whole function to that rule, including
|
|
12
|
+
* runtimes previously no-op'd with `if (false)`. Both webpack and Turbopack
|
|
13
|
+
* dest are affected. Production builds are unaffected.
|
|
12
14
|
*
|
|
13
15
|
* Walk from cwd up looking for node_modules/next (app or monorepo root).
|
|
14
16
|
* Write + rename, never in place: pnpm may hardlink files into its store.
|
|
15
17
|
*
|
|
16
18
|
* Idempotent. If a future Next version no longer contains the pattern, prints
|
|
17
|
-
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.
|
|
19
|
+
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.ts
|
|
20
|
+
* after checking upstream.
|
|
18
21
|
*
|
|
19
22
|
* Usage (from an app with `next` installed):
|
|
20
23
|
* patch-next-flight-debuginfo
|
|
@@ -23,8 +26,12 @@
|
|
|
23
26
|
import fs from 'node:fs';
|
|
24
27
|
import path from 'node:path';
|
|
25
28
|
import { fileURLToPath } from 'node:url';
|
|
26
|
-
|
|
27
|
-
export const
|
|
29
|
+
/** Next 16.3.8 `transferReferencedDebugInfo`, matched in full. */
|
|
30
|
+
export const ORIGINAL_FUNCTION = 'function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){referencedChunk=referencedChunk._debugInfo,parentChunk=parentChunk._debugInfo;for(var i=0;i<referencedChunk.length;++i){var debugInfoEntry=referencedChunk[i];null==debugInfoEntry.name&&parentChunk.push(debugInfoEntry)}}}';
|
|
31
|
+
/** Same function after the previous `if(false)` no-op rewrite. */
|
|
32
|
+
export const NOOP_FUNCTION = 'function transferReferencedDebugInfo(parentChunk,referencedChunk){if(false){referencedChunk=referencedChunk._debugInfo,parentChunk=parentChunk._debugInfo;for(var i=0;i<referencedChunk.length;++i){var debugInfoEntry=referencedChunk[i];null==debugInfoEntry.name&&parentChunk.push(debugInfoEntry)}}}';
|
|
33
|
+
/** Once-per-entry copy from React #37481, without constructor or fulfillReference edits. */
|
|
34
|
+
export const DEDUP_FUNCTION = 'function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){var referencedDebugInfo=referencedChunk._debugInfo,receivingDebugInfo=parentChunk._debugInfo,received=parentChunk._receivedDebugInfo;null==received&&(received=parentChunk._receivedDebugInfo=new Set);for(var i=0;i<referencedDebugInfo.length;++i){var debugInfoEntry=referencedDebugInfo[i];null==debugInfoEntry.name&&!received.has(debugInfoEntry)&&(received.add(debugInfoEntry),receivingDebugInfo.push(debugInfoEntry))}}}';
|
|
28
35
|
export const RUNTIME_FILES = [
|
|
29
36
|
'app-page.runtime.dev.js',
|
|
30
37
|
'app-page-turbo.runtime.dev.js',
|
|
@@ -58,18 +65,23 @@ export function patchNextFlightDebugInfo(cwd = process.cwd()) {
|
|
|
58
65
|
if (!fs.existsSync(file))
|
|
59
66
|
continue;
|
|
60
67
|
const src = fs.readFileSync(file, 'utf8');
|
|
61
|
-
if (src.includes(
|
|
68
|
+
if (src.includes(DEDUP_FUNCTION)) {
|
|
62
69
|
already += 1;
|
|
63
70
|
continue;
|
|
64
71
|
}
|
|
65
|
-
|
|
72
|
+
const from = src.includes(ORIGINAL_FUNCTION)
|
|
73
|
+
? ORIGINAL_FUNCTION
|
|
74
|
+
: src.includes(NOOP_FUNCTION)
|
|
75
|
+
? NOOP_FUNCTION
|
|
76
|
+
: null;
|
|
77
|
+
if (!from) {
|
|
66
78
|
missing += 1;
|
|
67
79
|
console.warn(`[patch-next-flight-debuginfo] pattern not found in ${file} — Next may have changed; check if the upstream React fix landed`);
|
|
68
80
|
continue;
|
|
69
81
|
}
|
|
70
82
|
fs.writeFileSync(`${file}.orig`, src);
|
|
71
83
|
const tmp = `${file}.patch-tmp`;
|
|
72
|
-
fs.writeFileSync(tmp, src.replace(
|
|
84
|
+
fs.writeFileSync(tmp, src.replace(from, DEDUP_FUNCTION));
|
|
73
85
|
fs.renameSync(tmp, file);
|
|
74
86
|
patched += 1;
|
|
75
87
|
console.log(`[patch-next-flight-debuginfo] patched ${file}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-next-flight-debuginfo.js","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"patch-next-flight-debuginfo.js","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,6DAA6D;AAE7D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAC5B,uTAAuT,CAAC;AAE1T,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GACxB,0SAA0S,CAAC;AAE7S,4FAA4F;AAC5F,MAAM,CAAC,MAAM,cAAc,GACzB,6fAA6f,CAAC;AAEhgB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,yBAAyB;IACzB,+BAA+B;IAC/B,sCAAsC;IACtC,4CAA4C;CACpC,CAAC;AASX,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC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CAAC,OAAO,aAAa,MAAM,CAAC,OAAO,qBAAqB,MAAM,CAAC,OAAO,kBAAkB,CACtI,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAyB,EAAE,UAAkB;IAC1E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/project-build",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Build tools and management scripts for SE Studio projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,19 +66,19 @@
|
|
|
66
66
|
"url": "https://github.com/Something-Else-Studio/se-core-product/issues"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@biomejs/biome": "^2.5.
|
|
69
|
+
"@biomejs/biome": "^2.5.15",
|
|
70
70
|
"@biomejs/js-api": "^6.0.0",
|
|
71
|
-
"@biomejs/wasm-nodejs": "^2.5.
|
|
71
|
+
"@biomejs/wasm-nodejs": "^2.5.15",
|
|
72
72
|
"change-case": "^5.4.4",
|
|
73
73
|
"chroma-js": "^3.2.0",
|
|
74
|
-
"contentful-management": "^12.
|
|
75
|
-
"dotenv": "^
|
|
74
|
+
"contentful-management": "^12.19.0",
|
|
75
|
+
"dotenv": "^18.0.5"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/chroma-js": "^3.1.2",
|
|
79
79
|
"@types/node": "^24.13.3",
|
|
80
80
|
"typescript": "^7.0.2",
|
|
81
|
-
"vitest": "^
|
|
81
|
+
"vitest": "^5.0.3"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsc --project tsconfig.build.json && cp src/patch-next-dev.cjs src/patch-next-dev.d.ts dist/",
|