@wcstack/lint 4.29.0 → 4.31.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 +28 -2
- package/README.md +28 -2
- package/dist/cli.cjs +587 -23
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -40,7 +40,7 @@ wcs-validate [--attr=data-wcs] [--state-tag=wcs-state] [--lang=ja|en] [--root=<d
|
|
|
40
40
|
| `--lang=ja\|en` | 診断メッセージの言語。未指定時は環境ロケール(`LC_ALL` / `LC_MESSAGES` / `LANG` → OS ロケール)に従う。code / range は言語に依らず不変 |
|
|
41
41
|
| `--root=<dir>`(`--root <dir>` も) | 4.10 から: サイトのルートのディレクトリ。/ から始まるパスをその下で読む — `<base href="/ja/">` の下の `<wcs-state src="/app.js">`(`docs/csp.md` と `examples/router-i18n` の形)や、state のファイルの `/…` からの import は `<dir>/app.js` として読む。ディレクトリの外へ出るもの(`/../x.js`)は読まない。無ければ / から始まるパスは読まない(`wcs/state-src-unread`、info)。そうしたファイルの指摘はディレクトリの下のパスで出す(`public/app.js:12:5 …`) |
|
|
42
42
|
| `--errors-only`(別名 `--quiet`) | error severity の行だけ表示。warning / info の件数と exit code は不変 |
|
|
43
|
-
| `--strict` | warning severity の診断でも exit `1` にする。severity 自体は不変(IDE の表示と同じ)で、exit code の閾値だけを error → warning に下げる。summary 行の末尾に `(strict)` が付く。パスの typo(`wcs/binding-path-missing` は warning)で CI を落としたいときに使う — ただし先に `<wcs-state src>` を全て解決可能にしておくこと(解決できない外部 state が残す warning でも落ちるようになる)。`--errors-only` と併用可: 表示は error のみのまま、exit code は warning
|
|
43
|
+
| `--strict` | warning severity の診断でも exit `1` にする。severity 自体は不変(IDE の表示と同じ)で、exit code の閾値だけを error → warning に下げる。summary 行の末尾に `(strict)` が付く。パスの typo(`wcs/binding-path-missing` は warning)で CI を落としたいときに使う — ただし先に `<wcs-state src>` を全て解決可能にしておくこと(解決できない外部 state が残す warning でも落ちるようになる)。`--errors-only` と併用可: 表示は error のみのまま、exit code は warning を反映する。4.30 から、state をまるごと読めなかったと言う info(`wcs/state-src-unread` と、state の先頭の `...spread` の `wcs/path-dynamic-unknown`)も warning と同じく数え、`--errors-only` でも表示する |
|
|
44
44
|
|
|
45
45
|
## 出力と exit code
|
|
46
46
|
|
|
@@ -96,7 +96,7 @@ nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack scr
|
|
|
96
96
|
|
|
97
97
|
- **発見**: HTML ファイルから上へ辿って最も近い `wcstack.manifest.json` が自動で使われます — コマンドラインに渡す必要はありません。`application` artifact を含む `*.manifest.json` を引数に渡した場合は、その実行全体で発見を置き換えます。VS Code 拡張も同じファイルを発見するので IDE と CLI の結果は一致します。
|
|
98
98
|
- **schema を当てるページ**(4.26 から): schema を作った state のファイルを記した manifest — `wcstack.application.stateSource`、manifest からの相対で、`wcs-schema emit` が書きます — は、そのファイルを root の `<wcs-state src>` で読むページだけの契約です(同じパスの `.js` と `.ts`、`.mjs` と `.mts` は同じファイル)。state がインラインのページや別のファイルのページは、発見した manifest でも引数に渡した manifest でも、manifest が無いものとして検査します。4.25 までは、アプリの schema をその下のすべてのページに当てていたので、アプリの隣で自前のインラインの state を持つページの正しいパスが `wcs/path-nonexistent` の error になっていました。`stateSource` の無い manifest(手書き・それより前の `wcs-schema` が作ったもの)は、これまでどおりすべてのページに当てます。
|
|
99
|
-
- **効果**: `stateSchema` を宣言すると、schema 上に確定的に存在しないバインドパスは `wcs/path-nonexistent`(**error**・exit `1`)、`for:` に非配列は `wcs/path-type-mismatch`(**error**)になります。schema が開いたままの箇所(素の `{}
|
|
99
|
+
- **効果**: `stateSchema` を宣言すると、schema 上に確定的に存在しないバインドパスは `wcs/path-nonexistent`(**error**・exit `1`)、`for:` に非配列は `wcs/path-type-mismatch`(**error**)になります。schema が開いたままの箇所(素の `{}`)は schema が無いときと同じに検査し(4.31 から。以前は沈黙した)、インラインスクリプトのメソッド / getter / `$listKeys` は引き続き存在扱いです。`stateSchema` が無ければ従来どおりです。
|
|
100
100
|
- **契約が要るとき**: 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>` を渡してください。
|
|
101
101
|
- **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` で同期を保ってください。
|
|
102
102
|
|
|
@@ -197,6 +197,32 @@ nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack scr
|
|
|
197
197
|
- 確かなときだけ読みます: オブジェクトリテラルの `state = { … }`(フィールドか、コンストラクタの `this.state = { … }`)で、スプレッドも計算されたキーも無いもの。テンプレートは、モジュールの中の 1 つの文字列。lint が読めないファイル(`--root` なしの `/` から始まるパス)、呼び出しで作る state、見つからないクラスには、これまでどおり何も言いません。
|
|
198
198
|
|
|
199
199
|
|
|
200
|
+
## ほかのフレームワークの癖で書いたページに言うこと
|
|
201
|
+
|
|
202
|
+
4.30 から。継ぎ目アプリ street-reports — 初めての作者が React のアプリを wcstack に移した。React(JSX)の作者が持ち込む癖は何も言われずに動くか、lint が別のものとして言いました: 式は「存在しないパス」と言われ、束縛の右辺のテンプレートリテラルや引用符の文字列は何も言われませんでした。ランタイムが拒むか黙って落とすものは error、ほかは warning で、確かなことだけを言います。
|
|
203
|
+
|
|
204
|
+
- **`wcs/binding-expression`**(error) — 束縛の右辺はパスとフィルタで、式ではありません: `hidden: !loading`・`textContent: count + 1`・`class.active: status === 'new'`・`class.is-new: .status === 'new'`・`textContent: done ? '完了' : '未完了'`・`` attr.href: `/reports/${id}` ``・`textContent: '件数: ' + count`・`textContent: formatDate(reportedAt)`・`if: items.length > 0`・`{{ count + 1 }}`・`<!--@@: count + 1 -->`。式とは、右辺(最初の `|` より前)に空白か `` ! ? = < > + ( ) ' " ` & , `` のどれかがあるもの — パスはどれも持てません。メッセージは、形にフィルタがあればそれを示し(`!x` → `x|not`・`x > 0` → `x|gt(0)`・`x === 'new'` → `x|eq(new)`・`x + 1` → `x|add(1)`)、無ければ getter を勧めます。引数付きやアロー関数のイベントの束縛(`onclick: remove(.id)`・`onchange: () => toggleRow(.id)`)には、ハンドラはメソッドの名前で `(event, ...ループの添字)` で呼ばれると言います。1 つの文字列に 1 件: 同じ文字列のパスが無いという報告(`wcs/binding-path-missing`・`wcs/path-nonexistent`)は重ねません。引数付きのフィルタ・修飾子・行のパス・ワイルドカードと添字のパス・スプレッド・`else:`・`state.key:`・`command.x:`・`eventToken.x:` は式ではありません。`a || b` は既に error です(`wcs/binding-syntax`、空のフィルタ)。`<wcs-state>` の無いファイルの `{{ }}` はほかのテンプレートエンジンのもの(`{{#each}}`)で、読みません。
|
|
205
|
+
- **`wcs/attribute-mustache`**(warning) — 束縛属性以外の属性の値の `{{ }}`: `href="/reports/{{ id }}"`・`class="row {{ kind }}"`・`alt="{{ title }}"`・`<wcs-link to="/reports/{{ .id }}">`。`{{ }}` はテキストでしか読まれないので、属性には波括弧が残ります。属性を束ねてください(`attr.href: <パス>`。文字列を組み立てる getter を書いて)。ページを返す前にサーバーのテンプレートが埋めるのなら正しいので warning です。`<wcs-state>` のあるファイル(または DCC の定義)だけで、state が `$behavior: { enableMustache: false }` を宣言しているとき・`data-wcs-ignore` の中では言いません。属性ごとに 1 回。
|
|
206
|
+
- **`wcs/structural-element`**(error) — `<template>` でない要素の `data-wcs` に単独で書いた `if:` / `elseif:` / `else:` / `for:`(`<p data-wcs="if: open">`・`<li data-wcs="for: items">`): ランタイムはその名前のプロパティを書くだけで、要素は常に表示され、一覧は 1 つの要素です。要素を `<template data-wcs="if: …">` の中に入れてください。ほかの束縛と並べたものは、これまでどおり `wcs/template-syntax` が言います。
|
|
207
|
+
- **`wcs/collection-mutation`**(error) — state のメソッド・setter・`$watch` と `$on` のハンドラ(`wcs/array-mutation` が見る所)で、state のリテラルでの初期値が `new Set(…)` / `new Map(…)` のキーへの `this.selected.add(id)`・`.delete(…)`・`.clear()`・`this.byId.set(k, v)`。state はそれを見ません。新しいものを代入する(`this.selected = new Set([...this.selected, id])`)か、配列 / オブジェクトで持ってください。メソッドがキーを代入し直すときは言いません。
|
|
208
|
+
- **`wcs/row-id-shared`**(warning) — `for:` の行の要素のリテラルの `id="…"` で、束縛(`attr.id:` / `id:`)が与えないもの: すべての行が同じ id になり、`<label for>` や `aria-labelledby` は最初の行にしか届きません。束ねてください(`attr.id: .domId` — 行のキーから組み立てる行の getter を書いて)。ループと id ごとに 1 回。行の中の `if:` の枝の下(1 行だけで描かれることがある)と shadow root の中では言いません。
|
|
209
|
+
- **`wcs/event-name-case`**(warning) — `onSubmit:`・`onClick:`・`onChange:`(JSX の綴り): `Submit` という名前のイベントのリスナーが付き、それを送るものはありません。DOM のイベントなら `onsubmit:`。部品のコールバック("prop")は部品が送るイベントで、`eventToken.<メンバー>:` で束ねます。
|
|
210
|
+
- **`wcs/inline-import`**(error) — インラインの `<wcs-state>` や `<wcs-guard-handler>` のスクリプトの静的な `import … from "./x.js"`(`../`・`/`): `blob:` URL から評価されるので、import は解決しません。`src=` のファイル・完全な URL・import map の名前を使ってください。完全な URL・裸の指定子・`src=` の state には言いません。
|
|
211
|
+
- **`wcs/key-binding`**(warning) — ネイティブ要素の `key:`(React の `key`): `key` という名前のプロパティを書くだけで、何もしません。key は要りません — 行は行のオブジェクトで突き合わされ、取り直したデータで行を保つのは `$listKeys` です。カスタム要素の `key` は入力のことがある(`<wcs-storage>`)ので言いません。
|
|
212
|
+
- **`--strict` は読めなかった state を数えます。** `wcs/state-src-unread`(lint が読めない `<wcs-state src>`)と、state の先頭の `...spread` の `wcs/path-dynamic-unknown` —— どちらの後も、その state のパスは 1 つも検査されません —— は info のままですが、`--strict` では warning と同じく数えます(exit `1`)。lint が値を読めないキー(別のファイルから import した辞書、`team: init.team`)は、state の残りを検査したままにします: `--strict` が通す info のままです。そして、summary 行がその数を言い(`(strict; 2 unchecked counted as warnings)`)、その後に `strict:` の注記が続きます。4.29 までの `--strict` は、そうした state を検査しないまま exit `0` でした。
|
|
213
|
+
|
|
214
|
+
新しい error は `--errors-only` にも出ます。新しい warning は `--strict` で失敗します。
|
|
215
|
+
|
|
216
|
+
## 生成した schema と、行の合計を持つページに言うこと
|
|
217
|
+
|
|
218
|
+
4.31 から。外部の評価 — wcstack 4.28.0 でビルドなしの確定申告の下書きツールを 25 日で作る Advent Calendar の連載の記録から:
|
|
219
|
+
|
|
220
|
+
- **`stateSchema` を足しても検査は弱くなりません。** schema が何も言わない所 — 行に型の無い一覧(`items: {}`。空で始まる一覧に `wcs-schema` が書くもの)・`null` の型の値・`any` — のパスは、schema が無いときと同じに検査します(`wcs/binding-path-missing`、warning)。そうした一覧の下の綴り違い `.deductio` は、schema が無いと知らされ、足すと通っていました。`wcs-schema emit` も、そうした一覧を名指すようになりました。
|
|
221
|
+
- **`wcs/getter-untracked-read` は一覧の行も読みます。** getter が `this.incomes` を読み、行のオブジェクトから項目を読み — `this.incomes.reduce((t, row) => t + row.amount, 0)`・`this.todos.filter((t) => !t.done).length`、`filter` / `slice` / `toSorted` の後・`[...this.list]`・`for (const row of this.list)` も — その項目がパスで書かれるとき。追跡されるのは一覧だけなので、合計は行の追加と削除には付いてきて、金額を打ち替えると前の値のままです。ページの束縛が書くなら **error**(行の中の `valueAsNumber: .amount`・`checked: .done`・組み込みタグの出力)、lint が契約を持たないカスタム要素の `value:` / `checked:`(`<yen-input data-wcs="value: .amount">`)かスクリプト(`this["incomes.0.amount"] = …`・`$setAll`)が書くなら warning。その項目の書き込みが無ければ報告しません — 一覧を置き換えるページ・`#ro` の束縛・`<option data-wcs="value: .id">`。項目はパスで読んでください: `this.$getAll("incomes.*.amount", [])`。
|
|
222
|
+
- **無いパスにはどこでも「もしかして」。** トップレベルのキーや getter の綴り違い(`dependentsDeductio`)・オブジェクトのメンバー(`user.nmae`)にも、ランタイムと同じく近い名前を言います。これまでは行のフィールドだけでした。
|
|
223
|
+
|
|
224
|
+
新しい warning は `--strict` で落ち、新しい error は `--errors-only` でも出ます。
|
|
225
|
+
|
|
200
226
|
## 生成 → 検証 → 修正ループでの利用
|
|
201
227
|
|
|
202
228
|
安定した 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
|
@@ -40,7 +40,7 @@ wcs-validate [--attr=data-wcs] [--state-tag=wcs-state] [--lang=ja|en] [--root=<d
|
|
|
40
40
|
| `--lang=ja\|en` | Diagnostic message language. Defaults to the environment locale (`LC_ALL` / `LC_MESSAGES` / `LANG`, then the OS locale); codes and ranges are language-independent |
|
|
41
41
|
| `--root=<dir>` (also `--root <dir>`) | Since 4.10: the site's root directory, where a path from `/` is read — a `<wcs-state src="/app.js">` under `<base href="/ja/">` (the form of `docs/csp.md` and `examples/router-i18n`) and an import from `/…` in a state file are read as `<dir>/app.js`; a path that leaves the directory (`/../x.js`) is not. Without it a path from `/` is not read (`wcs/state-src-unread`, info). A finding in such a file is reported under the directory (`public/app.js:12:5 …`) |
|
|
42
42
|
| `--errors-only` (alias `--quiet`) | Print only error-severity lines; warning/info counts and the exit code are unchanged |
|
|
43
|
-
| `--strict` | Exit `1` on warning-severity diagnostics too. Severities are unchanged (the IDE shows the same thing); only the exit-code threshold moves from error to warning. The summary line ends with `(strict)`. Use it to fail CI on a path typo (`wcs/binding-path-missing` is a warning) — but resolve every `<wcs-state src>` first (an unresolvable external state leaves warnings that would now fail the build). Combines with `--errors-only`: output stays error-only, the exit code still reflects warnings |
|
|
43
|
+
| `--strict` | Exit `1` on warning-severity diagnostics too. Severities are unchanged (the IDE shows the same thing); only the exit-code threshold moves from error to warning. The summary line ends with `(strict)`. Use it to fail CI on a path typo (`wcs/binding-path-missing` is a warning) — but resolve every `<wcs-state src>` first (an unresolvable external state leaves warnings that would now fail the build). Combines with `--errors-only`: output stays error-only, the exit code still reflects warnings. Since 4.30 the infos that say a whole state was not read — `wcs/state-src-unread`, and `wcs/path-dynamic-unknown` for a `...spread` at the top of a state — count like warnings too, and are printed with `--errors-only` |
|
|
44
44
|
|
|
45
45
|
## Output & exit codes
|
|
46
46
|
|
|
@@ -96,7 +96,7 @@ Without a contract, a path the validator cannot resolve is only a **warning** (`
|
|
|
96
96
|
|
|
97
97
|
- **Discovery**: the nearest `wcstack.manifest.json` walking up from the HTML file is used automatically — nothing to pass on the command line. Passing `*.manifest.json` arguments that contain an `application` artifact replaces discovery for the whole run. The VS Code extension discovers the same file, so IDE and CLI agree.
|
|
98
98
|
- **Which pages a schema is for** (since 4.26): a manifest that names the state file its schema was generated from — `wcstack.application.stateSource`, relative to the manifest, which `wcs-schema emit` writes — is the contract only of a page whose root `<wcs-state src>` loads that file (`.js` and `.ts`, `.mjs` and `.mts` of one path being one file). A page whose state is inline, or another file, is checked as if there were no manifest, whether the manifest was discovered or passed on the command line. Up to 4.25 the app's schema was applied to every page under it, so a page with its own inline state beside the app got `wcs/path-nonexistent` errors for its correct paths. A manifest without `stateSource` (hand-written, or generated by an earlier `wcs-schema`) applies to every page as before.
|
|
99
|
-
- **Effect**: when a `stateSchema` is declared, a bound path that the schema definitely lacks is `wcs/path-nonexistent` (**error**, exit `1`); `for:` on a non-array is `wcs/path-type-mismatch` (**error**). Paths the schema leaves open (a bare `{}`)
|
|
99
|
+
- **Effect**: when a `stateSchema` is declared, a bound path that the schema definitely lacks is `wcs/path-nonexistent` (**error**, exit `1`); `for:` on a non-array is `wcs/path-type-mismatch` (**error**). Paths the schema leaves open (a bare `{}`) are checked as they are without a schema — since 4.31; they were silent — and methods / getters / `$listKeys` from the inline script still count as existing. Without a `stateSchema`, behavior is unchanged.
|
|
100
100
|
- **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 `/`.
|
|
101
101
|
- **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.
|
|
102
102
|
|
|
@@ -197,6 +197,32 @@ Since 4.29, from the garden-plots seam app — a console assembled from a city's
|
|
|
197
197
|
- Only what is certain is read: `state = { … }` as an object literal (a field, or `this.state = { … }` in the constructor) with no spread and no computed key, and a template that is one string of the module. A file the lint cannot read (a path from `/` without `--root`), a state built by a call, a class it cannot find: nothing is said about the tag, as before.
|
|
198
198
|
|
|
199
199
|
|
|
200
|
+
## What a page written from another framework's habits is told
|
|
201
|
+
|
|
202
|
+
Since 4.30, from the street-reports seam app — a React app ported to wcstack by a first-time author. The habits a React (JSX) author brings ran without a word, or the lint described them as something else: an expression was "a path that does not exist", and a template literal or a quoted string on the right of a binding was not reported at all. What the runtime refuses or silently drops is an error, the rest a warning, and only what is certain is said.
|
|
203
|
+
|
|
204
|
+
- **`wcs/binding-expression`** (error) — the right side of a binding is a path and filters, not an expression: `hidden: !loading`, `textContent: count + 1`, `class.active: status === 'new'`, `class.is-new: .status === 'new'`, `textContent: done ? '完了' : '未完了'`, `` attr.href: `/reports/${id}` ``, `textContent: '件数: ' + count`, `textContent: formatDate(reportedAt)`, `if: items.length > 0`, `{{ count + 1 }}`, `<!--@@: count + 1 -->`. An expression is a right side (before the first `|`) with whitespace in it or one of `` ! ? = < > + ( ) ' " ` & , ``, none of which a path can hold. The message names the filter where the form has one — `!x` → `x|not`, `x > 0` → `x|gt(0)`, `x === 'new'` → `x|eq(new)`, `x + 1` → `x|add(1)` — and a getter otherwise. On an event binding with arguments or an arrow function (`onclick: remove(.id)`, `onchange: () => toggleRow(.id)`) it says that a handler is a method name, called with `(event, ...loopIndexes)`. One finding per text: the missing-path report of the same text (`wcs/binding-path-missing`, `wcs/path-nonexistent`) is not added. Filters with arguments, modifiers, row paths, wildcard and index paths, spreads, `else:`, `state.key:`, `command.x:` and `eventToken.x:` are not expressions; `a || b` is already an error (`wcs/binding-syntax`, an empty filter). `{{ }}` in a file without a `<wcs-state>` is another template engine's (`{{#each}}`) and is not read.
|
|
205
|
+
- **`wcs/attribute-mustache`** (warning) — `{{ }}` in an attribute other than the bind attribute: `href="/reports/{{ id }}"`, `class="row {{ kind }}"`, `alt="{{ title }}"`, `<wcs-link to="/reports/{{ .id }}">`. `{{ }}` is read in text only, so the attribute keeps the braces; bind it (`attr.href: <path>`, with a getter that builds the string). A warning, since a server-side template that fills it before the page is served is fine. Only in a file (or a DCC definition) with a `<wcs-state>`, not where the state declares `$behavior: { enableMustache: false }`, not in a `data-wcs-ignore` subtree; once per attribute.
|
|
206
|
+
- **`wcs/structural-element`** (error) — `if:` / `elseif:` / `else:` / `for:` alone in the `data-wcs` of an element that is not a `<template>` (`<p data-wcs="if: open">`, `<li data-wcs="for: items">`): the runtime sets a property of that name and does nothing else — the element is always shown, the list is one element. Put the element inside `<template data-wcs="if: …">`. Beside another binding, `wcs/template-syntax` says it as before.
|
|
207
|
+
- **`wcs/collection-mutation`** (error) — in a state's methods, setters, `$watch` and `$on` handlers (where `wcs/array-mutation` looks): `this.selected.add(id)`, `.delete(…)`, `.clear()`, `this.byId.set(k, v)` on a key whose initial value in the state literal is `new Set(…)` / `new Map(…)`. The state does not see it. Assign a new one (`this.selected = new Set([...this.selected, id])`), or keep an array / an object. Not said when the method assigns the key again.
|
|
208
|
+
- **`wcs/row-id-shared`** (warning) — a literal `id="…"` on an element of a `for:` row that no binding gives (`attr.id:` / `id:`): every row gets the same id, and a `<label for>` or `aria-labelledby` reaches the first row only. Bind it (`attr.id: .domId`, with a row getter that builds it from the row's key). Once per loop and id. Not under an `if:` branch in the row (it may be drawn for one row at a time) nor in a shadow root.
|
|
209
|
+
- **`wcs/event-name-case`** (warning) — `onSubmit:`, `onClick:`, `onChange:` (JSX's spelling): the listener is added for an event named `Submit`, which nothing dispatches. Write `onsubmit:` for a DOM event; a callback "prop" of a part is an event the part dispatches, bound with `eventToken.<member>:`.
|
|
210
|
+
- **`wcs/inline-import`** (error) — a static `import … from "./x.js"` (`../`, `/`) in an inline `<wcs-state>` or `<wcs-guard-handler>` script: it is evaluated from a `blob:` URL, and the import does not resolve. Use a `src=` file, a full URL, or an import-map name. Not for a full URL, a bare specifier or a `src=` state.
|
|
211
|
+
- **`wcs/key-binding`** (warning) — `key:` on a native element (React's `key`): it sets a property named `key` and does nothing. No key is needed: rows are matched by the row object, and `$listKeys` keeps rows across refetched data. A custom element's `key` may be an input (`<wcs-storage>`) and is not reported.
|
|
212
|
+
- **`--strict` counts a state that was not read.** `wcs/state-src-unread` (a `<wcs-state src>` the lint cannot read) and the `wcs/path-dynamic-unknown` of a `...spread` at the top of a state — after either, none of that state's paths is checked — stay info, but under `--strict` they count like warnings (exit `1`). A key whose value the lint cannot read (a dictionary imported from another file, `team: init.team`) leaves the rest of the state checked: it stays an info that `--strict` passes. For those two, the summary line says how many (`(strict; 2 unchecked counted as warnings)`) and a `strict:` note follows it. Up to 4.29 `--strict` exited `0` with such a state unchecked.
|
|
213
|
+
|
|
214
|
+
The new errors are printed with `--errors-only` too; the new warnings fail `--strict`.
|
|
215
|
+
|
|
216
|
+
## What a page with a generated schema and a total over its rows is told
|
|
217
|
+
|
|
218
|
+
Since 4.31, from an outside evaluation — the record of a 25-day Advent Calendar series that builds a buildless tax-return draft tool on wcstack 4.28.0:
|
|
219
|
+
|
|
220
|
+
- **A `stateSchema` never weakens the check.** Where the schema says nothing — a list whose rows have no type (`items: {}`, what `wcs-schema` writes for a list that starts empty), a value typed `null`, `any` — a path is checked as it is without a schema (`wcs/binding-path-missing`, a warning). A misspelt `.deductio` under such a list was reported without the schema and passed once it was added. `wcs-schema emit` also names each such list now.
|
|
221
|
+
- **`wcs/getter-untracked-read` reads a list's rows too.** A getter that reads `this.incomes` and a field from its row objects — `this.incomes.reduce((t, row) => t + row.amount, 0)`, `this.todos.filter((t) => !t.done).length`, also after `filter` / `slice` / `toSorted`, on `[...this.list]`, and in `for (const row of this.list)` — when that field is written by path: only the list is tracked, so the total follows rows added and removed and keeps its value when an amount is edited. An **error** when a binding on the page writes it (`valueAsNumber: .amount` in the rows, `checked: .done`, a built-in tag's output); a warning when the write is a custom element's `value:` / `checked:` the lint has no contract for (`<yen-input data-wcs="value: .amount">`) or the script's (`this["incomes.0.amount"] = …`, `$setAll`). Not reported without such a write of that field — a page that replaces the list, a `#ro` binding, `<option data-wcs="value: .id">`. Read the field by path: `this.$getAll("incomes.*.amount", [])`.
|
|
222
|
+
- **A did-you-mean for any missing path.** A misspelt top-level key or getter (`dependentsDeductio`) and an object's member (`user.nmae`) name the near one, as the runtime does; only a row's field did.
|
|
223
|
+
|
|
224
|
+
The new warnings fail `--strict`; the new error shows with `--errors-only`.
|
|
225
|
+
|
|
200
226
|
## Use in generate–validate–fix loops
|
|
201
227
|
|
|
202
228
|
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
|
@@ -464,6 +464,28 @@ var WcsDiagnosticCode = {
|
|
|
464
464
|
// ランタイムは何も言わず、後から state に書くと正しいものが選ばれる(継ぎ目アプリ garden-plots の取り込み — 保存した
|
|
465
465
|
// 設定がページを描く前に届くようになって見えた)。値の束縛が前にあるとき・リテラルの `value` だけのときは黙る。warning。
|
|
466
466
|
RadioBeforeValue: "wcs/radio-before-value",
|
|
467
|
+
// --- another framework's habits (service/frameworkHabitsValidator.ts・collectionMutationValidator.ts — 継ぎ目アプリ
|
|
468
|
+
// street-reports: React から移した作者。ランタイムが拒むか黙って落とすものは error、ほかは warning) ---
|
|
469
|
+
// 束縛の右辺(最初の `|` より前)が式(`hidden: !loading`・`textContent: count + 1`・`{{ a ? b : c }}`・
|
|
470
|
+
// `onclick: remove(.id)`)。パスとして引かれ、何も出ない。同じ文字列のパスの検査(binding-path-missing 等)は重ねない。error。
|
|
471
|
+
BindingExpression: "wcs/binding-expression",
|
|
472
|
+
// 束縛属性以外の属性の値の `{{ }}`(`href="/r/{{ id }}"`)。`{{ }}` はテキストでしか読まれず、属性には書いたまま残る。
|
|
473
|
+
// サーバーのテンプレートが埋めるなら正しいので warning。`<wcs-state>` の無いファイルでは言わない。
|
|
474
|
+
AttributeMustache: "wcs/attribute-mustache",
|
|
475
|
+
// `<template>` でない要素の `data-wcs` にある `if:` / `elseif:` / `else:` / `for:`(単独)。ランタイムはその名前の
|
|
476
|
+
// プロパティを書くだけで、要素は常に出て、行は 1 つ。error。
|
|
477
|
+
StructuralElement: "wcs/structural-element",
|
|
478
|
+
// state の `new Set(…)` / `new Map(…)` のキーをその場で変える(`this.selected.add(id)`)。state は見ない。error。
|
|
479
|
+
CollectionMutation: "wcs/collection-mutation",
|
|
480
|
+
// `for:` の行の中の要素のリテラルの `id`(束ねていない)。すべての行が同じ id になる。warning。
|
|
481
|
+
RowIdShared: "wcs/row-id-shared",
|
|
482
|
+
// `onSubmit:` — `on` の直後が大文字のイベント束縛(JSX の綴り)。`Submit` という名前のイベントを聞く。warning。
|
|
483
|
+
EventNameCase: "wcs/event-name-case",
|
|
484
|
+
// インラインの `<wcs-state>` / `<wcs-guard-handler>` のスクリプトの相対・ルート相対の静的 import。blob: URL から
|
|
485
|
+
// 評価されるので解決しない。error。
|
|
486
|
+
InlineImport: "wcs/inline-import",
|
|
487
|
+
// `key:`(React の key)。`key` という名前のプロパティを書くだけ。warning。
|
|
488
|
+
KeyBinding: "wcs/key-binding",
|
|
467
489
|
// 書き戻すときに変換しない双方向の `value:` が、state が数値で持つパス(種・JSDoc の `@type`・stateSchema)を指す。
|
|
468
490
|
// 要素の `value` は文字列なので、5 と入力した後の state は `"5"` で、`count + 1` は `"51"` になる。ランタイムは何も
|
|
469
491
|
// 言わない(ekiden-entry — 弁当 1 個と 2 個が 12 個になった)。数値にする入力フィルタ(`value|number:`)・
|
|
@@ -652,6 +674,9 @@ function didYouMean(input, candidates) {
|
|
|
652
674
|
if (input.length === 0) {
|
|
653
675
|
return "";
|
|
654
676
|
}
|
|
677
|
+
if (/[\s!?=<>+('"`&]/.test(input)) {
|
|
678
|
+
return " An expression is not a path: use a filter (|not, |eq(x), |gt(n)) or a getter.";
|
|
679
|
+
}
|
|
655
680
|
const folded = input.toLowerCase();
|
|
656
681
|
let best = null;
|
|
657
682
|
let bestDistance = 3;
|
|
@@ -2662,7 +2687,7 @@ function getWcsManifest() {
|
|
|
2662
2687
|
}
|
|
2663
2688
|
|
|
2664
2689
|
// ../state/package.json
|
|
2665
|
-
var version = "4.
|
|
2690
|
+
var version = "4.31.0";
|
|
2666
2691
|
|
|
2667
2692
|
// src/service/wcsManifest.ts
|
|
2668
2693
|
var ENGINE_VERSION = version;
|
|
@@ -2748,9 +2773,9 @@ function missingSegment(path, tree) {
|
|
|
2748
2773
|
}
|
|
2749
2774
|
return null;
|
|
2750
2775
|
}
|
|
2751
|
-
function
|
|
2776
|
+
function pathSuggestion(path, candidates, msgs) {
|
|
2752
2777
|
const missing = missingSegment(path, pathTree(candidates));
|
|
2753
|
-
if (missing === null
|
|
2778
|
+
if (missing === null) return "";
|
|
2754
2779
|
return suggestion(missing.segment, missing.names, msgs);
|
|
2755
2780
|
}
|
|
2756
2781
|
function suggestion(input, candidates, msgs) {
|
|
@@ -13343,6 +13368,12 @@ function shortSeed(raw) {
|
|
|
13343
13368
|
return flat.length <= 32 ? flat : `${flat.slice(0, 29)}\u2026`;
|
|
13344
13369
|
}
|
|
13345
13370
|
var MAX_LISTED_KEYS = 10;
|
|
13371
|
+
function collectionFix(key, method, kind) {
|
|
13372
|
+
const k = `this.${key}`;
|
|
13373
|
+
if (method === "clear") return `${k} = new ${kind}()`;
|
|
13374
|
+
if (kind === "Set") return method === "add" ? `${k} = new Set([...${k}, id])` : `${k} = new Set([...${k}].filter((x) => x !== id))`;
|
|
13375
|
+
return method === "set" ? `${k} = new Map([...${k}, [key, value]])` : `${k} = new Map([...${k}].filter(([k]) => k !== key))`;
|
|
13376
|
+
}
|
|
13346
13377
|
function listKeys(keys) {
|
|
13347
13378
|
return keys.length <= MAX_LISTED_KEYS ? keys.join(", ") : `${keys.slice(0, MAX_LISTED_KEYS).join(", ")} \u2026 (+${keys.length - MAX_LISTED_KEYS})`;
|
|
13348
13379
|
}
|
|
@@ -13430,11 +13461,21 @@ var ja = {
|
|
|
13430
13461
|
objectKeyAssign: (t, acc, sp) => `"${t}" \u306E\u30AD\u30FC\u306B\u305D\u306E\u5834\u3067\u4EE3\u5165\u3057\u3066\u3044\u307E\u3059\u3002state \u306F\u3053\u306E\u66F8\u304D\u8FBC\u307F\u3092\u898B\u306A\u3044\u306E\u3067\u3001\u305D\u308C\u3092\u8AAD\u3080\u675F\u7E1B\u30FBgetter\u30FB$watch \u306F\u5909\u308F\u3089\u305A\u3001\u4F55\u3082\u63CF\u304D\u76F4\u3055\u308C\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u4EE3\u5165\u3059\u308B\uFF08${acc} = { ...${acc}, [key]: value }\uFF09\u304B\u3001\u30C9\u30C3\u30C8\u30D1\u30B9\u3067\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF08this["${sp}"] = \u2026\uFF09`,
|
|
13431
13462
|
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`,
|
|
13432
13463
|
getterUntrackedReadBound: (root, sp, binding, tag, written) => `\u3053\u3053\u3067\u8FFD\u8DE1\u3055\u308C\u308B\u306E\u306F "${root}" \u3060\u3051\u3067\u3059\u304C\u3001<${tag}> \u306E\u675F\u7E1B "${binding}" \u306F "${written}" \u3092\u30D1\u30B9\u3067\u66F8\u304D\u307E\u3059\u3002\u305D\u306E\u66F8\u304D\u8FBC\u307F\u306F\u3053\u306E getter \u306B\u5C4A\u304B\u305A\u3001getter \u306F\u524D\u306B\u8A08\u7B97\u3057\u305F\u5024\u3092\u8FD4\u3057\u7D9A\u3051\u307E\u3059\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`,
|
|
13464
|
+
getterRowFieldRead: (list, fieldPath, written, binding, tag) => `\u3053\u306E getter \u306F\u4E00\u89A7 "${list}" \u3092\u8AAD\u307F\u3001\u884C\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304B\u3089\u9805\u76EE\u3092\u8AAD\u3093\u3067\u3044\u307E\u3059\u3002\u8FFD\u8DE1\u3055\u308C\u308B\u306E\u306F "${list}" \u3060\u3051\u3067\u3001${binding !== null ? `<${tag}> \u306E\u675F\u7E1B "${binding}" \u306F` : "\u30DA\u30FC\u30B8\u306F"} "${written}" \u3092\u30D1\u30B9\u3067\u66F8\u304D\u307E\u3059\u3002\u305D\u306E\u66F8\u304D\u8FBC\u307F\u306F\u3053\u306E getter \u306B\u5C4A\u304B\u305A\u3001\u884C\u306E\u8FFD\u52A0\u3068\u524A\u9664\u3067\u306F\u6B63\u3057\u304F\u898B\u3048\u3066\u3082\u3001\u884C\u306E\u5024\u3092\u5909\u3048\u308B\u3068\u524D\u306B\u8A08\u7B97\u3057\u305F\u5024\u306E\u307E\u307E\u3067\u3059\u3002\u884C\u306E\u9805\u76EE\u306F\u30D1\u30B9\u3067\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044: this.$getAll("${fieldPath}", [])`,
|
|
13433
13465
|
handlerFilterNotAllowed: (prop) => `\u30A4\u30D9\u30F3\u30C8\u30CF\u30F3\u30C9\u30E9 "${prop}" \u306B\u30D5\u30A3\u30EB\u30BF\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093`,
|
|
13434
13466
|
typeExpectation: (label, expected, resultType) => `"${label}" \u306B\u306F${JA_EXPECTED_LABEL[expected]}\u304C\u5FC5\u8981\u3067\u3059\uFF08\u73FE\u5728\u306E\u578B: ${resultType}\uFF09`,
|
|
13435
13467
|
attrBooleanPresence: (a, p, rhs) => `"attr.${a}" \u306B boolean \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u3002attr.* \u306F String(value) \u3092\u66F8\u304F\u306E\u3067\u3001false \u306E\u3068\u304D ${a}="false" \u306B\u306A\u308A\u307E\u3059\u3002\u8AD6\u7406\u5C5E\u6027\u306F\u5024\u306B\u95A2\u4FC2\u306A\u304F\u3001\u5728\u308B\u3060\u3051\u3067\u52B9\u304D\u307E\u3059: ${a}="false" \u3067\u3082 ${a} \u306E\u307E\u307E\u3067\u3059\uFF08\u5C5E\u6027\u3092\u5916\u3059\u306E\u306F null / undefined \u3060\u3051\uFF09\u3002\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044: ${p}: ${rhs}`,
|
|
13436
13468
|
attrBooleanText: (a, rhs) => `"attr.${a}" \u306B boolean \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u3002attr.* \u306F String(value) \u3092\u66F8\u304F\u306E\u3067\u3001\u5C5E\u6027\u306F "true" \u304B "false" \u306B\u306A\u308A\u3001\u5916\u308C\u308B\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u5916\u3059\u306E\u306F null / undefined \u3060\u3051\uFF09\u3002\u5C5E\u6027\u306E\u6709\u7121\u3092\u898B\u308B\u5074\uFF08CSS \u306E [${a}]\u30FBhasAttribute()\uFF09\u306B\u306F\u3001\u3069\u3061\u3089\u3067\u3082\u5728\u308A\u307E\u3059\u3002false \u306E\u9593\u306F\u5916\u3059\u306A\u3089 attr.${a}: ${rhs}|defaults(null)\u3001\u6587\u5B57\u306E "true" / "false" \u304C\u610F\u56F3\u306A\u3089 attr.${a}: ${rhs}|string \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
|
|
13437
13469
|
radioBeforeValue: (binding, value, checkbox, fix) => `\u300C${binding}:\u300D\u304C\u3001\u3053\u306E${checkbox ? "\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9" : "\u30E9\u30B8\u30AA"}\u306B\u5024\u3092\u4E0E\u3048\u308B\u300C${value}:\u300D\u3088\u308A\u524D\u306B\u66F8\u304B\u308C\u3066\u3044\u307E\u3059\u3002\u675F\u7E1B\u306F\u66F8\u3044\u305F\u9806\u306B\u5F53\u305F\u308B\u306E\u3067\u3001\u5024\u304C\u307E\u3060\u30D6\u30E9\u30A6\u30B6\u306E\u65E2\u5B9A\u306E "on" \u306E\u3046\u3061\u306B\u6BD4\u3079\u3089\u308C\u3001\u6700\u521D\u306E\u63CF\u753B\u3067\u306F\u4F55\u3082\u30C1\u30A7\u30C3\u30AF\u3055\u308C\u307E\u305B\u3093\uFF08\u4F55\u3082\u77E5\u3089\u305B\u307E\u305B\u3093\u3002\u5F8C\u304B\u3089 state \u306B\u66F8\u304F\u3068\u6B63\u3057\u3044\u3082\u306E\u304C\u30C1\u30A7\u30C3\u30AF\u3055\u308C\u307E\u3059\uFF09\u3002\u5024\u3092\u5148\u306B\u66F8\u3044\u3066\u304F\u3060\u3055\u3044: ${fix}`,
|
|
13470
|
+
bindingExpression: (expression, fix) => `\u675F\u7E1B\u306E\u53F3\u8FBA\u306F\u30D1\u30B9\u3068\u30D5\u30A3\u30EB\u30BF\u3067\u3001\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093: "${expression}" \u306F\u8A55\u4FA1\u3055\u308C\u305A\u3001\u305D\u306E\u540D\u524D\u306E\u30D1\u30B9\u3068\u3057\u3066\u5F15\u304B\u308C\u307E\u3059\u3002${fix !== null ? `${fix} \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044` : "\u305D\u306E\u5024\u3092\u8A08\u7B97\u3059\u308B getter \u3092 state \u306B\u66F8\u304D\u3001getter \u306E\u540D\u524D\u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044"}`,
|
|
13471
|
+
handlerExpression: (property, expression, method) => `\u30A4\u30D9\u30F3\u30C8\u306E\u675F\u7E1B\u306E\u53F3\u8FBA\u306F\u30E1\u30BD\u30C3\u30C9\u306E\u540D\u524D\u3067\u3001\u547C\u3073\u51FA\u3057\u3084\u95A2\u6570\u3067\u306F\u3042\u308A\u307E\u305B\u3093: "${expression}" \u306F\u8A55\u4FA1\u3055\u308C\u307E\u305B\u3093\u3002${method !== null ? `"${property}: ${method}" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044` : "\u30E1\u30BD\u30C3\u30C9\u306E\u540D\u524D\u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044"}\u3002\u30CF\u30F3\u30C9\u30E9\u306F (event, ...\u30EB\u30FC\u30D7\u306E\u6DFB\u5B57) \u3067\u547C\u3070\u308C\u308B\u306E\u3067\u3001\u884C\u306E\u5024\u306F\u30E1\u30BD\u30C3\u30C9\u306E\u4E2D\u3067\u6DFB\u5B57\u304B\u3089\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044`,
|
|
13472
|
+
attributeMustache: (name) => `{{ }} \u306F\u30C6\u30AD\u30B9\u30C8\u306E\u4E2D\u3067\u3057\u304B\u8AAD\u307E\u308C\u307E\u305B\u3093\u3002\u5C5E\u6027 "${name}" \u306E\u4E2D\u3067\u306F\u66F8\u3044\u305F\u307E\u307E\u6B8B\u308A\u307E\u3059\u3002\u5C5E\u6027\u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044\uFF08attr.${name}: <\u30D1\u30B9>\u3002\u6587\u5B57\u5217\u3092\u7D44\u307F\u7ACB\u3066\u308B getter \u3092\u66F8\u3044\u3066\uFF09\u3002\u30DA\u30FC\u30B8\u3092\u8FD4\u3059\u524D\u306B\u30B5\u30FC\u30D0\u30FC\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u57CB\u3081\u308B\u306E\u306A\u3089\u3001\u3053\u306E\u307E\u307E\u3067\u6B63\u3057\u3044\u66F8\u304D\u65B9\u3067\u3059`,
|
|
13473
|
+
structuralElement: (directive, tagName) => `"${directive}:" \u306F <template> \u306E\u4E0A\u3067\u3060\u3051\u50CD\u304D\u307E\u3059\u3002<${tagName}> \u306E\u4E0A\u3067\u306F\u30E9\u30F3\u30BF\u30A4\u30E0\u306F "${directive}" \u3068\u3044\u3046\u540D\u524D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u66F8\u304F\u3060\u3051\u3067\u3001${directive === "for" ? "\u8981\u7D20\u306F\u884C\u3054\u3068\u3067\u306F\u306A\u304F 1 \u3064\u3060\u3051\u63CF\u304B\u308C\u307E\u3059" : "\u8981\u7D20\u306F\u5E38\u306B\u8868\u793A\u3055\u308C\u307E\u3059"}\u3002\u8981\u7D20\u3092 <template data-wcs="${directive === "else" ? "else:" : `${directive}: \u2026`}"> \u306E\u4E2D\u306B\u5165\u308C\u3066\u304F\u3060\u3055\u3044`,
|
|
13474
|
+
collectionMutation: (key, method, kind) => `"this.${key}.${method}(\u2026)" \u306F state \u306E ${kind} \u3092\u305D\u306E\u5834\u3067\u5909\u3048\u307E\u3059\u3002state \u306F\u305D\u308C\u3092\u898B\u306A\u3044\u306E\u3067\u3001"${key}" \u306B\u675F\u306D\u305F\u3082\u306E\u3082\u3001\u305D\u308C\u3092\u8AAD\u3080 getter \u3082\u66F4\u65B0\u3055\u308C\u307E\u305B\u3093\uFF08\u4F55\u3082\u77E5\u3089\u305B\u307E\u305B\u3093\uFF09\u3002\u65B0\u3057\u3044 ${kind} \u3092\u4EE3\u5165\u3059\u308B\uFF08${collectionFix(key, method, kind)}\uFF09\u304B\u3001\u914D\u5217 / \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6301\u3063\u3066\u304F\u3060\u3055\u3044`,
|
|
13475
|
+
rowIdShared: (id) => `for: \u306E\u3059\u3079\u3066\u306E\u884C\u304C id="${id}" \u306B\u306A\u308A\u307E\u3059\u3002id \u306F 1 \u3064\u306E\u8981\u7D20\u306E\u3082\u306E\u3067\u3001\u305D\u308C\u3092\u540D\u6307\u3059 <label for> \u3084 aria-labelledby \u306F\u6700\u521D\u306E\u884C\u306B\u3057\u304B\u5C4A\u304D\u307E\u305B\u3093\u3002id \u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044\uFF08attr.id: .domId \u2014 \u884C\u306E\u30AD\u30FC\u304B\u3089\u7D44\u307F\u7ACB\u3066\u308B\u884C\u306E getter \u3092\u66F8\u3044\u3066\uFF09`,
|
|
13476
|
+
eventNameCase: (property, lower2) => `"${property}:" \u306F "${property.slice(2)}" \u3068\u3044\u3046\u540D\u524D\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u805E\u304D\u307E\u3059\u304C\u3001\u305D\u308C\u3092\u9001\u308B\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093 \u2014 DOM \u306E\u30A4\u30D9\u30F3\u30C8\u540D\u306F\u5C0F\u6587\u5B57\u3067\u3059\u3002DOM \u306E\u30A4\u30D9\u30F3\u30C8\u306A\u3089 "${lower2}:" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002\u90E8\u54C1\u306E\u30B3\u30FC\u30EB\u30D0\u30C3\u30AF\uFF08"prop"\uFF09\u306F\u90E8\u54C1\u304C\u9001\u308B\u30A4\u30D9\u30F3\u30C8\u3067\u3001eventToken.<\u30E1\u30F3\u30D0\u30FC>: \u3067\u675F\u306D\u307E\u3059`,
|
|
13477
|
+
inlineImport: (specifier, guard) => `\u30A4\u30F3\u30E9\u30A4\u30F3\u306E ${guard ? "<wcs-guard-handler>" : "<wcs-state>"} \u306E\u30B9\u30AF\u30EA\u30D7\u30C8\u306F blob: URL \u304B\u3089\u8A55\u4FA1\u3055\u308C\u308B\u306E\u3067\u3001"${specifier}" \u306F\u89E3\u6C7A\u3057\u307E\u305B\u3093\uFF08${guard ? "\u30AC\u30FC\u30C9\u306F" : "state \u306F"}\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3059\uFF09\u3002${guard ? "\u5B8C\u5168\u306A URL \u304B\u3001\u30DA\u30FC\u30B8\u306E import map \u304C\u4E0E\u3048\u308B\u540D\u524D\u3092 import \u3057\u3066\u304F\u3060\u3055\u3044" : '\u5B8C\u5168\u306A URL \u304B\u3001\u30DA\u30FC\u30B8\u306E import map \u304C\u4E0E\u3048\u308B\u540D\u524D\u3092 import \u3059\u308B\u304B\u3001state \u3092\u30D5\u30A1\u30A4\u30EB\u306B\u79FB\u3057\u3066\u304F\u3060\u3055\u3044\uFF08src="./state.js"\uFF09'}`,
|
|
13478
|
+
keyBinding: () => `"key:" \u306F "key" \u3068\u3044\u3046\u540D\u524D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u66F8\u304F\u3060\u3051\u3067\u3001\u307B\u304B\u306B\u4F55\u3082\u3057\u307E\u305B\u3093\u3002key \u306F\u8981\u308A\u307E\u305B\u3093 \u2014 \u884C\u306F\u884C\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u7A81\u304D\u5408\u308F\u3055\u308C\u3001\u53D6\u308A\u76F4\u3057\u305F\u30C7\u30FC\u30BF\u3067\u884C\u3092\u4FDD\u3064\u306E\u306F $listKeys \u3067\u3059`,
|
|
13438
13479
|
radioNameShared: (name, binding) => `\u884C\u3054\u3068\u306E\u30E9\u30B8\u30AA\u304C\u3059\u3079\u3066 name="${name}" \u306B\u306A\u308B\u306E\u3067\u3001\u30D6\u30E9\u30A6\u30B6\u306F\u5168\u90E8\u306E\u884C\u306E\u30E9\u30B8\u30AA\u3092 1 \u3064\u306E\u30B0\u30EB\u30FC\u30D7\u306B\u3057\u307E\u3059\u3002\u30DA\u30FC\u30B8\u5168\u4F53\u3067 1 \u3064\u3057\u304B\u9078\u3070\u308C\u305F\u72B6\u614B\u306B\u306A\u3089\u305A\u3001\u8868\u793A\u306F\u6700\u521D\u306E\u63CF\u753B\u304B\u3089\u884C\u3054\u3068\u306E\u5024\u3068\u98DF\u3044\u9055\u3044\u307E\u3059\uFF08\u4F55\u3082\u77E5\u3089\u305B\u307E\u305B\u3093\uFF09\u3002${binding === "radio" ? "\u884C\u3054\u3068\u306B\u9055\u3046 name \u3092\u675F\u306D\u308B\uFF08attr.name: .<\u884C\u3054\u3068\u306B\u9055\u3046\u30D5\u30A3\u30FC\u30EB\u30C9>\uFF09\u304B\u3001name \u3092\u5916\u3057\u3066\u304F\u3060\u3055\u3044\uFF08radio: \u306F name \u304C\u7121\u304F\u3066\u3082\u3001\u540C\u3058\u30D1\u30B9\u306B\u675F\u306D\u305F\u30E9\u30B8\u30AA\u3092\u9078\u629E\u306B\u5408\u308F\u305B\u307E\u3059\uFF09" : "\u884C\u3054\u3068\u306B\u9055\u3046 name \u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044\uFF08attr.name: .<\u884C\u3054\u3068\u306B\u9055\u3046\u30D5\u30A3\u30FC\u30EB\u30C9>\uFF09\u3002\u884C\u3092\u307E\u305F\u3044\u3067 1 \u3064\u3092\u9078\u3070\u305B\u308B\u306A\u3089\u3001\u5168\u90E8\u3092 1 \u3064\u306E\u30D1\u30B9\u306B\u675F\u306D\u307E\u3059\uFF08value: .<\u884C\u306E id>; radio: <\u30D1\u30B9>\uFF09"}`,
|
|
13439
13480
|
numberWrittenAsString: (path, left, asNumber) => `"${path}" \u306F state \u3067\u306F\u6570\u5024\u3067\u3059\u304C\u3001value: \u304C\u66F8\u304D\u623B\u3059\u306E\u306F\u8981\u7D20\u306E\u6301\u3064\u6587\u5B57\u5217\u3067\u3059\u30025 \u3068\u5165\u529B\u3057\u305F\u5F8C\u306E state \u306F "5" \u3067\u3001"5" + 1 \u306F "51" \u306B\u306A\u308A\u307E\u3059\uFF08\u4F55\u3082\u77E5\u3089\u305B\u307E\u305B\u3093\uFF09\u3002\u66F8\u304D\u623B\u3059\u3068\u304D\u306B\u6570\u5024\u306B\u3057\u3066\u304F\u3060\u3055\u3044: ${asNumber ? `valueAsNumber: ${path}\u3001\u307E\u305F\u306F` : ""}\u5DE6\u8FBA\u306E\u5165\u529B\u30D5\u30A3\u30EB\u30BF ${left}|number: ${path}\uFF08|int\u30FB|float \u3082\uFF09`,
|
|
13440
13481
|
twoWayOutputFilter: (prop, filters, left, rhs, keystroke) => keystroke ? `${prop}: \u306F\u53CC\u65B9\u5411\u3067 1 \u6253\u9375\u3054\u3068\u306B\u66F8\u304D\u623B\u3057\u3001\u51FA\u529B\u30D5\u30A3\u30EB\u30BF "${filters}" \u306F\u305D\u306E\u305F\u3073\u306B state \u306E\u5024\u3092\u6574\u5F62\u3057\u3066\u6B04\u3078\u66F8\u304D\u76F4\u3057\u307E\u3059\u3002\u5165\u529B\u4E2D\u306E\u6B04\u304C\u66F8\u304D\u63DB\u308F\u308A\uFF08\u30AD\u30E3\u30EC\u30C3\u30C8\u306F\u672B\u5C3E\u3078\u98DB\u3073\u3001IME \u306E\u5909\u63DB\u306F\u9014\u5207\u308C\u307E\u3059\uFF09\u3001state \u304C\u53D7\u3051\u53D6\u308B\u306E\u3082\u6B04\u306E\u6574\u5F62\u6E08\u307F\u306E\u6587\u5B57\u3067\u3059\uFF08\u51FA\u529B\u30D5\u30A3\u30EB\u30BF\u306F\u66F8\u304D\u623B\u3057\u3067\u5143\u306B\u623B\u308A\u307E\u305B\u3093\uFF09\u3002\u6574\u5F62\u3057\u305F\u6587\u5B57\u306F\u5225\u306E\u8981\u7D20\u306B\u8868\u793A\u3059\u308B\u3001\u6B04\u306E\u78BA\u5B9A\u3067\u66F8\u304D\u623B\u3057\u3066 setter \u3067\u6574\u5F62\u3059\u308B\uFF08${prop}#onchange:\uFF09\u3001\u307E\u305F\u306F\u4E00\u65B9\u5411\u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${prop}#ro: ${rhs}\uFF09` : `${prop}: \u306F\u53CC\u65B9\u5411\u3067\u3059\u304C\u3001\u51FA\u529B\u30D5\u30A3\u30EB\u30BF "${filters}" \u306F\u66F8\u304D\u623B\u3057\u3067\u5143\u306B\u623B\u308A\u307E\u305B\u3093\u3002\u8981\u7D20\u304C\u66F8\u304D\u623B\u3059\u306E\u306F\u8868\u793A\u3057\u3066\u3044\u308B\u6574\u5F62\u6E08\u307F\u306E\u5024\u3067\u3001\u6B21\u306F\u305D\u306E\u5024\u306B\u30D5\u30A3\u30EB\u30BF\u304C\u639B\u304B\u308A\u307E\u3059\u3002\u5DE6\u8FBA\u306E\u5165\u529B\u30D5\u30A3\u30EB\u30BF\u3067\u5143\u306B\u623B\u3059\uFF08${left}|<\u30D5\u30A3\u30EB\u30BF>: \u2026\uFF09\u3001\u6574\u5F62\u3057\u305F\u5024\u306F\u5225\u306E\u8981\u7D20\u306B\u8868\u793A\u3059\u308B\u3001\u307E\u305F\u306F\u4E00\u65B9\u5411\u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${prop}#ro: ${rhs}\uFF09`,
|
|
@@ -13721,11 +13762,21 @@ var en = {
|
|
|
13721
13762
|
objectKeyAssign: (t, acc, sp) => `This assigns a key of "${t}" in place. The state does not see the write, so no binding, getter or $watch that reads it changes, and nothing is rendered again. Assign a new object (${acc} = { ...${acc}, [key]: value }), or write the dot path this["${sp}"] = \u2026`,
|
|
13722
13763
|
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`,
|
|
13723
13764
|
getterUntrackedReadBound: (root, sp, binding, tag, written) => `Only "${root}" is tracked here, but the binding "${binding}" on <${tag}> writes "${written}" by path: that write never reaches this getter, which keeps returning the value it last computed (plain property access after a path read is not tracked). Read this["${sp}"] instead`,
|
|
13765
|
+
getterRowFieldRead: (list, fieldPath, written, binding, tag) => `This getter reads the list "${list}" and a field from its row objects. Only "${list}" is tracked, and ${binding !== null ? `the binding "${binding}" on <${tag}>` : "the page"} writes "${written}" by path: that write never reaches this getter, which looks right when rows are added or removed and keeps its last value when a row's value changes. Read the rows' fields by path: this.$getAll("${fieldPath}", [])`,
|
|
13724
13766
|
handlerFilterNotAllowed: (prop) => `Filters cannot be applied to event handler "${prop}"`,
|
|
13725
13767
|
typeExpectation: (label, expected, resultType) => `"${label}" requires ${EN_EXPECTED_LABEL[expected]} (current type: ${resultType})`,
|
|
13726
13768
|
attrBooleanPresence: (a, p, rhs) => `"attr.${a}" is given a boolean. attr.* writes String(value), so false is written as ${a}="false" \u2014 and a boolean attribute is on whenever it is present, whatever its value: ${a}="false" still means ${a} (only null / undefined remove an attribute). Bind the property instead: ${p}: ${rhs}`,
|
|
13727
13769
|
attrBooleanText: (a, rhs) => `"attr.${a}" is given a boolean. attr.* writes String(value), so the attribute is "true" or "false" and is never removed (only null / undefined remove it): whatever tests its presence \u2014 [${a}] in CSS, hasAttribute() \u2014 finds it either way. To remove it while false, write attr.${a}: ${rhs}|defaults(null); if the text "true" / "false" is what is meant, say so: attr.${a}: ${rhs}|string`,
|
|
13728
13770
|
radioBeforeValue: (binding, value, checkbox, fix) => `"${binding}:" is written before "${value}:", which gives this ${checkbox ? "checkbox" : "radio"} its value. Bindings are applied in the order written, so it is compared while its value is still the browser's default "on": nothing is checked at the first render \u2014 nothing says so, and a later write of the state checks the right one. Write the value first: ${fix}`,
|
|
13771
|
+
bindingExpression: (expression, fix) => `A binding takes a path and filters, not an expression: "${expression}" is not evaluated, it is looked up as a path of that name. ${fix !== null ? `Write ${fix}` : "Write a getter in the state that computes the value, and bind the getter's name"}`,
|
|
13772
|
+
handlerExpression: (property, expression, method) => `An event binding names a method, not a call or a function: "${expression}" is not evaluated. ${method !== null ? `Write "${property}: ${method}"` : "Write the method's name"}; the handler is called with (event, ...loopIndexes), so read the row's values in the method through the loop index`,
|
|
13773
|
+
attributeMustache: (name) => `{{ }} is read in text only: in the attribute "${name}" it stays as written. Bind the attribute (attr.${name}: <path>, with a getter that builds the string) \u2014 a server-side template that fills it before the page is served is fine`,
|
|
13774
|
+
structuralElement: (directive, tagName) => `"${directive}:" works on a <template> only: on <${tagName}> the runtime sets a property named "${directive}" and does nothing else \u2014 ${directive === "for" ? "the element is drawn once, not once per row" : "the element is always shown"}. Put the element inside <template data-wcs="${directive === "else" ? "else:" : `${directive}: \u2026`}">`,
|
|
13775
|
+
collectionMutation: (key, method, kind) => `"this.${key}.${method}(\u2026)" changes the state's ${kind} in place: the state does not see it, so nothing bound to "${key}" and no getter that reads it is updated \u2014 nothing says so. Assign a new ${kind} (${collectionFix(key, method, kind)}), or keep an array / an object`,
|
|
13776
|
+
rowIdShared: (id) => `Every row of the for: gets id="${id}": an id belongs to one element, so a <label for> or aria-labelledby that names it reaches the first row only. Bind it (attr.id: .domId, with a row getter that builds it from the row's key)`,
|
|
13777
|
+
eventNameCase: (property, lower2) => `"${property}:" listens for an event named "${property.slice(2)}", which nothing dispatches \u2014 DOM event names are lower case. Write "${lower2}:" for the DOM event; a callback "prop" of a part is an event the part dispatches, bound with eventToken.<member>:`,
|
|
13778
|
+
inlineImport: (specifier, guard) => `An inline ${guard ? "<wcs-guard-handler>" : "<wcs-state>"} script is evaluated from a blob: URL, against which "${specifier}" does not resolve: the ${guard ? "guard" : "state"} fails to load. Import a full URL or a name the page's import map gives${guard ? "" : ', or move the state into a file (src="./state.js")'}`,
|
|
13779
|
+
keyBinding: () => `"key:" sets a property named "key" and does nothing else. No key is needed: rows are matched by the row object, and $listKeys keeps rows across refetched data`,
|
|
13729
13780
|
radioNameShared: (name, binding) => `Every row's radios get name="${name}", so the browser makes one group of all the rows: only one radio on the whole page stays checked, and the page disagrees with the rows' values from the first render \u2014 nothing says so. ${binding === "radio" ? "Bind a name that differs per row (attr.name: .<a row field>), or drop the name: radio: keeps the radios bound to one path in step without it" : "Bind a name that differs per row (attr.name: .<a row field>) \u2014 or, for one choice over all the rows, bind them all to one path: value: .<the row's id>; radio: <path>"}`,
|
|
13730
13781
|
numberWrittenAsString: (path, left, asNumber) => `"${path}" is a number in the state, but value: writes back what the element holds, a string: after the user enters 5 the state has "5", and "5" + 1 is "51" \u2014 nothing says so. Convert it on the way in: ${asNumber ? `valueAsNumber: ${path}, or ` : ""}an input filter on the left side, ${left}|number: ${path} (also |int, |float)`,
|
|
13731
13782
|
twoWayOutputFilter: (prop, filters, left, rhs, keystroke) => keystroke ? `${prop}: is two-way and writes back on every keystroke, and the output filter "${filters}" formats what the state holds each time: the field is rewritten while the user types \u2014 the caret jumps to the end, an IME composition is cut \u2014 and what the state receives is the field's formatted text (an output filter is not undone on the way back). Show the formatted text in another element, write back when the field is committed and format in a setter (${prop}#onchange:), or make the binding one-way: ${prop}#ro: ${rhs}` : `${prop}: is two-way, and nothing undoes the output filter "${filters}" on the way back: the element writes back the formatted value it shows, and the filter is then applied to that. Undo it with an input filter on the left side (${left}|<filter>: \u2026), show the formatted value in another element, or make the binding one-way: ${prop}#ro: ${rhs}`,
|
|
@@ -16081,6 +16132,122 @@ function findLocationRead(body) {
|
|
|
16081
16132
|
walk2(wrapper.body);
|
|
16082
16133
|
return found;
|
|
16083
16134
|
}
|
|
16135
|
+
var ROW_CALLBACKS = /* @__PURE__ */ new Map([
|
|
16136
|
+
["reduce", [1]],
|
|
16137
|
+
["reduceRight", [1]],
|
|
16138
|
+
["map", [0]],
|
|
16139
|
+
["flatMap", [0]],
|
|
16140
|
+
["filter", [0]],
|
|
16141
|
+
["find", [0]],
|
|
16142
|
+
["findIndex", [0]],
|
|
16143
|
+
["findLast", [0]],
|
|
16144
|
+
["findLastIndex", [0]],
|
|
16145
|
+
["some", [0]],
|
|
16146
|
+
["every", [0]],
|
|
16147
|
+
["forEach", [0]],
|
|
16148
|
+
["sort", [0, 1]],
|
|
16149
|
+
["toSorted", [0, 1]]
|
|
16150
|
+
]);
|
|
16151
|
+
var ROW_PRESERVING = /* @__PURE__ */ new Set(["filter", "slice", "sort", "toSorted", "reverse", "toReversed", "toSpliced", "concat"]);
|
|
16152
|
+
function findRowFieldReads(body) {
|
|
16153
|
+
let program;
|
|
16154
|
+
try {
|
|
16155
|
+
program = parseErasingTypes(PREFIX + body + SUFFIX, { ecmaVersion: "latest", sourceType: "module" });
|
|
16156
|
+
} catch {
|
|
16157
|
+
return null;
|
|
16158
|
+
}
|
|
16159
|
+
const wrapper = unwrapWrapper(program);
|
|
16160
|
+
if (wrapper === null) return null;
|
|
16161
|
+
const out = [];
|
|
16162
|
+
const listOf = (node) => {
|
|
16163
|
+
const n = unwrapChain(node);
|
|
16164
|
+
if (n.type === "MemberExpression" && n.object.type === "ThisExpression") {
|
|
16165
|
+
const key = !n.computed && n.property.type === "Identifier" ? n.property.name : literalString2(n.property);
|
|
16166
|
+
return key !== null && key !== "" && !key.startsWith("$") ? key : null;
|
|
16167
|
+
}
|
|
16168
|
+
if (n.type === "CallExpression") {
|
|
16169
|
+
const callee = unwrapChain(n.callee);
|
|
16170
|
+
if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" && ROW_PRESERVING.has(callee.property.name)) return listOf(callee.object);
|
|
16171
|
+
}
|
|
16172
|
+
if (n.type === "ArrayExpression" && n.elements.length === 1 && n.elements[0]?.type === "SpreadElement") {
|
|
16173
|
+
return listOf(n.elements[0].argument);
|
|
16174
|
+
}
|
|
16175
|
+
return null;
|
|
16176
|
+
};
|
|
16177
|
+
const readsOf = (list, name, node) => {
|
|
16178
|
+
const walk3 = (n) => {
|
|
16179
|
+
if (isFunctionNode(n)) {
|
|
16180
|
+
const bound = /* @__PURE__ */ new Set();
|
|
16181
|
+
for (const param of n.params) bindingNames(param, bound);
|
|
16182
|
+
if (bound.has(name)) return;
|
|
16183
|
+
}
|
|
16184
|
+
if (n.type === "AssignmentExpression" || n.type === "UpdateExpression") {
|
|
16185
|
+
const target = n.type === "AssignmentExpression" ? n.left : n.argument;
|
|
16186
|
+
if (unwrapChain(target).type === "MemberExpression") {
|
|
16187
|
+
if (n.type === "AssignmentExpression") walk3(n.right);
|
|
16188
|
+
return;
|
|
16189
|
+
}
|
|
16190
|
+
}
|
|
16191
|
+
if (n.type === "MemberExpression" || n.type === "ChainExpression" || n.type === "CallExpression") {
|
|
16192
|
+
const call = n.type === "CallExpression" ? n : null;
|
|
16193
|
+
const { segments, base } = resolveChain(call !== null ? call.callee : n);
|
|
16194
|
+
if (base.type === "Identifier" && base.name === name && segments.length > 0) {
|
|
16195
|
+
const fields = [];
|
|
16196
|
+
for (const segment of segments) {
|
|
16197
|
+
if (segment.text === null || segment.dynamic !== null) break;
|
|
16198
|
+
fields.push(segment.text);
|
|
16199
|
+
}
|
|
16200
|
+
if (call !== null && fields.length === segments.length) fields.pop();
|
|
16201
|
+
if (fields.length > 0) out.push({ list, fields, start: n.start - PREFIX.length, end: n.end - PREFIX.length });
|
|
16202
|
+
if (call !== null) for (const arg of call.arguments) walk3(arg);
|
|
16203
|
+
return;
|
|
16204
|
+
}
|
|
16205
|
+
}
|
|
16206
|
+
forEachChild(n, walk3);
|
|
16207
|
+
};
|
|
16208
|
+
walk3(node);
|
|
16209
|
+
};
|
|
16210
|
+
const rowParam = (list, param, body2) => {
|
|
16211
|
+
if (param === void 0) return;
|
|
16212
|
+
const p = param.type === "AssignmentPattern" ? param.left : param;
|
|
16213
|
+
if (p.type === "Identifier") {
|
|
16214
|
+
readsOf(list, p.name, body2);
|
|
16215
|
+
return;
|
|
16216
|
+
}
|
|
16217
|
+
if (p.type !== "ObjectPattern") return;
|
|
16218
|
+
for (const property of p.properties) {
|
|
16219
|
+
if (property.type !== "Property") continue;
|
|
16220
|
+
const key = !property.computed && property.key.type === "Identifier" ? property.key.name : literalString2(property.key);
|
|
16221
|
+
if (key !== null) out.push({ list, fields: [key], start: property.key.start - PREFIX.length, end: property.key.end - PREFIX.length });
|
|
16222
|
+
}
|
|
16223
|
+
};
|
|
16224
|
+
const walk2 = (node, thisIsState) => {
|
|
16225
|
+
if (isFunctionNode(node) && node.type !== "ArrowFunctionExpression") {
|
|
16226
|
+
forEachChild(node, (child) => walk2(child, false));
|
|
16227
|
+
return;
|
|
16228
|
+
}
|
|
16229
|
+
if (isClassNode(node)) return;
|
|
16230
|
+
if (thisIsState && node.type === "CallExpression") {
|
|
16231
|
+
const callee = unwrapChain(node.callee);
|
|
16232
|
+
const method = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" ? callee.property.name : null;
|
|
16233
|
+
const rows = method === null ? void 0 : ROW_CALLBACKS.get(method);
|
|
16234
|
+
const list = rows === void 0 ? null : listOf(callee.object);
|
|
16235
|
+
const callback = node.arguments[0];
|
|
16236
|
+
if (list !== null && callback !== void 0 && isFunctionNode(callback)) {
|
|
16237
|
+
for (const index of rows) rowParam(list, callback.params[index], callback.body);
|
|
16238
|
+
}
|
|
16239
|
+
}
|
|
16240
|
+
if (thisIsState && node.type === "ForOfStatement") {
|
|
16241
|
+
const list = listOf(node.right);
|
|
16242
|
+
const left = node.left;
|
|
16243
|
+
const param = left.type === "VariableDeclaration" ? left.declarations[0]?.id : left;
|
|
16244
|
+
if (list !== null) rowParam(list, param, node.body);
|
|
16245
|
+
}
|
|
16246
|
+
forEachChild(node, (child) => walk2(child, thisIsState));
|
|
16247
|
+
};
|
|
16248
|
+
walk2(wrapper.body, true);
|
|
16249
|
+
return out;
|
|
16250
|
+
}
|
|
16084
16251
|
var WINDOW_HOLDERS = /* @__PURE__ */ new Set(["window", "globalThis", "self"]);
|
|
16085
16252
|
var WINDOW_VALUES = /* @__PURE__ */ new Map([
|
|
16086
16253
|
["innerWidth", "size"],
|
|
@@ -16941,11 +17108,11 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
|
|
|
16941
17108
|
code: WcsDiagnosticCode.RecursionUnsupported,
|
|
16942
17109
|
message: msgs.recursionUnsupported(checkPath, "binding"),
|
|
16943
17110
|
severity: "error"
|
|
16944
|
-
} : schema !== void 0 && !(unresolved && propNoMod.startsWith("on")) ? validateSchemaPathExistence(checkPath, pathTrimmed, scopedPaths, scopedPathSet, commandNames, schema, msgs) : unresolved ? null : toMissingVerdict(validatePathExistence(checkPath, pathTrimmed, scopedPaths, scopedPathSet, commandNames, msgs));
|
|
17111
|
+
} : schema !== void 0 && !(unresolved && propNoMod.startsWith("on")) ? validateSchemaPathExistence(checkPath, pathTrimmed, scopedPaths, scopedPathSet, commandNames, schema, msgs, unresolved) : unresolved ? null : toMissingVerdict(validatePathExistence(checkPath, pathTrimmed, scopedPaths, scopedPathSet, commandNames, msgs));
|
|
16945
17112
|
if (verdict) {
|
|
16946
17113
|
const pathOffset = binding.indexOf(parsed.path);
|
|
16947
17114
|
const pathStart = bindingStart + pathOffset;
|
|
16948
|
-
const near = verdict.code === WcsDiagnosticCode.BindingPathMissing || verdict.code === WcsDiagnosticCode.PathNonexistent ?
|
|
17115
|
+
const near = verdict.code === WcsDiagnosticCode.BindingPathMissing || verdict.code === WcsDiagnosticCode.PathNonexistent ? pathSuggestion(checkPath, scopedPaths, msgs) : "";
|
|
16949
17116
|
diagnostics.push({
|
|
16950
17117
|
code: verdict.code,
|
|
16951
17118
|
start: pathStart,
|
|
@@ -17396,7 +17563,7 @@ function matchesRecursionCandidates(scopedPaths, checkPath, scopedPathSet) {
|
|
|
17396
17563
|
function toMissingVerdict(message) {
|
|
17397
17564
|
return message ? { code: WcsDiagnosticCode.BindingPathMissing, message, severity: "warning" } : null;
|
|
17398
17565
|
}
|
|
17399
|
-
function validateSchemaPathExistence(checkPath, displayPath, scopedPaths, scopedPathSet, commandNames, schema, msgs) {
|
|
17566
|
+
function validateSchemaPathExistence(checkPath, displayPath, scopedPaths, scopedPathSet, commandNames, schema, msgs, unresolved) {
|
|
17400
17567
|
if (checkPath.startsWith("$")) {
|
|
17401
17568
|
return toMissingVerdict(validatePathExistence(checkPath, displayPath, scopedPaths, scopedPathSet, commandNames, msgs));
|
|
17402
17569
|
}
|
|
@@ -17405,6 +17572,9 @@ function validateSchemaPathExistence(checkPath, displayPath, scopedPaths, scoped
|
|
|
17405
17572
|
if (resolution.kind === "nonexistent") {
|
|
17406
17573
|
return { code: WcsDiagnosticCode.PathNonexistent, message: msgs.pathNonexistent(displayPath), severity: "error" };
|
|
17407
17574
|
}
|
|
17575
|
+
if (resolution.kind === "unknown" && !unresolved) {
|
|
17576
|
+
return toMissingVerdict(validatePathExistence(checkPath, displayPath, scopedPaths, scopedPathSet, commandNames, msgs));
|
|
17577
|
+
}
|
|
17408
17578
|
return null;
|
|
17409
17579
|
}
|
|
17410
17580
|
function getExpectedType(property) {
|
|
@@ -17817,7 +17987,10 @@ function validateTemplateSyntax(html, stateTagName, bindAttrName = "data-wcs", l
|
|
|
17817
17987
|
if (isValidTemplatePath(path, pathSet2, scoped)) return null;
|
|
17818
17988
|
if (defaultSchema !== void 0 && !path.startsWith("$")) {
|
|
17819
17989
|
const resolution = resolveIndexedSchemaPath(defaultSchema, path);
|
|
17820
|
-
|
|
17990
|
+
if (resolution.kind === "nonexistent") {
|
|
17991
|
+
return { code: WcsDiagnosticCode.PathNonexistent, severity: "error", message: msgs.pathNonexistent(displayPath) };
|
|
17992
|
+
}
|
|
17993
|
+
if (resolution.kind !== "unknown") return null;
|
|
17821
17994
|
}
|
|
17822
17995
|
if (isUnresolvedPath(path, pathIndex.scopes)) return null;
|
|
17823
17996
|
return { code: WcsDiagnosticCode.BindingPathMissing, severity: "warning", message: msgs.pathMissing(displayPath) };
|
|
@@ -17826,7 +17999,7 @@ function validateTemplateSyntax(html, stateTagName, bindAttrName = "data-wcs", l
|
|
|
17826
17999
|
const defaultPaths = allPaths;
|
|
17827
18000
|
const pathSet = new Set(defaultPaths.map((p) => p.path));
|
|
17828
18001
|
const filterNameSet = new Set(BUILTIN_FILTERS.map((f) => f.name));
|
|
17829
|
-
const
|
|
18002
|
+
const nearName = (code, path) => code === WcsDiagnosticCode.BindingPathMissing || code === WcsDiagnosticCode.PathNonexistent ? pathSuggestion(path, defaultPaths, msgs) : "";
|
|
17830
18003
|
const mustaches = findAllMustacheSyntax(html);
|
|
17831
18004
|
const comments = findAllCommentBindings(html);
|
|
17832
18005
|
for (const item of [...mustaches, ...comments]) {
|
|
@@ -17939,7 +18112,7 @@ function validateTemplateSyntax(html, stateTagName, bindAttrName = "data-wcs", l
|
|
|
17939
18112
|
code: verdict.code,
|
|
17940
18113
|
start: item.exprStart,
|
|
17941
18114
|
end: item.exprStart + pathPart.length,
|
|
17942
|
-
message: verdict.message + msgs.expansionSuffix(expandedPath) +
|
|
18115
|
+
message: verdict.message + msgs.expansionSuffix(expandedPath) + nearName(verdict.code, expandedPath),
|
|
17943
18116
|
severity: verdict.severity
|
|
17944
18117
|
});
|
|
17945
18118
|
}
|
|
@@ -17951,7 +18124,7 @@ function validateTemplateSyntax(html, stateTagName, bindAttrName = "data-wcs", l
|
|
|
17951
18124
|
code: verdict.code,
|
|
17952
18125
|
start: item.exprStart,
|
|
17953
18126
|
end: item.exprStart + pathPart.length,
|
|
17954
|
-
message: verdict.message +
|
|
18127
|
+
message: verdict.message + nearName(verdict.code, pathPart),
|
|
17955
18128
|
severity: verdict.severity
|
|
17956
18129
|
});
|
|
17957
18130
|
}
|
|
@@ -19300,7 +19473,7 @@ function validateGetterUntrackedReads(script, scriptStart, mountPath, nestedWrit
|
|
|
19300
19473
|
const segments = read.callee ? read.chain.slice(0, -1) : read.chain;
|
|
19301
19474
|
if (segments.length < 2 || !objectRoots.has(segments[0])) continue;
|
|
19302
19475
|
const prefix = mountPath === null ? [] : mountPath.split(".");
|
|
19303
|
-
const write = boundWriteOf([...prefix, ...segments], prefix.length + read.path.split(".").length, bindingWrites());
|
|
19476
|
+
const write = boundWriteOf([...prefix, ...segments], prefix.length + read.path.split(".").length, bindingWrites().filter((w) => w.certain));
|
|
19304
19477
|
if (write === void 0 && !nestedWriteRoots().has([...prefix, segments[0]].join("."))) continue;
|
|
19305
19478
|
const sp = segments.join(".");
|
|
19306
19479
|
out.push({
|
|
@@ -19314,6 +19487,45 @@ function validateGetterUntrackedReads(script, scriptStart, mountPath, nestedWrit
|
|
|
19314
19487
|
}
|
|
19315
19488
|
return out;
|
|
19316
19489
|
}
|
|
19490
|
+
function validateGetterRowFieldReads(script, scriptStart, mountPath, writtenPaths, bindingWrites, locale2) {
|
|
19491
|
+
const getters = analyzeCallableBodies(script).filter((entry) => entry.kind === "getter" && entry.accessor === "get");
|
|
19492
|
+
const msgs = getMessages(locale2);
|
|
19493
|
+
const prefix = mountPath === null ? [] : mountPath.split(".");
|
|
19494
|
+
const out = [];
|
|
19495
|
+
for (const getter of getters) {
|
|
19496
|
+
if (!/\bthis\b/.test(getter.body)) continue;
|
|
19497
|
+
const told = /* @__PURE__ */ new Set();
|
|
19498
|
+
for (const read of findRowFieldReads(getter.body) ?? []) {
|
|
19499
|
+
const list = [...prefix, ...read.list.split(".")];
|
|
19500
|
+
const segments = [...list, "*", ...read.fields];
|
|
19501
|
+
const writes = bindingWrites();
|
|
19502
|
+
const bound = boundWriteOf(segments, list.length, writes.filter((w) => w.certain));
|
|
19503
|
+
const soft = bound === void 0 ? boundWriteOf(segments, list.length, writes.filter((w) => !w.certain)) : void 0;
|
|
19504
|
+
const written = bound?.path ?? soft?.path ?? writtenUnderRows(segments, list.length, writtenPaths());
|
|
19505
|
+
const fieldPath = `${read.list}.*.${read.fields.join(".")}`;
|
|
19506
|
+
if (written === void 0 || told.has(fieldPath)) continue;
|
|
19507
|
+
told.add(fieldPath);
|
|
19508
|
+
out.push({
|
|
19509
|
+
code: WcsDiagnosticCode.GetterUntrackedRead,
|
|
19510
|
+
start: scriptStart + getter.bodyStart + read.start,
|
|
19511
|
+
end: scriptStart + getter.bodyStart + read.end,
|
|
19512
|
+
message: msgs.getterRowFieldRead(read.list, fieldPath, written, (bound ?? soft)?.binding ?? null, (bound ?? soft)?.tag ?? null),
|
|
19513
|
+
severity: bound === void 0 ? "warning" : "error"
|
|
19514
|
+
});
|
|
19515
|
+
}
|
|
19516
|
+
}
|
|
19517
|
+
return out;
|
|
19518
|
+
}
|
|
19519
|
+
function writtenUnderRows(segments, tracked, written) {
|
|
19520
|
+
return written.find(({ path, inclusive, script }) => {
|
|
19521
|
+
if (!script || inclusive) return false;
|
|
19522
|
+
const w = path.split(".").map((s) => /^\d+$/.test(s) ? "*" : s);
|
|
19523
|
+
if (w.length <= tracked) return false;
|
|
19524
|
+
const common = Math.min(w.length, segments.length);
|
|
19525
|
+
for (let i = 0; i < common; i++) if (w[i] !== segments[i]) return false;
|
|
19526
|
+
return true;
|
|
19527
|
+
})?.path;
|
|
19528
|
+
}
|
|
19317
19529
|
function boundWriteOf(segments, tracked, writes) {
|
|
19318
19530
|
return writes.find((write) => {
|
|
19319
19531
|
const written = write.path.split(".");
|
|
@@ -19340,8 +19552,8 @@ function collectBindingWrites(html, bindAttrName) {
|
|
|
19340
19552
|
if (list === null) return;
|
|
19341
19553
|
path = path === "." ? `${list}.*` : `${list}.*.${path.slice(1)}`;
|
|
19342
19554
|
}
|
|
19343
|
-
const write = (written) => {
|
|
19344
|
-
out.push({ path: written, binding: binding.exprText, tag });
|
|
19555
|
+
const write = (written, certain = true) => {
|
|
19556
|
+
out.push({ path: written, binding: binding.exprText, tag, certain });
|
|
19345
19557
|
};
|
|
19346
19558
|
if (parsed.bindingType === "spread") {
|
|
19347
19559
|
if (outputs === null) return;
|
|
@@ -19354,6 +19566,8 @@ function collectBindingWrites(html, bindAttrName) {
|
|
|
19354
19566
|
write(path);
|
|
19355
19567
|
} else if (parsed.bindingType === "prop" && (writesBack(attr, parsed.propName, parsed.propName) || outputs?.includes(parsed.propName) === true)) {
|
|
19356
19568
|
write(path);
|
|
19569
|
+
} else if (parsed.bindingType === "prop" && contract === void 0 && tag.includes("-") && TWO_WAY_PROPS.has(parsed.propName)) {
|
|
19570
|
+
write(path, false);
|
|
19357
19571
|
}
|
|
19358
19572
|
});
|
|
19359
19573
|
}
|
|
@@ -19496,9 +19710,11 @@ function templateKeyPath(raw) {
|
|
|
19496
19710
|
const path = raw.replace(/\$\{[^{}]*\}/g, "*");
|
|
19497
19711
|
return TEMPLATE_KEY_PATH.test(path) ? path : null;
|
|
19498
19712
|
}
|
|
19499
|
-
function collectNestedWriteRoots(html, stateTagName, bindAttrName, blocks) {
|
|
19713
|
+
function collectNestedWriteRoots(html, stateTagName, bindAttrName, blocks, written = []) {
|
|
19500
19714
|
const roots = /* @__PURE__ */ new Map();
|
|
19715
|
+
let script = false;
|
|
19501
19716
|
const addPrefixes = (path, inclusive) => {
|
|
19717
|
+
written.push({ path, inclusive, script });
|
|
19502
19718
|
const segments = path.split(".");
|
|
19503
19719
|
const last = inclusive ? segments.length : segments.length - 1;
|
|
19504
19720
|
const example = inclusive ? `${path}.*` : path;
|
|
@@ -19538,6 +19754,7 @@ function collectNestedWriteRoots(html, stateTagName, bindAttrName, blocks) {
|
|
|
19538
19754
|
const tag = tags.find((t) => t.start <= at2 && at2 <= t.end);
|
|
19539
19755
|
if (tag?.contract?.hasWcBindable && tag.contract.properties.includes(occ.propName)) addPrefixes(path, false);
|
|
19540
19756
|
}
|
|
19757
|
+
script = true;
|
|
19541
19758
|
for (const block of blocks) {
|
|
19542
19759
|
if (block.mountPath !== null) addPrefixes(block.mountPath, true);
|
|
19543
19760
|
const scan = maskCommentsAndStrings(block.content);
|
|
@@ -19769,8 +19986,15 @@ function validateOnHandlerThis(script, scriptStart, locale2) {
|
|
|
19769
19986
|
function validateSemantics(html, stateTagName = "wcs-state", locale2, bindAttrName = "data-wcs") {
|
|
19770
19987
|
const out = [];
|
|
19771
19988
|
const blocks = parseLoadedScriptBlocks(html, stateTagName);
|
|
19772
|
-
let
|
|
19773
|
-
const
|
|
19989
|
+
let nestedWrites = null;
|
|
19990
|
+
const getNestedWrites = () => {
|
|
19991
|
+
if (nestedWrites === null) {
|
|
19992
|
+
const paths = [];
|
|
19993
|
+
nestedWrites = { roots: collectNestedWriteRoots(html, stateTagName, bindAttrName, blocks, paths), paths };
|
|
19994
|
+
}
|
|
19995
|
+
return nestedWrites;
|
|
19996
|
+
};
|
|
19997
|
+
const getNestedWriteRoots = () => getNestedWrites().roots;
|
|
19774
19998
|
let bindingWrites = null;
|
|
19775
19999
|
const getBindingWrites = () => bindingWrites ??= collectBindingWrites(html, bindAttrName);
|
|
19776
20000
|
for (const block of blocks) {
|
|
@@ -19786,6 +20010,14 @@ function validateSemantics(html, stateTagName = "wcs-state", locale2, bindAttrNa
|
|
|
19786
20010
|
getBindingWrites,
|
|
19787
20011
|
locale2
|
|
19788
20012
|
));
|
|
20013
|
+
out.push(...validateGetterRowFieldReads(
|
|
20014
|
+
block.content,
|
|
20015
|
+
block.contentStart,
|
|
20016
|
+
block.mountPath,
|
|
20017
|
+
() => getNestedWrites().paths,
|
|
20018
|
+
getBindingWrites,
|
|
20019
|
+
locale2
|
|
20020
|
+
));
|
|
19789
20021
|
out.push(...validateGetterLocationReads(block.content, block.contentStart, locale2));
|
|
19790
20022
|
out.push(...validateGetterClockReads(block.content, block.contentStart, locale2));
|
|
19791
20023
|
out.push(...validateGetterAmbientReads(block.content, block.contentStart, locale2));
|
|
@@ -21525,7 +21757,8 @@ function validateScriptReads(html, stateTagName = "wcs-state", locale2, fileRead
|
|
|
21525
21757
|
start: block.contentStart + spread.start,
|
|
21526
21758
|
end: block.contentStart + spread.end,
|
|
21527
21759
|
message: msgs.pathDynamicUnknownSpread(block.content.slice(spread.start, spread.end)),
|
|
21528
|
-
severity: "info"
|
|
21760
|
+
severity: "info",
|
|
21761
|
+
wholeState: true
|
|
21529
21762
|
});
|
|
21530
21763
|
}
|
|
21531
21764
|
const prefix = block.mountPath === null || block.mountPath === "" ? "" : `${block.mountPath}.`;
|
|
@@ -21887,8 +22120,320 @@ function describe(callable) {
|
|
|
21887
22120
|
return callable.listed?.key ?? callable.name;
|
|
21888
22121
|
}
|
|
21889
22122
|
|
|
21890
|
-
// src/service/
|
|
22123
|
+
// src/service/frameworkHabitsValidator.ts
|
|
22124
|
+
var EXPRESSION_CHARACTER = /[\s!?=<>+()'"`&,]/;
|
|
22125
|
+
var PATH = /^(?:\.|\.?[^\s!?=<>+()'"`&,|.@][^\s!?=<>+()'"`&,|@]*)$/;
|
|
22126
|
+
var NUMBER2 = /^-?\d+(?:\.\d+)?$/;
|
|
22127
|
+
function isBindingExpression(path) {
|
|
22128
|
+
if (path === "" || path.includes("@")) return false;
|
|
22129
|
+
return EXPRESSION_CHARACTER.test(path);
|
|
22130
|
+
}
|
|
22131
|
+
function filterHint(expression) {
|
|
22132
|
+
const text3 = expression.trim();
|
|
22133
|
+
const not3 = /^!\s*(\S+)$/.exec(text3);
|
|
22134
|
+
if (not3 !== null && PATH.test(not3[1])) return `${not3[1]}|not`;
|
|
22135
|
+
const binary = /^(\S+)\s*(===|!==|==|!=|>=|<=|>|<|\+|-|\*|\/|%)\s*(\S+)$/.exec(text3);
|
|
22136
|
+
if (binary === null || !PATH.test(binary[1])) return null;
|
|
22137
|
+
const [, path, op, raw] = binary;
|
|
22138
|
+
const quoted = /^(['"])(.*)\1$/.exec(raw);
|
|
22139
|
+
const value = quoted !== null ? quoted[2] : raw;
|
|
22140
|
+
const isNumber = quoted === null && NUMBER2.test(raw);
|
|
22141
|
+
if (quoted === null && !isNumber && !["true", "false", "null"].includes(raw)) return null;
|
|
22142
|
+
if (/[,()|]/.test(value)) return null;
|
|
22143
|
+
const name = {
|
|
22144
|
+
"===": "eq",
|
|
22145
|
+
"==": "eq",
|
|
22146
|
+
"!==": "ne",
|
|
22147
|
+
"!=": "ne",
|
|
22148
|
+
">": "gt",
|
|
22149
|
+
">=": "ge",
|
|
22150
|
+
"<": "lt",
|
|
22151
|
+
"<=": "le",
|
|
22152
|
+
"+": "add",
|
|
22153
|
+
"-": "sub",
|
|
22154
|
+
"*": "mul",
|
|
22155
|
+
"/": "div",
|
|
22156
|
+
"%": "mod"
|
|
22157
|
+
}[op];
|
|
22158
|
+
if (name !== "eq" && name !== "ne" && !isNumber) return null;
|
|
22159
|
+
return `${path}|${name}(${value})`;
|
|
22160
|
+
}
|
|
22161
|
+
function calledMethod(expression) {
|
|
22162
|
+
const arrow = expression.indexOf("=>");
|
|
22163
|
+
const body = arrow === -1 ? expression : expression.slice(arrow + 2);
|
|
22164
|
+
const call = /^\s*\{?\s*(?:this\s*\.\s*)?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/.exec(body);
|
|
22165
|
+
return call === null ? null : call[1];
|
|
22166
|
+
}
|
|
22167
|
+
function propertyOf(left) {
|
|
22168
|
+
return (splitOutsideQuotes2(left, "|")[0] ?? "").replace(/#.*$/, "").trim();
|
|
22169
|
+
}
|
|
22170
|
+
function validateBindingExpressions(html, bindAttribute = "data-wcs", stateTagName = "wcs-state", locale2) {
|
|
22171
|
+
const msgs = getMessages(locale2);
|
|
22172
|
+
const out = [];
|
|
22173
|
+
if (html.includes(bindAttribute)) {
|
|
22174
|
+
for (const attr of findAllBindAttributes(html, bindAttribute)) {
|
|
22175
|
+
let pos = 0;
|
|
22176
|
+
for (const binding of splitBindingExpressions(attr.value)) {
|
|
22177
|
+
const bindingStart = attr.valueStart + pos;
|
|
22178
|
+
pos += binding.length + 1;
|
|
22179
|
+
const colon = indexOfOutsideQuotes2(binding, ":");
|
|
22180
|
+
if (colon === -1) continue;
|
|
22181
|
+
const property = propertyOf(binding.slice(0, colon));
|
|
22182
|
+
if (property === "else") continue;
|
|
22183
|
+
const site = expressionIn(binding, colon + 1);
|
|
22184
|
+
if (site === null) continue;
|
|
22185
|
+
const handler = property.startsWith("on");
|
|
22186
|
+
out.push({
|
|
22187
|
+
code: WcsDiagnosticCode.BindingExpression,
|
|
22188
|
+
start: bindingStart + site.start,
|
|
22189
|
+
end: bindingStart + site.end,
|
|
22190
|
+
message: handler ? msgs.handlerExpression(property, site.text, calledMethod(site.text)) : msgs.bindingExpression(site.text, filterHint(site.text)),
|
|
22191
|
+
severity: "error"
|
|
22192
|
+
});
|
|
22193
|
+
}
|
|
22194
|
+
}
|
|
22195
|
+
}
|
|
22196
|
+
if ((html.includes("{{") || html.includes("@@")) && parseWcsStateElements(html, stateTagName).length > 0) {
|
|
22197
|
+
const texts = [...findAllMustacheSyntax(html).filter((m) => !m.inDocumentHead), ...findAllCommentBindings(html).filter((m) => !m.inDocumentHead)];
|
|
22198
|
+
for (const m of texts) {
|
|
22199
|
+
const site = expressionIn(m.expression, 0);
|
|
22200
|
+
if (site === null) continue;
|
|
22201
|
+
out.push({
|
|
22202
|
+
code: WcsDiagnosticCode.BindingExpression,
|
|
22203
|
+
start: m.exprStart + site.start,
|
|
22204
|
+
end: m.exprStart + site.end,
|
|
22205
|
+
message: msgs.bindingExpression(site.text, filterHint(site.text)),
|
|
22206
|
+
severity: "error"
|
|
22207
|
+
});
|
|
22208
|
+
}
|
|
22209
|
+
}
|
|
22210
|
+
return out;
|
|
22211
|
+
}
|
|
22212
|
+
function expressionIn(text3, from) {
|
|
22213
|
+
const rhs = text3.slice(from);
|
|
22214
|
+
const segments = splitOutsideQuotes2(rhs, "|");
|
|
22215
|
+
if (segments.slice(1).some((s) => s.trim() === "")) return null;
|
|
22216
|
+
const raw = segments[0] ?? "";
|
|
22217
|
+
const path = raw.trim();
|
|
22218
|
+
if (!isBindingExpression(path)) return null;
|
|
22219
|
+
const start = from + raw.indexOf(path);
|
|
22220
|
+
return { start, end: start + path.length, text: path };
|
|
22221
|
+
}
|
|
22222
|
+
function writtenAttributes2(html, from, to) {
|
|
22223
|
+
const out = [];
|
|
22224
|
+
const attribute = /([^\s"'<>/=]+)(?:(\s*=\s*)(?:"([^"]*)"|'([^']*)'|([^\s"'<>`=]+)))?/g;
|
|
22225
|
+
const text3 = html.slice(from, to);
|
|
22226
|
+
let match;
|
|
22227
|
+
while ((match = attribute.exec(text3)) !== null) {
|
|
22228
|
+
const value = match[3] ?? match[4] ?? match[5] ?? null;
|
|
22229
|
+
const quoted = match[3] !== void 0 || match[4] !== void 0 ? 1 : 0;
|
|
22230
|
+
out.push({
|
|
22231
|
+
name: match[1].toLowerCase(),
|
|
22232
|
+
value,
|
|
22233
|
+
start: from + match.index,
|
|
22234
|
+
end: from + match.index + match[0].length,
|
|
22235
|
+
valueStart: from + match.index + match[1].length + (match[2]?.length ?? 0) + quoted
|
|
22236
|
+
});
|
|
22237
|
+
}
|
|
22238
|
+
return out;
|
|
22239
|
+
}
|
|
22240
|
+
function validateAttributeMustaches(html, bindAttribute = "data-wcs", stateTagName = "wcs-state", locale2, fileReader) {
|
|
22241
|
+
if (!html.includes("{{")) return [];
|
|
22242
|
+
if (parseWcsStateElements(html, stateTagName).length === 0) return [];
|
|
22243
|
+
if (isMustacheDisabled(html, stateTagName, fileReader)) return [];
|
|
22244
|
+
const msgs = getMessages(locale2);
|
|
22245
|
+
const bind = bindAttribute.toLowerCase();
|
|
22246
|
+
const out = [];
|
|
22247
|
+
for (const tag of findStartTagRegions(html)) {
|
|
22248
|
+
if (!html.slice(tag.start, tag.end).includes("{{")) continue;
|
|
22249
|
+
for (const a of writtenAttributes2(html, tag.start, tag.end)) {
|
|
22250
|
+
if (a.value === null || a.name === bind) continue;
|
|
22251
|
+
const open = a.value.indexOf("{{");
|
|
22252
|
+
if (open === -1) continue;
|
|
22253
|
+
const close = a.value.indexOf("}}", open + 2);
|
|
22254
|
+
if (close === -1) continue;
|
|
22255
|
+
out.push({
|
|
22256
|
+
code: WcsDiagnosticCode.AttributeMustache,
|
|
22257
|
+
start: a.valueStart + open,
|
|
22258
|
+
end: a.valueStart + close + 2,
|
|
22259
|
+
message: msgs.attributeMustache(a.name),
|
|
22260
|
+
severity: "warning"
|
|
22261
|
+
});
|
|
22262
|
+
}
|
|
22263
|
+
}
|
|
22264
|
+
return out;
|
|
22265
|
+
}
|
|
22266
|
+
function validateMarkupHabits(html, bindAttribute = "data-wcs", locale2) {
|
|
22267
|
+
const msgs = getMessages(locale2);
|
|
22268
|
+
const out = [];
|
|
22269
|
+
const boundId = /* @__PURE__ */ new Set();
|
|
22270
|
+
if (html.includes(bindAttribute)) {
|
|
22271
|
+
for (const attr of findAllBindAttributes(html, bindAttribute)) {
|
|
22272
|
+
const bindings = splitBindingExpressions(attr.value);
|
|
22273
|
+
const nonEmpty = bindings.filter((b) => b.trim() !== "").length;
|
|
22274
|
+
let pos = 0;
|
|
22275
|
+
for (const binding of bindings) {
|
|
22276
|
+
const bindingStart = attr.valueStart + pos;
|
|
22277
|
+
pos += binding.length + 1;
|
|
22278
|
+
if (binding.trim() === "") continue;
|
|
22279
|
+
const colon = indexOfOutsideQuotes2(binding, ":");
|
|
22280
|
+
const rawLeft = colon === -1 ? binding : binding.slice(0, colon);
|
|
22281
|
+
const exact = rawLeft.trim();
|
|
22282
|
+
const leftStart = bindingStart + (rawLeft.length - rawLeft.trimStart().length);
|
|
22283
|
+
const property = propertyOf(rawLeft);
|
|
22284
|
+
if (property === "id" || property === "attr.id" || property === ".id" || property === "...") {
|
|
22285
|
+
if (attr.attrsStart !== void 0) boundId.add(attr.attrsStart);
|
|
22286
|
+
}
|
|
22287
|
+
if (STRUCTURAL_BINDING_TYPE_SET2.has(exact) && nonEmpty === 1 && attr.tagName !== "template") {
|
|
22288
|
+
out.push({
|
|
22289
|
+
code: WcsDiagnosticCode.StructuralElement,
|
|
22290
|
+
start: leftStart,
|
|
22291
|
+
end: leftStart + exact.length,
|
|
22292
|
+
message: msgs.structuralElement(exact, attr.tagName ?? ""),
|
|
22293
|
+
severity: "error"
|
|
22294
|
+
});
|
|
22295
|
+
continue;
|
|
22296
|
+
}
|
|
22297
|
+
if (/^on[A-Z]/.test(property)) {
|
|
22298
|
+
out.push({
|
|
22299
|
+
code: WcsDiagnosticCode.EventNameCase,
|
|
22300
|
+
start: leftStart,
|
|
22301
|
+
end: leftStart + property.length,
|
|
22302
|
+
message: msgs.eventNameCase(property, `on${property.slice(2).toLowerCase()}`),
|
|
22303
|
+
severity: "warning"
|
|
22304
|
+
});
|
|
22305
|
+
} else if (property === "key" && attr.tagName !== void 0 && !attr.tagName.includes("-")) {
|
|
22306
|
+
out.push({
|
|
22307
|
+
code: WcsDiagnosticCode.KeyBinding,
|
|
22308
|
+
start: leftStart,
|
|
22309
|
+
end: leftStart + property.length,
|
|
22310
|
+
message: msgs.keyBinding(),
|
|
22311
|
+
severity: "warning"
|
|
22312
|
+
});
|
|
22313
|
+
}
|
|
22314
|
+
}
|
|
22315
|
+
}
|
|
22316
|
+
}
|
|
22317
|
+
out.push(...sharedRowIds(html, bindAttribute, boundId, msgs));
|
|
22318
|
+
return out;
|
|
22319
|
+
}
|
|
22320
|
+
function sharedRowIds(html, bindAttribute, boundId, msgs) {
|
|
22321
|
+
if (!/<template[^>]*for\s*:/i.test(html)) return [];
|
|
22322
|
+
const out = [];
|
|
22323
|
+
const said = /* @__PURE__ */ new Set();
|
|
22324
|
+
const chainAt = createTemplateChain(html);
|
|
22325
|
+
for (const tag of findStartTagRegions(html)) {
|
|
22326
|
+
if (boundId.has(tag.start)) continue;
|
|
22327
|
+
const id = writtenAttributes2(html, tag.start, tag.end).find((a) => a.name === "id");
|
|
22328
|
+
if (id === void 0 || id.value === null || id.value.trim() === "") continue;
|
|
22329
|
+
const fors = getEnclosingFors(html, tag.start, bindAttribute);
|
|
22330
|
+
if (fors.length === 0) continue;
|
|
22331
|
+
const loop = fors[fors.length - 1];
|
|
22332
|
+
const chain = chainAt(tag.start);
|
|
22333
|
+
if (chain[chain.length - 1] !== loop.anchor) continue;
|
|
22334
|
+
const key = `${loop.anchor}\0${id.value}`;
|
|
22335
|
+
if (said.has(key)) continue;
|
|
22336
|
+
said.add(key);
|
|
22337
|
+
out.push({
|
|
22338
|
+
code: WcsDiagnosticCode.RowIdShared,
|
|
22339
|
+
start: id.start,
|
|
22340
|
+
end: id.end,
|
|
22341
|
+
message: msgs.rowIdShared(id.value),
|
|
22342
|
+
severity: "warning"
|
|
22343
|
+
});
|
|
22344
|
+
}
|
|
22345
|
+
return out;
|
|
22346
|
+
}
|
|
21891
22347
|
var GUARD_TAG = "wcs-guard-handler";
|
|
22348
|
+
var RELATIVE_SPECIFIER = /^(?:\.{1,2}\/|\/(?!\/))/;
|
|
22349
|
+
function validateInlineImports(html, stateTagName = "wcs-state", locale2) {
|
|
22350
|
+
if (!/\bimport\b|\bexport\b/.test(html)) return [];
|
|
22351
|
+
const msgs = getMessages(locale2);
|
|
22352
|
+
const out = [];
|
|
22353
|
+
const check = (blocks, guard) => {
|
|
22354
|
+
for (const block of blocks) {
|
|
22355
|
+
if (block.modulePath !== void 0) continue;
|
|
22356
|
+
for (const s of relativeImports(block.content)) {
|
|
22357
|
+
out.push({
|
|
22358
|
+
code: WcsDiagnosticCode.InlineImport,
|
|
22359
|
+
start: block.contentStart + s.start,
|
|
22360
|
+
end: block.contentStart + s.end,
|
|
22361
|
+
message: msgs.inlineImport(s.specifier, guard),
|
|
22362
|
+
severity: "error"
|
|
22363
|
+
});
|
|
22364
|
+
}
|
|
22365
|
+
}
|
|
22366
|
+
};
|
|
22367
|
+
if (html.includes(GUARD_TAG)) check(parseWcsScriptBlocks(html, GUARD_TAG), true);
|
|
22368
|
+
check(parseLoadedScriptBlocks(html, stateTagName), false);
|
|
22369
|
+
return out;
|
|
22370
|
+
}
|
|
22371
|
+
function relativeImports(source) {
|
|
22372
|
+
if (!/\b(?:import|export)\b/.test(source)) return [];
|
|
22373
|
+
let program;
|
|
22374
|
+
try {
|
|
22375
|
+
program = parseErasingTypes(source, { ecmaVersion: "latest", sourceType: "module", allowHashBang: true });
|
|
22376
|
+
} catch {
|
|
22377
|
+
return [];
|
|
22378
|
+
}
|
|
22379
|
+
const out = [];
|
|
22380
|
+
for (const node of program.body) {
|
|
22381
|
+
if (node.type !== "ImportDeclaration" && node.type !== "ExportAllDeclaration" && node.type !== "ExportNamedDeclaration") continue;
|
|
22382
|
+
const src = node.source;
|
|
22383
|
+
if (src === void 0 || src === null || src.type !== "Literal" || typeof src.value !== "string") continue;
|
|
22384
|
+
if (!RELATIVE_SPECIFIER.test(src.value)) continue;
|
|
22385
|
+
out.push({ specifier: src.value, start: src.start, end: src.end });
|
|
22386
|
+
}
|
|
22387
|
+
return out;
|
|
22388
|
+
}
|
|
22389
|
+
|
|
22390
|
+
// src/service/collectionMutationValidator.ts
|
|
22391
|
+
var METHODS = {
|
|
22392
|
+
Set: /* @__PURE__ */ new Set(["add", "delete", "clear"]),
|
|
22393
|
+
Map: /* @__PURE__ */ new Set(["set", "delete", "clear"])
|
|
22394
|
+
};
|
|
22395
|
+
var CALL = String.raw`\bthis\s*\??\.\s*(${ID})\s*\??\.\s*(add|set|delete|clear)(?=\s*\()`;
|
|
22396
|
+
function validateCollectionMutations(html, stateTagName = "wcs-state", locale2) {
|
|
22397
|
+
const msgs = getMessages(locale2);
|
|
22398
|
+
const out = [];
|
|
22399
|
+
for (const block of parseLoadedScriptBlocks(html, stateTagName)) {
|
|
22400
|
+
const script = block.content;
|
|
22401
|
+
if (!/new\s+(?:Set|Map)\b/.test(script)) continue;
|
|
22402
|
+
const kinds = /* @__PURE__ */ new Map();
|
|
22403
|
+
const kindOf = (key) => {
|
|
22404
|
+
if (!kinds.has(key)) {
|
|
22405
|
+
const declaration = findTopLevelDeclaration(script, key);
|
|
22406
|
+
const seed = declaration?.kind === "data" ? /^new\s+(Set|Map)\s*\(/.exec(declaration.value ?? "") : null;
|
|
22407
|
+
kinds.set(key, seed === null ? null : seed[1]);
|
|
22408
|
+
}
|
|
22409
|
+
return kinds.get(key);
|
|
22410
|
+
};
|
|
22411
|
+
let bodies = null;
|
|
22412
|
+
for (const match of execAllMasked(CALL, script)) {
|
|
22413
|
+
const [key, method] = match.groups;
|
|
22414
|
+
if (key === void 0 || method === void 0 || isApiRoot(key)) continue;
|
|
22415
|
+
const kind = kindOf(key);
|
|
22416
|
+
if (kind === null || !METHODS[kind].has(method)) continue;
|
|
22417
|
+
bodies ??= analyzeCallableBodies(script);
|
|
22418
|
+
const body = bodies.find((b) => match.index >= b.bodyStart && match.index < b.bodyStart + b.body.length);
|
|
22419
|
+
const scope = body === void 0 ? script : body.body;
|
|
22420
|
+
if (new RegExp(String.raw`\bthis\s*\??\.\s*${key}\s*=(?!=)`).test(maskCommentsAndStrings(scope))) continue;
|
|
22421
|
+
const start = block.contentStart + match.index;
|
|
22422
|
+
out.push({
|
|
22423
|
+
code: WcsDiagnosticCode.CollectionMutation,
|
|
22424
|
+
start,
|
|
22425
|
+
end: start + match.length,
|
|
22426
|
+
message: msgs.collectionMutation(key, method, kind),
|
|
22427
|
+
severity: "error",
|
|
22428
|
+
statePath: key
|
|
22429
|
+
});
|
|
22430
|
+
}
|
|
22431
|
+
}
|
|
22432
|
+
return out;
|
|
22433
|
+
}
|
|
22434
|
+
|
|
22435
|
+
// src/service/moduleTopReadValidator.ts
|
|
22436
|
+
var GUARD_TAG2 = "wcs-guard-handler";
|
|
21892
22437
|
var STORAGES = /* @__PURE__ */ new Set(["localStorage", "sessionStorage"]);
|
|
21893
22438
|
var GLOBALS = /* @__PURE__ */ new Set(["window", "globalThis", "self"]);
|
|
21894
22439
|
var STORAGE_WRITES = /* @__PURE__ */ new Set(["setItem", "removeItem", "clear"]);
|
|
@@ -21908,7 +22453,7 @@ function validateModuleTopReads(html, stateTagName = "wcs-state", locale2) {
|
|
|
21908
22453
|
}
|
|
21909
22454
|
}
|
|
21910
22455
|
};
|
|
21911
|
-
if (html.includes(
|
|
22456
|
+
if (html.includes(GUARD_TAG2)) check(parseWcsScriptBlocks(html, GUARD_TAG2), true);
|
|
21912
22457
|
check(parseLoadedScriptBlocks(html, stateTagName), false);
|
|
21913
22458
|
return out;
|
|
21914
22459
|
}
|
|
@@ -22008,7 +22553,8 @@ function validateStateSources(html, stateTagName = "wcs-state", locale2, fileRea
|
|
|
22008
22553
|
start: span.start,
|
|
22009
22554
|
end: span.end,
|
|
22010
22555
|
message: getMessages(locale2).stateSrcUnread(src),
|
|
22011
|
-
severity: "info"
|
|
22556
|
+
severity: "info",
|
|
22557
|
+
wholeState: true
|
|
22012
22558
|
});
|
|
22013
22559
|
}
|
|
22014
22560
|
return out;
|
|
@@ -22945,6 +23491,7 @@ function validateText(text3, options, applicationSchema, env) {
|
|
|
22945
23491
|
out.push(...validateOutputPathWrites(text3, bindAttribute, stateTagName, locale2, fileReader));
|
|
22946
23492
|
out.push(...validateAccessorLists(text3, stateTagName, locale2));
|
|
22947
23493
|
out.push(...validateArrayMutations(text3, stateTagName, locale2));
|
|
23494
|
+
out.push(...validateCollectionMutations(text3, stateTagName, locale2));
|
|
22948
23495
|
out.push(...validateModuleTopReads(text3, stateTagName, locale2));
|
|
22949
23496
|
out.push(...validateWatchDeclarations(text3, stateTagName, locale2, fileReader, bindAttribute, applicationSchema));
|
|
22950
23497
|
out.push(...validateScanDeclarations(text3, stateTagName, locale2));
|
|
@@ -22959,6 +23506,16 @@ function validateText(text3, options, applicationSchema, env) {
|
|
|
22959
23506
|
for (const d of validateNestedAssigns(text3, stateTagName, locale2)) {
|
|
22960
23507
|
out.push({ code: WcsDiagnosticCode.NestedAssign, start: d.start, end: d.end, message: d.message, severity: d.severity });
|
|
22961
23508
|
}
|
|
23509
|
+
out.push(...validateAttributeMustaches(text3, bindAttribute, stateTagName, locale2, fileReader));
|
|
23510
|
+
out.push(...validateMarkupHabits(text3, bindAttribute, locale2));
|
|
23511
|
+
out.push(...validateInlineImports(text3, stateTagName, locale2));
|
|
23512
|
+
const expressions = validateBindingExpressions(text3, bindAttribute, stateTagName, locale2);
|
|
23513
|
+
if (expressions.length > 0) {
|
|
23514
|
+
const inExpression = (d) => d.code !== WcsDiagnosticCode.BindingExpression && expressions.some((e) => d.start >= e.start && d.end <= e.end);
|
|
23515
|
+
const kept2 = out.filter((d) => !inExpression(d));
|
|
23516
|
+
out.length = 0;
|
|
23517
|
+
out.push(...kept2, ...expressions);
|
|
23518
|
+
}
|
|
22962
23519
|
const ignored = [
|
|
22963
23520
|
...findIgnoredRanges(text3, bindAttribute),
|
|
22964
23521
|
...text3.includes("{{") && isMustacheDisabled(text3, stateTagName, fileReader) ? findAllMustacheSyntax(text3).map((m) => [m.matchStart, m.matchEnd]) : []
|
|
@@ -23181,6 +23738,7 @@ function runValidation(inputs, options = {}) {
|
|
|
23181
23738
|
let errorCount = 0;
|
|
23182
23739
|
let warningCount = 0;
|
|
23183
23740
|
let infoCount = 0;
|
|
23741
|
+
let uncheckedCount = 0;
|
|
23184
23742
|
for (const source of [...diagnosticsBySource.keys()].sort()) {
|
|
23185
23743
|
const diags = diagnosticsBySource.get(source);
|
|
23186
23744
|
const mapper = createPositionMapper(textBySource.get(source) ?? "");
|
|
@@ -23188,7 +23746,9 @@ function runValidation(inputs, options = {}) {
|
|
|
23188
23746
|
if (d.severity === "error") errorCount++;
|
|
23189
23747
|
else if (d.severity === "warning") warningCount++;
|
|
23190
23748
|
else infoCount++;
|
|
23191
|
-
|
|
23749
|
+
const unchecked = d.severity === "info" && d.wholeState === true;
|
|
23750
|
+
if (unchecked) uncheckedCount++;
|
|
23751
|
+
if (options.errorsOnly && d.severity !== "error" && !(options.strict === true && unchecked)) continue;
|
|
23192
23752
|
const pos = mapper(d.start);
|
|
23193
23753
|
lines.push(`${source}:${pos.line}:${pos.column} ${severityLabel[d.severity]} ${d.code} ${d.message}`);
|
|
23194
23754
|
}
|
|
@@ -23198,6 +23758,9 @@ function runValidation(inputs, options = {}) {
|
|
|
23198
23758
|
if (notRead.length > 0) {
|
|
23199
23759
|
notes.push(`not read: ${notRead.join(", ")} \u2014 wcs-validate reads HTML pages (data-wcs, <wcs-*> tags), not a framework's components or script files`);
|
|
23200
23760
|
}
|
|
23761
|
+
if (options.strict === true && uncheckedCount > 0) {
|
|
23762
|
+
notes.push(`strict: ${uncheckedCount} info about a state that was not read at all (an unread src, a spread at the top of the state) counted like warnings \u2014 give --root, or a stateSchema, to have it checked`);
|
|
23763
|
+
}
|
|
23201
23764
|
if (nothingToCheck.length > 0) {
|
|
23202
23765
|
notes.push(`nothing to check: ${nothingToCheck.join(", ")} \u2014 no data-wcs binding, <wcs-*> tag or wcstack script in them`);
|
|
23203
23766
|
}
|
|
@@ -23206,7 +23769,8 @@ function runValidation(inputs, options = {}) {
|
|
|
23206
23769
|
errorCount,
|
|
23207
23770
|
warningCount,
|
|
23208
23771
|
infoCount,
|
|
23209
|
-
|
|
23772
|
+
uncheckedCount,
|
|
23773
|
+
exitCode: errorCount > 0 || options.strict === true && (warningCount > 0 || uncheckedCount > 0) ? 1 : 0,
|
|
23210
23774
|
diagnosticsBySource,
|
|
23211
23775
|
notRead,
|
|
23212
23776
|
nothingToCheck,
|
|
@@ -23315,7 +23879,7 @@ function main(argv) {
|
|
|
23315
23879
|
}
|
|
23316
23880
|
process.stdout.write(
|
|
23317
23881
|
`
|
|
23318
|
-
${result.errorCount} error(s), ${result.warningCount} warning(s), ${result.infoCount} info${options.strict ?
|
|
23882
|
+
${result.errorCount} error(s), ${result.warningCount} warning(s), ${result.infoCount} info${options.strict ? ` (strict${result.uncheckedCount > 0 ? `; ${result.uncheckedCount} unchecked counted as warnings` : ""})` : ""}
|
|
23319
23883
|
`
|
|
23320
23884
|
);
|
|
23321
23885
|
for (const note of result.notes) process.stdout.write(note + "\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/lint",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.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": {
|