@kurot/cli 1.1.0 → 1.1.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.
- package/CHANGELOG.md +34 -0
- package/LICENSE +21 -0
- package/README.md +40 -9
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +3 -0
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/clean.d.ts +3 -0
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +3 -0
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +3 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +5 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/core/components/discover-components.d.ts +16 -0
- package/dist/core/components/discover-components.d.ts.map +1 -0
- package/dist/core/components/discover-components.js +191 -0
- package/dist/core/components/discover-components.js.map +1 -0
- package/dist/core/config.d.ts +45 -17
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +16 -6
- package/dist/core/config.js.map +1 -1
- package/dist/core/dev-server.d.ts +5 -5
- package/dist/core/dev-server.d.ts.map +1 -1
- package/dist/core/dev-server.js +97 -25
- package/dist/core/dev-server.js.map +1 -1
- package/dist/core/diagnostics/output.d.ts +31 -0
- package/dist/core/diagnostics/output.d.ts.map +1 -1
- package/dist/core/diagnostics/output.js +13 -0
- package/dist/core/diagnostics/output.js.map +1 -1
- package/dist/core/diagnostics/types.d.ts +15 -0
- package/dist/core/diagnostics/types.d.ts.map +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/exml/ast.d.ts +27 -0
- package/dist/core/exml/ast.d.ts.map +1 -1
- package/dist/core/exml/codegen.d.ts +6 -7
- package/dist/core/exml/codegen.d.ts.map +1 -1
- package/dist/core/exml/codegen.js +57 -87
- package/dist/core/exml/codegen.js.map +1 -1
- package/dist/core/exml/exml-diagnostics.d.ts +2 -1
- package/dist/core/exml/exml-diagnostics.d.ts.map +1 -1
- package/dist/core/exml/exml-diagnostics.js +2 -2
- package/dist/core/exml/exml-diagnostics.js.map +1 -1
- package/dist/core/exml/exml-parser.d.ts +11 -11
- package/dist/core/exml/exml-parser.d.ts.map +1 -1
- package/dist/core/exml/exml-parser.js +90 -178
- package/dist/core/exml/exml-parser.js.map +1 -1
- package/dist/core/exml/index.d.ts +13 -13
- package/dist/core/exml/index.d.ts.map +1 -1
- package/dist/core/exml/index.js +12 -13
- package/dist/core/exml/index.js.map +1 -1
- package/dist/core/exml/registry.d.ts +39 -33
- package/dist/core/exml/registry.d.ts.map +1 -1
- package/dist/core/exml/registry.js +56 -43
- package/dist/core/exml/registry.js.map +1 -1
- package/dist/core/exml/skin-module-builder.d.ts +14 -0
- package/dist/core/exml/skin-module-builder.d.ts.map +1 -1
- package/dist/core/exml/skin-module-builder.js +8 -2
- package/dist/core/exml/skin-module-builder.js.map +1 -1
- package/dist/core/exml/xml-parser.d.ts +36 -26
- package/dist/core/exml/xml-parser.d.ts.map +1 -1
- package/dist/core/exml/xml-parser.js +133 -144
- package/dist/core/exml/xml-parser.js.map +1 -1
- package/dist/core/namespace-external-plugin.d.ts +5 -5
- package/dist/core/namespace-external-plugin.js +5 -5
- package/dist/core/pipeline.d.ts +59 -39
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +6 -1
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/plugins/clean-output.d.ts +3 -0
- package/dist/core/plugins/clean-output.d.ts.map +1 -1
- package/dist/core/plugins/clean-output.js +3 -1
- package/dist/core/plugins/clean-output.js.map +1 -1
- package/dist/core/plugins/compile-custom-namespaces.d.ts +6 -1
- package/dist/core/plugins/compile-custom-namespaces.d.ts.map +1 -1
- package/dist/core/plugins/compile-custom-namespaces.js +74 -11
- package/dist/core/plugins/compile-custom-namespaces.js.map +1 -1
- package/dist/core/plugins/compile-engine.d.ts +2 -4
- package/dist/core/plugins/compile-engine.d.ts.map +1 -1
- package/dist/core/plugins/compile-engine.js +5 -5
- package/dist/core/plugins/compile-engine.js.map +1 -1
- package/dist/core/plugins/compile-exml.d.ts.map +1 -1
- package/dist/core/plugins/compile-exml.js +18 -3
- package/dist/core/plugins/compile-exml.js.map +1 -1
- package/dist/core/plugins/compile-source.d.ts +1 -1
- package/dist/core/plugins/compile-source.d.ts.map +1 -1
- package/dist/core/plugins/compile-source.js +10 -8
- package/dist/core/plugins/compile-source.js.map +1 -1
- package/dist/core/plugins/component-catalog.d.ts +6 -0
- package/dist/core/plugins/component-catalog.d.ts.map +1 -0
- package/dist/core/plugins/component-catalog.js +30 -0
- package/dist/core/plugins/component-catalog.js.map +1 -0
- package/dist/core/plugins/copy-assets.d.ts +1 -2
- package/dist/core/plugins/copy-assets.d.ts.map +1 -1
- package/dist/core/plugins/copy-assets.js +1 -3
- package/dist/core/plugins/copy-assets.js.map +1 -1
- package/dist/core/plugins/generate-html.d.ts.map +1 -1
- package/dist/core/plugins/generate-html.js +1 -1
- package/dist/core/plugins/generate-html.js.map +1 -1
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/index.d.ts.map +1 -1
- package/dist/core/plugins/index.js +3 -0
- package/dist/core/plugins/index.js.map +1 -1
- package/dist/core/project.d.ts +85 -6
- package/dist/core/project.d.ts.map +1 -1
- package/dist/core/project.js +53 -8
- package/dist/core/project.js.map +1 -1
- package/dist/core/template.d.ts +8 -1
- package/dist/core/template.d.ts.map +1 -1
- package/dist/core/template.js +18 -8
- package/dist/core/template.js.map +1 -1
- package/dist/define.d.ts +1 -1
- package/dist/define.d.ts.map +1 -1
- package/dist/utils/fs.d.ts +15 -0
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +15 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/logger.d.ts +7 -3
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +7 -3
- 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 +5 -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/tsconfig.json +3 -0
- package/templates/game/src/LoadingUI.ts +0 -27
- /package/templates/game/resource/skins/{ButtonSkin.exml → eui/ButtonSkin.exml} +0 -0
- /package/templates/game/resource/skins/{CheckBoxSkin.exml → eui/CheckBoxSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ComboBoxSkin.exml → eui/ComboBoxSkin.exml} +0 -0
- /package/templates/game/resource/skins/{GroupSkin.exml → eui/GroupSkin.exml} +0 -0
- /package/templates/game/resource/skins/{HScrollBarSkin.exml → eui/HScrollBarSkin.exml} +0 -0
- /package/templates/game/resource/skins/{HSliderSkin.exml → eui/HSliderSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ImageSkin.exml → eui/ImageSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ItemRendererSkin.exml → eui/ItemRendererSkin.exml} +0 -0
- /package/templates/game/resource/skins/{LabelSkin.exml → eui/LabelSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ListSkin.exml → eui/ListSkin.exml} +0 -0
- /package/templates/game/resource/skins/{PanelSkin.exml → eui/PanelSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ProgressBarSkin.exml → eui/ProgressBarSkin.exml} +0 -0
- /package/templates/game/resource/skins/{RadioButtonSkin.exml → eui/RadioButtonSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ScrollerSkin.exml → eui/ScrollerSkin.exml} +0 -0
- /package/templates/game/resource/skins/{TabBarSkin.exml → eui/TabBarSkin.exml} +0 -0
- /package/templates/game/resource/skins/{TextInputSkin.exml → eui/TextInputSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ToggleButtonSkin.exml → eui/ToggleButtonSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ToggleSwitchSkin.exml → eui/ToggleSwitchSkin.exml} +0 -0
- /package/templates/game/resource/skins/{VScrollBarSkin.exml → eui/VScrollBarSkin.exml} +0 -0
- /package/templates/game/resource/skins/{VSliderSkin.exml → eui/VSliderSkin.exml} +0 -0
- /package/templates/game/resource/skins/{ViewStackSkin.exml → eui/ViewStackSkin.exml} +0 -0
package/dist/core/project.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ProjectConfig } from './config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Output mode used to resolve a project and its build paths.
|
|
4
|
+
*/
|
|
2
5
|
export type BuildMode = 'development' | 'release';
|
|
3
6
|
/**
|
|
4
7
|
* A project-defined EXML namespace (Egret's `xmlns:game="game.*"` convention).
|
|
@@ -18,9 +21,76 @@ export interface CustomNamespace {
|
|
|
18
21
|
*/
|
|
19
22
|
readonly specifier: string;
|
|
20
23
|
/**
|
|
21
|
-
* Absolute path to
|
|
24
|
+
* Absolute path to a user-maintained barrel file. Convention-based component
|
|
25
|
+
* namespaces omit this and receive a generated entry during compilation.
|
|
22
26
|
*/
|
|
23
|
-
readonly entry
|
|
27
|
+
readonly entry?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Components exported by a generated namespace entry.
|
|
30
|
+
*/
|
|
31
|
+
readonly components?: readonly ProjectComponent[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolved directories for convention-based reusable UI components.
|
|
35
|
+
*/
|
|
36
|
+
export interface ComponentConvention {
|
|
37
|
+
/**
|
|
38
|
+
* XML namespace prefix used by component tags.
|
|
39
|
+
*/
|
|
40
|
+
readonly prefix: string;
|
|
41
|
+
/**
|
|
42
|
+
* Virtual module specifier shared by compiled skins and application code.
|
|
43
|
+
*/
|
|
44
|
+
readonly specifier: string;
|
|
45
|
+
/**
|
|
46
|
+
* Absolute directory containing component TypeScript sources.
|
|
47
|
+
*/
|
|
48
|
+
readonly sourceDir: string;
|
|
49
|
+
/**
|
|
50
|
+
* Absolute directory containing paired component skins.
|
|
51
|
+
*/
|
|
52
|
+
readonly skinDir: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A reusable component source paired with its standard EUI skin.
|
|
56
|
+
*/
|
|
57
|
+
export interface ProjectComponent {
|
|
58
|
+
/**
|
|
59
|
+
* Exported component class name.
|
|
60
|
+
*/
|
|
61
|
+
readonly name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Complete EXML tag, including the configured namespace prefix.
|
|
64
|
+
*/
|
|
65
|
+
readonly tag: string;
|
|
66
|
+
/**
|
|
67
|
+
* XML namespace prefix used by the component tag.
|
|
68
|
+
*/
|
|
69
|
+
readonly namespace: string;
|
|
70
|
+
/**
|
|
71
|
+
* Virtual module specifier that owns the component export.
|
|
72
|
+
*/
|
|
73
|
+
readonly specifier: string;
|
|
74
|
+
/**
|
|
75
|
+
* Absolute TypeScript source path.
|
|
76
|
+
*/
|
|
77
|
+
readonly source: string;
|
|
78
|
+
/**
|
|
79
|
+
* POSIX TypeScript source path relative to the project root.
|
|
80
|
+
*/
|
|
81
|
+
readonly sourceRelative: string;
|
|
82
|
+
/**
|
|
83
|
+
* Absolute EXML skin path.
|
|
84
|
+
*/
|
|
85
|
+
readonly skin: string;
|
|
86
|
+
/**
|
|
87
|
+
* POSIX EXML skin path relative to the project root.
|
|
88
|
+
*/
|
|
89
|
+
readonly skinRelative: string;
|
|
90
|
+
/**
|
|
91
|
+
* Skin class declared by the EXML root.
|
|
92
|
+
*/
|
|
93
|
+
readonly skinClass: string;
|
|
24
94
|
}
|
|
25
95
|
/**
|
|
26
96
|
* Resolved view of a Kurot project.
|
|
@@ -74,9 +144,18 @@ export interface Project {
|
|
|
74
144
|
*/
|
|
75
145
|
readonly enginePackages: string[];
|
|
76
146
|
/**
|
|
77
|
-
* Project-defined EXML namespaces
|
|
147
|
+
* Project-defined EXML namespaces from manual barrels and the generated
|
|
148
|
+
* reusable-component entry.
|
|
78
149
|
*/
|
|
79
150
|
readonly customNamespaces: CustomNamespace[];
|
|
151
|
+
/**
|
|
152
|
+
* Resolved convention-based component directories, when configured.
|
|
153
|
+
*/
|
|
154
|
+
readonly componentConvention?: ComponentConvention;
|
|
155
|
+
/**
|
|
156
|
+
* Validated reusable components discovered from the configured directories.
|
|
157
|
+
*/
|
|
158
|
+
readonly components: ProjectComponent[];
|
|
80
159
|
}
|
|
81
160
|
/**
|
|
82
161
|
* Base output folder names, used by both build and clean.
|
|
@@ -88,8 +167,8 @@ export declare const OUTPUT_DIRS: {
|
|
|
88
167
|
/**
|
|
89
168
|
* Loads and resolves the project rooted at the current working directory.
|
|
90
169
|
*
|
|
91
|
-
* @param mode -
|
|
92
|
-
* @returns The resolved project view
|
|
170
|
+
* @param mode - Build mode to resolve the project for.
|
|
171
|
+
* @returns The resolved project view.
|
|
93
172
|
*/
|
|
94
173
|
export declare function loadProject(mode: BuildMode): Promise<Project>;
|
|
95
174
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,K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AM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IACnD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAID;;GAEG;AACH,eAAO,MAAM,WAAW;;;CAAgE,CAAC;AAEzF;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAsCnE"}
|
package/dist/core/project.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import { loadConfig } from './config.js';
|
|
4
|
+
import { discoverComponents } from './components/discover-components.js';
|
|
5
|
+
import { ConfigError } from './errors.js';
|
|
6
|
+
const NAMESPACE_SPECIFIER_PREFIX = '#ns/';
|
|
4
7
|
/**
|
|
5
8
|
* Base output folder names, used by both build and clean.
|
|
6
9
|
*/
|
|
@@ -8,8 +11,8 @@ export const OUTPUT_DIRS = { development: 'bin-debug', release: 'bin-release' };
|
|
|
8
11
|
/**
|
|
9
12
|
* Loads and resolves the project rooted at the current working directory.
|
|
10
13
|
*
|
|
11
|
-
* @param mode -
|
|
12
|
-
* @returns The resolved project view
|
|
14
|
+
* @param mode - Build mode to resolve the project for.
|
|
15
|
+
* @returns The resolved project view.
|
|
13
16
|
*/
|
|
14
17
|
export async function loadProject(mode) {
|
|
15
18
|
const root = process.cwd();
|
|
@@ -17,6 +20,19 @@ export async function loadProject(mode) {
|
|
|
17
20
|
const outputDir = mode === 'release'
|
|
18
21
|
? path.resolve(root, OUTPUT_DIRS.release, 'web', timestamp())
|
|
19
22
|
: path.resolve(root, config.output.dir);
|
|
23
|
+
const componentConvention = resolveComponentConvention(root, config);
|
|
24
|
+
const components = await discoverComponents(root, componentConvention);
|
|
25
|
+
const customNamespaces = resolveCustomNamespaces(root, config.exml?.namespaces);
|
|
26
|
+
if (componentConvention) {
|
|
27
|
+
if (customNamespaces.some(namespace => namespace.prefix === componentConvention.prefix)) {
|
|
28
|
+
throw new ConfigError(`Invalid config: exml.components.namespace '${componentConvention.prefix}' conflicts with exml.namespaces.${componentConvention.prefix}`);
|
|
29
|
+
}
|
|
30
|
+
customNamespaces.push({
|
|
31
|
+
prefix: componentConvention.prefix,
|
|
32
|
+
specifier: componentConvention.specifier,
|
|
33
|
+
components,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
20
36
|
return {
|
|
21
37
|
root,
|
|
22
38
|
mode,
|
|
@@ -28,14 +44,11 @@ export async function loadProject(mode) {
|
|
|
28
44
|
htmlTemplate: config.html ? path.resolve(root, config.html.template) : undefined,
|
|
29
45
|
themeFile: config.exml ? path.resolve(root, config.exml.themeFile) : undefined,
|
|
30
46
|
enginePackages: detectEnginePackages(root),
|
|
31
|
-
customNamespaces
|
|
47
|
+
customNamespaces,
|
|
48
|
+
componentConvention,
|
|
49
|
+
components,
|
|
32
50
|
};
|
|
33
51
|
}
|
|
34
|
-
/**
|
|
35
|
-
* The specifier prefix used for project-defined EXML namespaces (kept out of
|
|
36
|
-
* npm's `@scope` space).
|
|
37
|
-
*/
|
|
38
|
-
const NAMESPACE_SPECIFIER_PREFIX = '#ns/';
|
|
39
52
|
/**
|
|
40
53
|
* Resolves `config.exml.namespaces` into `CustomNamespace` entries with
|
|
41
54
|
* absolute barrel paths.
|
|
@@ -49,6 +62,38 @@ function resolveCustomNamespaces(root, namespaces) {
|
|
|
49
62
|
entry: path.resolve(root, entry),
|
|
50
63
|
}));
|
|
51
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the reusable-component convention into absolute project paths.
|
|
67
|
+
*
|
|
68
|
+
* Source files must remain inside `src`, and component skins must remain
|
|
69
|
+
* inside `resource`; paths outside those roots are rejected as invalid config.
|
|
70
|
+
*
|
|
71
|
+
* @returns The resolved convention, or `undefined` when components are not configured.
|
|
72
|
+
* @throws {ConfigError} If either configured directory escapes its required project root.
|
|
73
|
+
*/
|
|
74
|
+
function resolveComponentConvention(root, config) {
|
|
75
|
+
const components = config.exml?.components;
|
|
76
|
+
if (!components)
|
|
77
|
+
return undefined;
|
|
78
|
+
const sourceDir = path.resolve(root, components.sourceDir);
|
|
79
|
+
const skinDir = path.resolve(root, components.skinDir);
|
|
80
|
+
if (!isWithin(path.resolve(root, 'src'), sourceDir)) {
|
|
81
|
+
throw new ConfigError('Invalid config: exml.components.sourceDir must be inside the project src directory');
|
|
82
|
+
}
|
|
83
|
+
if (!isWithin(path.resolve(root, 'resource'), skinDir)) {
|
|
84
|
+
throw new ConfigError('Invalid config: exml.components.skinDir must be inside the project resource directory');
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
prefix: components.namespace,
|
|
88
|
+
specifier: `${NAMESPACE_SPECIFIER_PREFIX}${components.namespace}`,
|
|
89
|
+
sourceDir,
|
|
90
|
+
skinDir,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function isWithin(directory, target) {
|
|
94
|
+
const relative = path.relative(directory, target);
|
|
95
|
+
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
96
|
+
}
|
|
52
97
|
/**
|
|
53
98
|
* Reads `@kurot/*` runtime dependencies (excluding the CLI) from package.json.
|
|
54
99
|
*/
|
package/dist/core/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsK1C,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAW,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAe;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,SAAS,GACd,IAAI,KAAK,SAAS;QACjB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC7D,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACvE,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,IAAI,EA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CAAC,CACjB,CAAC;AACH,CAAC"}
|
package/dist/core/template.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project templates bundled with the CLI.
|
|
3
|
+
*/
|
|
1
4
|
export declare const TEMPLATES: readonly ["game", "empty"];
|
|
5
|
+
/**
|
|
6
|
+
* Name of a bundled project template.
|
|
7
|
+
*/
|
|
2
8
|
export type TemplateName = (typeof TEMPLATES)[number];
|
|
3
9
|
/**
|
|
4
10
|
* Scaffolds a new project by copying `templates/<template>/` into `./<name>/`,
|
|
@@ -7,7 +13,8 @@ export type TemplateName = (typeof TEMPLATES)[number];
|
|
|
7
13
|
* - `name` is set to the project name.
|
|
8
14
|
* - `@kurot/cli` is pinned to the version of the CLI doing the scaffolding,
|
|
9
15
|
* so a project always uses the CLI that created it (never a stale template pin).
|
|
10
|
-
* - `@kurot/*` engine packages are
|
|
16
|
+
* - `@kurot/*` engine packages are pinned to the registry's latest concrete
|
|
17
|
+
* version, with the `latest` tag retained only as an offline fallback.
|
|
11
18
|
*/
|
|
12
19
|
export declare function scaffoldProject(name: string, template: TemplateName): Promise<void>;
|
|
13
20
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,eAAO,MAAM,SAAS,4BAA6B,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BzF"}
|
package/dist/core/template.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import * as path from 'node:path';
|
|
2
1
|
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { copyDir,
|
|
4
|
+
import { copyDir, ensureDir, exists, writeFile } from '../utils/fs.js';
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
const TEMPLATES_DIR = path.resolve(__dirname, '../../templates');
|
|
7
7
|
const CLI_PKG = path.resolve(__dirname, '../../package.json');
|
|
8
|
+
/**
|
|
9
|
+
* Project templates bundled with the CLI.
|
|
10
|
+
*/
|
|
8
11
|
export const TEMPLATES = ['game', 'empty'];
|
|
9
12
|
/**
|
|
10
13
|
* Scaffolds a new project by copying `templates/<template>/` into `./<name>/`,
|
|
@@ -13,7 +16,8 @@ export const TEMPLATES = ['game', 'empty'];
|
|
|
13
16
|
* - `name` is set to the project name.
|
|
14
17
|
* - `@kurot/cli` is pinned to the version of the CLI doing the scaffolding,
|
|
15
18
|
* so a project always uses the CLI that created it (never a stale template pin).
|
|
16
|
-
* - `@kurot/*` engine packages are
|
|
19
|
+
* - `@kurot/*` engine packages are pinned to the registry's latest concrete
|
|
20
|
+
* version, with the `latest` tag retained only as an offline fallback.
|
|
17
21
|
*/
|
|
18
22
|
export async function scaffoldProject(name, template) {
|
|
19
23
|
const templateDir = path.join(TEMPLATES_DIR, template);
|
|
@@ -25,6 +29,12 @@ export async function scaffoldProject(name, template) {
|
|
|
25
29
|
throw new Error(`Directory "${name}" already exists`);
|
|
26
30
|
}
|
|
27
31
|
await copyDir(templateDir, destDir);
|
|
32
|
+
if (template === 'game') {
|
|
33
|
+
await Promise.all([
|
|
34
|
+
ensureDir(path.join(destDir, 'src/components')),
|
|
35
|
+
ensureDir(path.join(destDir, 'resource/skins/components')),
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
28
38
|
const pkgPath = path.join(destDir, 'package.json');
|
|
29
39
|
if (await exists(pkgPath)) {
|
|
30
40
|
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));
|
|
@@ -43,10 +53,12 @@ async function pinKurotDeps(deps, cliVersion) {
|
|
|
43
53
|
if (!deps)
|
|
44
54
|
return;
|
|
45
55
|
await Promise.all(Object.keys(deps).map(async (dep) => {
|
|
46
|
-
if (dep === '@kurot/cli')
|
|
56
|
+
if (dep === '@kurot/cli') {
|
|
47
57
|
deps[dep] = `^${cliVersion}`;
|
|
48
|
-
|
|
58
|
+
}
|
|
59
|
+
else if (dep.startsWith('@kurot/')) {
|
|
49
60
|
deps[dep] = await resolveLatest(dep);
|
|
61
|
+
}
|
|
50
62
|
}));
|
|
51
63
|
}
|
|
52
64
|
/**
|
|
@@ -64,9 +76,7 @@ async function resolveLatest(pkg) {
|
|
|
64
76
|
return `^${data.version}`;
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
|
-
catch {
|
|
68
|
-
// Offline / unpublished — fall back below.
|
|
69
|
-
}
|
|
79
|
+
catch { }
|
|
70
80
|
return 'latest';
|
|
71
81
|
}
|
|
72
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AASvE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,aAAa,GAAG,IAAI,CAA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AAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAyB,CAAC;YACxD,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7C,CAAC;IACF,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IACV,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAwB,CAAC;IACnF,OAAO,GAAG,CAAC,OAAO,CAAC;AACpB,CAAC"}
|
package/dist/define.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { ProjectConfig, BuildTarget, StageConfig, ExmlConfig, OutputConfig } from './core/config.js';
|
|
1
|
+
export type { ProjectConfig, BuildTarget, StageConfig, ExmlConfig, ComponentsConfig, OutputConfig, } from './core/config.js';
|
|
2
2
|
//# sourceMappingURL=define.d.ts.map
|
package/dist/define.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,YAAY,GACZ,MAAM,kBAAkB,CAAC"}
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a directory and any missing parent directories.
|
|
3
|
+
*/
|
|
1
4
|
export declare function ensureDir(dir: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Recursively copies a directory.
|
|
7
|
+
*
|
|
8
|
+
* The optional filter receives each file's base name; directories are always
|
|
9
|
+
* traversed so matching descendants remain discoverable.
|
|
10
|
+
*/
|
|
2
11
|
export declare function copyDir(src: string, dest: string, filter?: (name: string) => boolean): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Writes a UTF-8 file after creating its parent directory.
|
|
14
|
+
*/
|
|
3
15
|
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Tests whether a filesystem path is accessible without propagating access errors.
|
|
18
|
+
*/
|
|
4
19
|
export declare function exists(filePath: string): Promise<boolean>;
|
|
5
20
|
//# sourceMappingURL=fs.d.ts.map
|
package/dist/utils/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAY1G;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhF;AAED,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAK/D"}
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAY1G;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhF;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAK/D"}
|
package/dist/utils/fs.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import * as fs from 'node:fs/promises';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a directory and any missing parent directories.
|
|
5
|
+
*/
|
|
3
6
|
export async function ensureDir(dir) {
|
|
4
7
|
await fs.mkdir(dir, { recursive: true });
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Recursively copies a directory.
|
|
11
|
+
*
|
|
12
|
+
* The optional filter receives each file's base name; directories are always
|
|
13
|
+
* traversed so matching descendants remain discoverable.
|
|
14
|
+
*/
|
|
6
15
|
export async function copyDir(src, dest, filter) {
|
|
7
16
|
await ensureDir(dest);
|
|
8
17
|
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
@@ -17,10 +26,16 @@ export async function copyDir(src, dest, filter) {
|
|
|
17
26
|
}
|
|
18
27
|
}
|
|
19
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Writes a UTF-8 file after creating its parent directory.
|
|
31
|
+
*/
|
|
20
32
|
export async function writeFile(filePath, content) {
|
|
21
33
|
await ensureDir(path.dirname(filePath));
|
|
22
34
|
await fs.writeFile(filePath, content, 'utf-8');
|
|
23
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Tests whether a filesystem path is accessible without propagating access errors.
|
|
38
|
+
*/
|
|
24
39
|
export async function exists(fil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YACzB,MAAM,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;aAAM,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC;IACF,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB,EAAE,OAAe;IAChE,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAgB;IAC5C,OAAO,EAAE;SACP,MAAM,CAAC,QAAQ,CAAC;SAChB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;SAChB,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enables or suppresses human-readable logger output.
|
|
3
|
+
* Machine-readable diagnostic modes disable it to keep stdout parseable.
|
|
4
|
+
*/
|
|
1
5
|
export declare function setLoggerEnabled(value: boolean): void;
|
|
6
|
+
/**
|
|
7
|
+
* Human-readable CLI logger with a consistent Kurot prefix and severity color.
|
|
8
|
+
*/
|
|
2
9
|
export declare const logger: {
|
|
3
10
|
info: (msg: string) => void;
|
|
4
11
|
success: (msg: string) => void;
|
|
5
12
|
warn: (msg: string) => void;
|
|
6
13
|
error: (msg: string) => void;
|
|
7
|
-
/**
|
|
8
|
-
* Logs a single pipeline step, indented under the current command.
|
|
9
|
-
*/
|
|
10
14
|
step: (msg: string) => void;
|
|
11
15
|
};
|
|
12
16
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;gBACN,MAAM,KAAG,IAAI;mBACV,MAAM,KAAG,IAAI;gBAChB,MAAM,KAAG,IAAI;iBACZ,MAAM,KAAG,IAAI;gBACd,MAAM,KAAG,IAAI;CACzB,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -11,17 +11,21 @@ function write(method, message) {
|
|
|
11
11
|
return;
|
|
12
12
|
console[method](message);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Enables or suppresses human-readable logger output.
|
|
16
|
+
* Machine-readable diagnostic modes disable it to keep stdout parseable.
|
|
17
|
+
*/
|
|
14
18
|
export function setLoggerEnabled(value) {
|
|
15
19
|
enabled = value;
|
|
16
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Human-readable CLI logger with a consistent Kurot prefix and severity color.
|
|
23
|
+
*/
|
|
17
24
|
export const logger = {
|
|
18
25
|
info: (msg) => write('log', `${tag} ${msg}`),
|
|
19
26
|
success: (msg) => write('log', `${tag} ${green}${msg}${reset}`),
|
|
20
27
|
warn: (msg) => write('warn', `${tag} ${yellow}${msg}${reset}`),
|
|
21
28
|
error: (msg) => write('error', `${tag} ${red}${msg}${reset}`),
|
|
22
|
-
/**
|
|
23
|
-
* Logs a single pipeline step, indented under the current command.
|
|
24
|
-
*/
|
|
25
29
|
step: (msg) => write('log', `${tag} ${dim}›${reset} ${msg}`),
|
|
26
30
|
};
|
|
27
31
|
//# 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;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,MAAM,GAAG,GAAG,SAAS,CAAC;AAEtB,MAAM,GAAG,GAAG,GAAG,IAAI,UAAU,KAAK,EAAE,CAAC;AAErC,IAAI,OAAO,GAAG,IAAI,CAAC;AAEnB,SAAS,KAAK,CAAC,MAAgC,EAAE,OAAe;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC9C,OAAO,GAAG,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,IAAI,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAC1D,OAAO,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAC7E,IAAI,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,MAAM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,CAAC;IAC5E,KAAK,EAAE,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAC3E,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.1.
|
|
3
|
+
"version": "1.1.2",
|
|
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
|
+
}
|