@kurot/cli 3.6.1 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -2
- package/README.md +49 -121
- package/dist/core/config-watcher.d.ts +8 -0
- package/dist/core/config-watcher.d.ts.map +1 -0
- package/dist/core/config-watcher.js +63 -0
- package/dist/core/config-watcher.js.map +1 -0
- package/dist/core/config.d.ts +12 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +26 -6
- package/dist/core/config.js.map +1 -1
- package/dist/core/dev-server.d.ts.map +1 -1
- package/dist/core/dev-server.js +2 -0
- package/dist/core/dev-server.js.map +1 -1
- package/dist/core/diagnostics/codes.d.ts +2 -0
- package/dist/core/diagnostics/codes.d.ts.map +1 -1
- package/dist/core/diagnostics/codes.js +2 -0
- package/dist/core/diagnostics/codes.js.map +1 -1
- package/dist/core/diagnostics/output.d.ts +1 -1
- package/dist/core/diagnostics/output.d.ts.map +1 -1
- package/dist/core/plugins/generate-html.d.ts +7 -1
- package/dist/core/plugins/generate-html.d.ts.map +1 -1
- package/dist/core/plugins/generate-html.js +20 -4
- package/dist/core/plugins/generate-html.js.map +1 -1
- package/dist/core/plugins/index.d.ts +2 -1
- package/dist/core/plugins/index.d.ts.map +1 -1
- package/dist/core/plugins/index.js +4 -1
- package/dist/core/plugins/index.js.map +1 -1
- package/dist/core/plugins/version-assets.d.ts +7 -0
- package/dist/core/plugins/version-assets.d.ts.map +1 -0
- package/dist/core/plugins/version-assets.js +108 -0
- package/dist/core/plugins/version-assets.js.map +1 -0
- package/docs/ai-context.md +42 -58
- package/docs/architecture.md +14 -2
- package/docs/default-ui-skins.md +12 -23
- package/docs/dev-resource-watching.md +25 -6
- package/docs/game-template.md +20 -29
- package/docs/label-text-layout.md +13 -15
- package/docs/release-assets.md +76 -0
- package/docs/text-components.md +3 -7
- package/package.json +3 -2
- package/templates/empty/README.md +4 -1
- package/templates/empty/src/Main.ts +5 -7
- package/templates/game/README.md +4 -1
- package/templates/game/src/Main.ts +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,132 @@ and CLI command/configuration APIs follow [Semantic Versioning](https://semver.o
|
|
|
7
7
|
The early KUI XML contract follows the pre-1.0 `ui-document` kernel; authored
|
|
8
8
|
format changes are documented explicitly in each release.
|
|
9
9
|
|
|
10
|
+
## 3.8.0 — 2026-10-30
|
|
11
|
+
|
|
12
|
+
Prepared for publication; not yet published.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Watch root ESM TS/JS configuration stage defaults in dev, including atomic
|
|
17
|
+
replacement saves. Re-evaluate the root module, validate values and atomically
|
|
18
|
+
publish HTML on the existing server; manual refresh applies the new defaults.
|
|
19
|
+
- Retain valid HTML after malformed edits and recover after correction; report
|
|
20
|
+
restart-required diagnostics for structural configuration changes. Add
|
|
21
|
+
`config-change` JSONL events and stage width/height/orientation validation.
|
|
22
|
+
- Update game/empty starters to canvas-only Player startup using Core >= 2.6.0
|
|
23
|
+
within 2.x. Keep explicit runtime options available as per-field overrides.
|
|
24
|
+
|
|
25
|
+
### Compatibility and adoption
|
|
26
|
+
|
|
27
|
+
- This minor release adds configuration watching to `kurot dev`. Stage defaults
|
|
28
|
+
apply after a successful HTML update and manual browser refresh; running
|
|
29
|
+
Players are not reconfigured. `build --watch` retains its existing behavior.
|
|
30
|
+
- Root ESM configuration is re-evaluated; imported helpers and structural
|
|
31
|
+
changes still require restarting dev. Shared configuration loading now rejects
|
|
32
|
+
invalid width/height/orientation values for build, dev and clean commands.
|
|
33
|
+
- Core 2.6.0 is published, providing the required canvas-attribute startup for
|
|
34
|
+
newly created game/empty projects. Template latest placeholders and registry
|
|
35
|
+
resolution remain; CLI does not acquire a Core runtime dependency.
|
|
36
|
+
- ui-document remains ^0.13.0, with development lock 0.13.2. Other SDK versions,
|
|
37
|
+
peer minima, installations and locks are unchanged. Existing CLI ^3.x ranges
|
|
38
|
+
accept optional adoption; exact pins require an explicit declaration update.
|
|
39
|
+
- JSONL clients receive the added `config-change` build reason and the
|
|
40
|
+
`KUROT_CONFIG_RELOAD_FAILED` / `KUROT_CONFIG_RESTART_REQUIRED` diagnostic codes.
|
|
41
|
+
|
|
42
|
+
### Verification — 2026-10-30
|
|
43
|
+
|
|
44
|
+
- Build and all 145 tests pass (27 files), including TS/JS root configuration
|
|
45
|
+
reloads, atomic replacement saves, invalid-value retention/recovery,
|
|
46
|
+
restart-required diagnostics and generated HTML.
|
|
47
|
+
- Integration with built Core 2.6.0 passes the real dev save/manual-refresh and
|
|
48
|
+
release startup checks on WebGL and Canvas 2D, including explicit overrides
|
|
49
|
+
and recovery on the same server process without browser errors.
|
|
50
|
+
- The 243-file local package includes the compiled configuration watcher,
|
|
51
|
+
diagnostics, watching guide and both canvas-only starters with their Core
|
|
52
|
+
2.6.0 requirement. ui-document remains ^0.13.0; no Core runtime dependency
|
|
53
|
+
is added. npm registry checks confirm 3.8.0 is not published.
|
|
54
|
+
|
|
55
|
+
## 3.7.0 — 2026-10-27
|
|
56
|
+
|
|
57
|
+
Published on npm; registry version, downloaded archive and integrity verified on 2026-10-28.
|
|
58
|
+
|
|
59
|
+
### Registry adoption — 2026-10-28
|
|
60
|
+
|
|
61
|
+
- Verify the published 239-file archive and its SHA-512 integrity. Adopt
|
|
62
|
+
ui-document 0.13.2 in the development lock without changing the ^0.13.0
|
|
63
|
+
compatibility range; build and all 132 tests pass.
|
|
64
|
+
- Selected SDK/application/example installations adopt registry CLI 3.7.0.
|
|
65
|
+
MilfMaster no longer applies its earlier 3.6.0 patch; the published feature
|
|
66
|
+
passes its existing same-name-resource/cache verification. Electron Editor
|
|
67
|
+
retains its current installation at the user's explicit request.
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- Optional `output.versionedAssets` release packaging: place runtime files in
|
|
72
|
+
`assets/<content-hash>/` and emit an HTML base URL, covering same-name resource
|
|
73
|
+
updates, generated themes, atlas/font pages and page-shell assets. Identical
|
|
74
|
+
output reuses the version; development and existing configurations keep their
|
|
75
|
+
paths. Root manifest and reported script paths use the version prefix.
|
|
76
|
+
- Validate the option and reject conflicting HTML base elements before moving
|
|
77
|
+
output. Add regressions for same-name replacements, deterministic versions,
|
|
78
|
+
generated KUI, shell/script changes and disabled/development builds.
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- The game starter resolves its Theme URL against document.baseURI so compiled
|
|
83
|
+
skin imports follow the selected release directory with existing UI runtimes.
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Parse release HTML with parse5 before inserting the versioned base URL.
|
|
88
|
+
Preserve quoted attribute values containing greater-than signs and ignore
|
|
89
|
+
base-like text in scripts/styles. Keep the authored template intact, require
|
|
90
|
+
an explicit head and reject actual conflicting base elements.
|
|
91
|
+
|
|
92
|
+
### Compatibility and adoption
|
|
93
|
+
|
|
94
|
+
- This minor release adds an opt-in configuration field. The default paths,
|
|
95
|
+
development/watch behavior, commands and KUI/resource formats retain their
|
|
96
|
+
existing contracts. ui-document remains ^0.13.0; Core/UI and other SDKs need
|
|
97
|
+
no new release or higher peer minima.
|
|
98
|
+
- Add parse5 ^7.3.0 as a CLI dependency for HTML parsing. Its entities dependency
|
|
99
|
+
supports the CLI's Node.js >= 20 baseline; it is not shipped in game bundles.
|
|
100
|
+
- Projects enabling versioning need CLI >= 3.7.0 within 3.x, an absolute Theme
|
|
101
|
+
config URL based on document.baseURI and the deployment rules in
|
|
102
|
+
docs/release-assets.md. Existing projects may keep versioning disabled.
|
|
103
|
+
- demo/game use ^3.3.1, and the selected Tentax/MilfMaster templates use ^3.6.0;
|
|
104
|
+
these ranges accept 3.7.0 as optional installation/lock adoption. Star Catcher
|
|
105
|
+
pins 3.3.1, and Editor/Studio pin 3.6.1; adopting this feature requires explicit
|
|
106
|
+
declaration updates. Their installations/locks are unchanged by preparation.
|
|
107
|
+
- Bundled template latest placeholders remain; create records the running CLI's
|
|
108
|
+
version range. New scaffolds from 3.7.0 receive the Theme URL correction.
|
|
109
|
+
Other SDK peers/development locks and unrelated applications are unaffected.
|
|
110
|
+
|
|
111
|
+
### Adoption
|
|
112
|
+
|
|
113
|
+
- MilfMaster enables versioning using a committed pnpm patch to its installed
|
|
114
|
+
registry CLI 3.6.0. The patch carries the release feature without upgrading
|
|
115
|
+
runtime SDKs or depending on another checkout. No npm publication is claimed.
|
|
116
|
+
|
|
117
|
+
### Verification — 2026-10-27
|
|
118
|
+
|
|
119
|
+
- Clean CLI build and all 25 test files / 132 tests pass with maxWorkers=1,
|
|
120
|
+
including quoted HTML attributes, script/style text, release process
|
|
121
|
+
configuration and generated KUI output. git diff --check passes. An earlier
|
|
122
|
+
parallel run hit a resource-watch batch-reason assertion; its isolated rerun
|
|
123
|
+
and subsequent full runs passed.
|
|
124
|
+
- The packed 3.7.0 archive contains 239 entries, including the compiled version
|
|
125
|
+
plugin, release deployment guide and corrected game starter. Its metadata
|
|
126
|
+
declares parse5 ^7.3.0 and the unchanged ui-document ^0.13.0 requirement.
|
|
127
|
+
- MilfMaster's same-browser-cache fixture keeps its old immutable response
|
|
128
|
+
cached while the next deployment loads the changed resource, atlas page and
|
|
129
|
+
font through a new version directory; uncached old-version lazy loads remain
|
|
130
|
+
available. Actual minified game startup passes on WebGL and Canvas.
|
|
131
|
+
|
|
10
132
|
## 3.6.1 — 2026-10-18
|
|
11
133
|
|
|
12
|
-
|
|
134
|
+
Published; verified on npm on 2026-10-18, including latest, downloaded tarball
|
|
135
|
+
SHA-512 integrity and all 234 files matching prepared commit 46459e97.
|
|
13
136
|
|
|
14
137
|
### Fixed
|
|
15
138
|
|
|
@@ -36,13 +159,17 @@ Prepared locally; not published.
|
|
|
36
159
|
- Command/configuration APIs, KUI format and runtime Skin output are unchanged.
|
|
37
160
|
ui-document remains ^0.13.0, locked to registry 0.13.0; no Core/UI dependency
|
|
38
161
|
or other dependency/lock update is added.
|
|
39
|
-
- To receive the declaration correction
|
|
162
|
+
- To receive the declaration correction, update the project's
|
|
40
163
|
CLI installation/lock and rebuild to regenerate .kurot/skin-parts.d.ts.
|
|
41
164
|
Published 3.6.0 keeps the old property form. Core/UI runtime upgrades are not
|
|
42
165
|
required for this fix; existing compatible application ranges remain valid.
|
|
43
166
|
- New scaffolds receive README/AGENTS entries. Existing games retain their own
|
|
44
167
|
instructions, resources and directories. Template latest placeholders remain
|
|
45
168
|
unchanged; UI 3.6.2 is needed only to read the new bundled UI guides.
|
|
169
|
+
- Kurot-Studio adopts exact registry CLI 3.6.1 with a matching lock in commit
|
|
170
|
+
048e5c1. Its application build and complete check (175 files / 1,451 tests)
|
|
171
|
+
pass; other direct/transitive dependencies and game installations are unchanged.
|
|
172
|
+
The application has not been published.
|
|
46
173
|
|
|
47
174
|
### Verification
|
|
48
175
|
|
package/README.md
CHANGED
|
@@ -1,94 +1,22 @@
|
|
|
1
1
|
# @kurot/cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Build-time KUI XML → ESM Skin compilation, game scaffolding and development
|
|
4
|
+
resource watching. Package version: **3.8.0** (prepared; publication pending).
|
|
5
|
+
Requires Node.js >= 20 and
|
|
6
|
+
ui-document **^0.13.0**; games supply their own Core/UI runtime packages.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
> **Current version: 3.6.1 (prepared; not published).** Requires `@kurot/ui-document@^0.13.0`
|
|
12
|
-
> and Node.js 20 or later. The CLI runs only at build time.
|
|
13
|
-
|
|
14
|
-
> **Release scope:** The 3.x line is dedicated to Kurot Editor integration.
|
|
15
|
-
> Existing game projects that use EXML should remain on
|
|
16
|
-
> `@kurot/cli@1.3.x`. The KUI toolchain is not an in-place project upgrade and does
|
|
17
|
-
> not require those projects to change their configuration or UI assets.
|
|
18
|
-
|
|
19
|
-
Version 3.6.1 fixes generated host skinParts declarations for full TypeScript
|
|
20
|
-
checks with skipLibCheck=false and ships README/AGENTS entries in both templates.
|
|
21
|
-
The game entry links UI 3.6.2's authoring/directory guide and complete ScoreHUD
|
|
22
|
-
recipe. Runtime Skin output, dependency ranges and locks are unchanged. After
|
|
23
|
-
publication, existing projects adopt the fix by updating their CLI installation/
|
|
24
|
-
lock and rebuilding; new template docs do not overwrite existing project files.
|
|
25
|
-
|
|
26
|
-
See [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
27
|
-
|
|
28
|
-
Version 3.3.1 fixes development synchronization for all runtime resources,
|
|
29
|
-
including locale JSON, atlas PNG/JSON, fonts and translations. No project
|
|
30
|
-
configuration changes are required; refresh the preview after synchronization.
|
|
31
|
-
See [development resource watching](docs/dev-resource-watching.md).
|
|
32
|
-
|
|
33
|
-
Version 3.2.1 adds project styles, bundled fonts and English translations to the
|
|
34
|
-
game template. Existing projects are not rewritten. See [game template setup](docs/game-template.md).
|
|
35
|
-
|
|
36
|
-
Version 3.3.0 compiles shared Label presets from `style.json.labels` into native
|
|
37
|
-
properties, with local and Skin state fields taking priority. See [Label presets](#label-presets-in-330).
|
|
38
|
-
|
|
39
|
-
## Centered flips in 3.5.0
|
|
40
|
-
|
|
41
|
-
Compile independent `flipX`/`flipY` booleans on display nodes and named Skin
|
|
42
|
-
states, for example `flipY="true" flipY.down="false"`. The compiler rejects
|
|
43
|
-
malformed booleans and flags on the nonvisual Skin root. Percent dimensions and
|
|
44
|
-
negative scale retain their existing contracts; no authored XML is converted.
|
|
45
|
-
|
|
46
|
-
The dependency/lock uses published ui-document 0.13.0. Apps rendering these
|
|
47
|
-
flags need published Core 2.4.0/UI 3.4.0; CLI-built skins run directly through
|
|
48
|
-
UI. CLI 3.5.0 is published.
|
|
49
|
-
|
|
50
|
-
## BitmapLabel and RichLabel in 3.4.0
|
|
51
|
-
|
|
52
|
-
Compile BitmapLabel with a configured `font` resource, and RichLabel with
|
|
53
|
-
literal `textFlow` / `Span` elements. Named Skin states replace complete run
|
|
54
|
-
arrays; an empty flow clears content. Span elements never become display
|
|
55
|
-
children or Skin parts. New native text fields are validated before output,
|
|
56
|
-
and percentage-looking text such as `100%` remains literal.
|
|
57
|
-
|
|
58
|
-
Rendering these new tags requires UI `^3.3.0` and Core `^2.3.0` in the app;
|
|
59
|
-
these are the original native API minimums. Current UI 3.4.0 requires Core
|
|
60
|
-
`^2.4.0`, which includes the Core 2.3.1 blank rich-text line correction. Existing controls
|
|
61
|
-
and templates do not require automatic upgrades or migrations. See
|
|
62
|
-
[text component compilation](docs/text-components.md).
|
|
63
|
-
|
|
64
|
-
## Label text fitting in 3.1.0
|
|
65
|
-
|
|
66
|
-
The shared ui-document catalog supports Label `textFit` and `minFontSize`
|
|
67
|
-
in KUI XML:
|
|
68
|
-
|
|
69
|
-
```xml
|
|
70
|
-
<Skin xmlns="https://kurot.dev/ui/1" class="skins.AmountSkin" states="down">
|
|
71
|
-
<Label id="labelDisplay" text="KZT 10 000,00" width="140" size="24"
|
|
72
|
-
multiline="false" textFit="shrink" minFontSize="16" size.down="20" />
|
|
73
|
-
</Skin>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
The compiler emits the policy, base size and state overrides unchanged. UI
|
|
77
|
-
derives the drawing size after layout validation. Rendering this capability
|
|
78
|
-
requires `@kurot/ui@^3.1.0` and `@kurot/core@^2.1.0` in the application.
|
|
79
|
-
These are the original fitting API minimums; current UI 3.4.0 requires Core ^2.4.0.
|
|
80
|
-
Explicit `multiline="false"` means one unwrapped first line; remove it or set
|
|
81
|
-
it to true for text intended to wrap. Files are not migrated automatically.
|
|
82
|
-
See the [compilation contract](docs/label-text-layout.md) and
|
|
83
|
-
[native Label contract](../ui/docs/label-text-layout.md).
|
|
8
|
+
For UI production use the installed UI [authoring guide](../ui/docs/ui-authoring.md)
|
|
9
|
+
and [ScoreHUD recipe](../ui/docs/recipes/score-hud.md). Legacy EXML projects use
|
|
10
|
+
the separate CLI 1.3.x line. KUI configuration and resource files are project-owned.
|
|
84
11
|
|
|
85
12
|
## Usage
|
|
86
13
|
|
|
87
|
-
The CLI does not require a global install.
|
|
88
|
-
|
|
14
|
+
The CLI does not require a global install. Install it as a project development
|
|
15
|
+
dependency. Both new scaffolds need Core ^2.6.0 for canvas stage-attribute
|
|
16
|
+
startup. Existing projects keep their own installed SDKs and resources.
|
|
89
17
|
|
|
90
18
|
```bash
|
|
91
|
-
npx @kurot/cli@3.
|
|
19
|
+
npx @kurot/cli@3.8.0 create my-game
|
|
92
20
|
cd my-game
|
|
93
21
|
pnpm install
|
|
94
22
|
pnpm dev
|
|
@@ -96,7 +24,7 @@ pnpm dev
|
|
|
96
24
|
|
|
97
25
|
Scaffolded projects expose `build`, `dev`, and `clean` scripts. For an
|
|
98
26
|
Editor-managed KUI XML project, install the package with
|
|
99
|
-
`pnpm add -D @kurot/cli@^3.
|
|
27
|
+
`pnpm add -D @kurot/cli@^3.8.0`. Existing EXML projects should keep their current
|
|
100
28
|
1.3.x dependency.
|
|
101
29
|
|
|
102
30
|
## Commands
|
|
@@ -113,24 +41,12 @@ resource loading, and an editable HTML template. Fonts load before creating UI;
|
|
|
113
41
|
translations register after preload. The `empty` template contains a minimal
|
|
114
42
|
`Sprite` application without UI/style/language dependencies.
|
|
115
43
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
CLI 3.6.0 supplies rounded Kurot-owned textures,
|
|
123
|
-
native `.kui.xml` component states and resource-default nine-slice grids under
|
|
124
|
-
`resource/assets/ui/kui`. See [default KUI skins](docs/default-ui-skins.md).
|
|
125
|
-
Registry CLI 3.5.0 still contains the previous atlas.
|
|
126
|
-
The default Button uses symmetric padding and Panel titles use middle alignment.
|
|
127
|
-
The source preview also uses Core 2.5.0's multilingual ink centering;
|
|
128
|
-
inputs and multiline text retain stable baselines.
|
|
129
|
-
The new 2× atlas requires published Core ^2.5.0; CLI 3.6.0 is also published.
|
|
130
|
-
|
|
131
|
-
The CLI 3.6.0 game-template refresh introduces a "Made with Kurot" brand splash
|
|
132
|
-
with a playful mascot entrance, looping hops and sparkles. It supports reduced
|
|
133
|
-
motion and applies to newly created projects; see [HTML brand splash](docs/game-template.md#html-brand-splash).
|
|
44
|
+
Both templates include README/AGENTS entries for commands, authored/generated
|
|
45
|
+
files and installed SDK guides. The game template supplies rounded 2× KUI skins,
|
|
46
|
+
project fonts/colors/translations and a mascot splash with reduced-motion support.
|
|
47
|
+
The 2× skin kit needs Core >= 2.5.0 within 2.x. Existing project files remain
|
|
48
|
+
project-owned. See [template startup](docs/game-template.md) and
|
|
49
|
+
[default UI skins](docs/default-ui-skins.md).
|
|
134
50
|
|
|
135
51
|
### `kurot build`
|
|
136
52
|
|
|
@@ -144,8 +60,14 @@ Development output is written to `bin-debug/`. Release output is written to
|
|
|
144
60
|
project namespace, theme, and application code are separate ESM chunks joined
|
|
145
61
|
by the generated HTML import map.
|
|
146
62
|
|
|
147
|
-
|
|
148
|
-
|
|
63
|
+
Set `output: { dir: 'bin-debug', versionedAssets: true }` to place release
|
|
64
|
+
resources and scripts in `assets/<content-hash>/`. A generated HTML base URL
|
|
65
|
+
versions relative requests, including atlas pages, fonts and startup images.
|
|
66
|
+
Identical builds reuse the same path; development output is unchanged.
|
|
67
|
+
See [release assets and deployment](docs/release-assets.md) for theme loading,
|
|
68
|
+
cache headers and upload order. This option requires CLI >= 3.7.0 within 3.x.
|
|
69
|
+
|
|
70
|
+
Asset copying omits empty runtime directory trees. With KUI enabled, authored
|
|
149
71
|
`.kui.xml` files are compiled into the theme chunk and excluded from `resource/`;
|
|
150
72
|
skin-only directories such as `resource/ui` therefore do not appear in output.
|
|
151
73
|
Images, JSON and other runtime files inside those directories are still copied.
|
|
@@ -165,7 +87,14 @@ The development server rebuilds TypeScript, KUI XML, custom namespaces, and
|
|
|
165
87
|
the component catalog as their sources change. Browser refresh is currently
|
|
166
88
|
manual. JSONL mode reserves stdout for incremental build and server events.
|
|
167
89
|
|
|
168
|
-
|
|
90
|
+
Root `kurot.config.ts` / `.js` stage edits are reloaded and published to HTML
|
|
91
|
+
without restarting dev. Wait for the successful update, then refresh manually.
|
|
92
|
+
Invalid edits retain the last valid page; structural build configuration and
|
|
93
|
+
imported configuration helper changes still require restarting dev. Configuration
|
|
94
|
+
watching requires CLI >= 3.8.0 within 3.x and applies to `kurot dev`;
|
|
95
|
+
`kurot build --watch` keeps its existing source-watch behavior.
|
|
96
|
+
|
|
97
|
+
Dev also synchronizes the complete `resource/` tree,
|
|
169
98
|
including locale JSON, atlas PNG/JSON, fonts and translation files, with deletion
|
|
170
99
|
and rename handling. Runtime-only edits do not recompile skins; style and resource
|
|
171
100
|
default changes still do. Refresh after synchronization succeeds. No atlas
|
|
@@ -208,6 +137,10 @@ export default {
|
|
|
208
137
|
runtime theme manifest at `resource/default.thm.json`; it is not an authored
|
|
209
138
|
input. `ui.namespaces` can map additional XML prefixes to project barrel files.
|
|
210
139
|
|
|
140
|
+
`stage` supplies the generated canvas defaults. With Core >= 2.6.0 within 2.x,
|
|
141
|
+
entry code can use `createPlayer({ canvas })`. Explicit options override the corresponding defaults;
|
|
142
|
+
see [Core stage configuration](../core/docs/stage-configuration.md).
|
|
143
|
+
|
|
211
144
|
The HTML template must contain these placeholders:
|
|
212
145
|
|
|
213
146
|
- `{{KUROT_IMPORT_MAP}}`
|
|
@@ -239,7 +172,7 @@ use `property.state` on the affected node, so internal graphics remain unnamed.
|
|
|
239
172
|
Image sources use their resource key directly, for example
|
|
240
173
|
`source="button_up_png"`.
|
|
241
174
|
|
|
242
|
-
CLI
|
|
175
|
+
The CLI uses `@kurot/ui-document@^0.13.0` and its literal-string XML rules.
|
|
243
176
|
For example, `<Label text="100.80" text.down="false" size="48" />` compiles
|
|
244
177
|
the exact strings `100.80` and `false`, while the font size stays numeric.
|
|
245
178
|
String properties no longer add or remove backslash type escapes. Remove old
|
|
@@ -265,11 +198,10 @@ node inside the Skin is inferred as a skin part; its `id` is the part
|
|
|
265
198
|
name. The declaration augments the UI runtime with those exact names and types.
|
|
266
199
|
This file is editor-only, ignored by git, and never enters browser bundles.
|
|
267
200
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
requirements are unchanged. Generated runtime Skin factories are unaffected.
|
|
201
|
+
Generated host skinParts use getter signatures matching Component's accessor.
|
|
202
|
+
After changing authored Skin inputs, rebuild the declarations and run
|
|
203
|
+
`tsc --noEmit --skipLibCheck false`. Edit authored inputs rather than generated
|
|
204
|
+
`.kurot/` files. Runtime Skin factories are separate from editor declarations.
|
|
273
205
|
|
|
274
206
|
## Reusable components
|
|
275
207
|
|
|
@@ -325,7 +257,7 @@ enabled properties files are registered in `preload`. Replace fonts by changing
|
|
|
325
257
|
the resource-relative files/paths, and add languages through the Editor.
|
|
326
258
|
See [game template setup](docs/game-template.md) for lifecycle and fallback rules.
|
|
327
259
|
|
|
328
|
-
## Resource defaults
|
|
260
|
+
## Resource defaults
|
|
329
261
|
|
|
330
262
|
KUI builds validate `resource/default.res.json` and inherit image or sheet-frame
|
|
331
263
|
`scale9grid` values into compiled `Image.scale9Grid` when XML does not set one.
|
|
@@ -337,7 +269,7 @@ Sheet `subkeys` must be an object-valued frame map. Refresh old sheets in the
|
|
|
337
269
|
Editor before upgrading a KUI project; string-valued subkeys now fail the build.
|
|
338
270
|
See the [resource nine-slice contract](../ui-document/docs/resource-nine-slice.md).
|
|
339
271
|
|
|
340
|
-
## Project style colors
|
|
272
|
+
## Project style colors
|
|
341
273
|
|
|
342
274
|
The optional fixed `resource/config/style.json` is independent of
|
|
343
275
|
`default.res.json`. Each KUI build reads it through the shared document kernel, validates
|
|
@@ -365,14 +297,12 @@ switching. CLI-built skins run directly through `@kurot/ui`; `@kurot/ui-runtime`
|
|
|
365
297
|
is not required for this compilation path. Node.js >= 20 and semantic format
|
|
366
298
|
version 2 remain unchanged.
|
|
367
299
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
literal. Existing EXML projects remain on CLI 1.3.x. No Core/UI rendering change
|
|
371
|
-
is required for color expansion.
|
|
300
|
+
Only `@style:colors:<key>` is accepted for authored palette references.
|
|
301
|
+
Ordinary text remains literal; color expansion changes compiled copies only.
|
|
372
302
|
|
|
373
|
-
## Label presets
|
|
303
|
+
## Label presets
|
|
374
304
|
|
|
375
|
-
|
|
305
|
+
The compiler expands `textStyle="@style:labels:<key>"` through the shared
|
|
376
306
|
`style.json.labels` contract before generating native Label properties. Local and
|
|
377
307
|
state fields win; authoring references remain in XML. Development watches the
|
|
378
308
|
stylesheet and retains the last good bundle on errors. Programmatic `compileKUI`
|
|
@@ -383,6 +313,4 @@ than selecting a different preset. Missing presets, unsupported selection or
|
|
|
383
313
|
invalid configuration fail explicitly. Expansion runs after resource defaults
|
|
384
314
|
and before color resolution. It does not load fonts or measure text.
|
|
385
315
|
|
|
386
|
-
CLI 3.6.0/3.6.1 uses published ui-document 0.13.0 without local overrides. CLI
|
|
387
|
-
3.2.1 does not include this feature. Existing projects are not migrated.
|
|
388
316
|
See [the shared contract](../ui-document/docs/project-styles.md).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DevEvent } from './diagnostics/index.js';
|
|
2
|
+
import type { BuildContext } from './pipeline.js';
|
|
3
|
+
/**
|
|
4
|
+
* Watch the parent directory so atomic editor saves do not detach the watcher.
|
|
5
|
+
* Only stage defaults can change without rebuilding the project's paths/watchers.
|
|
6
|
+
*/
|
|
7
|
+
export declare function watchStageConfiguration(ctx: BuildContext, enqueue: (action: () => Promise<void>) => void, onEvent?: (event: DevEvent) => void): void;
|
|
8
|
+
//# sourceMappingURL=config-watcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-watcher.d.ts","sourceRoot":"","sources":["../../src/core/config-watcher.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GACjC,IAAI,CAgDN"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
+
import { loadConfig } from './config.js';
|
|
4
|
+
import { DIAGNOSTIC_CODES } from './diagnostics/codes.js';
|
|
5
|
+
import { writeStageHtml } from './plugins/generate-html.js';
|
|
6
|
+
import { logger } from '../utils/logger.js';
|
|
7
|
+
/**
|
|
8
|
+
* Watch the parent directory so atomic editor saves do not detach the watcher.
|
|
9
|
+
* Only stage defaults can change without rebuilding the project's paths/watchers.
|
|
10
|
+
*/
|
|
11
|
+
export function watchStageConfiguration(ctx, enqueue, onEvent) {
|
|
12
|
+
let active = ctx.project.config;
|
|
13
|
+
let debounce;
|
|
14
|
+
const watcher = fs.watch(ctx.project.root, (_event, filename) => {
|
|
15
|
+
if (filename !== null && filename !== 'kurot.config.ts' && filename !== 'kurot.config.js') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
clearTimeout(debounce);
|
|
19
|
+
debounce = setTimeout(() => enqueue(refresh), 100);
|
|
20
|
+
});
|
|
21
|
+
watcher.on('error', error => {
|
|
22
|
+
logger.error(`Configuration watcher failed: ${error.message}. Restart kurot dev.`);
|
|
23
|
+
});
|
|
24
|
+
ctx.disposers.push(() => {
|
|
25
|
+
clearTimeout(debounce);
|
|
26
|
+
watcher.close();
|
|
27
|
+
});
|
|
28
|
+
async function refresh() {
|
|
29
|
+
const startedAt = Date.now();
|
|
30
|
+
onEvent?.({ type: 'build-start', reason: 'config-change' });
|
|
31
|
+
let restartRequired = false;
|
|
32
|
+
try {
|
|
33
|
+
const next = await loadConfig({ root: ctx.project.root, fresh: true });
|
|
34
|
+
if (!isDeepStrictEqual(structure(active), structure(next))) {
|
|
35
|
+
restartRequired = true;
|
|
36
|
+
throw new Error('Build configuration outside stage changed. Restart kurot dev to apply it.');
|
|
37
|
+
}
|
|
38
|
+
if (!isDeepStrictEqual(active.stage, next.stage)) {
|
|
39
|
+
await writeStageHtml(ctx, next.stage);
|
|
40
|
+
}
|
|
41
|
+
active = next;
|
|
42
|
+
logger.success('Stage configuration updated. Refresh the browser to apply it.');
|
|
43
|
+
onEvent?.({ type: 'build-complete', success: true, durationMs: Date.now() - startedAt });
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
logger.error(`Configuration update failed: ${message}`);
|
|
48
|
+
onEvent?.({
|
|
49
|
+
type: 'diagnostic',
|
|
50
|
+
diagnostic: {
|
|
51
|
+
code: restartRequired ? DIAGNOSTIC_CODES.CONFIG_RESTART_REQUIRED : DIAGNOSTIC_CODES.CONFIG_RELOAD_FAILED,
|
|
52
|
+
severity: 'error',
|
|
53
|
+
message,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
onEvent?.({ type: 'build-complete', success: false, durationMs: Date.now() - startedAt });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function structure({ stage: _stage, ...config }) {
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=config-watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-watcher.js","sourceRoot":"","sources":["../../src/core/config-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,cAAc,E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UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;QAC3F,CAAC;IACF,CAAC;AACF,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAiB;IAC7D,OAAO,MAAM,CAAC;AACf,CAAC"}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -67,6 +67,11 @@ export interface OutputConfig {
|
|
|
67
67
|
* `bin-release/web/<timestamp>` regardless of this setting.
|
|
68
68
|
*/
|
|
69
69
|
readonly dir: string;
|
|
70
|
+
/**
|
|
71
|
+
* Place release assets in `assets/<content-hash>/` and set the entry page's
|
|
72
|
+
* base URL to that directory. Defaults to false; ignored in development.
|
|
73
|
+
*/
|
|
74
|
+
readonly versionedAssets?: boolean;
|
|
70
75
|
}
|
|
71
76
|
export interface HtmlConfig {
|
|
72
77
|
/**
|
|
@@ -86,7 +91,7 @@ export interface ProjectConfig {
|
|
|
86
91
|
*/
|
|
87
92
|
readonly entry: string;
|
|
88
93
|
/**
|
|
89
|
-
*
|
|
94
|
+
* Build output settings.
|
|
90
95
|
*/
|
|
91
96
|
readonly output: OutputConfig;
|
|
92
97
|
/**
|
|
@@ -107,8 +112,13 @@ export interface ProjectConfig {
|
|
|
107
112
|
* directory, merging it over `DEFAULTS`. Falls back to `DEFAULTS` entirely
|
|
108
113
|
* when no config file is present.
|
|
109
114
|
*
|
|
115
|
+
* @param options - Optional project root and fresh root-module evaluation. Imported
|
|
116
|
+
* helpers retain Node module caching; changes to them require restarting dev.
|
|
110
117
|
* @returns The validated project configuration.
|
|
111
118
|
* @throws {ConfigError} If the project configuration is invalid.
|
|
112
119
|
*/
|
|
113
|
-
export declare function loadConfig(
|
|
120
|
+
export declare function loadConfig(options?: {
|
|
121
|
+
root?: string;
|
|
122
|
+
fresh?: boolean;
|
|
123
|
+
}): Promise<ProjectConfig>;
|
|
114
124
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,UAAU;IAC1B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;CACxB;AA4BD;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CA6DzG"}
|
package/dist/core/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
2
3
|
import { exists } from '../utils/fs.js';
|
|
3
4
|
import { ConfigError } from './errors.js';
|
|
4
5
|
const DEFAULTS = {
|
|
@@ -23,40 +24,59 @@ const VALID_SCALE_MODES = [
|
|
|
23
24
|
'fixedNarrow',
|
|
24
25
|
'fixedWide',
|
|
25
26
|
];
|
|
27
|
+
let configRevision = 0;
|
|
26
28
|
/**
|
|
27
29
|
* Loads and validates `kurot.config.ts` (or `.js`) from the current working
|
|
28
30
|
* directory, merging it over `DEFAULTS`. Falls back to `DEFAULTS` entirely
|
|
29
31
|
* when no config file is present.
|
|
30
32
|
*
|
|
33
|
+
* @param options - Optional project root and fresh root-module evaluation. Imported
|
|
34
|
+
* helpers retain Node module caching; changes to them require restarting dev.
|
|
31
35
|
* @returns The validated project configuration.
|
|
32
36
|
* @throws {ConfigError} If the project configuration is invalid.
|
|
33
37
|
*/
|
|
34
|
-
export async function loadConfig() {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
38
|
+
export async function loadConfig(options = {}) {
|
|
39
|
+
const root = options.root ?? process.cwd();
|
|
40
|
+
const configPath = path.resolve(root, 'kurot.config.ts');
|
|
41
|
+
const jsConfigPath = path.resolve(root, 'kurot.config.js');
|
|
37
42
|
let config;
|
|
38
43
|
if ((await exists(configPath)) || (await exists(jsConfigPath))) {
|
|
39
44
|
// Dynamic import of `kurot.config.ts` relies on Node's built-in
|
|
40
45
|
// TypeScript type-stripping support (no `tsx`/`ts-node` involved).
|
|
41
|
-
const
|
|
46
|
+
const url = pathToFileURL((await exists(configPath)) ? configPath : jsConfigPath);
|
|
47
|
+
if (options.fresh) {
|
|
48
|
+
url.searchParams.set('kurotConfigRevision', String(++configRevision));
|
|
49
|
+
}
|
|
50
|
+
const mod = await import(url.href);
|
|
42
51
|
const userConfig = mod.default ?? mod;
|
|
43
52
|
config = { ...DEFAULTS, ...userConfig, stage: { ...DEFAULTS.stage, ...userConfig.stage } };
|
|
44
53
|
}
|
|
45
54
|
else {
|
|
46
55
|
config = DEFAULTS;
|
|
47
56
|
}
|
|
57
|
+
if (config.output.versionedAssets !== undefined && typeof config.output.versionedAssets !== 'boolean') {
|
|
58
|
+
throw new ConfigError('Invalid config: output.versionedAssets must be a boolean');
|
|
59
|
+
}
|
|
48
60
|
if (!Number.isInteger(config.stage.frameRate) || config.stage.frameRate <= 0) {
|
|
49
61
|
throw new ConfigError(`Invalid config: stage.frameRate must be a positive integer, got ${config.stage.frameRate}`);
|
|
50
62
|
}
|
|
63
|
+
for (const key of ['width', 'height']) {
|
|
64
|
+
if (!Number.isFinite(config.stage[key]) || config.stage[key] <= 0) {
|
|
65
|
+
throw new ConfigError(`Invalid config: stage.${key} must be a positive finite number, got ${config.stage[key]}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!['auto', 'portrait', 'landscape', 'landscapeFlipped'].includes(config.stage.orientation)) {
|
|
69
|
+
throw new ConfigError(`Invalid config: stage.orientation must be auto, portrait, landscape or landscapeFlipped, got '${config.stage.orientation}'`);
|
|
70
|
+
}
|
|
51
71
|
if (!VALID_SCALE_MODES.includes(config.stage.scaleMode)) {
|
|
52
72
|
throw new ConfigError(`Invalid config: stage.scaleMode must be one of ${VALID_SCALE_MODES.map(m => `'${m}'`).join(', ')}, got '${config.stage.scaleMode}'`);
|
|
53
73
|
}
|
|
54
|
-
const entryPath = path.resolve(config.entry);
|
|
74
|
+
const entryPath = path.resolve(root, config.entry);
|
|
55
75
|
if (!(await exists(entryPath))) {
|
|
56
76
|
throw new ConfigError(`Invalid config: entry file '${config.entry}' does not exist`);
|
|
57
77
|
}
|
|
58
78
|
if (config.html) {
|
|
59
|
-
const templatePath = path.resolve(config.html.template);
|
|
79
|
+
const templatePath = path.resolve(root, config.html.template);
|
|
60
80
|
if (!(await exists(templatePath))) {
|
|
61
81
|
throw new ConfigError(`Invalid config: HTML template '${config.html.template}' does not exist`);
|
|
62
82
|
}
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsH1C,MAAM,QAAQ,GAAkB;IAC/B,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE,EAAE,GAA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AU,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAAC,UAAwC;IACzE,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,WAAW,CACpB,sFAAsF,UAAU,CAAC,SAAS,GAAG,CAC7G,CAAC;IACH,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,WAAW,CAAC,2DAA2D,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,WAAW,CAAC,yDAAyD,CAAC,CAAC;IAClF,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC7C;AAwBD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC/F"}
|