diff --git a/editors/vscode/src/compiler.cjs b/editors/vscode/src/compiler.cjs index 51b83231..e3979dc1 100644 --- a/editors/vscode/src/compiler.cjs +++ b/editors/vscode/src/compiler.cjs @@ -1,6 +1,6 @@ "use strict"; // Generated by scripts/build-editor-compiler.mjs. Do not edit directly. -// WRN editor compiler source hash: 55b8301cff11aaee86a6692d86801e583eae0764af059dc10fdd83c047f4891b +// WRN editor compiler source hash: c0e3e8c72c68cb3c182e2de84c13ef0b8921579d9b081550002b8cdbe4af3397 // WRN editor compiler generator hash: c71e7fe4258c97b73b384ff14b321f0cf0b30cc2ed0322f5f84b04e757159b18 // Generated with TypeScript: 5.9.3 const __nodeRequire = require; @@ -4363,6 +4363,17 @@ function astDiagnostics(ast, options) { interactive = true; const tag = node.tag.toLowerCase(); for (const attribute of node.attrs) { + if (attribute.event && (attribute.name === "for" || attribute.name === "key")) { + diagnostics.push({ + code: "WRN-TEMPLATE-LOOP-DIRECTIVE", + severity: "error", + message: `@${attribute.name} is an event binding, not a loop directive.`, + hint: attribute.name === "for" + ? 'Use data-for="item in items".' + : 'Use data-key="item.id" alongside data-for.', + file: options.file, + }); + } if (attribute.event || attribute.boolean || !urlAttributes.has(attribute.name.toLowerCase())) continue; if (attribute.value.includes("{")) @@ -7017,7 +7028,9 @@ function validateTypedInitializer(name, annotation, expression) { * Server output retains the original typed source. */ function eraseFunctionTypes(source) { - return source.replace(/(\b(?:async\s+)?function\s+[A-Za-z_$][\w$]*\s*\()([^)]*)(\)\s*)(?::\s*([^{}=>]+)\s*)?(\{)/g, (_whole, open, params, close, _returnType, brace) => { + return source + .replace(/\bcatch\s*\(\s*([A-Za-z_$][\w$]*)\s*:\s*(?:any|unknown)\s*\)/g, "catch ($1)") + .replace(/(\b(?:async\s+)?function\s+[A-Za-z_$][\w$]*\s*\()([^)]*)(\)\s*)(?::\s*([^{}=>]+)\s*)?(\{)/g, (_whole, open, params, close, _returnType, brace) => { const plainParams = params .split(",") .map((param) => param.replace(/([A-Za-z_$][\w$]*)(\?)?\s*:\s*([^=]+?)(?=\s*=|$)/, "$1").trim()) diff --git a/editors/vscode/src/extension.bundle.cjs b/editors/vscode/src/extension.bundle.cjs index e3422bf9..bb600b33 100644 --- a/editors/vscode/src/extension.bundle.cjs +++ b/editors/vscode/src/extension.bundle.cjs @@ -1,4 +1,4 @@ -// WRN editor extension source hash: 1f978c42851411e8a985eb6c865b706e52f6063f067c3245946b4f55bc1a7d11 +// WRN editor extension source hash: 28a3937b948e6affb33150753d537162c6702786551dd90ab0968ef9166f21ac // WRN editor extension generator hash: 456d1d614e44e5fb1f19b784176c09cf2ade9b64ef73a17934c2698150b62728 "use strict"; var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); diff --git a/editors/vscode/src/language-server.cjs b/editors/vscode/src/language-server.cjs index 1639a3dc..10623de1 100644 --- a/editors/vscode/src/language-server.cjs +++ b/editors/vscode/src/language-server.cjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// WRN editor language server source hash: 13b4b0b80a52f1e883211f1b5193ad6ab28c582f526f0a28747ebf71307bbc0d +// WRN editor language server source hash: 41ff6d71dda68160ce6236e7a1a07ee8164c1c6173ba71e392aef4c3bf455390 // WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72 // @bun @bun-cjs (function(exports, require, module, __filename, __dirname) {var __create = Object.create; @@ -171456,6 +171456,15 @@ function astDiagnostics(ast, options) { interactive = true; const tag = node.tag.toLowerCase(); for (const attribute of node.attrs) { + if (attribute.event && (attribute.name === "for" || attribute.name === "key")) { + diagnostics.push({ + code: "WRN-TEMPLATE-LOOP-DIRECTIVE", + severity: "error", + message: `@${attribute.name} is an event binding, not a loop directive.`, + hint: attribute.name === "for" ? 'Use data-for="item in items".' : 'Use data-key="item.id" alongside data-for.', + file: options.file + }); + } if (attribute.event || attribute.boolean || !urlAttributes.has(attribute.name.toLowerCase())) continue; if (attribute.value.includes("{")) @@ -171849,6 +171858,8 @@ function retainedImports(ast) { return ast.structuredImports.filter((entry) => { if (entry.source.endsWith(".wrn")) return false; + if (!entry.typeOnly && entry.source === "@wrnexus/ui") + return false; if (entry.typeOnly) return true; return !entry.source.startsWith("@/components/") && !entry.source.startsWith("@/layouts/") && !entry.source.startsWith("@/stores/");