@se-studio/project-build 1.1.10 → 1.1.12
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 +13 -0
- package/README.md +16 -0
- package/dist/colourFile.d.ts +2 -2
- package/dist/colourFile.d.ts.map +1 -1
- package/dist/colourFile.js +26 -7
- package/dist/colourFile.js.map +1 -1
- package/dist/patch-next-flight-debuginfo.d.ts +35 -0
- package/dist/patch-next-flight-debuginfo.d.ts.map +1 -0
- package/dist/patch-next-flight-debuginfo.js +92 -0
- package/dist/patch-next-flight-debuginfo.js.map +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @se-studio/project-build
|
|
2
2
|
|
|
3
|
+
## 1.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1e65f12: Generated theme lookups return `undefined` (and warn when `LOG_CMS=1`) instead of throwing on unknown CMS names. `lookupTextStyleClassName` is now `string | undefined` — treat the result as optional, do not concatenate it. Tailwind `@source` should scan core-ui `src/**/*.tsx` plus `dist/**/*.js`, not the whole `dist` tree.
|
|
8
|
+
|
|
9
|
+
## 1.1.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
- Bump Biome to 2.5.11.
|
|
15
|
+
|
|
3
16
|
## 1.1.10
|
|
4
17
|
|
|
5
18
|
### 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
|
package/dist/colourFile.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function buildColorFile(config: Pick<ITailwindConfigurationOption
|
|
|
16
16
|
* - Full TypeScript autocomplete and type checking for style names
|
|
17
17
|
* - Runtime validation of style names from external sources (CMS)
|
|
18
18
|
* - Efficient lookup tables for style class name resolution
|
|
19
|
-
* -
|
|
19
|
+
* - Unknown CMS names return undefined (set LOG_CMS=1 to warn) instead of throwing
|
|
20
20
|
*
|
|
21
21
|
* @param config - Tailwind configuration containing the font table definition
|
|
22
22
|
* @param config.fontTable - Font table with styles mapping from design system
|
|
@@ -41,7 +41,7 @@ export declare function buildColorFile(config: Pick<ITailwindConfigurationOption
|
|
|
41
41
|
* // Results in:
|
|
42
42
|
* // export type TextStyleName = "h1" | "p-base" | "p-sm";
|
|
43
43
|
* // export const textStyleNames: TextStyleName[] = ["h1", "p-base", "p-sm"] as const;
|
|
44
|
-
* // export function lookupTextStyleClassName(style: TextStyleName): string { ... }
|
|
44
|
+
* // export function lookupTextStyleClassName(style: TextStyleName): string | undefined { ... }
|
|
45
45
|
* // export function convertCmsTextStyleName(style: string | undefined | null): TextStyleName | undefined { ... }
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
package/dist/colourFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colourFile.d.ts","sourceRoot":"","sources":["../src/colourFile.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,+GAA+G;AAI/G,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"colourFile.d.ts","sourceRoot":"","sources":["../src/colourFile.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,+GAA+G;AAI/G,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAwBhE,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CACV,6BAA6B,EAC7B,WAAW,GAAG,cAAc,GAAG,gBAAgB,GAAG,WAAW,CAC9D,wBA4MF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,6BAA6B,EAAE,WAAW,CAAC,wBA6C3F"}
|
package/dist/colourFile.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
/** biome-ignore-all lint/suspicious/noTemplateCurlyInString: Template literals are used for dynamic strings */
|
|
3
3
|
import chroma from 'chroma-js';
|
|
4
4
|
import { cleanColourName } from './tailwind-utils.js';
|
|
5
|
+
/** Emitted into generated theme files. Unknown CMS names must not throw. */
|
|
6
|
+
const WARN_UNKNOWN_THEME_NAME = `function warnUnknownThemeName(kind: string, name: unknown): void {
|
|
7
|
+
if (typeof process !== "undefined" && process.env.LOG_CMS) {
|
|
8
|
+
console.warn("[cms] unknown " + kind + ' "' + String(name) + '"');
|
|
9
|
+
}
|
|
10
|
+
}`;
|
|
5
11
|
function buildColours(config) {
|
|
6
12
|
if (!config.colorOptions)
|
|
7
13
|
return undefined;
|
|
@@ -62,11 +68,15 @@ export function buildColorFile(config) {
|
|
|
62
68
|
code.push(` "${key}": ["text-${colorName}", "bg-${colorName}"],`);
|
|
63
69
|
});
|
|
64
70
|
code.push('};');
|
|
71
|
+
code.push(WARN_UNKNOWN_THEME_NAME);
|
|
65
72
|
code.push(`export type ColourType = "text" | "bg";
|
|
66
73
|
export function lookupColourString(colour: ProjectColourName | undefined | null, type:ColourType): string|undefined {
|
|
67
74
|
if (!colour) return undefined;
|
|
68
75
|
const entry = colourTable[colour];`);
|
|
69
|
-
code.push(
|
|
76
|
+
code.push(`if (!entry) {
|
|
77
|
+
warnUnknownThemeName("colour", colour);
|
|
78
|
+
return undefined;
|
|
79
|
+
}`);
|
|
70
80
|
code.push(`
|
|
71
81
|
switch (type) {
|
|
72
82
|
case "text": return entry[0] ?? "";
|
|
@@ -93,7 +103,10 @@ export function lookupColourString(colour: ProjectColourName | undefined | null,
|
|
|
93
103
|
code.push(`
|
|
94
104
|
export function lookupGradientString(gradient: CmsGradientName): string | undefined {
|
|
95
105
|
const entry = gradientTable[gradient];`);
|
|
96
|
-
code.push(
|
|
106
|
+
code.push(`if (!entry) {
|
|
107
|
+
warnUnknownThemeName("gradient", gradient);
|
|
108
|
+
return undefined;
|
|
109
|
+
}`);
|
|
97
110
|
code.push(`
|
|
98
111
|
return entry;
|
|
99
112
|
}
|
|
@@ -112,7 +125,8 @@ export function lookupGradientOrColourString(
|
|
|
112
125
|
): string|undefined {
|
|
113
126
|
if (type === "bg" && isGradientName(key)) return lookupGradientString(key);
|
|
114
127
|
if (isColourName(key)) return lookupColourString(key, type);`);
|
|
115
|
-
code.push(
|
|
128
|
+
code.push(`warnUnknownThemeName("colour or gradient", key);
|
|
129
|
+
return undefined;`);
|
|
116
130
|
code.push(`
|
|
117
131
|
}
|
|
118
132
|
`);
|
|
@@ -206,7 +220,7 @@ export function lookupColourClassNames(backgroundColour?: ProjectColourName | Cm
|
|
|
206
220
|
* - Full TypeScript autocomplete and type checking for style names
|
|
207
221
|
* - Runtime validation of style names from external sources (CMS)
|
|
208
222
|
* - Efficient lookup tables for style class name resolution
|
|
209
|
-
* -
|
|
223
|
+
* - Unknown CMS names return undefined (set LOG_CMS=1 to warn) instead of throwing
|
|
210
224
|
*
|
|
211
225
|
* @param config - Tailwind configuration containing the font table definition
|
|
212
226
|
* @param config.fontTable - Font table with styles mapping from design system
|
|
@@ -231,7 +245,7 @@ export function lookupColourClassNames(backgroundColour?: ProjectColourName | Cm
|
|
|
231
245
|
* // Results in:
|
|
232
246
|
* // export type TextStyleName = "h1" | "p-base" | "p-sm";
|
|
233
247
|
* // export const textStyleNames: TextStyleName[] = ["h1", "p-base", "p-sm"] as const;
|
|
234
|
-
* // export function lookupTextStyleClassName(style: TextStyleName): string { ... }
|
|
248
|
+
* // export function lookupTextStyleClassName(style: TextStyleName): string | undefined { ... }
|
|
235
249
|
* // export function convertCmsTextStyleName(style: string | undefined | null): TextStyleName | undefined { ... }
|
|
236
250
|
* ```
|
|
237
251
|
*/
|
|
@@ -254,10 +268,14 @@ export function buildTextStylesFile(config) {
|
|
|
254
268
|
code.push(` "${style}": "${style}",`);
|
|
255
269
|
});
|
|
256
270
|
code.push(`};`);
|
|
271
|
+
code.push(WARN_UNKNOWN_THEME_NAME);
|
|
257
272
|
code.push(`
|
|
258
|
-
export function lookupTextStyleClassName(style: TextStyleName): string {
|
|
273
|
+
export function lookupTextStyleClassName(style: TextStyleName): string | undefined {
|
|
259
274
|
const entry = textStyleTable[style];
|
|
260
|
-
if (!entry)
|
|
275
|
+
if (!entry) {
|
|
276
|
+
warnUnknownThemeName("text style", style);
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
261
279
|
return entry;
|
|
262
280
|
}
|
|
263
281
|
|
|
@@ -267,6 +285,7 @@ export function convertCmsTextStyleName(
|
|
|
267
285
|
if (style && textStyleNames.includes(style as TextStyleName)) {
|
|
268
286
|
return style as TextStyleName;
|
|
269
287
|
}
|
|
288
|
+
if (style) warnUnknownThemeName("text style", style);
|
|
270
289
|
return undefined;
|
|
271
290
|
}
|
|
272
291
|
`);
|
package/dist/colourFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colourFile.js","sourceRoot":"","sources":["../src/colourFile.ts"],"names":[],"mappings":"AAAA,gEA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AC,EAAE,EAAE;QACnD,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAEnC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;CAmBX,CAAC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"patch-next-flight-debuginfo.js","sourceRoot":"","sources":["../src/patch-next-flight-debuginfo.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,6DAA6D;AAE7D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GACjB,2FAA2F,CAAC;AAC9F,MAAM,CAAC,MAAM,WAAW,GACtB,8EAA8E,CAAC;AAEjF,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,GAAG,CAAC,CAAC;IAC5B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EA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AI,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.12",
|
|
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.
|
|
63
|
+
"@biomejs/biome": "^2.5.11",
|
|
63
64
|
"@biomejs/js-api": "^6.0.0",
|
|
64
|
-
"@biomejs/wasm-nodejs": "^2.5.
|
|
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",
|