@kurot/cli 1.0.2 → 1.1.1
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 +53 -1
- package/LICENSE +21 -0
- package/README.md +41 -11
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +49 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +19 -5
- package/dist/commands/dev.js.map +1 -1
- package/dist/core/dev-server.d.ts +9 -0
- package/dist/core/dev-server.d.ts.map +1 -1
- package/dist/core/dev-server.js +40 -16
- package/dist/core/dev-server.js.map +1 -1
- package/dist/core/diagnostics/codes.d.ts +21 -0
- package/dist/core/diagnostics/codes.d.ts.map +1 -0
- package/dist/core/diagnostics/codes.js +25 -0
- package/dist/core/diagnostics/codes.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +28 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -0
- package/dist/core/diagnostics/collector.js +78 -0
- package/dist/core/diagnostics/collector.js.map +1 -0
- package/dist/core/diagnostics/index.d.ts +7 -0
- package/dist/core/diagnostics/index.d.ts.map +1 -0
- package/dist/core/diagnostics/index.js +4 -0
- package/dist/core/diagnostics/index.js.map +1 -0
- package/dist/core/diagnostics/output.d.ts +30 -0
- package/dist/core/diagnostics/output.d.ts.map +1 -0
- package/dist/core/diagnostics/output.js +15 -0
- package/dist/core/diagnostics/output.js.map +1 -0
- package/dist/core/diagnostics/types.d.ts +30 -0
- package/dist/core/diagnostics/types.d.ts.map +1 -0
- package/dist/core/diagnostics/types.js +2 -0
- package/dist/core/diagnostics/types.js.map +1 -0
- package/dist/core/exml/ast.d.ts +9 -1
- package/dist/core/exml/ast.d.ts.map +1 -1
- package/dist/core/exml/exml-diagnostics.d.ts +7 -0
- package/dist/core/exml/exml-diagnostics.d.ts.map +1 -0
- package/dist/core/exml/exml-diagnostics.js +26 -0
- package/dist/core/exml/exml-diagnostics.js.map +1 -0
- package/dist/core/exml/exml-parser.d.ts.map +1 -1
- package/dist/core/exml/exml-parser.js +1 -1
- package/dist/core/exml/exml-parser.js.map +1 -1
- package/dist/core/exml/index.d.ts +5 -3
- package/dist/core/exml/index.d.ts.map +1 -1
- package/dist/core/exml/index.js +2 -1
- package/dist/core/exml/index.js.map +1 -1
- package/dist/core/exml/registry.d.ts +7 -0
- package/dist/core/exml/registry.d.ts.map +1 -1
- package/dist/core/exml/registry.js +41 -0
- package/dist/core/exml/registry.js.map +1 -1
- package/dist/core/exml/skin-module-builder.d.ts +21 -0
- package/dist/core/exml/skin-module-builder.d.ts.map +1 -0
- package/dist/core/exml/skin-module-builder.js +103 -0
- package/dist/core/exml/skin-module-builder.js.map +1 -0
- package/dist/core/exml/source-location.d.ts +25 -0
- package/dist/core/exml/source-location.d.ts.map +1 -0
- package/dist/core/exml/source-location.js +52 -0
- package/dist/core/exml/source-location.js.map +1 -0
- package/dist/core/exml/xml-parser.d.ts +15 -0
- package/dist/core/exml/xml-parser.d.ts.map +1 -1
- package/dist/core/exml/xml-parser.js +13 -7
- package/dist/core/exml/xml-parser.js.map +1 -1
- package/dist/core/pipeline.d.ts +11 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +9 -0
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/plugins/compile-exml.d.ts.map +1 -1
- package/dist/core/plugins/compile-exml.js +101 -88
- package/dist/core/plugins/compile-exml.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +14 -5
- package/dist/utils/logger.js.map +1 -1
- package/package.json +18 -8
- package/templates/empty/src/Main.ts +6 -6
- package/templates/empty/tsconfig.json +3 -0
- package/templates/game/kurot.config.ts +3 -0
- package/templates/game/src/AssetAdapter.ts +25 -0
- package/templates/game/src/LifecycleHandler.ts +39 -0
- package/templates/game/src/Main.ts +85 -78
- package/templates/game/src/Preloader.ts +112 -0
- package/templates/game/src/game-components.ts +6 -0
- package/templates/game/template/web/logo.png +0 -0
- package/templates/game/tsconfig.json +3 -0
- package/templates/game/src/LoadingUI.ts +0 -27
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import * as os from 'node:os';
|
|
3
1
|
import * as fs from 'node:fs/promises';
|
|
4
2
|
import * as path from 'node:path';
|
|
5
|
-
import {
|
|
3
|
+
import { writeFile } from '../../utils/fs.js';
|
|
6
4
|
import { logger } from '../../utils/logger.js';
|
|
7
|
-
import {
|
|
5
|
+
import { DIAGNOSTIC_CODES } from '../diagnostics/index.js';
|
|
6
|
+
import { buildSkinsModule } from '../exml/skin-module-builder.js';
|
|
7
|
+
import { BuildError } from '../errors.js';
|
|
8
8
|
/**
|
|
9
9
|
* Compiles `.exml` skin files into a single ESM module and rewrites the theme.
|
|
10
10
|
*
|
|
@@ -23,13 +23,27 @@ export function compileExml() {
|
|
|
23
23
|
const { project } = ctx;
|
|
24
24
|
if (!project.config.exml || !project.themeFile)
|
|
25
25
|
return;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
ctx.diagnostics.removeByCodes([
|
|
27
|
+
DIAGNOSTIC_CODES.EXML_UNKNOWN_TAG,
|
|
28
|
+
DIAGNOSTIC_CODES.EXML_COMPILE_FAILED,
|
|
29
|
+
DIAGNOSTIC_CODES.EXML_DECLARED_FILE_NOT_FOUND,
|
|
30
|
+
DIAGNOSTIC_CODES.THEME_FILE_NOT_FOUND,
|
|
31
|
+
DIAGNOSTIC_CODES.THEME_INVALID_JSON,
|
|
32
|
+
DIAGNOSTIC_CODES.THEME_SKIN_NOT_FOUND,
|
|
33
|
+
]);
|
|
34
|
+
const theme = await loadTheme(ctx);
|
|
35
|
+
if (!theme) {
|
|
36
|
+
throwIfInputInvalid(ctx);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const { files, missingDeclaredPaths } = await resolveExmlFiles(ctx, theme);
|
|
40
|
+
const skins = files.map(file => ({ file, className: extractClassName(file) }));
|
|
41
|
+
reportMissingThemeSkins(ctx, theme, skins, missingDeclaredPaths);
|
|
42
|
+
throwIfInputInvalid(ctx);
|
|
28
43
|
if (files.length === 0) {
|
|
29
44
|
logger.step('no .exml files found, skipping');
|
|
30
45
|
return;
|
|
31
46
|
}
|
|
32
|
-
const skins = files.map(file => ({ file, className: extractClassName(file) }));
|
|
33
47
|
const skinsFile = await buildSkinsModule(ctx, skins);
|
|
34
48
|
ctx.outputs.skinsScript = `js/${skinsFile}`;
|
|
35
49
|
const relThemePath = project.config.exml.themeFile;
|
|
@@ -43,90 +57,33 @@ export function compileExml() {
|
|
|
43
57
|
},
|
|
44
58
|
};
|
|
45
59
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Generates one ESM module per skin in a temp dir, plus an index that imports
|
|
48
|
-
* and registers them, then bundles to `js/default.thm[.min_<hash>].js`.
|
|
49
|
-
*
|
|
50
|
-
* Engine packages and custom namespaces stay external (resolved by the page
|
|
51
|
-
* import map — see `compile-engine.ts` and `compile-custom-namespaces.ts`).
|
|
52
|
-
*/
|
|
53
|
-
async function buildSkinsModule(ctx, skins) {
|
|
54
|
-
const { project } = ctx;
|
|
55
|
-
const jsDir = path.join(project.outputDir, 'js');
|
|
56
|
-
await ensureDir(jsDir);
|
|
57
|
-
const customNamespaces = project.customNamespaces.map(ns => ({ prefix: ns.prefix, specifier: ns.specifier }));
|
|
58
|
-
const isRelease = project.mode === 'release';
|
|
59
|
-
const stubDir = await fs.mkdtemp(path.join(os.tmpdir(), 'kurot-skins-'));
|
|
60
|
-
try {
|
|
61
|
-
const indexLines = [];
|
|
62
|
-
await Promise.all(skins.map(async (skin, i) => {
|
|
63
|
-
const code = generateSkinModule(skin, customNamespaces, isRelease);
|
|
64
|
-
await fs.writeFile(path.join(stubDir, `skin${i}.ts`), code);
|
|
65
|
-
const funcName = factoryName(skin.className);
|
|
66
|
-
indexLines.push(`import { ${funcName} as s${i} } from './skin${i}.js';\n` +
|
|
67
|
-
`globalThis[${JSON.stringify(skin.className)}] = s${i};`);
|
|
68
|
-
}));
|
|
69
|
-
await fs.writeFile(path.join(stubDir, 'index.ts'), indexLines.join('\n\n') + '\n');
|
|
70
|
-
const engineExternal = project.enginePackages.length > 0 ? project.enginePackages : ['@kurot/ui', '@kurot/core'];
|
|
71
|
-
const result = await esbuild.build({
|
|
72
|
-
entryPoints: [path.join(stubDir, 'index.ts')],
|
|
73
|
-
outdir: jsDir,
|
|
74
|
-
entryNames: isRelease ? 'default.thm.min_[hash]' : 'default.thm',
|
|
75
|
-
bundle: true,
|
|
76
|
-
format: 'esm',
|
|
77
|
-
platform: 'browser',
|
|
78
|
-
target: 'es2022',
|
|
79
|
-
minify: isRelease,
|
|
80
|
-
metafile: true,
|
|
81
|
-
logLevel: 'warning',
|
|
82
|
-
external: [...engineExternal, ...project.customNamespaces.map(ns => ns.specifier)],
|
|
83
|
-
});
|
|
84
|
-
const output = Object.keys(result.metafile.outputs).find(f => f.endsWith('.js'));
|
|
85
|
-
return path.basename(output ?? 'default.thm.js');
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
await fs.rm(stubDir, { recursive: true, force: true });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Generates an ESM skin factory, returning a stub on parse failure.
|
|
93
|
-
*/
|
|
94
|
-
function generateSkinModule(skin, customNamespaces, strict) {
|
|
95
|
-
try {
|
|
96
|
-
const ir = parseToIR(skin.file.contents, skin.className, customNamespaces);
|
|
97
|
-
if (ir.unresolvedTags.length > 0) {
|
|
98
|
-
const tags = [...new Set(ir.unresolvedTags)].join(', ');
|
|
99
|
-
logger.warn(`${skin.file.relPath}: unresolved tag(s) dropped from skin: ${tags}`);
|
|
100
|
-
}
|
|
101
|
-
return generateCode(ir, { format: 'esm' });
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
105
|
-
if (strict) {
|
|
106
|
-
throw new Error(`EXML compile failed for ${skin.file.relPath}: ${message}`, { cause: err });
|
|
107
|
-
}
|
|
108
|
-
logger.warn(`EXML compile failed for ${skin.file.relPath}: ${message}`);
|
|
109
|
-
return `// Failed to compile ${skin.file.relPath}: ${message}\nexport function ${factoryName(skin.className)}() { return {}; }\n`;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
60
|
/**
|
|
113
61
|
* Determines which `.exml` files to compile (honours `autoGenerateExmlsList`).
|
|
114
62
|
*/
|
|
115
|
-
async function resolveExmlFiles(
|
|
63
|
+
async function resolveExmlFiles(ctx, theme) {
|
|
64
|
+
const { project } = ctx;
|
|
116
65
|
const declared = (theme.exmls ?? []).map(e => (typeof e === 'string' ? e : e?.path)).filter(Boolean);
|
|
117
66
|
if (theme.autoGenerateExmlsList === false && declared.length > 0) {
|
|
118
67
|
const files = [];
|
|
68
|
+
const missingDeclaredPaths = new Set();
|
|
119
69
|
for (const rel of declared) {
|
|
120
70
|
try {
|
|
121
71
|
files.push(await readExmlAt(project.resourceDir, resolveExmlPath(project, rel)));
|
|
122
72
|
}
|
|
123
73
|
catch {
|
|
124
|
-
|
|
74
|
+
missingDeclaredPaths.add(toResourceRelativePath(project, rel));
|
|
75
|
+
reportDiagnostic(ctx, {
|
|
76
|
+
code: DIAGNOSTIC_CODES.EXML_DECLARED_FILE_NOT_FOUND,
|
|
77
|
+
severity: 'warning',
|
|
78
|
+
message: `Theme-declared EXML file was not found: ${rel}`,
|
|
79
|
+
location: { file: project.config.exml.themeFile },
|
|
80
|
+
suggestions: ['Correct the path or remove it from the theme exmls list.'],
|
|
81
|
+
});
|
|
125
82
|
}
|
|
126
83
|
}
|
|
127
|
-
return files;
|
|
84
|
+
return { files, missingDeclaredPaths };
|
|
128
85
|
}
|
|
129
|
-
return collectExmlFiles(project.resourceDir);
|
|
86
|
+
return { files: await collectExmlFiles(project.resourceDir), missingDeclaredPaths: new Set() };
|
|
130
87
|
}
|
|
131
88
|
/**
|
|
132
89
|
* Recursively collects every `.exml` file under `resource/`, sorted by path.
|
|
@@ -172,16 +129,75 @@ async function readExmlAt(resourceDir, absolute) {
|
|
|
172
129
|
};
|
|
173
130
|
}
|
|
174
131
|
/**
|
|
175
|
-
* Reads the
|
|
132
|
+
* Reads and parses the configured theme file.
|
|
176
133
|
*/
|
|
177
|
-
async function loadTheme(
|
|
134
|
+
async function loadTheme(ctx) {
|
|
135
|
+
const { project } = ctx;
|
|
136
|
+
let source;
|
|
178
137
|
try {
|
|
179
|
-
|
|
138
|
+
source = await fs.readFile(project.themeFile, 'utf-8');
|
|
180
139
|
}
|
|
181
140
|
catch {
|
|
182
|
-
|
|
141
|
+
reportDiagnostic(ctx, {
|
|
142
|
+
code: DIAGNOSTIC_CODES.THEME_FILE_NOT_FOUND,
|
|
143
|
+
severity: 'warning',
|
|
144
|
+
message: `Theme file could not be read: ${project.config.exml.themeFile}`,
|
|
145
|
+
location: { file: project.config.exml.themeFile },
|
|
146
|
+
suggestions: ['Create the theme file or correct exml.themeFile in kurot.config.ts.'],
|
|
147
|
+
});
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
return JSON.parse(source);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
155
|
+
reportDiagnostic(ctx, {
|
|
156
|
+
code: DIAGNOSTIC_CODES.THEME_INVALID_JSON,
|
|
157
|
+
severity: 'error',
|
|
158
|
+
message: `Theme file is not valid JSON: ${message}`,
|
|
159
|
+
location: { file: project.config.exml.themeFile },
|
|
160
|
+
suggestions: ['Correct the JSON syntax in the theme file.'],
|
|
161
|
+
});
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function reportMissingThemeSkins(ctx, theme, compiled, missingDeclaredPaths) {
|
|
166
|
+
const { project } = ctx;
|
|
167
|
+
const compiledPaths = new Set(compiled.map(skin => skin.file.relPath));
|
|
168
|
+
for (const value of Object.values(theme.skins ?? {})) {
|
|
169
|
+
if (!isSkinPath(value))
|
|
170
|
+
continue;
|
|
171
|
+
const relPath = toResourceRelativePath(project, value);
|
|
172
|
+
if (compiledPaths.has(relPath) || missingDeclaredPaths.has(relPath))
|
|
173
|
+
continue;
|
|
174
|
+
reportDiagnostic(ctx, {
|
|
175
|
+
code: DIAGNOSTIC_CODES.THEME_SKIN_NOT_FOUND,
|
|
176
|
+
severity: 'warning',
|
|
177
|
+
message: `Theme skin was not compiled: ${value}`,
|
|
178
|
+
location: { file: project.config.exml.themeFile },
|
|
179
|
+
suggestions: ['Correct the skin path or add the EXML file to the compilation list.'],
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function toResourceRelativePath(project, value) {
|
|
184
|
+
return toPosix(path.relative(project.resourceDir, resolveExmlPath(project, value)));
|
|
185
|
+
}
|
|
186
|
+
function reportDiagnostic(ctx, diagnostic) {
|
|
187
|
+
ctx.diagnostics.report(diagnostic);
|
|
188
|
+
const location = diagnostic.location ? `${diagnostic.location.file}: ` : '';
|
|
189
|
+
if (diagnostic.severity === 'error') {
|
|
190
|
+
logger.error(`${location}${diagnostic.message}`);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
logger.warn(`${location}${diagnostic.message}`);
|
|
183
194
|
}
|
|
184
195
|
}
|
|
196
|
+
function throwIfInputInvalid(ctx) {
|
|
197
|
+
if (!ctx.diagnostics.hasErrors())
|
|
198
|
+
return;
|
|
199
|
+
throw new BuildError('EXML input validation failed.');
|
|
200
|
+
}
|
|
185
201
|
/**
|
|
186
202
|
* Rewrites the `skins` map to class names: Egret path values
|
|
187
203
|
* (`resource/skins/X.exml`) are matched to their compiled skin; values that are
|
|
@@ -191,7 +207,7 @@ function remapSkins(project, skins, compiled) {
|
|
|
191
207
|
const byRelPath = new Map(compiled.map(s => [s.file.relPath, s.className]));
|
|
192
208
|
const result = {};
|
|
193
209
|
for (const [host, value] of Object.entries(skins)) {
|
|
194
|
-
if (
|
|
210
|
+
if (isSkinPath(value)) {
|
|
195
211
|
const relPath = toPosix(path.relative(project.resourceDir, resolveExmlPath(project, value)));
|
|
196
212
|
result[host] = byRelPath.get(relPath) ?? value;
|
|
197
213
|
}
|
|
@@ -201,6 +217,9 @@ function remapSkins(project, skins, compiled) {
|
|
|
201
217
|
}
|
|
202
218
|
return result;
|
|
203
219
|
}
|
|
220
|
+
function isSkinPath(value) {
|
|
221
|
+
return /\.exml$/i.test(value) || value.includes('/');
|
|
222
|
+
}
|
|
204
223
|
/**
|
|
205
224
|
* Reads the `class="..."` attribute, falling back to the file name.
|
|
206
225
|
*/
|
|
@@ -208,12 +227,6 @@ function extractClassName(file) {
|
|
|
208
227
|
const match = file.contents.match(/class="([^"]+)"/);
|
|
209
228
|
return match ? match[1] : path.basename(file.path, '.exml');
|
|
210
229
|
}
|
|
211
|
-
/**
|
|
212
|
-
* `skins.ButtonSkin` → `createButtonSkin` (matches the EXML codegen).
|
|
213
|
-
*/
|
|
214
|
-
function factoryName(className) {
|
|
215
|
-
return `create${className.split('.').pop()}`;
|
|
216
|
-
}
|
|
217
230
|
/**
|
|
218
231
|
* Converts a file system path to forward-slash form (a no-op on POSIX).
|
|
219
232
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-exml.js","sourceRoot":"","sources":["../../../src/core/plugins/compile-exml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"compile-exml.js","sourceRoot":"","sources":["../../../src/core/plugins/compile-exml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAA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AC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7F,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;QAChD,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAChC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,IAAc;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { buildCommand } from './commands/build.js';
|
|
|
7
7
|
import { createCommand } from './commands/create.js';
|
|
8
8
|
import { cleanCommand } from './commands/clean.js';
|
|
9
9
|
import { devCommand } from './commands/dev.js';
|
|
10
|
+
import { logger } from './utils/logger.js';
|
|
10
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
12
|
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
12
13
|
const program = new Command();
|
|
@@ -15,5 +16,11 @@ program.addCommand(buildCommand);
|
|
|
15
16
|
program.addCommand(devCommand);
|
|
16
17
|
program.addCommand(createCommand);
|
|
17
18
|
program.addCommand(cleanCommand);
|
|
18
|
-
|
|
19
|
+
try {
|
|
20
|
+
await program.parseAsync();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
}
|
|
19
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAElF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAEjF,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC/B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAEjC,IAAI,CAAC;IACJ,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC5B,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IAChB,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAgBA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAErD;AAED,eAAO,MAAM,MAAM;gBACN,MAAM,KAAG,IAAI;mBACV,MAAM,KAAG,IAAI;gBAChB,MAAM,KAAG,IAAI;iBACZ,MAAM,KAAG,IAAI;IAC1B;;OAEG;gBACS,MAAM,KAAG,IAAI;CACzB,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -5,14 +5,23 @@ const red = '\x1b[31m';
|
|
|
5
5
|
const cyan = '\x1b[36m';
|
|
6
6
|
const dim = '\x1b[2m';
|
|
7
7
|
const tag = `${cyan}[kurot]${reset}`;
|
|
8
|
+
let enabled = true;
|
|
9
|
+
function write(method, message) {
|
|
10
|
+
if (!enabled)
|
|
11
|
+
return;
|
|
12
|
+
console[method](message);
|
|
13
|
+
}
|
|
14
|
+
export function setLoggerEnabled(value) {
|
|
15
|
+
enabled = value;
|
|
16
|
+
}
|
|
8
17
|
export const logger = {
|
|
9
|
-
info: (msg) =>
|
|
10
|
-
success: (msg) =>
|
|
11
|
-
warn: (msg) =>
|
|
12
|
-
error: (msg) =>
|
|
18
|
+
info: (msg) => write('log', `${tag} ${msg}`),
|
|
19
|
+
success: (msg) => write('log', `${tag} ${green}${msg}${reset}`),
|
|
20
|
+
warn: (msg) => write('warn', `${tag} ${yellow}${msg}${reset}`),
|
|
21
|
+
error: (msg) => write('error', `${tag} ${red}${msg}${reset}`),
|
|
13
22
|
/**
|
|
14
23
|
* Logs a single pipeline step, indented under the current command.
|
|
15
24
|
*/
|
|
16
|
-
step: (msg) =>
|
|
25
|
+
step: (msg) => write('log', `${tag} ${dim}›${reset} ${msg}`),
|
|
17
26
|
};
|
|
18
27
|
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,KAAK,GAAG,UAAU,CAAC;AACz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E,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAC5E,KAAK,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAC3E;;OAEG;IACH,IAAI,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;CAC1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurot/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Kurot CLI - build tool for the Kurot game engine",
|
|
5
|
+
"author": "Kelvin <kyia.x52@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"type": "module",
|
|
8
|
+
"main": "./dist/define.js",
|
|
9
|
+
"types": "./dist/define.d.ts",
|
|
6
10
|
"bin": {
|
|
7
11
|
"kurot": "./dist/index.js"
|
|
8
12
|
},
|
|
9
|
-
"main": "./dist/define.js",
|
|
10
|
-
"types": "./dist/define.d.ts",
|
|
11
13
|
"files": [
|
|
12
14
|
"dist",
|
|
13
15
|
"templates",
|
|
14
16
|
"README.md",
|
|
15
|
-
"CHANGELOG.md"
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"LICENSE"
|
|
16
19
|
],
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc --build",
|
|
22
22
|
"dev": "tsc --watch",
|
|
@@ -36,10 +36,20 @@
|
|
|
36
36
|
"typescript": "^5.6.0",
|
|
37
37
|
"vitest": "^4.1.4"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"keywords": [
|
|
40
|
+
"kurot",
|
|
41
|
+
"cli",
|
|
42
|
+
"game-engine",
|
|
43
|
+
"exml",
|
|
44
|
+
"typescript"
|
|
45
|
+
],
|
|
40
46
|
"repository": {
|
|
41
47
|
"type": "git",
|
|
42
48
|
"url": "git+https://github.com/kurot-engine/kurot.git",
|
|
43
49
|
"directory": "packages/cli"
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "pnpm@10.33.0",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kurot
|
|
2
|
+
* Kurot empty project template.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* A minimal entry point that depends only on @kurot/core and contains no UI components.
|
|
5
|
+
* Suitable for Canvas rendering, custom drawing, and animation experiments.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Lifecycle: constructor → ADDED_TO_STAGE → $onAddToStage
|
|
8
8
|
*/
|
|
9
9
|
import { createPlayer, Sprite, Event } from '@kurot/core';
|
|
10
10
|
|
|
@@ -15,12 +15,12 @@ class Main extends Sprite {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
private onAddedToStage(_event: Event): void {
|
|
18
|
-
//
|
|
18
|
+
// Add your game logic here.
|
|
19
19
|
console.log('Kurot game started');
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// ──
|
|
23
|
+
// ── Bootstrap ─────────────────────────────────────────────────────────────
|
|
24
24
|
const app = createPlayer({
|
|
25
25
|
canvas: document.getElementById('gameCanvas') as HTMLCanvasElement,
|
|
26
26
|
contentWidth: 640,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Texture, resource } from '@kurot/core';
|
|
2
|
+
import { DefaultAssetAdapter, type IAssetAdapter } from '@kurot/ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Connects UI asset sources to the project's resource system.
|
|
6
|
+
*/
|
|
7
|
+
export class AssetAdapter implements IAssetAdapter {
|
|
8
|
+
|
|
9
|
+
private readonly fallback = new DefaultAssetAdapter();
|
|
10
|
+
|
|
11
|
+
getAsset(
|
|
12
|
+
source: string,
|
|
13
|
+
callback: (content: Texture | undefined, source: string) => void,
|
|
14
|
+
): void {
|
|
15
|
+
const cached = resource.get<Texture>(source);
|
|
16
|
+
if (cached) {
|
|
17
|
+
callback(cached, source);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
resource.load<Texture>(source)
|
|
22
|
+
.then(content => callback(content, source))
|
|
23
|
+
.catch(() => this.fallback.getAsset(source, callback));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Event, type Stage } from '@kurot/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Manages application-specific foreground and background behavior.
|
|
5
|
+
*
|
|
6
|
+
* Kurot pauses and resumes its ticker automatically. Add project-level
|
|
7
|
+
* behavior such as music, network, or worker handling to this class.
|
|
8
|
+
*/
|
|
9
|
+
export class LifecycleHandler {
|
|
10
|
+
|
|
11
|
+
private static _stage?: Stage;
|
|
12
|
+
|
|
13
|
+
static init(stage: Stage): void {
|
|
14
|
+
if (this._stage === stage) return;
|
|
15
|
+
|
|
16
|
+
this.clear();
|
|
17
|
+
this._stage = stage;
|
|
18
|
+
this._stage.addEventListener(Event.DEACTIVATE, this.onPause);
|
|
19
|
+
this._stage.addEventListener(Event.ACTIVATE, this.onResume);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static clear(): void {
|
|
23
|
+
if (!this._stage) return;
|
|
24
|
+
|
|
25
|
+
this._stage.removeEventListener(Event.DEACTIVATE, this.onPause);
|
|
26
|
+
this._stage.removeEventListener(Event.ACTIVATE, this.onResume);
|
|
27
|
+
this._stage = undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private static onPause = (): void => {
|
|
31
|
+
// Add application-specific background behavior here.
|
|
32
|
+
console.log('paused');
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
private static onResume = (): void => {
|
|
36
|
+
// Add application-specific foreground behavior here.
|
|
37
|
+
console.log('resumed');
|
|
38
|
+
};
|
|
39
|
+
}
|