@kurot/cli 1.1.1 → 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/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 +1 -1
- package/templates/game/kurot.config.ts +4 -2
- package/templates/game/src/game-components.ts +0 -6
- /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/exml/index.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* const jsCode = generateCode(ir);
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
+
import { generateCode } from './codegen.js';
|
|
18
|
+
import { parseEXML } from './exml-parser.js';
|
|
17
19
|
// ── XML Parser ───────────────────────────────────────────────────────
|
|
18
20
|
export { parseXML, filterElements, getTextContent } from './xml-parser.js';
|
|
19
21
|
export { SourceLocator, createSourceLocator } from './source-location.js';
|
|
@@ -23,28 +25,25 @@ export { lookupComponent, getDefaultProperty, resolveModule, localName, isProper
|
|
|
23
25
|
export { parseEXML, parseSkinRoot } from './exml-parser.js';
|
|
24
26
|
// ── Code Generator ───────────────────────────────────────────────────
|
|
25
27
|
export { generateCode } from './codegen.js';
|
|
26
|
-
// ── Convenience: parse + generate in one step ────────────────────────
|
|
27
|
-
import { parseEXML } from './exml-parser.js';
|
|
28
|
-
import { generateCode } from './codegen.js';
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
29
|
+
* Compiles an EXML source string directly to JavaScript.
|
|
31
30
|
*
|
|
32
|
-
* @param source - EXML source text
|
|
33
|
-
* @param className - Optional class name
|
|
34
|
-
* @param options - Code generation options
|
|
35
|
-
* @returns Generated
|
|
31
|
+
* @param source - EXML source text.
|
|
32
|
+
* @param className - Optional class name used for the factory function name.
|
|
33
|
+
* @param options - Code generation options and project-defined namespaces.
|
|
34
|
+
* @returns Generated JavaScript source.
|
|
36
35
|
*/
|
|
37
36
|
export function compileEXML(source, className, options) {
|
|
38
37
|
const ir = parseEXML(source, className, options?.customNamespaces ?? []);
|
|
39
38
|
return generateCode(ir, options);
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
41
|
+
* Parses an EXML source string into its intermediate representation.
|
|
43
42
|
*
|
|
44
|
-
* @param source - EXML source text
|
|
45
|
-
* @param className - Optional class name
|
|
46
|
-
* @param customNamespaces - Project-defined EXML namespaces
|
|
47
|
-
* @returns
|
|
43
|
+
* @param source - EXML source text.
|
|
44
|
+
* @param className - Optional skin class name.
|
|
45
|
+
* @param customNamespaces - Project-defined EXML namespaces.
|
|
46
|
+
* @returns The parsed skin intermediate representation.
|
|
48
47
|
*/
|
|
49
48
|
export function parseToIR(source, className, customNamespaces = []) {
|
|
50
49
|
return parseEXML(source, className, customNamespaces);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/exml/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wEAAwE;AACxE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAuB1E,wEAAwE;AACxE,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,eAAe,CAAC;AAGvB,wEAAwE;AACxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/exml/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,wEAAwE;AACxE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAuB1E,wEAAwE;AACxE,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,eAAe,CAAC;AAGvB,wEAAwE;AACxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAY5C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,SAAkB,EAAE,OAA4B;IAC3F,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAC;IACzE,OAAO,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACxB,MAAc,EACd,SAAkB,EAClB,mBAA+C,EAAE;IAEjD,OAAO,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Static component registry for EXML → JS code generation.
|
|
3
3
|
*
|
|
4
|
-
* Maps
|
|
5
|
-
* and default properties.
|
|
6
|
-
* `EXMLConfig`.
|
|
4
|
+
* Maps local tag names such as `Button` and `Skin` to their module specifiers
|
|
5
|
+
* and default properties.
|
|
7
6
|
*/
|
|
8
7
|
export interface ComponentInfo {
|
|
9
8
|
/**
|
|
10
9
|
* Module path to import from (e.g. "@kurot/ui").
|
|
11
10
|
*/
|
|
12
|
-
module: string;
|
|
11
|
+
readonly module: string;
|
|
13
12
|
/**
|
|
14
13
|
* The default property name — direct children are assigned here.
|
|
15
14
|
*/
|
|
16
|
-
defaultProperty?: string;
|
|
15
|
+
readonly defaultProperty?: string;
|
|
17
16
|
/**
|
|
18
17
|
* Whether `defaultProperty` accepts an array (vs a single value).
|
|
19
18
|
*/
|
|
20
|
-
isArray?: boolean;
|
|
19
|
+
readonly isArray?: boolean;
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* A project-defined EXML namespace, matching Egret's `xmlns:game="game.*"`
|
|
@@ -32,9 +31,15 @@ export interface NamespaceModule {
|
|
|
32
31
|
* Virtual module specifier resolved via the HTML import map.
|
|
33
32
|
*/
|
|
34
33
|
readonly specifier: string;
|
|
34
|
+
/**
|
|
35
|
+
* Exact component names exported by an automatically discovered namespace.
|
|
36
|
+
* Omitted for a manually maintained namespace whose exports are only known
|
|
37
|
+
* to the module bundler.
|
|
38
|
+
*/
|
|
39
|
+
readonly componentNames?: ReadonlySet<string>;
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
|
-
*
|
|
42
|
+
* Looks up a component by its tag name.
|
|
38
43
|
*
|
|
39
44
|
* Project-defined namespaces (`customNamespaces`) take priority when the
|
|
40
45
|
* tag's prefix matches one: this mirrors Egret's `xmlns:game="game.*"`
|
|
@@ -42,58 +47,59 @@ export interface NamespaceModule {
|
|
|
42
47
|
* which module a tag resolves to (the same is true of the built-in `eui`/
|
|
43
48
|
* `egret` prefixes below).
|
|
44
49
|
*
|
|
45
|
-
* @param tagName -
|
|
46
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
47
|
-
* @returns Component
|
|
50
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
51
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
52
|
+
* @returns Component metadata, or `undefined` when the tag is unknown.
|
|
48
53
|
*/
|
|
49
|
-
export declare function lookupComponent(tagName: string, customNamespaces?: readonly NamespaceModule[]): ComponentInfo |
|
|
54
|
+
export declare function lookupComponent(tagName: string, customNamespaces?: readonly NamespaceModule[]): ComponentInfo | undefined;
|
|
50
55
|
/**
|
|
51
|
-
*
|
|
56
|
+
* Gets the default property for a component.
|
|
52
57
|
*
|
|
53
|
-
* @param tagName -
|
|
54
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
55
|
-
* @returns The default property name, or `undefined`
|
|
58
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
59
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
60
|
+
* @returns The default property name, or `undefined` when none is registered.
|
|
56
61
|
*/
|
|
57
62
|
export declare function getDefaultProperty(tagName: string, customNamespaces?: readonly NamespaceModule[]): string | undefined;
|
|
58
63
|
/**
|
|
59
|
-
*
|
|
64
|
+
* Resolves a tag name to its import module path.
|
|
60
65
|
*
|
|
61
|
-
* @param tagName -
|
|
62
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
63
|
-
* @returns The module
|
|
66
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
67
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
68
|
+
* @returns The module specifier, or `undefined` when the tag is unknown.
|
|
64
69
|
*/
|
|
65
|
-
export declare function resolveModule(tagName: string, customNamespaces?: readonly NamespaceModule[]): string |
|
|
70
|
+
export declare function resolveModule(tagName: string, customNamespaces?: readonly NamespaceModule[]): string | undefined;
|
|
66
71
|
/**
|
|
67
|
-
*
|
|
72
|
+
* Gets the local class name from a tag name.
|
|
68
73
|
*
|
|
69
|
-
* @param tagName -
|
|
70
|
-
* @returns The
|
|
74
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
75
|
+
* @returns The unprefixed class name.
|
|
71
76
|
*/
|
|
72
77
|
export declare function localName(tagName: string): string;
|
|
73
78
|
/**
|
|
74
79
|
* Suggests the closest registered component tag for a misspelled built-in tag.
|
|
75
80
|
*
|
|
76
|
-
* @param tagName -
|
|
77
|
-
* @
|
|
81
|
+
* @param tagName - Complete tag name that could not be resolved.
|
|
82
|
+
* @param customNamespaces - Project-defined namespaces available to the skin.
|
|
83
|
+
* @returns A close registered tag, or `undefined` when no candidate is reliable.
|
|
78
84
|
*/
|
|
79
|
-
export declare function suggestComponentTag(tagName: string): string | undefined;
|
|
85
|
+
export declare function suggestComponentTag(tagName: string, customNamespaces?: readonly NamespaceModule[]): string | undefined;
|
|
80
86
|
/**
|
|
81
|
-
* Checks
|
|
87
|
+
* Checks whether a tag name uses EXML property-node syntax.
|
|
82
88
|
*
|
|
83
89
|
* e.g. "eui:Button.label" → property "label" on `Button`.
|
|
84
90
|
*
|
|
85
|
-
* @param tagName -
|
|
86
|
-
* @returns Whether the tag
|
|
91
|
+
* @param tagName - Complete tag name to inspect.
|
|
92
|
+
* @returns Whether the tag contains a property separator.
|
|
87
93
|
*/
|
|
88
94
|
export declare function isPropertyNode(tagName: string): boolean;
|
|
89
95
|
/**
|
|
90
|
-
*
|
|
96
|
+
* Parses a property-node tag such as `eui:Button.label`.
|
|
91
97
|
*
|
|
92
|
-
* @param tagName -
|
|
93
|
-
* @returns The owner
|
|
98
|
+
* @param tagName - Complete property-node tag name.
|
|
99
|
+
* @returns The owner and property names, or `undefined` when the tag is not a property node.
|
|
94
100
|
*/
|
|
95
101
|
export declare function parsePropertyNode(tagName: string): {
|
|
96
102
|
owner: string;
|
|
97
103
|
property: string;
|
|
98
|
-
} |
|
|
104
|
+
} | undefined;
|
|
99
105
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/core/exml/registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/core/exml/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,O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|
|
5
|
-
* and default properties.
|
|
6
|
-
* `EXMLConfig`.
|
|
4
|
+
* Maps local tag names such as `Button` and `Skin` to their module specifiers
|
|
5
|
+
* and default properties.
|
|
7
6
|
*/
|
|
8
7
|
// ── Namespace mappings ───────────────────────────────────────────────
|
|
9
8
|
/**
|
|
@@ -84,7 +83,7 @@ const COMPONENTS = {
|
|
|
84
83
|
};
|
|
85
84
|
// ── Public API ───────────────────────────────────────────────────────
|
|
86
85
|
/**
|
|
87
|
-
*
|
|
86
|
+
* Looks up a component by its tag name.
|
|
88
87
|
*
|
|
89
88
|
* Project-defined namespaces (`customNamespaces`) take priority when the
|
|
90
89
|
* tag's prefix matches one: this mirrors Egret's `xmlns:game="game.*"`
|
|
@@ -92,58 +91,62 @@ const COMPONENTS = {
|
|
|
92
91
|
* which module a tag resolves to (the same is true of the built-in `eui`/
|
|
93
92
|
* `egret` prefixes below).
|
|
94
93
|
*
|
|
95
|
-
* @param tagName -
|
|
96
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
97
|
-
* @returns Component
|
|
94
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
95
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
96
|
+
* @returns Component metadata, or `undefined` when the tag is unknown.
|
|
98
97
|
*/
|
|
99
98
|
export function lookupComponent(tagName, customNamespaces = []) {
|
|
100
99
|
const prefix = tagName.includes(':') ? tagName.split(':')[0] : '';
|
|
101
100
|
if (prefix) {
|
|
102
101
|
const custom = customNamespaces.find(ns => ns.prefix === prefix);
|
|
103
|
-
if (custom)
|
|
102
|
+
if (custom) {
|
|
103
|
+
const name = localName(tagName);
|
|
104
|
+
if (custom.componentNames && !custom.componentNames.has(name))
|
|
105
|
+
return undefined;
|
|
104
106
|
return { module: custom.specifier };
|
|
107
|
+
}
|
|
105
108
|
}
|
|
106
109
|
const local = localName(tagName);
|
|
107
|
-
return COMPONENTS[local]
|
|
110
|
+
return COMPONENTS[local];
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
|
-
*
|
|
113
|
+
* Gets the default property for a component.
|
|
111
114
|
*
|
|
112
|
-
* @param tagName -
|
|
113
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
114
|
-
* @returns The default property name, or `undefined`
|
|
115
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
116
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
117
|
+
* @returns The default property name, or `undefined` when none is registered.
|
|
115
118
|
*/
|
|
116
119
|
export function getDefaultProperty(tagName, customNamespaces = []) {
|
|
117
120
|
const info = lookupComponent(tagName, customNamespaces);
|
|
118
121
|
return info?.defaultProperty;
|
|
119
122
|
}
|
|
120
123
|
/**
|
|
121
|
-
*
|
|
124
|
+
* Resolves a tag name to its import module path.
|
|
122
125
|
*
|
|
123
|
-
* @param tagName -
|
|
124
|
-
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts
|
|
125
|
-
* @returns The module
|
|
126
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
127
|
+
* @param customNamespaces - Project-defined namespaces from `kurot.config.ts`.
|
|
128
|
+
* @returns The module specifier, or `undefined` when the tag is unknown.
|
|
126
129
|
*/
|
|
127
130
|
export function resolveModule(tagName, customNamespaces = []) {
|
|
128
|
-
// Check for namespace prefix first
|
|
129
131
|
if (tagName.includes(':')) {
|
|
130
132
|
const [prefix] = tagName.split(':');
|
|
131
133
|
const custom = customNamespaces.find(ns => ns.prefix === prefix);
|
|
132
|
-
if (custom)
|
|
133
|
-
|
|
134
|
+
if (custom) {
|
|
135
|
+
const name = localName(tagName);
|
|
136
|
+
return custom.componentNames && !custom.componentNames.has(name) ? undefined : custom.specifier;
|
|
137
|
+
}
|
|
134
138
|
const modulePath = NAMESPACE_MODULES[prefix];
|
|
135
139
|
if (modulePath)
|
|
136
140
|
return modulePath;
|
|
137
141
|
}
|
|
138
|
-
// Fall back to component registry
|
|
139
142
|
const info = lookupComponent(tagName, customNamespaces);
|
|
140
|
-
return info?.module
|
|
143
|
+
return info?.module;
|
|
141
144
|
}
|
|
142
145
|
/**
|
|
143
|
-
*
|
|
146
|
+
* Gets the local class name from a tag name.
|
|
144
147
|
*
|
|
145
|
-
* @param tagName -
|
|
146
|
-
* @returns The
|
|
148
|
+
* @param tagName - Complete tag name, optionally including a prefix.
|
|
149
|
+
* @returns The unprefixed class name.
|
|
147
150
|
*/
|
|
148
151
|
export function localName(tagName) {
|
|
149
152
|
return tagName.includes(':') ? tagName.split(':').pop() : tagName;
|
|
@@ -151,51 +154,61 @@ export function localName(tagName) {
|
|
|
151
154
|
/**
|
|
152
155
|
* Suggests the closest registered component tag for a misspelled built-in tag.
|
|
153
156
|
*
|
|
154
|
-
* @param tagName -
|
|
155
|
-
* @
|
|
157
|
+
* @param tagName - Complete tag name that could not be resolved.
|
|
158
|
+
* @param customNamespaces - Project-defined namespaces available to the skin.
|
|
159
|
+
* @returns A close registered tag, or `undefined` when no candidate is reliable.
|
|
156
160
|
*/
|
|
157
|
-
export function suggestComponentTag(tagName) {
|
|
161
|
+
export function suggestComponentTag(tagName, customNamespaces = []) {
|
|
158
162
|
const separator = tagName.indexOf(':');
|
|
159
163
|
const prefix = separator >= 0 ? tagName.slice(0, separator) : '';
|
|
164
|
+
const custom = customNamespaces.find(namespace => namespace.prefix === prefix);
|
|
165
|
+
if (custom?.componentNames) {
|
|
166
|
+
return suggestName(tagName, prefix, [...custom.componentNames]);
|
|
167
|
+
}
|
|
160
168
|
const expectedModule = prefix ? NAMESPACE_MODULES[prefix] : undefined;
|
|
161
169
|
if (prefix && !expectedModule)
|
|
162
170
|
return undefined;
|
|
163
171
|
const requestedName = localName(tagName);
|
|
164
|
-
const
|
|
172
|
+
const names = Object.entries(COMPONENTS)
|
|
165
173
|
.filter(([, info]) => !expectedModule || info.module === expectedModule)
|
|
166
|
-
.map(([name]) =>
|
|
167
|
-
|
|
168
|
-
const candidate = candidates[0];
|
|
169
|
-
if (!candidate || candidate.distance > suggestionThreshold(requestedName.length))
|
|
170
|
-
return undefined;
|
|
171
|
-
return prefix ? `${prefix}:${candidate.name}` : candidate.name;
|
|
174
|
+
.map(([name]) => name);
|
|
175
|
+
return suggestName(requestedName, prefix, names);
|
|
172
176
|
}
|
|
173
177
|
/**
|
|
174
|
-
* Checks
|
|
178
|
+
* Checks whether a tag name uses EXML property-node syntax.
|
|
175
179
|
*
|
|
176
180
|
* e.g. "eui:Button.label" → property "label" on `Button`.
|
|
177
181
|
*
|
|
178
|
-
* @param tagName -
|
|
179
|
-
* @returns Whether the tag
|
|
182
|
+
* @param tagName - Complete tag name to inspect.
|
|
183
|
+
* @returns Whether the tag contains a property separator.
|
|
180
184
|
*/
|
|
181
185
|
export function isPropertyNode(tagName) {
|
|
182
186
|
return tagName.includes('.');
|
|
183
187
|
}
|
|
184
188
|
/**
|
|
185
|
-
*
|
|
189
|
+
* Parses a property-node tag such as `eui:Button.label`.
|
|
186
190
|
*
|
|
187
|
-
* @param tagName -
|
|
188
|
-
* @returns The owner
|
|
191
|
+
* @param tagName - Complete property-node tag name.
|
|
192
|
+
* @returns The owner and property names, or `undefined` when the tag is not a property node.
|
|
189
193
|
*/
|
|
190
194
|
export function parsePropertyNode(tagName) {
|
|
191
|
-
// First strip namespace prefix
|
|
192
195
|
const parts = tagName.split('.');
|
|
193
196
|
if (parts.length < 2)
|
|
194
|
-
return
|
|
197
|
+
return undefined;
|
|
195
198
|
const ownerPart = parts[0];
|
|
196
199
|
const property = parts.slice(1).join('.');
|
|
197
200
|
return { owner: localName(ownerPart), property };
|
|
198
201
|
}
|
|
202
|
+
function suggestName(tagName, prefix, names) {
|
|
203
|
+
const requestedName = localName(tagName);
|
|
204
|
+
const candidates = names
|
|
205
|
+
.map(name => ({ name, distance: editDistance(requestedName, name) }))
|
|
206
|
+
.sort((a, b) => a.distance - b.distance || a.name.localeCompare(b.name));
|
|
207
|
+
const candidate = candidates[0];
|
|
208
|
+
if (!candidate || candidate.distance > suggestionThreshold(requestedName.length))
|
|
209
|
+
return undefined;
|
|
210
|
+
return prefix ? `${prefix}:${candidate.name}` : candidate.name;
|
|
211
|
+
}
|
|
199
212
|
function suggestionThreshold(length) {
|
|
200
213
|
if (length <= 3)
|
|
201
214
|
return 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/exml/registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/exml/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsCH,wEAAwE;AAExE;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IACjD,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,aAAa;IACpB,CAAC,EAAE,WAAW;IACd,IAAI,EAAE,aAAa;CACnB,CAAC;AAEF,wEAAwE;AAExE;;;GAGG;AACH,MAAM,UAAU,GAAkC;IACjD,qBAAqB;IACrB,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE;IAChF,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE;IACjF,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE;IACjF,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE;IACnF,QAAQ,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE;IAE9E,iBAAiB;IACjB,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;IAC/B,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;IAC9B,KAAK,EAAE,EAAE,MAAM,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CAAC;QACpC,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;QAC3E,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -3,8 +3,17 @@ import type { BuildContext } from '../pipeline.js';
|
|
|
3
3
|
* EXML source file resolved for skin compilation.
|
|
4
4
|
*/
|
|
5
5
|
export interface ExmlFile {
|
|
6
|
+
/**
|
|
7
|
+
* Absolute source path.
|
|
8
|
+
*/
|
|
6
9
|
readonly path: string;
|
|
10
|
+
/**
|
|
11
|
+
* POSIX path relative to the project's resource directory.
|
|
12
|
+
*/
|
|
7
13
|
readonly relPath: string;
|
|
14
|
+
/**
|
|
15
|
+
* UTF-8 EXML source text.
|
|
16
|
+
*/
|
|
8
17
|
readonly contents: string;
|
|
9
18
|
}
|
|
10
19
|
/**
|
|
@@ -12,10 +21,15 @@ export interface ExmlFile {
|
|
|
12
21
|
*/
|
|
13
22
|
export interface CompiledSkin {
|
|
14
23
|
readonly file: ExmlFile;
|
|
24
|
+
/**
|
|
25
|
+
* Complete class name used for global factory registration.
|
|
26
|
+
*/
|
|
15
27
|
readonly className: string;
|
|
16
28
|
}
|
|
17
29
|
/**
|
|
18
30
|
* Builds and atomically installs the ESM bundle for a set of EXML skins.
|
|
31
|
+
*
|
|
32
|
+
* @returns The installed bundle's filename relative to the output `js` directory.
|
|
19
33
|
*/
|
|
20
34
|
export declare function buildSkinsModule(ctx: BuildContext, skins: readonly CompiledSkin[]): Promise<string>;
|
|
21
35
|
//# sourceMappingURL=skin-module-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skin-module-builder.d.ts","sourceRoot":"","sources":["../../../src/core/exml/skin-module-builder.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED
|
|
1
|
+
{"version":3,"file":"skin-module-builder.d.ts","sourceRoot":"","sources":["../../../src/core/exml/skin-module-builder.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBzG"}
|
|
@@ -10,6 +10,8 @@ import { createUnresolvedTagDiagnostics } from './exml-diagnostics.js';
|
|
|
10
10
|
import { generateCode, parseToIR } from './index.js';
|
|
11
11
|
/**
|
|
12
12
|
* Builds and atomically installs the ESM bundle for a set of EXML skins.
|
|
13
|
+
*
|
|
14
|
+
* @returns The installed bundle's filename relative to the output `js` directory.
|
|
13
15
|
*/
|
|
14
16
|
export async function buildSkinsModule(ctx, skins) {
|
|
15
17
|
const temporaryRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'kurot-skins-'));
|
|
@@ -34,9 +36,13 @@ export async function buildSkinsModule(ctx, skins) {
|
|
|
34
36
|
}
|
|
35
37
|
async function generateSkinModule(ctx, skin) {
|
|
36
38
|
try {
|
|
37
|
-
const namespaces = ctx.project.customNamespaces.map(ns => ({
|
|
39
|
+
const namespaces = ctx.project.customNamespaces.map(ns => ({
|
|
40
|
+
prefix: ns.prefix,
|
|
41
|
+
specifier: ns.specifier,
|
|
42
|
+
...(ns.components ? { componentNames: new Set(ns.components.map(component => component.name)) } : {}),
|
|
43
|
+
}));
|
|
38
44
|
const ir = parseToIR(skin.file.contents, skin.className, namespaces);
|
|
39
|
-
const diagnostics = createUnresolvedTagDiagnostics(skin.file.relPath, skin.file.contents, ir.unresolvedTags);
|
|
45
|
+
const diagnostics = createUnresolvedTagDiagnostics(skin.file.relPath, skin.file.contents, ir.unresolvedTags, namespaces);
|
|
40
46
|
for (const diagnostic of diagnostics) {
|
|
41
47
|
ctx.diagnostics.report(diagnostic);
|
|
42
48
|
logger.warn(`${diagnostic.location?.file}: ${diagnostic.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skin-module-builder.js","sourceRoot":"","sources":["../../../src/core/exml/skin-module-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"skin-module-builder.js","sourceRoot":"","sources":["../../../src/core/exml/skin-module-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiCrD;;;;GAIG;AACH,MAAM,CA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Aa,CAAC,SAAiB,EAAE,UAAkB,EAAE,cAAsB;IACzF,MAAM,SAAS,CAAC,cAAc,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAChF,IAAI,CAAC;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACrD,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IACpE,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB;IACrC,OAAO,SAAS,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -1,76 +1,86 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Lightweight XML parser for EXML
|
|
2
|
+
* Lightweight XML parser for the subset used by EXML skins.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
7
|
-
* - Attribute values (quoted)
|
|
8
|
-
* - Self-closing elements
|
|
9
|
-
* - CDATA sections
|
|
10
|
-
* - XML comments and processing instructions (skipped)
|
|
11
|
-
*
|
|
12
|
-
* Does NOT support:
|
|
13
|
-
* - DTD / ENTITY declarations
|
|
14
|
-
* - Namespaced attribute prefixes (we only care about the local name)
|
|
4
|
+
* Supports prefixed elements, quoted attributes, text, CDATA, comments,
|
|
5
|
+
* processing instructions, and self-closing elements. DTD and entity
|
|
6
|
+
* declarations are outside the supported input contract.
|
|
15
7
|
*/
|
|
16
8
|
/**
|
|
17
|
-
* Half-open offsets covering
|
|
9
|
+
* Half-open UTF-16 offsets covering parsed source syntax.
|
|
18
10
|
*/
|
|
19
11
|
export interface SourceRange {
|
|
20
12
|
readonly start: number;
|
|
21
13
|
readonly end: number;
|
|
22
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Base node in the parsed XML tree.
|
|
17
|
+
*/
|
|
23
18
|
export interface XNode {
|
|
24
|
-
/**
|
|
25
|
-
* Node type.
|
|
26
|
-
*/
|
|
27
19
|
readonly type: 'element' | 'text';
|
|
28
20
|
/**
|
|
29
|
-
*
|
|
21
|
+
* Range containing the complete node syntax.
|
|
30
22
|
*/
|
|
31
23
|
readonly range: SourceRange;
|
|
32
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Text node whose content has XML entities decoded.
|
|
27
|
+
*/
|
|
33
28
|
export interface XText extends XNode {
|
|
34
29
|
readonly type: 'text';
|
|
35
30
|
/**
|
|
36
|
-
*
|
|
31
|
+
* Text content, including insignificant whitespace.
|
|
37
32
|
*/
|
|
38
33
|
readonly text: string;
|
|
39
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Parsed XML attribute.
|
|
37
|
+
*/
|
|
40
38
|
export interface XAttribute {
|
|
41
39
|
/**
|
|
42
|
-
*
|
|
40
|
+
* Complete attribute name, including any namespace prefix.
|
|
43
41
|
*/
|
|
44
42
|
readonly name: string;
|
|
45
43
|
/**
|
|
46
|
-
*
|
|
44
|
+
* Decoded attribute value.
|
|
47
45
|
*/
|
|
48
46
|
readonly value: string;
|
|
49
47
|
/**
|
|
50
|
-
*
|
|
48
|
+
* Range containing the complete attribute assignment.
|
|
51
49
|
*/
|
|
52
50
|
readonly range: SourceRange;
|
|
53
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Element node in the parsed XML tree.
|
|
54
|
+
*/
|
|
54
55
|
export interface XElement extends XNode {
|
|
55
56
|
readonly type: 'element';
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
+
* Complete tag name, including any namespace prefix.
|
|
58
59
|
*/
|
|
59
60
|
readonly name: string;
|
|
60
61
|
/**
|
|
61
|
-
* Attributes in order.
|
|
62
|
+
* Attributes in source order.
|
|
62
63
|
*/
|
|
63
64
|
readonly attributes: XAttribute[];
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Element and text children in source order.
|
|
66
67
|
*/
|
|
67
68
|
readonly children: XNode[];
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the element children from a mixed XML child list.
|
|
72
|
+
*/
|
|
69
73
|
export declare function filterElements(children: readonly XNode[]): XElement[];
|
|
74
|
+
/**
|
|
75
|
+
* Concatenates the text children from a mixed XML child list.
|
|
76
|
+
*/
|
|
70
77
|
export declare function getTextContent(children: readonly XNode[]): string;
|
|
71
78
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
79
|
+
* Parses EXML source and returns its first root element.
|
|
80
|
+
*
|
|
81
|
+
* Leading text, comments, and processing instructions are ignored.
|
|
82
|
+
*
|
|
83
|
+
* @throws {Error} If no root element exists or element closing tags are invalid.
|
|
74
84
|
*/
|
|
75
85
|
export declare function parseXML(source: string): XElement;
|
|
76
86
|
//# sourceMappingURL=xml-parser.d.ts.map
|