@wcstack/lint 4.2.0 → 4.3.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/dist/cli.cjs +130 -118
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -122,12 +122,15 @@ var WcsDiagnosticCode = {
|
|
|
122
122
|
NestedAssign: "wcs/nested-assign",
|
|
123
123
|
// --- 意味論(構文・存在検査では捕まらない取り違え。service/semanticValidator.ts) ---
|
|
124
124
|
// `$getAll` / `$setAll` / `$resolve` の添字の本数がパスの `*` の本数と噛み合わない。
|
|
125
|
-
//
|
|
125
|
+
// ランタイムは #901 / #902 で throw する(diagnostics の後付けがあれば同じ code の文面。超過は 3.x では
|
|
126
|
+
// 黙って無視されていた)。error。
|
|
126
127
|
IndexArity: "wcs/index-arity",
|
|
127
128
|
// ワイルドカードの階数がスコープの段数を超える(`matrix.*.*` を 1 段の for で読む、
|
|
128
129
|
// `$2` を 1 段のループで読む。ランタイムの #1401)。既存の「for の外」検査の深さ方向の一般化。
|
|
129
130
|
// 4.0 は各段の `*` が**その段で囲む for のリスト**の行であることも確かめる(#1403・F32 — `for: a`
|
|
130
|
-
// の行の中の `b.*.y` は投げる)。静的側も囲む for の一覧と段ごとに比べて同じ code
|
|
131
|
+
// の行の中の `b.*.y` は投げる)。静的側も囲む for の一覧と段ごとに比べて同じ code で報告する
|
|
132
|
+
// (ランタイムの文面に code が付くのは diagnostics の後付けがあるとき)。for のスコープを組み直しきれない
|
|
133
|
+
// ので、ランタイムは初期化を失敗させるが warning のまま(vscode-wcs の README の重大度の例外)。
|
|
131
134
|
WildcardRank: "wcs/wildcard-rank",
|
|
132
135
|
// ループの添字の範囲(`$1`〜`$128`。上限は manifest の `syntax.indexParam.maxDepth`)の外。ランタイムと同じ code:
|
|
133
136
|
// for の中のマークアップの `$129`(バインディングが失敗する)と、スクリプトの `this.$0` / `this.$129` / `this.$1000`
|
|
@@ -135,7 +138,8 @@ var WcsDiagnosticCode = {
|
|
|
135
138
|
// `wcs/binding-path-missing`(ただしけっして動かないので error)。for の外の `$129` はランタイムでは #1401 なので
|
|
136
139
|
// 従来どおり「for の外のループ添字」(`wcs/template-syntax`)で報告する。
|
|
137
140
|
IndexParamRange: "wcs/index-param-range",
|
|
138
|
-
// パス getter
|
|
141
|
+
// パス getter どうしの循環参照。4.0 のランタイムは評価の時点で #701 として throw し、その getter を読む
|
|
142
|
+
// 束縛はすべて失敗する(3.x はアドレススタック上限まで再帰してから落ちた)。error。
|
|
139
143
|
GetterCycle: "wcs/getter-cycle",
|
|
140
144
|
// `$renderedCallback`(3.x の旧名 `$updatedCallback`)が、どのバインディングにも現れないパスを判定に使っている。
|
|
141
145
|
// 同コールバックは **binding 駆動**(live binding が適用された path しか報告しない)
|
|
@@ -150,8 +154,9 @@ var WcsDiagnosticCode = {
|
|
|
150
154
|
GetterUntrackedRead: "wcs/getter-untracked-read",
|
|
151
155
|
OnHandlerThis: "wcs/on-handler-this",
|
|
152
156
|
// --- <wcs-state> script: $watch declaration ---
|
|
153
|
-
//
|
|
154
|
-
//
|
|
157
|
+
// temporal の後付け(state の temporal/watch.ts)が読み込みで throw する宣言: 越境 `@` / `$` 始まり /
|
|
158
|
+
// 空キー / 明らかな非関数ハンドラ。空の段(`a..b`)はランタイムが調べず、その watch は黙って発火しない
|
|
159
|
+
// (lint だけが知らせる — docs/mistake-catalogue.md)。
|
|
155
160
|
WatchDeclarationInvalid: "wcs/watch-declaration-invalid",
|
|
156
161
|
// `$watch` のキーが状態定義に存在しない。バインディング側と違い黙って発火しない
|
|
157
162
|
// だけなので気づけない。severity は binding-path-missing に揃える(warning)。
|
|
@@ -170,8 +175,8 @@ var WcsDiagnosticCode = {
|
|
|
170
175
|
//
|
|
171
176
|
// `**` を解釈しない場所へ `**` が渡った(data-wcs / mustache / $watch キー / $listKeys
|
|
172
177
|
// キー / $resolve / $postUpdate / $dependOn(旧名 $trackDependency) / 代入)、または `$recursion` 宣言が
|
|
173
|
-
// 無いのに `**` を使った。runtime
|
|
174
|
-
//
|
|
178
|
+
// 無いのに `**` を使った。4.0 の runtime はどれも #1101 で throw する — 宣言なしの `**` getter も、
|
|
179
|
+
// アクセサを登録する時点で(3.x は黙って無視した)。error。
|
|
175
180
|
RecursionUnsupported: "wcs/recursion-unsupported",
|
|
176
181
|
// 宣言済みアンカーと合致しない `**`(綴り違い・2 つ目の `**`)、または `**` の後ろが
|
|
177
182
|
// 整形されていない(空セグメント・`**` 直後の素の `*`)。
|
|
@@ -209,7 +214,8 @@ var WcsDiagnosticCode = {
|
|
|
209
214
|
// ドットアクセスを含むチェーン代入は NestedAssign の担当(相補・二重報告なし)。
|
|
210
215
|
ArrayIndexAssign: "wcs/array-index-assign",
|
|
211
216
|
// --- built-in wcs-* tag contract (generated/builtinTags.generated.ts が正本) ---
|
|
212
|
-
// 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)
|
|
217
|
+
// 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)。4.0 のランタイムは #38 / #1203 /
|
|
218
|
+
// #1204 で拒み、root では初期化が、行では束縛が失敗する(3.x の「黙って無視」ではない)。error。
|
|
213
219
|
TagMemberUnknown: "wcs/tag-member-unknown",
|
|
214
220
|
// タグのメンバー名が "on" で始まる(`once` 等)のに先頭ドット無しで束縛した: ランタイムはイベント束縛にして
|
|
215
221
|
// "ce" イベントを待ち、値は届かない。明示のプロパティ形 `.once:` を提案する(@wcstack/state 3.1・要件 B5 / 3.x 計画 D36)
|
|
@@ -271,7 +277,8 @@ var WcsDiagnosticCode = {
|
|
|
271
277
|
// (error 昇格時は packages/lint/scripts/smoke-test.mjs の対ケース更新が必須)。
|
|
272
278
|
AriaAttrUnknown: "wcs/aria-attr-unknown",
|
|
273
279
|
// --- document-level load configuration ---
|
|
274
|
-
// @wcstack/state/auto
|
|
280
|
+
// @wcstack/state/auto より後に @wcstack/devtools/auto が読まれている。info: 4.0 は後から付いた DevTools に
|
|
281
|
+
// 既存の束縛を送り直すので、欠けるのは付く前のタイムラインだけ。
|
|
275
282
|
ScriptOrder: "wcs/script-order",
|
|
276
283
|
// router/auto があるのに <base href> がない(SPA の basename 誤導出)。
|
|
277
284
|
BaseHrefMissing: "wcs/base-href-missing",
|
|
@@ -1629,6 +1636,61 @@ function extractAttribute(tagContent, attrName) {
|
|
|
1629
1636
|
if (!match) return null;
|
|
1630
1637
|
return match[1] ?? match[2] ?? match[3] ?? null;
|
|
1631
1638
|
}
|
|
1639
|
+
var IGNORE_VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
1640
|
+
"area",
|
|
1641
|
+
"base",
|
|
1642
|
+
"br",
|
|
1643
|
+
"col",
|
|
1644
|
+
"embed",
|
|
1645
|
+
"hr",
|
|
1646
|
+
"img",
|
|
1647
|
+
"input",
|
|
1648
|
+
"link",
|
|
1649
|
+
"meta",
|
|
1650
|
+
"param",
|
|
1651
|
+
"source",
|
|
1652
|
+
"track",
|
|
1653
|
+
"wbr"
|
|
1654
|
+
]);
|
|
1655
|
+
function findIgnoredRanges(html, bindAttribute) {
|
|
1656
|
+
const marker = asciiLowerCase(`${bindAttribute}-ignore`);
|
|
1657
|
+
const lower2 = asciiLowerCase(html);
|
|
1658
|
+
if (!lower2.includes(marker)) return [];
|
|
1659
|
+
const out = [];
|
|
1660
|
+
const stack = [];
|
|
1661
|
+
const tag = /<!--[\s\S]*?(?:-->|$)|<(\/?)([a-zA-Z][^\s/>]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
|
|
1662
|
+
let match;
|
|
1663
|
+
while ((match = tag.exec(html)) !== null) {
|
|
1664
|
+
if (match[2] === void 0) continue;
|
|
1665
|
+
const name = asciiLowerCase(match[2]);
|
|
1666
|
+
const end = match.index + match[0].length;
|
|
1667
|
+
if (match[1] === "/") {
|
|
1668
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
1669
|
+
if (stack[i].name !== name) continue;
|
|
1670
|
+
for (const open of stack.slice(i)) if (open.start !== null) out.push([open.start, end]);
|
|
1671
|
+
stack.length = i;
|
|
1672
|
+
break;
|
|
1673
|
+
}
|
|
1674
|
+
continue;
|
|
1675
|
+
}
|
|
1676
|
+
const ignored = parseAttributeNames(match[3]).has(marker) ? match.index : null;
|
|
1677
|
+
if (IGNORE_VOID_ELEMENTS.has(name)) {
|
|
1678
|
+
if (ignored !== null) out.push([ignored, end]);
|
|
1679
|
+
continue;
|
|
1680
|
+
}
|
|
1681
|
+
if (RAW_TEXT_ELEMENTS.has(name)) {
|
|
1682
|
+
const close = name === "plaintext" ? -1 : lower2.indexOf(`</${name}`, end);
|
|
1683
|
+
const closeEnd = close === -1 ? html.length : html.indexOf(">", close) + 1 || html.length;
|
|
1684
|
+
if (ignored !== null) out.push([ignored, closeEnd]);
|
|
1685
|
+
if (close === -1) break;
|
|
1686
|
+
tag.lastIndex = closeEnd;
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
stack.push({ name, start: ignored });
|
|
1690
|
+
}
|
|
1691
|
+
for (const open of stack) if (open.start !== null) out.push([open.start, html.length]);
|
|
1692
|
+
return out;
|
|
1693
|
+
}
|
|
1632
1694
|
|
|
1633
1695
|
// src/core/parser/quoteAware.ts
|
|
1634
1696
|
var isQuote = (c) => c === "'" || c === '"';
|
|
@@ -2136,10 +2198,11 @@ var builtinFilterMeta = {
|
|
|
2136
2198
|
// `not` は真偽性(truthy / falsy)の反転。`if:` が `Boolean()` で寄せるのと同じ規則で、
|
|
2137
2199
|
// `else:` はこのフィルタを足した束縛として組み立てられる(structural/createNotFilter.ts)
|
|
2138
2200
|
not: { description: "\u771F\u507D\u6027\u3092\u53CD\u8EE2\uFF08falsy \u2192 true\uFF09", hasArgs: false, resultType: "boolean", acceptTypes: "any", minArgs: 0, maxArgs: 0 },
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2201
|
+
// 比較は数値だけを受ける(filters/core.ts の `numeric` は数値以外の値で #28。3.x も同じで、"string" は誤りだった)
|
|
2202
|
+
lt: { description: "\u3088\u308A\u5C0F\u3055\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
2203
|
+
le: { description: "\u4EE5\u4E0B\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
2204
|
+
gt: { description: "\u3088\u308A\u5927\u304D\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
2205
|
+
ge: { description: "\u4EE5\u4E0A\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
2143
2206
|
// 算術
|
|
2144
2207
|
add: { description: "\u52A0\u7B97", hasArgs: true, resultType: "number", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
2145
2208
|
sub: { description: "\u6E1B\u7B97", hasArgs: true, resultType: "number", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
|
|
@@ -10826,15 +10889,15 @@ var ja = {
|
|
|
10826
10889
|
watchKeyEmptySegment: (k) => `$watch \u306E\u30AD\u30FC "${k}" \u306B\u7A7A\u306E\u30D1\u30B9\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u3059`,
|
|
10827
10890
|
watchHandlerNotFunction: (k) => `$watch \u306E\u30A8\u30F3\u30C8\u30EA "${k}" \u306E\u5024\u306F\u95A2\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`,
|
|
10828
10891
|
watchPathMissing: (k) => `$watch \u306E\u30AD\u30FC "${k}" \u306F\u72B6\u614B\u5B9A\u7FA9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\uFF08\u4E00\u5EA6\u3082\u767A\u706B\u3057\u307E\u305B\u3093\uFF09`,
|
|
10829
|
-
scanRemoved: (mountPath) => mountPath === null ? `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\
|
|
10892
|
+
scanRemoved: (mountPath) => mountPath === null ? `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08diagnostics \u306E\u5F8C\u4ED8\u3051\u3092\u5165\u308C\u305F\u5165\u53E3 \u2014 /auto \u306A\u3069 \u2014 \u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u3001/core \u3060\u3051\u3067\u306F\u9ED9\u3063\u3066\u7121\u8996\u3057\u307E\u3059\uFF09\u3002\u30D1\u30B9\u306E\u5909\u5316\u3092\u7573\u3080\u306A\u3089 $watch\u3001\u30A4\u30D9\u30F3\u30C8\u3092\u7573\u3080\u306A\u3089 $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u3001\u51FA\u529B\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3078\u66F8\u3044\u3066\u304F\u3060\u3055\u3044` : `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\u3002\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002root \u306E state \u306E $watch \u304B $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u7573\u3093\u3067\u304F\u3060\u3055\u3044`,
|
|
10830
10893
|
typeAnnotationIncompatible: (vt, rt) => `\u578B "${vt}" \u306F @type {${rt}} \u3068\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093`,
|
|
10831
10894
|
arrayMutation: (m, alt) => `\u914D\u5217\u306E\u7834\u58CA\u7684\u30E1\u30BD\u30C3\u30C9 "${m}" \u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\uFF08\u540C\u4E00\u53C2\u7167\u306E\u81EA\u5DF1\u518D\u4EE3\u5165\u3067\u3082\u8981\u7D20\u306E\u8FFD\u52A0\u30FB\u524A\u9664\u306F\u53CD\u6620\u3055\u308C\u307E\u305B\u3093\uFF09\u3002\u975E\u7834\u58CA\u30E1\u30BD\u30C3\u30C9\u3068\u518D\u4EE3\u5165\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: ${alt}\uFF09\u3002`,
|
|
10832
10895
|
arrayIndexAssign: (sp) => `\u914D\u5217\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3078\u306E\u76F4\u63A5\u4EE3\u5165\u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\u3002this["${sp}"] \u306E\u3088\u3046\u306A\u30C9\u30C3\u30C8\u30D1\u30B9\u4EE3\u5165\u3001\u307E\u305F\u306F with() \u3068\u518D\u4EE3\u5165\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
10833
10896
|
inPlaceAlias: (a, src, t) => `"${a}" \u306F ${src}\uFF08state \u306E\u5024\u305D\u306E\u3082\u306E\uFF09\u3067\u3059\u3002\u305D\u308C\u3092\u901A\u3057\u305F\u5909\u66F4\u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u305B\u305A\u3001\u540C\u3058\u5024\u3092\u66F8\u304D\u623B\u3057\u3066\u3082\u4E00\u89A7\u306E\u884C\u306F\u8FFD\u52A0\u30FB\u524A\u9664\u30FB\u7F6E\u304D\u63DB\u3048\u3055\u308C\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u5024\u3092\u4F5C\u3063\u3066 ${t} \u306B\u4EE3\u5165\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${a}.with(i, item) / [...${a}, item] / { ...${a}, key: value }\uFF09`,
|
|
10834
10897
|
inPlaceChange: (src, t) => `${src} \u306F state \u306E\u5024\u3092\u305D\u306E\u5834\u3067\u5909\u3048\u308B\u306E\u3067\u3001\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u5024\u3092\u4F5C\u3063\u3066 ${t} \u306B\u4EE3\u5165\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
10835
|
-
tagMemberUnknown: (prop, tag) => `"${prop}" \u306F <${tag}> \u306E wcBindable \u30E1\u30F3\u30D0\u30FC\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\
|
|
10898
|
+
tagMemberUnknown: (prop, tag) => `"${prop}" \u306F <${tag}> \u306E wcBindable \u30E1\u30F3\u30D0\u30FC\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u5BA3\u8A00\u306B\u7121\u3044\u30E1\u30F3\u30D0\u30FC\u3078\u306E\u675F\u7E1B\u3092 #38 \u3067\u62D2\u307F\u3001root \u3067\u306F state \u304C\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3059\uFF09`,
|
|
10836
10899
|
nameAlias: (written, canonical) => `"${written}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\u3067\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u3093\u3060\u6642\u70B9\u3067 throw \u3057\u307E\u3059\uFF09\u3002"${canonical}" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
|
|
10837
|
-
declarationAliasRead: (alias, canonical) => `"${alias}" \u306F 4.0 \u3067\u5916\u308C\u305F\u5BA3\u8A00\u30AD\u30FC\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u306A\u306E\u3067\u3001this["${alias}"] \u306F undefined \u306B\u306A\u308A\u307E\u3059\u3002"${canonical}" \u3092\u8AAD\u3093\u3067\
|
|
10900
|
+
declarationAliasRead: (alias, canonical) => `"${alias}" \u306F 4.0 \u3067\u5916\u308C\u305F\u5BA3\u8A00\u30AD\u30FC\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u306A\u306E\u3067\u3001this["${alias}"] \u306F undefined \u306B\u306A\u308A\u307E\u3059\u3002\u5BA3\u8A00\u306F this \u3092\u901A\u3057\u3066\u8AAD\u3081\u307E\u305B\u3093 \u2014 "${canonical}" \u3092\u8AAD\u3093\u3067\u3082 undefined \u3067\u3059${canonical === "$stream" ? "\uFF08\u30B9\u30C8\u30EA\u30FC\u30E0\u306E\u72B6\u614B\u306F $streamStatus\u30FB$streamError \u3067\u8AAD\u307F\u307E\u3059\uFF09" : ""}`,
|
|
10838
10901
|
declarationAlias: (alias, canonical) => `\u5BA3\u8A00\u30AD\u30FC "${alias}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\u3067\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09\u3002"${canonical}" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
|
|
10839
10902
|
declarationAliasInVolume: (alias, canonical, mountPath) => `\u5BA3\u8A00\u30AD\u30FC "${alias}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u3002\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002"${canonical}" \u3082\u30DC\u30EA\u30E5\u30FC\u30E0\u3067\u306F\u5BA3\u8A00\u3067\u304D\u306A\u3044\u306E\u3067\u3001root \u306E state \u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
10840
10903
|
behaviorNotObject: (keys) => `$behavior \u306F { ${keys.map((k) => `${k}?`).join(", ")} } \u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09`,
|
|
@@ -10864,7 +10927,7 @@ var ja = {
|
|
|
10864
10927
|
storagePairClobber: (path) => `<wcs-storage> \u306E value \u3092 #init=element \u306A\u3057\u3067\u30A2\u30AF\u30BB\u30B5\u30DA\u30A2 "${path}" \u306B\u675F\u306D\u3066\u3044\u307E\u3059\u3002state \u306E\u5074\u304C\u5148\u306B\u66F8\u304F\u306E\u3067\u3001\u8AAD\u307F\u8FBC\u307F\u306E\u305F\u3073\u306B getter \u306E\u6700\u521D\u306E\u5024\u304C\u4FDD\u5B58\u5024\u306E\u4E0A\u306B\u4FDD\u5B58\u3055\u308C\u3001setter \u306F\u4FDD\u5B58\u5024\u3092\u53D7\u3051\u53D6\u308C\u307E\u305B\u3093 \u2014 #init=element \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08\`value#init=element: ${path}\`\uFF09`,
|
|
10865
10928
|
inputNestedWrite: (tag, input, path, example) => `<${tag}> \u306E\u5165\u529B "${input}" \u306B "${path}" \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u304C\u3001\u30DA\u30FC\u30B8\u306F\u305D\u306E\u4E0B\uFF08"${example}"\uFF09\u3078\u66F8\u304D\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002\u675F\u7E1B\u306F "${path}" \u81EA\u8EAB\u3078\u306E\u4EE3\u5165\u3067\u3057\u304B\u5F53\u3066\u76F4\u3055\u308C\u306A\u3044\u306E\u3067\u3001\u4E0B\u3078\u306E\u66F8\u304D\u8FBC\u307F\u306F <${tag}> \u306B\u5C4A\u304D\u307E\u305B\u3093 \u2014 \u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30D1\u30B9\u3067\u8AAD\u3093\u3067\u65B0\u3057\u3044\u5024\u3092\u8FD4\u3059 getter\uFF08\`this["${example}"]\`\u30FB\`$getAll\`\uFF09\u3092\u675F\u306D\u308B\u304B\u3001\u4E0B\u3078\u66F8\u304B\u305A\u306B "${path}" \u3092\u5DEE\u3057\u66FF\u3048\u3066\u304F\u3060\u3055\u3044`,
|
|
10866
10929
|
inputNestedWriteOneShot: (tag, input, path, example) => `<${tag}> \u306E\u5165\u529B "${input}" \u306B "${path}" \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u304C\u3001\u30DA\u30FC\u30B8\u306F\u305D\u306E\u4E0B\uFF08"${example}"\uFF09\u3078\u66F8\u304D\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002\u675F\u7E1B\u306F "${path}" \u81EA\u8EAB\u3078\u306E\u4EE3\u5165\u3067\u3057\u304B\u5F53\u3066\u76F4\u3055\u308C\u305A\u3001<${tag}> \u306F\u8981\u6C42\u306E\u305F\u3073\u306B "${input}" \u3092 null \u306B\u623B\u3059\u306E\u3067\u3001\u6B21\u306E\u8981\u6C42\u306F "${input}" \u306A\u3057\u3067\u9001\u3089\u308C\u307E\u3059 \u2014 \u8981\u6C42\u3092\u59CB\u3081\u308B\u30CF\u30F3\u30C9\u30E9\u3067\u65B0\u3057\u3044\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u4F5C\u3063\u3066\u4EE3\u5165\u3057\uFF08\`this.submitBody = { \u2026 }\`\uFF09\u3001\u305D\u308C\u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044`,
|
|
10867
|
-
devtoolsAfterState: () => `@wcstack/devtools/auto \u306F @wcstack/state/auto \u3088\u308A\u5148\u306B\u8AAD\u307F\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u5F8C\u3060\u3068\
|
|
10930
|
+
devtoolsAfterState: () => `@wcstack/devtools/auto \u306F @wcstack/state/auto \u3088\u308A\u5148\u306B\u8AAD\u307F\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u5F8C\u304B\u3089\u3060\u3068\u3001DevTools \u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u306F\u4ED8\u3044\u305F\u6642\u70B9\u304B\u3089\u59CB\u307E\u308A\u307E\u3059\u3002\u65E2\u306B\u3042\u308B\u914D\u7DDA\u306F 4.0 \u304C\u9001\u308A\u76F4\u3057\u307E\u3059\uFF09`,
|
|
10868
10931
|
baseHrefMissing: () => `@wcstack/router \u3092\u4F7F\u3046 SPA \u306B\u306F <head> \u5185\u306E <base href="/"> \u304C\u5FC5\u8981\u3067\u3059\uFF08\u7121\u3044\u3068\u30C7\u30A3\u30FC\u30D7\u30EA\u30F3\u30AF\u3067 basename \u304C\u8AA4\u5C0E\u51FA\u3055\u308C\u307E\u3059\uFF09`,
|
|
10869
10932
|
routerOutletMisplaced: () => `\u3053\u306E <wcs-outlet> \u306F <wcs-router> \u306E\u76F4\u5F8C\u306B\u7121\u3044\u306E\u3067\u3001\u3069\u306E router \u3082\u4F7F\u3044\u307E\u305B\u3093\u3002router \u306F\u81EA\u5206\u306E\u76F4\u5F8C\u306E\u8981\u7D20\u3060\u3051\u3092 outlet \u3068\u3057\u3066\u4F7F\u3044\u3001\u305D\u3053\u306B <wcs-outlet> \u304C\u7121\u3051\u308C\u3070\u81EA\u524D\u306E outlet \u3092\u4F5C\u308A\u307E\u3059\u3002\u30EB\u30FC\u30C8\u306F router \u306E\u76F4\u5F8C\u306B\u63CF\u304B\u308C\u3001\u3053\u306E outlet \u306F\u7A7A\u306E\u307E\u307E\u3067\u3059 \u2014 <wcs-router> \u306E\u76F4\u5F8C\u3078\u79FB\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
10870
10933
|
signalsDualEntry: () => `@wcstack/signals \u3068 @wcstack/signals/dom \u304C\u540C\u4E00\u30DA\u30FC\u30B8\u304B\u3089 import \u3055\u308C\u3066\u3044\u307E\u3059\u3002CDN \u3067\u306F\u5404\u30A8\u30F3\u30C8\u30EA\u304C\u81EA\u5DF1\u5B8C\u7D50\u30D0\u30F3\u30C9\u30EB\u306E\u305F\u3081\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u30B3\u30A2\u304C\u4E8C\u91CD\u5316\u3057\u3001\u5883\u754C\u3067\u53CD\u5FDC\u304C\u58CA\u308C\u307E\u3059 \u2014 \u3059\u3079\u3066 /dom \u30A8\u30F3\u30C8\u30EA\u304B\u3089 import \u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
@@ -10876,13 +10939,15 @@ var ja = {
|
|
|
10876
10939
|
mountPathInvalid: (problem, mountPath) => {
|
|
10877
10940
|
switch (problem) {
|
|
10878
10941
|
case "empty":
|
|
10879
|
-
return `"mount" \u306B\u306F\u7A7A\u3067\u306A\u3044\
|
|
10942
|
+
return `"mount" \u306B\u306F\u7A7A\u3067\u306A\u3044\u9759\u7684\u306A\u30D1\u30B9\u304C\u5FC5\u8981\u3067\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
|
|
10880
10943
|
case "emptySegment":
|
|
10881
|
-
return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u306E\
|
|
10944
|
+
return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u306E\u6BB5\u304C\u3042\u308A\u307E\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
|
|
10882
10945
|
case "wildcard":
|
|
10883
|
-
return `"mount" \u30D1\u30B9 "${mountPath}" \u306F\u9759\u7684\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093 \u2014 \
|
|
10946
|
+
return `"mount" \u30D1\u30B9 "${mountPath}" \u306F\u9759\u7684\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093 \u2014 "*" \u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
|
|
10947
|
+
case "whitespace":
|
|
10948
|
+
return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u767D\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
|
|
10884
10949
|
default:
|
|
10885
|
-
return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u4E88\u7D04\u6587\u5B57\uFF08$, #, @\uFF09\u306F\u4F7F\u3048\u307E\u305B\u3093\
|
|
10950
|
+
return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u4E88\u7D04\u6587\u5B57\uFF08$, #, @\uFF09\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
|
|
10886
10951
|
}
|
|
10887
10952
|
},
|
|
10888
10953
|
recursionUnsupported: (p, where) => {
|
|
@@ -10904,7 +10969,7 @@ var ja = {
|
|
|
10904
10969
|
case "listKeys":
|
|
10905
10970
|
return `$listKeys \u306E\u30AD\u30FC "${p}" \u306B "**" \u306F\u4F7F\u3048\u307E\u305B\u3093\u3002\u30AD\u30FC\u4ED8\u304D\u30EA\u30B9\u30C8\u306F 1 \u672C\u306E\u5177\u4F53\u30EA\u30B9\u30C8\u30D1\u30B9\u3067\u3059 \u2014 \u6DF1\u3055\u3054\u3068\u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: "nodes.*.children"\uFF09`;
|
|
10906
10971
|
default:
|
|
10907
|
-
return `"${p}" \u306F "**" \u3092\u542B\u307F\u307E\u3059\u304C\u3001\u3053\u306E state \u306B\u306F $recursion \u5BA3\u8A00\u304C\u3042\u308A\u307E\u305B\u3093\u3002$recursion = { "<anchor>": "<repeat>" }\uFF08\u4F8B: { "nodes.*": "children.*" }\uFF09\u3092\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u304C\u7121\u3044\u3068
|
|
10972
|
+
return `"${p}" \u306F "**" \u3092\u542B\u307F\u307E\u3059\u304C\u3001\u3053\u306E state \u306B\u306F $recursion \u5BA3\u8A00\u304C\u3042\u308A\u307E\u305B\u3093\u3002$recursion = { "<anchor>": "<repeat>" }\uFF08\u4F8B: { "nodes.*": "children.*" }\uFF09\u3092\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u304C\u7121\u3044\u3068\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B #1101 \u3067 throw \u3057\u3001state \u306F\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3059\uFF09`;
|
|
10908
10973
|
}
|
|
10909
10974
|
},
|
|
10910
10975
|
recursionAnchorMismatch: (p, anchor) => `"${p}" \u306F\u5BA3\u8A00\u6E08\u307F\u306E\u518D\u5E30\u30A2\u30F3\u30AB\u30FC "${anchor}" \u3068\u5408\u81F4\u3057\u307E\u305B\u3093\uFF08\u521D\u7248\u306F state \u3054\u3068\u306B 1 \u3064\u306E\u81EA\u5DF1\u518D\u5E30\u306E\u307F\u3002"**" \u306E\u5F8C\u308D\u306F\u6574\u5F62\u3055\u308C\u305F\u63A5\u5C3E\u8F9E \u2014 2 \u3064\u76EE\u306E "**"\u30FB\u7A7A\u30BB\u30B0\u30E1\u30F3\u30C8\u30FB"**" \u76F4\u5F8C\u306E\u7D20\u306E "*" \u306F\u7F6E\u3051\u307E\u305B\u3093\uFF09`,
|
|
@@ -11025,15 +11090,15 @@ var en = {
|
|
|
11025
11090
|
watchKeyEmptySegment: (k) => `$watch key "${k}" has an empty path segment`,
|
|
11026
11091
|
watchHandlerNotFunction: (k) => `The value of $watch entry "${k}" must be a function`,
|
|
11027
11092
|
watchPathMissing: (k) => `$watch key "${k}" does not exist in the state definition (it will never fire)`,
|
|
11028
|
-
scanRemoved: (mountPath) => mountPath === null ? `$scan was removed in 4.0 (the
|
|
11093
|
+
scanRemoved: (mountPath) => mountPath === null ? `$scan was removed in 4.0 (the entries with the diagnostics add-on, such as /auto, throw at load; /core alone ignores it). Fold a path's changes in a $watch handler, or events in an $on handler, and write the output property there` : `$scan was removed in 4.0. In a volume (mount="${mountPath}") the runtime refuses to graft it and reports that with console.error (this state is not on the tree). Fold in a $watch or $on handler on the root state`,
|
|
11029
11094
|
typeAnnotationIncompatible: (vt, rt) => `Type "${vt}" is not compatible with @type {${rt}}`,
|
|
11030
11095
|
arrayMutation: (m, alt) => `Destructive array method "${m}" does not trigger a reactive update (re-assigning the same reference does not reflect added/removed elements either). Use a non-destructive method with reassignment (e.g. ${alt}).`,
|
|
11031
11096
|
arrayIndexAssign: (sp) => `Assigning directly to an array index does not trigger a reactive update. Use a dot-path assignment like this["${sp}"], or with() plus reassignment.`,
|
|
11032
11097
|
inPlaceAlias: (a, src, t) => `"${a}" is ${src} \u2014 the state's own value. A change through it does not trigger a reactive update, and writing the same value back does not add, remove or replace a list's rows. Build a new value and assign it to ${t} (${a}.with(i, item), [...${a}, item], { ...${a}, key: value })`,
|
|
11033
11098
|
inPlaceChange: (src, t) => `${src} changes the state's value in place, which does not trigger a reactive update. Build a new value and assign it to ${t}`,
|
|
11034
|
-
tagMemberUnknown: (prop, tag) => `"${prop}" is not a wcBindable member of <${tag}> (
|
|
11099
|
+
tagMemberUnknown: (prop, tag) => `"${prop}" is not a wcBindable member of <${tag}> (the runtime refuses a binding to an undeclared member with #38; at the root the state fails to initialize)`,
|
|
11035
11100
|
nameAlias: (written, canonical) => `"${written}" was removed in 4.0 (the 3.x old name of "${canonical}"; the runtime throws when it is read) \u2014 write "${canonical}"`,
|
|
11036
|
-
declarationAliasRead: (alias, canonical) => `"${alias}" is a declaration key 4.0 removed (the 3.x old name of "${canonical}"), so this["${alias}"] is undefined.
|
|
11101
|
+
declarationAliasRead: (alias, canonical) => `"${alias}" is a declaration key 4.0 removed (the 3.x old name of "${canonical}"), so this["${alias}"] is undefined. A declaration cannot be read through this \u2014 reading "${canonical}" is undefined too${canonical === "$stream" ? " (read a stream's state from $streamStatus / $streamError)" : ""}`,
|
|
11037
11102
|
declarationAlias: (alias, canonical) => `The declaration key "${alias}" was removed in 4.0 (the 3.x old name of "${canonical}"; the runtime throws at load time) \u2014 write "${canonical}"`,
|
|
11038
11103
|
declarationAliasInVolume: (alias, canonical, mountPath) => `The declaration key "${alias}" was removed in 4.0 (the 3.x old name of "${canonical}"). In a volume (mount="${mountPath}") the runtime refuses to graft it and reports that with console.error (this state is not on the tree). "${canonical}" cannot be declared in a volume either \u2014 declare it on the root state`,
|
|
11039
11104
|
behaviorNotObject: (keys) => `$behavior must be an object { ${keys.map((k) => `${k}?`).join(", ")} } (the runtime throws at load time)`,
|
|
@@ -11063,7 +11128,7 @@ var en = {
|
|
|
11063
11128
|
storagePairClobber: (path) => `The <wcs-storage> value is bound to the accessor pair "${path}" without #init=element. The state's side goes first, so on every load the getter's starting value is saved over the stored one, and the setter never receives it \u2014 add #init=element (\`value#init=element: ${path}\`)`,
|
|
11064
11129
|
inputNestedWrite: (tag, input, path, example) => `"${path}" is bound to the input "${input}" of <${tag}>, but the page writes below it ("${example}"). A binding is re-applied only when "${path}" itself is assigned, so those writes never reach <${tag}> \u2014 bind a getter that reads the fields by path (\`this["${example}"]\`, \`$getAll\`) and returns a new value, or replace "${path}" instead of writing below it`,
|
|
11065
11130
|
inputNestedWriteOneShot: (tag, input, path, example) => `"${path}" is bound to the input "${input}" of <${tag}>, but the page writes below it ("${example}"). A binding is re-applied only when "${path}" itself is assigned, and <${tag}> resets "${input}" to null after every request, so the next request goes without it \u2014 build a new object in the handler that starts the request (\`this.submitBody = { \u2026 }\`) and bind that`,
|
|
11066
|
-
devtoolsAfterState: () => `Load @wcstack/devtools/auto
|
|
11131
|
+
devtoolsAfterState: () => `Load @wcstack/devtools/auto before @wcstack/state/auto (loaded later, the DevTools timeline starts when it attaches; 4.0 sends it the wiring that is there already)`,
|
|
11067
11132
|
baseHrefMissing: () => `An SPA using @wcstack/router needs <base href="/"> in <head> (without it, deep links misderive the basename)`,
|
|
11068
11133
|
routerOutletMisplaced: () => `This <wcs-outlet> is not right after a <wcs-router>, so no router uses it: a router uses only the element right after it as its outlet, and makes an outlet of its own there when that is not a <wcs-outlet>. The routes render right after the router and this outlet stays empty \u2014 move it right after the <wcs-router>`,
|
|
11069
11134
|
signalsDualEntry: () => `Both @wcstack/signals and @wcstack/signals/dom are imported on this page. On a CDN each entry is a self-contained bundle, so the reactive core is duplicated and reactivity breaks at the seam \u2014 import everything from the single /dom entry`,
|
|
@@ -11075,13 +11140,15 @@ var en = {
|
|
|
11075
11140
|
mountPathInvalid: (problem, mountPath) => {
|
|
11076
11141
|
switch (problem) {
|
|
11077
11142
|
case "empty":
|
|
11078
|
-
return `"mount"
|
|
11143
|
+
return `"mount" needs a non-empty static path (the runtime refuses the volume: "has an invalid mount path").`;
|
|
11079
11144
|
case "emptySegment":
|
|
11080
|
-
return `"mount" path "${mountPath}" has an empty segment.`;
|
|
11145
|
+
return `"mount" path "${mountPath}" has an empty segment (the runtime refuses the volume: "has an invalid mount path").`;
|
|
11081
11146
|
case "wildcard":
|
|
11082
|
-
return `"mount" path "${mountPath}" must be static (
|
|
11147
|
+
return `"mount" path "${mountPath}" must be static \u2014 no "*" (the runtime refuses the volume: "has an invalid mount path").`;
|
|
11148
|
+
case "whitespace":
|
|
11149
|
+
return `"mount" path "${mountPath}" must not contain whitespace (the runtime refuses the volume: "has an invalid mount path").`;
|
|
11083
11150
|
default:
|
|
11084
|
-
return `"mount" path "${mountPath}" must not use reserved characters
|
|
11151
|
+
return `"mount" path "${mountPath}" must not use the reserved characters $, #, @ (the runtime refuses the volume: "has an invalid mount path").`;
|
|
11085
11152
|
}
|
|
11086
11153
|
},
|
|
11087
11154
|
recursionUnsupported: (p, where) => {
|
|
@@ -11103,7 +11170,7 @@ var en = {
|
|
|
11103
11170
|
case "listKeys":
|
|
11104
11171
|
return `$listKeys key "${p}" cannot contain "**" \u2014 a keyed list is one concrete list path. Declare the key per depth instead (for example "nodes.*.children")`;
|
|
11105
11172
|
default:
|
|
11106
|
-
return `"${p}" contains "**" but this state declares no $recursion anchor. Declare $recursion = { "<anchor>": "<repeat>" } (for example { "nodes.*": "children.*" }) \u2014 without it
|
|
11173
|
+
return `"${p}" contains "**" but this state declares no $recursion anchor. Declare $recursion = { "<anchor>": "<repeat>" } (for example { "nodes.*": "children.*" }) \u2014 without it the runtime throws #1101 at load and the state fails to initialize`;
|
|
11107
11174
|
}
|
|
11108
11175
|
},
|
|
11109
11176
|
recursionAnchorMismatch: (p, anchor) => `"${p}" does not match the declared recursion anchor "${anchor}" (this version supports exactly one self-recursive anchor per state, and "**" must be followed by a well-formed suffix: no second "**", no empty segment, no bare "*" right after "**")`,
|
|
@@ -11526,11 +11593,6 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
|
|
|
11526
11593
|
const pathIndex = getStatePathIndex(html, stateTagName, fileReader);
|
|
11527
11594
|
const statePaths = mergeSchemaCandidates(pathIndex.paths, applicationSchema);
|
|
11528
11595
|
const attrs = findAllBindAttributes(html, attrName);
|
|
11529
|
-
let structuralTemplates = null;
|
|
11530
|
-
const getStructuralTemplates = () => {
|
|
11531
|
-
structuralTemplates ??= collectStructuralTemplates(html, attrName);
|
|
11532
|
-
return structuralTemplates;
|
|
11533
|
-
};
|
|
11534
11596
|
const outerCandidates = [];
|
|
11535
11597
|
const currentTargetCandidates = [];
|
|
11536
11598
|
let currentTargetHandlers = null;
|
|
@@ -11690,7 +11752,8 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
|
|
|
11690
11752
|
start: pathStart,
|
|
11691
11753
|
end: pathStart + tokenPath.length,
|
|
11692
11754
|
message: msgs.commandRhsFormat(),
|
|
11693
|
-
|
|
11755
|
+
// ランタイムは束縛の計画で #1201 として throw し、root では初期化が失敗する
|
|
11756
|
+
severity: "error"
|
|
11694
11757
|
});
|
|
11695
11758
|
} else if (commandNames.size > 0 && !commandNames.has(tokenPath)) {
|
|
11696
11759
|
diagnostics.push({
|
|
@@ -11698,7 +11761,9 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
|
|
|
11698
11761
|
start: pathStart,
|
|
11699
11762
|
end: pathStart + tokenPath.length,
|
|
11700
11763
|
message: msgs.commandTokenUndeclared(tokenPath),
|
|
11701
|
-
|
|
11764
|
+
// ランタイムは取り付けで #1302 として throw し、root では初期化が失敗する
|
|
11765
|
+
// (eventToken. と `on*: $command.x` はイベントのたびに #1301 を記録するだけなので warning のまま)
|
|
11766
|
+
severity: "error"
|
|
11702
11767
|
});
|
|
11703
11768
|
}
|
|
11704
11769
|
}
|
|
@@ -11868,10 +11933,7 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
|
|
|
11868
11933
|
const typePath = candidateKeyOf(pathTrimmed, (c) => scopedPathSet.has(c));
|
|
11869
11934
|
const resultType = resolveResultType(typePath, parsed.filters, scopedPaths);
|
|
11870
11935
|
if (resultType !== null) {
|
|
11871
|
-
const typeReq = getExpectedType(
|
|
11872
|
-
parsed.property,
|
|
11873
|
-
() => isNegatedByElseChain(getStructuralTemplates(), attr.valueStart)
|
|
11874
|
-
);
|
|
11936
|
+
const typeReq = getExpectedType(parsed.property);
|
|
11875
11937
|
if (typeReq && resultType !== typeReq.expected) {
|
|
11876
11938
|
const pathOffset = binding.indexOf(parsed.path);
|
|
11877
11939
|
const pathStart = bindingStart + pathOffset;
|
|
@@ -12029,14 +12091,16 @@ function validateFilterUsage(filter, bindingStart, msgs) {
|
|
|
12029
12091
|
for (let i = 0; i < Math.min(argCount, info.argTypes.length); i++) {
|
|
12030
12092
|
const expectedArgType = info.argTypes[i];
|
|
12031
12093
|
if (expectedArgType === "any") continue;
|
|
12032
|
-
const
|
|
12033
|
-
|
|
12094
|
+
const arg = filter.args[i];
|
|
12095
|
+
const numericFails = expectedArgType === "number" && !readsAsNumber(arg);
|
|
12096
|
+
const actualArgType = inferArgType(arg);
|
|
12097
|
+
if (expectedArgType === "number" ? numericFails : actualArgType !== expectedArgType) {
|
|
12034
12098
|
diagnostics.push({
|
|
12035
12099
|
code: WcsDiagnosticCode.FilterArgType,
|
|
12036
12100
|
start: bindingStart + filter.argsOffset,
|
|
12037
12101
|
end: bindingStart + filter.argsOffset + filter.name.length,
|
|
12038
|
-
message: msgs.filterArgType(filter.name, i + 1, expectedArgType,
|
|
12039
|
-
severity: "warning"
|
|
12102
|
+
message: msgs.filterArgType(filter.name, i + 1, expectedArgType, arg, actualArgType),
|
|
12103
|
+
severity: numericFails ? "error" : "warning"
|
|
12040
12104
|
});
|
|
12041
12105
|
}
|
|
12042
12106
|
}
|
|
@@ -12101,57 +12165,11 @@ function validateSchemaPathExistence(checkPath, displayPath, scopedPaths, scoped
|
|
|
12101
12165
|
}
|
|
12102
12166
|
return null;
|
|
12103
12167
|
}
|
|
12104
|
-
function
|
|
12105
|
-
const escaped = attrName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12106
|
-
const attrRegex = new RegExp(`${escaped}\\s*=\\s*(["'])`, "i");
|
|
12107
|
-
const tagRegex = /<template(?:\s[^>]*)?>|<\/template\s*>/gi;
|
|
12108
|
-
const templates = [];
|
|
12109
|
-
let depth = 0;
|
|
12110
|
-
let match;
|
|
12111
|
-
while ((match = tagRegex.exec(html)) !== null) {
|
|
12112
|
-
if (match[0].startsWith("</")) {
|
|
12113
|
-
depth = Math.max(0, depth - 1);
|
|
12114
|
-
continue;
|
|
12115
|
-
}
|
|
12116
|
-
const attrMatch = attrRegex.exec(match[0]);
|
|
12117
|
-
if (attrMatch) {
|
|
12118
|
-
const quote = attrMatch[1];
|
|
12119
|
-
const valueStart = match.index + attrMatch.index + attrMatch[0].length;
|
|
12120
|
-
const valueEnd = html.indexOf(quote, valueStart);
|
|
12121
|
-
if (valueEnd !== -1) {
|
|
12122
|
-
const first = splitBindingExpressions(html.slice(valueStart, valueEnd))[0] ?? "";
|
|
12123
|
-
const firstColon = indexOfOutsideQuotes2(first, ":");
|
|
12124
|
-
const prop = (firstColon === -1 ? first : first.slice(0, firstColon)).replace(/#.*$/, "").trim();
|
|
12125
|
-
const type = prop === "if" || prop === "elseif" || prop === "else" ? prop : "other";
|
|
12126
|
-
templates.push({ valueStart, depth, type });
|
|
12127
|
-
}
|
|
12128
|
-
}
|
|
12129
|
-
depth++;
|
|
12130
|
-
}
|
|
12131
|
-
return templates;
|
|
12132
|
-
}
|
|
12133
|
-
function isNegatedByElseChain(templates, valueStart) {
|
|
12134
|
-
const index = templates.findIndex((t) => t.valueStart === valueStart);
|
|
12135
|
-
if (index === -1) return false;
|
|
12136
|
-
const selfDepth = templates[index].depth;
|
|
12137
|
-
for (let i = index + 1; i < templates.length; i++) {
|
|
12138
|
-
const next = templates[i];
|
|
12139
|
-
if (next.depth > selfDepth) continue;
|
|
12140
|
-
if (next.depth < selfDepth) return false;
|
|
12141
|
-
if (next.type === "elseif" || next.type === "else") return true;
|
|
12142
|
-
if (next.type === "if") return false;
|
|
12143
|
-
}
|
|
12144
|
-
return false;
|
|
12145
|
-
}
|
|
12146
|
-
function getExpectedType(property, isNegatedIf) {
|
|
12168
|
+
function getExpectedType(property) {
|
|
12147
12169
|
const prop = property.replace(/#.*$/, "");
|
|
12148
12170
|
if (prop === "for") {
|
|
12149
12171
|
return { label: "for", expected: "array", severity: "error" };
|
|
12150
12172
|
}
|
|
12151
|
-
if (prop === "if" || prop === "elseif") {
|
|
12152
|
-
if (!isNegatedIf()) return null;
|
|
12153
|
-
return { label: prop, expected: "boolean", severity: "warning" };
|
|
12154
|
-
}
|
|
12155
12173
|
if (prop.startsWith("class.")) {
|
|
12156
12174
|
return { label: prop, expected: "boolean", severity: "warning" };
|
|
12157
12175
|
}
|
|
@@ -12207,6 +12225,10 @@ function inferArgType(arg) {
|
|
|
12207
12225
|
if (/^-?\d+(\.\d+)?$/.test(v)) return "number";
|
|
12208
12226
|
return "string";
|
|
12209
12227
|
}
|
|
12228
|
+
function readsAsNumber(arg) {
|
|
12229
|
+
const v = arg.trim().replace(/^(["'])([\s\S]*)\1$/, "$2");
|
|
12230
|
+
return v !== "" && !Number.isNaN(Number(v));
|
|
12231
|
+
}
|
|
12210
12232
|
function isLiteral(value) {
|
|
12211
12233
|
return /^-?\d/.test(value) || /^["'`]/.test(value) || value === "true" || value === "false" || value === "null";
|
|
12212
12234
|
}
|
|
@@ -14131,20 +14153,7 @@ var BUILTIN_TAGS = {
|
|
|
14131
14153
|
};
|
|
14132
14154
|
|
|
14133
14155
|
// src/service/ioNodeValidator.ts
|
|
14134
|
-
var
|
|
14135
|
-
"textContent",
|
|
14136
|
-
"innerHTML",
|
|
14137
|
-
"innerText",
|
|
14138
|
-
"hidden",
|
|
14139
|
-
"title",
|
|
14140
|
-
"id",
|
|
14141
|
-
"slot",
|
|
14142
|
-
"dir",
|
|
14143
|
-
"lang",
|
|
14144
|
-
"role",
|
|
14145
|
-
"tabIndex",
|
|
14146
|
-
"className"
|
|
14147
|
-
]);
|
|
14156
|
+
var HTML_SINK_PROPERTIES = /* @__PURE__ */ new Set(["html", "innerHTML", "outerHTML", "srcdoc"]);
|
|
14148
14157
|
var STRUCTURAL_DIRECTIVES3 = /* @__PURE__ */ new Set(["for", "if", "elseif", "else"]);
|
|
14149
14158
|
var EXPLICIT_PROPERTY_REJECTED_HEADS2 = /* @__PURE__ */ new Set([
|
|
14150
14159
|
...Object.values(getWcsManifest().syntax.bindingTypes.propNamespaces),
|
|
@@ -14246,7 +14255,7 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
|
|
|
14246
14255
|
code: WcsDiagnosticCode.TagMemberUnknown,
|
|
14247
14256
|
start,
|
|
14248
14257
|
end,
|
|
14249
|
-
severity: "
|
|
14258
|
+
severity: "error",
|
|
14250
14259
|
tag: tagName,
|
|
14251
14260
|
member: name,
|
|
14252
14261
|
message: msgs.tagCommandUnknown(name, tagName, contract.commands.join(", ") || msgs.none()) + suggestion(name, contract.commands, msgs)
|
|
@@ -14261,7 +14270,7 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
|
|
|
14261
14270
|
code: WcsDiagnosticCode.TagMemberUnknown,
|
|
14262
14271
|
start,
|
|
14263
14272
|
end,
|
|
14264
|
-
severity: "
|
|
14273
|
+
severity: "error",
|
|
14265
14274
|
tag: tagName,
|
|
14266
14275
|
member: name,
|
|
14267
14276
|
message: msgs.tagEventTokenKeyUnknown(name, tagName, contract.properties.join(", ")) + suggestion(name, contract.properties, msgs)
|
|
@@ -14269,13 +14278,13 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
|
|
|
14269
14278
|
}
|
|
14270
14279
|
return;
|
|
14271
14280
|
}
|
|
14272
|
-
if (!contract.properties.includes(property) && !(property in contract.inputs) && !
|
|
14281
|
+
if (!contract.properties.includes(property) && !(property in contract.inputs) && !HTML_SINK_PROPERTIES.has(property)) {
|
|
14273
14282
|
const members = [...contract.properties, ...inputNames];
|
|
14274
14283
|
diagnostics.push({
|
|
14275
14284
|
code: WcsDiagnosticCode.TagMemberUnknown,
|
|
14276
14285
|
start,
|
|
14277
14286
|
end,
|
|
14278
|
-
severity: "
|
|
14287
|
+
severity: "error",
|
|
14279
14288
|
tag: tagName,
|
|
14280
14289
|
member: property,
|
|
14281
14290
|
message: msgs.tagMemberUnknown(property, tagName) + suggestion(property, members, msgs)
|
|
@@ -14480,7 +14489,7 @@ function validateDocumentEnv(html, locale2) {
|
|
|
14480
14489
|
code: WcsDiagnosticCode.ScriptOrder,
|
|
14481
14490
|
start: later.start,
|
|
14482
14491
|
end: later.end,
|
|
14483
|
-
severity: "
|
|
14492
|
+
severity: "info",
|
|
14484
14493
|
message: msgs.devtoolsAfterState()
|
|
14485
14494
|
});
|
|
14486
14495
|
}
|
|
@@ -15176,7 +15185,7 @@ function validateRecursiveGetters(script, offset2, spec, undeclared, msgs, out)
|
|
|
15176
15185
|
start,
|
|
15177
15186
|
end,
|
|
15178
15187
|
msgs.recursionUnsupported(span.name, "undeclared"),
|
|
15179
|
-
"
|
|
15188
|
+
"error"
|
|
15180
15189
|
);
|
|
15181
15190
|
}
|
|
15182
15191
|
continue;
|
|
@@ -15700,7 +15709,8 @@ function findMountPathProblem(mountPath) {
|
|
|
15700
15709
|
if (mountPath.length === 0) return "empty";
|
|
15701
15710
|
for (const segment of mountPath.split(".")) {
|
|
15702
15711
|
if (segment.length === 0) return "emptySegment";
|
|
15703
|
-
if (segment
|
|
15712
|
+
if (segment.includes("*")) return "wildcard";
|
|
15713
|
+
if (/\s/.test(segment)) return "whitespace";
|
|
15704
15714
|
if (segment.includes("$") || segment.includes("#") || segment.includes("@")) return "reserved";
|
|
15705
15715
|
}
|
|
15706
15716
|
return null;
|
|
@@ -16072,7 +16082,7 @@ function validateIndexArity(script, scriptStart, locale2) {
|
|
|
16072
16082
|
start: scriptStart + parsed.starts[1] + leading,
|
|
16073
16083
|
end: scriptStart + parsed.starts[1] + argText.trimEnd().length,
|
|
16074
16084
|
message: msgs.indexArity(api, path, requirement, wildcardCount, actual),
|
|
16075
|
-
severity: "
|
|
16085
|
+
severity: "error"
|
|
16076
16086
|
});
|
|
16077
16087
|
}
|
|
16078
16088
|
return out;
|
|
@@ -16128,7 +16138,7 @@ function validateGetterCycles(script, scriptStart, locale2) {
|
|
|
16128
16138
|
start: scriptStart + getter.start,
|
|
16129
16139
|
end: scriptStart + getter.end,
|
|
16130
16140
|
message: msgs.getterCycle(cycle),
|
|
16131
|
-
severity: "
|
|
16141
|
+
severity: "error"
|
|
16132
16142
|
});
|
|
16133
16143
|
}
|
|
16134
16144
|
return out;
|
|
@@ -16240,7 +16250,7 @@ function validateInputNestedWrites(html, stateTagName, bindAttrName, nestedWrite
|
|
|
16240
16250
|
code: WcsDiagnosticCode.InputNestedWrite,
|
|
16241
16251
|
start: occ.pathRange.start,
|
|
16242
16252
|
end: occ.pathRange.end,
|
|
16243
|
-
severity: "
|
|
16253
|
+
severity: "error",
|
|
16244
16254
|
tag: tag.tagName,
|
|
16245
16255
|
statePath: occ.path,
|
|
16246
16256
|
message
|
|
@@ -16897,7 +16907,9 @@ function validateDocument(text3, options = {}) {
|
|
|
16897
16907
|
for (const d of validateNestedAssigns(text3, stateTagName, locale2)) {
|
|
16898
16908
|
out.push({ code: WcsDiagnosticCode.NestedAssign, start: d.start, end: d.end, message: d.message, severity: d.severity });
|
|
16899
16909
|
}
|
|
16900
|
-
|
|
16910
|
+
const ignored = findIgnoredRanges(text3, bindAttribute);
|
|
16911
|
+
const kept = ignored.length === 0 ? out : out.filter((d) => !ignored.some(([start, end]) => d.start >= start && d.start < end));
|
|
16912
|
+
return sortDiagnostics(kept);
|
|
16901
16913
|
}
|
|
16902
16914
|
|
|
16903
16915
|
// src/core/sidecar/drift.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/lint",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.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": {
|