@se-studio/project-build 1.1.10 → 1.1.11

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
@@ -1,5 +1,12 @@
1
1
  # @se-studio/project-build
2
2
 
3
+ ## 1.1.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `patch-next-flight-debuginfo` so marketing apps can no-op dest Flight debug-info copies from `predev` instead of copying a script into every repo.
8
+ - Bump Biome to 2.5.11.
9
+
3
10
  ## 1.1.10
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -49,6 +49,22 @@ Run the build system:
49
49
  pnpm setailwind
50
50
  ```
51
51
 
52
+ ### Dest Flight debug-info patch
53
+
54
+ React dest Flight copies unnamed `_debugInfo` without dedup, which can OOM `next dest` on large CMS pages. From the **app directory** (so `next` resolves correctly):
55
+
56
+ ```json
57
+ {
58
+ "scripts": {
59
+ "predev": "pnpm typegen && patch-next-flight-debuginfo"
60
+ }
61
+ }
62
+ ```
63
+
64
+ Idempotent. When Next/React ship the upstream fix, the command prints a notice and exits 0 — then remove it from `predev`.
65
+
66
+ Do not write this file in place under `node_modules` yourself; the CLI write+renames to avoid corrupting pnpm hardlinks.
67
+
52
68
  ### Management Scripts
53
69
 
54
70
  ```bash
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Dest-only workaround for a React Flight memory explosion.
4
+ *
5
+ * In `next dest`, the SSR pass consumes the RSC payload with React's
6
+ * development flight client. Its `transferReferencedDebugInfo` copies every
7
+ * unnamed `_debugInfo` entry from a referenced (outlined) chunk into the
8
+ * referencing chunk's array, with no deduplication. On pages with a large,
9
+ * heavily cross-referenced RSC payload those arrays grow combinatorially and
10
+ * the dest server dies at the V8 heap limit (~16GB). Both webpack and
11
+ * Turbopack dest are affected. Production builds are unaffected.
12
+ *
13
+ * Walk from cwd up looking for node_modules/next (app or monorepo root).
14
+ * Write + rename, never in place: pnpm may hardlink files into its store.
15
+ *
16
+ * Idempotent. If a future Next version no longer contains the pattern, prints
17
+ * a notice and exits 0 — then delete the `predev` wiring in consuming apps.
18
+ *
19
+ * Usage (from an app with `next` installed):
20
+ * patch-next-flight-debuginfo
21
+ */
22
+ /** biome-ignore-all lint/suspicious/noConsole: CLI status */
23
+ export declare const NEEDLE = "function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){";
24
+ export declare const REPLACEMENT = "function transferReferencedDebugInfo(parentChunk,referencedChunk){if(false){";
25
+ 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
+ export interface PatchNextFlightDebugInfoResult {
27
+ patched: number;
28
+ already: number;
29
+ missing: number;
30
+ nextDir: string | null;
31
+ }
32
+ export declare function resolveNextDir(cwd: string): string | null;
33
+ export declare function patchNextFlightDebugInfo(cwd?: string): PatchNextFlightDebugInfoResult;
34
+ export declare function main(cwd?: string): number;
35
+ //# sourceMappingURL=patch-next-flight-debuginfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-next-flight-debuginfo.d.ts","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,6DAA6D;AAM7D,eAAO,MAAM,MAAM,8FAC0E,CAAC;AAC9F,eAAO,MAAM,WAAW,iFACwD,CAAC;AAEjF,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,CAgChC;AAED,wBAAgB,IAAI,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAYxD"}
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Dest-only workaround for a React Flight memory explosion.
4
+ *
5
+ * In `next dest`, the SSR pass consumes the RSC payload with React's
6
+ * development flight client. Its `transferReferencedDebugInfo` copies every
7
+ * unnamed `_debugInfo` entry from a referenced (outlined) chunk into the
8
+ * referencing chunk's array, with no deduplication. On pages with a large,
9
+ * heavily cross-referenced RSC payload those arrays grow combinatorially and
10
+ * the dest server dies at the V8 heap limit (~16GB). Both webpack and
11
+ * Turbopack dest are affected. Production builds are unaffected.
12
+ *
13
+ * Walk from cwd up looking for node_modules/next (app or monorepo root).
14
+ * Write + rename, never in place: pnpm may hardlink files into its store.
15
+ *
16
+ * Idempotent. If a future Next version no longer contains the pattern, prints
17
+ * a notice and exits 0 — then delete the `predev` wiring in consuming apps.
18
+ *
19
+ * Usage (from an app with `next` installed):
20
+ * patch-next-flight-debuginfo
21
+ */
22
+ /** biome-ignore-all lint/suspicious/noConsole: CLI status */
23
+ import fs from 'node:fs';
24
+ import path from 'node:path';
25
+ import { fileURLToPath } from 'node:url';
26
+ export const NEEDLE = 'function transferReferencedDebugInfo(parentChunk,referencedChunk){if(null!==parentChunk){';
27
+ export const REPLACEMENT = 'function transferReferencedDebugInfo(parentChunk,referencedChunk){if(false){';
28
+ export const RUNTIME_FILES = [
29
+ 'app-page.runtime.dev.js',
30
+ 'app-page-turbo.runtime.dev.js',
31
+ 'app-page-experimental.runtime.dev.js',
32
+ 'app-page-turbo-experimental.runtime.dev.js',
33
+ ];
34
+ export function resolveNextDir(cwd) {
35
+ let dir = path.resolve(cwd);
36
+ const { root } = path.parse(dir);
37
+ while (true) {
38
+ const pkg = path.join(dir, 'node_modules', 'next', 'package.json');
39
+ if (fs.existsSync(pkg)) {
40
+ return fs.realpathSync(path.dirname(pkg));
41
+ }
42
+ if (dir === root) {
43
+ return null;
44
+ }
45
+ dir = path.dirname(dir);
46
+ }
47
+ }
48
+ export function patchNextFlightDebugInfo(cwd = process.cwd()) {
49
+ const nextDir = resolveNextDir(cwd);
50
+ if (!nextDir) {
51
+ return { patched: 0, already: 0, missing: 0, nextDir: null };
52
+ }
53
+ let patched = 0;
54
+ let already = 0;
55
+ let missing = 0;
56
+ for (const name of RUNTIME_FILES) {
57
+ const file = path.join(nextDir, 'dist/compiled/next-server', name);
58
+ if (!fs.existsSync(file))
59
+ continue;
60
+ const src = fs.readFileSync(file, 'utf8');
61
+ if (src.includes(REPLACEMENT)) {
62
+ already += 1;
63
+ continue;
64
+ }
65
+ if (!src.includes(NEEDLE)) {
66
+ missing += 1;
67
+ console.warn(`[patch-next-flight-debuginfo] pattern not found in ${file} — Next may have changed; check if the upstream React fix landed`);
68
+ continue;
69
+ }
70
+ fs.writeFileSync(`${file}.orig`, src);
71
+ const tmp = `${file}.patch-tmp`;
72
+ fs.writeFileSync(tmp, src.replace(NEEDLE, REPLACEMENT));
73
+ fs.renameSync(tmp, file);
74
+ patched += 1;
75
+ console.log(`[patch-next-flight-debuginfo] patched ${file}`);
76
+ }
77
+ return { patched, already, missing, nextDir };
78
+ }
79
+ export function main(cwd = process.cwd()) {
80
+ const result = patchNextFlightDebugInfo(cwd);
81
+ if (!result.nextDir) {
82
+ console.error('[patch-next-flight-debuginfo] could not resolve the next package from cwd; nothing patched');
83
+ return 1;
84
+ }
85
+ console.log(`[patch-next-flight-debuginfo] done: ${result.patched} patched, ${result.already} already patched, ${result.missing} pattern-missing`);
86
+ return 0;
87
+ }
88
+ const invokedDirectly = process.argv[1] !== undefined && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
89
+ if (invokedDirectly) {
90
+ process.exit(main());
91
+ }
92
+ //# sourceMappingURL=patch-next-flight-debuginfo.js.map
@@ -0,0 +1 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/D,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IAC9C,MAAM,MAAM,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CACX,4FAA4F,CAC7F,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,GAAG,CACT,uCAAuC,MAAM,CAAC,OAAO,aAAa,MAAM,CAAC,OAAO,qBAAqB,MAAM,CAAC,OAAO,kBAAkB,CACtI,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,IAAI,eAAe,EAAE,CAAC;IACpB,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.10",
3
+ "version": "1.1.11",
4
4
  "description": "Build tools and management scripts for SE Studio projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,8 @@
35
35
  "cms-capture-screenshots": "./dist/cms-capture-screenshots.js",
36
36
  "cms-update-colour-hints": "./dist/cms-update-colour-hints.js",
37
37
  "cms-generate-collection-guidelines": "./dist/cms-generate-collection-guidelines.js",
38
- "cms-generate-html-style-guide": "./dist/cms-generate-html-style-guide.js"
38
+ "cms-generate-html-style-guide": "./dist/cms-generate-html-style-guide.js",
39
+ "patch-next-flight-debuginfo": "./dist/patch-next-flight-debuginfo.js"
39
40
  },
40
41
  "files": [
41
42
  "dist",
@@ -59,9 +60,9 @@
59
60
  "url": "https://github.com/Something-Else-Studio/se-core-product/issues"
60
61
  },
61
62
  "dependencies": {
62
- "@biomejs/biome": "^2.5.10",
63
+ "@biomejs/biome": "^2.5.11",
63
64
  "@biomejs/js-api": "^6.0.0",
64
- "@biomejs/wasm-nodejs": "^2.5.10",
65
+ "@biomejs/wasm-nodejs": "^2.5.11",
65
66
  "change-case": "^5.4.4",
66
67
  "chroma-js": "^3.2.0",
67
68
  "contentful-management": "^12.15.0",