@kurot/cli 1.0.2

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.
Files changed (162) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +296 -0
  3. package/dist/commands/build.d.ts +3 -0
  4. package/dist/commands/build.d.ts.map +1 -0
  5. package/dist/commands/build.js +59 -0
  6. package/dist/commands/build.js.map +1 -0
  7. package/dist/commands/clean.d.ts +3 -0
  8. package/dist/commands/clean.d.ts.map +1 -0
  9. package/dist/commands/clean.js +15 -0
  10. package/dist/commands/clean.js.map +1 -0
  11. package/dist/commands/create.d.ts +3 -0
  12. package/dist/commands/create.d.ts.map +1 -0
  13. package/dist/commands/create.js +24 -0
  14. package/dist/commands/create.js.map +1 -0
  15. package/dist/commands/dev.d.ts +3 -0
  16. package/dist/commands/dev.d.ts.map +1 -0
  17. package/dist/commands/dev.js +25 -0
  18. package/dist/commands/dev.js.map +1 -0
  19. package/dist/core/config.d.ts +94 -0
  20. package/dist/core/config.d.ts.map +1 -0
  21. package/dist/core/config.js +70 -0
  22. package/dist/core/config.js.map +1 -0
  23. package/dist/core/dev-server.d.ts +21 -0
  24. package/dist/core/dev-server.d.ts.map +1 -0
  25. package/dist/core/dev-server.js +113 -0
  26. package/dist/core/dev-server.js.map +1 -0
  27. package/dist/core/errors.d.ts +16 -0
  28. package/dist/core/errors.d.ts.map +1 -0
  29. package/dist/core/errors.js +23 -0
  30. package/dist/core/errors.js.map +1 -0
  31. package/dist/core/exml/ast.d.ts +243 -0
  32. package/dist/core/exml/ast.d.ts.map +1 -0
  33. package/dist/core/exml/ast.js +8 -0
  34. package/dist/core/exml/ast.js.map +1 -0
  35. package/dist/core/exml/codegen.d.ts +23 -0
  36. package/dist/core/exml/codegen.d.ts.map +1 -0
  37. package/dist/core/exml/codegen.js +422 -0
  38. package/dist/core/exml/codegen.js.map +1 -0
  39. package/dist/core/exml/exml-parser.d.ts +27 -0
  40. package/dist/core/exml/exml-parser.d.ts.map +1 -0
  41. package/dist/core/exml/exml-parser.js +466 -0
  42. package/dist/core/exml/exml-parser.js.map +1 -0
  43. package/dist/core/exml/index.d.ts +52 -0
  44. package/dist/core/exml/index.d.ts.map +1 -0
  45. package/dist/core/exml/index.js +51 -0
  46. package/dist/core/exml/index.js.map +1 -0
  47. package/dist/core/exml/registry.d.ts +92 -0
  48. package/dist/core/exml/registry.d.ts.map +1 -0
  49. package/dist/core/exml/registry.js +177 -0
  50. package/dist/core/exml/registry.js.map +1 -0
  51. package/dist/core/exml/xml-parser.d.ts +61 -0
  52. package/dist/core/exml/xml-parser.d.ts.map +1 -0
  53. package/dist/core/exml/xml-parser.js +201 -0
  54. package/dist/core/exml/xml-parser.js.map +1 -0
  55. package/dist/core/namespace-external-plugin.d.ts +45 -0
  56. package/dist/core/namespace-external-plugin.d.ts.map +1 -0
  57. package/dist/core/namespace-external-plugin.js +66 -0
  58. package/dist/core/namespace-external-plugin.js.map +1 -0
  59. package/dist/core/pipeline.d.ts +75 -0
  60. package/dist/core/pipeline.d.ts.map +1 -0
  61. package/dist/core/pipeline.js +30 -0
  62. package/dist/core/pipeline.js.map +1 -0
  63. package/dist/core/plugins/clean-output.d.ts +3 -0
  64. package/dist/core/plugins/clean-output.d.ts.map +1 -0
  65. package/dist/core/plugins/clean-output.js +11 -0
  66. package/dist/core/plugins/clean-output.js.map +1 -0
  67. package/dist/core/plugins/compile-custom-namespaces.d.ts +19 -0
  68. package/dist/core/plugins/compile-custom-namespaces.d.ts.map +1 -0
  69. package/dist/core/plugins/compile-custom-namespaces.js +104 -0
  70. package/dist/core/plugins/compile-custom-namespaces.js.map +1 -0
  71. package/dist/core/plugins/compile-engine.d.ts +19 -0
  72. package/dist/core/plugins/compile-engine.d.ts.map +1 -0
  73. package/dist/core/plugins/compile-engine.js +75 -0
  74. package/dist/core/plugins/compile-engine.js.map +1 -0
  75. package/dist/core/plugins/compile-exml.d.ts +14 -0
  76. package/dist/core/plugins/compile-exml.d.ts.map +1 -0
  77. package/dist/core/plugins/compile-exml.js +223 -0
  78. package/dist/core/plugins/compile-exml.js.map +1 -0
  79. package/dist/core/plugins/compile-source.d.ts +14 -0
  80. package/dist/core/plugins/compile-source.d.ts.map +1 -0
  81. package/dist/core/plugins/compile-source.js +132 -0
  82. package/dist/core/plugins/compile-source.js.map +1 -0
  83. package/dist/core/plugins/copy-assets.d.ts +12 -0
  84. package/dist/core/plugins/copy-assets.d.ts.map +1 -0
  85. package/dist/core/plugins/copy-assets.js +33 -0
  86. package/dist/core/plugins/copy-assets.js.map +1 -0
  87. package/dist/core/plugins/generate-html.d.ts +16 -0
  88. package/dist/core/plugins/generate-html.d.ts.map +1 -0
  89. package/dist/core/plugins/generate-html.js +137 -0
  90. package/dist/core/plugins/generate-html.js.map +1 -0
  91. package/dist/core/plugins/index.d.ts +21 -0
  92. package/dist/core/plugins/index.d.ts.map +1 -0
  93. package/dist/core/plugins/index.js +39 -0
  94. package/dist/core/plugins/index.js.map +1 -0
  95. package/dist/core/plugins/manifest.d.ts +14 -0
  96. package/dist/core/plugins/manifest.d.ts.map +1 -0
  97. package/dist/core/plugins/manifest.js +28 -0
  98. package/dist/core/plugins/manifest.js.map +1 -0
  99. package/dist/core/project.d.ts +95 -0
  100. package/dist/core/project.d.ts.map +1 -0
  101. package/dist/core/project.js +79 -0
  102. package/dist/core/project.js.map +1 -0
  103. package/dist/core/template.d.ts +13 -0
  104. package/dist/core/template.d.ts.map +1 -0
  105. package/dist/core/template.js +79 -0
  106. package/dist/core/template.js.map +1 -0
  107. package/dist/define.d.ts +2 -0
  108. package/dist/define.d.ts.map +1 -0
  109. package/dist/define.js +2 -0
  110. package/dist/define.js.map +1 -0
  111. package/dist/index.d.ts +3 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +19 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/utils/fs.d.ts +5 -0
  116. package/dist/utils/fs.d.ts.map +1 -0
  117. package/dist/utils/fs.js +30 -0
  118. package/dist/utils/fs.js.map +1 -0
  119. package/dist/utils/logger.d.ts +11 -0
  120. package/dist/utils/logger.d.ts.map +1 -0
  121. package/dist/utils/logger.js +18 -0
  122. package/dist/utils/logger.js.map +1 -0
  123. package/package.json +45 -0
  124. package/templates/empty/kurot.config.ts +13 -0
  125. package/templates/empty/package.json +17 -0
  126. package/templates/empty/pnpm-workspace.yaml +3 -0
  127. package/templates/empty/src/Main.ts +32 -0
  128. package/templates/empty/template/web/index.html +38 -0
  129. package/templates/empty/tsconfig.json +10 -0
  130. package/templates/game/kurot.config.ts +16 -0
  131. package/templates/game/package.json +19 -0
  132. package/templates/game/pnpm-workspace.yaml +3 -0
  133. package/templates/game/resource/assets/eui.json +24 -0
  134. package/templates/game/resource/assets/eui.png +0 -0
  135. package/templates/game/resource/default.res.json +15 -0
  136. package/templates/game/resource/default.thm.json +19 -0
  137. package/templates/game/resource/skins/ButtonSkin.exml +16 -0
  138. package/templates/game/resource/skins/CheckBoxSkin.exml +18 -0
  139. package/templates/game/resource/skins/ComboBoxSkin.exml +31 -0
  140. package/templates/game/resource/skins/GroupSkin.exml +4 -0
  141. package/templates/game/resource/skins/HScrollBarSkin.exml +6 -0
  142. package/templates/game/resource/skins/HSliderSkin.exml +7 -0
  143. package/templates/game/resource/skins/ImageSkin.exml +4 -0
  144. package/templates/game/resource/skins/ItemRendererSkin.exml +15 -0
  145. package/templates/game/resource/skins/LabelSkin.exml +7 -0
  146. package/templates/game/resource/skins/ListSkin.exml +11 -0
  147. package/templates/game/resource/skins/PanelSkin.exml +15 -0
  148. package/templates/game/resource/skins/ProgressBarSkin.exml +11 -0
  149. package/templates/game/resource/skins/RadioButtonSkin.exml +18 -0
  150. package/templates/game/resource/skins/ScrollerSkin.exml +8 -0
  151. package/templates/game/resource/skins/TabBarSkin.exml +6 -0
  152. package/templates/game/resource/skins/TextInputSkin.exml +22 -0
  153. package/templates/game/resource/skins/ToggleButtonSkin.exml +21 -0
  154. package/templates/game/resource/skins/ToggleSwitchSkin.exml +15 -0
  155. package/templates/game/resource/skins/VScrollBarSkin.exml +6 -0
  156. package/templates/game/resource/skins/VSliderSkin.exml +7 -0
  157. package/templates/game/resource/skins/ViewStackSkin.exml +4 -0
  158. package/templates/game/src/LoadingUI.ts +27 -0
  159. package/templates/game/src/Main.ts +165 -0
  160. package/templates/game/template/web/index.html +109 -0
  161. package/templates/game/template/web/logo.png +0 -0
  162. package/templates/game/tsconfig.json +10 -0
@@ -0,0 +1,94 @@
1
+ export type BuildTarget = 'html5';
2
+ export interface StageConfig {
3
+ /**
4
+ * Stage width in points.
5
+ */
6
+ width: number;
7
+ /**
8
+ * Stage height in points.
9
+ */
10
+ height: number;
11
+ /**
12
+ * Egret-style scale mode: `showAll` | `noScale` | `exactFit` | `noBorder` |
13
+ * `fixedHeight` | `fixedWidth` | `fixedNarrow` | `fixedWide`.
14
+ */
15
+ scaleMode: string;
16
+ /**
17
+ * Preferred device orientation (e.g. `auto`, `portrait`, `landscape`).
18
+ */
19
+ orientation: string;
20
+ /**
21
+ * Target frame rate, in frames per second.
22
+ */
23
+ frameRate: number;
24
+ }
25
+ export interface ExmlConfig {
26
+ /**
27
+ * Path to the Egret-style theme file (e.g. `resource/default.thm.json`),
28
+ * relative to the project root.
29
+ */
30
+ themeFile: string;
31
+ /**
32
+ * Custom EXML namespaces for project-defined components, matching Egret's
33
+ * `xmlns:game="game.*"` convention. Maps the namespace prefix used in EXML
34
+ * (e.g. `game`) to a barrel file that exports every class referenced under
35
+ * that namespace (e.g. `src/ui/index.ts` re-exporting `HeroNarrowIR`, etc.).
36
+ *
37
+ * Each barrel is bundled into its own chunk and wired into both the app and
38
+ * skins bundles via an import map, so a class referenced from EXML and from
39
+ * game code resolves to the same module instance (no duplicate class identity).
40
+ */
41
+ namespaces?: Record<string, string>;
42
+ }
43
+ export interface OutputConfig {
44
+ /**
45
+ * Development build output directory, relative to the project root
46
+ * (default: `bin-debug`). Release builds always go to
47
+ * `bin-release/web/<timestamp>` regardless of this setting.
48
+ */
49
+ dir: string;
50
+ }
51
+ export interface HtmlConfig {
52
+ /**
53
+ * Path to the project-owned HTML template, relative to the project root.
54
+ * Omit to use the CLI's built-in default template.
55
+ */
56
+ template: string;
57
+ }
58
+ export interface ProjectConfig {
59
+ /**
60
+ * Build target platform. Only `html5` is currently supported.
61
+ */
62
+ target: BuildTarget;
63
+ /**
64
+ * Path to the entry source file, relative to the project root
65
+ * (default: `src/Main.ts`).
66
+ */
67
+ entry: string;
68
+ /**
69
+ * Development build output settings.
70
+ */
71
+ output: OutputConfig;
72
+ /**
73
+ * HTML page template settings. Omit to use the built-in default page.
74
+ */
75
+ html?: HtmlConfig;
76
+ /**
77
+ * Stage / canvas configuration.
78
+ */
79
+ stage: StageConfig;
80
+ /**
81
+ * EXML compilation settings. Omit to disable EXML support entirely.
82
+ */
83
+ exml?: ExmlConfig;
84
+ }
85
+ /**
86
+ * Loads and validates `kurot.config.ts` (or `.js`) from the current working
87
+ * directory, merging it over `DEFAULTS`. Falls back to `DEFAULTS` entirely
88
+ * when no config file is present.
89
+ *
90
+ * @returns The validated project configuration
91
+ * @throws {ConfigError} If `stage.frameRate`, `stage.scaleMode`, or `entry` is invalid
92
+ */
93
+ export declare function loadConfig(): Promise<ProjectConfig>;
94
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC5B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IAC1B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB;AA0BD;;;;;;;GAOG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CA6CzD"}
@@ -0,0 +1,70 @@
1
+ import * as path from 'node:path';
2
+ import { exists } from '../utils/fs.js';
3
+ import { ConfigError } from './errors.js';
4
+ const DEFAULTS = {
5
+ target: 'html5',
6
+ entry: 'src/Main.ts',
7
+ output: { dir: 'bin-debug' },
8
+ stage: {
9
+ width: 640,
10
+ height: 1136,
11
+ scaleMode: 'showAll',
12
+ orientation: 'auto',
13
+ frameRate: 60,
14
+ },
15
+ };
16
+ const VALID_SCALE_MODES = [
17
+ 'showAll',
18
+ 'noScale',
19
+ 'exactFit',
20
+ 'noBorder',
21
+ 'fixedHeight',
22
+ 'fixedWidth',
23
+ 'fixedNarrow',
24
+ 'fixedWide',
25
+ ];
26
+ /**
27
+ * Loads and validates `kurot.config.ts` (or `.js`) from the current working
28
+ * directory, merging it over `DEFAULTS`. Falls back to `DEFAULTS` entirely
29
+ * when no config file is present.
30
+ *
31
+ * @returns The validated project configuration
32
+ * @throws {ConfigError} If `stage.frameRate`, `stage.scaleMode`, or `entry` is invalid
33
+ */
34
+ export async function loadConfig() {
35
+ const configPath = path.resolve('kurot.config.ts');
36
+ const jsConfigPath = path.resolve('kurot.config.js');
37
+ let config;
38
+ if ((await exists(configPath)) || (await exists(jsConfigPath))) {
39
+ // Dynamic import of `kurot.config.ts` relies on Node's built-in
40
+ // TypeScript type-stripping support (no `tsx`/`ts-node` involved).
41
+ const mod = await import((await exists(configPath)) ? configPath : jsConfigPath);
42
+ const userConfig = mod.default ?? mod;
43
+ config = { ...DEFAULTS, ...userConfig, stage: { ...DEFAULTS.stage, ...userConfig.stage } };
44
+ }
45
+ else {
46
+ config = DEFAULTS;
47
+ }
48
+ // Validate stage.frameRate
49
+ if (!Number.isInteger(config.stage.frameRate) || config.stage.frameRate <= 0) {
50
+ throw new ConfigError(`Invalid config: stage.frameRate must be a positive integer, got ${config.stage.frameRate}`);
51
+ }
52
+ // Validate stage.scaleMode
53
+ if (!VALID_SCALE_MODES.includes(config.stage.scaleMode)) {
54
+ throw new ConfigError(`Invalid config: stage.scaleMode must be one of ${VALID_SCALE_MODES.map(m => `'${m}'`).join(', ')}, got '${config.stage.scaleMode}'`);
55
+ }
56
+ // Validate entry file exists
57
+ const entryPath = path.resolve(config.entry);
58
+ if (!(await exists(entryPath))) {
59
+ throw new ConfigError(`Invalid config: entry file '${config.entry}' does not exist`);
60
+ }
61
+ // Validate HTML template exists
62
+ if (config.html) {
63
+ const templatePath = path.resolve(config.html.template);
64
+ if (!(await exists(templatePath))) {
65
+ throw new ConfigError(`Invalid config: HTML template '${config.html.template}' does not exist`);
66
+ }
67
+ }
68
+ return config;
69
+ }
70
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,a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
4
+ * Port for the dev server to listen on.
5
+ */
6
+ port: number;
7
+ /**
8
+ * Whether to generate sourcemaps for the app bundle.
9
+ */
10
+ sourcemap: boolean;
11
+ }
12
+ /**
13
+ * Starts a development server.
14
+ *
15
+ * The build pipeline runs once with watch enabled: esbuild rebuilds `main.js`
16
+ * on every source change, and an `fs.watch` on `resource/` recompiles EXML and
17
+ * re-copies assets. Files are served straight from the output directory.
18
+ * The browser is not auto-reloaded — refresh manually to pick up changes.
19
+ */
20
+ export declare function startDevServer(project: Project, options: DevServerOptions): Promise<void>;
21
+ //# sourceMappingURL=dev-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAY5C,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/F"}
@@ -0,0 +1,113 @@
1
+ import * as http from 'node:http';
2
+ import * as fs from 'node:fs/promises';
3
+ import * as fsSync from 'node:fs';
4
+ import * as path from 'node:path';
5
+ import { createContext, runPipeline, disposeContext } from './pipeline.js';
6
+ import { compileExml, compileEngine, compileCustomNamespaces, compileSource, generateHtml, copyAssets, } from './plugins/index.js';
7
+ import { logger } from '../utils/logger.js';
8
+ /**
9
+ * Starts a development server.
10
+ *
11
+ * The build pipeline runs once with watch enabled: esbuild rebuilds `main.js`
12
+ * on every source change, and an `fs.watch` on `resource/` recompiles EXML and
13
+ * re-copies assets. Files are served straight from the output directory.
14
+ * The browser is not auto-reloaded — refresh manually to pick up changes.
15
+ */
16
+ export async function startDevServer(project, options) {
17
+ const ctx = createContext(project, { sourcemap: options.sourcemap, watch: true });
18
+ await runPipeline(ctx, [
19
+ compileExml(),
20
+ compileEngine(),
21
+ compileCustomNamespaces(),
22
+ compileSource(),
23
+ generateHtml(),
24
+ copyAssets(),
25
+ ]);
26
+ watchResources(project, ctx);
27
+ const server = startHttpServer(project, options.port);
28
+ process.on('SIGINT', async () => {
29
+ logger.info('Stopping dev server...');
30
+ await disposeContext(ctx);
31
+ server.close();
32
+ process.exit(0);
33
+ });
34
+ }
35
+ /**
36
+ * Recompiles EXML and re-copies assets when a `.exml` file changes.
37
+ */
38
+ function watchResources(project, ctx) {
39
+ if (!project.config.exml)
40
+ return;
41
+ let debounce;
42
+ let watcher;
43
+ try {
44
+ watcher = fsSync.watch(project.resourceDir, { recursive: true }, (_event, filename) => {
45
+ if (!filename || !filename.endsWith('.exml'))
46
+ return;
47
+ clearTimeout(debounce);
48
+ debounce = setTimeout(async () => {
49
+ logger.info(`EXML changed: ${path.basename(filename)}, recompiling...`);
50
+ try {
51
+ await compileExml().apply(ctx);
52
+ await copyAssets().apply(ctx);
53
+ }
54
+ catch (err) {
55
+ logger.warn(`EXML recompile failed: ${err instanceof Error ? err.message : err}`);
56
+ }
57
+ }, 100);
58
+ });
59
+ }
60
+ catch {
61
+ logger.warn('EXML watcher unavailable (recursive fs.watch unsupported on this platform).');
62
+ return;
63
+ }
64
+ ctx.disposers.push(() => watcher.close());
65
+ }
66
+ /**
67
+ * Serves static files from the project output directory.
68
+ */
69
+ function startHttpServer(project, port) {
70
+ const server = http.createServer(async (req, res) => {
71
+ const url = (req.url ?? '/').split('?')[0];
72
+ const filePath = path.join(project.outputDir, url === '/' ? 'index.html' : url);
73
+ try {
74
+ const data = await fs.readFile(filePath);
75
+ res.writeHead(200, { 'Content-Type': mimeType(filePath) });
76
+ res.end(data);
77
+ }
78
+ catch {
79
+ res.writeHead(404);
80
+ res.end('Not found');
81
+ }
82
+ });
83
+ server.listen(port, () => {
84
+ logger.success(`Dev server running at http://localhost:${port}`);
85
+ logger.info('Watching for changes (refresh the browser to reload)...');
86
+ });
87
+ return server;
88
+ }
89
+ const MIME_TYPES = {
90
+ '.html': 'text/html; charset=utf-8',
91
+ '.js': 'application/javascript',
92
+ '.mjs': 'application/javascript',
93
+ '.map': 'application/json',
94
+ '.css': 'text/css',
95
+ '.json': 'application/json',
96
+ '.png': 'image/png',
97
+ '.jpg': 'image/jpeg',
98
+ '.jpeg': 'image/jpeg',
99
+ '.gif': 'image/gif',
100
+ '.svg': 'image/svg+xml',
101
+ '.webp': 'image/webp',
102
+ '.mp3': 'audio/mpeg',
103
+ '.ogg': 'audio/ogg',
104
+ '.wav': 'audio/wav',
105
+ '.mp4': 'video/mp4',
106
+ '.woff': 'font/woff',
107
+ '.woff2': 'font/woff2',
108
+ '.ttf': 'font/ttf',
109
+ };
110
+ function mimeType(filePath) {
111
+ return MIME_TYPES[path.extname(filePath).toLowerCase()] ?? 'application/octet-stream';
112
+ }
113
+ //# sourceMappingURL=dev-server.js.map
@@ -0,0 +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;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAC9F,OAAO,EACN,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAa5C;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAgB,EAAE,OAAyB;IAC/E,MAAM,GAAG,GAAG,aAAa,CAAC,O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CAAC,CAAC;YAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACR,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACnB,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACtB,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,OAAO,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;QACjE,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,GAA2B;IAC1C,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,wBAAwB;IAChC,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;CAClB,CAAC;AAEF,SAAS,QAAQ,CAAC,QAAgB;IACjC,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,0BAA0B,CAAC;AACvF,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A build step failed. Thrown by the CLI's `build` command and caught at the
3
+ * top level to print a friendly error instead of a raw stack trace.
4
+ */
5
+ export declare class BuildError extends Error {
6
+ readonly cause?: Error | undefined;
7
+ constructor(message: string, cause?: Error | undefined);
8
+ }
9
+ /**
10
+ * `kurot.config.ts` failed validation (e.g. a missing entry file or an
11
+ * invalid `stage.scaleMode`).
12
+ */
13
+ export declare class ConfigError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAGnC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK;gBADtB,OAAO,EAAE,MAAM,EACN,KAAK,CAAC,EAAE,KAAK,YAAA;CAKvB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAI3B"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A build step failed. Thrown by the CLI's `build` command and caught at the
3
+ * top level to print a friendly error instead of a raw stack trace.
4
+ */
5
+ export class BuildError extends Error {
6
+ cause;
7
+ constructor(message, cause) {
8
+ super(message);
9
+ this.cause = cause;
10
+ this.name = 'BuildError';
11
+ }
12
+ }
13
+ /**
14
+ * `kurot.config.ts` failed validation (e.g. a missing entry file or an
15
+ * invalid `stage.scaleMode`).
16
+ */
17
+ export class ConfigError extends Error {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = 'ConfigError';
21
+ }
22
+ }
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAG1B;IAFV,YACC,OAAe,EACN,KAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,UAAK,GAAL,KAAK,CAAQ;QAGtB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC1B,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACrC,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC3B,CAAC;CACD"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * Intermediate representation (IR / AST) for a parsed EXML skin.
3
+ *
4
+ * The EXML parser converts XML → SkinIR, then the code generator
5
+ * converts SkinIR → JS source code.
6
+ */
7
+ /**
8
+ * A literal value (string, number, boolean, null).
9
+ */
10
+ export interface LiteralValue {
11
+ readonly type: 'literal';
12
+ readonly value: string | number | boolean | null;
13
+ }
14
+ /**
15
+ * A percent value (e.g. `width="100%"`).
16
+ */
17
+ export interface PercentValue {
18
+ readonly type: 'percent';
19
+ /**
20
+ * The numeric portion (e.g. `100`).
21
+ */
22
+ readonly value: number;
23
+ }
24
+ /**
25
+ * A binding expression (e.g. `"{data.name}"`).
26
+ */
27
+ export interface BindingValue {
28
+ readonly type: 'binding';
29
+ /**
30
+ * The expression string (e.g. `"data.name"`).
31
+ */
32
+ readonly expression: string;
33
+ }
34
+ /**
35
+ * A reference to a skin part by id (e.g. for an `AddItems` target).
36
+ */
37
+ export interface RefValue {
38
+ readonly type: 'ref';
39
+ /**
40
+ * The variable name in generated code.
41
+ */
42
+ readonly varName: string;
43
+ }
44
+ export type PropertyValue = LiteralValue | PercentValue | BindingValue | RefValue;
45
+ export interface PropertyAssignment {
46
+ /**
47
+ * Property name.
48
+ */
49
+ readonly name: string;
50
+ /**
51
+ * State name (empty = default, e.g. "up" from "label.up").
52
+ */
53
+ readonly state: string;
54
+ /**
55
+ * The value to assign.
56
+ */
57
+ readonly value: PropertyValue;
58
+ }
59
+ /**
60
+ * A component instance in the skin.
61
+ */
62
+ export interface SkinNode {
63
+ /**
64
+ * Tag/class name (without namespace, e.g. "Button").
65
+ */
66
+ readonly className: string;
67
+ /**
68
+ * Module to import from (e.g. "@kurot/ui").
69
+ */
70
+ readonly module: string;
71
+ /**
72
+ * Variable name in generated code (e.g. "btn1").
73
+ */
74
+ readonly varName: string;
75
+ /**
76
+ * ID (skin part name, e.g. "myBtn") or undefined.
77
+ */
78
+ readonly id?: string;
79
+ /**
80
+ * Properties to set on this node.
81
+ */
82
+ readonly properties: PropertyAssignment[];
83
+ /**
84
+ * Children assigned to the default property.
85
+ */
86
+ readonly children: SkinNode[];
87
+ /**
88
+ * Children assigned to named properties (property nodes).
89
+ */
90
+ readonly propertyChildren: PropertyChild[];
91
+ /**
92
+ * `includeIn` state names (only present in these states).
93
+ */
94
+ readonly includeIn: string[];
95
+ /**
96
+ * `excludeFrom` state names (excluded from these states).
97
+ */
98
+ readonly excludeFrom: string[];
99
+ }
100
+ /**
101
+ * A child assigned to a specific property (via property node syntax).
102
+ */
103
+ export interface PropertyChild {
104
+ /**
105
+ * Property name.
106
+ */
107
+ readonly propertyName: string;
108
+ /**
109
+ * The child node(s) — usually a single node or text content.
110
+ */
111
+ readonly nodes: (SkinNode | string)[];
112
+ }
113
+ export interface StateAddItems {
114
+ readonly type: 'AddItems';
115
+ /**
116
+ * ID of the item to add.
117
+ */
118
+ readonly targetId: string;
119
+ /**
120
+ * ID of the destination container.
121
+ */
122
+ readonly destinationId: string;
123
+ /**
124
+ * Insertion index (-1 = append).
125
+ */
126
+ readonly position: number;
127
+ /**
128
+ * Property name on the destination.
129
+ */
130
+ readonly propertyName: string;
131
+ }
132
+ export interface StateSetProperty {
133
+ readonly type: 'SetProperty';
134
+ /**
135
+ * ID of the target (empty = skin itself).
136
+ */
137
+ readonly targetId: string;
138
+ /**
139
+ * Property name.
140
+ */
141
+ readonly name: string;
142
+ /**
143
+ * Value to set.
144
+ */
145
+ readonly value: PropertyValue;
146
+ }
147
+ export interface StateSetStateProperty {
148
+ readonly type: 'SetStateProperty';
149
+ /**
150
+ * Property name.
151
+ */
152
+ readonly name: string;
153
+ /**
154
+ * Value to set.
155
+ */
156
+ readonly value: PropertyValue;
157
+ /**
158
+ * State that triggers this.
159
+ */
160
+ readonly stateName: string;
161
+ }
162
+ export type StateOverride = StateAddItems | StateSetProperty | StateSetStateProperty;
163
+ export interface StateDef {
164
+ /**
165
+ * State name (e.g. "up", "down", "disabled").
166
+ */
167
+ readonly name: string;
168
+ /**
169
+ * State groups this state belongs to.
170
+ */
171
+ readonly stateGroups: string[];
172
+ /**
173
+ * State-specific overrides.
174
+ */
175
+ readonly overrides: StateOverride[];
176
+ }
177
+ export interface BindingDef {
178
+ /**
179
+ * Target variable name.
180
+ */
181
+ readonly targetVar: string;
182
+ /**
183
+ * Target property name.
184
+ */
185
+ readonly targetProp: string;
186
+ /**
187
+ * Binding expression string.
188
+ */
189
+ readonly expression: string;
190
+ }
191
+ export interface SkinIR {
192
+ /**
193
+ * Skin class name (e.g. "MySkin").
194
+ */
195
+ readonly className: string;
196
+ /**
197
+ * Superclass name (default: "Skin").
198
+ */
199
+ readonly superClassName: string;
200
+ /**
201
+ * Skin width (from root attributes).
202
+ */
203
+ readonly width?: number;
204
+ /**
205
+ * Skin height (from root attributes).
206
+ */
207
+ readonly height?: number;
208
+ /**
209
+ * Other properties declared on the root Skin element.
210
+ */
211
+ readonly properties: PropertyAssignment[];
212
+ /**
213
+ * All imports needed: className → module.
214
+ */
215
+ readonly imports: Map<string, string>;
216
+ /**
217
+ * Skin part IDs.
218
+ */
219
+ readonly skinParts: string[];
220
+ /**
221
+ * Visual children of the skin.
222
+ */
223
+ readonly children: SkinNode[];
224
+ /**
225
+ * Property children of the skin.
226
+ */
227
+ readonly propertyChildren: PropertyChild[];
228
+ /**
229
+ * State definitions.
230
+ */
231
+ readonly states: StateDef[];
232
+ /**
233
+ * Inline declarations (non-visual).
234
+ */
235
+ readonly declarations: SkinNode[];
236
+ /**
237
+ * Tag names that could not be resolved to a component or a project-defined
238
+ * namespace (see `NamespaceModule`). These are silently dropped from the
239
+ * generated skin, so callers should surface them as build warnings.
240
+ */
241
+ readonly unresolvedTags: string[];
242
+ }
243
+ //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,QAAQ,EAAE,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;CAClC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Intermediate representation (IR / AST) for a parsed EXML skin.
3
+ *
4
+ * The EXML parser converts XML → SkinIR, then the code generator
5
+ * converts SkinIR → JS source code.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=ast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/core/exml/ast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Code generator — converts SkinIR into JavaScript source code.
3
+ *
4
+ * Generates ESM-compatible factory functions that create and configure
5
+ * Skin instances with all components, states, and bindings.
6
+ */
7
+ import type { SkinIR } from './ast.js';
8
+ export interface CodeGenOptions {
9
+ /**
10
+ * Output format. Only `'esm'` is supported (import/export statements for
11
+ * use as ES modules). Retained as an option for forward compatibility.
12
+ */
13
+ format?: 'esm';
14
+ }
15
+ /**
16
+ * Generate JavaScript source code from a SkinIR.
17
+ *
18
+ * @param ir - The skin intermediate representation
19
+ * @param options - Code generation options
20
+ * @returns Generated JS source string
21
+ */
22
+ export declare function generateCode(ir: SkinIR, _options?: CodeGenOptions): string;
23
+ //# sourceMappingURL=codegen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../src/core/exml/codegen.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,MAAM,EAYN,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,cAAc;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAE1E"}