@wcstack/lint 4.10.1 → 4.11.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/README.ja.md +8 -1
- package/README.md +8 -1
- package/dist/cli.cjs +415 -27
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -67,7 +67,7 @@ nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack scr
|
|
|
67
67
|
|
|
68
68
|
## state の契約を宣言する(`stateSchema`)
|
|
69
69
|
|
|
70
|
-
契約が無いと、validator が解決できないパスは **warning**(`wcs/binding-path-missing`)に留まります: インラインスクリプトが静的に読めなくても `count` は実行時には存在するかもしれないからです。`[]` で始まるリストの行のフィールドは、行を足す・置き換える代入式の行リテラルから読みます。4.9 から、`map` で行を作り直す代入 — `this.rows = [...this.items].map((c) => ({ id: c.id, label: c.name }))`・`.filter(…).map((c) => { return { … }; })` — も、そうする getter と同じく読み、`{}` を種にしたキーへ代入したオブジェクトリテラルのキーも読みます(`this.fieldErrors = { date: "…" }` で `fieldErrors.date`。リテラルの中の spread
|
|
70
|
+
契約が無いと、validator が解決できないパスは **warning**(`wcs/binding-path-missing`)に留まります: インラインスクリプトが静的に読めなくても `count` は実行時には存在するかもしれないからです。`[]` で始まるリストの行のフィールドは、行を足す・置き換える代入式の行リテラルから読みます。4.9 から、`map` で行を作り直す代入 — `this.rows = [...this.items].map((c) => ({ id: c.id, label: c.name }))`・`.filter(…).map((c) => { return { … }; })` — も、そうする getter と同じく読み、`{}` を種にしたキーへ代入したオブジェクトリテラルのキーも読みます(`this.fieldErrors = { date: "…" }` で `fieldErrors.date`。リテラルの中の spread は追いません)。4.11 から、モジュールの定数を spread する種 — `const EMPTY_DRAFT = { title: "", body: "" }` と `draft: { ...EMPTY_DRAFT }`、読めるファイルから import した定数も — は、そのリテラルのキーを持ちます(入れ子のものも。同じ名前は後に書いた方が勝ちます — オブジェクトを作るときと同じ)。リストの種の最初の行(`[{ ...ROW, id: 0 }]`)も同じです。4.10 まではそのキーの下の束縛がすべて `wcs/binding-path-missing` の誤報で、打ち間違い(`draft.titel`)も同じ警告でした。読めない spread — 呼び出し・`let`・読めない import — があれば、そのキーの下は検査せず、ページがその下を束ねていればキーの上で 1 回だけそう言います(`wcs/path-dynamic-unknown`、info)。外から届くリスト(`<wcs-fetch>` や `<wcs-storage>` が埋めるまで `null`)にはそのリテラルが無いので、プロパティの直前の JSDoc `@type` で形を宣言してください(`/** @type {{ id: number, name: string }[] | null} */ catalog: null`)。同じスクリプトの `@typedef` で行の型に名前を付け、`@type {Product[] | null}` と書いてもかまいません。HTML と同じ(または上の)ディレクトリに `application` sidecar を置くと、同じ typo が **error** になります:
|
|
71
71
|
|
|
72
72
|
```json
|
|
73
73
|
{
|
|
@@ -93,6 +93,13 @@ nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack scr
|
|
|
93
93
|
- **契約が要るとき**: validator が全体を読めない state は、契約が無いとパスをまったく検査できません。よくあるのはトップレベルの spread です — `export default { ...defaults(), get total() { … } }` は静的には見えないキーを持ち込むので、その state のパスは検査しません。4.4 から、spread の上で 1 回だけそう言います(`wcs/path-dynamic-unknown`、info)。`stateSchema` があれば束縛を —— 4.4 から getter の中で読むパス(`wcs/read-path-missing`)も —— それで検査します。読めない `<wcs-state src>` — / から始まるパス・URL・無いファイル — の state も検査できません。4.7 から、それを属性の上で 1 回だけ言います(`wcs/state-src-unread`、info)。4.6 までは何も言いませんでした。`src` はページからの相対パスで読むので、ファイルはサーバーと同じ並びに置き、/ から始まるパスには 4.10 から `--root=<dir>` を渡してください。
|
|
94
94
|
- **schema の出どころ**: 手で書く(受け付けるのは JSON-Schema サブセット `type / properties / required / items / enum / const / anyOf / $defs / $ref` のみ)か、TypeScript の state ファイル(または JSDoc で型を付けた JavaScript のファイル)から `wcs-schema`(`@wcstack/typescript`)で生成します。manifest は派生物なので、CI では `wcs-schema check` で同期を保ってください。
|
|
95
95
|
|
|
96
|
+
## ページの wcstack のスクリプトと lint の版
|
|
97
|
+
|
|
98
|
+
4.11 から、2 つの warning がページの読み込む wcstack のスクリプトを見ます。どちらも warning なので、`--strict` では落ち、`--errors-only` では落ちません。
|
|
99
|
+
|
|
100
|
+
- **`wcs/tag-package-missing`** — wcstack を自分で読み込むページが、あるパッケージの `wcs-*` のタグ(`<wcs-upload>` やそのヘルパー `<wcs-upload-header>`、`<wcs-state>`・`<wcs-router>` など)を書くのに、そのパッケージのスクリプトを読み込んでいない。要素は定義されず、束縛は待ち続けて何も起きず、コンソールにも何も出ません。パッケージごとに 1 回、最初のタグに、読み込む `/auto` を挙げて報告します。読み込んだと数えるのは、`<script src>`・import map の項目・インラインのスクリプトの import か文字列が `@wcstack/<pkg>`(版・CDN・ローカルのパスを問わない)か一括バンドル `wcstack`(state・router・fetch・storage・autoloader)を名指すものです。ローカルのスクリプト(`./app.js`)は、それが import する相対のモジュールとともに読み、名指すものを数えます。wcstack を自分で読み込まないページ(断片・バンドラのページ)、autoloader がいて `@components/` の import map が覆うタグ、読めないローカルのスクリプトがあるページでは報告しません。
|
|
101
|
+
- **`wcs/lint-version-behind`** — ページの URL が、この lint より新しい minor を固定している: `@wcstack/state@4.11.0` を `@wcstack/lint@4.10.1` で検査する。lint が持つのは自分の版の規則なので(`@wcstack/state` と lockstep で出ます)、新しい minor で加わったものは検査されず、新しい minor の正しい書き方を error にもします(4.2.0 の lint は 4.10 の `datetime(ja-JP,short,Asia/Tokyo)` を `wcs/filter-arity` にします)。ページに 1 回、いちばん新しい固定に、`@wcstack/lint` をその版に上げるよう言います — `package.json` の lint はページが固定する版に揃えてください。版の無い URL・major だけの固定(`@4`)・lint の方が新しいときは報告しません。
|
|
102
|
+
|
|
96
103
|
## 生成 → 検証 → 修正ループでの利用
|
|
97
104
|
|
|
98
105
|
安定した diagnostic code・`source:line:col` range・exit code 契約により、CI のゲートにも AI コード生成フローにもそのまま組み込めます: HTML を生成 → `npx @wcstack/lint --errors-only` → 診断を読んで修正 → exit code `0` になるまで再実行。このゲートが覆うのは `data-wcs` のページです: 出力が `not read:` や `nothing to check:` で終わるときは、そのファイルは検査されていません。
|
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ A framework app (React, Vue) that uses the `<wcs-*>` elements has neither: its p
|
|
|
67
67
|
|
|
68
68
|
## Declaring a state contract (`stateSchema`)
|
|
69
69
|
|
|
70
|
-
Without a contract, a path the validator cannot resolve is only a **warning** (`wcs/binding-path-missing`): `count` may well exist at runtime even when the inline script cannot be read statically. Note that a list starting as `[]` does not need a contract just to name its row fields — the analyzer reads them from the row literals in the assignments that add or replace rows (`this.items = this.items.concat({ id, kind: "general" })`, `.toSpliced(i, n, { … })`, `.with(i, { … })`, `[...this.items, { … }]`); only a row passed as a variable (`concat(row)`) is invisible to it. Since 4.9 it also reads an assignment that rebuilds the rows with `map` — `this.rows = [...this.items].map((c) => ({ id: c.id, label: c.name }))`, `.filter(…).map((c) => { return { … }; })` — the way it reads a getter that does, and the keys of an object literal assigned to a key seeded `{}` (`this.fieldErrors = { date: "…" }` gives `fieldErrors.date`; a spread inside the literal is not followed). A list that arrives from outside — `null` until `<wcs-fetch>` or `<wcs-storage>` fills it — has no such literal: declare its shape with a JSDoc `@type` before the property (`/** @type {{ id: number, name: string }[] | null} */ catalog: null`), or name the row type with a `@typedef` in the same script and write `@type {Product[] | null}`. Put an `application` sidecar next to (or above) the HTML and the same typo becomes an **error**:
|
|
70
|
+
Without a contract, a path the validator cannot resolve is only a **warning** (`wcs/binding-path-missing`): `count` may well exist at runtime even when the inline script cannot be read statically. Note that a list starting as `[]` does not need a contract just to name its row fields — the analyzer reads them from the row literals in the assignments that add or replace rows (`this.items = this.items.concat({ id, kind: "general" })`, `.toSpliced(i, n, { … })`, `.with(i, { … })`, `[...this.items, { … }]`); only a row passed as a variable (`concat(row)`) is invisible to it. Since 4.9 it also reads an assignment that rebuilds the rows with `map` — `this.rows = [...this.items].map((c) => ({ id: c.id, label: c.name }))`, `.filter(…).map((c) => { return { … }; })` — the way it reads a getter that does, and the keys of an object literal assigned to a key seeded `{}` (`this.fieldErrors = { date: "…" }` gives `fieldErrors.date`; a spread inside the literal is not followed). Since 4.11 a seed that spreads a constant of the module — `draft: { ...EMPTY_DRAFT }` with `const EMPTY_DRAFT = { title: "", body: "" }`, or one imported from a file it reads — has that literal's keys (nested ones too; a later key of the same name wins, as when the object is built), and so does a list seed's first row (`[{ ...ROW, id: 0 }]`). Up to 4.10 every binding under such a key was a false `wcs/binding-path-missing`, and a typo (`draft.titel`) the same warning. A spread it cannot read — a call, a `let`, an import it cannot read — leaves the keys under that key unchecked, said once at the key when the page binds under it (`wcs/path-dynamic-unknown`, info). A list that arrives from outside — `null` until `<wcs-fetch>` or `<wcs-storage>` fills it — has no such literal: declare its shape with a JSDoc `@type` before the property (`/** @type {{ id: number, name: string }[] | null} */ catalog: null`), or name the row type with a `@typedef` in the same script and write `@type {Product[] | null}`. Put an `application` sidecar next to (or above) the HTML and the same typo becomes an **error**:
|
|
71
71
|
|
|
72
72
|
```json
|
|
73
73
|
{
|
|
@@ -93,6 +93,13 @@ Without a contract, a path the validator cannot resolve is only a **warning** (`
|
|
|
93
93
|
- **When a contract is needed**: a state the validator cannot read in full needs one for its paths to be checked at all. A top-level spread is the common case — `export default { ...defaults(), get total() { … } }` brings in keys no static reader sees, so the validator checks no path of that state, and since 4.4 it says so once, at the spread (`wcs/path-dynamic-unknown`, info). With a `stateSchema` the bindings — and, since 4.4, the paths the getters read (`wcs/read-path-missing`) — are checked against it. A `<wcs-state src>` it cannot read — a path from `/`, a URL, a file that is not there — leaves that state unchecked as well; since 4.7 it says so once, at the attribute (`wcs/state-src-unread`, info), where up to 4.6 it said nothing. It reads a `src` relative to the page: keep the files laid out as on the server, and since 4.10 pass `--root=<dir>` for a path from `/`.
|
|
94
94
|
- **Where the schema comes from**: write it by hand (only the JSON-Schema subset `type / properties / required / items / enum / const / anyOf / $defs / $ref` is accepted), or generate it from a TypeScript state file — or a JavaScript one with JSDoc types — with `wcs-schema` (`@wcstack/typescript`). The manifest is a derived artifact — keep it in sync with `wcs-schema check` in CI.
|
|
95
95
|
|
|
96
|
+
## The page's wcstack scripts and the lint's version
|
|
97
|
+
|
|
98
|
+
Since 4.11, two warnings look at the wcstack scripts a page loads. Both are warnings: `--strict` fails on them, `--errors-only` does not.
|
|
99
|
+
|
|
100
|
+
- **`wcs/tag-package-missing`** — a `wcs-*` tag of a wcstack package (`<wcs-upload>`, or its helper `<wcs-upload-header>`; `<wcs-state>`, `<wcs-router>` …) on a page that loads wcstack itself but no script of that package. The element is never defined, its bindings wait and nothing happens, and the console says nothing. Reported once per package, at its first tag, with the `/auto` to load. A script counts when a `<script src>`, an import map entry, or an import or a string in an inline script names `@wcstack/<pkg>` (any version, any CDN, a local path) or the `wcstack` bundle (state, router, fetch, storage, autoloader); a local script (`./app.js`) is read, with the relative modules it imports, for what it names. Not reported on a page that names no wcstack script itself (a fragment, a bundler's page), for a tag an `@components/` import map entry covers while the autoloader is there, or when a local script cannot be read.
|
|
101
|
+
- **`wcs/lint-version-behind`** — a URL on the page pins a newer minor than this lint: `@wcstack/state@4.11.0` checked with `@wcstack/lint@4.10.1`. The lint carries the rules of its own version (it is released with `@wcstack/state`, in lockstep), so it does not check what the newer minor added, and it can report the newer minor's correct syntax as an error (4.2.0's lint gives `wcs/filter-arity` for 4.10's `datetime(ja-JP,short,Asia/Tokyo)`). Said once per page, at the newest pin: upgrade `@wcstack/lint` to that version — keep the lint in `package.json` at the version the page pins. A URL without a version, a major-only pin (`@4`) and a lint newer than the page are not reported.
|
|
102
|
+
|
|
96
103
|
## Use in generate–validate–fix loops
|
|
97
104
|
|
|
98
105
|
Stable diagnostic codes, `source:line:col` ranges, and the exit-code contract make this CLI a drop-in gate for CI and for AI code-generation flows: generate HTML → `npx @wcstack/lint --errors-only` → read the diagnostics, fix, and re-run until exit code `0`. The gate covers `data-wcs` pages: when the output ends with `not read:` or `nothing to check:`, those files were not checked.
|
package/dist/cli.cjs
CHANGED
|
@@ -97,7 +97,8 @@ var WcsDiagnosticCode = {
|
|
|
97
97
|
PathReadonly: "wcs/path-readonly",
|
|
98
98
|
PathReservedName: "wcs/path-reserved-name",
|
|
99
99
|
// lint の限界の告知(作者の誤りではない): `export default { … }` のトップレベルの spread が持ち込むキーは読めないので、
|
|
100
|
-
// stateSchema の無い state のパスは検査しない — それを spread の上で 1 回だけ言う。info
|
|
100
|
+
// stateSchema の無い state のパスは検査しない — それを spread の上で 1 回だけ言う。info。値の読めないキー(辿れない名前、
|
|
101
|
+
// 読めない spread を持つオブジェクトリテラルの種 `draft: { ...makeDraft() }`)の下を束ねたときも、キーの上で 1 回言う。
|
|
101
102
|
PathDynamicUnknown: "wcs/path-dynamic-unknown",
|
|
102
103
|
// lint の限界の告知(作者の誤りではない): 読めない `<wcs-state src>`(/ から始まるパス・URL・無いファイル)の state は
|
|
103
104
|
// パスもスクリプトの規則も検査しない — それを src の上で 1 回だけ言う。info(docs/seam-apps.md、prod-booking)。
|
|
@@ -303,6 +304,16 @@ var WcsDiagnosticCode = {
|
|
|
303
304
|
RouterOutletMisplaced: "wcs/router-outlet-misplaced",
|
|
304
305
|
// @wcstack/signals と /dom エントリの同一ページ混在(リアクティブコア二重化)。
|
|
305
306
|
SignalsDualEntry: "wcs/signals-dual-entry",
|
|
307
|
+
// wcstack を自分で読み込むページが、あるパッケージのタグ(`<wcs-upload>`・`<wcs-upload-header>`)を書くのに、その
|
|
308
|
+
// パッケージのスクリプトを読み込んでいない。要素は定義されず、束縛は待ち続け、コンソールにも何も出ない(継ぎ目アプリ
|
|
309
|
+
// homeroom — 保存が「送信中 0%」で止まった)。パッケージごとに 1 回、最初のタグに。読めないローカルのスクリプトがある
|
|
310
|
+
// ページ・autoloader の `@components/` が覆うタグ・wcstack を自分で読み込まないページ(断片・バンドラ)では黙る。warning。
|
|
311
|
+
TagPackageMissing: "wcs/tag-package-missing",
|
|
312
|
+
// ページの URL が、lint の規則の版(lint を作った @wcstack/state の版)より新しい minor の wcstack を固定している
|
|
313
|
+
// (`@wcstack/state@4.11.0` と lint 4.10.1)。古い lint は新しい規則を知らず、新しい正しい書き方を error にもする
|
|
314
|
+
// (homeroom — 4.2.0 の lint が 4.10 の `datetime(ja-JP,short,Asia/Tokyo)` を `wcs/filter-arity` に)。ページに 1 回、
|
|
315
|
+
// いちばん新しい固定に。版の無い URL・major だけの `@4`・lint の方が新しいときは黙る。warning。
|
|
316
|
+
LintVersionBehind: "wcs/lint-version-behind",
|
|
306
317
|
// `<wcs-route>`(またはレイアウトのテンプレート)の直下のテキストの `{{ }}`。最初に着いたルートでしか束ねられず、
|
|
307
318
|
// 遷移で入ったルートでは書いたままの文字が出る(router の README「Where route content lives」— docs/seam-apps.md、
|
|
308
319
|
// router-admin)。warning。
|
|
@@ -2386,7 +2397,11 @@ function getWcsManifest() {
|
|
|
2386
2397
|
};
|
|
2387
2398
|
}
|
|
2388
2399
|
|
|
2400
|
+
// ../state/package.json
|
|
2401
|
+
var version = "4.11.0";
|
|
2402
|
+
|
|
2389
2403
|
// src/service/wcsManifest.ts
|
|
2404
|
+
var ENGINE_VERSION = version;
|
|
2390
2405
|
var NATIVE_COMMANDS2 = getWcsManifest().nativeCommands ?? null;
|
|
2391
2406
|
function nativeCommandsOf(tag) {
|
|
2392
2407
|
if (NATIVE_COMMANDS2 === null) return null;
|
|
@@ -8114,10 +8129,10 @@ pp.readWord = function() {
|
|
|
8114
8129
|
}
|
|
8115
8130
|
return this.finishToken(type, word);
|
|
8116
8131
|
};
|
|
8117
|
-
var
|
|
8132
|
+
var version2 = "8.18.0";
|
|
8118
8133
|
Parser.acorn = {
|
|
8119
8134
|
Parser,
|
|
8120
|
-
version,
|
|
8135
|
+
version: version2,
|
|
8121
8136
|
defaultOptions,
|
|
8122
8137
|
Position,
|
|
8123
8138
|
SourceLocation,
|
|
@@ -9660,19 +9675,100 @@ function pushDataPropertyPaths(prop, paths, typedefs, scope) {
|
|
|
9660
9675
|
}
|
|
9661
9676
|
function pushDataPropertyPathsAt(path, prop, paths, depth, typedefs, scope) {
|
|
9662
9677
|
const followed = scope === void 0 ? null : followValue(prop, scope);
|
|
9678
|
+
let candidate;
|
|
9679
|
+
let unread = null;
|
|
9663
9680
|
if (followed === null) {
|
|
9664
|
-
|
|
9665
|
-
|
|
9681
|
+
candidate = { path, kind: "data", typeHint: prop.typeHint, rawInitial: prop.value?.trim() };
|
|
9682
|
+
paths.push(candidate);
|
|
9683
|
+
unread = pushLiteralStructurePaths(path, prop, paths, depth, typedefs, scope);
|
|
9666
9684
|
} else {
|
|
9667
9685
|
const value = followed.value;
|
|
9668
9686
|
const shapeHint = value === null ? void 0 : inferTypeHint(value.text);
|
|
9669
9687
|
const typeHint = prop.typeHint ?? (shapeHint === "array" || shapeHint === "object" ? shapeHint : void 0);
|
|
9670
9688
|
const opaque = (value === null || !isReadableLiteral(value.text)) && prop.declaredType === void 0 ? { opaque: { ...followed.name !== void 0 ? { name: followed.name } : {}, ...followed.from !== void 0 ? { from: followed.from } : {} } } : {};
|
|
9671
|
-
|
|
9672
|
-
|
|
9689
|
+
candidate = withHint({ path, kind: "data", rawInitial: prop.value?.trim(), ...opaque }, typeHint);
|
|
9690
|
+
paths.push(candidate);
|
|
9691
|
+
if (value !== null) unread = pushLiteralStructurePaths(path, { ...prop, value: value.text }, paths, depth, typedefs, value.scope);
|
|
9692
|
+
}
|
|
9693
|
+
if (unread !== null && candidate.opaque === void 0 && prop.declaredType === void 0) {
|
|
9694
|
+
candidate.opaque = { spread: unread.text, ...unread.from !== void 0 ? { from: unread.from } : {} };
|
|
9673
9695
|
}
|
|
9674
9696
|
if (prop.declaredType !== void 0) pushDeclaredShapePaths(path, prop.declaredType, paths, depth, typedefs);
|
|
9675
9697
|
}
|
|
9698
|
+
var MAX_SPREAD_HOPS = 8;
|
|
9699
|
+
function objectLiteralKeys(content, scope, shorthands, hops = 0) {
|
|
9700
|
+
const explicit = parseTopLevelProperties(content);
|
|
9701
|
+
const props = shorthands ? withShorthands(content, explicit) : explicit;
|
|
9702
|
+
const spreads = findObjectSpreads(content);
|
|
9703
|
+
if (spreads.length === 0) {
|
|
9704
|
+
return { keys: props.filter((p) => p.kind === "data").map((prop) => ({ prop, scope })), unread: null };
|
|
9705
|
+
}
|
|
9706
|
+
const items = [
|
|
9707
|
+
...props.map((prop) => ({ at: prop.nameStart ?? 0, prop })),
|
|
9708
|
+
...spreads.map((s) => ({ at: s.start, spread: s.text }))
|
|
9709
|
+
].sort((a, b) => a.at - b.at);
|
|
9710
|
+
const keys = /* @__PURE__ */ new Map();
|
|
9711
|
+
const put = (key) => {
|
|
9712
|
+
keys.delete(key.prop.name);
|
|
9713
|
+
keys.set(key.prop.name, key);
|
|
9714
|
+
};
|
|
9715
|
+
let unread = null;
|
|
9716
|
+
for (const item of items) {
|
|
9717
|
+
if ("prop" in item) {
|
|
9718
|
+
put({ prop: item.prop, scope });
|
|
9719
|
+
continue;
|
|
9720
|
+
}
|
|
9721
|
+
const literal2 = hops < MAX_SPREAD_HOPS ? spreadLiteral(item.spread, scope) : { unread: { text: item.spread } };
|
|
9722
|
+
if ("unread" in literal2) {
|
|
9723
|
+
unread ??= literal2.unread;
|
|
9724
|
+
continue;
|
|
9725
|
+
}
|
|
9726
|
+
if (literal2.text === null) continue;
|
|
9727
|
+
const nested = objectLiteralKeys(extractObjectContent(literal2.text), literal2.scope, true, hops + 1);
|
|
9728
|
+
for (const key of nested.keys) put(key);
|
|
9729
|
+
if (nested.unread !== null) unread ??= { text: item.spread };
|
|
9730
|
+
}
|
|
9731
|
+
return { keys: [...keys.values()].filter((k) => k.prop.kind === "data"), unread };
|
|
9732
|
+
}
|
|
9733
|
+
function spreadLiteral(spread, scope) {
|
|
9734
|
+
const expr = unwrapFreeze(spread.replace(/^\.\.\./, ""));
|
|
9735
|
+
if (expr === "null" || expr === "undefined") return { text: null };
|
|
9736
|
+
if (isObjectLiteral(expr)) return { text: expr, scope };
|
|
9737
|
+
if (!isBindingName(expr) || scope === void 0) return { unread: { text: spread } };
|
|
9738
|
+
const from = scope.importOf(expr);
|
|
9739
|
+
const unread = { unread: { text: spread, ...from !== void 0 ? { from } : {} } };
|
|
9740
|
+
let current2 = scope.resolveName(expr);
|
|
9741
|
+
for (let hops = 0; current2 !== null && hops < MAX_SPREAD_HOPS; hops++) {
|
|
9742
|
+
const inner = unwrapFreeze(current2.text);
|
|
9743
|
+
if (isObjectLiteral(inner)) return { text: inner, scope: current2.scope };
|
|
9744
|
+
if (!isBindingName(inner)) return unread;
|
|
9745
|
+
current2 = current2.scope.resolveName(inner);
|
|
9746
|
+
}
|
|
9747
|
+
return unread;
|
|
9748
|
+
}
|
|
9749
|
+
function findObjectSpreads(content) {
|
|
9750
|
+
const scan = maskCommentsAndStrings(content).replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, (c) => " ".repeat(c.length));
|
|
9751
|
+
const out = [];
|
|
9752
|
+
let depth = 0;
|
|
9753
|
+
let start = 0;
|
|
9754
|
+
for (let i = 0; i <= scan.length; i++) {
|
|
9755
|
+
const ch = scan[i];
|
|
9756
|
+
if (ch === "{" || ch === "[" || ch === "(") {
|
|
9757
|
+
depth++;
|
|
9758
|
+
} else if (ch === "}" || ch === "]" || ch === ")") {
|
|
9759
|
+
depth--;
|
|
9760
|
+
} else if (ch === "," && depth === 0 || i === scan.length) {
|
|
9761
|
+
const segment = scan.slice(start, i);
|
|
9762
|
+
const lead = segment.length - segment.trimStart().length;
|
|
9763
|
+
if (segment.trimStart().startsWith("...")) {
|
|
9764
|
+
const end = start + segment.trimEnd().length;
|
|
9765
|
+
out.push({ start: start + lead, text: content.slice(start + lead, end) });
|
|
9766
|
+
}
|
|
9767
|
+
start = i + 1;
|
|
9768
|
+
}
|
|
9769
|
+
}
|
|
9770
|
+
return out;
|
|
9771
|
+
}
|
|
9676
9772
|
var WORD_LITERALS = /* @__PURE__ */ new Set(["true", "false", "null", "undefined", "NaN", "Infinity", "this"]);
|
|
9677
9773
|
function isBindingName(text3) {
|
|
9678
9774
|
return /^[$A-Za-z_][$\w]*$/.test(text3) && !WORD_LITERALS.has(text3);
|
|
@@ -9740,23 +9836,30 @@ function pushDeclaredShapePaths(path, type, paths, depth, typedefs) {
|
|
|
9740
9836
|
}
|
|
9741
9837
|
function pushLiteralStructurePaths(path, prop, paths, depth, typedefs, scope) {
|
|
9742
9838
|
if (prop.value && isArrayLiteral(prop.value)) {
|
|
9743
|
-
|
|
9839
|
+
const row = { path: `${path}.*`, kind: "list" };
|
|
9840
|
+
paths.push(row);
|
|
9744
9841
|
paths.push({ path: `${path}.length`, kind: "data", typeHint: "number" });
|
|
9745
|
-
if (depth >= MAX_OBJECT_NEST_DEPTH) return;
|
|
9746
|
-
|
|
9747
|
-
|
|
9842
|
+
if (depth >= MAX_OBJECT_NEST_DEPTH) return null;
|
|
9843
|
+
const first = firstRowObjectContent(prop.value);
|
|
9844
|
+
if (first === null) return null;
|
|
9845
|
+
const { keys, unread } = objectLiteralKeys(first, scope, false);
|
|
9846
|
+
for (const key of keys) {
|
|
9847
|
+
pushDataPropertyPathsAt(`${path}.*.${key.prop.name}`, key.prop, paths, depth + 1, typedefs, key.scope);
|
|
9748
9848
|
}
|
|
9749
|
-
|
|
9849
|
+
if (unread !== null && prop.declaredType === void 0) {
|
|
9850
|
+
row.opaque = { spread: unread.text, ...unread.from !== void 0 ? { from: unread.from } : {} };
|
|
9851
|
+
}
|
|
9852
|
+
return null;
|
|
9750
9853
|
}
|
|
9751
9854
|
if (prop.value && isObjectLiteral(prop.value)) {
|
|
9752
|
-
if (depth >= MAX_OBJECT_NEST_DEPTH) return;
|
|
9753
|
-
const
|
|
9754
|
-
const
|
|
9755
|
-
|
|
9756
|
-
if (childProp.kind !== "data") continue;
|
|
9757
|
-
pushDataPropertyPathsAt(`${path}.${childProp.name}`, childProp, paths, depth + 1, typedefs, scope);
|
|
9855
|
+
if (depth >= MAX_OBJECT_NEST_DEPTH) return null;
|
|
9856
|
+
const { keys, unread } = objectLiteralKeys(extractObjectContent(prop.value), scope, true);
|
|
9857
|
+
for (const key of keys) {
|
|
9858
|
+
pushDataPropertyPathsAt(`${path}.${key.prop.name}`, key.prop, paths, depth + 1, typedefs, key.scope);
|
|
9758
9859
|
}
|
|
9860
|
+
return unread;
|
|
9759
9861
|
}
|
|
9862
|
+
return null;
|
|
9760
9863
|
}
|
|
9761
9864
|
function analyzeJsonPaths(jsonString) {
|
|
9762
9865
|
let data2;
|
|
@@ -10029,15 +10132,18 @@ function extractObjectContent(value) {
|
|
|
10029
10132
|
if (start === -1) return "";
|
|
10030
10133
|
return extractBracedContent(trimmed, scan, start);
|
|
10031
10134
|
}
|
|
10032
|
-
function
|
|
10135
|
+
function firstRowObjectContent(value) {
|
|
10033
10136
|
const trimmed = value.trim();
|
|
10034
|
-
if (!trimmed.startsWith("[")) return
|
|
10137
|
+
if (!trimmed.startsWith("[")) return null;
|
|
10035
10138
|
const scan = maskCommentsAndStrings(trimmed);
|
|
10036
10139
|
let first = 1;
|
|
10037
10140
|
while (first < scan.length && /\s/.test(scan[first])) first++;
|
|
10038
|
-
if (scan[first] !== "{") return
|
|
10039
|
-
|
|
10040
|
-
|
|
10141
|
+
if (scan[first] !== "{") return null;
|
|
10142
|
+
return extractBracedContent(trimmed, scan, first);
|
|
10143
|
+
}
|
|
10144
|
+
function extractArrayElementDataProperties(value) {
|
|
10145
|
+
const content = firstRowObjectContent(value);
|
|
10146
|
+
return content === null ? [] : parseTopLevelProperties(content).filter((prop) => prop.kind === "data");
|
|
10041
10147
|
}
|
|
10042
10148
|
function normalizeJsDocType(typeExpr) {
|
|
10043
10149
|
const parts = typeExpr.split("|").map((p) => p.trim());
|
|
@@ -11420,6 +11526,7 @@ var ja = {
|
|
|
11420
11526
|
stateSrcUnread: (src) => `"${src}" \u3092\u8AAD\u3081\u306A\u3044\u306E\u3067\u3001\u3053\u306E state \u306E\u30D1\u30B9\u3082\u30B9\u30AF\u30EA\u30D7\u30C8\u306E\u898F\u5247\u3082\u691C\u67FB\u3057\u3066\u3044\u307E\u305B\u3093\u3002src \u306F\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u306E\u76F8\u5BFE\u30D1\u30B9\u3067\u8AAD\u307F\u307E\u3059\uFF08URL \u306F\u8AAD\u307E\u305A\u3001/ \u304B\u3089\u59CB\u307E\u308B\u30D1\u30B9\u306F wcs-validate --root=<\u30B5\u30A4\u30C8\u306E\u30EB\u30FC\u30C8> \u306E\u3068\u304D\u3060\u3051\u305D\u306E\u4E0B\u3067\u8AAD\u307F\u307E\u3059\uFF09\u3002\u30B5\u30FC\u30D0\u30FC\u3068\u540C\u3058\u4E26\u3073\u306B\u7F6E\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u306E\u76F8\u5BFE\u30D1\u30B9\u3067\u6307\u3059\u304B\u3001--root \u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
11421
11527
|
pathDynamicUnknownValue: (path, n, name, from) => `"${path}" \u306E\u5024${name === void 0 ? "" : from === void 0 ? `\uFF08${name}\uFF09` : `\uFF08${name}\u3002"${from}" \u304B\u3089 import\uFF09`}\u306F\u9759\u7684\u306B\u8AAD\u3081\u306A\u3044\u306E\u3067\u3001\u305D\u306E\u4E0B\u306B\u675F\u306D\u305F\u30D1\u30B9\uFF08${n} \u4EF6\uFF09\u306F\u691C\u67FB\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u30AD\u30FC\u306B JSDoc \u306E @type \u2014 \u5F62\u304B\u3001\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30EA\u30C6\u30E9\u30EB\u3092\u6307\u3059 typeof import("./file.js").name\uFF08\u8F9E\u66F8\u306A\u3089\u5168\u90E8\u306E\u30AD\u30FC\u3092\u6301\u3064\u65E2\u5B9A\u306E\u8A00\u8A9E\u306E\u30D5\u30A1\u30A4\u30EB\uFF09\u2014 \u3092\u4ED8\u3051\u308B\u304B\u3001wcstack.manifest.json \u306E stateSchema \u306B\u5BA3\u8A00\u3059\u308B\u3068\u691C\u67FB\u3055\u308C\u307E\u3059`,
|
|
11422
11528
|
pathDynamicUnknownSpread: (sp) => `${sp} \u304C\u6301\u3061\u8FBC\u3080\u30AD\u30FC\u306F\u9759\u7684\u306B\u8AAD\u3081\u306A\u3044\u306E\u3067\u3001\u3053\u306E state \u306E\u30D1\u30B9\u306F\u691C\u67FB\u3057\u3066\u3044\u307E\u305B\u3093\uFF08\u675F\u7E1B\u30FBgetter \u306E\u4E2D\u306E\u8AAD\u307F\u30FB$watch \u306E\u30AD\u30FC\uFF09\u3002\u30AD\u30FC\u3092 wcstack.manifest.json \u306E stateSchema \u306B\u5BA3\u8A00\u3059\u308B\u3068\u691C\u67FB\u3055\u308C\u307E\u3059\u3002npx wcs-schema\uFF08@wcstack/typescript\uFF09\u304C state \u306E\u578B\uFF08JSDoc\u30FBTypeScript\uFF09\u304B\u3089\u4F5C\u308C\u307E\u3059`,
|
|
11529
|
+
pathDynamicUnknownObjectSpread: (path, n, sp, from) => `${sp}${from === void 0 ? "" : `\uFF08"${from}" \u304B\u3089 import\uFF09`}\u304C "${path}" \u306B\u6301\u3061\u8FBC\u3080\u30AD\u30FC\u306F\u9759\u7684\u306B\u8AAD\u3081\u306A\u3044\u306E\u3067\u3001\u305D\u306E\u4E0B\u306B\u675F\u306D\u305F\u30D1\u30B9\uFF08${n} \u4EF6\uFF09\u306F\u691C\u67FB\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30EA\u30C6\u30E9\u30EB\u3092\u675F\u7E1B\u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306E const \u3092 spread \u3059\u308B\u304B\u3001\u30AD\u30FC\u306B\u5F62\u3092\u8868\u3059 JSDoc \u306E @type \u3092\u4ED8\u3051\u308B\u304B\u3001wcstack.manifest.json \u306E stateSchema \u306B\u5BA3\u8A00\u3059\u308B\u3068\u691C\u67FB\u3055\u308C\u307E\u3059`,
|
|
11423
11530
|
pathReadonlyTwoWay: (p, prop) => `"${p}" \u306F setter \u306E\u7121\u3044 getter \u3067\u3059\u304C\u3001${prop}: \u306F\u8AAD\u8005\u306E\u5165\u529B\u3092\u66F8\u304D\u623B\u3059\u306E\u3067\u3001\u5165\u529B\u306E\u305F\u3073\u306B\u66F8\u304D\u8FBC\u307F\u304C\u5931\u6557\u3057\u307E\u3059\uFF08"${p}" is a getter without a setter\uFF09\u3002setter \u3092\u8DB3\u3059\uFF08set "${p}"(v) { \u2026 }\uFF09\u304B\u3001#ro \u3067\u4E00\u65B9\u5411\u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${prop}#ro: ${p}\uFF09`,
|
|
11424
11531
|
submitWithoutPrevent: (h) => `onsubmit \u306B #prevent \u304C\u7121\u304F\u3001"${h}" \u3082 preventDefault \u3092\u547C\u3073\u307E\u305B\u3093\u3002\u30D6\u30E9\u30A6\u30B6\u306F\u30D5\u30A9\u30FC\u30E0\u3082\u9001\u308B\u306E\u3067\u3001\u30DA\u30FC\u30B8\u304C\u8AAD\u307F\u76F4\u3055\u308C\u308B\u304B\u3001router \u304C\u3042\u308C\u3070 GET \u304C\u6B04\u306E\u5024\uFF08\u30D1\u30B9\u30EF\u30FC\u30C9\u3082\uFF09\u3092 URL \u3068\u5C65\u6B74\u306B\u8F09\u305B\u307E\u3059\u3002onsubmit#prevent: ${h} \u3068\u66F8\u304F\u304B\u3001\u30CF\u30F3\u30C9\u30E9\u3067 event.preventDefault() \u3092\u547C\u3093\u3067\u304F\u3060\u3055\u3044`,
|
|
11425
11532
|
getterUntrackedRead: (root, sp) => `\u3053\u3053\u3067\u8FFD\u8DE1\u3055\u308C\u308B\u306E\u306F "${root}" \u3060\u3051\u3067\u3059\u3002"${sp}" \u304C\u5909\u308F\u3063\u3066\u3082\u3053\u306E getter \u306F\u518D\u8A55\u4FA1\u3055\u308C\u307E\u305B\u3093\uFF08\u30D1\u30B9\u8AAD\u307F\u53D6\u308A\u306E\u5148\u306E\u7D20\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u30A2\u30AF\u30BB\u30B9\u306F\u8FFD\u8DE1\u3055\u308C\u306A\u3044\uFF09\u3002this["${sp}"] \u3067\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044`,
|
|
@@ -11487,6 +11594,8 @@ var ja = {
|
|
|
11487
11594
|
routerOutletMisplaced: () => `\u3053\u306E <wcs-outlet> \u306F <wcs-router> \u306E\u76F4\u5F8C\u306B\u7121\u3044\u306E\u3067\u3001\u3069\u306E router \u3082\u4F7F\u3044\u307E\u305B\u3093\u3002router \u306F\u81EA\u5206\u306E\u76F4\u5F8C\u306E\u8981\u7D20\u3060\u3051\u3092 outlet \u3068\u3057\u3066\u4F7F\u3044\u3001\u305D\u3053\u306B <wcs-outlet> \u304C\u7121\u3051\u308C\u3070\u81EA\u524D\u306E outlet \u3092\u4F5C\u308A\u307E\u3059\u3002\u30EB\u30FC\u30C8\u306F router \u306E\u76F4\u5F8C\u306B\u63CF\u304B\u308C\u3001\u3053\u306E outlet \u306F\u7A7A\u306E\u307E\u307E\u3067\u3059 \u2014 <wcs-router> \u306E\u76F4\u5F8C\u3078\u79FB\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
11488
11595
|
signalsDualEntry: () => `@wcstack/signals \u3068 @wcstack/signals/dom \u304C\u540C\u4E00\u30DA\u30FC\u30B8\u304B\u3089 import \u3055\u308C\u3066\u3044\u307E\u3059\u3002CDN \u3067\u306F\u5404\u30A8\u30F3\u30C8\u30EA\u304C\u81EA\u5DF1\u5B8C\u7D50\u30D0\u30F3\u30C9\u30EB\u306E\u305F\u3081\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u30B3\u30A2\u304C\u4E8C\u91CD\u5316\u3057\u3001\u5883\u754C\u3067\u53CD\u5FDC\u304C\u58CA\u308C\u307E\u3059 \u2014 \u3059\u3079\u3066 /dom \u30A8\u30F3\u30C8\u30EA\u304B\u3089 import \u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
11489
11596
|
signalsImportMapBoth: () => `\u3053\u306E import map \u306F @wcstack/signals \u3068 @wcstack/signals/dom \u306E\u4E21\u65B9\u3092\u5272\u308A\u5F53\u3066\u3066\u3044\u307E\u3059\u3002CDN \u3067\u306F\u5404\u30A8\u30F3\u30C8\u30EA\u304C\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u30B3\u30A2\u3092\u6301\u3064\u306E\u3067\u3001@wcstack/signals \u3092 import \u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\uFF08\u3053\u306E\u30DA\u30FC\u30B8\u306E\u3082\u306E\u3067\u3082\u3001\u8AAD\u307F\u8FBC\u3080 .js \u3067\u3082\uFF09\u304C 2 \u3064\u76EE\u306E\u30B3\u30A2\u3092\u6301\u3061\u3001\u5883\u754C\u3067\u53CD\u5FDC\u304C\u58CA\u308C\u307E\u3059\u3002@wcstack/signals/dom \u3060\u3051\u3092\u5272\u308A\u5F53\u3066\u3066\u304F\u3060\u3055\u3044\uFF08\u30B3\u30A2\u306E\u5168\u90E8\u3092 export \u3057\u307E\u3059\uFF09`,
|
|
11597
|
+
tagPackageMissing: (tags, pkg, url) => `${tags.map((t) => `<${t}>`).join("\u30FB")} \u306F ${pkg} \u306E\u30BF\u30B0\u3067\u3059\u304C\u3001\u3053\u306E\u30DA\u30FC\u30B8\u306F ${pkg} \u306E\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u305B\u3093\u3002\u8981\u7D20\u306F\u5B9A\u7FA9\u3055\u308C\u306A\u3044\u306E\u3067\u3001\u305D\u306E\u675F\u7E1B\u306F\u5F85\u3061\u7D9A\u3051\u3066\u4F55\u3082\u8D77\u304D\u305A\u3001\u30B3\u30F3\u30BD\u30FC\u30EB\u306B\u3082\u4F55\u3082\u51FA\u307E\u305B\u3093 \u2014 <script type="module" src="${url}"></script> \u3067\u8AAD\u307F\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044`,
|
|
11598
|
+
lintVersionBehind: (spec, version3, minor, lint) => `\u3053\u306E\u30DA\u30FC\u30B8\u306F ${spec} \u3092\u56FA\u5B9A\u3057\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u306E lint \u306E\u898F\u5247\uFF08@wcstack ${lint}\uFF09\u3088\u308A\u65B0\u3057\u3044 minor \u3067\u3059\u3002${minor} \u3067\u52A0\u308F\u3063\u305F\u898F\u5247\u306F\u691C\u67FB\u3055\u308C\u305A\u3001${minor} \u306E\u6B63\u3057\u3044\u66F8\u304D\u65B9\u304C error \u306B\u306A\u308B\u3053\u3068\u3082\u3042\u308A\u307E\u3059 \u2014 @wcstack/lint \u3092 ${version3} \u306B\u4E0A\u3052\u3066\u304F\u3060\u3055\u3044\uFF08npm i -D @wcstack/lint@${version3}\u3002VS Code \u306E\u62E1\u5F35\u306F ${minor} \u306B\u5BFE\u5FDC\u3059\u308B\u7248\u3078\uFF09`,
|
|
11490
11599
|
routeBareMustache: (inLayout) => inLayout ? `\u30EC\u30A4\u30A2\u30A6\u30C8\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u76F4\u4E0B\u306E\u30C6\u30AD\u30B9\u30C8\u306E {{ }} \u306F\u3001\u9077\u79FB\u3067\u306F\u675F\u306D\u3089\u308C\u307E\u305B\u3093 \u2014 \u8981\u7D20\u3067\u5305\u3093\u3067\u304F\u3060\u3055\u3044\uFF08<span>{{ \u2026 }}</span>\uFF09` : `<wcs-route> \u306E\u76F4\u4E0B\u306E\u30C6\u30AD\u30B9\u30C8\u306E {{ }} \u306F\u3001\u6700\u521D\u306B\u7740\u3044\u305F\u30EB\u30FC\u30C8\u3067\u3057\u304B\u675F\u306D\u3089\u308C\u307E\u305B\u3093\u3002\u9077\u79FB\u3067\u5165\u3063\u305F\u30EB\u30FC\u30C8\u3067\u306F\u66F8\u3044\u305F\u307E\u307E\u306E\u6587\u5B57\u304C\u51FA\u307E\u3059 \u2014 \u8981\u7D20\u3067\u5305\u3093\u3067\u304F\u3060\u3055\u3044\uFF08<h1>{{ \u2026 }}</h1>\uFF09`,
|
|
11491
11600
|
layoutSlotMissing: (l) => `\u30EC\u30A4\u30A2\u30A6\u30C8 "${l}" \u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306B\u65E2\u5B9A\u306E <slot>\uFF08name \u306E\u7121\u3044\u3082\u306E\uFF09\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u3053\u306E <wcs-layout> \u306E\u540D\u524D\u4ED8\u304D\u30B9\u30ED\u30C3\u30C8\u306E\u5916\u306E\u4E2D\u8EAB\uFF08\u5165\u308C\u5B50\u306E\u30EB\u30FC\u30C8\u3068\u305D\u306E\u30DA\u30FC\u30B8\uFF09\u306F\u8868\u793A\u3055\u308C\u307E\u305B\u3093 \u2014 \u30DA\u30FC\u30B8\u3092\u7F6E\u304F\u5834\u6240\u306B <slot></slot> \u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
|
|
11492
11601
|
namedStateAttrDeprecated: (name) => `name \u5C5E\u6027\u306F v2 \u3067\u64A4\u53BB\u3055\u308C\u307E\u3057\u305F\uFF081 root 1 \u30C4\u30EA\u30FC\uFF09\u3002\u30EB\u30FC\u30C8\u30C4\u30EA\u30FC\u3078\u306E\u30DE\u30A6\u30F3\u30C8 <wcs-state mount="${name}"> \u306B\u7F6E\u304D\u63DB\u3048\u3001\u30D1\u30B9\u306F "${name}.<path>" \u3067\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\uFF08docs/state-mount-design.md \xA79\uFF09`,
|
|
@@ -11633,6 +11742,7 @@ var en = {
|
|
|
11633
11742
|
stateSrcUnread: (src) => `"${src}" cannot be read, so this state's paths and script rules are not checked. A src is read relative to this file (a URL is not read, and a path from / only under wcs-validate --root=<the site's root>): point it at the file laid out as on the server, relative to this file, or pass --root`,
|
|
11634
11743
|
pathDynamicUnknownValue: (path, n, name, from) => `The value of "${path}"${name === void 0 ? "" : from === void 0 ? ` (${name})` : ` (${name}, imported from "${from}")`} cannot be read statically, so the ${n === 1 ? "path" : `${n} paths`} bound under it ${n === 1 ? "is" : "are"} not checked. Give the key a JSDoc @type \u2014 its shape, or typeof import("./file.js").name for a module's literal (for a dictionary, the default language's file, which has every key) \u2014 or declare it in the stateSchema of wcstack.manifest.json to have them checked`,
|
|
11635
11744
|
pathDynamicUnknownSpread: (sp) => `The keys ${sp} brings in cannot be read statically, so this state's paths are not checked (bindings, reads in getters, $watch keys). Declare the keys in the stateSchema of wcstack.manifest.json to have them checked; npx wcs-schema (@wcstack/typescript) derives it from the state's types (JSDoc or TypeScript)`,
|
|
11745
|
+
pathDynamicUnknownObjectSpread: (path, n, sp, from) => `The keys ${sp}${from === void 0 ? "" : ` (imported from "${from}")`} brings into "${path}" cannot be read statically, so the ${n === 1 ? "path" : `${n} paths`} bound under it ${n === 1 ? "is" : "are"} not checked. Spread a const of the module bound to an object literal, give the key a JSDoc @type with its shape, or declare it in the stateSchema of wcstack.manifest.json to have them checked`,
|
|
11636
11746
|
pathReadonlyTwoWay: (p, prop) => `"${p}" is a getter without a setter, and ${prop}: writes back what the reader enters, so every edit fails ("${p}" is a getter without a setter). Add a setter (set "${p}"(v) { \u2026 }), or bind it one way with #ro (${prop}#ro: ${p})`,
|
|
11637
11747
|
submitWithoutPrevent: (h) => `onsubmit has no #prevent and "${h}" does not call preventDefault, so the browser submits the form too: the page reloads, or with the router a GET puts the fields (a password too) in the URL and the history. Write onsubmit#prevent: ${h}, or call event.preventDefault() in the handler`,
|
|
11638
11748
|
getterUntrackedRead: (root, sp) => `Only "${root}" is tracked here: the getter is not re-evaluated when "${sp}" changes (plain property access after a path read is not tracked). Read this["${sp}"] instead`,
|
|
@@ -11700,6 +11810,8 @@ var en = {
|
|
|
11700
11810
|
routerOutletMisplaced: () => `This <wcs-outlet> is not right after a <wcs-router>, so no router uses it: a router uses only the element right after it as its outlet, and makes an outlet of its own there when that is not a <wcs-outlet>. The routes render right after the router and this outlet stays empty \u2014 move it right after the <wcs-router>`,
|
|
11701
11811
|
signalsDualEntry: () => `Both @wcstack/signals and @wcstack/signals/dom are imported on this page. On a CDN each entry is a self-contained bundle, so the reactive core is duplicated and reactivity breaks at the seam \u2014 import everything from the single /dom entry`,
|
|
11702
11812
|
signalsImportMapBoth: () => `This import map maps both @wcstack/signals and @wcstack/signals/dom. On a CDN each entry carries its own reactive core, so a module that imports @wcstack/signals \u2014 this page's, or a .js file it loads \u2014 gets a second core and reactivity breaks at the seam. Map only @wcstack/signals/dom (it exports the whole core)`,
|
|
11813
|
+
tagPackageMissing: (tags, pkg, url) => `${tags.map((t) => `<${t}>`).join(", ")} ${tags.length === 1 ? "is a tag" : "are tags"} of ${pkg}, and this page loads no script of ${pkg}: the element is never defined, so its bindings wait and nothing happens, without a word in the console. Load it with <script type="module" src="${url}"></script>`,
|
|
11814
|
+
lintVersionBehind: (spec, version3, minor, lint) => `This page pins ${spec}, a newer minor than the rules of this lint (@wcstack ${lint}): what ${minor} added is not checked, and correct ${minor} syntax can be reported as an error. Upgrade @wcstack/lint to ${version3} (npm i -D @wcstack/lint@${version3}; the VS Code extension to its release for ${minor})`,
|
|
11703
11815
|
routeBareMustache: (inLayout) => inLayout ? `{{ }} in text directly under a layout template is not bound on a navigation. Wrap it in an element (<span>{{ \u2026 }}</span>)` : `{{ }} in text directly under <wcs-route> is bound only on the landing route: a route entered by navigation shows it as written. Wrap it in an element (<h1>{{ \u2026 }}</h1>)`,
|
|
11704
11816
|
layoutSlotMissing: (l) => `The template of layout "${l}" has no default <slot> (one without a name), so what this <wcs-layout> holds outside the named slots \u2014 the nested routes and their pages \u2014 is not shown. Put a <slot></slot> where the page goes`,
|
|
11705
11817
|
namedStateAttrDeprecated: (name) => `The "name" attribute was removed in v2 \u2014 there is a single state tree per root. Mount this state onto the tree instead: <wcs-state mount="${name}"> and read it as "${name}.<path>" (docs/state-mount-design.md \xA79)`,
|
|
@@ -15725,6 +15837,281 @@ function findMisplacedOutlets(html) {
|
|
|
15725
15837
|
return routerWithoutOutlet ? misplaced : [];
|
|
15726
15838
|
}
|
|
15727
15839
|
|
|
15840
|
+
// src/service/packageLoadValidator.ts
|
|
15841
|
+
var CORE_TAG_PACKAGES = {
|
|
15842
|
+
"wcs-state": "state",
|
|
15843
|
+
"wcs-ssr": "state",
|
|
15844
|
+
"wcs-router": "router",
|
|
15845
|
+
"wcs-route": "router",
|
|
15846
|
+
"wcs-outlet": "router",
|
|
15847
|
+
"wcs-layout": "router",
|
|
15848
|
+
"wcs-layout-outlet": "router",
|
|
15849
|
+
"wcs-link": "router",
|
|
15850
|
+
"wcs-head": "router",
|
|
15851
|
+
"wcs-guard-handler": "router",
|
|
15852
|
+
"wcs-autoloader": "autoloader",
|
|
15853
|
+
"wcs-devtools": "devtools"
|
|
15854
|
+
};
|
|
15855
|
+
function packageOfTag(tag) {
|
|
15856
|
+
if (Object.hasOwn(BUILTIN_TAGS, tag)) return BUILTIN_TAGS[tag].package;
|
|
15857
|
+
return Object.hasOwn(CORE_TAG_PACKAGES, tag) ? CORE_TAG_PACKAGES[tag] : void 0;
|
|
15858
|
+
}
|
|
15859
|
+
var SCOPED_NAME = /@wcstack\/([a-z0-9-]+)/g;
|
|
15860
|
+
var REPO_DIST = /\/packages\/([a-z0-9-]+)\/dist\//g;
|
|
15861
|
+
var BUNDLE = /(?:^|[/"'`\s])wcstack(?:@[^/"'`\s]+)?\/(?:auto\b|dist\/)/;
|
|
15862
|
+
var PINNED = /(?:@wcstack\/([a-z0-9-]+)|(?:^|(?<=[/"'`\s]))wcstack)@(\d+)\.(\d+)(?:\.(\d+))?(-[0-9A-Za-z.-]+)?/g;
|
|
15863
|
+
function namedPackages(text3) {
|
|
15864
|
+
const out = [];
|
|
15865
|
+
for (const m of text3.matchAll(SCOPED_NAME)) out.push(m[1]);
|
|
15866
|
+
for (const m of text3.matchAll(REPO_DIST)) out.push(m[1]);
|
|
15867
|
+
if (BUNDLE.test(text3)) out.push("wcstack");
|
|
15868
|
+
return out.flatMap((p) => p === "wcstack" ? [...BUNDLE_PACKAGES] : [p]);
|
|
15869
|
+
}
|
|
15870
|
+
var MAX_FILES2 = 32;
|
|
15871
|
+
var MAX_DEPTH = 4;
|
|
15872
|
+
function validatePackageLoads(html, locale2, fileReader) {
|
|
15873
|
+
const msgs = getMessages(locale2);
|
|
15874
|
+
const scan = blankHtmlComments(html);
|
|
15875
|
+
const loads = collectPageLoads(scan, fileReader);
|
|
15876
|
+
const out = [];
|
|
15877
|
+
const lint = parseVersion(ENGINE_VERSION);
|
|
15878
|
+
let newest = null;
|
|
15879
|
+
for (const ref2 of loads.references) {
|
|
15880
|
+
for (const m of ref2.text.matchAll(PINNED)) {
|
|
15881
|
+
const pin = {
|
|
15882
|
+
spec: m[0],
|
|
15883
|
+
version: m[0].slice(m[0].lastIndexOf("@") + 1),
|
|
15884
|
+
major: Number(m[2]),
|
|
15885
|
+
minor: Number(m[3]),
|
|
15886
|
+
patch: m[4] === void 0 ? 0 : Number(m[4])
|
|
15887
|
+
};
|
|
15888
|
+
if (newest === null || comparePins(pin, newest.pin) > 0) {
|
|
15889
|
+
newest = { pin, start: ref2.start + m.index, end: ref2.start + m.index + m[0].length };
|
|
15890
|
+
}
|
|
15891
|
+
}
|
|
15892
|
+
}
|
|
15893
|
+
if (lint !== null && newest !== null && newest.pin.major === lint.major && newest.pin.minor > lint.minor) {
|
|
15894
|
+
out.push({
|
|
15895
|
+
code: WcsDiagnosticCode.LintVersionBehind,
|
|
15896
|
+
start: newest.start,
|
|
15897
|
+
end: newest.end,
|
|
15898
|
+
severity: "warning",
|
|
15899
|
+
message: msgs.lintVersionBehind(newest.pin.spec, newest.pin.version, `${newest.pin.major}.${newest.pin.minor}`, ENGINE_VERSION)
|
|
15900
|
+
});
|
|
15901
|
+
}
|
|
15902
|
+
if (!loads.own || loads.unclear) return out;
|
|
15903
|
+
const autoloader = loads.autoloader;
|
|
15904
|
+
const components = loads.mapKeys.filter((k) => k.startsWith("@components/"));
|
|
15905
|
+
const defined = new Set([...loads.definedTags].map((t) => packageOfTag(t)).filter((p) => p !== void 0));
|
|
15906
|
+
const byPackage = /* @__PURE__ */ new Map();
|
|
15907
|
+
for (const tag of findWcsTags(scan)) {
|
|
15908
|
+
const pkg = packageOfTag(tag.name);
|
|
15909
|
+
if (pkg === void 0 || loads.pkgs.has(pkg) || defined.has(pkg)) continue;
|
|
15910
|
+
if (autoloader && tag.name !== "wcs-autoloader" && components.some((k) => coversTag(k, tag.name))) continue;
|
|
15911
|
+
const seen2 = byPackage.get(pkg);
|
|
15912
|
+
if (seen2 === void 0) byPackage.set(pkg, { tags: [tag.name], start: tag.start, end: tag.end });
|
|
15913
|
+
else if (!seen2.tags.includes(tag.name)) seen2.tags.push(tag.name);
|
|
15914
|
+
}
|
|
15915
|
+
const version3 = suggestedVersion(loads.references);
|
|
15916
|
+
for (const [pkg, at2] of byPackage) {
|
|
15917
|
+
out.push({
|
|
15918
|
+
code: WcsDiagnosticCode.TagPackageMissing,
|
|
15919
|
+
start: at2.start,
|
|
15920
|
+
end: at2.end,
|
|
15921
|
+
severity: "warning",
|
|
15922
|
+
tag: at2.tags[0],
|
|
15923
|
+
message: msgs.tagPackageMissing(at2.tags, `@wcstack/${pkg}`, `https://esm.run/@wcstack/${pkg}${version3 === null ? "" : `@${version3}`}/auto`)
|
|
15924
|
+
});
|
|
15925
|
+
}
|
|
15926
|
+
return out;
|
|
15927
|
+
}
|
|
15928
|
+
function comparePins(a, b) {
|
|
15929
|
+
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
|
|
15930
|
+
}
|
|
15931
|
+
function parseVersion(version3) {
|
|
15932
|
+
const m = /^(\d+)\.(\d+)/.exec(version3);
|
|
15933
|
+
return m === null ? null : { major: Number(m[1]), minor: Number(m[2]) };
|
|
15934
|
+
}
|
|
15935
|
+
function suggestedVersion(references) {
|
|
15936
|
+
const versions = /* @__PURE__ */ new Set();
|
|
15937
|
+
for (const ref2 of references) {
|
|
15938
|
+
for (const m of ref2.text.matchAll(PINNED)) versions.add(m[0].slice(m[0].lastIndexOf("@") + 1));
|
|
15939
|
+
}
|
|
15940
|
+
return versions.size === 1 ? [...versions][0] : null;
|
|
15941
|
+
}
|
|
15942
|
+
function coversTag(key, tag) {
|
|
15943
|
+
const body = key.slice("@components/".length);
|
|
15944
|
+
if (body.endsWith("/")) {
|
|
15945
|
+
const prefix = body.slice(0, -1).replace(/\|[^/]*$/, "").replace(/\//g, "-");
|
|
15946
|
+
return prefix !== "" && tag.startsWith(`${prefix}-`);
|
|
15947
|
+
}
|
|
15948
|
+
return body.replace(/\|.*$/, "") === tag;
|
|
15949
|
+
}
|
|
15950
|
+
function markupOf(scan) {
|
|
15951
|
+
return scan.replace(
|
|
15952
|
+
/(<(script|style)\b[^>]*>)([\s\S]*?)(<\/\2\s*>)/gi,
|
|
15953
|
+
(_m, open, _name, body, close) => open + " ".repeat(body.length) + close
|
|
15954
|
+
);
|
|
15955
|
+
}
|
|
15956
|
+
function findWcsTags(scan) {
|
|
15957
|
+
const out = [];
|
|
15958
|
+
for (const m of markupOf(scan).matchAll(/<(wcs-[a-z0-9-]+)(?=[\s/>])/gi)) {
|
|
15959
|
+
const start = m.index + 1;
|
|
15960
|
+
out.push({ name: m[1].toLowerCase(), start, end: start + m[1].length });
|
|
15961
|
+
}
|
|
15962
|
+
return out;
|
|
15963
|
+
}
|
|
15964
|
+
function autoloaderModules(scan, imports) {
|
|
15965
|
+
const markup = markupOf(scan);
|
|
15966
|
+
const tags = /* @__PURE__ */ new Set();
|
|
15967
|
+
for (const m of markup.matchAll(/<([a-z][a-z0-9]*-[a-z0-9-]*)(?=[\s/>])/gi)) tags.add(m[1].toLowerCase());
|
|
15968
|
+
for (const m of markup.matchAll(/\sis\s*=\s*["']([a-z][a-z0-9]*-[a-z0-9-]*)["']/gi)) tags.add(m[1].toLowerCase());
|
|
15969
|
+
for (const tag of tags) if (tag.startsWith("wcs-")) tags.delete(tag);
|
|
15970
|
+
const out = [];
|
|
15971
|
+
for (const [key, value] of imports) {
|
|
15972
|
+
if (!key.startsWith("@components/") || isUrl(value)) continue;
|
|
15973
|
+
const body = key.slice("@components/".length);
|
|
15974
|
+
if (!body.endsWith("/")) {
|
|
15975
|
+
if (!body.startsWith("wcs-")) out.push(pagePath(value));
|
|
15976
|
+
continue;
|
|
15977
|
+
}
|
|
15978
|
+
const prefix = body.slice(0, -1).replace(/\|[^/]*$/, "").replace(/\//g, "-");
|
|
15979
|
+
for (const tag of tags) {
|
|
15980
|
+
if (prefix !== "" && tag.startsWith(`${prefix}-`)) out.push(pagePath(`${value}${tag.slice(prefix.length + 1)}.js`));
|
|
15981
|
+
}
|
|
15982
|
+
}
|
|
15983
|
+
return out;
|
|
15984
|
+
}
|
|
15985
|
+
function collectPageLoads(scan, fileReader) {
|
|
15986
|
+
const loads = {
|
|
15987
|
+
pkgs: /* @__PURE__ */ new Set(),
|
|
15988
|
+
definedTags: /* @__PURE__ */ new Set(),
|
|
15989
|
+
own: false,
|
|
15990
|
+
unclear: false,
|
|
15991
|
+
autoloader: false,
|
|
15992
|
+
imports: /* @__PURE__ */ new Map(),
|
|
15993
|
+
mapKeys: [],
|
|
15994
|
+
references: []
|
|
15995
|
+
};
|
|
15996
|
+
const name = (text3, own2) => {
|
|
15997
|
+
const pkgs = namedPackages(text3);
|
|
15998
|
+
for (const p of pkgs) loads.pkgs.add(p);
|
|
15999
|
+
if (own2 && pkgs.length > 0) loads.own = true;
|
|
16000
|
+
};
|
|
16001
|
+
const locals = [];
|
|
16002
|
+
const specifiers = [];
|
|
16003
|
+
const scriptRegex = /<script\b((?:"[^"]*"|'[^']*'|[^>"'])*)>([\s\S]*?)<\/script\s*>/gi;
|
|
16004
|
+
let match;
|
|
16005
|
+
while ((match = scriptRegex.exec(scan)) !== null) {
|
|
16006
|
+
const attrs = match[1];
|
|
16007
|
+
const type = (attrValue(attrs, "type") ?? "").trim().toLowerCase();
|
|
16008
|
+
const src = extractSrc(`<script${attrs}>`);
|
|
16009
|
+
const bodyStart = match.index + match[0].indexOf(">") + 1;
|
|
16010
|
+
if (src !== null) {
|
|
16011
|
+
const start = match.index + src.offsetInTag;
|
|
16012
|
+
loads.references.push({ text: src.value, start });
|
|
16013
|
+
name(src.value, true);
|
|
16014
|
+
if (namedPackages(src.value).length === 0 && !isUrl(src.value)) locals.push(pagePath(src.value));
|
|
16015
|
+
continue;
|
|
16016
|
+
}
|
|
16017
|
+
if (type === "importmap") {
|
|
16018
|
+
readImportMap(match[2], bodyStart, loads, name);
|
|
16019
|
+
continue;
|
|
16020
|
+
}
|
|
16021
|
+
if (type !== "" && type !== "module" && !/^(?:text|application)\/(?:x-)?(?:javascript|ecmascript)$/.test(type)) continue;
|
|
16022
|
+
const body = blankJsComments(match[2]);
|
|
16023
|
+
name(body, false);
|
|
16024
|
+
for (const im of body.matchAll(/(?:\bfrom\s*|\bimport\s*\(?\s*)(["'])([^"'\n]*)\1/g)) {
|
|
16025
|
+
const start = bodyStart + im.index + im[0].indexOf(im[1]) + 1;
|
|
16026
|
+
loads.references.push({ text: im[2], start });
|
|
16027
|
+
name(im[2], true);
|
|
16028
|
+
specifiers.push(im[2]);
|
|
16029
|
+
}
|
|
16030
|
+
}
|
|
16031
|
+
for (const m of scan.matchAll(/<link\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/gi)) {
|
|
16032
|
+
if (!/^\s*modulepreload\s*$/i.test(attrValue(m[1], "rel") ?? "")) continue;
|
|
16033
|
+
const href = attrValue(m[1], "href");
|
|
16034
|
+
if (href !== null) name(href, false);
|
|
16035
|
+
}
|
|
16036
|
+
for (const spec of specifiers) {
|
|
16037
|
+
if (namedPackages(spec).length > 0) continue;
|
|
16038
|
+
const target = resolveSpecifier(spec, loads.imports);
|
|
16039
|
+
if (target === void 0 || namedPackages(target).length > 0 || isUrl(target)) continue;
|
|
16040
|
+
if (isRelative(target)) locals.push(pagePath(target));
|
|
16041
|
+
}
|
|
16042
|
+
loads.autoloader = loads.pkgs.has("autoloader") || /<wcs-autoloader\b/i.test(scan);
|
|
16043
|
+
if (loads.autoloader) locals.push(...autoloaderModules(scan, loads.imports));
|
|
16044
|
+
if (locals.length > 0) readLocalModules(locals, fileReader, loads);
|
|
16045
|
+
return loads;
|
|
16046
|
+
}
|
|
16047
|
+
function readImportMap(body, bodyStart, loads, name) {
|
|
16048
|
+
for (const m of body.matchAll(/"((?:[^"\\]|\\.)*)"/g)) {
|
|
16049
|
+
loads.references.push({ text: m[1], start: bodyStart + m.index + 1 });
|
|
16050
|
+
name(m[1], true);
|
|
16051
|
+
}
|
|
16052
|
+
let parsed = null;
|
|
16053
|
+
try {
|
|
16054
|
+
parsed = JSON.parse(body);
|
|
16055
|
+
} catch {
|
|
16056
|
+
return;
|
|
16057
|
+
}
|
|
16058
|
+
const imports = parsed?.imports;
|
|
16059
|
+
if (imports === null || typeof imports !== "object") return;
|
|
16060
|
+
for (const [key, value] of Object.entries(imports)) {
|
|
16061
|
+
loads.mapKeys.push(key);
|
|
16062
|
+
if (typeof value === "string") loads.imports.set(key, value);
|
|
16063
|
+
}
|
|
16064
|
+
}
|
|
16065
|
+
function resolveSpecifier(spec, imports) {
|
|
16066
|
+
if (isUrl(spec) || isRelative(spec)) return spec;
|
|
16067
|
+
if (imports.has(spec)) return imports.get(spec);
|
|
16068
|
+
let best;
|
|
16069
|
+
for (const key of imports.keys()) {
|
|
16070
|
+
if (key.endsWith("/") && spec.startsWith(key) && (best === void 0 || key.length > best.length)) best = key;
|
|
16071
|
+
}
|
|
16072
|
+
return best === void 0 ? void 0 : imports.get(best) + spec.slice(best.length);
|
|
16073
|
+
}
|
|
16074
|
+
function isUrl(spec) {
|
|
16075
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(spec) || spec.startsWith("//");
|
|
16076
|
+
}
|
|
16077
|
+
function isRelative(spec) {
|
|
16078
|
+
return spec.startsWith("./") || spec.startsWith("../") || spec.startsWith("/");
|
|
16079
|
+
}
|
|
16080
|
+
function pagePath(src) {
|
|
16081
|
+
return isRelative(src) ? src : `./${src}`;
|
|
16082
|
+
}
|
|
16083
|
+
function readLocalModules(entries, fileReader, loads) {
|
|
16084
|
+
if (fileReader === void 0) {
|
|
16085
|
+
loads.unclear = true;
|
|
16086
|
+
return;
|
|
16087
|
+
}
|
|
16088
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
16089
|
+
const queue = entries.map((spec) => ({ spec, from: "", depth: 0 }));
|
|
16090
|
+
while (queue.length > 0) {
|
|
16091
|
+
const { spec, from, depth } = queue.shift();
|
|
16092
|
+
const path = joinModulePath(from, spec);
|
|
16093
|
+
if (seen2.has(path)) continue;
|
|
16094
|
+
if (seen2.size >= MAX_FILES2 || depth > MAX_DEPTH) {
|
|
16095
|
+
loads.unclear = true;
|
|
16096
|
+
return;
|
|
16097
|
+
}
|
|
16098
|
+
seen2.add(path);
|
|
16099
|
+
const text3 = fileReader(path);
|
|
16100
|
+
if (text3 === void 0) {
|
|
16101
|
+
loads.unclear = true;
|
|
16102
|
+
return;
|
|
16103
|
+
}
|
|
16104
|
+
for (const p of namedPackages(text3)) loads.pkgs.add(p);
|
|
16105
|
+
for (const m of text3.matchAll(/["'`](wcs-[a-z0-9-]+)["'`]/g)) loads.definedTags.add(m[1]);
|
|
16106
|
+
for (const im of text3.matchAll(/(?:\bfrom\s*|\bimport\s*\(?\s*)(["'])([^"'\n]*)\1/g)) {
|
|
16107
|
+
if (namedPackages(im[2]).length > 0) continue;
|
|
16108
|
+
const target = resolveSpecifier(im[2], loads.imports);
|
|
16109
|
+
if (target === void 0 || namedPackages(target).length > 0 || isUrl(target) || !isRelative(target)) continue;
|
|
16110
|
+
queue.push({ spec: target, from: isRelative(im[2]) ? path : "", depth: depth + 1 });
|
|
16111
|
+
}
|
|
16112
|
+
}
|
|
16113
|
+
}
|
|
16114
|
+
|
|
15728
16115
|
// src/service/watchDeclarationValidator.ts
|
|
15729
16116
|
var STATE_NAME_SEPARATOR = "@";
|
|
15730
16117
|
function validateWatchDeclarations(html, stateTagName = "wcs-state", locale2, fileReader) {
|
|
@@ -17715,7 +18102,7 @@ function validateScriptReads(html, stateTagName = "wcs-state", locale2, fileRead
|
|
|
17715
18102
|
code: WcsDiagnosticCode.PathDynamicUnknown,
|
|
17716
18103
|
start: block.contentStart + span.start,
|
|
17717
18104
|
end: block.contentStart + span.end,
|
|
17718
|
-
message: msgs.pathDynamicUnknownValue(path, count, candidate.opaque?.name, candidate.opaque?.from),
|
|
18105
|
+
message: candidate.opaque?.spread !== void 0 ? msgs.pathDynamicUnknownObjectSpread(path, count, candidate.opaque.spread, candidate.opaque.from) : msgs.pathDynamicUnknownValue(path, count, candidate.opaque?.name, candidate.opaque?.from),
|
|
17719
18106
|
severity: "info"
|
|
17720
18107
|
});
|
|
17721
18108
|
}
|
|
@@ -18029,12 +18416,12 @@ function loadManifest(artifact) {
|
|
|
18029
18416
|
for (const ns of NAMESPACE_KEYS) {
|
|
18030
18417
|
const nsObj = extensions[ns];
|
|
18031
18418
|
if (nsObj !== null && typeof nsObj === "object") {
|
|
18032
|
-
const
|
|
18033
|
-
if (typeof
|
|
18419
|
+
const version3 = nsObj.version;
|
|
18420
|
+
if (typeof version3 === "number" && version3 !== SUPPORTED_NAMESPACE_VERSION) {
|
|
18034
18421
|
ctx.add(
|
|
18035
18422
|
WcsDiagnosticCode.ManifestNamespaceVersion,
|
|
18036
18423
|
pointer("manifestExtensions", ns, "version"),
|
|
18037
|
-
`Namespace "${ns}" version ${
|
|
18424
|
+
`Namespace "${ns}" version ${version3} is unsupported (expected ${SUPPORTED_NAMESPACE_VERSION}).`,
|
|
18038
18425
|
"warning"
|
|
18039
18426
|
);
|
|
18040
18427
|
}
|
|
@@ -18292,6 +18679,7 @@ function validateText(text3, options, applicationSchema) {
|
|
|
18292
18679
|
out.push(...validateAriaAttributes(text3, bindAttribute, locale2));
|
|
18293
18680
|
out.push(...validateLiveRegions(text3, bindAttribute, stateTagName, locale2));
|
|
18294
18681
|
out.push(...validateDocumentEnv(text3, locale2));
|
|
18682
|
+
out.push(...validatePackageLoads(text3, locale2, fileReader));
|
|
18295
18683
|
out.push(...validateSemantics(text3, stateTagName, locale2, bindAttribute));
|
|
18296
18684
|
out.push(...validateScriptStateUses(text3, stateTagName, locale2, bindAttribute));
|
|
18297
18685
|
out.push(...validateScriptReads(text3, stateTagName, locale2, fileReader, applicationSchema, bindAttribute));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/lint",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Static-contract validator CLI (wcs-validate) for wcstack data-wcs bindings and wcstack.manifest.json sidecars. Thin npm wrapper around the wcstack-intellisense validator core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|