@swiftuijs/twill 0.3.0 → 0.3.1

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.
Files changed (57) hide show
  1. package/README.md +3 -3
  2. package/bin/run.mjs +2 -2
  3. package/dist/cli.js +5 -5
  4. package/dist/{compiler-CbNSBUI2.js → compiler-BdkU4Ruh.js} +32 -12
  5. package/dist/compiler-BdkU4Ruh.js.map +1 -0
  6. package/dist/config-la_KkjCS.js +1 -0
  7. package/dist/config.js +1 -0
  8. package/dist/declarations-BTAS8Mb_.js +132 -0
  9. package/dist/declarations-BTAS8Mb_.js.map +1 -0
  10. package/dist/declarations.js +1 -131
  11. package/dist/doctor-Co_pdZtt.js +202 -0
  12. package/dist/doctor-Co_pdZtt.js.map +1 -0
  13. package/dist/doctor.js +1 -201
  14. package/dist/editor.js +1 -1
  15. package/dist/esbuild.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/{loader-compiler-D1teTrXw.js → loader-compiler.js} +2 -2
  18. package/dist/loader-compiler.js.map +1 -0
  19. package/dist/loader-registration-B1ST9h1e.js +15 -0
  20. package/dist/loader-registration-B1ST9h1e.js.map +1 -0
  21. package/dist/loader-registration.d.ts +4 -0
  22. package/dist/loader-registration.js +2 -0
  23. package/dist/loader-state-DE2ArGYl.js +61 -0
  24. package/dist/loader-state-DE2ArGYl.js.map +1 -0
  25. package/dist/loader-state.d.ts +34 -0
  26. package/dist/loader-sync.d.ts +3 -0
  27. package/dist/loader-sync.js +28 -0
  28. package/dist/loader-sync.js.map +1 -0
  29. package/dist/loader.d.ts +2 -4
  30. package/dist/loader.js +9 -46
  31. package/dist/loader.js.map +1 -1
  32. package/dist/{plugin-BHfiQ2L-.js → plugin-DdTVagIU.js} +2 -2
  33. package/dist/{plugin-BHfiQ2L-.js.map → plugin-DdTVagIU.js.map} +1 -1
  34. package/dist/project-ZmlpFooa.js +444 -0
  35. package/dist/project-ZmlpFooa.js.map +1 -0
  36. package/dist/project.js +1 -442
  37. package/dist/register.js +2 -2
  38. package/dist/register.js.map +1 -1
  39. package/dist/rollup.js +1 -1
  40. package/dist/rspack.js +1 -1
  41. package/dist/syntax.js +1 -1
  42. package/dist/{transpile-D8P8Lsbx.js → transpile-CLNavDUr.js} +2 -2
  43. package/dist/{transpile-D8P8Lsbx.js.map → transpile-CLNavDUr.js.map} +1 -1
  44. package/dist/typescript-plugin.cjs +31 -11
  45. package/dist/typescript-plugin.cjs.map +1 -1
  46. package/dist/vite-BI-5KRgr.js +7 -0
  47. package/dist/vite-BI-5KRgr.js.map +1 -0
  48. package/dist/vite-react.js +1 -1
  49. package/dist/vite.js +1 -6
  50. package/dist/webpack.js +1 -1
  51. package/package.json +2 -2
  52. package/dist/compiler-CbNSBUI2.js.map +0 -1
  53. package/dist/declarations.js.map +0 -1
  54. package/dist/doctor.js.map +0 -1
  55. package/dist/loader-compiler-D1teTrXw.js.map +0 -1
  56. package/dist/project.js.map +0 -1
  57. package/dist/vite.js.map +0 -1
@@ -0,0 +1,7 @@
1
+ import { t as twillPlugin } from "./plugin-DdTVagIU.js";
2
+ //#region src/vite.ts
3
+ var vite_default = twillPlugin.vite;
4
+ //#endregion
5
+ export { vite_default as t };
6
+
7
+ //# sourceMappingURL=vite-BI-5KRgr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-BI-5KRgr.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { twillPlugin } from './plugin.js';\nexport default twillPlugin.vite;\nexport type { PluginOptions } from './plugin.js';\n"],"mappings":";;AACA,IAAA,eAAe,YAAY"}
@@ -1,4 +1,4 @@
1
- import vite_default from "./vite.js";
1
+ import { t as vite_default } from "./vite-BI-5KRgr.js";
2
2
  import react from "@vitejs/plugin-react";
3
3
  //#region src/vite-react.ts
4
4
  /** Compose the normal Vite React plugin with dialect compilation and refresh
package/dist/vite.js CHANGED
@@ -1,7 +1,2 @@
1
- import { t as twillPlugin } from "./plugin-BHfiQ2L-.js";
2
- //#region src/vite.ts
3
- var vite_default = twillPlugin.vite;
4
- //#endregion
1
+ import { t as vite_default } from "./vite-BI-5KRgr.js";
5
2
  export { vite_default as default };
6
-
7
- //# sourceMappingURL=vite.js.map
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as twillPlugin } from "./plugin-BHfiQ2L-.js";
1
+ import { t as twillPlugin } from "./plugin-DdTVagIU.js";
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = twillPlugin.webpack;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftuijs/twill",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Twill extends TypeScript with Swift-inspired syntax: trailing closures, guards, defer and checked switch expressions. Compiles to ordinary JavaScript.",
5
5
  "main": "./dist/typescript-plugin.cjs",
6
6
  "repository": {
@@ -163,7 +163,7 @@
163
163
  "vue": "^3.5.43",
164
164
  "webpack": "^5.111.1",
165
165
  "@playwright/test": "^1.63.0",
166
- "@swiftuijs/twill-runtime": "0.3.0"
166
+ "@swiftuijs/twill-runtime": "0.3.1"
167
167
  },
168
168
  "scripts": {
169
169
  "build": "node ../../scripts/generate-runtime-helper.mjs && vite build && vite build --config vite.plugin.config.ts && node scripts/prepare-core.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiler-CbNSBUI2.js","names":["tt"],"sources":["../src/parser.js","../src/defer-helper.ts","../src/defer.ts","../src/branches.ts","../src/enums.ts","../src/compiler.ts"],"sourcesContent":["// Acorn's extension hooks intentionally use its internal AST shape. Keep that\n// boundary here; the public compiler API is typed in compiler.ts.\nimport { Parser, tokTypes as tt } from 'acorn';\nimport { tsPlugin } from 'acorn-typescript';\nimport jsx from 'acorn-jsx';\n\nconst options = { ecmaVersion: 'latest', sourceType: 'module', locations: true };\nconst bases = {\n js: Parser,\n jsx: Parser.extend(jsx()),\n ts: Parser.extend(tsPlugin({ allowSatisfies: true })),\n tsx: Parser.extend(tsPlugin({ allowSatisfies: true })),\n};\n\n// `guard` remains an ordinary JS identifier unless its expression is followed\n// by a top-level `else`. Token lookahead ignores strings/comments and balanced\n// groups; it never rewrites source or attempts to parse the expression itself.\nfunction guardAt(input, offset, implicitMember = false) {\n const lexer = Parser.tokenizer(input.slice(offset), { ecmaVersion: 'latest' });\n const stack = [];\n let first = true;\n try {\n for (;;) {\n const token = lexer.getToken();\n const label = token.type.label;\n if (\n first &&\n ['=', '.', '?.', ':', '++/--', '*', '/', '%', '==/!=/===/!==', 'in', 'instanceof'].includes(\n label,\n ) &&\n !(implicitMember && label === '.')\n )\n return false;\n if (\n !stack.length &&\n ['if', 'for', 'while', 'switch', 'try', 'return', 'throw', 'var', 'export'].includes(label)\n )\n return false;\n if (!first && !stack.length && label === 'const') return false;\n first = false;\n if (!stack.length && label === 'else') return true;\n if (!stack.length && ['eof', ';', '}'].includes(label)) return false;\n if (['(', '[', '{', '${'].includes(label)) stack.push(label);\n else if ([')', ']', '}'].includes(label)) {\n if (!stack.length) return false;\n stack.pop();\n }\n }\n } catch {\n return false;\n }\n}\n\n// Deliberately conservative: do not infer exits from calls, loops or a nested\n// function's return. JS/TS still checks the legality of break/continue/return.\nfunction exits(node) {\n switch (node.type) {\n case 'ReturnStatement':\n case 'ThrowStatement':\n case 'BreakStatement':\n case 'ContinueStatement':\n return true;\n case 'BlockStatement':\n return node.body.some(exits);\n case 'IfStatement':\n case 'TwillIfBinding':\n return !!node.alternate && exits(node.consequent) && exits(node.alternate);\n default:\n return false;\n }\n}\n\nfunction awaits(node) {\n if (!node || typeof node !== 'object') return false;\n if (node.type === 'AwaitExpression' || node.await === true || node.kind === 'await using')\n return true;\n if (node.type === 'DeferStatement') return node.awaited;\n if (['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression'].includes(node.type))\n return false;\n if (['ClassDeclaration', 'ClassExpression'].includes(node.type)) {\n return (\n awaits(node.superClass) ||\n node.body.body.some((member) => member.computed && awaits(member.key))\n );\n }\n return Object.entries(node).some(([key, value]) => {\n if (key === 'loc' || key === 'trailing') return false;\n return Array.isArray(value) ? value.some(awaits) : !!value?.type && awaits(value);\n });\n}\n\nfunction deferAt(input, offset) {\n try {\n const next = Parser.tokenizer(input.slice(offset), { ecmaVersion: 'latest' }).getToken();\n return (\n next.type === tt.braceL &&\n !/[\\r\\n\\u2028\\u2029]/.test(input.slice(offset, offset + next.start))\n );\n } catch {\n // The isolated tokenizer may read JS division as a regexp. Let the real\n // expression parser handle ordinary uses of the identifier instead.\n return false;\n }\n}\n\n// Inspect only the possible parameter header, using real tokens so comments,\n// strings, default arguments and destructuring cannot confuse the delimiter.\nfunction headerAt(input, offset) {\n const lexer = Parser.tokenizer(input.slice(offset), options);\n const stack = [];\n let first = true;\n const tokens = [];\n try {\n for (;;) {\n const token = lexer.getToken();\n const label = token.type.label;\n if (first && label !== 'name' && label !== '(') return null;\n first = false;\n if (!stack.length && label === 'in') {\n const async = tokens.length > 1 && tokens[0].value === 'async';\n const firstParam = tokens[async ? 1 : 0];\n return {\n start: offset,\n end: offset + token.end,\n inStart: offset + token.start,\n text: input.slice(offset + tokens[0].start, offset + tokens.at(-1).end),\n textStart: offset + tokens[0].start,\n async,\n asyncEnd: async ? offset + tokens[0].end : null,\n parenthesized: firstParam.type.label === '(',\n };\n }\n if (label === 'eof' || (!stack.length && [';', '{', '}', '=>'].includes(label))) return null;\n if (['(', '[', '{'].includes(label)) stack.push(label);\n if ([')', ']', '}'].includes(label)) {\n if (!stack.length) return null;\n stack.pop();\n }\n tokens.push(token);\n }\n } catch {\n return null;\n }\n}\n\nfunction moveNodes(node, delta, locate) {\n if (!node || typeof node !== 'object') return;\n if (typeof node.start === 'number') {\n node.start += delta;\n node.end += delta;\n node.loc = { start: locate(node.start), end: locate(node.end) };\n }\n for (const [key, value] of Object.entries(node)) {\n if (key === 'loc') continue;\n if (Array.isArray(value)) value.forEach((item) => moveNodes(item, delta, locate));\n else if (value && typeof value === 'object') moveNodes(value, delta, locate);\n }\n}\n\nconst parsers = new Map();\nfunction associatedEnumAt(input, offset) {\n try {\n const tokens = Parser.tokenizer(input.slice(offset), { ecmaVersion: 'latest' });\n tokens.getToken(); // Declaration name; the TS parser validates it.\n const next = tokens.getToken();\n return (\n next.value === '<' ||\n (next.type === tt.braceL &&\n tokens.getToken().type === tt._case &&\n tokens.getToken().type === tt.name)\n );\n } catch {\n // Let the original parser diagnose malformed native syntax at its real offset.\n return false;\n }\n}\n\nfunction parserFor(language) {\n if (parsers.has(language)) return parsers.get(language);\n const Base = bases[language];\n class TwillParser extends Base {\n declareName(name, bindingType, position) {\n // acorn-typescript 1.4.13 passes 6/7 for aliases/interfaces, but its\n // zero type mask incorrectly registers them as runtime bindings.\n // TS has separate type/value namespaces; its checker owns type merging.\n if (bindingType === 6 || bindingType === 7) {\n const scope = this.currentScope();\n // Its namespace blocks enter Acorn scopes without initializing types.\n (scope.types ??= []).push(name);\n if (this.inModule && scope.flags & 1) delete this.undefinedExports[name];\n return;\n }\n super.declareName(name, bindingType, position);\n }\n\n skipHeader = null;\n closures = [];\n lineStarts = null;\n classSuperDepth = null;\n subscriptDepth = 0;\n conditionDepth = null;\n derivedClassElement = false;\n implicitClosure = null;\n\n tsParseEnumDeclaration(node, modifiers = {}) {\n if (!associatedEnumAt(this.input, this.end))\n return super.tsParseEnumDeclaration(node, modifiers);\n if (modifiers.const || modifiers.declare || this.isAmbientContext)\n this.raise(node.start, 'Associated-value enums cannot be const or ambient declarations.');\n this.expectContextual('enum');\n node.id = this.parseIdent();\n this.checkLValSimple(node.id, 2);\n node.typeParameters = this.tsTryParseTypeParameters(() => {\n if (this.type === tt._in || (this.isContextual('out') && this.lookahead().type === tt.name))\n this.raise(\n this.start,\n 'Associated-value enum type parameters cannot have const/in/out modifiers.',\n );\n });\n const constant = node.typeParameters?.params.find((parameter) => parameter.const);\n if (constant)\n this.raise(\n constant.start,\n 'Associated-value enum type parameters cannot have const/in/out modifiers.',\n );\n node.braceStart = this.start;\n this.expect(tt.braceL);\n node.cases = [];\n const names = new Set();\n while (this.type !== tt.braceR) {\n const branch = this.startNode();\n this.expect(tt._case);\n branch.id = this.parseIdent();\n if (names.has(branch.id.name)) this.raise(branch.id.start, 'Duplicate enum case.');\n names.add(branch.id.name);\n branch.params = [];\n branch.hasParens = this.eat(tt.parenL);\n if (branch.hasParens) {\n const fields = new Set();\n while (this.type !== tt.parenR) {\n const field = this.parseIdent();\n this.checkLValSimple(field);\n if (field.name === 'kind')\n this.raise(\n field.start,\n 'Enum payload fields cannot use the discriminator name kind.',\n );\n if (fields.has(field.name)) this.raise(field.start, 'Duplicate enum payload field.');\n fields.add(field.name);\n if (this.type !== tt.colon)\n this.raise(\n this.start,\n 'Enum payload fields require a name and type; optional/default/rest fields are unsupported.',\n );\n field.typeAnnotation = this.tsParseTypeAnnotation();\n branch.params.push(field);\n if (!this.eat(tt.comma)) break;\n }\n this.expect(tt.parenR);\n }\n branch.valueEnd = this.lastTokEnd;\n this.semicolon();\n node.cases.push(this.finishNode(branch, 'TwillEnumCase'));\n }\n if (!node.cases.length)\n this.raise(node.start, 'An associated-value enum needs at least one case.');\n this.next();\n return this.finishNode(node, 'TwillEnumDeclaration');\n }\n\n locate(offset) {\n if (!this.lineStarts) {\n this.lineStarts = [0];\n const breaks = /\\r\\n?|\\n|\\u2028|\\u2029/g;\n let match;\n while ((match = breaks.exec(this.input))) this.lineStarts.push(breaks.lastIndex);\n }\n let low = 0;\n let high = this.lineStarts.length;\n while (low + 1 < high) {\n const mid = (low + high) >>> 1;\n if (this.lineStarts[mid] <= offset) low = mid;\n else high = mid;\n }\n return { line: low + 1, column: offset - this.lineStarts[low] };\n }\n\n parseStatement(context, ...args) {\n if (this.isContextual('defer') && deferAt(this.input, this.end)) {\n // A newline leaves an ordinary identifier expression and separate JS\n // block. Calls, member access, assignments and labels are unchanged.\n const node = this.startNode();\n const async = this.canAwait;\n this.next();\n const enclosing = this.implicitClosure;\n const implicit =\n enclosing && this.currentVarScope() === this.scopeStack[enclosing.scopeIndex]\n ? enclosing\n : null;\n const previousScope = implicit?.scopeIndex;\n if (implicit) implicit.scopeIndex = this.scopeStack.length;\n let cleanup;\n try {\n // A defer body captures its enclosing callback's receiver, like a\n // named parameter. Ordinary nested functions remain separate scopes.\n cleanup = this.parseArrowExpression(this.startNode(), [], async, false);\n } finally {\n if (implicit) implicit.scopeIndex = previousScope;\n }\n node.awaited = awaits(cleanup.body);\n cleanup.async = node.awaited;\n node.cleanup = cleanup;\n return this.finishNode(node, 'DeferStatement');\n }\n if (!this.isContextual('guard') || !guardAt(this.input, this.end, !!this.implicitClosure)) {\n const statement = super.parseStatement(context, ...args);\n if (context && statement.type === 'TwillEnumDeclaration')\n this.raise(\n statement.start,\n 'An associated-value enum requires a block; add braces around this body.',\n );\n return statement;\n }\n const node = this.startNode();\n node.singleStatement = !!context;\n this.next();\n node.binding = null;\n if (this.type === tt._const) {\n if (context)\n this.raise(node.start, 'A guard binding requires a block; add braces around this body.');\n const declaration = this.startNode();\n this.next();\n this.parseVar(declaration, false, 'const');\n node.binding = this.finishNode(declaration, 'VariableDeclaration');\n if (node.binding.declarations.length !== 1)\n this.raise(node.start, 'guard const requires one binding declaration.');\n } else node.test = this.parseExpression();\n node.elseStart = this.start;\n this.expect(tt._else);\n if (this.type !== tt.braceL) this.unexpected();\n node.failure = this.parseBlock();\n if (!exits(node.failure))\n this.raise(\n node.failure.start,\n 'Every guard else path must exit with return, throw, break or continue.',\n );\n return this.finishNode(node, 'GuardStatement');\n }\n\n parseIfStatement(node) {\n // Native parenthesized if statements keep the host parser's contract.\n // Look only for the new binding introducer; lexical errors belong to\n // the main parser so their offsets remain absolute.\n if (/^\\s*\\(/.test(this.input.slice(this.end))) return super.parseIfStatement(node);\n let binding;\n try {\n binding = Parser.tokenizer(this.input.slice(this.end), options).getToken().type;\n } catch {}\n if (binding !== tt._const) return super.parseIfStatement(node);\n this.next();\n const declaration = this.startNode();\n this.next();\n this.enterScope(0);\n const previous = this.conditionDepth;\n this.conditionDepth = this.subscriptDepth;\n try {\n this.parseVar(declaration, false, 'const');\n } finally {\n this.conditionDepth = previous;\n }\n node.binding = this.finishNode(declaration, 'VariableDeclaration');\n if (node.binding.declarations.length !== 1)\n this.raise(node.start, 'if const requires one binding declaration.');\n if (this.type !== tt.braceL)\n this.raise(this.start, 'if const requires a braced success branch.');\n // The binding and success body share a scope; else belongs to the outer\n // scope. The initializer's references are checked in the lowered outer\n // scope, before the successful const declaration exists.\n node.consequent = this.parseBlock(false);\n this.exitScope();\n node.alternate = null;\n if (this.eat(tt._else)) {\n if (this.type !== tt.braceL && this.type !== tt._if)\n this.raise(this.start, 'if const else requires a block or another if.');\n node.alternate = this.parseStatement('if');\n }\n return this.finishNode(node, 'TwillIfBinding');\n }\n\n tsParseTypeParameter(...args) {\n const start = this.start;\n const loc = this.startLoc;\n const constant = this.type === tt._const;\n if (constant) this.next();\n const parameter = super.tsParseTypeParameter(...args);\n if (constant) {\n parameter.const = true;\n parameter.start = start;\n parameter.loc.start = loc;\n }\n return parameter;\n }\n\n parseExprSubscripts(...args) {\n this.subscriptDepth++;\n try {\n return super.parseExprSubscripts(...args);\n } finally {\n this.subscriptDepth--;\n }\n }\n\n parseClassSuper(...args) {\n const previous = this.classSuperDepth;\n this.classSuperDepth = this.subscriptDepth;\n try {\n return super.parseClassSuper(...args);\n } finally {\n this.classSuperDepth = previous;\n }\n }\n\n parseClassElement(...args) {\n const previous = this.derivedClassElement;\n this.derivedClassElement = !!args[0];\n try {\n return super.parseClassElement(...args);\n } finally {\n this.derivedClassElement = previous;\n }\n }\n\n raise(position, message, ...args) {\n // acorn-typescript 1.4.13 inverts the subclass check for `override`.\n // Permit this valid syntax; TypeScript still checks override semantics.\n if (\n language.startsWith('ts') &&\n this.derivedClassElement &&\n typeof message === 'string' &&\n message.includes(\"cannot have an 'override' modifier\")\n )\n return;\n return super.raise(position, message, ...args);\n }\n\n readToken(code) {\n // acorn-typescript enables JSX by default. Plain .twill follows TypeScript's\n // non-JSX grammar, including angle-bracket assertions.\n if (language === 'ts' && code === 60 && !this.inType && this.exprAllowed)\n return this.readToken_lt_gt(code);\n return super.readToken(code);\n }\n\n parseExprAtom(...args) {\n if (this.type === tt.dot) {\n const closure = this.implicitClosure;\n if (!closure || this.currentVarScope() !== this.scopeStack[closure.scopeIndex])\n this.raise(\n this.start,\n 'Implicit member access requires a trailing closure without a parameter header.',\n );\n // A zero-width receiver lets Acorn parse the original dot/property chain.\n // The compiler supplies one hygienic parameter; property tokens stay mapped.\n const node = this.startNode();\n node.name = '__twillImplicit';\n closure.members.push(node);\n return this.finishNodeAt(node, 'Identifier', this.start, this.startLoc);\n }\n if (this.type === tt._switch) return this.parseSwitchExpression();\n if (language === 'ts' && this.type === tt.relational && this.value === '<') {\n const node = this.startNode();\n this.tsInType(() => {\n this.next();\n node.typeAnnotation = this.tsParseType();\n if (!this.tsMatchRightRelational()) this.unexpected();\n this.next();\n });\n node.expression = this.parseMaybeUnary(null, false, false, args[1]);\n // Let the TS plugin backtrack and recognize a generic arrow function.\n if (node.expression.type === 'ArrowFunctionExpression') this.unexpected(node.start);\n return this.finishNode(node, 'TSTypeAssertion');\n }\n return super.parseExprAtom(...args);\n }\n\n parseSwitchExpression(call) {\n const node = call ? this.startNodeAt(call.start, call.loc.start) : this.startNode();\n node.keyword = call ? 'match' : 'switch';\n if (call) {\n if (call.arguments.length !== 1 || call.arguments[0].type === 'SpreadElement')\n this.raise(\n call.start,\n 'A match expression requires one subject; parenthesize comma expressions.',\n );\n const opening = Parser.tokenizer(this.input.slice(call.callee.end), options).getToken();\n node.parenStart = call.callee.end + opening.start;\n node.discriminant = call.arguments[0];\n node.parenEnd = call.end - 1;\n } else {\n this.next();\n node.parenStart = this.start;\n node.discriminant = this.parseParenExpression();\n node.parenEnd = this.lastTokStart;\n }\n this.expect(tt.braceL);\n node.cases = [];\n let mode,\n discriminator,\n sawDefault = false;\n while (this.type !== tt.braceR) {\n const branch = this.startNode();\n const isCase = this.type === tt._case;\n if (!isCase && this.type !== tt._default) this.unexpected();\n this.next();\n this.enterScope(0); // Each expression arm has its own lexical bindings.\n if (!isCase) {\n if (sawDefault) this.raise(branch.start, 'Multiple default clauses.');\n sawDefault = true;\n branch.test = null;\n } else if (\n (call && this.type !== tt.braceL) ||\n (!call && this.type.label === 'name' && this.value === 'enum' && !this.containsEsc)\n ) {\n if (mode === 'value')\n this.raise(branch.start, 'Cannot mix enum patterns and value cases.');\n if (discriminator !== undefined && discriminator !== 'kind')\n this.raise(branch.start, 'Enum patterns require the kind discriminator.');\n mode = 'pattern';\n discriminator = 'kind';\n const pattern = this.startNode();\n pattern.explicitKeyword = !call;\n if (!call) this.next();\n let reference = this.parseIdent();\n while (this.eat(tt.dot)) {\n const member = this.startNodeAt(reference.start, reference.loc.start);\n member.object = reference;\n member.property = this.parseIdent(true);\n member.computed = false;\n member.optional = false;\n reference = this.finishNode(member, 'MemberExpression');\n }\n if (reference.type !== 'MemberExpression')\n this.raise(reference.start, 'An enum pattern requires a qualified case reference.');\n pattern.reference = reference;\n pattern.parenStart = this.start;\n this.expect(tt.parenL);\n if (this.type === tt.braceL) {\n pattern.binding = this.parseObj(true);\n this.checkLValPattern(pattern.binding, 2, false);\n }\n pattern.parenEnd = this.start;\n this.expect(tt.parenR);\n branch.enumPattern = this.finishNode(pattern, 'TwillEnumPattern');\n } else if (this.type === tt.braceL) {\n if (mode === 'value')\n this.raise(branch.start, 'Cannot mix object patterns and value cases.');\n mode = 'pattern';\n const errors = {\n shorthandAssign: -1,\n trailingComma: -1,\n parenthesizedAssign: -1,\n parenthesizedBind: -1,\n doubleProto: -1,\n };\n const pattern = this.parseObj(false, errors);\n const tags = pattern.properties.filter(\n (property) =>\n property.type === 'Property' &&\n !property.computed &&\n !property.method &&\n property.kind === 'init' &&\n ((property.value.type === 'Literal' && !property.value.regex) ||\n (property.value.type === 'UnaryExpression' &&\n ['+', '-'].includes(property.value.operator) &&\n property.value.argument.type === 'Literal' &&\n typeof property.value.argument.value === 'number')),\n );\n if (tags.length !== 1)\n this.raise(\n pattern.start,\n 'An object case needs exactly one literal discriminator; other properties bind values.',\n );\n const tag = tags[0];\n const key = String(tag.key.name ?? tag.key.value);\n if (discriminator !== undefined && key !== discriminator)\n this.raise(tag.start, 'Object cases must use the same discriminator property.');\n discriminator = key;\n pattern.properties = pattern.properties.filter((property) => property !== tag);\n this.toAssignable(pattern, true, errors);\n this.checkLValPattern(pattern, 2, false);\n pattern.properties.push(tag);\n pattern.properties.sort((a, b) => a.start - b.start);\n branch.pattern = pattern;\n branch.tag = tag;\n } else {\n if (mode === 'pattern')\n this.raise(branch.start, 'Cannot mix object patterns and value cases.');\n mode = 'value';\n branch.test = this.parseExpression();\n }\n branch.colonStart = this.start;\n this.expect(tt.colon);\n if (this.type === tt._throw) {\n const thrown = this.parseThrowStatement(this.startNode());\n branch.value = thrown.argument;\n branch.throw = true;\n branch.valueEnd = thrown.end;\n } else {\n branch.value = this.parseMaybeAssign();\n branch.valueEnd = this.lastTokEnd;\n this.semicolon();\n }\n this.exitScope();\n node.cases.push(this.finishNode(branch, 'TwillSwitchCase'));\n }\n this.next();\n if (!node.cases.length)\n this.raise(node.start, `A ${node.keyword} expression requires at least one arm.`);\n node.discriminator = discriminator;\n return this.finishNode(node, 'TwillSwitchExpression');\n }\n\n next(...args) {\n super.next(...args);\n if (this.skipHeader !== null) {\n const end = this.skipHeader;\n this.skipHeader = null;\n while (this.start < end && this.type !== tt.eof) super.next(...args);\n }\n }\n\n parseTrailingClosure(callee, label) {\n const start = this.start;\n const header = headerAt(this.input, this.end);\n let params = [];\n let async = false;\n let parameterText = '()';\n if (header) {\n let text = header.text.trim();\n async = header.async;\n if (async) text = text.replace(/^async\\s+/, '');\n parameterText = text.startsWith('(') ? text : `(${text})`;\n const prefix = async ? 'async ' : '';\n try {\n const arrow = Base.parse(`${prefix}${parameterText} => {}`, {\n ...options,\n sourceType: this.options.sourceType,\n }).body[0].expression;\n params = arrow.params;\n const sourceStart = header.textStart + header.text.indexOf(text);\n const addedParen = text.startsWith('(') ? 0 : 1;\n params.forEach((param) =>\n moveNodes(param, sourceStart - prefix.length - addedParen, (offset) =>\n this.locate(offset),\n ),\n );\n } catch (error) {\n this.raise(start, `Invalid trailing closure parameters: ${error.message}`);\n }\n }\n const node = this.startNode();\n // parseArrowExpression supplies the real function scope, including return,\n // await, lexical this/super, duplicate bindings and strict-mode checks.\n this.skipHeader = header?.end ?? null;\n const previous = this.implicitClosure;\n const implicit = header ? null : { scopeIndex: this.scopeStack.length, members: [] };\n this.implicitClosure = implicit;\n let arrow;\n try {\n arrow = this.parseArrowExpression(node, params, async, false);\n } finally {\n this.implicitClosure = previous;\n }\n this.closures.push({\n node: arrow,\n callee,\n label,\n header,\n parameterText,\n async,\n implicitMembers: implicit?.members ?? [],\n });\n return arrow;\n }\n\n parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {\n // The TS parser treats a same-line brace after type arguments as an\n // expression operand. In this dialect it can instead begin the callback.\n const classBody =\n this.classSuperDepth !== null && this.subscriptDepth === this.classSuperDepth + 1;\n // Inspect only the arm-leading token after the ordinary call parser has\n // parsed the subject once. Native calls/TSX subjects and trailing closures\n // named match remain intact; case/default cannot start a native callback.\n if (\n !noCalls &&\n !classBody &&\n this.type === tt.braceL &&\n base.type === 'CallExpression' &&\n !base.optional &&\n !base.typeParameters &&\n base.callee.type === 'Identifier' &&\n base.callee.name === 'match' &&\n base.callee.start === base.start &&\n this.input.slice(base.callee.start, base.callee.end) === 'match'\n ) {\n let first;\n try {\n first = Parser.tokenizer(this.input.slice(this.end), options).getToken().type;\n } catch {\n // The main parser reports lexical errors at their original offsets,\n // rather than the lookahead tokenizer's relative slice positions.\n }\n if (first === tt._case || first === tt._default) return this.parseSwitchExpression(base);\n }\n if (!noCalls && !classBody && this.tsMatchLeftRelational?.() && this.start === base.end) {\n const parameters = this.tsTryParseAndCatch(() => {\n const parsed = this.tsParseTypeArgumentsInExpression();\n return parsed &&\n this.type === tt.braceL &&\n !/[\\r\\n\\u2028\\u2029]/.test(this.input.slice(parsed.end, this.start))\n ? parsed\n : undefined;\n });\n if (parameters) {\n const instantiation = this.startNodeAt(startPos, startLoc);\n instantiation.expression = base;\n instantiation.typeParameters = parameters;\n base = this.finishNode(instantiation, 'TSInstantiationExpression');\n }\n }\n const supported = [\n 'CallExpression',\n 'Identifier',\n 'MemberExpression',\n 'TSInstantiationExpression',\n ].includes(base.type);\n // Swift separates statement conditions from ordinary expressions. At\n // condition depth, the brace starts the statement body. Parentheses and\n // arguments enter deeper expression contexts and retain trailing calls.\n const conditionBody =\n this.conditionDepth !== null && this.subscriptDepth === this.conditionDepth + 1;\n if (conditionBody && this.type === tt.braceL) return base;\n // Only the outer heritage expression owns the class body brace. Nested\n // calls, parenthesized expressions and computed lookups allow callbacks.\n if (!noCalls && supported && this.type === tt.braceL && !classBody) {\n if (base.trailing)\n this.raise(\n this.start,\n 'Additional trailing closures require labels (for example completion: { ... }).',\n );\n // Bare names on a new line remain ordinary JavaScript statements.\n if (base.type !== 'CallExpression' && /[\\r\\n]/.test(this.input.slice(base.end, this.start)))\n return base;\n const hadParens = base.type === 'CallExpression' && base.end === this.lastTokEnd;\n const callee = hadParens\n ? base.callee\n : base.type === 'TSInstantiationExpression'\n ? base.expression\n : base;\n const node = this.startNodeAt(startPos, startLoc);\n node.callee = callee;\n node.arguments = hadParens ? [...base.arguments] : [];\n node.optional = base.optional ?? false;\n if ((hadParens || base.type === 'TSInstantiationExpression') && base.typeParameters)\n node.typeParameters = base.typeParameters;\n const callEnd = this.lastTokEnd;\n const args = [this.parseTrailingClosure(callee, null)];\n while (this.type === tt.name) {\n const tail = this.input.slice(this.end);\n // Only recognize a label when a colon and opening brace follow it.\n const lexer = Parser.tokenizer(tail, options);\n const colon = lexer.getToken();\n if (colon.type !== tt.colon || lexer.getToken().type !== tt.braceL) break;\n const label = { name: this.value, start: this.start, end: this.end };\n this.next();\n this.expect(tt.colon);\n args.push(this.parseTrailingClosure(callee, label));\n }\n node.arguments.push(...args);\n node.trailing = {\n callEnd,\n hadParens,\n originalArgs: hadParens ? base.arguments : [],\n closures: args,\n };\n return this.finishNode(node, 'CallExpression');\n }\n return super.parseSubscript(\n base,\n startPos,\n startLoc,\n noCalls,\n maybeAsyncArrow,\n optionalChained,\n forInit,\n );\n }\n }\n parsers.set(language, TwillParser);\n return TwillParser;\n}\n\nexport function parse(source, language = 'ts', sourceType = 'module') {\n const TwillParser = parserFor(language);\n const comments = [];\n const parser = new TwillParser(\n { ...options, sourceType, allowHashBang: true, onComment: comments },\n source,\n );\n const ast = parser.parse();\n const live = new Set();\n const calls = [];\n const guards = [];\n const ifBindings = [];\n const defers = [];\n const switches = [];\n const enums = [];\n const visit = (node) => {\n if (!node || typeof node !== 'object') return;\n if (\n node.type === 'ArrowFunctionExpression' ||\n (node.type === 'Identifier' && node.start === node.end && node.name === '__twillImplicit')\n )\n live.add(node);\n if (node.trailing) calls.push(node);\n if (node.type === 'GuardStatement') guards.push(node);\n if (node.type === 'TwillIfBinding') ifBindings.push(node);\n if (node.type === 'DeferStatement') defers.push(node);\n if (node.type === 'TwillSwitchExpression') switches.push(node);\n if (node.type === 'TwillEnumDeclaration') enums.push(node);\n for (const key of Object.keys(node)) {\n if (key === 'trailing' || key === 'loc') continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const child of value) visit(child);\n } else if (value?.type) visit(value);\n }\n };\n visit(ast);\n return {\n ast,\n calls,\n guards,\n ifBindings,\n defers,\n switches,\n enums,\n comments,\n closures: parser.closures\n .filter((closure) => live.has(closure.node))\n .map((closure) => ({\n ...closure,\n // TS backtracking can discard tentative expression parses. Only receivers\n // reachable in the final tree may add a parameter or source insertion.\n implicitMembers: closure.implicitMembers\n .filter((node) => live.has(node))\n .map((node) => node.start),\n })),\n };\n}\n","// Generated by scripts/generate-runtime-helper.mjs from runtime helper ABI v1.\n// Source SHA-256: d1a6b960405fad1da869b081aac018695b28372341cad8a077caa645310f32ef\n// Edit packages/runtime/src/helpers/v1.js, then regenerate.\nexport function syncDeferBody(\n names: Record<'stack' | 'failed' | 'failure' | 'cleanup' | 'error', string>,\n): string {\n return (\n '\\n let ' +\n names.failed +\n ' = false,\\n ' +\n names.failure +\n ';\\n while (' +\n names.stack +\n '?.length) {\\n const ' +\n names.cleanup +\n ' = ' +\n names.stack +\n '.pop();\\n if (' +\n names.cleanup +\n ') {\\n try {\\n ' +\n names.cleanup +\n '();\\n } catch (' +\n names.error +\n ') {\\n ' +\n names.failed +\n ' = true;\\n ' +\n names.failure +\n ' = ' +\n names.error +\n ';\\n }\\n }\\n }\\n if (' +\n names.failed +\n ') throw ' +\n names.failure +\n ';\\n'\n );\n}\n","import MagicString from 'magic-string';\nimport type { Language } from './compiler.js';\nimport { syncDeferBody } from './defer-helper.js';\n\ntype Node = { type: string; start: number; end: number; [key: string]: any };\ntype Comment = { start: number; end: number; value: string; type: string };\ntype Scope = { block: Node; functionBody: boolean; defers: Node[] };\nconst functions = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\n\nfunction children(node: Node, visit: (child: Node) => void) {\n for (const key of Object.keys(node)) {\n if (key === 'loc' || key === 'trailing') continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (child?.type) visit(child);\n }\n } else if (value?.type) visit(value);\n }\n}\n\n/** Native finally where scope permits; callbacks retain dynamic registration semantics. */\nexport function lowerDefers(\n source: string,\n ast: Node,\n code: MagicString,\n language: Language,\n usedNames: Set<string>,\n contentStarts: Map<Node, number>,\n comments: Comment[],\n runtime: 'inline' | 'external',\n sourceType: 'module' | 'script',\n fail: (node: Node, message: string) => never,\n) {\n const scopes: Scope[] = [];\n const visit = (node: Node, scope: Scope | undefined, parent?: Node) => {\n if (functions.has(node.type) || ['Program', 'TSModuleBlock', 'SwitchCase'].includes(node.type))\n scope = undefined;\n if (node.type === 'BlockStatement' || node.type === 'StaticBlock') {\n scope = {\n block: node,\n functionBody: !!parent && functions.has(parent.type) && parent.body === node,\n defers: [],\n };\n scopes.push(scope);\n }\n if (node.type === 'DeferStatement') {\n if (!scope)\n fail(\n node,\n 'defer requires an explicit block or function body; wrap a switch case in braces.',\n );\n scope.defers.push(node);\n const check = (item: Node) => {\n if (functions.has(item.type)) return;\n if (item.type === 'ReturnStatement')\n fail(\n item,\n 'A defer cleanup cannot return; use a nested function for local early returns.',\n );\n children(item, check);\n };\n check(node.cleanup.body);\n }\n children(node, (child) => visit(child, scope, node));\n };\n visit(ast, undefined);\n let counter = 0;\n const fresh = (part: string) => {\n let name: string;\n do name = `__twill${part}${counter++}`;\n while (usedNames.has(name));\n usedNames.add(name);\n return name;\n };\n const sortedComments = [...comments].sort((a, b) => b.end - a.end);\n const leadingComment = (statement: Node, minimum: number) => {\n let start = statement.start;\n // Move adjacent JSDoc with hoisted function initializers, retaining checkJs\n // annotations. Comments emitted during TS backtracking may be duplicated.\n for (const comment of sortedComments) {\n if (comment.end > start || comment.start < minimum) continue;\n if (/\\S/.test(source.slice(comment.end, start))) break;\n if (comment.type === 'Block' && comment.value.startsWith('*')) start = comment.start;\n else break;\n }\n return start;\n };\n let sharedHelper: string | undefined;\n for (const scope of scopes) {\n if (!scope.defers.length) continue;\n const { block } = scope;\n const statements = block.body as Node[];\n // A direct synchronous cleanup can be the original finally body. Moving\n // lexical declarations into a new try would change TDZ/closure visibility;\n // retain the callback lowering whenever that or hoisting is observable.\n const first = statements.indexOf(scope.defers[0]!);\n let native =\n first >= 0 && scope.defers.every((node) => !node.awaited && statements.includes(node));\n if (native) {\n native = !statements.some(\n (node, index) =>\n node.type === 'FunctionDeclaration' ||\n node.type === 'TSDeclareFunction' ||\n (node.type === 'VariableDeclaration' && node.kind.endsWith('using')) ||\n (index > first &&\n ((node.type === 'VariableDeclaration' && node.kind !== 'var') ||\n (node.type.endsWith('Declaration') && node.type !== 'VariableDeclaration') ||\n (node.type === 'GuardStatement' && node.binding))),\n );\n const check = (node: Node) => {\n if (\n node.type === 'WithStatement' ||\n node.type === 'ThisExpression' ||\n (node.type === 'VariableDeclarator' && !node.init) ||\n (node.type === 'VariableDeclaration' &&\n node.kind === 'var' &&\n (!statements.includes(node) || node.start > scope.defers[0]!.start)) ||\n (node.type === 'CallExpression' &&\n node.callee.type === 'Identifier' &&\n node.callee.name === 'eval')\n )\n native = false;\n children(node, check);\n };\n if (native) check(block);\n const cleanupScope = (node: Node) => {\n if (\n node.type === 'FunctionDeclaration' ||\n node.directive ||\n (node.type === 'VariableDeclaration' && node.kind === 'var')\n )\n native = false;\n if (!functions.has(node.type)) children(node, cleanupScope);\n };\n if (native) for (const node of scope.defers) cleanupScope(node.cleanup.body);\n }\n if (native) {\n for (const node of [...scope.defers].reverse()) {\n code.overwrite(node.start, node.cleanup.body.start, ';try {');\n if (!node.cleanup.body.body.length) {\n // Empty cleanup has no executable tokens to map. Keep its comments,\n // but mark the emitted empty finally as scaffolding for source lint.\n code.remove(node.cleanup.body.start, node.cleanup.body.end);\n code.appendLeft(\n block.end - 1,\n '\\n} finally ' + source.slice(node.cleanup.body.start, node.cleanup.body.end) + '\\n',\n );\n continue;\n }\n code.prependRight(node.cleanup.body.start, '\\n} finally ');\n code.appendLeft(node.cleanup.body.end, '\\n');\n if (node.cleanup.body.end !== block.end - 1)\n code.move(node.cleanup.body.start, node.cleanup.body.end, block.end - 1);\n }\n continue;\n }\n // A direct statement executes at most once per block entry. Nested or\n // unbraced-loop registrations still require the dynamic stack.\n const single = scope.defers.length === 1 && statements.includes(scope.defers[0]!);\n const stack = fresh(single ? 'Cleanup' : 'Defers');\n const failure = single ? '' : fresh('Failure');\n const failed = single ? '' : fresh('Failed');\n const callback = single ? stack : fresh('Cleanup');\n const error = single ? '' : fresh('Error');\n const anyAsync = scope.defers.some((node) => node.awaited);\n const allAsync = scope.defers.every((node) => node.awaited);\n const mixed = anyAsync && !allAsync;\n const callbackType = mixed ? '{ run: () => unknown; async: boolean }' : '() => unknown';\n const storageType = single\n ? '(() => unknown) | undefined'\n : `Array<${callbackType}> | undefined`;\n const annotation = language.startsWith('ts') ? `: ${storageType}` : '';\n const jsdoc = language.startsWith('js') ? `\\n/** @type {${storageType}} */\\n` : '';\n let start = contentStarts.get(block) ?? block.start + 1;\n // StaticBlock.start includes the `static` token, unlike BlockStatement.\n if (block.type === 'StaticBlock') start = statements[0]!.start;\n let index = 0;\n while (statements[index]?.directive) start = statements[index++]!.end;\n const ordinary = statements.slice(index);\n const declarations = scope.functionBody\n ? ordinary.filter((node) => node.type === 'FunctionDeclaration')\n : [];\n if (scope.functionBody && ordinary.some((node) => node.type === 'TSDeclareFunction'))\n fail(\n ordinary.find((node) => node.type === 'TSDeclareFunction')!,\n 'Function overloads/ambient function declarations in a defer scope are not supported; move them to a separate scope.',\n );\n const names = [...new Set(declarations.map((node) => node.id.name as string))];\n code.prependLeft(\n start,\n `;${jsdoc}let ${stack}${annotation};${names.length ? `var ${names.join(',')};` : ''}try {\\n`,\n );\n // Function-body declarations bind like var, including parameter aliases.\n // Initializers stay in the try's lexical environment so they still capture\n // let/const declared anywhere in the original body. Preserve the name token\n // and parameter/body tokens rather than regenerating function source.\n let anchor = start;\n const initial = new Set<Node>();\n for (const statement of ordinary) {\n if (statement.type !== 'FunctionDeclaration') break;\n initial.add(statement);\n anchor = statement.end;\n }\n for (const declaration of declarations) {\n const commentStart = leadingComment(declaration, start);\n if (!initial.has(declaration)) code.move(commentStart, declaration.end, anchor);\n if (commentStart < declaration.start) code.prependLeft(commentStart, '\\n');\n code.move(declaration.start, declaration.id.start, declaration.id.end);\n code.appendLeft(declaration.id.end, ' = ');\n code.appendLeft(declaration.end, ';');\n }\n for (const node of scope.defers) {\n const arrow = `${node.awaited ? 'async ' : ''}() => `;\n const prefix = single\n ? `${stack} = ${arrow}`\n : `(${stack} ??= []).push(${mixed ? `{ async: ${node.awaited}, run: ` : ''}${arrow}`;\n code.overwrite(node.start, node.cleanup.body.start, prefix);\n code.appendLeft(node.end, single ? ';' : `${mixed ? '}' : ''});`);\n }\n if (single) {\n // Guard the await as well as the call: unreached async cleanup must not\n // add a microtask turn. Native finally preserves all completion kinds.\n const call = allAsync ? `if (${stack}) await ${stack}();` : `${stack}?.();`;\n code.appendLeft(block.end - 1, `\\n} finally { ${call} }\\n`);\n continue;\n }\n if (!anyAsync) {\n let body: string;\n if (runtime === 'external') {\n if (sourceType !== 'module')\n fail(\n scope.defers[0]!,\n 'External runtime helpers require module sourceType; use runtime: inline for scripts.',\n );\n sharedHelper ??= fresh('RunDefers');\n body = `${sharedHelper}(${stack});`;\n } else body = syncDeferBody({ stack, failed, failure, cleanup: callback, error });\n code.appendLeft(block.end - 1, `} finally { ${body} }`);\n continue;\n }\n const call = mixed\n ? `if (${callback}.async) await ${callback}.run(); else ${callback}.run();`\n : `${allAsync ? 'await ' : ''}${callback}();`;\n // Nested-finally semantics: every registered cleanup runs, and the last\n // cleanup failure replaces an earlier cleanup/body failure (even undefined).\n code.appendLeft(\n block.end - 1,\n `} finally { let ${failed} = false, ${failure}; while (${stack}?.length) { const ${callback} = ${stack}.pop(); if (${callback}) { try { ${call} } catch (${error}) { ${failed} = true; ${failure} = ${error}; } } } if (${failed}) throw ${failure}; }`,\n );\n }\n if (sharedHelper) {\n // Keep shebangs, file pragmas and the directive prologue before imports.\n // An adjacent declaration JSDoc/suppression stays with its original node.\n const statement = ast.body.find((node: Node) => !node.directive)!;\n let start = statement.start;\n for (const comment of sortedComments) {\n if (comment.end > start) continue;\n if (/\\S/.test(source.slice(comment.end, start))) break;\n if (\n (source.startsWith('/**', comment.start) ||\n /@ts-(?:ignore|expect-error)\\b/.test(comment.value)) &&\n !/@(?:ts-(?:check|nocheck)|jsxImportSource|jsxRuntime)\\b/.test(comment.value)\n )\n start = comment.start;\n else break;\n }\n code.prependLeft(\n start,\n `\\nimport { runDefers as ${sharedHelper} } from '@swiftuijs/twill-runtime/helpers/v1';\\n`,\n );\n }\n}\n","import MagicString from 'magic-string';\nimport { Parser, tokTypes } from 'acorn';\nimport type { Language } from './compiler.js';\n\ntype Node = { type: string; start: number; end: number; [key: string]: any };\nfunction suspension(node: Node): Node | undefined {\n if (['AwaitExpression', 'YieldExpression'].includes(node.type)) return node;\n if (['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression'].includes(node.type))\n return;\n for (const [key, value] of Object.entries(node)) {\n if (['loc', 'trailing', 'tag'].includes(key)) continue;\n for (const child of Array.isArray(value) ? value : [value]) {\n if (child?.type) {\n const found = suspension(child);\n if (found) return found;\n }\n }\n }\n}\n\n/** Native switches with per-arm scopes. Direct returns and standalone variable\n * initializers need no extra function; other expressions keep a lexical IIFE. */\nexport function lowerSwitchExpressions(\n source: string,\n ast: Node,\n switches: Node[],\n code: MagicString,\n language: Language,\n usedNames: Set<string>,\n comments: { start: number; end: number }[],\n fail: (node: Node, message: string) => never,\n) {\n const returns = new Set<Node>();\n const initializers = new Map<Node, { declaration: Node; statement: Node; prefixStart: number }>();\n const leadingDoc = (start: number) => {\n let low = 0,\n high = comments.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n if (comments[middle]!.end <= start) low = middle + 1;\n else high = middle;\n }\n const comment = comments[low - 1];\n return comment && /^\\s*$/.test(source.slice(comment.end, start)) ? comment : undefined;\n };\n const directEval = (node: Node): boolean => {\n if (\n ['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression'].includes(node.type)\n )\n return false;\n if (\n node.type === 'CallExpression' &&\n node.callee.type === 'Identifier' &&\n node.callee.name === 'eval' &&\n !node.optional\n )\n return true;\n return Object.entries(node).some(\n ([key, value]) =>\n !['loc', 'trailing', 'tag'].includes(key) &&\n (Array.isArray(value) ? value : [value]).some((child) => child?.type && directEval(child)),\n );\n };\n const grouping = (start: number, end: number, initializer = false) => {\n const parentheses: { start: number; end: number }[] = [];\n const tokens = Parser.tokenizer(source.slice(start, end), { ecmaVersion: 'latest' });\n for (;;) {\n const token = tokens.getToken();\n if (token.type === tokTypes.eof) break;\n if (initializer && token.type === tokTypes.eq) parentheses.length = 0;\n if (token.type === tokTypes.parenL || token.type === tokTypes.parenR) parentheses.push(token);\n }\n for (const token of parentheses) {\n code.remove(start + token.start, start + token.end);\n }\n };\n const visit = (node: Node, parent?: Node) => {\n if (node.type === 'VariableDeclaration' && node.declarations.length === 1) {\n const declaration = node.declarations[0];\n if (\n declaration.id.type === 'Identifier' &&\n declaration.init?.type === 'TwillSwitchExpression' &&\n ['Program', 'BlockStatement', 'SwitchCase', 'ExportNamedDeclaration'].includes(\n parent?.type ?? '',\n )\n ) {\n const statement = parent?.type === 'ExportNamedDeclaration' ? parent : node;\n const comment = leadingDoc(statement.start);\n const prefixStart =\n comment && source.startsWith('/**', comment.start) ? comment.start : statement.start;\n const pragma =\n comment &&\n /@ts-(?:ignore|expect-error|nocheck|check)\\b/.test(\n source.slice(comment.start, comment.end),\n );\n // A direct eval can observe the old wrapper's function scope. JS JSDoc\n // contextual typing also stays on the existing expression path.\n if (\n !pragma &&\n !directEval(declaration.init) &&\n (language.startsWith('ts') || prefixStart === statement.start)\n )\n initializers.set(declaration.init, { declaration, statement, prefixStart });\n }\n }\n if (node.type === 'ReturnStatement' && node.argument?.type === 'TwillSwitchExpression') {\n returns.add(node.argument);\n code.remove(node.start, node.start + 6);\n // Acorn omits grouping parentheses from expression node ranges.\n // Preserve comments while removing only the return's outer grouping.\n for (const [start, end] of [\n [node.start + 6, node.argument.start],\n [node.argument.end, node.end],\n ]) {\n grouping(start, end);\n }\n }\n for (const [key, value] of Object.entries(node)) {\n if (['loc', 'trailing', 'tag'].includes(key)) continue;\n for (const child of Array.isArray(value) ? value : [value])\n if (child?.type) visit(child, node);\n }\n };\n visit(ast);\n let counter = 0;\n const fresh = (part: string) => {\n let name: string;\n do name = `__twill${part}${counter++}`;\n while (usedNames.has(name));\n usedNames.add(name);\n return name;\n };\n for (const node of switches) {\n const direct = returns.has(node);\n const suspended = !direct && suspension(node);\n if (suspended)\n fail(\n suspended,\n `await/yield inside a ${node.keyword} expression requires a direct return. Bind the subject first, or await the whole result explicitly.`,\n );\n const initializer = initializers.get(node);\n const result = initializer ? fresh('Result') : undefined;\n const exit = initializer ? fresh('Exit') : undefined;\n const subject = fresh('Subject');\n if (initializer) {\n const { declaration, statement, prefixStart } = initializer;\n // Keep the user's const/let/var declaration and its TDZ unchanged. Native\n // control-flow inference computes the temporary's union across the arms.\n // An explicit annotation supplies contextual typing without copying tokens.\n const annotation =\n language.startsWith('ts') && declaration.id.typeAnnotation\n ? `: typeof ${declaration.id.name}`\n : '';\n grouping(declaration.id.end, node.start, true);\n grouping(node.end, statement.end);\n code.appendLeft(prefixStart, `let ${result}${annotation}; ${exit}: {const ${subject} = `);\n if (prefixStart < statement.start) code.prependRight(prefixStart, '\\n');\n code.move(prefixStart, node.start, node.end);\n code.appendRight(node.end, ` ${result}`);\n }\n const valuePrefix = result ? `${result} = (` : 'return ';\n const valueSuffix = result ? `); break ${exit};` : ';';\n const kind = node.cases.some((branch: Node) => branch.enumPattern) ? fresh('Kind') : undefined;\n if (!initializer)\n code.appendLeft(node.start, `${direct ? '{' : '(() => {'}const ${subject} = `);\n code.remove(node.parenStart, node.parenStart + 1);\n if (node.keyword === 'match') {\n // The native call parser permits a trailing comma. It is not part of the\n // subject initializer; preserve intervening comments/grouping tokens.\n const tokens = Parser.tokenizer(source.slice(node.discriminant.end, node.parenEnd), {\n ecmaVersion: 'latest',\n });\n for (;;) {\n const token = tokens.getToken();\n if (token.type === tokTypes.eof) break;\n if (token.type === tokTypes.comma)\n code.remove(node.discriminant.end + token.start, node.discriminant.end + token.end);\n }\n }\n // Keep the keyword source-backed for mapped lint diagnostics.\n const keywordEnd = node.start + (node.keyword === 'match' ? 5 : 6);\n if (node.keyword === 'match') code.overwrite(node.start, keywordEnd, 'switch');\n code.move(node.start, keywordEnd, node.parenEnd);\n code.appendLeft(node.parenEnd, `; ${kind ? `const ${kind} = ${subject}[\"kind\"]; ` : ''}`);\n code.overwrite(\n node.parenEnd,\n node.parenEnd + 1,\n ` (${kind ?? subject}${kind || node.discriminator === undefined ? '' : `[${JSON.stringify(node.discriminator)}]`})`,\n );\n for (const branch of node.cases) {\n if (branch.enumPattern) {\n const { reference, binding, start, parenStart, parenEnd, explicitKeyword } =\n branch.enumPattern;\n const tag = JSON.stringify(reference.property.name);\n if (language.startsWith('ts')) {\n // A type-only factory witness checks the reference and literal tag.\n // Native TS erases it; matching performs no factory/property lookup.\n const witness = `(${tag} satisfies (typeof `;\n if (explicitKeyword) code.overwrite(start, start + 4, witness);\n else code.appendLeft(start, witness);\n code.appendLeft(\n reference.end,\n ` extends (...args: never[]) => { readonly kind: ${tag} } ? ${tag} : never))`,\n );\n } else {\n if (explicitKeyword) {\n code.overwrite(start, start + 4, tag);\n code.remove(reference.start, reference.end);\n } else code.overwrite(reference.start, reference.end, tag);\n }\n code.remove(parenStart, parenStart + 1);\n code.remove(parenEnd, parenEnd + 1);\n if (binding) {\n code.appendLeft(binding.start, ': { const ');\n code.overwrite(\n branch.colonStart,\n branch.colonStart + 1,\n ` = ${subject}; ${branch.throw ? '' : valuePrefix}`,\n );\n code.appendLeft(branch.valueEnd, `${branch.throw ? ';' : valueSuffix} }`);\n if (source[branch.end - 1] === ';') code.remove(branch.end - 1, branch.end);\n } else if (!branch.throw) {\n code.appendLeft(branch.colonStart + 1, ` ${valuePrefix}`);\n if (result) {\n code.appendLeft(branch.valueEnd, valueSuffix);\n if (source[branch.end - 1] === ';') code.remove(branch.end - 1, branch.end);\n }\n }\n } else if (branch.pattern) {\n const { pattern, tag } = branch;\n // A discarded discriminator binding preserves native rest exclusion.\n // Its key remains source-backed; the literal moves to the case label.\n code.appendLeft(tag.value.start, fresh('Tag'));\n code.move(tag.value.start, tag.value.end, pattern.start);\n code.appendLeft(tag.value.end, ': { const ');\n code.overwrite(\n branch.colonStart,\n branch.colonStart + 1,\n ` = ${subject}; ${branch.throw ? '' : valuePrefix}`,\n );\n code.appendLeft(branch.valueEnd, `${branch.throw ? ';' : valueSuffix} }`);\n if (source[branch.end - 1] === ';') code.remove(branch.end - 1, branch.end);\n } else if (!branch.throw) {\n code.appendLeft(branch.colonStart + 1, ` ${valuePrefix}`);\n if (result) {\n code.appendLeft(branch.valueEnd, valueSuffix);\n if (source[branch.end - 1] === ';') code.remove(branch.end - 1, branch.end);\n }\n }\n }\n const hasDefault = node.cases.some(\n (branch: Node) => !branch.pattern && !branch.enumPattern && branch.test === null,\n );\n const check =\n !hasDefault && language.startsWith('ts')\n ? ` ${kind ? `(0 as unknown as typeof ${kind})` : subject} satisfies never;`\n : '';\n // Transpile-only JS hosts cannot prove unions. Unexpected values fail\n // visibly rather than returning an accidental undefined.\n const failure = hasDefault\n ? ''\n : `${check} throw new TypeError('Non-exhaustive switch expression');`;\n code.overwrite(node.end - 1, node.end, `}${failure}${direct || initializer ? '}' : '})()'}`, {\n contentOnly: true,\n });\n }\n}\n","import type MagicString from 'magic-string';\nimport type { SourceMap } from 'magic-string';\nimport {\n TraceMap,\n decodedMappings,\n encodedMappings,\n generatedPositionFor,\n} from '@jridgewell/trace-mapping';\n\ntype Node = { type: string; start: number; end: number; [key: string]: any };\ntype Insertion = {\n anchor: number;\n before: boolean;\n text: string;\n copies: { start: number; sourceStart: number; length: number }[];\n};\n\n/** Find free type references, respecting generic function/mapped/infer binders. */\nfunction references(\n node: Node,\n names: Set<string>,\n found = new Set<string>(),\n bound = new Set<string>(),\n) {\n const local = new Set(bound);\n for (const parameter of node.typeParameters?.params ?? []) local.add(parameter.name);\n if (node.type === 'TSMappedType') local.add(node.typeParameter.name);\n if (node.type === 'TSInferType') local.add(node.typeParameter.name);\n if (node.type === 'TSTypeReference' && node.typeName.type === 'Identifier') {\n const name = node.typeName.name;\n if (names.has(name) && !local.has(name)) found.add(name);\n }\n for (const [key, value] of Object.entries(node)) {\n if (['loc', 'typeName'].includes(key)) continue;\n for (const child of Array.isArray(value) ? value : [value]) {\n if (!child?.type) continue;\n const childBound = new Set(local);\n if (node.type === 'TSConditionalType' && key === 'trueType') {\n const bind = (part: Node) => {\n if (part.type === 'TSInferType') childBound.add(part.typeParameter.name);\n for (const [property, nested] of Object.entries(part)) {\n if (property === 'loc') continue;\n // An inner conditional's extends clause owns its own infer binders.\n // Its check/true/false branches may still infer for this outer clause.\n if (part.type === 'TSConditionalType' && property === 'extendsType') continue;\n for (const item of Array.isArray(nested) ? nested : [nested])\n if (item?.type) bind(item);\n }\n };\n bind(node.extendsType);\n }\n references(child, names, found, childBound);\n }\n }\n return found;\n}\n\nexport function enumTypeParameters(node: Node, branch: Node) {\n const parameters: Node[] = node.typeParameters?.params ?? [];\n const names = new Set(parameters.map((parameter) => parameter.name));\n const used = new Set<string>();\n for (const field of branch.params) references(field.typeAnnotation, names, used);\n // Constraints/defaults may reference an earlier enum type parameter.\n for (let size = -1; size !== used.size;) {\n size = used.size;\n for (const parameter of parameters) {\n if (!used.has(parameter.name)) continue;\n if (parameter.constraint) references(parameter.constraint, names, used);\n if (parameter.default) references(parameter.default, names, used);\n }\n }\n return parameters.filter((parameter) => used.has(parameter.name));\n}\n\n/** Tagged records and precise factories; no application runtime is introduced. */\nexport function lowerEnums(source: string, ast: Node, enums: Node[], code: MagicString) {\n const insertions: Insertion[] = [];\n const exported = new Set<Node>();\n const visit = (node: Node) => {\n if (node.type === 'ExportNamedDeclaration') exported.add(node.declaration);\n for (const [key, value] of Object.entries(node)) {\n if (['loc', 'trailing'].includes(key)) continue;\n for (const child of Array.isArray(value) ? value : [value]) if (child?.type) visit(child);\n }\n };\n visit(ast);\n for (const node of enums) {\n const replacement: Insertion = {\n anchor: node.braceStart,\n before: false,\n text: '= ',\n copies: [],\n };\n for (const [index, branch] of node.cases.entries()) {\n if (index) replacement.text += ' | ';\n replacement.text += `{ readonly kind: ${JSON.stringify(branch.id.name)}; `;\n for (const field of branch.params) {\n replacement.text += 'readonly ';\n const text = source.slice(field.start, field.typeAnnotation.end);\n replacement.copies.push({\n start: replacement.text.length,\n sourceStart: field.start,\n length: text.length,\n });\n replacement.text += text + '; ';\n }\n replacement.text += '}';\n }\n replacement.text += `; ${exported.has(node) ? 'export ' : ''}const `;\n replacement.copies.push({\n start: replacement.text.length,\n sourceStart: node.id.start,\n length: node.id.end - node.id.start,\n });\n replacement.text += source.slice(node.id.start, node.id.end) + ' = {';\n insertions.push(replacement);\n code.overwrite(node.start, node.start + 4, 'type');\n code.overwrite(node.braceStart, node.braceStart + 1, replacement.text);\n for (const branch of node.cases) {\n code.remove(branch.start, branch.start + 4);\n const parameters = enumTypeParameters(node, branch);\n const copied: Insertion = {\n anchor: branch.id.end,\n before: true,\n text: parameters.length ? '<' : '',\n copies: [],\n };\n for (const [index, parameter] of parameters.entries()) {\n if (index) copied.text += ', ';\n const text = source.slice(parameter.start, parameter.end);\n copied.copies.push({\n start: copied.text.length,\n sourceStart: parameter.start,\n length: text.length,\n });\n copied.text += text;\n }\n if (parameters.length) copied.text += '>';\n const generic = copied.text;\n if (generic) insertions.push(copied);\n code.appendLeft(branch.id.end, generic + (branch.hasParens ? '' : '()'));\n const fields = branch.params.map((field: Node) => field.name);\n // Const assertion only narrows the fresh literal; it does not mask type errors.\n code.appendLeft(\n branch.valueEnd,\n `{ return { kind: ${JSON.stringify(branch.id.name)}${fields.length ? ', ' + fields.join(', ') : ''} } as const; },`,\n );\n if (source[branch.end - 1] === ';') code.remove(branch.end - 1, branch.end);\n }\n code.appendLeft(node.end, ';');\n }\n return insertions;\n}\n\n/** Generated type copies map to their actual source tokens, including .d.ts maps. */\nexport function mapEnumCopies(\n source: string,\n generated: string,\n map: SourceMap,\n insertions: Insertion[],\n) {\n const starts = (text: string) => {\n const result = [0];\n for (let index = 0; index < text.length; index++)\n if (text[index] === '\\n') result.push(index + 1);\n return result;\n };\n const originalLines = starts(source),\n generatedLines = starts(generated);\n const position = (lines: number[], offset: number) => {\n let line = 0;\n while (line + 1 < lines.length && lines[line + 1]! <= offset) line++;\n return { line, column: offset - lines[line]! };\n };\n const trace = new TraceMap(map as any);\n const decoded = decodedMappings(trace);\n const copies: { generatedStart: number; sourceStart: number; length: number }[] = [];\n for (const insertion of insertions) {\n const anchor = position(originalLines, insertion.anchor);\n const location = generatedPositionFor(trace, {\n source: map.sources[0]!,\n line: anchor.line + 1,\n column: anchor.column,\n });\n const offset =\n generatedLines[location.line! - 1]! +\n location.column! -\n (insertion.before ? insertion.text.length : 0);\n if (generated.slice(offset, offset + insertion.text.length) !== insertion.text)\n throw new Error('Enum mapping anchor does not match generated text.');\n for (const copy of insertion.copies) {\n copies.push({\n generatedStart: offset + copy.start,\n sourceStart: copy.sourceStart,\n length: copy.length,\n });\n for (let index = 0; index < copy.length; index++) {\n const target = position(generatedLines, offset + copy.start + index);\n const original = position(originalLines, copy.sourceStart + index);\n const line = decoded[target.line]!;\n const entry: [number, number, number, number] = [\n target.column,\n 0,\n original.line,\n original.column,\n ];\n const existing = line.findIndex((segment) => segment[0] === target.column);\n if (existing >= 0) line[existing] = entry;\n else line.push(entry);\n }\n }\n }\n for (const line of decoded) line.sort((left, right) => left[0] - right[0]);\n map.mappings = encodedMappings(\n new TraceMap({ ...JSON.parse(map.toString()), mappings: decoded }),\n );\n return copies;\n}\n","import MagicString from 'magic-string';\nimport { Parser, tokTypes } from 'acorn';\nimport { parse } from './parser.js';\nimport { lowerDefers } from './defer.js';\nimport { lowerSwitchExpressions } from './branches.js';\nimport { lowerEnums, mapEnumCopies } from './enums.js';\nimport {\n originalPositionFor,\n generatedPositionFor,\n TraceMap,\n GREATEST_LOWER_BOUND,\n} from '@jridgewell/trace-mapping';\n\nexport type Language = 'js' | 'jsx' | 'ts' | 'tsx';\nexport interface TransformOptions {\n filename?: string;\n language?: Language;\n sourceType?: 'module' | 'script';\n /** Standard JSX runtime source; normally inherited from tsconfig.json. */\n jsxImportSource?: string;\n /** Swift's single-expression implicit return. Defaults to true. */\n implicitReturn?: boolean;\n /** Share dynamic synchronous cleanup through the optional runtime. Defaults to inline. */\n runtime?: 'inline' | 'external';\n}\nimport { extensions, isTwillFile } from './extensions.js';\nexport { extensions, isTwillFile } from './extensions.js';\nexport function inferLanguage(filename: string): Language {\n if (/\\.(?:twillx|tsx)$/.test(filename)) return 'tsx';\n if (/\\.jsx$/.test(filename)) return 'jsx';\n if (/\\.(?:js|mjs|cjs)$/.test(filename)) return 'js';\n return 'ts';\n}\n\nexport class TwillSyntaxError extends SyntaxError {\n readonly filename: string;\n readonly line: number;\n readonly column: number;\n readonly offset: number;\n readonly frame: string;\n constructor(\n source: string,\n filename: string,\n error: { message: string; pos?: number; loc?: { line: number; column: number } },\n ) {\n const line = error.loc?.line ?? 1;\n const column = error.loc?.column ?? 0;\n super(`${filename}:${line}:${column + 1}: ${error.message.replace(/\\s*\\(\\d+:\\d+\\)$/, '')}`);\n this.name = 'TwillSyntaxError';\n this.filename = filename;\n this.line = line;\n this.column = column;\n this.offset = error.pos ?? 0;\n this.frame = `${source.split(/\\r\\n|[\\r\\n\\u2028\\u2029]/)[line - 1] ?? ''}\\n${' '.repeat(column)}^`;\n }\n}\n\n// The parser boundary uses ESTree, including TS/JSX nodes from Acorn plugins.\ntype Node = { type: string; start: number; end: number; [key: string]: any };\ntype ClosureMetadata = {\n node: Node;\n label: { start: number; end: number } | null;\n header: { end: number; inStart: number; asyncEnd: number | null; parenthesized: boolean } | null;\n async: boolean;\n implicitMembers: number[];\n};\nfunction walk(node: Node, visit: (node: Node) => void): void {\n visit(node);\n for (const key of Object.keys(node)) {\n if (key === 'loc' || key === 'trailing') continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (child?.type) walk(child, visit);\n }\n } else if (value?.type) walk(value, visit);\n }\n}\nfunction calleeName(node: Node): string | undefined {\n if (node.type === 'Identifier') return node.start === node.end ? undefined : node.name;\n if (node.type === 'MemberExpression' && !node.computed) {\n const object = calleeName(node.object);\n if (object) return `${object}.${node.property.name}`;\n }\n}\n\nexport function transform(source: string, options: TransformOptions = {}) {\n if (options.runtime !== undefined && !['inline', 'external'].includes(options.runtime))\n throw new TypeError('runtime must be inline or external');\n const filename = options.filename ?? 'input.twill';\n let parsed: {\n ast: Node;\n calls: Node[];\n guards: Node[];\n ifBindings: Node[];\n defers: Node[];\n switches: Node[];\n enums: Node[];\n comments: { start: number; end: number; value: string; type: string }[];\n closures: ClosureMetadata[];\n };\n try {\n parsed = parse(\n source,\n options.language ?? inferLanguage(filename),\n options.sourceType ?? 'module',\n );\n } catch (error) {\n throw new TwillSyntaxError(\n source,\n filename,\n error as ConstructorParameters<typeof TwillSyntaxError>[2],\n );\n }\n const code = new MagicString(source);\n const enumInsertions = parsed.enums.length\n ? lowerEnums(source, parsed.ast, parsed.enums, code)\n : [];\n const usedNames = new Set<string>();\n const patternGuards = parsed.guards.filter(\n (guard) => guard.binding && guard.binding.declarations[0].id.type !== 'Identifier',\n );\n if (\n patternGuards.length ||\n parsed.ifBindings.length ||\n parsed.switches.length ||\n parsed.defers.length ||\n parsed.closures.some((closure) => closure.implicitMembers.length) ||\n /\\.twillx$/.test(filename.split(/[?#]/, 1)[0]!)\n )\n walk(parsed.ast, (node) => {\n if (node.type === 'Identifier' || node.type === 'JSXIdentifier') usedNames.add(node.name);\n });\n let guardCounter = 0;\n const ifBindingStarts = new Set(parsed.ifBindings.map((node) => node.consequent.start + 1));\n for (const statement of parsed.ifBindings) {\n const binding = statement.binding.declarations[0].id;\n let temporary: string;\n do temporary = `__twillIf${guardCounter++}`;\n while (usedNames.has(temporary));\n usedNames.add(temporary);\n const patternEnd = binding.typeAnnotation?.start ?? binding.end;\n // Evaluate in the outer scope, then move the original binding tokens into\n // the success branch. This preserves maps, narrowing and native defaults.\n code.overwrite(statement.start, binding.start, `{const ${temporary}`);\n code.move(binding.start, patternEnd, statement.consequent.start + 1);\n code.prependRight(binding.start, 'const ');\n code.appendLeft(patternEnd, ` = ${temporary};`);\n code.prependLeft(\n statement.consequent.start,\n `; if (${temporary} !== null && ${temporary} !== void 0) `,\n );\n code.appendLeft(statement.end, '}');\n }\n for (const guard of parsed.guards) {\n // A guard is one source statement. Without these braces an outer `else`\n // would bind to the lowered inner if (JavaScript's dangling-else rule).\n if (guard.singleStatement) {\n code.prependLeft(guard.start, '{');\n code.appendLeft(guard.end, '}');\n }\n if (guard.binding) {\n const binding = guard.binding.declarations[0].id;\n // Nullish checks preserve false, 0 and empty strings. The original\n // initializer runs once and the binding stays in the surrounding scope.\n if (binding.type === 'Identifier') code.remove(guard.start, guard.start + 'guard'.length);\n else {\n let temporary: string;\n do temporary = `__twillGuard${guardCounter++}`;\n while (usedNames.has(temporary));\n usedNames.add(temporary);\n // Move native pattern tokens intact, preserving editor definitions and\n // initializer TDZ/shadowing. A type annotation belongs to the temporary.\n const patternEnd = binding.typeAnnotation?.start ?? binding.end;\n code.overwrite(guard.start, binding.start, `const ${temporary}`);\n code.move(binding.start, patternEnd, guard.end);\n code.prependRight(binding.start, '; const ');\n code.appendLeft(patternEnd, ` = ${temporary};`);\n code.overwrite(guard.elseStart, guard.elseStart + 4, `; if (${temporary} == null)`);\n continue;\n }\n code.overwrite(\n guard.elseStart,\n guard.elseStart + 'else'.length,\n `; if (${binding.name} == null)`,\n );\n } else {\n code.overwrite(guard.start, guard.start + 'guard'.length, 'if (!(');\n code.overwrite(guard.elseStart, guard.elseStart + 'else'.length, '))');\n }\n }\n const uiFile = /\\.twillx$/.test(filename.split(/[?#]/, 1)[0]!);\n const metadataByNode = new Map(parsed.closures.map((item) => [item.node, item]));\n const componentCalls = new Set(\n parsed.calls.filter((node) => {\n const name = calleeName(node.callee);\n // Like JSX tags, uppercase final names opt into component syntax in UI\n // files. Parenthesized callable expressions retain ordinary callback behavior.\n return (\n uiFile &&\n node.start === node.callee.start &&\n !!name &&\n /^[A-Z]/.test(name.split('.').at(-1)!)\n );\n }),\n );\n for (const call of componentCalls) {\n const implicit = call.trailing.closures.flatMap(\n (closure: Node) => metadataByNode.get(closure)!.implicitMembers,\n )[0];\n if (implicit !== undefined)\n throw new TwillSyntaxError(source, filename, {\n message:\n 'Implicit member access is for ordinary callbacks. Use explicit parameters for component render props or slots.',\n pos: implicit,\n loc: {\n line: source.slice(0, implicit).split(/\\r\\n|[\\r\\n\\u2028\\u2029]/).length,\n column: source\n .slice(0, implicit)\n .split(/\\r\\n|[\\r\\n\\u2028\\u2029]/)\n .at(-1)!.length,\n },\n });\n }\n let implicitCounter = 0;\n for (const metadata of parsed.closures) {\n if (!metadata.implicitMembers.length) continue;\n let name: string;\n do name = `__twillArg${implicitCounter++}`;\n while (usedNames.has(name));\n usedNames.add(name);\n code.overwrite(metadata.node.start, metadata.node.start + 1, `(${name}) => {`);\n for (const offset of metadata.implicitMembers) code.appendLeft(offset, name);\n }\n // TypeScript only reads file-level leading pragmas, and the last wins.\n const leadingComments = parsed.comments\n .filter((comment) => comment.start < (parsed.ast.body[0]?.start ?? source.length))\n .map((comment) => comment.value)\n .join('\\n');\n const pragma = [...leadingComments.matchAll(/@jsxImportSource\\s+(\\S+)/g)].at(-1)?.[1];\n const imports = parsed.ast.body\n .filter((node: Node) => node.type === 'ImportDeclaration')\n .map((node: Node) => node.source.value as string);\n const vueImport = imports.some((name: string) => name === 'vue' || name.startsWith('@vue/'));\n const reactImport = imports.some((name: string) => name === 'react' || name.startsWith('react/'));\n if (componentCalls.size && !pragma && !options.jsxImportSource && vueImport && reactImport)\n throw new TwillSyntaxError(source, filename, {\n message:\n 'Both React and Vue are imported. Select the standard JSX runtime with @jsxImportSource or tsconfig jsxImportSource.',\n pos: parsed.calls[0]!.start,\n loc: parsed.calls[0]!.loc.start,\n });\n const jsxImportSource = pragma ?? options.jsxImportSource ?? (vueImport ? 'vue' : 'react');\n const vue = jsxImportSource === 'vue';\n if (uiFile && !pragma && jsxImportSource !== 'react') {\n const start = source.startsWith('#!') ? source.indexOf('\\n') + 1 : 0;\n code.appendLeft(start, `/** @jsxImportSource ${jsxImportSource} */\\n`);\n }\n const attributeClosings: number[] = [];\n const componentProps: {\n start: number;\n end: number;\n properties: { name: string; start: number; end: number; shorthand: boolean }[];\n }[] = [];\n const stripPunctuation = (start: number, end: number, types: readonly unknown[]) => {\n const text = source.slice(start, end);\n const lexer = Parser.tokenizer(text, { ecmaVersion: 'latest' });\n const edits = new MagicString(text);\n for (let token = lexer.getToken(); token.type !== tokTypes.eof; token = lexer.getToken())\n if (types.includes(token.type)) edits.remove(token.start, token.end);\n return edits.toString();\n };\n let counter = 0;\n for (const node of parsed.calls) {\n const { callEnd, hadParens, originalArgs, closures } = node.trailing;\n const component = componentCalls.has(node);\n if (component) {\n if (\n originalArgs.length > 1 ||\n originalArgs[0]?.type === 'SpreadElement' ||\n node.optional ||\n node.callee.optional\n )\n throw new TwillSyntaxError(source, filename, {\n message:\n 'Component syntax accepts one props object and children; optional calls use ordinary callbacks.',\n pos: node.start,\n loc: node.loc.start,\n });\n if (closures.length > 1 && !vue)\n throw new TwillSyntaxError(source, filename, {\n message:\n 'React components accept one children closure. Supply render props in the props object.',\n pos: closures[1].start,\n loc: closures[1].loc.start,\n });\n if (vue) {\n const labels = new Set(['default']);\n for (const closure of closures.slice(1)) {\n const label = metadataByNode.get(closure)!.label!;\n const name = source.slice(label.start, label.end);\n if (labels.has(name))\n throw new TwillSyntaxError(source, filename, {\n message: `Duplicate Vue slot: ${name}`,\n pos: label.start,\n loc: closure.loc.start,\n });\n labels.add(name);\n }\n }\n const opening = vue ? '>{({default: ' : '>{(';\n const tagEnd = node.typeParameters?.end ?? node.callee.end;\n code.appendLeft(node.callee.start, '(<');\n const props = originalArgs[0] as Node | undefined;\n const directAttributes =\n !vue &&\n props?.type === 'ObjectExpression' &&\n props.properties.every(\n (property: Node) =>\n property.type === 'SpreadElement' ||\n (property.kind === 'init' &&\n !property.method &&\n !property.computed &&\n (property.key.name ?? property.key.value) !== '__proto__' &&\n /^[A-Za-z_$][\\w$.:-]*$/.test(String(property.key.name ?? property.key.value))),\n );\n if (directAttributes) {\n componentProps.push({\n start: props!.start,\n end: props!.end,\n properties: props!.properties\n .filter((property: Node) => property.type !== 'SpreadElement')\n .map((property: Node) => ({\n name: String(property.key.name ?? property.key.value),\n start: property.key.start,\n end: property.key.end,\n shorthand: Boolean(property.shorthand),\n })),\n });\n // Literal props become native JSX attributes. This retains contextual\n // callback types and passes keys explicitly, as React's runtime expects.\n code.overwrite(\n tagEnd,\n props!.start + 1,\n ' ' + stripPunctuation(tagEnd, props!.start, [tokTypes.parenL]),\n );\n let previous = props!.start + 1;\n for (const property of props!.properties as Node[]) {\n if (previous < property.start)\n code.overwrite(\n previous,\n property.start,\n stripPunctuation(previous, property.start, [tokTypes.comma]) + ' ',\n );\n if (property.type === 'SpreadElement') code.prependLeft(property.start, '{');\n else {\n const name = String(property.key.name ?? property.key.value);\n if (property.shorthand) code.prependLeft(property.start, `${name}={`);\n else {\n code.overwrite(property.key.start, property.key.end, name);\n const start = property.key.end;\n const colon = Parser.tokenizer(source.slice(start, property.value.start), {\n ecmaVersion: 'latest',\n }).getToken();\n code.overwrite(start + colon.start, start + colon.end, '={');\n }\n }\n attributeClosings.push(property.end);\n previous = property.end;\n }\n const end = props!.end - 1;\n code.overwrite(\n previous,\n callEnd,\n stripPunctuation(previous, end, [tokTypes.comma]) +\n stripPunctuation(props!.end, callEnd, [tokTypes.parenR, tokTypes.comma]) +\n opening,\n );\n } else if (originalArgs.length) {\n const head = source.slice(tagEnd, originalArgs[0].start);\n const paren = Parser.tokenizer(head, { ecmaVersion: 'latest' }).getToken();\n code.overwrite(\n tagEnd,\n originalArgs[0].start,\n ' {...(' + head.slice(0, paren.start) + head.slice(paren.end),\n );\n const tailStart = originalArgs[0].end;\n const tail = Parser.tokenizer(source.slice(tailStart, callEnd - 1), {\n ecmaVersion: 'latest',\n });\n // Parenthesized props may contain closing parentheses before the comma.\n for (let token = tail.getToken(); token.type !== tokTypes.eof; token = tail.getToken())\n if (token.type === tokTypes.comma)\n code.remove(tailStart + token.start, tailStart + token.end);\n code.overwrite(callEnd - 1, callEnd, ')}' + opening);\n } else if (hadParens) {\n const gap = source.slice(tagEnd, callEnd);\n const tokens = Parser.tokenizer(gap, { ecmaVersion: 'latest' });\n const first = tokens.getToken();\n const last = tokens.getToken();\n code.overwrite(tagEnd, callEnd, opening + gap.slice(first.end, last.start));\n } else code.appendLeft(callEnd, opening);\n } else if (hadParens) {\n // Keep comments and trailing commas intact. The closing parenthesis is\n // moved after the closure; remove any comma immediately before it.\n const tailStart = originalArgs.at(-1)?.end ?? callEnd - 1;\n const tail = source.slice(tailStart, callEnd - 1);\n const token = Parser.tokenizer(tail, { ecmaVersion: 'latest' }).getToken();\n if (token.type === tokTypes.comma)\n code.remove(tailStart + token.start, tailStart + token.end);\n code.overwrite(callEnd - 1, callEnd, originalArgs.length ? ',' : '');\n } else code.appendLeft(callEnd, '(');\n let directChild = false;\n for (const closure of closures) {\n const metadata = metadataByNode.get(closure)!;\n const body = closure.body.body as Node[];\n const content = component && (vue || !metadata.header);\n const expressions = body.filter((statement) => statement.type === 'ExpressionStatement');\n const singleContent =\n content &&\n expressions.length === 1 &&\n body.every((statement) =>\n [\n 'ExpressionStatement',\n 'VariableDeclaration',\n 'FunctionDeclaration',\n 'ClassDeclaration',\n 'DeferStatement',\n 'EmptyStatement',\n ].includes(statement.type),\n ) &&\n body.filter((statement) => statement.type !== 'EmptyStatement').at(-1) === expressions[0];\n if (singleContent && body.length === 1 && !vue) {\n // A single JSX child is a value, not an array or an eagerly invoked\n // callback. This also supports libraries requiring ReactElement children.\n directChild = true;\n code.remove(closure.start, closure.start + 1);\n code.remove(closure.end - 1, closure.end);\n const statement = expressions[0]!;\n if (source[statement.end - 1] === ';') code.remove(statement.end - 1, statement.end);\n continue;\n }\n if (metadata.label) {\n const label = source\n .slice(metadata.label.start, metadata.label.end)\n .replace(/\\s*:\\s*$/, '');\n code.overwrite(\n metadata.label.start,\n closure.start,\n component && vue ? `, [${JSON.stringify(label)}]: ` : ', ',\n );\n }\n if (metadata.header) {\n const header = metadata.header;\n // Preserve parameter tokens in place so types, hover and diagnostics map\n // to their original locations instead of a regenerated header string.\n code.overwrite(\n closure.start,\n closure.start + 1,\n header.parenthesized || metadata.async ? '' : '(',\n );\n if (metadata.async && !header.parenthesized) code.appendLeft(header.asyncEnd!, ' (');\n code.overwrite(header.inStart, header.end, `${header.parenthesized ? '' : ') '}=> {`);\n } else if (!metadata.implicitMembers.length)\n code.overwrite(closure.start, closure.start + 1, '() => {');\n if (content && !singleContent) {\n let collector: string;\n do collector = `__twillChildren${counter++}`;\n while (usedNames.has(collector));\n const bodyStart = metadata.header?.end ?? closure.start + 1;\n const collect = (statement: Node): void => {\n switch (statement.type) {\n case 'ExpressionStatement':\n // The prefix belongs to the expression's own chunk. A moved\n // if-binding at this same boundary must remain before it.\n if (ifBindingStarts.has(statement.start))\n code.appendRight(statement.start, `${collector}.push(`);\n else code.prependLeft(statement.start, `${collector}.push(`);\n code.appendLeft(\n source[statement.end - 1] === ';' ? statement.end - 1 : statement.end,\n ')',\n );\n break;\n case 'BlockStatement':\n statement.body.forEach(collect);\n break;\n case 'IfStatement':\n case 'TwillIfBinding':\n collect(statement.consequent);\n if (statement.alternate) collect(statement.alternate);\n break;\n case 'GuardStatement':\n collect(statement.failure);\n break;\n case 'ForStatement':\n case 'ForOfStatement':\n case 'ForInStatement':\n case 'WhileStatement':\n case 'DoWhileStatement':\n collect(statement.body);\n break;\n case 'SwitchStatement':\n statement.cases.forEach((branch: Node) => branch.consequent.forEach(collect));\n break;\n case 'TryStatement':\n collect(statement.block);\n if (statement.handler) collect(statement.handler.body);\n if (statement.finalizer) collect(statement.finalizer);\n break;\n case 'LabeledStatement':\n collect(statement.body);\n break;\n case 'ReturnStatement':\n throw new TwillSyntaxError(source, filename, {\n message:\n 'Component children collect expressions; use expressions instead of return.',\n pos: statement.start,\n loc: statement.loc.start,\n });\n // Declarations, break/continue, throw, functions and classes keep\n // their normal semantics. Never collect inside a nested function.\n }\n };\n body.forEach(collect);\n // Prefix after collecting so a compact first expression cannot place\n // its push wrapper before the collector declaration at the same offset.\n code.prependLeft(bodyStart, `const ${collector} = [];`);\n code.prependLeft(\n closure.end - 1,\n vue\n ? `;return ${collector};`\n : `;return ${collector}.length === 1 ? ${collector}[0] : ${collector};`,\n );\n } else if (\n singleContent ||\n (options.implicitReturn !== false &&\n body.length === 1 &&\n body[0]!.type === 'ExpressionStatement')\n ) {\n // Parentheses prevent object literals / comma expressions from changing meaning.\n const statement = singleContent ? expressions[0]! : body[0]!;\n code.prependLeft(statement.start, 'return (');\n code.appendLeft(source[statement.end - 1] === ';' ? statement.end - 1 : statement.end, ')');\n }\n }\n if (component)\n code.prependLeft(\n closures.at(-1).end,\n (vue ? '})}' : directChild || metadataByNode.get(closures[0])!.header ? ')}' : ')()}') +\n `</${calleeName(node.callee)}>)`,\n );\n else code.appendLeft(closures.at(-1).end, ')');\n // The parser may visit nested trailing calls after this one. Edits use\n // original offsets throughout, so nested scopes compose without reparsing.\n }\n if (parsed.switches.length)\n lowerSwitchExpressions(\n source,\n parsed.ast,\n parsed.switches,\n code,\n options.language ?? inferLanguage(filename),\n usedNames,\n parsed.comments,\n (node, message) => {\n throw new TwillSyntaxError(source, filename, {\n message,\n pos: node.start,\n loc: node.loc.start,\n });\n },\n );\n // Apply outer attribute braces after nested call suffixes at the same offset.\n for (const end of attributeClosings) code.appendLeft(end, '}');\n if (parsed.defers.length) {\n const starts = new Map<Node, number>();\n for (const metadata of parsed.closures)\n if (metadata.header) starts.set(metadata.node.body, metadata.header.end);\n lowerDefers(\n source,\n parsed.ast,\n code,\n options.language ?? inferLanguage(filename),\n usedNames,\n starts,\n parsed.comments,\n options.runtime ?? 'inline',\n options.sourceType ?? 'module',\n (node, message) => {\n throw new TwillSyntaxError(source, filename, {\n message,\n pos: node.start,\n loc: node.loc.start,\n });\n },\n );\n }\n const map = code.generateMap({\n source: filename,\n file: filename.replace(/\\.twillx?$/, '.js'),\n includeContent: true,\n hires: true,\n });\n const enumCopies = enumInsertions.length\n ? mapEnumCopies(source, code.toString(), map, enumInsertions)\n : [];\n return {\n code: code.toString(),\n map,\n changed: code.hasChanged(),\n closures: parsed.closures.length,\n guards: parsed.guards.length,\n ifBindings: parsed.ifBindings.length,\n defers: parsed.defers.length,\n switches: parsed.switches.length,\n associatedEnums: parsed.enums,\n enumPatterns: parsed.switches.flatMap((node) =>\n node.cases.flatMap((branch: Node) => (branch.enumPattern ? [branch.enumPattern] : [])),\n ),\n enumCopies,\n componentProps,\n };\n}\n\nexport type TransformResult = ReturnType<typeof transform>;\nconst traceMaps = new WeakMap<TransformResult, TraceMap>();\nfunction traceMap(result: TransformResult): TraceMap {\n let map = traceMaps.get(result);\n if (!map) {\n map = new TraceMap(result.map as any);\n traceMaps.set(result, map);\n }\n return map;\n}\nexport function originalPosition(result: TransformResult, line: number, column: number) {\n return originalPositionFor(traceMap(result), {\n line,\n column,\n bias: GREATEST_LOWER_BOUND,\n });\n}\nexport function generatedPosition(result: TransformResult, line: number, column: number) {\n return generatedPositionFor(traceMap(result), {\n source: result.map.sources[0]!,\n line,\n column,\n bias: GREATEST_LOWER_BOUND,\n });\n}\n"],"mappings":";;;;;;AAMA,IAAM,UAAU;CAAE,aAAa;CAAU,YAAY;CAAU,WAAW;AAAK;AAC/E,IAAM,QAAQ;CACZ,IAAI;CACJ,KAAK,OAAO,OAAO,IAAI,CAAC;CACxB,IAAI,OAAO,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC,CAAC;CACpD,KAAK,OAAO,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC,CAAC;AACvD;AAKA,SAAS,QAAQ,OAAO,QAAQ,iBAAiB,OAAO;CACtD,MAAM,QAAQ,OAAO,UAAU,MAAM,MAAM,MAAM,GAAG,EAAE,aAAa,SAAS,CAAC;CAC7E,MAAM,QAAQ,CAAC;CACf,IAAI,QAAQ;CACZ,IAAI;EACF,SAAS;GAEP,MAAM,QADQ,MAAM,SACF,CAAC,CAAC,KAAK;GACzB,IACE,SACA;IAAC;IAAK;IAAK;IAAM;IAAK;IAAS;IAAK;IAAK;IAAK;IAAiB;IAAM;GAAY,CAAC,CAAC,SACjF,KACF,KACA,EAAE,kBAAkB,UAAU,MAE9B,OAAO;GACT,IACE,CAAC,MAAM,UACP;IAAC;IAAM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jB,MAAM,IAAI,iBAAiB,QAAQ,UAAU;IAC3C;IACA,KAAK,KAAK;IACV,KAAK,KAAK,IAAI;GAChB,CAAC;EACH,CACF;CACF;CACA,MAAM,MAAM,KAAK,YAAY;EAC3B,QAAQ;EACR,MAAM,SAAS,QAAQ,cAAc,KAAK;EAC1C,gBAAgB;EAChB,OAAO;CACT,CAAC;CACD,MAAM,aAAa,eAAe,SAC9B,cAAc,QAAQ,KAAK,SAAS,GAAG,KAAK,cAAc,IAC1D,CAAC;CACL,OAAO;EACL,MAAM,KAAK,SAAS;EACpB;EACA,SAAS,KAAK,WAAW;EACzB,UAAU,OAAO,SAAS;EAC1B,QAAQ,OAAO,OAAO;EACtB,YAAY,OAAO,WAAW;EAC9B,QAAQ,OAAO,OAAO;EACtB,UAAU,OAAO,SAAS;EAC1B,iBAAiB,OAAO;EACxB,cAAc,OAAO,SAAS,SAAS,SACrC,KAAK,MAAM,SAAS,WAAkB,OAAO,cAAc,CAAC,OAAO,WAAW,IAAI,CAAC,CAAE,CACvF;EACA;EACA;CACF;AACF;AAGA,IAAM,4BAAY,IAAI,QAAmC;AACzD,SAAS,SAAS,QAAmC;CACnD,IAAI,MAAM,UAAU,IAAI,MAAM;CAC9B,IAAI,CAAC,KAAK;EACR,MAAM,IAAI,SAAS,OAAO,GAAU;EACpC,UAAU,IAAI,QAAQ,GAAG;CAC3B;CACA,OAAO;AACT;AACA,SAAgB,iBAAiB,QAAyB,MAAc,QAAgB;CACtF,OAAO,oBAAoB,SAAS,MAAM,GAAG;EAC3C;EACA;EACA,MAAM;CACR,CAAC;AACH;AACA,SAAgB,kBAAkB,QAAyB,MAAc,QAAgB;CACvF,OAAO,qBAAqB,SAAS,MAAM,GAAG;EAC5C,QAAQ,OAAO,IAAI,QAAQ;EAC3B;EACA;EACA,MAAM;CACR,CAAC;AACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"declarations.js","names":[],"sources":["../src/declarations.ts"],"sourcesContent":["import ts from 'typescript';\nimport MagicString from 'magic-string';\nimport remapping from '@ampproject/remapping';\nimport { resolve, dirname, basename, relative } from 'node:path';\nimport { mkdirSync, writeFileSync, renameSync } from 'node:fs';\nimport { TwillProject, type ProjectDiagnostic, sourceFilename } from './project.js';\n\nexport interface DeclarationOptions {\n outDir?: string;\n build?: boolean;\n declarationMap?: boolean;\n}\nexport interface DeclarationBuild {\n projects: string[];\n files: string[];\n diagnostics: ProjectDiagnostic[];\n}\n\nconst moduleName = (value: string) =>\n value\n .replace(/\\.twillx?(?:\\.tsx?)?$/, '.js')\n .replace(/\\.(?:tsx?|jsx)$/, '.js')\n .replace(/\\.(m|c)ts$/, '.$1js');\nconst outputName = (filename: string) => filename.replace(/\\.twillx?\\.d\\.ts(?=\\.map$|$)/, '.d.ts');\nfunction moduleEdits(\n text: string,\n filename: string,\n source: string | undefined,\n redirects: ReadonlyMap<string, string>,\n) {\n const file = ts.createSourceFile(filename, text, ts.ScriptTarget.Latest, true);\n const edits = new MagicString(text);\n const visit = (node: ts.Node) => {\n if (ts.isStringLiteral(node)) {\n const parent = node.parent;\n if (\n ((ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) &&\n parent.moduleSpecifier === node) ||\n ts.isExternalModuleReference(parent) ||\n (ts.isLiteralTypeNode(parent) && ts.isImportTypeNode(parent.parent))\n ) {\n let value = moduleName(node.text);\n if (source && node.text.startsWith('.')) {\n const base = sourceFilename(resolve(dirname(source), node.text));\n const target = [\n base,\n ...['.twill', '.twillx', '.ts', '.tsx', '.mts', '.cts', '.js'].map((ext) => base + ext),\n ]\n .map((candidate) => redirects.get(candidate))\n .find(Boolean);\n if (target) {\n value = relative(dirname(filename), target)\n .replaceAll('\\\\', '/')\n .replace(/\\.d\\.(ts|mts|cts)$/, (_, extension: string) =>\n extension === 'ts' ? '.js' : extension === 'mts' ? '.mjs' : '.cjs',\n );\n if (!value.startsWith('.')) value = './' + value;\n }\n }\n if (value !== node.text) edits.overwrite(node.getStart() + 1, node.end - 1, value);\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(file);\n return edits;\n}\n\n/** Emits ordinary declaration files; a reference build visits dependencies first.\n * No output is written for a project with syntax, type or emit errors. */\nexport function emitDeclarations(\n tsconfig: string,\n options: DeclarationOptions = {},\n): DeclarationBuild {\n const result: DeclarationBuild = { projects: [], files: [], diagnostics: [] };\n const visited = new Set<string>();\n const active = new Set<string>();\n const redirects = new Map<string, string>();\n const build = (config: string, root: boolean) => {\n config = sourceFilename(resolve(config));\n if (active.has(config)) throw new Error(`Circular project reference: ${config}`);\n if (visited.has(config)) return;\n active.add(config);\n const parsed = ts.getParsedCommandLineOfConfigFile(\n config,\n {},\n {\n ...ts.sys,\n getCurrentDirectory: () => dirname(config),\n onUnRecoverableConfigFileDiagnostic() {},\n },\n );\n if (options.build)\n for (const reference of parsed?.projectReferences ?? [])\n build(ts.resolveProjectReferencePath(reference), false);\n active.delete(config);\n visited.add(config);\n if (result.diagnostics.some((item) => item.category === 'error')) return;\n const project = new TwillProject(config, {}, { declarationRedirects: redirects });\n try {\n const outDir = resolve(\n (root && options.outDir) ||\n parsed?.options.declarationDir ||\n parsed?.options.outDir ||\n resolve(project.root, 'dist'),\n );\n const emitted = project.declarationOutput(outDir, options.declarationMap ?? true);\n result.diagnostics.push(...emitted.diagnostics);\n if (emitted.diagnostics.some((item) => item.category === 'error')) return;\n const inputs = new Set(\n project\n .sourceFiles()\n .map((file) => (ts.sys.useCaseSensitiveFileNames ? file : file.toLowerCase())),\n );\n const files = new Map<string, { text: string; sources: string[] }>();\n const edits = new Map<string, MagicString>();\n const projectRedirects = new Map(redirects);\n const outputKeys = new Set<string>();\n for (const file of emitted.files)\n if (!file.filename.endsWith('.map'))\n for (const source of file.sources)\n projectRedirects.set(source, outputName(file.filename));\n for (const file of emitted.files) {\n const filename = outputName(file.filename);\n const key = ts.sys.useCaseSensitiveFileNames ? filename : filename.toLowerCase();\n if (inputs.has(key))\n throw new Error(`Declaration output would overwrite source: ${filename}`);\n if (outputKeys.has(key)) throw new Error(`Declaration output collision: ${filename}`);\n outputKeys.add(key);\n if (!filename.endsWith('.map')) {\n const changed = moduleEdits(file.text, filename, file.sources[0], projectRedirects);\n edits.set(filename, changed);\n files.set(filename, {\n text: changed\n .toString()\n .replace(/(sourceMappingURL=.*)\\.twillx?\\.d\\.ts\\.map/g, '$1.d.ts.map'),\n sources: file.sources,\n });\n } else files.set(filename, { text: file.text, sources: file.sources });\n }\n for (const [filename, file] of files)\n if (filename.endsWith('.map')) {\n const declaration = filename.slice(0, -4);\n const originalMap = JSON.parse(file.text);\n const source = sourceFilename(\n resolve(\n dirname(filename),\n originalMap.sourceRoot ?? '',\n decodeURIComponent(originalMap.sources[0] ?? ''),\n ),\n );\n const transformed = project.transformed(source);\n const changed = edits.get(declaration)!;\n const maps: any[] = [\n changed.generateMap({ source: declaration, hires: true, includeContent: true }),\n originalMap,\n ];\n if (transformed) maps.push(transformed.map);\n const combined = remapping(maps as any, () => null);\n combined.file = basename(declaration);\n combined.sources = combined.sources.map(() =>\n relative(dirname(filename), source).replaceAll('\\\\', '/'),\n );\n file.text = JSON.stringify(combined);\n }\n for (const [filename, file] of files) {\n mkdirSync(dirname(filename), { recursive: true });\n const staging = filename + '.twill-tmp';\n writeFileSync(staging, file.text);\n renameSync(staging, filename);\n result.files.push(filename);\n if (!filename.endsWith('.map'))\n for (const source of file.sources) redirects.set(source, filename);\n }\n result.projects.push(config);\n } finally {\n project.dispose();\n }\n };\n build(tsconfig, true);\n return result;\n}\n"],"mappings":";;;;;;;AAkBA,IAAM,cAAc,UAClB,MACG,QAAQ,yBAAyB,KAAK,CAAC,CACvC,QAAQ,mBAAmB,KAAK,CAAC,CACjC,QAAQ,cAAc,OAAO;AAClC,IAAM,cAAc,aAAqB,SAAS,QAAQ,gCAAgC,OAAO;AACjG,SAAS,YACP,MACA,UACA,QACA,WACA;CACA,MAAM,OAAO,GAAG,iBAAiB,UAAU,MAAM,GAAG,aAAa,QAAQ,IAAI;CAC7E,MAAM,QAAQ,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,GAAG;IAC1C,MAAM,WAAW,UAAU,YAAmB,IAAI;IAClD,SAAS,OAAO,SAAS,WAAW;IACpC,SAAS,UAAU,SAAS,QAAQ,UAClC,SAAS,QAAQ,QAAQ,GAAG,MAAM,CAAC,CAAC,WAAW,MAAM,GAAG,CAC1D;IACA,KAAK,OAAO,KAAK,UAAU,QAAQ;GACrC;GACF,KAAK,MAAM,CAAC,UAAU,SAAS,OAAO;IACpC,UAAU,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;IAChD,MAAM,UAAU,WAAW;IAC3B,cAAc,SAAS,KAAK,IAAI;IAChC,WAAW,SAAS,QAAQ;IAC5B,OAAO,MAAM,KAAK,QAAQ;IAC1B,IAAI,CAAC,SAAS,SAAS,MAAM,GAC3B,KAAK,MAAM,UAAU,KAAK,SAAS,UAAU,IAAI,QAAQ,QAAQ;GACrE;GACA,OAAO,SAAS,KAAK,MAAM;EAC7B,UAAU;GACR,QAAQ,QAAQ;EAClB;CACF;CACA,MAAM,UAAU,IAAI;CACpB,OAAO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"doctor.js","names":["metadata"],"sources":["../package.json","../src/doctor.ts"],"sourcesContent":["{\n \"name\": \"@swiftuijs/twill\",\n \"version\": \"0.3.0\",\n \"description\": \"Twill extends TypeScript with Swift-inspired syntax: trailing closures, guards, defer and checked switch expressions. Compiles to ordinary JavaScript.\",\n \"main\": \"./dist/typescript-plugin.cjs\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/swiftuijs/twill.git\",\n \"directory\": \"packages/twill\"\n },\n \"keywords\": [\n \"javascript\",\n \"typescript\",\n \"trailing-closures\",\n \"swift\",\n \"vite\",\n \"unplugin\",\n \"react\",\n \"vue\",\n \"twill\",\n \"guard\",\n \"defer\"\n ],\n \"author\": {\n \"name\": \"forth.ink\",\n \"url\": \"https://forth.ink\"\n },\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"bugs\": {\n \"url\": \"https://github.com/swiftuijs/twill/issues\"\n },\n \"homepage\": \"https://twill.evecalm.com/\",\n \"dependencies\": {\n \"@ampproject/remapping\": \"^2.3.0\",\n \"@jridgewell/trace-mapping\": \"^0.3.31\",\n \"acorn\": \"8.18.0\",\n \"acorn-jsx\": \"^5.3.2\",\n \"acorn-typescript\": \"1.4.13\",\n \"magic-string\": \"^1.4.2\",\n \"typescript\": \"catalog:\",\n \"unplugin\": \"^3.4.0\"\n },\n \"sideEffects\": false,\n \"engines\": {\n \"node\": \"^20.19.0 || >=22.12.0\"\n },\n \"files\": [\n \"bin\",\n \"dist/**/*.js\",\n \"dist/**/*.js.map\",\n \"dist/**/*.d.ts\",\n \"schemas\",\n \"README.md\",\n \"LICENSE\",\n \"dist/**/*.cjs\",\n \"dist/**/*.cjs.map\",\n \"dist/*.LICENSE.txt\"\n ],\n \"bin\": {\n \"twill\": \"./bin/twill.mjs\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./vite\": {\n \"types\": \"./dist/vite.d.ts\",\n \"import\": \"./dist/vite.js\"\n },\n \"./rollup\": {\n \"types\": \"./dist/rollup.d.ts\",\n \"import\": \"./dist/rollup.js\"\n },\n \"./esbuild\": {\n \"types\": \"./dist/esbuild.d.ts\",\n \"import\": \"./dist/esbuild.js\"\n },\n \"./webpack\": {\n \"types\": \"./dist/webpack.d.ts\",\n \"import\": \"./dist/webpack.js\"\n },\n \"./rspack\": {\n \"types\": \"./dist/rspack.d.ts\",\n \"import\": \"./dist/rspack.js\"\n },\n \"./project\": {\n \"types\": \"./dist/project.d.ts\",\n \"import\": \"./dist/project.js\"\n },\n \"./editor\": {\n \"types\": \"./dist/editor.d.ts\",\n \"import\": \"./dist/editor.js\"\n },\n \"./register\": {\n \"types\": \"./dist/register.d.ts\",\n \"import\": \"./dist/register.js\"\n },\n \"./schema\": \"./schemas/twill.schema.json\",\n \"./typescript-plugin\": {\n \"types\": \"./dist/typescript-plugin.d.ts\",\n \"require\": \"./dist/typescript-plugin.cjs\",\n \"default\": \"./dist/typescript-plugin.cjs\"\n },\n \"./doctor\": {\n \"types\": \"./dist/doctor.d.ts\",\n \"import\": \"./dist/doctor.js\"\n },\n \"./syntax\": {\n \"types\": \"./dist/syntax.d.ts\",\n \"import\": \"./dist/syntax.js\"\n },\n \"./config\": {\n \"types\": \"./dist/config.d.ts\",\n \"import\": \"./dist/config.js\"\n },\n \"./declarations\": {\n \"types\": \"./dist/declarations.d.ts\",\n \"import\": \"./dist/declarations.js\"\n },\n \"./vite-react\": {\n \"types\": \"./dist/vite-react.d.ts\",\n \"import\": \"./dist/vite-react.js\"\n }\n },\n \"peerDependencies\": {\n \"react\": \"^18.2.0 || ^19.0.0\",\n \"vue\": \"^3.3.0\",\n \"@vitejs/plugin-react\": \"^6.1.1\"\n },\n \"peerDependenciesMeta\": {\n \"react\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"@vitejs/plugin-react\": {\n \"optional\": true\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"module\": \"./dist/index.js\",\n \"scripts\": {\n \"build\": \"node ../../scripts/generate-runtime-helper.mjs && vite build && vite build --config vite.plugin.config.ts && node scripts/prepare-core.mjs\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\",\n \"prepack\": \"pnpm run build\",\n \"test:unit\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:package\": \"node tests/consumer.mjs\",\n \"test:size\": \"node tests/bundle-size.mjs\",\n \"test:browser\": \"playwright test\",\n \"benchmark\": \"node benchmarks/compiler.mjs\",\n \"test\": \"pnpm run test:unit\",\n \"benchmark:branching\": \"node benchmarks/branching.mjs\",\n \"benchmark:enum-patterns\": \"node benchmarks/enum-patterns.mjs\",\n \"benchmark:runtime\": \"node benchmarks/runtime-helpers.mjs\",\n \"benchmark:if-bindings\": \"node benchmarks/if-bindings.mjs\"\n },\n \"devDependencies\": {\n \"vite\": \"catalog:\",\n \"vite-plugin-dts\": \"^5.1.2\",\n \"@types/node\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"@vitest/coverage-v8\": \"catalog:\",\n \"@rspack/core\": \"catalog:\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vue/server-renderer\": \"catalog:\",\n \"esbuild\": \"catalog:\",\n \"react\": \"catalog:\",\n \"react-dom\": \"catalog:\",\n \"rollup\": \"catalog:\",\n \"vue\": \"catalog:\",\n \"webpack\": \"catalog:\",\n \"@playwright/test\": \"catalog:\",\n \"@swiftuijs/twill-runtime\": \"workspace:*\"\n }\n}\n","import ts from 'typescript';\nimport metadata from '../package.json';\nimport { TwillProject } from './project.js';\nimport { isTwillFile } from './compiler.js';\n\n/** Shareable diagnostics without source contents or environment-variable values. */\nexport function inspectProject(project: TwillProject, filename?: string) {\n const started = performance.now();\n const diagnostics = project.diagnostics(filename);\n const files = project.sourceFiles();\n return {\n twillVersion: metadata.version,\n typescriptVersion: ts.version,\n nodeVersion: process.version,\n root: project.root,\n configFiles: project.configFiles,\n compilerOptions: project.compilerOptions,\n files: {\n total: files.length,\n twill: files.filter(isTwillFile).length,\n native: files.filter((file) => !isTwillFile(file)).length,\n },\n sourceFiles: files,\n diagnostics,\n diagnosticTimeMs: performance.now() - started,\n ok: !diagnostics.some((diagnostic) => diagnostic.category === 'error'),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,SAAgB,eAAe,SAAuB,UAAmB;CACvE,MAAM,UAAU,YAAY,IAAI;CAChC,MAAM,cAAc,QAAQ,YAAY,QAAQ;CAChD,MAAM,QAAQ,QAAQ,YAAY;CAClC,OAAO;EACL,cAAcA,gBAAS;EACvB,mBAAmB,GAAG;EACtB,aAAa,QAAQ;EACrB,MAAM,QAAQ;EACd,aAAa,QAAQ;EACrB,iBAAiB,QAAQ;EACzB,OAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM,OAAO,WAAW,CAAC,CAAC;GACjC,QAAQ,MAAM,QAAQ,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC;EACrD;EACA,aAAa;EACb;EACA,kBAAkB,YAAY,IAAI,IAAI;EACtC,IAAI,CAAC,YAAY,MAAM,eAAe,WAAW,aAAa,OAAO;CACvE;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader-compiler-D1teTrXw.js","names":[],"sources":["../src/loader-compiler.ts"],"sourcesContent":["import ts from 'typescript';\nimport { transpile, transpileNative } from './transpile.js';\nimport { loaderConfiguration } from './configuration.js';\n\nexport function compileModule(source: string, filename: string, dialect: boolean) {\n const { config, observations } = loaderConfiguration(filename);\n const result = dialect\n ? transpile(source, { ...config, filename }, ts.ScriptTarget.ES2022)\n : transpileNative(\n source,\n filename,\n undefined,\n undefined,\n config.jsxImportSource,\n ts.ScriptTarget.ES2022,\n );\n return {\n source:\n result.code +\n '\\n//# sourceMappingURL=data:application/json;base64,' +\n Buffer.from(result.map).toString('base64'),\n observations,\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,cAAc,QAAgB,UAAkB,SAAkB;CAChF,MAAM,EAAE,QAAQ,iBAAiB,oBAAoB,QAAQ;CAC7D,MAAM,SAAS,UACX,UAAU,QAAQ;EAAE,GAAG;EAAQ;CAAS,GAAG,GAAG,aAAa,MAAM,IACjE,gBACE,QACA,UACA,KAAA,GACA,KAAA,GACA,OAAO,iBACP,GAAG,aAAa,MAClB;CACJ,OAAO;EACL,QACE,OAAO,OACP,yDACA,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC,SAAS,QAAQ;EAC3C;CACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"project.js","names":[],"sources":["../src/recovery.ts","../src/project.ts"],"sourcesContent":["import MagicString from 'magic-string';\nimport remapping from '@ampproject/remapping';\nimport {\n transform,\n TwillSyntaxError,\n originalPosition,\n type TransformOptions,\n type TransformResult,\n} from './compiler.js';\n\n/** Editor-only recovery; build and CLI compilation always use strict parsing. */\nexport function recoverTransform(\n source: string,\n options: TransformOptions,\n onSyntaxError?: (error: TwillSyntaxError) => void,\n): TransformResult {\n const repaired = new MagicString(source);\n let text = source;\n // Complete a missing member name or a few unfinished delimiters. Limit repair\n // attempts so malformed documents cannot lock up the extension host.\n for (let attempt = 0; attempt < 8; attempt++) {\n try {\n const result = transform(text, options);\n if (text === source) return result;\n const repairMap = repaired.generateMap({\n source: options.filename,\n includeContent: true,\n hires: true,\n });\n // Descriptor offsets belong to repaired parser input. Restore their\n // source positions before the editor composes generated mappings;\n // otherwise an earlier inserted token can bypass linked-tag rename checks.\n const repairedResult = { ...result, map: repairMap };\n const starts = [0];\n for (const match of source.matchAll(/\\n/g)) starts.push(match.index! + 1);\n const sourceOffset = (offset: number) => {\n const prefix = text.slice(0, offset).split('\\n');\n const point = originalPosition(repairedResult, prefix.length, prefix.at(-1)!.length);\n return starts[point.line! - 1]! + point.column!;\n };\n const enumPatterns = result.enumPatterns.map((pattern) => ({\n ...pattern,\n reference: {\n ...pattern.reference,\n property: {\n ...pattern.reference.property,\n start: sourceOffset(pattern.reference.property.start),\n end: sourceOffset(pattern.reference.property.end),\n },\n },\n }));\n const map = remapping(\n [JSON.parse(result.map.toString()), JSON.parse(repairMap.toString())],\n () => null,\n );\n return { ...result, enumPatterns, map: map as unknown as TransformResult['map'] };\n } catch (error) {\n if (!(error instanceof TwillSyntaxError)) throw error;\n if (attempt === 0) onSyntaxError?.(error);\n const before = text.slice(0, error.offset);\n let insertion: string;\n let offset = error.offset;\n if (/\\.\\s*$/.test(before)) insertion = '__twillIncomplete';\n else if (offset >= text.length) {\n // Match lexical delimiters via the original source. This path only\n // handles suffix completion; it never makes build output valid.\n const stack: string[] = [];\n const scanner =\n /(?:\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n]*|[()[\\]{}])/g;\n for (const token of text.matchAll(scanner)) {\n if ('([{'.includes(token[0])) stack.push(token[0]);\n else if (')]}'.includes(token[0])) stack.pop();\n }\n const opening = stack.at(-1);\n if (!opening) throw error;\n insertion = ({ '(': ')', '[': ']', '{': '}' } as Record<string, string>)[opening]!;\n } else throw error;\n // Later parser errors refer to the repaired text. Map interior offsets\n // back before inserting again; suffix repairs always anchor at source EOF.\n if (offset >= text.length) offset = source.length;\n else if (text !== source) {\n const prefix = text.slice(0, offset).split('\\n');\n const point = originalPosition(\n {\n code: text,\n map: repaired.generateMap({ source: options.filename, hires: true }),\n } as TransformResult,\n prefix.length,\n prefix.at(-1)!.length,\n );\n const starts = [0];\n for (const match of source.matchAll(/\\n/g)) starts.push(match.index! + 1);\n offset =\n point.line == null || point.column == null\n ? source.length\n : starts[point.line - 1]! + point.column;\n }\n repaired.appendLeft(offset, insertion);\n text = repaired.toString();\n }\n }\n return transform(source, options);\n}\n","import ts from 'typescript';\nimport { resolve, dirname } from 'node:path';\nimport {\n transform,\n extensions,\n isTwillFile,\n inferLanguage,\n originalPosition,\n generatedPosition,\n type TransformOptions,\n type TransformResult,\n} from './compiler.js';\nimport { loadConfig } from './config.js';\nimport { recoverTransform } from './recovery.js';\nimport { isDependency } from './files.js';\nexport { isDependency } from './files.js';\n\nfunction lineStarts(text: string): number[] {\n const starts = [0];\n // MagicString maps count LF-delimited lines. TS language-service APIs here\n // take absolute offsets, so keep the map's coordinates at this boundary.\n const breaks = /\\n/g;\n while (breaks.exec(text)) starts.push(breaks.lastIndex);\n return starts;\n}\nfunction positionAt(starts: number[], offset: number) {\n let low = 0;\n let high = starts.length;\n while (low + 1 < high) {\n const mid = (low + high) >>> 1;\n if (starts[mid]! <= offset) low = mid;\n else high = mid;\n }\n return { line: low + 1, column: offset - starts[low]! };\n}\n\n// TypeScript's config discovery accepts custom TS extensions only as Deferred;\n// each virtual filename below supplies the actual script kind to the service.\nconst extraExtensions = extensions.map((extension) => ({\n extension,\n isMixedContent: false,\n scriptKind: ts.ScriptKind.Deferred,\n}));\nexport function virtualFilename(filename: string): string {\n filename = filename.replaceAll('\\\\', '/');\n return isTwillFile(filename)\n ? filename + { ts: '.ts', tsx: '.tsx', js: '.js', jsx: '.jsx' }[inferLanguage(filename)]\n : filename;\n}\nexport function sourceFilename(filename: string): string {\n filename = filename.replaceAll('\\\\', '/');\n if (isTwillFile(filename)) return filename;\n return filename.replace(/(\\.twill)\\.ts$/, '$1').replace(/(\\.twillx)\\.tsx$/, '$1');\n}\n\nexport interface ProjectDiagnostic {\n filename?: string;\n line: number;\n column: number;\n length: number;\n code: number;\n category: 'error' | 'warning' | 'message';\n message: string;\n}\n\n/** A virtual-source TypeScript project shared by the CLI and VS Code extension. */\nexport class TwillProject {\n readonly root: string;\n readonly service: ts.LanguageService;\n readonly compilerOptions: ts.CompilerOptions;\n readonly configFiles: readonly string[];\n private files: string[];\n private overlays = new Map<string, string>();\n private results = new Map<\n string,\n { source: string; result: TransformResult; syntaxError?: Error }\n >();\n private lineMaps = new WeakMap<TransformResult, { original: number[]; generated: number[] }>();\n private version = 0;\n private invalidation = 0;\n private fileVersions = new Map<string, number>();\n private configurationErrors: readonly ts.Diagnostic[];\n private options: TransformOptions;\n private readonly host: ts.LanguageServiceHost;\n private recover: boolean;\n private discoverFiles: () => string[];\n\n constructor(\n tsconfig: string,\n options: TransformOptions = {},\n projectOptions: {\n inferred?: boolean;\n recover?: boolean;\n defaultLibFileName?: (options: ts.CompilerOptions) => string;\n declarationRedirects?: ReadonlyMap<string, string>;\n } = {},\n ) {\n const configFile = sourceFilename(resolve(tsconfig));\n this.root = dirname(configFile);\n this.recover = projectOptions.recover ?? false;\n this.options = { ...loadConfig(this.root, configFile), ...options };\n const configReads = new Set([\n configFile,\n sourceFilename(resolve(this.root, 'twill.config.json')),\n ]);\n const configHost = {\n ...ts.sys,\n readFile: (filename: string) => {\n configReads.add(sourceFilename(filename));\n return ts.sys.readFile(filename);\n },\n };\n const raw =\n projectOptions.inferred && !ts.sys.fileExists(configFile)\n ? {\n config: {\n compilerOptions: {\n strict: true,\n target: 'ES2022',\n module: 'ESNext',\n moduleResolution: 'Bundler',\n jsx: 'react-jsx',\n },\n },\n }\n : ts.readConfigFile(configFile, configHost.readFile);\n const parsed = ts.parseJsonConfigFileContent(\n raw.config ?? {},\n configHost,\n this.root,\n { allowJs: true, allowImportingTsExtensions: true, noEmit: true },\n configFile,\n undefined,\n extraExtensions,\n );\n this.configurationErrors = [...(raw.error ? [raw.error] : []), ...parsed.errors];\n if (parsed.projectReferences?.length && !projectOptions.declarationRedirects)\n this.configurationErrors = [\n ...this.configurationErrors,\n {\n category: ts.DiagnosticCategory.Error,\n code: 90002,\n file: undefined,\n start: undefined,\n length: undefined,\n messageText:\n 'TypeScript project references are not supported by twill check. Check each referenced project separately.',\n },\n ];\n this.compilerOptions = parsed.options;\n this.configFiles = [...configReads];\n this.options.jsxImportSource ??= parsed.options.jsxImportSource;\n this.files = parsed.fileNames.map(virtualFilename);\n this.discoverFiles = () =>\n ts\n .parseJsonConfigFileContent(\n raw.config ?? {},\n configHost,\n this.root,\n { allowJs: true, allowImportingTsExtensions: true, noEmit: true },\n configFile,\n undefined,\n extraExtensions,\n )\n .fileNames.map(virtualFilename);\n const readFile = (name: string) => {\n const original = sourceFilename(name);\n const source = this.overlays.get(original) ?? ts.sys.readFile(original);\n if (source === undefined) return undefined;\n if (!isTwillFile(original)) return source;\n // Syntax failures are reported separately, with original source positions.\n // Keep the service alive so other open documents still work.\n try {\n return this.result(original, source).code;\n } catch {\n return '';\n }\n };\n const fileExists = (name: string) =>\n this.overlays.has(sourceFilename(name)) || ts.sys.fileExists(sourceFilename(name));\n const resolutionHost: ts.ModuleResolutionHost = { ...ts.sys, readFile, fileExists };\n this.host = {\n ...ts.sys,\n getScriptFileNames: () => this.files,\n useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,\n getScriptVersion: (name) =>\n `${this.invalidation}:${this.fileVersions.get(sourceFilename(name)) ?? 0}`,\n getProjectVersion: () => String(this.version),\n getScriptSnapshot: (name) => {\n const text = readFile(name);\n return text === undefined ? undefined : ts.ScriptSnapshot.fromString(text);\n },\n getCurrentDirectory: () => this.root,\n getCompilationSettings: () => this.compilerOptions,\n getDefaultLibFileName:\n projectOptions.defaultLibFileName ?? ((opts) => ts.getDefaultLibFilePath(opts)),\n readFile,\n fileExists,\n resolveModuleNames: (names, importer) =>\n names.map((name) => {\n const resolved = ts.resolveModuleName(\n name,\n importer,\n this.compilerOptions,\n resolutionHost,\n ).resolvedModule;\n if (resolved) {\n const redirect = projectOptions.declarationRedirects?.get(\n sourceFilename(resolved.resolvedFileName),\n );\n return redirect\n ? { ...resolved, resolvedFileName: redirect, extension: ts.Extension.Dts }\n : { ...resolved, resolvedFileName: virtualFilename(resolved.resolvedFileName) };\n }\n if (name.startsWith('.') || name.startsWith('/')) {\n const base = resolve(dirname(sourceFilename(importer)), name);\n const candidates = isTwillFile(base)\n ? [base]\n : extensions.flatMap((extension) => [\n base + extension,\n resolve(base, 'index' + extension),\n ]);\n for (const candidate of candidates) {\n if (fileExists(candidate)) {\n const redirect = projectOptions.declarationRedirects?.get(\n sourceFilename(candidate),\n );\n if (redirect)\n return {\n resolvedFileName: redirect,\n extension: ts.Extension.Dts,\n isExternalLibraryImport: false,\n };\n const file = virtualFilename(candidate);\n // Fallback candidates are exclusively .twill/.twillx; native\n // JS/TS extensions are resolved by TypeScript above.\n const extension = file.endsWith('.tsx') ? ts.Extension.Tsx : ts.Extension.Ts;\n return { resolvedFileName: file, extension, isExternalLibraryImport: false };\n }\n }\n }\n return undefined;\n }),\n };\n this.service = ts.createLanguageService(this.host);\n }\n\n /** Declaration-only native TypeScript emit from the checked virtual program. */\n declarationOutput(outDir: string, declarationMap = true) {\n const diagnostics = this.diagnostics();\n if (diagnostics.some((item) => item.category === 'error')) return { diagnostics, files: [] };\n const previous = this.service.getProgram();\n if (!previous) return { diagnostics, files: [] };\n const options: ts.CompilerOptions = {\n ...this.compilerOptions,\n noEmit: false,\n declaration: true,\n emitDeclarationOnly: true,\n declarationMap,\n noEmitOnError: true,\n incremental: false,\n composite: false,\n rootDir: this.compilerOptions.rootDir ?? this.root,\n outDir,\n declarationDir: outDir,\n allowImportingTsExtensions: true,\n };\n const host = ts.createCompilerHost(options);\n host.readFile = this.host.readFile!;\n host.fileExists = this.host.fileExists!;\n host.getCurrentDirectory = () => this.root;\n host.resolveModuleNames = this.host.resolveModuleNames;\n host.getSourceFile = (filename, languageVersion) =>\n previous.getSourceFile(filename) ??\n (host.readFile(filename) === undefined\n ? undefined\n : ts.createSourceFile(filename, host.readFile(filename)!, languageVersion, true));\n const program = ts.createProgram(previous.getRootFileNames(), options, host);\n const errors = ts.getPreEmitDiagnostics(program).map((item) => this.diagnostic(item));\n if (errors.some((item) => item.category === 'error')) return { diagnostics: errors, files: [] };\n const files: { filename: string; text: string; sources: string[] }[] = [];\n const emitted = program.emit(\n undefined,\n (filename, text, _bom, _error, sources) => {\n files.push({\n filename: sourceFilename(filename),\n text,\n sources: sources?.map((source) => sourceFilename(source.fileName)) ?? [],\n });\n },\n undefined,\n true,\n );\n return {\n diagnostics: [...diagnostics, ...emitted.diagnostics.map((item) => this.diagnostic(item))],\n files: emitted.emitSkipped ? [] : files,\n };\n }\n\n private result(filename: string, source: string): TransformResult {\n const cached = this.results.get(filename);\n if (cached?.source === source) return cached.result;\n const options = { ...this.options, filename };\n let syntaxError: Error | undefined;\n const result = this.recover\n ? recoverTransform(source, options, (error) => {\n syntaxError = error;\n })\n : transform(source, options);\n this.results.set(filename, { source, result, syntaxError });\n return result;\n }\n\n update(filename: string, text?: string) {\n filename = sourceFilename(resolve(filename));\n // Hover and completion often submit the same open document. An unchanged\n // overlay must retain compiler results and TypeScript's semantic caches.\n if (\n text !== undefined &&\n text === this.overlays.get(filename) &&\n this.files.includes(virtualFilename(filename))\n )\n return;\n if (text === undefined) this.overlays.delete(filename);\n else this.overlays.set(filename, text);\n this.fileVersions.set(filename, (this.fileVersions.get(filename) ?? 0) + 1);\n if (!this.files.includes(virtualFilename(filename))) this.files.push(virtualFilename(filename));\n this.results.delete(filename);\n this.version++;\n }\n\n invalidate() {\n this.invalidation++;\n this.version++;\n this.results.clear();\n }\n\n /** Refresh a disk version without discarding unsaved overlays or other transforms. */\n refresh(filename: string, discover = false) {\n filename = sourceFilename(resolve(filename));\n if (discover)\n this.files = [\n ...new Set([...this.discoverFiles(), ...[...this.overlays.keys()].map(virtualFilename)]),\n ];\n if (!this.overlays.has(filename)) {\n this.results.delete(filename);\n this.fileVersions.set(filename, (this.fileVersions.get(filename) ?? 0) + 1);\n }\n this.version++;\n }\n\n text(filename: string): string | undefined {\n filename = sourceFilename(resolve(filename));\n return this.overlays.get(filename) ?? ts.sys.readFile(filename);\n }\n\n transformed(filename: string): TransformResult | undefined {\n filename = sourceFilename(resolve(filename));\n const source = this.text(filename);\n return source !== undefined && isTwillFile(filename)\n ? this.result(filename, source)\n : undefined;\n }\n\n sourceFiles(): string[] {\n const dependencies =\n this.service\n .getProgram()\n ?.getSourceFiles()\n .filter((file) => !file.isDeclarationFile && !isDependency(file.fileName))\n .map((file) => file.fileName) ?? [];\n return [...new Set([...this.files, ...dependencies].map(sourceFilename))];\n }\n\n private lines(filename: string, result: TransformResult) {\n let lines = this.lineMaps.get(result);\n if (!lines) {\n lines = { original: lineStarts(this.text(filename)!), generated: lineStarts(result.code) };\n this.lineMaps.set(result, lines);\n }\n return lines;\n }\n\n toGeneratedOffset(filename: string, offset: number): number {\n const result = this.transformed(filename);\n if (!result) return offset;\n const lines = this.lines(filename, result);\n const sourcePosition = positionAt(lines.original, offset);\n const position = generatedPosition(result, sourcePosition.line, sourcePosition.column);\n if (position.line === null || position.column === null) return offset;\n return (lines.generated[position.line - 1] ?? 0) + position.column;\n }\n\n toOriginalOffset(filename: string, offset: number): number {\n const result = this.transformed(filename);\n if (!result) return offset;\n const lines = this.lines(filename, result);\n const sourcePosition = positionAt(lines.generated, offset);\n const position = originalPosition(result, sourcePosition.line, sourcePosition.column);\n if (position.line === null || position.column === null) return 0;\n return (lines.original[position.line - 1] ?? 0) + position.column;\n }\n\n private diagnostic(diagnostic: ts.Diagnostic): ProjectDiagnostic {\n const filename = diagnostic.file ? sourceFilename(diagnostic.file.fileName) : undefined;\n const source = filename ? (this.text(filename) ?? '') : '';\n const start = filename ? this.toOriginalOffset(filename, diagnostic.start ?? 0) : 0;\n const end = filename\n ? this.toOriginalOffset(filename, (diagnostic.start ?? 0) + (diagnostic.length ?? 1))\n : start + 1;\n const before = source.slice(0, start).split(/\\r\\n|[\\r\\n\\u2028\\u2029]/);\n return {\n filename,\n line: before.length,\n column: before.at(-1)!.length,\n length: Math.max(1, end - start),\n code: diagnostic.code,\n category:\n diagnostic.category === ts.DiagnosticCategory.Error\n ? 'error'\n : diagnostic.category === ts.DiagnosticCategory.Warning\n ? 'warning'\n : 'message',\n message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'),\n };\n }\n\n diagnostics(filename?: string): ProjectDiagnostic[] {\n const result = this.configurationErrors.map((error) => this.diagnostic(error));\n if (!filename)\n result.push(\n ...this.service.getCompilerOptionsDiagnostics().map((error) => this.diagnostic(error)),\n );\n const files = filename\n ? [virtualFilename(resolve(filename))]\n : this.sourceFiles().map(virtualFilename);\n for (const file of files) {\n if (/\\.d\\.[cm]?ts$/.test(file)) continue;\n try {\n this.transformed(file);\n const syntaxError = this.results.get(sourceFilename(file))?.syntaxError;\n if (syntaxError) throw syntaxError;\n result.push(\n ...[\n ...this.service.getSyntacticDiagnostics(file),\n ...this.service.getSemanticDiagnostics(file),\n ].map((error) => this.diagnostic(error)),\n );\n } catch (error) {\n const syntax = error as { message: string; line?: number; column?: number };\n result.push({\n filename: sourceFilename(file),\n line: syntax.line ?? 1,\n column: syntax.column ?? 0,\n length: 1,\n code: 90001,\n category: 'error',\n message: syntax.message,\n });\n }\n }\n return result;\n }\n\n dispose() {\n this.service.dispose();\n }\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,iBACd,QACA,SACA,eACiB;CACjB,MAAM,WAAW,IAAI,YAAY,MAAM;CACvC,IAAI,OAAO;CAGX,KAAK,IAAI,UAAU,GAAG,UAAU,GAAG,WACjC,IAAI;EACF,MAAM,SAAS,UAAU,MAAM,OAAO;EACtC,IAAI,SAAS,QAAQ,OAAO;EAC5B,MAAM,YAAY,SAAS,YAAY;GACrC,QAAQ,QAAQ;GAChB,gBAAgB;GAChB,OAAO;EACT,CAAC;EAID,MAAM,iBAAiB;GAAE,GAAG;GAAQ,KAAK;EAAU;EACnD,MAAM,SAAS,CAAC,CAAC;EACjB,KAAK,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG,OAAO,KAAK,MAAM,QAAS,CAAC;EACxE,MAAM,gBAAgB,WAAmB;GACvC,MAAM,SAAS,KAAK,MAAM,GAAG,MAAM,CAAC,CAAC,MAAM,IAAI;GAC/C,MAAM,QAAQ,iBAAiB,gBAAgB,OAAO,QAAQ,OAAO,GAAG,EAAE,CAAC,CAAE,MAAM;GACnF,OAAO,OAAO,MAAM,OAAQ,KAAM,MAAM;EAC1C;EACA,MAAM,eAAe,OAAO,aAAa,KAAK,aAAa;GACzD,GAAG;GACH,WAAW;IACT,GAAG,QAAQ;IACX,UAAU;KACR,GAAG,QAAQ,UAAU;KACrB,OAAO,aAAa,QAAQ,UAAU,SAAS,KAAK;KACpD,KAAK,aAAa,QAAQ,UAAU,SAAS,GAAG;IAClD;GACF;EACF,EAAE;EACF,MAAM,MAAM,UACV,CAAC,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,GAAG,KAAK,MAAM,UAAU,SAAS,C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AAG;GAChC,IAAI;IACF,KAAK,YAAY,IAAI;IACrB,MAAM,cAAc,KAAK,QAAQ,IAAI,eAAe,IAAI,CAAC,CAAC,EAAE;IAC5D,IAAI,aAAa,MAAM;IACvB,OAAO,KACL,GAAG,CACD,GAAG,KAAK,QAAQ,wBAAwB,IAAI,GAC5C,GAAG,KAAK,QAAQ,uBAAuB,IAAI,CAC7C,CAAC,CAAC,KAAK,UAAU,KAAK,WAAW,KAAK,CAAC,CACzC;GACF,SAAS,OAAO;IACd,MAAM,SAAS;IACf,OAAO,KAAK;KACV,UAAU,eAAe,IAAI;KAC7B,MAAM,OAAO,QAAQ;KACrB,QAAQ,OAAO,UAAU;KACzB,QAAQ;KACR,MAAM;KACN,UAAU;KACV,SAAS,OAAO;IAClB,CAAC;GACH;EACF;EACA,OAAO;CACT;CAEA,UAAU;EACR,KAAK,QAAQ,QAAQ;CACvB;AACF"}
package/dist/vite.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { twillPlugin } from './plugin.js';\nexport default twillPlugin.vite;\nexport type { PluginOptions } from './plugin.js';\n"],"mappings":";;AACA,IAAA,eAAe,YAAY"}