@kurot/cli 3.6.1 → 3.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.
- package/CHANGELOG.md +129 -2
- package/README.md +49 -121
- package/dist/core/config-watcher.d.ts +8 -0
- package/dist/core/config-watcher.d.ts.map +1 -0
- package/dist/core/config-watcher.js +63 -0
- package/dist/core/config-watcher.js.map +1 -0
- package/dist/core/config.d.ts +12 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -6
- package/dist/core/config.js.map +1 -1
- package/dist/core/dev-server.d.ts.map +1 -1
- package/dist/core/dev-server.js +2 -0
- package/dist/core/dev-server.js.map +1 -1
- package/dist/core/diagnostics/codes.d.ts +2 -0
- package/dist/core/diagnostics/codes.d.ts.map +1 -1
- package/dist/core/diagnostics/codes.js +2 -0
- package/dist/core/diagnostics/codes.js.map +1 -1
- package/dist/core/diagnostics/output.d.ts +1 -1
- package/dist/core/diagnostics/output.d.ts.map +1 -1
- package/dist/core/plugins/generate-html.d.ts +7 -1
- package/dist/core/plugins/generate-html.d.ts.map +1 -1
- package/dist/core/plugins/generate-html.js +20 -4
- package/dist/core/plugins/generate-html.js.map +1 -1
- package/dist/core/plugins/index.d.ts +2 -1
- package/dist/core/plugins/index.d.ts.map +1 -1
- package/dist/core/plugins/index.js +4 -1
- package/dist/core/plugins/index.js.map +1 -1
- package/dist/core/plugins/version-assets.d.ts +7 -0
- package/dist/core/plugins/version-assets.d.ts.map +1 -0
- package/dist/core/plugins/version-assets.js +108 -0
- package/dist/core/plugins/version-assets.js.map +1 -0
- package/docs/ai-context.md +42 -58
- package/docs/architecture.md +14 -2
- package/docs/default-ui-skins.md +12 -23
- package/docs/dev-resource-watching.md +25 -6
- package/docs/game-template.md +20 -29
- package/docs/label-text-layout.md +13 -15
- package/docs/release-assets.md +76 -0
- package/docs/text-components.md +3 -7
- package/package.json +3 -2
- package/templates/empty/README.md +4 -1
- package/templates/empty/src/Main.ts +5 -7
- package/templates/game/README.md +4 -1
- package/templates/game/src/Main.ts +2 -8
package/dist/core/dev-server.js
CHANGED
|
@@ -9,6 +9,7 @@ import { refreshProjectComponents } from './components/discover-components.js';
|
|
|
9
9
|
import { createResourceAssetSync } from './resource-asset-sync.js';
|
|
10
10
|
import { watchResourceDirectory } from './resource-watcher.js';
|
|
11
11
|
import { KUI_THEME_OUTPUT_PATH } from './project.js';
|
|
12
|
+
import { watchStageConfiguration } from './config-watcher.js';
|
|
12
13
|
import { logger } from '../utils/logger.js';
|
|
13
14
|
const MIME_TYPES = {
|
|
14
15
|
'.html': 'text/html; charset=utf-8',
|
|
@@ -65,6 +66,7 @@ export async function startDevServer(project, options) {
|
|
|
65
66
|
const syncAssets = await createResourceAssetSync(project);
|
|
66
67
|
const componentSkinsWatched = watchComponents(project, ctx, options, enqueue, syncAssets);
|
|
67
68
|
watchResources(project, ctx, options, componentSkinsWatched, enqueue, syncAssets);
|
|
69
|
+
watchStageConfiguration(ctx, enqueue, options.onEvent);
|
|
68
70
|
const server = startHttpServer(project, options);
|
|
69
71
|
process.on('SIGINT', async () => {
|
|
70
72
|
logger.info('Stopping dev server...');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACN,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC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AAO,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;IACvD,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,QAAgB;IACjC,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,0BAA0B,CAAC;AACvF,CAAC"}
|
|
@@ -6,6 +6,8 @@ export declare const DIAGNOSTIC_CODES: {
|
|
|
6
6
|
readonly KUI_COMPILE_FAILED: "KUROT_KUI_COMPILE_FAILED";
|
|
7
7
|
readonly KUI_DUPLICATE_DEFAULT: "KUROT_KUI_DUPLICATE_DEFAULT";
|
|
8
8
|
readonly WATCH_RELEASE_IGNORED: "KUROT_WATCH_RELEASE_IGNORED";
|
|
9
|
+
readonly CONFIG_RELOAD_FAILED: "KUROT_CONFIG_RELOAD_FAILED";
|
|
10
|
+
readonly CONFIG_RESTART_REQUIRED: "KUROT_CONFIG_RESTART_REQUIRED";
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
13
|
* Union of diagnostic codes currently defined by the CLI.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAMtF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
@@ -6,6 +6,8 @@ export const DIAGNOSTIC_CODES = {
|
|
|
6
6
|
KUI_COMPILE_FAILED: 'KUROT_KUI_COMPILE_FAILED',
|
|
7
7
|
KUI_DUPLICATE_DEFAULT: 'KUROT_KUI_DUPLICATE_DEFAULT',
|
|
8
8
|
WATCH_RELEASE_IGNORED: 'KUROT_WATCH_RELEASE_IGNORED',
|
|
9
|
+
CONFIG_RELOAD_FAILED: 'KUROT_CONFIG_RELOAD_FAILED',
|
|
10
|
+
CONFIG_RESTART_REQUIRED: 'KUROT_CONFIG_RESTART_REQUIRED',
|
|
9
11
|
};
|
|
10
12
|
const STRICT_DIAGNOSTIC_CODES = new Set([
|
|
11
13
|
DIAGNOSTIC_CODES.KUI_UNKNOWN_TAG,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,eAAe,EAAE,uBAAuB;IACxC,kBAAkB,EAAE,0BAA0B;IAC9C,qBAAqB,EAAE,6BAA6B;IACpD,qBAAqB,EAAE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,eAAe,EAAE,uBAAuB;IACxC,kBAAkB,EAAE,0BAA0B;IAC9C,qBAAqB,EAAE,6BAA6B;IACpD,qBAAqB,EAAE,6BAA6B;IACpD,oBAAoB,EAAE,4BAA4B;IAClD,uBAAuB,EAAE,+BAA+B;CAC/C,CAAC;AAOX,MAAM,uBAAuB,GAAgC,IAAI,GAAG,CAAC;IACpE,gBAAgB,CAAC,eAAe;CAChC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IAClD,OAAO,uBAAuB,CAAC,GAAG,CAAC,IAAsB,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -33,7 +33,7 @@ export type DevEvent = {
|
|
|
33
33
|
readonly url: string;
|
|
34
34
|
} | {
|
|
35
35
|
readonly type: 'build-start';
|
|
36
|
-
readonly reason: 'initial' | 'kui-change' | 'source-change' | 'resource-change';
|
|
36
|
+
readonly reason: 'initial' | 'kui-change' | 'source-change' | 'resource-change' | 'config-change';
|
|
37
37
|
} | {
|
|
38
38
|
readonly type: 'diagnostic';
|
|
39
39
|
readonly diagnostic: Diagnostic;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/core/diagnostics/output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG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U,EAAE,MAAM,CAAA;CAAE,CAAC;AAG/F;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB,CAGjF;AAGD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAG7E;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,QAAQ,GAAG,IAAI,CAE5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { BuildPlugin } from '../pipeline.js';
|
|
1
|
+
import type { BuildContext, BuildPlugin } from '../pipeline.js';
|
|
2
2
|
import type { Project } from '../project.js';
|
|
3
|
+
import type { StageConfig } from '../config.js';
|
|
3
4
|
/**
|
|
4
5
|
* Writes `index.html`.
|
|
5
6
|
*
|
|
@@ -9,6 +10,11 @@ import type { Project } from '../project.js';
|
|
|
9
10
|
* the engine via the user's own `createPlayer()` call.
|
|
10
11
|
*/
|
|
11
12
|
export declare function generateHtml(): BuildPlugin;
|
|
13
|
+
/**
|
|
14
|
+
* Publish a complete entry page with the supplied stage defaults. A failed
|
|
15
|
+
* render/write keeps the previous page; the immutable build project is unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export declare function writeStageHtml(ctx: BuildContext, stage: StageConfig): Promise<void>;
|
|
12
18
|
/**
|
|
13
19
|
* Replaces every required Kurot placeholder in the page template.
|
|
14
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-html.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/generate-html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-html.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/generate-html.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAoDhD;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,WAAW,CAY1C;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAYzF;AAiCD;;GAEG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,MAAM,CA0BR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs/promises';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
3
4
|
import { BuildError } from '../errors.js';
|
|
4
5
|
import { writeFile } from '../../utils/fs.js';
|
|
5
6
|
const PLACEHOLDERS = {
|
|
@@ -65,14 +66,29 @@ export function generateHtml() {
|
|
|
65
66
|
* Writes the entry page with generated scripts and import-map entries.
|
|
66
67
|
*/
|
|
67
68
|
async apply(ctx) {
|
|
68
|
-
|
|
69
|
-
const template = await loadTemplate(ctx.project);
|
|
70
|
-
const html = renderHtml(template, ctx.project, entryScript, ctx.outputs.engine);
|
|
71
|
-
await writeFile(path.join(ctx.project.outputDir, 'index.html'), html);
|
|
69
|
+
await writeStageHtml(ctx, ctx.project.config.stage);
|
|
72
70
|
await copyTemplateAssets(ctx.project);
|
|
73
71
|
},
|
|
74
72
|
};
|
|
75
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Publish a complete entry page with the supplied stage defaults. A failed
|
|
76
|
+
* render/write keeps the previous page; the immutable build project is unchanged.
|
|
77
|
+
*/
|
|
78
|
+
export async function writeStageHtml(ctx, stage) {
|
|
79
|
+
const project = { ...ctx.project, config: { ...ctx.project.config, stage } };
|
|
80
|
+
const template = await loadTemplate(project);
|
|
81
|
+
const html = renderHtml(template, project, ctx.outputs.entryScript ?? 'main.js', ctx.outputs.engine);
|
|
82
|
+
const destination = path.join(project.outputDir, 'index.html');
|
|
83
|
+
const temporary = `${destination}.${randomUUID()}.tmp`;
|
|
84
|
+
try {
|
|
85
|
+
await writeFile(temporary, html);
|
|
86
|
+
await fs.rename(temporary, destination);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
await fs.rm(temporary, { force: true });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
76
92
|
/**
|
|
77
93
|
* Copies files placed beside the project HTML template into the web output.
|
|
78
94
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-html.js","sourceRoot":"","sources":["../../../src/core/plugins/generate-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-html.js","sourceRoot":"","sources":["../../../src/core/plugins/generate-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,YAAY,GAAG;IACpB,SAAS,EAAE,sBAAsB;IACjC,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,sBAAsB;IACjC,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,sBAAsB;IACjC,WAAW,EAAE,wBAAwB;CAC5B,CAAC;AAEX,MA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,SAAS,eAAe,CAAC,MAA8B;IACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,IAAI,GAAG,CAAC;SACnD,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,OAAO,qDAAqD,OAAO,6BAA6B,CAAC;AAClG,CAAC"}
|
|
@@ -8,6 +8,7 @@ export { compileSource } from './compile-source.js';
|
|
|
8
8
|
export { generateHtml } from './generate-html.js';
|
|
9
9
|
export { writeManifest } from './manifest.js';
|
|
10
10
|
export { copyAssets } from './copy-assets.js';
|
|
11
|
+
export { versionAssets } from './version-assets.js';
|
|
11
12
|
/**
|
|
12
13
|
* The standard build sequence.
|
|
13
14
|
*
|
|
@@ -16,7 +17,7 @@ export { copyAssets } from './copy-assets.js';
|
|
|
16
17
|
* files external and exclude them from per-file dev output (see
|
|
17
18
|
* `compile-source.ts`). Engine and source compilation report their output
|
|
18
19
|
* paths, then the HTML and manifest referencing them are written, and
|
|
19
|
-
* finally static assets are copied.
|
|
20
|
+
* finally static assets are copied and optionally versioned for release.
|
|
20
21
|
*/
|
|
21
22
|
export declare function defaultPlugins(): BuildPlugin[];
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYlD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,WAAW,EAAE,CAa9C"}
|
|
@@ -7,6 +7,7 @@ import { compileSource } from './compile-source.js';
|
|
|
7
7
|
import { generateHtml } from './generate-html.js';
|
|
8
8
|
import { writeManifest } from './manifest.js';
|
|
9
9
|
import { copyAssets } from './copy-assets.js';
|
|
10
|
+
import { versionAssets } from './version-assets.js';
|
|
10
11
|
export { cleanOutput } from './clean-output.js';
|
|
11
12
|
export { compileKUI } from './compile-kui.js';
|
|
12
13
|
export { compileEngine } from './compile-engine.js';
|
|
@@ -16,6 +17,7 @@ export { compileSource } from './compile-source.js';
|
|
|
16
17
|
export { generateHtml } from './generate-html.js';
|
|
17
18
|
export { writeManifest } from './manifest.js';
|
|
18
19
|
export { copyAssets } from './copy-assets.js';
|
|
20
|
+
export { versionAssets } from './version-assets.js';
|
|
19
21
|
/**
|
|
20
22
|
* The standard build sequence.
|
|
21
23
|
*
|
|
@@ -24,7 +26,7 @@ export { copyAssets } from './copy-assets.js';
|
|
|
24
26
|
* files external and exclude them from per-file dev output (see
|
|
25
27
|
* `compile-source.ts`). Engine and source compilation report their output
|
|
26
28
|
* paths, then the HTML and manifest referencing them are written, and
|
|
27
|
-
* finally static assets are copied.
|
|
29
|
+
* finally static assets are copied and optionally versioned for release.
|
|
28
30
|
*/
|
|
29
31
|
export function defaultPlugins() {
|
|
30
32
|
return [
|
|
@@ -37,6 +39,7 @@ export function defaultPlugins() {
|
|
|
37
39
|
generateHtml(),
|
|
38
40
|
writeManifest(),
|
|
39
41
|
copyAssets(),
|
|
42
|
+
versionAssets(),
|
|
40
43
|
];
|
|
41
44
|
}
|
|
42
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO;QACN,WAAW,EAAE;QACb,UAAU,EAAE;QACZ,aAAa,EAAE;QACf,uBAAuB,EAAE;QACzB,qBAAqB,EAAE;QACvB,aAAa,EAAE;QACf,YAAY,EAAE;QACd,aAAa,EAAE;QACf,UAAU,EAAE;QACZ,aAAa,EAAE;KACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BuildPlugin } from '../pipeline.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gives every relative release URL one content-addressed base, including
|
|
4
|
+
* secondary analyzer requests, fonts and assets owned by the HTML template.
|
|
5
|
+
*/
|
|
6
|
+
export declare function versionAssets(): BuildPlugin;
|
|
7
|
+
//# sourceMappingURL=version-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-assets.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/version-assets.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,aAAa,IAAI,WAAW,CAyC3C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { createReadStream } from 'node:fs';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { defaultTreeAdapter, parse } from 'parse5';
|
|
6
|
+
import { BuildError } from '../errors.js';
|
|
7
|
+
/**
|
|
8
|
+
* Gives every relative release URL one content-addressed base, including
|
|
9
|
+
* secondary analyzer requests, fonts and assets owned by the HTML template.
|
|
10
|
+
*/
|
|
11
|
+
export function versionAssets() {
|
|
12
|
+
return {
|
|
13
|
+
name: 'version release assets',
|
|
14
|
+
async apply(ctx) {
|
|
15
|
+
if (ctx.project.mode !== 'release' || !ctx.project.config.output.versionedAssets) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const outputDir = ctx.project.outputDir;
|
|
19
|
+
const htmlPath = path.join(outputDir, 'index.html');
|
|
20
|
+
const html = await fs.readFile(htmlPath, 'utf8');
|
|
21
|
+
const headEnd = validateHtml(html);
|
|
22
|
+
const version = await hashDirectory(outputDir);
|
|
23
|
+
const prefix = `assets/${version}/`;
|
|
24
|
+
const entries = await fs.readdir(outputDir);
|
|
25
|
+
const staging = await fs.mkdtemp(path.join(outputDir, '.version-assets-'));
|
|
26
|
+
try {
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
if (entry === 'index.html' || entry === 'manifest.json') {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
await fs.rename(path.join(outputDir, entry), path.join(staging, entry));
|
|
32
|
+
}
|
|
33
|
+
await fs.mkdir(path.join(outputDir, 'assets'));
|
|
34
|
+
await fs.rename(staging, path.join(outputDir, prefix));
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
await fs.rm(staging, { recursive: true, force: true });
|
|
38
|
+
}
|
|
39
|
+
prefixOutputs(ctx, prefix);
|
|
40
|
+
const manifest = {
|
|
41
|
+
initial: Object.values(ctx.outputs.engine),
|
|
42
|
+
game: [ctx.outputs.skinsScript, ctx.outputs.entryScript].filter(Boolean),
|
|
43
|
+
};
|
|
44
|
+
await fs.writeFile(path.join(outputDir, 'manifest.json'), JSON.stringify(manifest, undefined, '\t') + '\n');
|
|
45
|
+
await fs.writeFile(htmlPath, `${html.slice(0, headEnd)}\n\t<base href="./${prefix}">${html.slice(headEnd)}`);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function validateHtml(html) {
|
|
50
|
+
const document = parse(html, { sourceCodeLocationInfo: true });
|
|
51
|
+
const root = document.childNodes.find(defaultTreeAdapter.isElementNode);
|
|
52
|
+
const head = root?.childNodes.filter(defaultTreeAdapter.isElementNode).find(node => node.tagName === 'head');
|
|
53
|
+
// HTML parsing can imply a head; insertion requires its authored start tag.
|
|
54
|
+
const headEnd = head?.sourceCodeLocation?.startTag?.endOffset;
|
|
55
|
+
if (headEnd === undefined) {
|
|
56
|
+
throw new BuildError('output.versionedAssets requires an HTML template with a <head> element.');
|
|
57
|
+
}
|
|
58
|
+
const elements = root ? [root] : [];
|
|
59
|
+
while (elements.length > 0) {
|
|
60
|
+
const element = elements.pop();
|
|
61
|
+
if (element.tagName === 'base') {
|
|
62
|
+
throw new BuildError("output.versionedAssets owns the HTML base URL; remove the template's <base> element.");
|
|
63
|
+
}
|
|
64
|
+
elements.push(...element.childNodes.filter(defaultTreeAdapter.isElementNode));
|
|
65
|
+
}
|
|
66
|
+
return headEnd;
|
|
67
|
+
}
|
|
68
|
+
async function hashDirectory(root) {
|
|
69
|
+
const hash = createHash('sha256');
|
|
70
|
+
const files = await listFiles(root);
|
|
71
|
+
for (const relative of files.sort()) {
|
|
72
|
+
const file = path.join(root, relative);
|
|
73
|
+
const stat = await fs.stat(file);
|
|
74
|
+
hash.update(JSON.stringify([relative, stat.size]) + '\n');
|
|
75
|
+
for await (const chunk of createReadStream(file)) {
|
|
76
|
+
hash.update(chunk);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return hash.digest('hex').slice(0, 32);
|
|
80
|
+
}
|
|
81
|
+
async function listFiles(root, directory = '') {
|
|
82
|
+
const files = [];
|
|
83
|
+
for (const entry of await fs.readdir(path.join(root, directory), { withFileTypes: true })) {
|
|
84
|
+
const relative = path.posix.join(directory, entry.name);
|
|
85
|
+
if (entry.isDirectory()) {
|
|
86
|
+
files.push(...(await listFiles(root, relative)));
|
|
87
|
+
}
|
|
88
|
+
else if (entry.isFile()) {
|
|
89
|
+
files.push(relative);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw new BuildError(`Versioned assets require regular files or directories: ${relative}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return files;
|
|
96
|
+
}
|
|
97
|
+
function prefixOutputs(ctx, prefix) {
|
|
98
|
+
if (ctx.outputs.entryScript) {
|
|
99
|
+
ctx.outputs.entryScript = prefix + ctx.outputs.entryScript;
|
|
100
|
+
}
|
|
101
|
+
if (ctx.outputs.skinsScript) {
|
|
102
|
+
ctx.outputs.skinsScript = prefix + ctx.outputs.skinsScript;
|
|
103
|
+
}
|
|
104
|
+
for (const specifier of Object.keys(ctx.outputs.engine)) {
|
|
105
|
+
ctx.outputs.engine[specifier] = prefix + ctx.outputs.engine[specifier];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=version-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-assets.js","sourceRoot":"","sources":["../../../src/core/plugins/version-assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MA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,UAAU,CAAC,0DAA0D,QAAQ,EAAE,CAAC,CAAC;QAC5F,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,GAAiB,EAAE,MAAc;IACvD,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC7B,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5D,CAAC;IACD,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC7B,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5D,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;AACF,CAAC"}
|
package/docs/ai-context.md
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
# @kurot/cli — AI context map
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[centered flips](../../../docs/centered-flips.md) for transform and adoption contracts.
|
|
8
|
-
|
|
9
|
-
Read this before exploring `src/`. [`architecture.md`](./architecture.md)
|
|
10
|
-
explains the plugin pipeline. Version `@kurot/cli@3.6.1` is prepared locally (not published), runs on Node.js 20+,
|
|
11
|
-
and is installed as a project dev dependency.
|
|
3
|
+
`@kurot/cli@3.8.0` (prepared; publication pending) is build-time tooling on Node.js >= 20, with ordinary
|
|
4
|
+
ui-document dependency **^0.13.0**. Projects supply their own Core/UI runtime.
|
|
5
|
+
Read [architecture](architecture.md) for the plugin pipeline; the source and
|
|
6
|
+
configuration exports establish current behavior.
|
|
12
7
|
|
|
13
8
|
## Directory map
|
|
14
9
|
|
|
@@ -31,34 +26,15 @@ src/
|
|
|
31
26
|
└── utils/
|
|
32
27
|
```
|
|
33
28
|
|
|
34
|
-
Project templates are under `templates/game` and `templates/empty
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
The 2× sheet requires Core ^2.5.0; published Core 2.4.0
|
|
44
|
-
does not interpret it. Private preview tooling binds checkout Core in an isolated
|
|
45
|
-
trial. Core 2.5.0 was published before CLI 3.6.0; both are verified on npm.
|
|
46
|
-
The CLI 3.6.0 game template includes the looping mascot brand splash; registry
|
|
47
|
-
CLI 3.5.0 does not contain that HTML/logo refresh. See game-template.md.
|
|
48
|
-
The 3.2.1 game template includes fixed style/locale configuration,
|
|
49
|
-
English properties and licensed regular/bold font files. StyleManager finishes
|
|
50
|
-
font loading before Main creates Player/Preloader; LocaleManager registers
|
|
51
|
-
preload texts before creating the scene. See [game-template.md](game-template.md).
|
|
52
|
-
Version 3.3.0 is published with Label preset compilation and
|
|
53
|
-
published ui-document 0.11.0. It has no local document-kernel override.
|
|
54
|
-
Published version 3.3.1 adds whole-resource dev synchronization, deletion/reconnect
|
|
55
|
-
handling and no-store responses. Installed CLI 3.3.0 lacks these fixes; consumers
|
|
56
|
-
must update their installed/locked version to receive them.
|
|
57
|
-
|
|
58
|
-
## Native text adoption in 3.4.0
|
|
59
|
-
|
|
60
|
-
Version 3.4.0 registers BitmapLabel and RichLabel from published UI
|
|
61
|
-
3.3.0 and consumes document 0.12.0. `kui/validate-text-components.ts` applies
|
|
29
|
+
Project templates are under `templates/game` and `templates/empty`, including
|
|
30
|
+
README/AGENTS entries for installed SDK guides and project commands. The game
|
|
31
|
+
template supplies paired KUI/TS components, default skins, a 2× atlas, palette,
|
|
32
|
+
fonts, translations and splash HTML. See [template startup](game-template.md)
|
|
33
|
+
and [default skins](default-ui-skins.md).
|
|
34
|
+
|
|
35
|
+
## Native text compilation
|
|
36
|
+
|
|
37
|
+
The compiler registers BitmapLabel and RichLabel through ui-document. `kui/validate-text-components.ts` applies
|
|
62
38
|
strict shared property/state validation only to these new built-ins, preserving
|
|
63
39
|
existing CLI-only and custom class contracts. Text flows remain literal arrays;
|
|
64
40
|
Span data does not create nodes/parts. Only width/height use percent conversion.
|
|
@@ -80,11 +56,11 @@ transforms such as `flipX`/`flipY` belong on those children. Overrides use local
|
|
|
80
56
|
`property.state` attributes. Storage IDs and runtime mapping metadata are not
|
|
81
57
|
authored XML fields.
|
|
82
58
|
|
|
83
|
-
|
|
59
|
+
The compiler validates centered-flip booleans on display nodes and named-state
|
|
84
60
|
overrides, including CLI-only controls. Malformed values and flags on the
|
|
85
61
|
nonvisual Skin root fail compilation. Negative scales are preserved.
|
|
86
62
|
|
|
87
|
-
CLI
|
|
63
|
+
The CLI requires `@kurot/ui-document@^0.13.0`. Schema-defined strings, including
|
|
88
64
|
numeric/boolean-looking text and state text, are literal attributes without
|
|
89
65
|
backslash type escaping. Old synthetic prefixes become literal characters;
|
|
90
66
|
do not migrate them silently. Numeric/boolean properties and schema-free
|
|
@@ -107,10 +83,9 @@ as the part name. Internal nodes can omit `id`; the declaration augments
|
|
|
107
83
|
component classes. The file is development metadata and is excluded from
|
|
108
84
|
runtime output.
|
|
109
85
|
|
|
110
|
-
|
|
111
|
-
preserving Component's accessor kind under `skipLibCheck=false`.
|
|
112
|
-
|
|
113
|
-
the fixed CLI; do not change Core/UI or hand-edit the generated declaration.
|
|
86
|
+
The generator narrows host `skinParts` through a getter signature,
|
|
87
|
+
preserving Component's accessor kind under `skipLibCheck=false`. Regenerate after
|
|
88
|
+
authored Skin changes; keep generated declarations out of manual edits.
|
|
114
89
|
|
|
115
90
|
## Reusable components
|
|
116
91
|
|
|
@@ -132,7 +107,7 @@ manual prefix cannot conflict with `ui.components.namespace`.
|
|
|
132
107
|
`--strict` or release policy.
|
|
133
108
|
- Machine diagnostic modes own stdout: build emits one JSON result; dev emits
|
|
134
109
|
JSONL lifecycle events.
|
|
135
|
-
-
|
|
110
|
+
- Dev watches all resource assets even without UI, emits
|
|
136
111
|
resource-change for copy-only batches, retains KUI requirements across mixed
|
|
137
112
|
batches, and reconciles deletions. Browser refresh remains manual; HTTP is
|
|
138
113
|
no-store. Per-file staging/rename is not an atomic atlas pair transaction.
|
|
@@ -143,9 +118,8 @@ manual prefix cannot conflict with `ui.components.namespace`.
|
|
|
143
118
|
- Engine and custom namespace chunks share `ctx.outputs.engine` because the
|
|
144
119
|
import-map writer treats both as external specifier mappings.
|
|
145
120
|
- Engine and reusable namespace bundles preserve class names in both modes.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
names only. Theme fallback uses constructor names.
|
|
121
|
+
Self-referencing classes retain stable names in both modes because Theme
|
|
122
|
+
fallback uses constructor names.
|
|
149
123
|
- The Skin module builder stages output in a temporary directory and installs a
|
|
150
124
|
bundle only after every Skin succeeds.
|
|
151
125
|
- `cleanOutput` wipes the active output directory at the start of each build.
|
|
@@ -153,11 +127,10 @@ manual prefix cannot conflict with `ui.components.namespace`.
|
|
|
153
127
|
- `create` queries the npm registry for current Kurot package versions and falls
|
|
154
128
|
back to `latest` if the request fails.
|
|
155
129
|
- Release output is timestamped and `manifest.json` exists only in release.
|
|
156
|
-
-
|
|
130
|
+
- Asset copying omits empty runtime directory trees,
|
|
157
131
|
including skin-only `resource/ui`. Runtime files under UI directories remain
|
|
158
132
|
eligible; generated theme JSON and the compiled Skin module remain required.
|
|
159
|
-
Template copies still preserve empty directories.
|
|
160
|
-
include this correction.
|
|
133
|
+
Template copies still preserve empty directories.
|
|
161
134
|
|
|
162
135
|
## Plugin order
|
|
163
136
|
|
|
@@ -171,11 +144,24 @@ manual prefix cannot conflict with `ui.components.namespace`.
|
|
|
171
144
|
6. compile application source;
|
|
172
145
|
7. generate HTML;
|
|
173
146
|
8. write the release manifest;
|
|
174
|
-
9. copy runtime assets
|
|
147
|
+
9. copy runtime assets;
|
|
148
|
+
10. optionally version release assets with `output.versionedAssets`.
|
|
175
149
|
|
|
176
150
|
Do not reorder namespace or source compilation without reviewing externalization
|
|
177
151
|
in `namespace-external-plugin.ts`.
|
|
178
152
|
|
|
153
|
+
Release versioning runs last so the digest covers generated themes, scripts,
|
|
154
|
+
resource bytes and template assets. It keeps index.html/manifest.json at the
|
|
155
|
+
output root and moves all other files under assets/<hash>/. The HTML base URL
|
|
156
|
+
versions document-relative requests; callers that explicitly resolve URLs must
|
|
157
|
+
use document.baseURI. Existing UI Theme must receive an absolute config URL.
|
|
158
|
+
See [release assets](release-assets.md). This option requires CLI >= 3.7.0 within 3.x.
|
|
159
|
+
|
|
160
|
+
Since CLI 3.8.0, root ESM config stage changes regenerate HTML in `kurot dev` without
|
|
161
|
+
restarting dev; `core/config-watcher.ts` owns this path. See
|
|
162
|
+
[development watching](dev-resource-watching.md). Core canvas-attribute startup
|
|
163
|
+
requires Core >= 2.6.0 within 2.x; explicit overrides remain supported.
|
|
164
|
+
|
|
179
165
|
## Configuration lookup
|
|
180
166
|
|
|
181
167
|
| Task | File |
|
|
@@ -205,14 +191,14 @@ pnpm test
|
|
|
205
191
|
CLI end-to-end tests bind localhost and may require permission in a restricted
|
|
206
192
|
execution environment.
|
|
207
193
|
|
|
208
|
-
## Resource configuration
|
|
194
|
+
## Resource configuration
|
|
209
195
|
|
|
210
196
|
KUI builds validate object subkeys, resolve resource nine-slice defaults, and
|
|
211
197
|
watch the manifest during development. See
|
|
212
198
|
[the resource-default contract](../../ui-document/docs/resource-nine-slice.md)
|
|
213
199
|
for conversion and compilation boundaries.
|
|
214
200
|
|
|
215
|
-
## Label text compilation
|
|
201
|
+
## Label text compilation
|
|
216
202
|
|
|
217
203
|
The compiler consumes the shared ui-document catalog and emits Label `textFit`,
|
|
218
204
|
`minFontSize`, authored `size` and state-size overrides unchanged. Runtime
|
|
@@ -222,7 +208,7 @@ within their respective majors. Neither engine is a CLI runtime dependency.
|
|
|
222
208
|
See [text compilation](label-text-layout.md) and
|
|
223
209
|
[native Label text layout](../../ui/docs/label-text-layout.md) for the boundary.
|
|
224
210
|
|
|
225
|
-
## Project styles
|
|
211
|
+
## Project styles
|
|
226
212
|
|
|
227
213
|
Read [project styles](../../ui-document/docs/project-styles.md). buildSkinsModule
|
|
228
214
|
reads the optional fixed config/style.json once per build and forwards its numeric
|
|
@@ -233,13 +219,11 @@ without migrating files. Fonts are validated but not loaded; the application own
|
|
|
233
219
|
font loading and rendering. Build/preview copies resolve references while authored
|
|
234
220
|
XML retains them. No live runtime palette switching is introduced.
|
|
235
221
|
|
|
236
|
-
## Label presets
|
|
222
|
+
## Label presets
|
|
237
223
|
|
|
238
224
|
skin-module-builder.ts reads the entire stylesheet once per build and passes it
|
|
239
225
|
through parseToIR/parseKUISkin. Resolve resource defaults, then Label presets, then colors before
|
|
240
226
|
native emission; retain XML references and local/state precedence. compileKUI
|
|
241
227
|
accepts an optional styleSheet. style.json changes already trigger whole-Skin
|
|
242
|
-
rebuilds. Invalid presets retain the last successful bundle.
|
|
243
|
-
lockfile used published ui-document 0.11.0 without a local override. Current
|
|
244
|
-
CLI 3.5.0 development uses published ui-document 0.13.0. textStyle is
|
|
228
|
+
rebuilds. Invalid presets retain the last successful bundle. textStyle is
|
|
245
229
|
Default-only; individual named-state fields can still override preset properties.
|