@se-studio/project-build 1.1.15 → 1.1.16
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,13 @@
|
|
|
1
1
|
# @se-studio/project-build
|
|
2
2
|
|
|
3
|
+
## 1.1.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Call `ensureNextDevFlightPatch()` from `@se-studio/project-build/patch-next-dev` at the top of each marketing app `next.config.ts`. That applies the dest Flight debug-info OOM patch for `pnpm dev`, `pnpm dev:dev`, and a raw `next dev`. `predev` does not run for the last two, which is what local smoke and cloud agents use. The helper no-ops on production builds.
|
|
8
|
+
|
|
9
|
+
Agent session and new-project skills tell agents to add that call before starting a dev server.
|
|
10
|
+
|
|
3
11
|
## 1.1.15
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -51,19 +51,17 @@ 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.
|
|
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`.
|
|
55
55
|
|
|
56
|
-
```
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
56
|
+
```ts
|
|
57
|
+
import { ensureNextDevFlightPatch } from '@se-studio/project-build/patch-next-dev';
|
|
58
|
+
|
|
59
|
+
ensureNextDevFlightPatch();
|
|
62
60
|
```
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
The helper no-ops when `NODE_ENV` is `production` or `NEXT_PHASE` is a production phase, so Vercel builds do not rewrite `node_modules`. It is idempotent. When Next/React ship the upstream fix, the command prints a notice and exits 0 — then remove the call.
|
|
65
63
|
|
|
66
|
-
Do not write
|
|
64
|
+
`patch-next-flight-debuginfo` remains the CLI for the same rewrite. Do not write the runtime files in place under `node_modules` yourself; the patch write+renames to avoid corrupting pnpm hardlinks.
|
|
67
65
|
|
|
68
66
|
### Management Scripts
|
|
69
67
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommonJS entry so Next can load this from next.config.ts.
|
|
3
|
+
* Next transpiles that file to CJS and require()s it. An import-only
|
|
4
|
+
* export is invisible to that require and the OOM patch never runs.
|
|
5
|
+
*
|
|
6
|
+
* The rewrite itself stays in the ESM CLI, spawned here so it stays synchronous
|
|
7
|
+
* before dest starts.
|
|
8
|
+
*/
|
|
9
|
+
const { spawnSync } = require('node:child_process');
|
|
10
|
+
const path = require('node:path');
|
|
11
|
+
|
|
12
|
+
const PRODUCTION_PHASES = new Set([
|
|
13
|
+
'phase-production-build',
|
|
14
|
+
'phase-production-server',
|
|
15
|
+
'phase-export',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
function shouldPatchNextDevFlight(env = process.env) {
|
|
19
|
+
if (env.NODE_ENV === 'production') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const phase = env.NEXT_PHASE;
|
|
23
|
+
if (phase && PRODUCTION_PHASES.has(phase)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function ensureNextDevFlightPatch(cwd = process.cwd(), env = process.env) {
|
|
30
|
+
if (!shouldPatchNextDevFlight(env)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const script = path.join(__dirname, 'patch-next-flight-debuginfo.js');
|
|
34
|
+
const result = spawnSync(process.execPath, [script], {
|
|
35
|
+
cwd,
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
});
|
|
38
|
+
if (result.status !== 0) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`patch-next-flight-debuginfo exited ${result.status ?? 'null'} (signal ${result.signal ?? 'none'})`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
ensureNextDevFlightPatch,
|
|
48
|
+
shouldPatchNextDevFlight,
|
|
49
|
+
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Write + rename, never in place: pnpm may hardlink files into its store.
|
|
15
15
|
*
|
|
16
16
|
* Idempotent. If a future Next version no longer contains the pattern, prints
|
|
17
|
-
* a notice and exits 0 — then
|
|
17
|
+
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.
|
|
18
18
|
*
|
|
19
19
|
* Usage (from an app with `next` installed):
|
|
20
20
|
* patch-next-flight-debuginfo
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Write + rename, never in place: pnpm may hardlink files into its store.
|
|
15
15
|
*
|
|
16
16
|
* Idempotent. If a future Next version no longer contains the pattern, prints
|
|
17
|
-
* a notice and exits 0 — then
|
|
17
|
+
* a notice and exits 0 — then remove `ensureNextDevFlightPatch()` from next.config.
|
|
18
18
|
*
|
|
19
19
|
* Usage (from an app with `next` installed):
|
|
20
20
|
* patch-next-flight-debuginfo
|
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.16",
|
|
4
4
|
"description": "Build tools and management scripts for SE Studio projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
"./management": {
|
|
24
24
|
"types": "./dist/management/index.d.ts",
|
|
25
25
|
"import": "./dist/management/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./patch-next-dev": {
|
|
28
|
+
"types": "./dist/patch-next-dev.d.ts",
|
|
29
|
+
"import": "./dist/patch-next-dev.cjs",
|
|
30
|
+
"require": "./dist/patch-next-dev.cjs",
|
|
31
|
+
"default": "./dist/patch-next-dev.cjs"
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
34
|
"bin": {
|
|
@@ -75,7 +81,7 @@
|
|
|
75
81
|
"vitest": "^4.1.11"
|
|
76
82
|
},
|
|
77
83
|
"scripts": {
|
|
78
|
-
"build": "tsc --project tsconfig.build.json",
|
|
84
|
+
"build": "tsc --project tsconfig.build.json && cp src/patch-next-dev.cjs src/patch-next-dev.d.ts dist/",
|
|
79
85
|
"dev": "tsc --project tsconfig.build.json --watch",
|
|
80
86
|
"type-check": "tsc --noEmit",
|
|
81
87
|
"lint": "biome lint .",
|