diff --git a/CHANGELOG.md b/CHANGELOG.md index 2286be6..86ef806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ Notable changes to `@intentius/github-warden`. Versions follow semver, and releases before `0.4.1` are not recorded here. +## Unreleased + +- New `codeowners` subcommand generates CODEOWNERS with one rule per member of a + chant workspace. Members are read through chant's read contract + (`chant workspace ls --json`), and owners are declared by member name in an + owners file. See [CLI.md](CLI.md#codeowners). +- The `@intentius/chant` and `@intentius/chant-lexicon-github` range moves from + `^0.72.1` to `^0.100.0`, since the read contract starts at chant 0.81. + ## 0.5.0 (2026-09-02) The removal cap is now evaluated per collection. Deletes of each resource type diff --git a/CLI.md b/CLI.md index 19c28da..64d8734 100644 --- a/CLI.md +++ b/CLI.md @@ -1,14 +1,16 @@ # CLI reference -The `github-warden` binary has three subcommands. All of them load the policy -file (`--config`) and authenticate the same way; they differ in what they do -with live GitHub state. +The `github-warden` binary has four subcommands. `reconcile`, `audit` and +`report` load the policy file (`--config`) and authenticate the same way; they +differ in what they do with live GitHub state. `codeowners` reads a chant +workspace from disk and touches neither GitHub nor the policy file. | Subcommand | What it does | Mutates? | |---|---|---| | `reconcile` | Diff desired vs live per cycle, guardrail-check, print the plan (`dry-run`) or apply it. | Only with `--mode apply`. | | `audit` | Run chant's posture-audit engine over every repo declared in the config. | Never. | | `report` | Run cycles in dry-run, optionally add audit and identity passes, print a compliance snapshot, optionally write a JSON artifact. | Never. | +| `codeowners` | Generate CODEOWNERS from the members of a chant workspace. | Only the `--out` file, and not with `--check`. | `github-warden --help` (or no arguments, or `--help` after a subcommand) prints usage; `github-warden --version` prints the version (inlined from @@ -128,3 +130,48 @@ several org administration endpoints are callable only by a GitHub App. See | 2 | Argument or config error (unknown flag, unknown cycle, invalid config shape, missing auth). | | 3 | Runtime error (unreadable config file, API failure, an errored cycle, or failed apply entries). | | 4 | `audit`: findings exceed `--fail-on`; `report`: needs attention with `--fail-on attention`. | + +## `codeowners` + +``` +github-warden codeowners --owners [--dir ] [--out ] [--check] +``` + +Generates a CODEOWNERS file with one rule per workspace member directory. The +members come from chant's workspace read contract: the warden runs +`chant workspace ls --json` (contract 1, chant 0.81.0 or newer) and never reads +`chant.workspace.json` itself. The chant that runs is the one installed beside +the warden, else `chant` on PATH. + +| Flag | Default | Meaning | +|---|---|---| +| `--owners ` | **required** | Owners file (YAML or JSON), described below. | +| `--dir ` | `.` | Where chant starts looking for the workspace declaration. | +| `--out ` | stdout | Write the file here, for example `.github/CODEOWNERS`. | +| `--check` | off | With `--out`, write nothing and exit 4 when the file differs from what would be generated. | + +The owners file names owners by member name, so a member that moves keeps its +owners. Every list must be non-empty and hold `@user`, `@org/team` or email +owners. + +```json +{ + "default": ["@acme/maintainers"], + "members": { + "api": ["@acme/api"], + "docs": ["@acme/docs", "@writer"] + } +} +``` + +`default` becomes a `*` rule. Each member becomes a rule on its directory, +prefixed with the workspace root when the workspace sits below the git root. +GitHub applies the last matching rule, so shallower directories come first and +a nested member's rule overrides its parent's. A member whose directory is +missing (reason `dir-missing`) is skipped with a note on stderr. A name in the +owners file that the workspace has no member for exits 2. A failed chant read +exits 3. + +Not yet covered: required status checks per member pipeline and a ruleset for +the `chant/lifecycle` branch. Both need the generated job names, which no +contract document carries yet (INTENTIUS/chant#3050). diff --git a/action/index.mjs b/action/index.mjs index 69ffbad..8262a6f 100644 --- a/action/index.mjs +++ b/action/index.mjs @@ -817,9 +817,9 @@ function diffBranchProtection(repoName, desired, live, opts, out) { "allowDeletions", "requireLinearHistory" ]; - for (const [pattern, db] of desiredByPattern) { - const lb = liveByPattern.get(pattern); - const key = `${repoName}/${pattern}`; + for (const [pattern2, db] of desiredByPattern) { + const lb = liveByPattern.get(pattern2); + const key = `${repoName}/${pattern2}`; if (!lb) { out.push({ kind: "create", resourceType: "branch-protection", key, after: db }); continue; @@ -851,9 +851,9 @@ function diffBranchProtection(repoName, desired, live, opts, out) { }); } } - for (const [pattern, lb] of liveByPattern) { - if (!desiredByPattern.has(pattern)) { - const key = `${repoName}/${pattern}`; + for (const [pattern2, lb] of liveByPattern) { + if (!desiredByPattern.has(pattern2)) { + const key = `${repoName}/${pattern2}`; if (opts.isOwned?.("branch-protection", key)) { out.push({ kind: "delete", resourceType: "branch-protection", key, before: lb }); } @@ -1274,13 +1274,70 @@ var init_runner = __esm({ }); // node_modules/@intentius/chant/src/yaml.ts +function isBlankOrComment(line) { + const t = line.trim(); + return t === "" || t.startsWith("#"); +} +function nextContentLine(lines, from) { + let i = from; + while (i < lines.length && isBlankOrComment(lines[i])) i++; + return i; +} +function indentOf(line) { + return line.search(/\S/); +} +function isSeqEntry(line) { + return SEQ_ENTRY.test(line); +} +function keyName(raw) { + const key = raw.trim(); + return key.startsWith('"') || key.startsWith("'") ? String(parseScalar(key)) : key; +} +function toLines(content) { + return content.replace(/\r\n?/g, "\n").split("\n").map((line) => DOCUMENT_MARKER.test(line) ? "" : line); +} +function parseWhole(lines, first, parse4) { + const outer = anchors; + anchors = /* @__PURE__ */ new Map(); + try { + const result = parse4(lines, first, indentOf(lines[first])); + const rest = nextContentLine(lines, result.endIndex); + if (rest < lines.length) { + throw new YAMLParseError( + rest + 1, + `cannot place ${JSON.stringify(lines[rest].trim())} at column ${indentOf(lines[rest]) + 1}; check its indentation, or the construct is one this parser does not read` + ); + } + return result.value; + } finally { + anchors = outer; + } +} +function resolveAlias(name, line) { + if (!anchors.has(name)) throw new YAMLParseError(line, `the alias *${name} has no anchor &${name} before it`); + return structuredClone(anchors.get(name)); +} +function setKey(obj, merges, key, value) { + if (key === MERGE_KEY) merges.push(...Array.isArray(value) ? value : [value]); + else obj[key] = value; +} +function applyMerges(obj, merges, line) { + for (const source of merges) { + if (typeof source !== "object" || source === null || Array.isArray(source)) { + throw new YAMLParseError(line, "a merge key (<<) takes a mapping or a list of mappings"); + } + for (const [k, v] of Object.entries(source)) if (!(k in obj)) obj[k] = v; + } +} function parseYAML(content) { try { return JSON.parse(content); } catch { } - const lines = content.replace(/\r\n?/g, "\n").split("\n"); - return parseYAMLLines(lines, 0, 0).value; + const lines = toLines(content); + const first = nextContentLine(lines, 0); + if (first === lines.length || isSeqEntry(lines[first])) return {}; + return parseWhole(lines, first, parseYAMLLines); } function blockScalarHeader(inline) { const m = inline.match(/^([|>])([+-]?)(?:\s+#.*)?$/); @@ -1339,196 +1396,190 @@ function parseBlockScalar(lines, startIndex, parentIndent, header) { } function parseYAMLLines(lines, startIndex, baseIndent) { const result = {}; + const merges = []; let i = startIndex; while (i < lines.length) { const line = lines[i]; - if (line.trim() === "" || line.trim().startsWith("#")) { + if (isBlankOrComment(line)) { i++; continue; } - const indent = line.search(/\S/); - if (indent < baseIndent) break; - if (indent > baseIndent && startIndex > 0) break; + if (indentOf(line) !== baseIndent || isSeqEntry(line)) break; const keyMatch = line.match(KEY_LINE); - if (keyMatch) { - const key = keyMatch[2].trim(); - const inlineValue = keyMatch[3].trim(); - if (inlineValue === "" || inlineValue.startsWith("#")) { - if (i + 1 < lines.length) { - const nextLine = lines[i + 1]; - const nextIndent = nextLine.search(/\S/); - if (nextLine.trimStart().startsWith("- ") && nextIndent >= indent) { - const arr = parseYAMLArray(lines, i + 1, nextIndent); - result[key] = arr.value; - i = arr.endIndex; - continue; - } else if (nextIndent > indent) { - const nested = parseYAMLLines(lines, i + 1, nextIndent); - result[key] = nested.value; - i = nested.endIndex; - continue; - } - } - result[key] = null; - i++; - } else if (inlineValue.startsWith("[")) { - try { - result[key] = JSON.parse(inlineValue); - } catch { - result[key] = inlineValue; - } - i++; - } else if (inlineValue.startsWith("{")) { - try { - result[key] = JSON.parse(inlineValue); - } catch { - result[key] = inlineValue; - } - i++; - } else { - const header = blockScalarHeader(inlineValue); - if (header) { - const block2 = parseBlockScalar(lines, i + 1, indent, header); - result[key] = block2.value; - i = block2.endIndex; - } else { - result[key] = parseScalar(inlineValue); - i++; - } - } - } else if (line.trimStart().startsWith("- ")) { - break; - } else { - i++; - } + if (!keyMatch) break; + const value = parseValue(keyMatch[3].trim(), lines, i, baseIndent); + setKey(result, merges, keyName(keyMatch[2]), value.value); + i = value.endIndex; } + applyMerges(result, merges, startIndex + 1); return { value: result, endIndex: i }; } -function parseArrayItemValue(inlineValue, lines, currentIndex, keyIndent) { - if (inlineValue !== "" && !inlineValue.startsWith("#")) { - const header = blockScalarHeader(inlineValue); - if (header) { - const dash = lines[currentIndex].match(/^(\s*)- /); - const keyIndent2 = dash ? dash[1].length + 2 : lines[currentIndex].search(/\S/); - return parseBlockScalar(lines, currentIndex + 1, keyIndent2, header).value; - } - if (inlineValue.startsWith("[")) { - try { - return JSON.parse(inlineValue); - } catch { - return inlineValue; - } - } - if (inlineValue.startsWith("{")) { - try { - return JSON.parse(inlineValue); - } catch { - return inlineValue; - } +function parseValue(inline, lines, at, keyIndent, sequenceAtKeyColumn = true) { + const anchor = inline.match(ANCHOR); + if (anchor) { + const value = parseValue((anchor[2] ?? "").trim(), lines, at, keyIndent, sequenceAtKeyColumn); + anchors.set(anchor[1], structuredClone(value.value)); + return value; + } + const alias = inline.match(ALIAS); + if (alias) return { value: resolveAlias(alias[1], at + 1), endIndex: at + 1 }; + if (ALIAS_LIST.test(inline)) { + const names = [...inline.matchAll(/\*([^\s,[\]{}]+)/g)].map((m) => m[1]); + return { value: names.map((name) => resolveAlias(name, at + 1)), endIndex: at + 1 }; + } + if (inline === "" || inline.startsWith("#")) { + const k = nextContentLine(lines, at + 1); + if (k < lines.length) { + const ni = indentOf(lines[k]); + const nested = isSeqEntry(lines[k]) && sequenceAtKeyColumn ? ni >= keyIndent : ni > keyIndent; + if (nested) return parseNode(lines, k, keyIndent); } - return parseScalar(inlineValue); + return { value: null, endIndex: at + 1 }; } - const nextIdx = currentIndex + 1; - if (nextIdx < lines.length) { - const nextLine = lines[nextIdx]; - if (nextLine.trim() !== "" && !nextLine.trim().startsWith("#")) { - const ni = nextLine.search(/\S/); - if (nextLine.trimStart().startsWith("- ")) { - if (ni >= keyIndent) return parseYAMLArray(lines, nextIdx, ni).value; - } else if (ni > keyIndent) { - return parseYAMLLines(lines, nextIdx, ni).value; - } + if (inline.startsWith("[") || inline.startsWith("{")) { + try { + return { value: JSON.parse(inline), endIndex: at + 1 }; + } catch { + return { value: inline, endIndex: at + 1 }; } } - return null; + const header = blockScalarHeader(inline); + if (header) return parseBlockScalar(lines, at + 1, keyIndent, header); + return parseFlowScalar(inline, lines, at + 1, keyIndent); } -function skipValueBlock(lines, startIndex, keyIndent) { - let k = startIndex; - while (k < lines.length && (lines[k].trim() === "" || lines[k].trim().startsWith("#"))) k++; - if (k < lines.length) { - const ni = lines[k].search(/\S/); - if (ni >= keyIndent && lines[k].trimStart().startsWith("- ")) { - return parseYAMLArray(lines, k, ni).endIndex; +function parseNode(lines, k, parentIndent) { + const line = lines[k]; + if (isSeqEntry(line)) return parseYAMLArray(lines, k, indentOf(line)); + if (KEY_LINE.test(line)) return parseYAMLLines(lines, k, indentOf(line)); + return parseValue(line.trim(), lines, k, parentIndent); +} +function closingQuote(text, quote, from) { + for (let i = from; i < text.length; i++) { + const ch = text[i]; + if (quote === '"' && ch === "\\") { + i++; + continue; + } + if (ch === quote) { + if (quote === "'" && text[i + 1] === "'") { + i++; + continue; + } + return i; } } - return skipNestedBlock(lines, startIndex, keyIndent + 1); + return -1; } -function skipNestedBlock(lines, startIndex, childIndent) { - let j = startIndex; - while (j < lines.length) { - const l = lines[j]; - if (l.trim() === "" || l.trim().startsWith("#")) { - j++; +function isWholeQuotedScalar(text) { + const quote = text[0]; + if (quote !== '"' && quote !== "'") return false; + return closingQuote(text, quote, 1) === text.length - 1; +} +function parseFlowScalar(first, lines, from, parentIndent) { + const quote = first[0]; + if (quote === '"' || quote === "'") { + if (closingQuote(first, quote, 1) !== -1) return { value: parseScalar(first), endIndex: from }; + return parseMultilineQuoted(first, lines, from, parentIndent, quote); + } + let text = first; + let endIndex = from; + let blanks = 0; + for (let j = from; j < lines.length; j++) { + const line = lines[j]; + const t = line.trim(); + if (t === "") { + blanks++; continue; } - const ni = l.search(/\S/); - if (ni < childIndent) break; - j++; + if (t.startsWith("#") || indentOf(line) <= parentIndent) break; + if (KEY_LINE.test(line)) { + throw new YAMLParseError( + j + 1, + /^!\S*$/.test(first) ? `the tag ${JSON.stringify(first)} before a nested block is not supported` : `${JSON.stringify(t)} is indented under the value ${JSON.stringify(first)}, and a scalar cannot hold a mapping; check its indentation` + ); + } + text += blanks > 0 ? "\n".repeat(blanks) : " "; + text += t; + blanks = 0; + endIndex = j + 1; + } + return { value: parseScalar(text), endIndex }; +} +function parseMultilineQuoted(first, lines, from, parentIndent, quote) { + const segments = [first.slice(1)]; + for (let j = from; j < lines.length; j++) { + const line = lines[j]; + if (line.trim() !== "" && indentOf(line) <= parentIndent) break; + const close = closingQuote(line, quote, 0); + if (close === -1) { + segments.push(line); + continue; + } + segments.push(line.slice(0, close)); + let body = ""; + let blanks = 0; + let escapedBreak = false; + segments.forEach((raw, n) => { + const isFirst = n === 0; + const isLast = n === segments.length - 1; + let s = raw; + if (!isFirst && !escapedBreak) s = s.replace(/^[ \t]+/, ""); + const endsEscaped = !isLast && quote === '"' && /(?:^|[^\\])(?:\\\\)*\\$/.test(s); + if (!isLast && !endsEscaped) s = s.replace(/[ \t]+$/, ""); + if (!isFirst && !isLast && s === "" && !escapedBreak) { + blanks++; + return; + } + if (!isFirst) body += escapedBreak ? "\n" : blanks > 0 ? "\n".repeat(blanks) : " "; + body += s; + blanks = 0; + escapedBreak = endsEscaped; + }); + return { value: parseScalar(quote + body + quote), endIndex: j + 1 }; } - return j; + throw new YAMLParseError(from, `unterminated ${quote === '"' ? "double" : "single"}-quoted scalar`); } function parseYAMLArray(lines, startIndex, baseIndent) { const result = []; let i = startIndex; while (i < lines.length) { const line = lines[i]; - if (line.trim() === "" || line.trim().startsWith("#")) { + if (isBlankOrComment(line)) { i++; continue; } - const indent = line.search(/\S/); - if (indent < baseIndent) break; - const itemMatch = line.match(/^(\s*)- (.*)$/); - if (itemMatch && indent === baseIndent) { - const itemValue = itemMatch[2].trim(); - const isQuotedScalar = itemValue.startsWith('"') && itemValue.endsWith('"') || itemValue.startsWith("'") && itemValue.endsWith("'"); - const kvMatch = !isQuotedScalar && itemValue.match(ITEM_KEY); - if (kvMatch) { - const obj = {}; - obj[kvMatch[1].trim()] = parseArrayItemValue(kvMatch[2].trim(), lines, i, indent + 2); - const nextIndent = indent + 2; - const firstVal = kvMatch[2].trim(); - let j = firstVal === "" || firstVal.startsWith("#") ? skipValueBlock(lines, i + 1, nextIndent) : blockScalarHeader(firstVal) ? skipNestedBlock(lines, i + 1, nextIndent + 1) : i + 1; - while (j < lines.length) { - const nextLine = lines[j]; - if (nextLine.trim() === "" || nextLine.trim().startsWith("#")) { - j++; - continue; - } - const ni = nextLine.search(/\S/); - if (ni < nextIndent) break; - if (ni > nextIndent) break; - const nextKV = nextLine.match(KEY_LINE); - if (nextKV) { - const nextVal = nextKV[3].trim(); - obj[nextKV[2].trim()] = parseArrayItemValue(nextVal, lines, j, ni); - if (nextVal === "" || nextVal.startsWith("#")) { - j = skipValueBlock(lines, j + 1, ni); - } else if (blockScalarHeader(nextVal)) { - j = skipNestedBlock(lines, j + 1, ni + 1); - } else { - j++; - } - } else { - break; - } - } - result.push(obj); - i = j; - } else { - const header = blockScalarHeader(itemValue); - if (header) { - const block2 = parseBlockScalar(lines, i + 1, indent, header); - result.push(block2.value); - i = block2.endIndex; - } else { - result.push(parseScalar(itemValue)); - i++; + const itemMatch = line.match(SEQ_ENTRY); + if (!itemMatch || indentOf(line) !== baseIndent) break; + const itemValue = (itemMatch[3] ?? "").trim(); + const keyIndent = baseIndent + 1 + (itemMatch[2]?.length ?? 1); + const kvMatch = isWholeQuotedScalar(itemValue) ? null : itemValue.match(ITEM_KEY); + if (kvMatch) { + const obj = {}; + const merges = []; + const firstValue = parseValue(kvMatch[2].trim(), lines, i, keyIndent); + setKey(obj, merges, keyName(kvMatch[1]), firstValue.value); + let j = firstValue.endIndex; + while (j < lines.length) { + const nextLine = lines[j]; + if (isBlankOrComment(nextLine)) { + j++; + continue; } + if (indentOf(nextLine) !== keyIndent || isSeqEntry(nextLine)) break; + const nextKV = nextLine.match(KEY_LINE); + if (!nextKV) break; + const value = parseValue(nextKV[3].trim(), lines, j, keyIndent); + setKey(obj, merges, keyName(nextKV[2]), value.value); + j = value.endIndex; } - } else { - break; + applyMerges(obj, merges, i + 1); + result.push(obj); + i = j; + continue; } + const item = parseValue(itemValue, lines, i, baseIndent, false); + result.push(item.value); + i = item.endIndex; } return { value: result, endIndex: i }; } @@ -1578,11 +1629,28 @@ function unescapeDoubleQuoted(body) { } return out; } -var KEY_LINE, ITEM_KEY, DQ_ESCAPES; +var YAMLParseError, KEY, KEY_LINE, ITEM_KEY, SEQ_ENTRY, DOCUMENT_MARKER, anchors, ANCHOR, ALIAS, ALIAS_LIST, MERGE_KEY, DQ_ESCAPES; var init_yaml = __esm({ "node_modules/@intentius/chant/src/yaml.ts"() { - KEY_LINE = /^(\s*)([^\s:][^:]*?):(?=\s|$)\s*(.*)$/; - ITEM_KEY = /^([^\s:][^:]*?):(?=\s|$)\s*(.*)$/; + YAMLParseError = class extends Error { + /** 1-based line number within the text handed to the parser. */ + line; + constructor(line, message) { + super(`YAML line ${line}: ${message}`); + this.name = "YAMLParseError"; + this.line = line; + } + }; + KEY = String.raw`("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^\s:"'][^:]*?)`; + KEY_LINE = new RegExp(String.raw`^(\s*)${KEY}:(?=\s|$)\s*(.*)$`); + ITEM_KEY = new RegExp(String.raw`^${KEY}:(?=\s|$)\s*(.*)$`); + SEQ_ENTRY = /^(\s*)-(?:([ \t]+)(.*))?$/; + DOCUMENT_MARKER = /^(?:---|\.\.\.)(?:[ \t]+#.*)?[ \t]*$/; + anchors = /* @__PURE__ */ new Map(); + ANCHOR = /^&([^\s,[\]{}]+)(?:[ \t]+(.*))?$/; + ALIAS = /^\*([^\s,[\]{}]+)(?:[ \t]+#.*)?$/; + ALIAS_LIST = /^\[\s*\*[^\s,[\]{}]+(?:\s*,\s*\*[^\s,[\]{}]+)*\s*\](?:[ \t]+#.*)?$/; + MERGE_KEY = "<<"; DQ_ESCAPES = { "0": "\0", a: "\x07", @@ -1619,57 +1687,1801 @@ var init_nginx = __esm({ } }); -// node_modules/@intentius/chant/src/audit/terraform-state.ts -function isTerraformStateFile(path) { - const name = path.split("/").pop() ?? path; - return /\.tfstate(\.backup)?$/i.test(name); -} -function isTerraformWorkDir(path) { - const parts = path.split("/"); - return parts.includes(".terraform"); -} -function isTerraformStatePath(path) { - return isTerraformStateFile(path) || isTerraformWorkDir(path); -} -function escapeRegExp(literal2) { - return literal2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); -} -function gitignoreCoversTerraformState(gitignore, path) { - const name = path.split("/").pop() ?? path; - for (const raw of gitignore.split("\n")) { - const line = raw.trim(); - if (line === "" || line.startsWith("#") || line.startsWith("!")) continue; - const pattern = line.replace(/^\*\*\//, "").replace(/^\//, "").replace(/\/$/, ""); - if (pattern === "" || pattern.includes("/")) continue; - const re = new RegExp(`^${pattern.split("*").map(escapeRegExp).join("[^/]*")}$`); - if (re.test(name) || path.split("/").some((segment) => re.test(segment))) return true; +// node_modules/picomatch/lib/constants.js +var require_constants = __commonJS({ + "node_modules/picomatch/lib/constants.js"(exports, module) { + "use strict"; + var WIN_SLASH = "\\\\/"; + var WIN_NO_SLASH = `[^${WIN_SLASH}]`; + var DEFAULT_MAX_EXTGLOB_RECURSION = 0; + var DOT_LITERAL = "\\."; + var PLUS_LITERAL = "\\+"; + var QMARK_LITERAL = "\\?"; + var SLASH_LITERAL = "\\/"; + var ONE_CHAR = "(?=.)"; + var QMARK = "[^/]"; + var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; + var START_ANCHOR = `(?:^|${SLASH_LITERAL})`; + var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; + var NO_DOT = `(?!${DOT_LITERAL})`; + var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; + var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; + var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; + var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; + var STAR = `${QMARK}*?`; + var SEP = "/"; + var POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR, + SEP + }; + var WINDOWS_CHARS = { + ...POSIX_CHARS, + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)`, + SEP: "\\" + }; + var POSIX_REGEX_SOURCE = { + __proto__: null, + alnum: "a-zA-Z0-9", + alpha: "a-zA-Z", + ascii: "\\x00-\\x7F", + blank: " \\t", + cntrl: "\\x00-\\x1F\\x7F", + digit: "0-9", + graph: "\\x21-\\x7E", + lower: "a-z", + print: "\\x20-\\x7E ", + punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", + space: " \\t\\r\\n\\v\\f", + upper: "A-Z", + word: "A-Za-z0-9_", + xdigit: "A-Fa-f0-9" + }; + module.exports = { + DEFAULT_MAX_EXTGLOB_RECURSION, + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + __proto__: null, + "***": "*", + "**/**": "**", + "**/**/**": "**" + }, + // Digits + CHAR_0: 48, + /* 0 */ + CHAR_9: 57, + /* 9 */ + // Alphabet chars. + CHAR_UPPERCASE_A: 65, + /* A */ + CHAR_LOWERCASE_A: 97, + /* a */ + CHAR_UPPERCASE_Z: 90, + /* Z */ + CHAR_LOWERCASE_Z: 122, + /* z */ + CHAR_LEFT_PARENTHESES: 40, + /* ( */ + CHAR_RIGHT_PARENTHESES: 41, + /* ) */ + CHAR_ASTERISK: 42, + /* * */ + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, + /* & */ + CHAR_AT: 64, + /* @ */ + CHAR_BACKWARD_SLASH: 92, + /* \ */ + CHAR_CARRIAGE_RETURN: 13, + /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, + /* ^ */ + CHAR_COLON: 58, + /* : */ + CHAR_COMMA: 44, + /* , */ + CHAR_DOT: 46, + /* . */ + CHAR_DOUBLE_QUOTE: 34, + /* " */ + CHAR_EQUAL: 61, + /* = */ + CHAR_EXCLAMATION_MARK: 33, + /* ! */ + CHAR_FORM_FEED: 12, + /* \f */ + CHAR_FORWARD_SLASH: 47, + /* / */ + CHAR_GRAVE_ACCENT: 96, + /* ` */ + CHAR_HASH: 35, + /* # */ + CHAR_HYPHEN_MINUS: 45, + /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, + /* < */ + CHAR_LEFT_CURLY_BRACE: 123, + /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, + /* [ */ + CHAR_LINE_FEED: 10, + /* \n */ + CHAR_NO_BREAK_SPACE: 160, + /* \u00A0 */ + CHAR_PERCENT: 37, + /* % */ + CHAR_PLUS: 43, + /* + */ + CHAR_QUESTION_MARK: 63, + /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, + /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, + /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, + /* ] */ + CHAR_SEMICOLON: 59, + /* ; */ + CHAR_SINGLE_QUOTE: 39, + /* ' */ + CHAR_SPACE: 32, + /* */ + CHAR_TAB: 9, + /* \t */ + CHAR_UNDERSCORE: 95, + /* _ */ + CHAR_VERTICAL_LINE: 124, + /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, + /* \uFEFF */ + /** + * Create EXTGLOB_CHARS + */ + extglobChars(chars) { + return { + "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` }, + "?": { type: "qmark", open: "(?:", close: ")?" }, + "+": { type: "plus", open: "(?:", close: ")+" }, + "*": { type: "star", open: "(?:", close: ")*" }, + "@": { type: "at", open: "(?:", close: ")" } + }; + }, + /** + * Create GLOB_CHARS + */ + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } + }; } - return false; -} -var init_terraform_state = __esm({ - "node_modules/@intentius/chant/src/audit/terraform-state.ts"() { +}); + +// node_modules/picomatch/lib/utils.js +var require_utils = __commonJS({ + "node_modules/picomatch/lib/utils.js"(exports) { + "use strict"; + var { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL + } = require_constants(); + exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); + exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str); + exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str); + exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1"); + exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/"); + exports.isWindows = () => { + if (typeof navigator !== "undefined" && navigator.platform) { + const platform = navigator.platform.toLowerCase(); + return platform === "win32" || platform === "windows"; + } + if (typeof process !== "undefined" && process.platform) { + return process.platform === "win32"; + } + return false; + }; + exports.removeBackslashes = (str) => { + return str.replace(REGEX_REMOVE_BACKSLASH, (match) => { + return match === "\\" ? "" : match; + }); + }; + exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; + }; + exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith("./")) { + output = output.slice(2); + state.prefix = "./"; + } + return output; + }; + exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? "" : "^"; + const append = options.contains ? "" : "$"; + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; + }; + exports.basename = (path, { windows } = {}) => { + const segs = path.split(windows ? /[\\/]/ : "/"); + const last = segs[segs.length - 1]; + if (last === "") { + return segs[segs.length - 2]; + } + return last; + }; } }); -// node_modules/@intentius/chant/src/lexicon.ts -function intrinsicTagFolds(def) { - return def.isTag === true; -} -function intrinsicCallFolds(def) { - return def.isTag !== true && def.foldsAsCall === true; -} -function intrinsicCallFoldsEagerly(def) { - return def.isTag !== true && def.foldsEagerly === true; +// node_modules/picomatch/lib/scan.js +var require_scan = __commonJS({ + "node_modules/picomatch/lib/scan.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var { + CHAR_ASTERISK, + /* * */ + CHAR_AT, + /* @ */ + CHAR_BACKWARD_SLASH, + /* \ */ + CHAR_COMMA, + /* , */ + CHAR_DOT, + /* . */ + CHAR_EXCLAMATION_MARK, + /* ! */ + CHAR_FORWARD_SLASH, + /* / */ + CHAR_LEFT_CURLY_BRACE, + /* { */ + CHAR_LEFT_PARENTHESES, + /* ( */ + CHAR_LEFT_SQUARE_BRACKET, + /* [ */ + CHAR_PLUS, + /* + */ + CHAR_QUESTION_MARK, + /* ? */ + CHAR_RIGHT_CURLY_BRACE, + /* } */ + CHAR_RIGHT_PARENTHESES, + /* ) */ + CHAR_RIGHT_SQUARE_BRACKET + /* ] */ + } = require_constants(); + var isPathSeparator = (code) => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; + }; + var depth = (token) => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } + }; + var scan = (input, options) => { + const opts = options || {}; + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: "", depth: 0, isGlob: false }; + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + while (index < length) { + code = advance(); + let next; + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: "", depth: 0, isGlob: false }; + if (finished === true) continue; + if (prev === CHAR_DOT && index === start + 1) { + start += 2; + continue; + } + lastIndex = index + 1; + continue; + } + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK; + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + if (scanToEnd === true) { + continue; + } + break; + } + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + if (isGlob === true) { + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + } + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + let base = str; + let prefix = ""; + let glob = ""; + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ""; + glob = str; + } else { + base = str; + } + if (base && base !== "" && base !== "/" && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== "") { + parts.push(value); + } + prevIndex = i; + } + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + state.slashes = slashes; + state.parts = parts; + } + return state; + }; + module.exports = scan; + } +}); + +// node_modules/picomatch/lib/parse.js +var require_parse = __commonJS({ + "node_modules/picomatch/lib/parse.js"(exports, module) { + "use strict"; + var constants = require_constants(); + var utils = require_utils(); + var { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS + } = constants; + var expandRange = (args, options) => { + if (typeof options.expandRange === "function") { + return options.expandRange(...args, options); + } + args.sort(); + const value = `[${args.join("-")}]`; + try { + new RegExp(value); + } catch (ex) { + return args.map((v) => utils.escapeRegex(v)).join(".."); + } + return value; + }; + var syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; + }; + var splitTopLevel = (input) => { + const parts = []; + let bracket = 0; + let paren = 0; + let quote = 0; + let value = ""; + let escaped = false; + for (const ch of input) { + if (escaped === true) { + value += ch; + escaped = false; + continue; + } + if (ch === "\\") { + value += ch; + escaped = true; + continue; + } + if (ch === '"') { + quote = quote === 1 ? 0 : 1; + value += ch; + continue; + } + if (quote === 0) { + if (ch === "[") { + bracket++; + } else if (ch === "]" && bracket > 0) { + bracket--; + } else if (bracket === 0) { + if (ch === "(") { + paren++; + } else if (ch === ")" && paren > 0) { + paren--; + } else if (ch === "|" && paren === 0) { + parts.push(value); + value = ""; + continue; + } + } + } + value += ch; + } + parts.push(value); + return parts; + }; + var isPlainBranch = (branch) => { + let escaped = false; + for (const ch of branch) { + if (escaped === true) { + escaped = false; + continue; + } + if (ch === "\\") { + escaped = true; + continue; + } + if (/[?*+@!()[\]{}]/.test(ch)) { + return false; + } + } + return true; + }; + var normalizeSimpleBranch = (branch) => { + let value = branch.trim(); + let changed = true; + while (changed === true) { + changed = false; + if (/^@\([^\\()[\]{}|]+\)$/.test(value)) { + value = value.slice(2, -1); + changed = true; + } + } + if (!isPlainBranch(value)) { + return; + } + return value.replace(/\\(.)/g, "$1"); + }; + var hasRepeatedCharPrefixOverlap = (branches) => { + const values = branches.map(normalizeSimpleBranch).filter(Boolean); + for (let i = 0; i < values.length; i++) { + for (let j = i + 1; j < values.length; j++) { + const a = values[i]; + const b = values[j]; + const char = a[0]; + if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) { + continue; + } + if (a === b || a.startsWith(b) || b.startsWith(a)) { + return true; + } + } + } + return false; + }; + var parseRepeatedExtglob = (pattern2, requireEnd = true) => { + if (pattern2[0] !== "+" && pattern2[0] !== "*" || pattern2[1] !== "(") { + return; + } + let bracket = 0; + let paren = 0; + let quote = 0; + let escaped = false; + for (let i = 1; i < pattern2.length; i++) { + const ch = pattern2[i]; + if (escaped === true) { + escaped = false; + continue; + } + if (ch === "\\") { + escaped = true; + continue; + } + if (ch === '"') { + quote = quote === 1 ? 0 : 1; + continue; + } + if (quote === 1) { + continue; + } + if (ch === "[") { + bracket++; + continue; + } + if (ch === "]" && bracket > 0) { + bracket--; + continue; + } + if (bracket > 0) { + continue; + } + if (ch === "(") { + paren++; + continue; + } + if (ch === ")") { + paren--; + if (paren === 0) { + if (requireEnd === true && i !== pattern2.length - 1) { + return; + } + return { + type: pattern2[0], + body: pattern2.slice(2, i), + end: i + }; + } + } + } + }; + var getStarExtglobSequenceOutput = (pattern2) => { + let index = 0; + const chars = []; + while (index < pattern2.length) { + const match = parseRepeatedExtglob(pattern2.slice(index), false); + if (!match || match.type !== "*") { + return; + } + const branches = splitTopLevel(match.body).map((branch2) => branch2.trim()); + if (branches.length !== 1) { + return; + } + const branch = normalizeSimpleBranch(branches[0]); + if (!branch || branch.length !== 1) { + return; + } + chars.push(branch); + index += match.end + 1; + } + if (chars.length < 1) { + return; + } + const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`; + return `${source}*`; + }; + var repeatedExtglobRecursion = (pattern2) => { + let depth = 0; + let value = pattern2.trim(); + let match = parseRepeatedExtglob(value); + while (match) { + depth++; + value = match.body.trim(); + match = parseRepeatedExtglob(value); + } + return depth; + }; + var analyzeRepeatedExtglob = (body, options) => { + if (options.maxExtglobRecursion === false) { + return { risky: false }; + } + const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION; + const branches = splitTopLevel(body).map((branch) => branch.trim()); + if (branches.length > 1) { + if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) { + return { risky: true }; + } + } + for (const branch of branches) { + const safeOutput = getStarExtglobSequenceOutput(branch); + if (safeOutput) { + return { risky: true, safeOutput }; + } + if (repeatedExtglobRecursion(branch) > max) { + return { risky: true }; + } + } + return { risky: false }; + }; + var parse4 = (input, options) => { + if (typeof input !== "string") { + throw new TypeError("Expected a string"); + } + input = REPLACEMENTS[input] || input; + const opts = { ...options }; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + const bos = { type: "bos", value: "", output: opts.prepend || "" }; + const tokens = [bos]; + const capture = opts.capture ? "" : "?:"; + const PLATFORM_CHARS = constants.globChars(opts.windows); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + const globstar = (opts2) => { + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const nodot = opts.dot ? "" : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + if (opts.capture) { + star = `(${star})`; + } + if (typeof opts.noext === "boolean") { + opts.noextglob = opts.noext; + } + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: "", + output: "", + prefix: "", + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + input = utils.removePrefix(input, state); + len = input.length; + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ""; + const remaining = () => input.slice(state.index + 1); + const consume = (value2 = "", num = 0) => { + state.consumed += value2; + state.index += num; + }; + const append = (token) => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + const negate = () => { + let count = 1; + while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) { + advance(); + state.start++; + count++; + } + if (count % 2 === 0) { + return false; + } + state.negated = true; + state.start++; + return true; + }; + const increment = (type) => { + state[type]++; + stack.push(type); + }; + const decrement = (type) => { + state[type]--; + stack.pop(); + }; + const push = (tok) => { + if (prev.type === "globstar") { + const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace"); + const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren"); + if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = "star"; + prev.value = "*"; + prev.output = star; + state.output += prev.output; + } + } + if (extglobs.length && tok.type !== "paren") { + extglobs[extglobs.length - 1].inner += tok.value; + } + if (tok.value || tok.output) append(tok); + if (prev && prev.type === "text" && tok.type === "text") { + prev.output = (prev.output || prev.value) + tok.value; + prev.value += tok.value; + return; + } + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + const extglobOpen = (type, value2) => { + const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" }; + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + token.startIndex = state.index; + token.tokensIndex = tokens.length; + const output = (opts.capture ? "(" : "") + token.open; + increment("parens"); + push({ type, value: value2, output: state.output ? "" : ONE_CHAR }); + push({ type: "paren", extglob: true, value: advance(), output }); + extglobs.push(token); + }; + const extglobClose = (token) => { + const literal2 = input.slice(token.startIndex, state.index + 1); + const body = input.slice(token.startIndex + 2, state.index); + const analysis = analyzeRepeatedExtglob(body, opts); + if ((token.type === "plus" || token.type === "star") && analysis.risky) { + const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0; + const open = tokens[token.tokensIndex]; + open.type = "text"; + open.value = literal2; + open.output = safeOutput || utils.escapeRegex(literal2); + for (let i = token.tokensIndex + 1; i < tokens.length; i++) { + tokens[i].value = ""; + tokens[i].output = ""; + delete tokens[i].suffix; + } + state.output = token.output + open.output; + state.backtrack = true; + push({ type: "paren", extglob: true, value, output: "" }); + decrement("parens"); + return; + } + let output = token.close + (opts.capture ? ")" : ""); + let rest; + if (token.type === "negate") { + let extglobStar = star; + if (token.inner && token.inner.length > 1 && token.inner.includes("/")) { + extglobStar = globstar(opts); + } + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + const expression = parse4(rest, { ...options, fastpaths: false }).output; + output = token.close = `)${expression})${extglobStar})`; + } + if (token.prev.type === "bos") { + state.negatedExtglob = true; + } + } + push({ type: "paren", extglob: true, value, output }); + decrement("parens"); + }; + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => { + if (first === "\\") { + backslashes = true; + return m; + } + if (first === "?") { + if (esc2) { + return esc2 + first + (rest ? QMARK.repeat(rest.length) : ""); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ""); + } + return QMARK.repeat(chars.length); + } + if (first === ".") { + return DOT_LITERAL.repeat(chars.length); + } + if (first === "*") { + if (esc2) { + return esc2 + first + (rest ? star : ""); + } + return star; + } + return esc2 ? m : `\\${m}`; + }); + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ""); + } else { + output = output.replace(/\\+/g, (m) => { + return m.length % 2 === 0 ? "\\\\" : m ? "\\" : ""; + }); + } + } + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + state.output = utils.wrapOutput(output, state, options); + return state; + } + while (!eos()) { + value = advance(); + if (value === "\0") { + continue; + } + if (value === "\\") { + const next = peek(); + if (next === "/" && opts.bash !== true) { + continue; + } + if (next === "." || next === ";") { + continue; + } + if (!next) { + value += "\\"; + push({ type: "text", value }); + continue; + } + const match = /^\\+/.exec(remaining()); + let slashes = 0; + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += "\\"; + } + } + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + if (state.brackets === 0) { + push({ type: "text", value }); + continue; + } + } + if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) { + if (opts.posix !== false && value === ":") { + const inner2 = prev.value.slice(1); + if (inner2.includes("[")) { + prev.posix = true; + if (inner2.includes(":")) { + const idx = prev.value.lastIndexOf("["); + const pre = prev.value.slice(0, idx); + const rest2 = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest2]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") { + value = `\\${value}`; + } + if (value === "]" && (prev.value === "[" || prev.value === "[^")) { + value = `\\${value}`; + } + if (opts.posix === true && value === "!" && prev.value === "[") { + value = "^"; + } + prev.value += value; + append({ value }); + continue; + } + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: "text", value }); + } + continue; + } + if (value === "(") { + increment("parens"); + push({ type: "paren", value }); + continue; + } + if (value === ")") { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "(")); + } + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + push({ type: "paren", value, output: state.parens ? ")" : "\\)" }); + decrement("parens"); + continue; + } + if (value === "[") { + if (opts.nobracket === true || !remaining().includes("]")) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("closing", "]")); + } + value = `\\${value}`; + } else { + increment("brackets"); + } + push({ type: "bracket", value }); + continue; + } + if (value === "]") { + if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) { + push({ type: "text", value, output: `\\${value}` }); + continue; + } + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "[")); + } + push({ type: "text", value, output: `\\${value}` }); + continue; + } + decrement("brackets"); + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) { + value = `/${value}`; + } + prev.value += value; + append({ value }); + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + if (value === "{" && opts.nobrace !== true) { + increment("braces"); + const open = { + type: "brace", + value, + output: "(", + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + braces.push(open); + push(open); + continue; + } + if (value === "}") { + const brace = braces[braces.length - 1]; + if (opts.nobrace === true || !brace) { + push({ type: "text", value, output: value }); + continue; + } + let output = ")"; + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === "brace") { + break; + } + if (arr[i].type !== "dots") { + range.unshift(arr[i].value); + } + } + output = expandRange(range, opts); + state.backtrack = true; + } + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = "\\{"; + value = output = "\\}"; + state.output = out; + for (const t of toks) { + state.output += t.output || t.value; + } + } + push({ type: "brace", value, output }); + decrement("braces"); + braces.pop(); + continue; + } + if (value === "|") { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: "text", value }); + continue; + } + if (value === ",") { + let output = value; + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === "braces") { + brace.comma = true; + output = "|"; + } + push({ type: "comma", value, output }); + continue; + } + if (value === "/") { + if (prev.type === "dot" && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ""; + state.output = ""; + tokens.pop(); + prev = bos; + continue; + } + push({ type: "slash", value, output: SLASH_LITERAL }); + continue; + } + if (value === ".") { + if (state.braces > 0 && prev.type === "dot") { + if (prev.value === ".") prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = "dots"; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") { + push({ type: "text", value, output: DOT_LITERAL }); + continue; + } + push({ type: "dot", value, output: DOT_LITERAL }); + continue; + } + if (value === "?") { + const isGroup = prev && prev.value === "("; + if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("qmark", value); + continue; + } + if (prev && prev.type === "paren") { + const next = peek(); + let output = value; + if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) { + output = `\\${value}`; + } + push({ type: "text", value, output }); + continue; + } + if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) { + push({ type: "qmark", value, output: QMARK_NO_DOT }); + continue; + } + push({ type: "qmark", value, output: QMARK }); + continue; + } + if (value === "!") { + if (opts.noextglob !== true && peek() === "(") { + if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) { + extglobOpen("negate", value); + continue; + } + } + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + if (value === "+") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("plus", value); + continue; + } + if (prev && prev.value === "(" || opts.regex === false) { + push({ type: "plus", value, output: PLUS_LITERAL }); + continue; + } + if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) { + push({ type: "plus", value }); + continue; + } + push({ type: "plus", value: PLUS_LITERAL }); + continue; + } + if (value === "@") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + push({ type: "at", extglob: true, value, output: "" }); + continue; + } + push({ type: "text", value }); + continue; + } + if (value !== "*") { + if (value === "$" || value === "^") { + value = `\\${value}`; + } + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + push({ type: "text", value }); + continue; + } + if (prev && (prev.type === "globstar" || prev.star === true)) { + prev.type = "star"; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen("star", value); + continue; + } + if (prev.type === "star") { + if (opts.noglobstar === true) { + consume(value); + continue; + } + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === "slash" || prior.type === "bos"; + const afterStar = before && (before.type === "star" || before.type === "globstar"); + if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) { + push({ type: "star", value, output: "" }); + continue; + } + const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace"); + const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren"); + if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) { + push({ type: "star", value, output: "" }); + continue; + } + while (rest.slice(0, 3) === "/**") { + const after = input[state.index + 4]; + if (after && after !== "/") { + break; + } + rest = rest.slice(3); + consume("/**", 3); + } + if (prior.type === "bos" && eos()) { + prev.type = "globstar"; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)"); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") { + const end = rest[1] !== void 0 ? "|$" : ""; + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + state.output += prior.output + prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: "slash", value: "/", output: "" }); + continue; + } + if (prior.type === "bos" && rest[0] === "/") { + prev.type = "globstar"; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: "slash", value: "/", output: "" }); + continue; + } + state.output = state.output.slice(0, -prev.output.length); + prev.type = "globstar"; + prev.output = globstar(opts); + prev.value += value; + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + const token = { type: "star", value, output: star }; + if (opts.bash === true) { + token.output = ".*?"; + if (prev.type === "bos" || prev.type === "slash") { + token.output = nodot + token.output; + } + push(token); + continue; + } + if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) { + token.output = value; + push(token); + continue; + } + if (state.index === state.start || prev.type === "slash" || prev.type === "dot") { + if (prev.type === "dot") { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + } else { + state.output += nodot; + prev.output += nodot; + } + if (peek() !== "*") { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + push(token); + } + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]")); + state.output = utils.escapeLast(state.output, "["); + decrement("brackets"); + } + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")")); + state.output = utils.escapeLast(state.output, "("); + decrement("parens"); + } + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}")); + state.output = utils.escapeLast(state.output, "{"); + decrement("braces"); + } + if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) { + push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` }); + } + if (state.backtrack === true) { + state.output = ""; + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + if (token.suffix) { + state.output += token.suffix; + } + } + } + return state; + }; + parse4.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + input = REPLACEMENTS[input] || input; + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(opts.windows); + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? "" : "?:"; + const state = { negated: false, prefix: "" }; + let star = opts.bash === true ? ".*?" : STAR; + if (opts.capture) { + star = `(${star})`; + } + const globstar = (opts2) => { + if (opts2.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const create = (str) => { + switch (str) { + case "*": + return `${nodot}${ONE_CHAR}${star}`; + case ".*": + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*.*": + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*/*": + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + case "**": + return nodot + globstar(opts); + case "**/*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + case "**/*.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "**/.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + const source2 = create(match[1]); + if (!source2) return; + return source2 + DOT_LITERAL + match[2]; + } + } + }; + const output = utils.removePrefix(input, state); + let source = create(output); + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + return source; + }; + module.exports = parse4; + } +}); + +// node_modules/picomatch/lib/picomatch.js +var require_picomatch = __commonJS({ + "node_modules/picomatch/lib/picomatch.js"(exports, module) { + "use strict"; + var scan = require_scan(); + var parse4 = require_parse(); + var utils = require_utils(); + var constants = require_constants(); + var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val); + var picomatch3 = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map((input) => picomatch3(input, options, returnState)); + const arrayMatcher = (str) => { + for (const isMatch of fns) { + const state2 = isMatch(str); + if (state2) return state2; + } + return false; + }; + return arrayMatcher; + } + const isState = isObject2(glob) && glob.tokens && glob.input; + if (glob === "" || typeof glob !== "string" && !isState) { + throw new TypeError("Expected pattern to be a non-empty string"); + } + const opts = options || {}; + const posix = opts.windows; + const regex = isState ? picomatch3.compileRe(glob, options) : picomatch3.makeRe(glob, options, false, true); + const state = regex.state; + delete regex.state; + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch3(opts.ignore, ignoreOpts, returnState); + } + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch3.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + if (typeof opts.onResult === "function") { + opts.onResult(result); + } + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + if (isIgnored(input)) { + if (typeof opts.onIgnore === "function") { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + if (typeof opts.onMatch === "function") { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + if (returnState) { + matcher.state = state; + } + return matcher; + }; + picomatch3.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== "string") { + throw new TypeError("Expected input to be a string"); + } + if (input === "") { + return { isMatch: false, output: "" }; + } + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = match && format ? format(input) : input; + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch3.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + return { isMatch: Boolean(match), match, output }; + }; + picomatch3.matchBase = (input, glob, options) => { + const regex = glob instanceof RegExp ? glob : picomatch3.makeRe(glob, options); + return regex.test(utils.basename(input)); + }; + picomatch3.isMatch = (str, patterns, options) => picomatch3(patterns, options)(str); + picomatch3.parse = (pattern2, options) => { + if (Array.isArray(pattern2)) return pattern2.map((p) => picomatch3.parse(p, options)); + return parse4(pattern2, { ...options, fastpaths: false }); + }; + picomatch3.scan = (input, options) => scan(input, options); + picomatch3.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + const opts = options || {}; + const prepend = opts.contains ? "" : "^"; + const append = opts.contains ? "" : "$"; + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + const regex = picomatch3.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + return regex; + }; + picomatch3.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== "string") { + throw new TypeError("Expected a non-empty string"); + } + let parsed = { negated: false, fastpaths: true }; + if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) { + parsed.output = parse4.fastpaths(input, options); + } + if (!parsed.output) { + parsed = parse4(input, options); + } + return picomatch3.compileRe(parsed, options, returnOutput, returnState); + }; + picomatch3.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? "i" : "")); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } + }; + picomatch3.constants = constants; + module.exports = picomatch3; + } +}); + +// node_modules/picomatch/index.js +var require_picomatch2 = __commonJS({ + "node_modules/picomatch/index.js"(exports, module) { + "use strict"; + var pico = require_picomatch(); + var utils = require_utils(); + function picomatch3(glob, options, returnState = false) { + if (options && (options.windows === null || options.windows === void 0)) { + options = { ...options, windows: utils.isWindows() }; + } + return pico(glob, options, returnState); + } + Object.assign(picomatch3, pico); + module.exports = picomatch3; + } +}); + +// node_modules/@intentius/chant/src/project-root.ts +import { existsSync as existsSync2 } from "fs"; +import { dirname as dirname2, join as join2, resolve } from "path"; +function findProjectConfig(startDir) { + const resolvedStart = resolve(startDir); + let dir = resolvedStart; + for (; ; ) { + const tsPath = join2(dir, "chant.config.ts"); + if (existsSync2(tsPath)) return { dir, configPath: tsPath }; + const jsonPath = join2(dir, "chant.config.json"); + if (existsSync2(jsonPath)) return { dir, configPath: jsonPath }; + if (existsSync2(join2(dir, ".git")) || existsSync2(join2(dir, "package.json"))) { + return { dir }; + } + const parent = dirname2(dir); + if (parent === dir) { + return { dir: resolvedStart }; + } + dir = parent; + } } -function isLexiconPlugin(value) { - if (typeof value !== "object" || value === null || !("name" in value) || typeof value.name !== "string" || !("serializer" in value) || typeof value.serializer !== "object") { - return false; +function findWorkspaceRoot(startDir) { + const start = resolve(startDir); + let top; + for (let dir = start; ; dir = dirname2(dir)) { + if (existsSync2(join2(dir, ".git"))) { + top = dir; + break; + } + if (dirname2(dir) === dir) break; + } + for (let dir = start; ; dir = dirname2(dir)) { + const [json2, jsonc] = WORKSPACE_DECLARATION_FILES.map((name) => join2(dir, name)); + const hasJson = existsSync2(json2); + const hasJsonc = existsSync2(jsonc); + if (hasJson && hasJsonc) return { dir, file: json2, conflicting: jsonc }; + if (hasJson) return { dir, file: json2 }; + if (hasJsonc) return { dir, file: jsonc }; + if (top === void 0 || dir === top || dirname2(dir) === dir) return void 0; } - const obj = value; - return typeof obj.generate === "function" && typeof obj.validate === "function" && typeof obj.coverage === "function" && typeof obj.package === "function"; } -var init_lexicon = __esm({ - "node_modules/@intentius/chant/src/lexicon.ts"() { +var WORKSPACE_DECLARATION_FILES; +var init_project_root = __esm({ + "node_modules/@intentius/chant/src/project-root.ts"() { + WORKSPACE_DECLARATION_FILES = ["chant.workspace.json", "chant.workspace.jsonc"]; } }); @@ -3311,12 +5123,12 @@ var init_checks = __esm({ $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => { $ZodCheck.init(inst, def); const escapedRegex = escapeRegex(def.includes); - const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex); - def.pattern = pattern; + const pattern2 = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex); + def.pattern = pattern2; inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); + bag.patterns.add(pattern2); }); inst._zod.check = (payload) => { if (payload.value.includes(def.includes, def.position)) @@ -3334,12 +5146,12 @@ var init_checks = __esm({ }); $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => { $ZodCheck.init(inst, def); - const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`); - def.pattern ?? (def.pattern = pattern); + const pattern2 = new RegExp(`^${escapeRegex(def.prefix)}.*`); + def.pattern ?? (def.pattern = pattern2); inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); + bag.patterns.add(pattern2); }); inst._zod.check = (payload) => { if (payload.value.startsWith(def.prefix)) @@ -3357,12 +5169,12 @@ var init_checks = __esm({ }); $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => { $ZodCheck.init(inst, def); - const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`); - def.pattern ?? (def.pattern = pattern); + const pattern2 = new RegExp(`.*${escapeRegex(def.suffix)}$`); + def.pattern ?? (def.pattern = pattern2); inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); + bag.patterns.add(pattern2); }); inst._zod.check = (payload) => { if (payload.value.endsWith(def.suffix)) @@ -5187,8 +6999,8 @@ var init_schemas = __esm({ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0; }); defineLazy(inst._zod, "pattern", () => { - const pattern = def.innerType._zod.pattern; - return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0; + const pattern2 = def.innerType._zod.pattern; + return pattern2 ? new RegExp(`^(${cleanRegex(pattern2.source)})?$`) : void 0; }); inst._zod.parse = (payload, ctx) => { if (def.innerType._zod.optin === "optional") { @@ -5217,8 +7029,8 @@ var init_schemas = __esm({ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); defineLazy(inst._zod, "pattern", () => { - const pattern = def.innerType._zod.pattern; - return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0; + const pattern2 = def.innerType._zod.pattern; + return pattern2 ? new RegExp(`^(${cleanRegex(pattern2.source)}|null)$`) : void 0; }); defineLazy(inst._zod, "values", () => { return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0; @@ -12538,12 +14350,12 @@ function _length(length, params2) { }); } // @__NO_SIDE_EFFECTS__ -function _regex(pattern, params2) { +function _regex(pattern2, params2) { return new $ZodCheckRegex({ check: "string_format", format: "regex", ...normalizeParams(params2), - pattern + pattern: pattern2 }); } // @__NO_SIDE_EFFECTS__ @@ -13579,11 +15391,11 @@ var init_json_schema_processors = __esm({ }; templateLiteralProcessor = (schema, _ctx, json2, _params) => { const _json = json2; - const pattern = schema._zod.pattern; - if (!pattern) + const pattern2 = schema._zod.pattern; + if (!pattern2) throw new Error("Pattern not found in template literal"); _json.type = "string"; - _json.pattern = pattern.source; + _json.pattern = pattern2.source; }; fileProcessor = (schema, _ctx, json2, _params) => { const _json = json2; @@ -13772,8 +15584,8 @@ var init_json_schema_processors = __esm({ path: [...params2.path, "patternProperties", "*"] }); json2.patternProperties = {}; - for (const pattern of patterns) { - json2.patternProperties[pattern.source] = valueSchema; + for (const pattern2 of patterns) { + json2.patternProperties[pattern2.source] = valueSchema; } } else { if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") { @@ -16182,14 +17994,14 @@ function convertBaseSchema(schema, ctx) { shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional(); } if (schema.propertyNames) { - const keySchema = convertSchema(schema.propertyNames, ctx); + const keySchema2 = convertSchema(schema.propertyNames, ctx); const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any(); if (Object.keys(shape).length === 0) { - zodSchema = z.record(keySchema, valueSchema); + zodSchema = z.record(keySchema2, valueSchema); break; } const objectSchema2 = z.object(shape).passthrough(); - const recordSchema = z.looseRecord(keySchema, valueSchema); + const recordSchema = z.looseRecord(keySchema2, valueSchema); zodSchema = z.intersection(objectSchema2, recordSchema); break; } @@ -16197,10 +18009,10 @@ function convertBaseSchema(schema, ctx) { const patternProps = schema.patternProperties; const patternKeys = Object.keys(patternProps); const looseRecords = []; - for (const pattern of patternKeys) { - const patternValue = convertSchema(patternProps[pattern], ctx); - const keySchema = z.string().regex(new RegExp(pattern)); - looseRecords.push(z.looseRecord(keySchema, patternValue)); + for (const pattern2 of patternKeys) { + const patternValue = convertSchema(patternProps[pattern2], ctx); + const keySchema2 = z.string().regex(new RegExp(pattern2)); + looseRecords.push(z.looseRecord(keySchema2, patternValue)); } const schemasToIntersect = []; if (Object.keys(shape).length > 0) { @@ -16938,7 +18750,7 @@ var init_bom_writer = __esm({ // node_modules/@intentius/chant/src/components/verbs/lockfile-sbom-generator.ts import { readFileSync, writeFileSync, mkdirSync } from "node:fs"; -import { dirname, join } from "node:path"; +import { dirname as dirname3, join as join3 } from "node:path"; function parseNpmPackageLock(content) { const lock = JSON.parse(content); const seen = /* @__PURE__ */ new Map(); @@ -16997,7 +18809,7 @@ function parsePomXml(content) { } function findManifest(dir) { for (const [kind, filename] of [["npm", "package-lock.json"], ["maven", "pom.xml"]]) { - const candidate = join(dir, filename); + const candidate = join3(dir, filename); try { readFileSync(candidate, "utf-8"); return { kind, path: candidate }; @@ -17008,7 +18820,7 @@ function findManifest(dir) { return void 0; } function sbomOutputPath(dir, format) { - return join(dir, `sbom.${format}.json`); + return join3(dir, `sbom.${format}.json`); } function createLockfileSbomGenerator(options = {}) { const now = options.now ?? (() => /* @__PURE__ */ new Date()); @@ -17037,10 +18849,10 @@ function createLockfileSbomGenerator(options = {}) { throw new SbomGeneratorNotImplementedError("forImage"); }, async forJar(input) { - return generateFromDir(dirname(input.jarPath), input.jarPath, input.digest, input.format); + return generateFromDir(dirname3(input.jarPath), input.jarPath, input.digest, input.format); }, async forZip(input) { - return generateFromDir(dirname(input.zipPath), input.zipPath, input.digest, input.format); + return generateFromDir(dirname3(input.zipPath), input.zipPath, input.digest, input.format); }, async forDir(input) { return generateFromDir(input.path, input.path, void 0, input.format); @@ -17084,32 +18896,6 @@ var init_sbom_generator = __esm({ } }); -// node_modules/@intentius/chant/src/project-root.ts -import { existsSync } from "fs"; -import { dirname as dirname2, join as join2, resolve } from "path"; -function findProjectConfig(startDir) { - const resolvedStart = resolve(startDir); - let dir = resolvedStart; - for (; ; ) { - const tsPath = join2(dir, "chant.config.ts"); - if (existsSync(tsPath)) return { dir, configPath: tsPath }; - const jsonPath = join2(dir, "chant.config.json"); - if (existsSync(jsonPath)) return { dir, configPath: jsonPath }; - if (existsSync(join2(dir, ".git")) || existsSync(join2(dir, "package.json"))) { - return { dir }; - } - const parent = dirname2(dir); - if (parent === dir) { - return { dir: resolvedStart }; - } - dir = parent; - } -} -var init_project_root = __esm({ - "node_modules/@intentius/chant/src/project-root.ts"() { - } -}); - // node_modules/@intentius/chant/src/config-import.ts async function importConfigModule(configPath) { return await import(configPath); @@ -17146,7 +18932,7 @@ var require_main = __commonJS({ analyzeMetafileSync: () => analyzeMetafileSync, build: () => build4, buildSync: () => buildSync, - context: () => context, + context: () => context2, default: () => node_default, formatMessages: () => formatMessages, formatMessagesSync: () => formatMessagesSync, @@ -18319,7 +20105,7 @@ is not a problem with esbuild. You need to fix your environment instead. let latestResultPromise; let provideLatestResult; if (isContext) - requestCallbacks["on-end"] = (id, request2) => new Promise((resolve9) => { + requestCallbacks["on-end"] = (id, request2) => new Promise((resolve12) => { buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => { const response = { errors: onEndErrors, @@ -18329,7 +20115,7 @@ is not a problem with esbuild. You need to fix your environment instead. latestResultPromise = void 0; provideLatestResult = void 0; sendResponse(id, response); - resolve9(); + resolve12(); }); }); sendRequest(refs, request, (error51, response) => { @@ -18346,10 +20132,10 @@ is not a problem with esbuild. You need to fix your environment instead. let didDispose = false; const result = { rebuild: () => { - if (!latestResultPromise) latestResultPromise = new Promise((resolve9, reject) => { + if (!latestResultPromise) latestResultPromise = new Promise((resolve12, reject) => { let settlePromise; provideLatestResult = (err, result2) => { - if (!settlePromise) settlePromise = () => err ? reject(err) : resolve9(result2); + if (!settlePromise) settlePromise = () => err ? reject(err) : resolve12(result2); }; const triggerAnotherBuild = () => { const request2 = { @@ -18370,7 +20156,7 @@ is not a problem with esbuild. You need to fix your environment instead. }); return latestResultPromise; }, - watch: (options2 = {}) => new Promise((resolve9, reject) => { + watch: (options2 = {}) => new Promise((resolve12, reject) => { if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`); const keys = {}; const delay = getFlag(options2, keys, "delay", mustBeInteger); @@ -18382,10 +20168,10 @@ is not a problem with esbuild. You need to fix your environment instead. if (delay) request2.delay = delay; sendRequest(refs, request2, (error210) => { if (error210) reject(new Error(error210)); - else resolve9(void 0); + else resolve12(void 0); }); }), - serve: (options2 = {}) => new Promise((resolve9, reject) => { + serve: (options2 = {}) => new Promise((resolve12, reject) => { if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`); const keys = {}; const port = getFlag(options2, keys, "port", mustBeValidPortNumber); @@ -18423,28 +20209,28 @@ is not a problem with esbuild. You need to fix your environment instead. sendResponse(id, {}); }; } - resolve9(response2); + resolve12(response2); }); }), - cancel: () => new Promise((resolve9) => { - if (didDispose) return resolve9(); + cancel: () => new Promise((resolve12) => { + if (didDispose) return resolve12(); const request2 = { command: "cancel", key: buildKey }; sendRequest(refs, request2, () => { - resolve9(); + resolve12(); }); }), - dispose: () => new Promise((resolve9) => { - if (didDispose) return resolve9(); + dispose: () => new Promise((resolve12) => { + if (didDispose) return resolve12(); didDispose = true; const request2 = { command: "dispose", key: buildKey }; sendRequest(refs, request2, () => { - resolve9(); + resolve12(); scheduleOnDisposeCallbacks(); refs.unref(); }); @@ -18483,7 +20269,7 @@ is not a problem with esbuild. You need to fix your environment instead. onLoad: [] }; i++; - let resolve9 = (path3, options = {}) => { + let resolve12 = (path3, options = {}) => { if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed'); if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`); let keys2 = /* @__PURE__ */ Object.create(null); @@ -18527,7 +20313,7 @@ is not a problem with esbuild. You need to fix your environment instead. }; let promise2 = setup({ initialOptions, - resolve: resolve9, + resolve: resolve12, onStart(callback) { let registeredText = `This error came from the "onStart" callback registered here:`; let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); @@ -19266,7 +21052,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_ }; var version2 = "0.28.1"; var build4 = (options) => ensureServiceIsRunning().build(options); - var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions); + var context2 = (buildOptions) => ensureServiceIsRunning().context(buildOptions); var transform2 = (input, options) => ensureServiceIsRunning().transform(input, options); var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); @@ -19414,46 +21200,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_ } }; longLivedService = { - build: (options) => new Promise((resolve9, reject) => { + build: (options) => new Promise((resolve12, reject) => { service.buildOrContext({ callName: "build", refs, options, isTTY: isTTY(), defaultWD, - callback: (err, res) => err ? reject(err) : resolve9(res) + callback: (err, res) => err ? reject(err) : resolve12(res) }); }), - context: (options) => new Promise((resolve9, reject) => service.buildOrContext({ + context: (options) => new Promise((resolve12, reject) => service.buildOrContext({ callName: "context", refs, options, isTTY: isTTY(), defaultWD, - callback: (err, res) => err ? reject(err) : resolve9(res) + callback: (err, res) => err ? reject(err) : resolve12(res) })), - transform: (input, options) => new Promise((resolve9, reject) => service.transform({ + transform: (input, options) => new Promise((resolve12, reject) => service.transform({ callName: "transform", refs, input, options: options || {}, isTTY: isTTY(), fs: fsAsync, - callback: (err, res) => err ? reject(err) : resolve9(res) + callback: (err, res) => err ? reject(err) : resolve12(res) })), - formatMessages: (messages, options) => new Promise((resolve9, reject) => service.formatMessages({ + formatMessages: (messages, options) => new Promise((resolve12, reject) => service.formatMessages({ callName: "formatMessages", refs, messages, options, - callback: (err, res) => err ? reject(err) : resolve9(res) + callback: (err, res) => err ? reject(err) : resolve12(res) })), - analyzeMetafile: (metafile, options) => new Promise((resolve9, reject) => service.analyzeMetafile({ + analyzeMetafile: (metafile, options) => new Promise((resolve12, reject) => service.analyzeMetafile({ callName: "analyzeMetafile", refs, metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), options, - callback: (err, res) => err ? reject(err) : resolve9(res) + callback: (err, res) => err ? reject(err) : resolve12(res) })) }; return longLivedService; @@ -19531,13 +21317,13 @@ error: ${text}`); worker.postMessage(msg); let status = Atomics.wait(sharedBufferView, 0, 0); if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status); - let { message: { id: id2, resolve: resolve9, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); + let { message: { id: id2, resolve: resolve12, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); if (reject) { applyProperties(reject, properties); throw reject; } - return resolve9; + return resolve12; }; worker.unref(); return { @@ -19621,10 +21407,10 @@ error: ${text}`); }); // node_modules/@intentius/chant/src/discovery/sandbox/bundle.ts -import { existsSync as existsSync2, mkdtempSync, readFileSync as readFileSync2, realpathSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs"; -import { createRequire } from "node:module"; +import { existsSync as existsSync3, mkdtempSync, readFileSync as readFileSync2, realpathSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs"; +import { createRequire as createRequire2 } from "node:module"; import { tmpdir } from "node:os"; -import { dirname as dirname3, join as join3, resolve as resolvePath } from "node:path"; +import { dirname as dirname4, join as join4, resolve as resolvePath } from "node:path"; function getExternalPackagePathCache() { const g = globalThis; return g.__chantExternalPackagePathCache ??= /* @__PURE__ */ new Map(); @@ -19632,10 +21418,10 @@ function getExternalPackagePathCache() { function fastResolvePackage(specifier, fromDir) { let dir = fromDir; for (; ; ) { - const packageDir = join3(dir, "node_modules", specifier); - if (existsSync2(packageDir)) { - const pkgJsonPath = join3(packageDir, "package.json"); - if (!existsSync2(pkgJsonPath)) return void 0; + const packageDir = join4(dir, "node_modules", specifier); + if (existsSync3(packageDir)) { + const pkgJsonPath = join4(packageDir, "package.json"); + if (!existsSync3(pkgJsonPath)) return void 0; let pkg; try { pkg = JSON.parse(readFileSync2(pkgJsonPath, "utf-8")); @@ -19648,14 +21434,14 @@ function fastResolvePackage(specifier, fromDir) { const main3 = pkg.main; const entry = typeof main3 === "string" ? main3 : "index.js"; const resolved = resolvePath(packageDir, entry); - if (!existsSync2(resolved) || !statSync(resolved).isFile()) return void 0; + if (!existsSync3(resolved) || !statSync(resolved).isFile()) return void 0; try { return realpathSync(resolved); } catch { return void 0; } } - const parent = dirname3(dir); + const parent = dirname4(dir); if (parent === dir) return void 0; dir = parent; } @@ -19673,7 +21459,7 @@ function externalTrustedPackagesPlugin() { } if (path === void 0) continue; resolved.set(name, path); - readPaths.push(dirname3(path)); + readPaths.push(dirname4(path)); } catch { pathCache.set(name, void 0); } @@ -19690,10 +21476,10 @@ function externalTrustedPackagesPlugin() { return { plugin, readPaths }; } async function bundleDriver(driverSource) { - const bundleDir = realpathSync(mkdtempSync(join3(tmpdir(), "chant-sandbox-"))); - const entryPath = join3(bundleDir, "driver.mts"); + const bundleDir = realpathSync(mkdtempSync(join4(tmpdir(), "chant-sandbox-"))); + const entryPath = join4(bundleDir, "driver.mts"); writeFileSync2(entryPath, driverSource, "utf-8"); - const outfile = join3(bundleDir, "child.mjs"); + const outfile = join4(bundleDir, "child.mjs"); const { plugin, readPaths } = externalTrustedPackagesPlugin(); const start = performance.now(); try { @@ -19720,8 +21506,8 @@ var init_bundle = __esm({ "node_modules/@intentius/chant/src/discovery/sandbox/bundle.ts"() { esbuild = __toESM(require_main(), 1); HERE = import.meta.dirname; - require2 = createRequire(import.meta.url); - EXTERNAL_PACKAGES = ["typescript", "@cdktf/hcl2json"]; + require2 = createRequire2(import.meta.url); + EXTERNAL_PACKAGES = ["typescript", "@cdktn/hcl2json"]; } }); @@ -19738,10 +21524,33 @@ var init_params = __esm({ }); // node_modules/@intentius/chant/src/discovery/sandbox/driver.ts -import { dirname as dirname4, join as join4 } from "node:path"; +import { dirname as dirname5, join as join5 } from "node:path"; function lit(value) { return JSON.stringify(value); } +function sendFunctionSource(before = []) { + return [ + `function send(payload) {`, + ...before.map((line) => ` ${line}`), + ` if (typeof process.send !== "function") {`, + ` console.log(JSON.stringify(payload));`, + ` return Promise.resolve();`, + ` }`, + ` return new Promise((resolve) => {`, + ` const lost = (err) => {`, + ` writeSync(2, "chant: the sandboxed child could not hand its result to the parent: " +`, + ` (err && err.message ? err.message : String(err)) + " (chant#2461)\\n");`, + ` process.exit(1);`, + ` };`, + ` try {`, + ` process.send(payload, (err) => (err ? lost(err) : resolve()));`, + ` } catch (err) {`, + ` lost(err);`, + ` }`, + ` });`, + `}` + ]; +} function generateDriverSource(options) { const { files, buildRoot } = options; const lines = [ @@ -19751,6 +21560,7 @@ function generateDriverSource(options) { `import { classifyChildError } from ${lit(CHILD_ERRORS_MODULE)};`, `import { getProvenance } from ${lit(PROVENANCE_MODULE)};`, `import { setBuildParams } from ${lit(PARAMS_MODULE)};`, + `import { writeSync } from "node:fs";`, ``, `const BUILD_ROOT = ${lit(buildRoot)};`, ``, @@ -19761,10 +21571,28 @@ function generateDriverSource(options) { // them exactly. Bound before any project import below. `setBuildParams(${lit({ ...params })});`, ``, - `function send(payload) {`, - ` if (typeof process.send === "function") process.send(payload);`, - ` else console.log(JSON.stringify(payload));`, - `}`, + // chant#2461 — which file was being imported when the loop drained. + // + // A project file whose module scope awaits something that never settles + // makes its `await import(...)` never complete. Nothing keeps the loop + // alive, so Node exits 0 having sent nothing, and `main().catch` never + // fires because an unsettled promise is not a rejection. The parent then + // knows only that the child vanished. + // + // The child DOES know, right up to the moment it exits. `process.on("exit")` + // runs synchronously, so it cannot `process.send` — that is asynchronous and + // the channel will never be serviced — but a synchronous `writeSync` to fd 2 + // lands, and the parent already captures and forwards stderr. + `let importing;`, + `let reported = false;`, + `process.on("exit", () => {`, + ` if (reported || importing === undefined) return;`, + ` writeSync(2, "chant: this file's module scope never finished evaluating, so the build could not " +`, + ` "report anything: " + importing + "\\n A top-level \`await\` that never settles does this. " +`, + ` "Nothing is thrown, so nothing else can name it (chant#2461).\\n");`, + `});`, + ``, + ...sendFunctionSource([`reported = true;`]), ``, // collectEntities (bundled, real DiscoveryError instances) already names // the exact offending file on a same-directory duplicate — reuse that @@ -19780,12 +21608,14 @@ function generateDriverSource(options) { ]; for (const file2 of files) { lines.push( + ` importing = ${lit(file2)};`, ` try {`, ` const mod = await import(${lit(file2)});`, ` modules.push({ file: ${lit(file2)}, exports: mod });`, ` } catch (err) {`, ` errors.push(classifyChildError(${lit(file2)}, err).toJSON());`, - ` }` + ` }`, + ` importing = undefined;` ); } lines.push( @@ -19795,7 +21625,7 @@ function generateDriverSource(options) { ` entities = collectEntities(modules, BUILD_ROOT);`, ` } catch (err) {`, ` errors.push(classifyChildError(errFile(err), err, "resolution").toJSON());`, - ` send({ entitySet: { entities: [] }, errors, provenanceByName: {} });`, + ` await send({ entitySet: { entities: [] }, errors, provenanceByName: {} });`, ` return;`, ` }`, ``, @@ -19817,18 +21647,20 @@ function generateDriverSource(options) { ` errors.push(classifyChildError("", err, "resolution").toJSON());`, ` }`, ``, + ` let entitySet;`, ` try {`, - ` const entitySet = encodeEntitySet(entities);`, - ` send({ entitySet, errors, provenanceByName });`, + ` entitySet = encodeEntitySet(entities);`, ` } catch (err) {`, ` errors.push(classifyChildError("", err, "resolution").toJSON());`, - ` send({ entitySet: { entities: [] }, errors, provenanceByName });`, + ` await send({ entitySet: { entities: [] }, errors, provenanceByName });`, + ` return;`, ` }`, + ` await send({ entitySet, errors, provenanceByName });`, `}`, ``, - `main().catch((err) => {`, - ` send({ entitySet: { entities: [] }, errors: [classifyChildError("", err).toJSON()], provenanceByName: {}, fatal: true });`, - `});` + `main().catch((err) =>`, + ` send({ entitySet: { entities: [] }, errors: [classifyChildError("", err).toJSON()], provenanceByName: {}, fatal: true }),`, + `);` ); return lines.join("\n"); } @@ -19836,18 +21668,16 @@ function generateConfigDriverSource(configPath) { return [ `import { classifyChildError } from ${lit(CHILD_ERRORS_MODULE)};`, `import { scanConfigWireSafety } from ${lit(CONFIG_WIRE_MODULE)};`, + `import { writeSync } from "node:fs";`, ``, - `function send(payload) {`, - ` if (typeof process.send === "function") process.send(payload);`, - ` else console.log(JSON.stringify(payload));`, - `}`, + ...sendFunctionSource(), ``, `async function main() {`, ` let namespace;`, ` try {`, ` namespace = await import(${lit(configPath)});`, ` } catch (err) {`, - ` send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err).toJSON() });`, + ` await send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err).toJSON() });`, ` return;`, ` }`, ``, @@ -19858,24 +21688,26 @@ function generateConfigDriverSource(configPath) { ``, ` const offenders = scanConfigWireSafety(selected);`, ` if (offenders.length > 0) {`, - ` send({ kind: "chant-config", ok: false, offenders });`, + ` await send({ kind: "chant-config", ok: false, offenders });`, ` return;`, ` }`, ``, + ` let config;`, ` try {`, // Round-trip here, not just at the IPC boundary: this is what proves the // payload really is JSON before it leaves the child, and turns anything // the scan somehow missed into a named error instead of a quiet drop. - ` const config = JSON.parse(JSON.stringify(selected ?? {}));`, - ` send({ kind: "chant-config", ok: true, config });`, + ` config = JSON.parse(JSON.stringify(selected ?? {}));`, ` } catch (err) {`, - ` send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err, "resolution").toJSON() });`, + ` await send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err, "resolution").toJSON() });`, + ` return;`, ` }`, + ` await send({ kind: "chant-config", ok: true, config });`, `}`, ``, - `main().catch((err) => {`, - ` send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err).toJSON() });`, - `});` + `main().catch((err) =>`, + ` send({ kind: "chant-config", ok: false, error: classifyChildError(${lit(configPath)}, err).toJSON() }),`, + `);` ].join("\n"); } var HERE2, DISCOVERY_DIR, COLLECT_MODULE, RESOLVE_MODULE, ENTITY_WIRE_CODEC_MODULE, CHILD_ERRORS_MODULE, PROVENANCE_MODULE, CONFIG_WIRE_MODULE, POLICY_WIRE_MODULE, POST_SYNTH_MODULE, PARAMS_MODULE; @@ -19883,16 +21715,16 @@ var init_driver = __esm({ "node_modules/@intentius/chant/src/discovery/sandbox/driver.ts"() { init_params(); HERE2 = import.meta.dirname; - DISCOVERY_DIR = join4(HERE2, ".."); - COLLECT_MODULE = join4(DISCOVERY_DIR, "collect.ts"); - RESOLVE_MODULE = join4(DISCOVERY_DIR, "resolve.ts"); - ENTITY_WIRE_CODEC_MODULE = join4(DISCOVERY_DIR, "entity-wire-codec.ts"); - CHILD_ERRORS_MODULE = join4(HERE2, "child-errors.ts"); - PROVENANCE_MODULE = join4(dirname4(DISCOVERY_DIR), "provenance.ts"); - CONFIG_WIRE_MODULE = join4(HERE2, "config-wire.ts"); - POLICY_WIRE_MODULE = join4(HERE2, "policy-wire.ts"); - POST_SYNTH_MODULE = join4(dirname4(DISCOVERY_DIR), "lint", "post-synth.ts"); - PARAMS_MODULE = join4(dirname4(DISCOVERY_DIR), "params.ts"); + DISCOVERY_DIR = join5(HERE2, ".."); + COLLECT_MODULE = join5(DISCOVERY_DIR, "collect.ts"); + RESOLVE_MODULE = join5(DISCOVERY_DIR, "resolve.ts"); + ENTITY_WIRE_CODEC_MODULE = join5(DISCOVERY_DIR, "entity-wire-codec.ts"); + CHILD_ERRORS_MODULE = join5(HERE2, "child-errors.ts"); + PROVENANCE_MODULE = join5(dirname5(DISCOVERY_DIR), "provenance.ts"); + CONFIG_WIRE_MODULE = join5(HERE2, "config-wire.ts"); + POLICY_WIRE_MODULE = join5(HERE2, "policy-wire.ts"); + POST_SYNTH_MODULE = join5(dirname5(DISCOVERY_DIR), "lint", "post-synth.ts"); + PARAMS_MODULE = join5(dirname5(DISCOVERY_DIR), "params.ts"); } }); @@ -19932,6 +21764,35 @@ function lineBuffered(emit) { } }; } +function describeSilentExit(label, code, signal, stderrBuf, unrecognised) { + const stderr = stderrBuf.trim(); + const head = `${label}: child exited before reporting results (code ${code}, signal ${signal})`; + if (unrecognised.length > 0) { + const shapes = unrecognised.map((m) => m && typeof m === "object" ? `{${Object.keys(m).join(", ")}}` : typeof m).join(", "); + return `${head}. It sent ${unrecognised.length} message(s) the parent did not recognise (${shapes}), so the payload shape and the parent's check disagree` + (stderr ? `: ${stderr}` : ""); + } + if (stderr) return `${head}: ${stderr}`; + if (code !== 0 || signal !== null) return head; + return `${head}. It exited cleanly with nothing on stderr, and no message arrived even after its IPC channel closed, so it never sent one: something it awaited never settled. On the run path the usual cause is a project file with a top-level \`await\` that does not settle. Module scope is arbitrary project source, an import of such a file never completes, and a promise that never settles is not a rejection, so the driver's own \`main().catch\` does not see it either. The config driver has nothing to await that can hang, and a failed send exits non-zero with a reason on stderr, so on the config path this has no known cause: please report it with the command that produced it (chant#2461).`; +} +function settleOnExitAfterChannelDrains(child, onExit, graceMs = EXIT_DRAIN_GRACE_MS) { + child.on("exit", (code, signal) => { + let done = false; + let grace; + const finish = () => { + if (done) return; + done = true; + if (grace !== void 0) clearTimeout(grace); + onExit(code, signal); + }; + if (!child.connected) { + finish(); + return; + } + child.once("disconnect", finish); + grace = setTimeout(finish, graceMs); + }); +} function forkSandboxed(options, isResponse) { const { bundlePath, bundleDir, projectRealpath, externalReadPaths, env: env2, timeoutMs, label, send, outputPrefix } = options; return new Promise((resolvePromise, reject) => { @@ -19945,6 +21806,7 @@ function forkSandboxed(options, isResponse) { }); let settled = false; let stderrBuf = ""; + const unrecognised = []; const timeout = setTimeout(() => { if (settled) return; settled = true; @@ -19976,7 +21838,11 @@ function forkSandboxed(options, isResponse) { }); child.stderr?.on("end", () => stderrForwarder.flush()); child.on("message", (msg) => { - if (settled || !isResponse(msg)) return; + if (settled) return; + if (!isResponse(msg)) { + unrecognised.push(msg); + return; + } settled = true; clearTimeout(timeout); child.kill(); @@ -19988,20 +21854,18 @@ function forkSandboxed(options, isResponse) { clearTimeout(timeout); reject(err); }); - child.on("exit", (code, signal) => { + settleOnExitAfterChannelDrains(child, (code, signal) => { if (settled) return; settled = true; clearTimeout(timeout); - reject( - new Error( - `${label}: child exited before reporting results (code ${code}, signal ${signal})${stderrBuf.trim() ? `: ${stderrBuf.trim()}` : ""}` - ) - ); + reject(new Error(describeSilentExit(label, code, signal, stderrBuf, unrecognised))); }); }); } +var EXIT_DRAIN_GRACE_MS; var init_fork = __esm({ "node_modules/@intentius/chant/src/discovery/sandbox/fork.ts"() { + EXIT_DRAIN_GRACE_MS = 2e3; } }); @@ -20078,11 +21942,11 @@ var init_config_run = __esm({ }); // node_modules/@intentius/chant/src/config-sandbox.ts -import { dirname as dirname5 } from "node:path"; +import { dirname as dirname6 } from "node:path"; function selectConfigExport(namespace) { return namespace.default ?? namespace.config ?? namespace; } -async function evaluateProjectConfig(configPath, projectRoot = dirname5(configPath)) { +async function evaluateProjectConfig(configPath, projectRoot = dirname6(configPath)) { if (!armed) { return selectConfigExport(await importConfigModule(configPath)); } @@ -20101,15 +21965,164 @@ var init_config_sandbox = __esm({ } }); +// node_modules/@intentius/chant/src/lexicon-module.ts +import { createRequire as createRequire3 } from "node:module"; +import { dirname as dirname7, isAbsolute, join as join6, relative, resolve as resolve3, sep } from "node:path"; +import { pathToFileURL } from "node:url"; +function lexiconDeclarationName(entry) { + return typeof entry === "string" ? entry : entry.name; +} +function lexiconNames(entries) { + return entries?.map(lexiconDeclarationName); +} +function isWithin(path, dir) { + const rel = relative(dir, path); + return rel === "" || !rel.startsWith("..") && !isAbsolute(rel); +} +function pathLexiconRoot(entry, baseDir, sourceDir = ".") { + const modulePath = isAbsolute(entry.module) ? entry.module : resolve3(baseDir, entry.module); + const declared = entry.root !== void 0; + const candidate = declared ? isAbsolute(entry.root) ? resolve3(entry.root) : resolve3(baseDir, entry.root) : dirname7(modulePath); + const project2 = resolve3(baseDir); + const source = resolve3(baseDir, sourceDir); + let problem; + if (!isWithin(candidate, project2)) problem = `${candidate} is outside the project (${project2})`; + else if (isWithin(source, candidate)) problem = `${candidate} contains the project's source directory (${source})`; + else if (!isWithin(modulePath, candidate)) problem = `the module ${modulePath} is not inside ${candidate}`; + if (problem === void 0) return { root: candidate }; + return declared ? { problem } : {}; +} +function registerLexiconDeclarations(entries, baseDir, sourceDir) { + const recorded = {}; + for (const entry of entries ?? []) { + if (typeof entry === "string") { + modulePaths.delete(entry); + moduleRoots.delete(entry); + continue; + } + const path = declaredModulePath(entry, baseDir); + modulePaths.set(entry.name, path); + recorded[entry.name] = path; + const { root } = pathLexiconRoot(entry, baseDir, sourceDir); + if (root === void 0) moduleRoots.delete(entry.name); + else moduleRoots.set(entry.name, root); + } + return recorded; +} +function declaredModulePath(entry, baseDir) { + return isAbsolute(entry.module) ? entry.module : resolve3(baseDir, entry.module); +} +function lexiconModulePath(name) { + return modulePaths.get(name); +} +function lexiconModuleRoot(name) { + return moduleRoots.get(name); +} +async function importLexiconModule(name) { + const path = modulePaths.get(name); + if (path === void 0) return void 0; + try { + return await import(path); + } catch (err) { + throw new Error( + `lexicon "${name}" is declared with module ${path}, which could not be loaded: ` + (err instanceof Error ? err.message : String(err)) + ); + } +} +function lexiconSourceLabel(name, fromDir = process.cwd(), paths = modulePaths) { + const path = paths.get(name); + if (path === void 0) return `@intentius/chant-lexicon-${name}`; + const rel = relative(fromDir, path); + return rel === "" || rel.startsWith("..") || isAbsolute(rel) ? path : `./${rel.split(sep).join("/")}`; +} +function lexiconPackagesToInstall(names, paths = modulePaths) { + return names.filter((name) => !paths.has(name)).map((name) => `@intentius/chant-lexicon-${name}`); +} +function packageNameOf(spec) { + if (spec.startsWith(".") || isAbsolute(spec) || spec.startsWith("file:")) return void 0; + const parts = spec.split("/"); + return spec.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0]; +} +function isPackageNotFound(err, pkg) { + const code = err?.code; + if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") return false; + const message = err instanceof Error ? err.message : String(err); + return message.includes(`'${pkg}'`) || message.includes(`"${pkg}"`) || message.includes(`${pkg}/`); +} +function resolveFromProject(spec, fromDir = process.cwd()) { + try { + return createRequire3(join6(fromDir, "package.json")).resolve(spec); + } catch { + return void 0; + } +} +async function importLexiconPackage(spec, fromDir = process.cwd()) { + try { + return await import(spec); + } catch (err) { + const pkg = packageNameOf(spec); + if (pkg === void 0 || !isPackageNotFound(err, pkg)) throw err; + const resolved = resolveFromProject(spec, fromDir); + if (resolved === void 0) throw err; + return await import(pathToFileURL(resolved).href); + } +} +var modulePaths, moduleRoots; +var init_lexicon_module = __esm({ + "node_modules/@intentius/chant/src/lexicon-module.ts"() { + modulePaths = /* @__PURE__ */ new Map(); + moduleRoots = /* @__PURE__ */ new Map(); + } +}); + +// node_modules/@intentius/chant/src/op/decide-config.ts +var envKeySchema, brokeredKeySchema, keySchema, backendSchema, decideConfigSchema; +var init_decide_config = __esm({ + "node_modules/@intentius/chant/src/op/decide-config.ts"() { + init_zod(); + envKeySchema = external_exports.strictObject({ + /** The variable's name. */ + env: external_exports.string().min(1) + }); + brokeredKeySchema = external_exports.strictObject({ + /** The capability's name in the box block, such as `inference`. */ + capability: external_exports.string().min(1), + /** The member whose box declares it. Without it, the one member that declares the capability. */ + member: external_exports.string().min(1).optional(), + /** + * The environment variable the broker sets with the scoped key. Without it, + * the broker is the endpoint and adds the key itself, so none is sent. + */ + env: external_exports.string().min(1).optional() + }); + keySchema = external_exports.union([envKeySchema, brokeredKeySchema]); + backendSchema = external_exports.strictObject({ + /** The server's base URL. `/v1/systemone` is appended. */ + url: external_exports.string().min(1), + /** Where the bearer key comes from. Omitted for a server that takes none, such as a local one. */ + key: keySchema.optional(), + /** How long to wait for an answer before the backend counts as unreachable, in milliseconds. Default 30000. */ + timeoutMs: external_exports.number().int().positive().optional() + }); + decideConfigSchema = external_exports.strictObject({ + /** Backend name, as a point's model decider names it, to the backend. */ + backends: external_exports.record(external_exports.string(), backendSchema).optional() + }); + } +}); + // node_modules/@intentius/chant/src/config.ts var config_exports = {}; __export(config_exports, { ChantConfigSchema: () => ChantConfigSchema, DEFAULT_CHANT_CONFIG: () => DEFAULT_CHANT_CONFIG, + InvalidChantConfigError: () => InvalidChantConfigError, environmentEndpoint: () => environmentEndpoint, environmentName: () => environmentName, environmentNames: () => environmentNames, + findProjectConfigPastFragments: () => findProjectConfigPastFragments, isEnvironmentPattern: () => isEnvironmentPattern, + isLintOnlyFragment: () => isLintOnlyFragment, isOwnershipParamRef: () => isOwnershipParamRef, loadChantConfig: () => loadChantConfig, loadChantConfigUpward: () => loadChantConfigUpward, @@ -20117,6 +22130,7 @@ __export(config_exports, { matchesEnvironmentPattern: () => matchesEnvironmentPattern, ownershipEnvDisagreement: () => ownershipEnvDisagreement, resolveAutoReleaseDisabled: () => resolveAutoReleaseDisabled, + resolveDiscoveryGlobs: () => resolveDiscoveryGlobs, resolveFoldEnabled: () => resolveFoldEnabled, resolveKnowledgeDir: () => resolveKnowledgeDir, resolveOwnershipEnv: () => resolveOwnershipEnv, @@ -20127,8 +22141,8 @@ __export(config_exports, { resolveSigningDefaults: () => resolveSigningDefaults, resolveVulnPolicy: () => resolveVulnPolicy }); -import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs"; -import { dirname as dirname6, join as join5 } from "path"; +import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs"; +import { dirname as dirname8, join as join7 } from "path"; function environmentName(entry) { return typeof entry === "string" ? entry : entry.name; } @@ -20138,9 +22152,9 @@ function environmentNames(environments) { function isEnvironmentPattern(declaredName) { return declaredName.includes("*"); } -function matchesEnvironmentPattern(pattern, name) { - const parts = pattern.split("*"); - if (parts.length === 1) return pattern === name; +function matchesEnvironmentPattern(pattern2, name) { + const parts = pattern2.split("*"); + if (parts.length === 1) return pattern2 === name; const first = parts[0]; const last = parts[parts.length - 1]; if (!name.startsWith(first)) return false; @@ -20164,29 +22178,48 @@ function environmentEndpoint(environments, name) { return found && typeof found !== "string" ? found.endpoint : void 0; } async function loadChantConfig(dir) { - const tsPath = join5(dir, "chant.config.ts"); - if (existsSync3(tsPath)) { + const tsPath = join7(dir, "chant.config.ts"); + if (existsSync4(tsPath)) { const config2 = await evaluateProjectConfig(tsPath, dir); return { config: normalizeConfig(config2, tsPath), configPath: tsPath }; } - const jsonPath = join5(dir, "chant.config.json"); - if (existsSync3(jsonPath)) { - const { readFileSync: readFileSync10 } = await import("fs"); - const content = readFileSync10(jsonPath, "utf-8"); + const jsonPath = join7(dir, "chant.config.json"); + if (existsSync4(jsonPath)) { + const { readFileSync: readFileSync14 } = await import("fs"); + const content = readFileSync14(jsonPath, "utf-8"); const parsed = JSON.parse(content); return { config: normalizeConfig(parsed, jsonPath), configPath: jsonPath }; } return { config: DEFAULT_CHANT_CONFIG }; } async function loadChantConfigUpward(startDir) { + const { dir, configPath } = findProjectConfigPastFragments(startDir); + if (configPath) warnIfFragmentShadowsProjectConfig(configPath); + return loadChantConfig(dir); +} +function findProjectConfigPastFragments(startDir) { let { dir, configPath } = findProjectConfig(startDir); while (configPath && isLintOnlyFragment(configPath)) { - const parent = dirname6(dir); + const parent = dirname8(dir); if (parent === dir) break; ({ dir, configPath } = findProjectConfig(parent)); } - if (configPath) warnIfFragmentShadowsProjectConfig(configPath); - return loadChantConfig(dir); + return { dir, configPath }; +} +async function resolveDiscoveryGlobs(startDir) { + const { dir, configPath } = findProjectConfigPastFragments(startDir); + if (!configPath) return void 0; + let config2; + try { + ({ config: config2 } = await loadChantConfig(dir)); + } catch (err) { + if (err instanceof InvalidChantConfigError && (err.key === "exclude" || err.key === "include")) throw err; + return void 0; + } + const exclude = config2.exclude ?? []; + const include = config2.include ?? []; + if (exclude.length === 0 && include.length === 0) return void 0; + return { root: dir, exclude, include }; } function isLintOnlyFragment(configPath) { if (!configPath.endsWith("chant.config.json")) return false; @@ -20300,7 +22333,7 @@ function resolveVulnPolicy(config2) { return out; } function resolveKnowledgeDir(config2, projectPath) { - return join5(projectPath, config2.knowledge?.dir ?? "knowledge"); + return join7(projectPath, config2.knowledge?.dir ?? "knowledge"); } function normalizeConfig(raw, source) { if (typeof raw !== "object" || raw === null) { @@ -20311,17 +22344,37 @@ function normalizeConfig(raw, source) { const issue2 = result.error.issues[0]; const path = issue2.path.length > 0 ? issue2.path.join(".") : void 0; const loc = source ? ` in ${source}` : ""; - throw new Error(`Invalid chant config${loc}: ${path ? `${path}: ` : ""}${issue2.message}`); + throw new InvalidChantConfigError( + `Invalid chant config${loc}: ${path ? `${path}: ` : ""}${issue2.message}`, + issue2.path.length > 0 ? String(issue2.path[0]) : void 0 + ); + } + const lexicons = raw.lexicons; + const baseDir = source !== void 0 ? dirname8(source) : process.cwd(); + const sourceDir = raw.sourceDir; + for (const [i, entry] of (lexicons ?? []).entries()) { + if (typeof entry === "string" || entry.root === void 0) continue; + const { problem } = pathLexiconRoot(entry, baseDir, sourceDir); + if (problem !== void 0) { + const loc = source ? ` in ${source}` : ""; + throw new InvalidChantConfigError(`Invalid chant config${loc}: lexicons.${i}.root: ${problem}`, "lexicons"); + } + } + const recorded = registerLexiconDeclarations(lexicons, baseDir, sourceDir); + if (Object.keys(recorded).length > 0) { + return { ...raw, lexicons: lexiconNames(lexicons), lexiconModules: recorded }; } return raw; } -var EnvironmentEntrySchema, ChantConfigSchema, DEFAULT_CHANT_CONFIG, LINT_FRAGMENT_KEYS, isCommentKey, PROJECT_CONFIG_KEYS; +var EnvironmentEntrySchema, LexiconEntrySchema, ChantConfigSchema, DEFAULT_CHANT_CONFIG, LINT_FRAGMENT_KEYS, isCommentKey, PROJECT_CONFIG_KEYS, InvalidChantConfigError; var init_config = __esm({ "node_modules/@intentius/chant/src/config.ts"() { init_zod(); init_sbom_generator(); init_project_root(); init_config_sandbox(); + init_lexicon_module(); + init_decide_config(); EnvironmentEntrySchema = external_exports.union([ external_exports.string().min(1), external_exports.object({ @@ -20329,8 +22382,16 @@ var init_config = __esm({ endpoint: external_exports.string().min(1).optional() }) ]); + LexiconEntrySchema = external_exports.union([ + external_exports.string().min(1), + external_exports.object({ + name: external_exports.string().min(1), + module: external_exports.string().min(1), + root: external_exports.string().min(1).optional() + }).strict() + ]); ChantConfigSchema = external_exports.object({ - lexicons: external_exports.array(external_exports.string().min(1)).optional(), + lexicons: external_exports.array(LexiconEntrySchema).optional(), capabilities: external_exports.array(external_exports.string().min(1)).optional(), environments: external_exports.array(EnvironmentEntrySchema).optional(), sourceDir: external_exports.string().min(1).optional(), @@ -20387,1063 +22448,2277 @@ var init_config = __esm({ }).optional(), knowledge: external_exports.object({ dir: external_exports.string().min(1).optional() - }).optional() + }).optional(), + decide: decideConfigSchema.optional(), + exclude: external_exports.array(external_exports.string().min(1)).optional(), + include: external_exports.array(external_exports.string().min(1)).optional(), + rootOnly: external_exports.boolean().optional() }).passthrough(); DEFAULT_CHANT_CONFIG = {}; LINT_FRAGMENT_KEYS = /* @__PURE__ */ new Set(["$schema", "extends", "rules", "overrides", "plugins", "policies"]); isCommentKey = (k) => k.startsWith("_"); PROJECT_CONFIG_KEYS = new Set(Object.keys(ChantConfigSchema.shape).filter((k) => k !== "lint")); + InvalidChantConfigError = class extends Error { + constructor(message, key) { + super(message); + this.key = key; + } + key; + }; } }); -// node_modules/@intentius/chant/src/declarable.ts -function isResourceDeclarable(value) { - return "props" in value; -} -function isDeclarable(value) { - return typeof value === "object" && value !== null && DECLARABLE_MARKER in value && value[DECLARABLE_MARKER] === true; -} -var DECLARABLE_MARKER; -var init_declarable = __esm({ - "node_modules/@intentius/chant/src/declarable.ts"() { - DECLARABLE_MARKER = /* @__PURE__ */ Symbol.for("chant.declarable"); +// node_modules/@intentius/chant/src/workspace/declaration.schema.json +var declaration_schema_default; +var init_declaration_schema = __esm({ + "node_modules/@intentius/chant/src/workspace/declaration.schema.json"() { + declaration_schema_default = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://intentius.io/chant/schemas/workspace/declaration/v1/chant.workspace.schema.json", + title: "chant.workspace.json", + description: "A workspace declaration, schema 1 (#2524 D1, D2; ws-051). Only this file makes a directory a workspace. It may also be named chant.workspace.jsonc, which allows comments and trailing commas; having both is an error. Unknown fields are refused, except fields whose names start with x-. A field added later within schema 1 is optional, and a declaration that uses one sets minReader to the first chant that knows it, so an older chant says so instead of misreading the file. Uniqueness of names and the placement rules are checked in code, since JSON Schema cannot say them.", + type: "object", + required: [ + "name", + "schema", + "members" + ], + properties: { + $schema: { + type: "string", + description: "An editor hint. chant ignores it." + }, + $comment: { + type: "string", + description: "A note for people. chant ignores it." + }, + name: { + $ref: "#/$defs/name", + description: "The workspace's name. With a git revision it identifies the workspace to readers (#2524 D15)." + }, + schema: { + const: 1, + description: "The declaration format version." + }, + minReader: { + $ref: "#/$defs/version", + description: "The oldest chant that may read this declaration. An older chant refuses it with reader-too-old." + }, + members: { + type: "array", + description: "Members and example groups, in the order readers list them.", + items: { + $ref: "#/$defs/entry" + } + }, + pins: { + type: "array", + description: "The toolchain and plugins that read this workspace, pinned (#2524 D3, threat model). Member kinds come only from pinned packages, read as data from their ./workspace-kinds subpath (#2535).", + items: { + $ref: "#/$defs/pin" + } + }, + quorum: { + type: "integer", + minimum: 0, + description: "How many agree verdicts besides the decider's a record needs, for every record kind with a reviews list (#2671). chant workspace records reports each record's quorum against it. Two when absent. Added in schema 1 by chant 0.86.0, so a declaration that sets it sets minReader to 0.86.0 or newer. A per-kind quorum comes later (#2650 C14)." + }, + records: { + type: "array", + description: "The workspace's own record kinds, each a kind file relative to the workspace root (#2680): the kinds whose records belong to no one member, such as a decisions directory at the root. A member names its own in its records. chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.", + items: { + $ref: "#/$defs/recordKind" + } + }, + hosts: { + type: "array", + description: "The hosts boxes run on (#2727). A host is one machine reached under one hostname: boxes on it share its ports, its state root and, in a browser, its cookie jar, so chant workspace check compares the boxes on one host and never boxes on different hosts. A member's box block names its host. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.", + items: { + $ref: "#/$defs/host" + } + }, + diagrams: { + type: "array", + description: "The workspace's own diagram artifacts (#2764): the diagrams that belong to no one member, such as a diagrams directory at the root. A member names its own in its diagrams. chant workspace ls lists every declared diagram, and chant workspace check reports one whose render is stale for its source when the entry records a sourceHash. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.", + items: { + $ref: "#/$defs/diagram" + } + }, + checks: { + type: "object", + description: "Severity for the declaration checks that allow it, keyed by WSP id (#2535, ws-028): error, warning, info or off. chant workspace check refuses an id it does not know, and one whose severity is fixed.", + propertyNames: { + pattern: "^WSP[0-9]{3}$" + }, + additionalProperties: { + $ref: "#/$defs/severity" + } + }, + changes: { + type: "object", + additionalProperties: false, + description: "The forward coverage check, chant workspace check --changes .. (#2773): each path a diff changes is mapped to the current records whose constrains cover it. severity says what a finding does: off reports none, warn (the default) reports them and passes, fail reports them and fails. ignore lists globs over files whose changes need no record, such as lockfiles and generated output. Added in schema 1 by chant 0.92.0, so a declaration that uses it sets minReader to 0.92.0 or newer.", + properties: { + severity: { + enum: [ + "off", + "warn", + "fail" + ], + description: "What a change-uncovered or change-out-of-scope finding does. warn when absent." + }, + ignore: { + type: "array", + description: "Globs over file paths from the workspace root: * and ? within one segment, ** across segments. A changed path one matches is listed as ignored and never reported.", + items: { + $ref: "#/$defs/fileGlob" + } + } + } + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false, + $defs: { + name: { + type: "string", + pattern: "^[a-z0-9][a-z0-9-]{0,39}$", + description: "Lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters. _workspace and _members are reserved; the pattern already rules them out." + }, + kindName: { + type: "string", + pattern: "^[a-z][a-z0-9-]{0,39}$" + }, + version: { + type: "string", + pattern: "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?$" + }, + dir: { + type: "string", + description: 'A directory relative to the workspace root, with / separators: "." for the root itself, otherwise no leading /, no . or .. segments and no trailing /.', + pattern: "^(\\.|(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*)$" + }, + glob: { + type: "string", + description: "A glob over directories, relative to the workspace root: * and ? within one segment, ** across segments, [...] classes. No leading /, no . or .. segments.", + pattern: "^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$" + }, + severity: { + enum: [ + "error", + "warning", + "info", + "off" + ] + }, + suppress: { + type: "array", + description: "Declaration checks suppressed for this entry (#2535). Each names a WSP id and says why. A suppressed finding is still reported, as suppressed, and never fails check.", + items: { + type: "object", + required: [ + "check", + "because" + ], + properties: { + check: { + type: "string", + pattern: "^WSP[0-9]{3}$" + }, + because: { + type: "string", + minLength: 1 + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + } + }, + outputName: { + type: "string", + minLength: 1, + maxLength: 255, + pattern: "^[^\\u0000-\\u001f]+$", + description: "An output's name, compared exactly." + }, + link: { + type: "object", + description: "A member link: this member reads output of member (#2539).", + required: [ + "member", + "output" + ], + properties: { + member: { + $ref: "#/$defs/name", + description: "The producer: another member of this workspace." + }, + output: { + $ref: "#/$defs/outputName", + description: "The producer's output, matched exactly. It must be one the producer's kind exposes." + }, + kind: { + $ref: "#/$defs/kindName", + description: "The link kind. output, the default, is the only one so far: the consumer reads the named output." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + entry: { + description: "A member, or an example group when kind is examples (ws-051).", + type: "object", + required: [ + "kind" + ], + properties: { + kind: { + $ref: "#/$defs/kindName" + } + }, + if: { + type: "object", + properties: { + kind: { + const: "examples" + } + }, + required: [ + "kind" + ] + }, + then: { + $ref: "#/$defs/group" + }, + else: { + $ref: "#/$defs/member" + } + }, + member: { + type: "object", + description: "A member (#2524 D2). Its directory leaves the root project, and it gets its own build, lint and ledger.", + required: [ + "name", + "dir", + "kind" + ], + properties: { + name: { + $ref: "#/$defs/name", + description: "Frozen once the member deploys; a rename is an alias record." + }, + dir: { + $ref: "#/$defs/dir" + }, + kind: { + $ref: "#/$defs/kindName", + description: "How to read the member: chant, workspace, other, or a kind a pinned plugin supplies (#2535)." + }, + roles: { + type: "array", + description: "Roles the member plays. A role may point at a path inside the member.", + items: { + oneOf: [ + { + $ref: "#/$defs/kindName" + }, + { + type: "object", + required: [ + "name" + ], + properties: { + name: { + $ref: "#/$defs/kindName" + }, + path: { + $ref: "#/$defs/dir", + description: "Relative to the member's directory." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + } + ] + } + }, + generated: { + type: "array", + description: "Files in the member's directory that a command writes (#2524 D14, #2541). chant workspace check fails when one differs from what its generator writes, unless the entry is marked handWritten with a reason. The lineage lock classes the same files as generated. skills/*/SKILL.md, which chant update writes, is listed implicitly for a chant member.", + items: { + $ref: "#/$defs/generatedFile" + } + }, + outputs: { + type: "array", + uniqueItems: true, + description: "The outputs this member exposes as link targets (#2539), for a member whose kind takes them from the entry: other, or a kind a pinned package supplies. A chant member's outputs are read from its source, and a nested workspace exposes none.", + items: { + $ref: "#/$defs/outputName" + } + }, + links: { + type: "array", + description: "Member links (#2524 D6, #2539): the outputs of other members this member reads. A link is stated once, here on the consumer, and matched exactly against the producer's outputs. chant workspace check resolves it in source.", + items: { + $ref: "#/$defs/link" + } + }, + records: { + type: "array", + description: "The record kinds this member holds, each a kind file relative to the member's directory (#2680). chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.", + items: { + $ref: "#/$defs/recordKind" + } + }, + diagrams: { + type: "array", + description: "The diagram artifacts this member holds (#2764). chant workspace ls lists every declared diagram, and chant workspace check reports one whose render is stale for its source when the entry records a sourceHash. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.", + items: { + $ref: "#/$defs/diagram" + } + }, + box: { + $ref: "#/$defs/box" + }, + upstream: { + type: "string", + minLength: 1, + description: "Where an embedded member's files come from. Versions live in the lock." + }, + because: { + type: "string", + minLength: 1, + description: "Why the member is there. Required for kind other." + }, + suppress: { + $ref: "#/$defs/suppress" + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false, + if: { + type: "object", + properties: { + kind: { + const: "other" + } + }, + required: [ + "kind" + ] + }, + then: { + type: "object", + properties: { + because: { + type: "string" + } + }, + required: [ + "because" + ] + } + }, + group: { + type: "object", + description: "An example group (ws-051): every directory the glob matches that holds a chant project is built and linted. A group has no ledger, releases or links, and its matches are never members. A match may sit inside a member's directory; that member leaves it to the group.", + required: [ + "name", + "kind", + "glob" + ], + properties: { + name: { + $ref: "#/$defs/name" + }, + kind: { + const: "examples" + }, + glob: { + oneOf: [ + { + $ref: "#/$defs/glob" + }, + { + type: "array", + minItems: 1, + uniqueItems: true, + items: { + $ref: "#/$defs/glob" + } + } + ] + }, + suppress: { + $ref: "#/$defs/suppress" + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + path: { + type: "string", + description: "A file or directory path with / separators: no leading /, no . or .. segments and no trailing /.", + pattern: "^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$" + }, + box: { + type: "object", + description: "The member is a box, or holds a box's declarations (#2726). A box holds no credential: each capability it needs outside itself is reached through a broker, a runtime such as a lobby or a door, which holds the credential and enforces the scope. chant workspace check fails when a file in the member's directory carries a literal secret (WSP121) and when a capability names no broker (WSP122). chant workspace status --json lists the capabilities, so a broker can read the scopes. Its host, slot, ports, state and cookies state the box's isolation (#2727): chant derives each value from the box's identity, its host, the member's name and its slot, and prints them in chant workspace status --json, so a runtime reads them instead of choosing its own. chant workspace check fails when two boxes on a host resolve to the same value (WSP123) and when a box hard-codes a machine path (WSP124). A member that builds the fountain lexicon's Box declares the callback token fountain gives its persistent sandbox as the capability fountain-callback, brokered by fountain, with scope owner, or chant workspace check fails (WSP125, #2780). Its intent names the decision record that says what the box is for (#2850): chant workspace status --json reports the record's state and answer, and chant workspace check fails when no decision record has the id (WSP126) and warns when the record constrains no member or path of this workspace (WSP127, #2857). Its services list what the box runs under its supervisor (#2880), which the fly lexicon observes, restarts and applies through sprite-env, and which chant workspace status --json prints. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.", + properties: { + intent: { + type: "string", + minLength: 1, + description: "The id of the decision record that says what the box is for (#2850), a record of a declared kind named decision. A new box starts as a question: the record is proposed with a null choice until the person who answers it decides it. The record constrains a member or path of this workspace, with member: or a path: entry at, above or inside a member's directory. It need not be this member: the intent can constrain the app the box runs when that app is another member (#2857). When it constrains this member, chant workspace graph --intent shows it for the box's files. Added by chant 0.94.0, so a declaration that uses it sets minReader to 0.94.0 or newer." + }, + services: { + type: "array", + description: "The services the box runs under its supervisor, sprite-env on a sprite (#2880). Each name is given once, every needs entry names a service of this list, the needs form no cycle, and at most one service sets httpPort; a declaration that breaks one of these can't be read (declaration-invalid). The fly lexicon's spriteServicesObserve and spriteServiceRestart read the list with box: true, and spriteApplyServices with box: true creates and replaces the services through sprite-env. None when omitted. Added by chant 0.95.0, so a declaration that uses it sets minReader to 0.95.0 or newer.", + items: { + $ref: "#/$defs/boxService" + } + }, + capabilities: { + type: "array", + description: "Each capability the box reaches outside itself, named once. None when omitted.", + items: { + $ref: "#/$defs/capability" + } + }, + host: { + $ref: "#/$defs/name", + description: "The host the box runs on, one of the top-level hosts (#2727). The box's name is the member's name." + }, + slot: { + type: "integer", + minimum: 0, + description: "The box's number on its host (#2727). Its ports come from the slot's block of the host's range." + }, + ports: { + type: "object", + description: "The ports the box listens on, each a name and its offset in the box's block (#2727). The port is the block's first port plus the offset.", + propertyNames: { + $ref: "#/$defs/kindName" + }, + additionalProperties: { + type: "integer", + minimum: 0, + maximum: 65534 + } + }, + state: { + type: "object", + description: "State the box keeps outside its checkout, such as hud's identity and database, each a name and a path relative to the box's state directory (#2727). The name is usually the environment variable the runtime sets, such as HUD_IDENTITY_PATH. A path that is absolute, starts with ~ or an environment reference, or has a .. segment is a WSP124 finding.", + propertyNames: { + type: "string", + pattern: "^[A-Za-z_][A-Za-z0-9_-]{0,63}$" + }, + additionalProperties: { + type: "string", + minLength: 1 + } + }, + cookies: { + type: "array", + description: "Session cookie names the box's runtimes set, such as hud_session (#2727). A browser scopes a cookie to a host, not a port, so each resolves to _.", + uniqueItems: true, + items: { + type: "string", + pattern: "^[A-Za-z][A-Za-z0-9_-]{0,63}$" + } + } + }, + dependentRequired: { + host: [ + "slot" + ], + slot: [ + "host" + ], + ports: [ + "host" + ], + state: [ + "host" + ], + cookies: [ + "host" + ] + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + boxService: { + type: "object", + description: "A service a box runs under its supervisor (#2880).", + required: [ + "name", + "cmd" + ], + properties: { + name: { + $ref: "#/$defs/kindName", + description: "The service's name in the supervisor. Unique within the box." + }, + cmd: { + type: "string", + minLength: 1, + description: "The command the supervisor runs (sprite-env services create --cmd). ${HOME} and other ${VAR} references are expanded from the environment of the process that applies the list, so the declaration holds no machine path." + }, + needs: { + type: "array", + uniqueItems: true, + description: "Names of services of the same box that start before this one (sprite-env services create --needs).", + items: { + $ref: "#/$defs/kindName" + } + }, + httpPort: { + $ref: "#/$defs/port", + description: "The port the supervisor routes the sprite's URL to (sprite-env services create --http-port). At most one service of a box sets it." + }, + duration: { + type: "string", + pattern: "^[0-9]+(\\.[0-9]+)?(ms|s|m)$", + description: "How long the service must stay up after it is created or started, such as 3s (sprite-env services create --duration)." + }, + health: { + type: "string", + pattern: "^https?://", + description: "A URL that answers 200 while the service works. spriteServicesObserve probes it, and spriteServiceRestart waits for it after a restart. Without it, the supervisor's state decides." + }, + optional: { + type: "boolean", + description: "True for a service something else creates by name, such as a site a release Op makes: spriteApplyServices creates it only when its only names it, and spriteServicesObserve skips it while the supervisor has no such service." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + capability: { + type: "object", + description: "A capability a box needs and does not hold the credential for, such as inference, fountain or a third-party API (#2726).", + required: [ + "name" + ], + properties: { + name: { + $ref: "#/$defs/kindName", + description: "The capability, such as inference or fountain. Unique within the box." + }, + broker: { + type: "string", + minLength: 1, + description: "What brokers the capability: the runtime that holds the credential and swaps the box's own token for it, such as lobby or door. It may name a member of this workspace, or a runtime outside it. Without it the capability is unbrokered, and chant workspace check fails with WSP122." + }, + scope: { + type: "array", + uniqueItems: true, + description: "What of the box's own the broker lets it reach, which the broker enforces. For Fountain: agent (start conversations with its own agent), vault (attach its own vault), conversations and sandboxes (its own). The words are the broker's; chant records them.", + items: { + type: "string", + minLength: 1, + pattern: "^[^\\u0000-\\u001f]+$" + } + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + recordKind: { + type: "object", + description: "A record kind the workspace declares (#2680): a kind file that exports recordKind. chant workspace check fails (WSP115) when the file is missing or does not load as a record kind.", + required: [ + "kind" + ], + properties: { + kind: { + $ref: "#/$defs/path", + description: "The kind file, relative to the member's directory, or to the workspace root for the workspace's own records. A path is listed once across the declaration." + }, + name: { + $ref: "#/$defs/kindName", + description: "The name readers show for the kind. Without it, the kind file's own recordKind.name. Unique across the declaration." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + diagram: { + type: "object", + description: "A diagram artifact the workspace declares (#2764): a rendered image with a source, pinned to the renderer that made it. A mermaid or excalidraw diagram may name no render: a reader draws it from its source. chant never runs the renderer.", + required: [ + "name", + "title", + "renderer" + ], + if: { + type: "object", + properties: { + renderer: { + type: "object", + properties: { + tool: { + enum: ["mermaid", "excalidraw"] + } + }, + required: [ + "tool" + ] + } + }, + required: [ + "renderer" + ] + }, + then: { + type: "object", + properties: { + source: { + $ref: "#/$defs/path" + } + }, + required: [ + "source" + ] + }, + else: { + type: "object", + properties: { + render: { + $ref: "#/$defs/path" + } + }, + required: [ + "render" + ] + }, + properties: { + name: { + $ref: "#/$defs/name", + description: "Unique across the declaration." + }, + title: { + type: "string", + minLength: 1, + description: "Shown above the diagram." + }, + source: { + oneOf: [ + { $ref: "#/$defs/path" }, + { type: "null" } + ], + description: "The source file, from the workspace root, with / separators. Null for an SVG with no source. Default null." + }, + render: { + oneOf: [ + { $ref: "#/$defs/path" }, + { type: "null" } + ], + description: "The rendered image, from the workspace root, with / separators. Required for d2 and graphviz. A mermaid or excalidraw diagram needs a source instead and may leave render out or null, from chant 0.96.0: a reader such as hud draws it from the source (an excalidraw diagram may still commit an exported SVG for docs)." + }, + renderer: { + $ref: "#/$defs/diagramRenderer" + }, + sourceHash: { + type: ["string", "null"], + pattern: "^[0-9a-f]{64}$", + description: "sha256 hex of the source's bytes when render was last produced from it, or for a mermaid or excalidraw diagram without a render, when the source was last pinned. chant workspace check compares this against the source in the tree read and reports drift (WSP133) on a mismatch; without it, or without a source, the render is never checked for drift. Default null." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + diagramRenderer: { + type: "object", + description: "The renderer a diagram's render was made with. chant records the pin; it never installs or runs the renderer (ws-052).", + required: [ + "tool", + "version" + ], + properties: { + tool: { + enum: ["d2", "mermaid", "graphviz", "excalidraw"] + }, + version: { + $ref: "#/$defs/version", + description: "The exact release the render was made with, such as 0.9.0. For mermaid or excalidraw, the release of the library a reader draws the source with, such as 11.4.1." + }, + args: { + type: "array", + description: 'Passed before the input and output paths, in order, such as ["--layout=elk", "--theme=0", "--pad=40", "--omit-version"]. Empty when absent.', + items: { + type: "string" + } + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + generatedFile: { + type: "object", + description: "One generated file of a member (#2524 D14, #2541).", + required: [ + "path", + "generator" + ], + properties: { + path: { + $ref: "#/$defs/path", + description: "The file, relative to the member's directory." + }, + generator: { + type: "string", + minLength: 1, + description: "The command line that writes the file, run in the member's directory with the member's own node_modules/.bin first on PATH, such as chant build ci --lexicon github -o ci.yml. When it passes -o or --output with this file's path, chant workspace check --generated points that flag at a temporary file. Otherwise the generator writes in place and check restores the tree afterwards." + }, + sources: { + type: "array", + description: "The files or directories the generator reads, relative to the workspace root, since a generator often reads other members.", + items: { + $ref: "#/$defs/path" + } + }, + handWritten: { + type: "object", + description: "The file is kept by hand instead of regenerated. chant workspace check reports it with the reason and never runs its generator, and the lock classes it owned.", + required: [ + "because" + ], + properties: { + because: { + type: "string", + minLength: 1 + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + pin: { + description: "An npm package at an exact version, or a local plugin by path. integrity is a Subresource Integrity digest.", + oneOf: [ + { + type: "object", + required: [ + "package", + "version" + ], + properties: { + package: { + type: "string", + pattern: "^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$" + }, + version: { + $ref: "#/$defs/version" + }, + integrity: { + type: "string", + pattern: "^sha(256|384|512)-[A-Za-z0-9+/]+={0,2}$" + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + { + type: "object", + required: [ + "path" + ], + properties: { + path: { + $ref: "#/$defs/dir" + }, + integrity: { + type: "string", + pattern: "^sha(256|384|512)-[A-Za-z0-9+/]+={0,2}$" + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + } + ] + }, + host: { + type: "object", + description: "A host boxes run on (#2727).", + required: [ + "name", + "ports" + ], + properties: { + name: { + $ref: "#/$defs/name", + description: "The host's name, unique among hosts. A box block names it in host." + }, + ports: { + type: "object", + description: "The TCP ports boxes on this host take theirs from. Slot n owns the block from + n * perBox to from + (n + 1) * perBox - 1, which must end at or before to.", + required: [ + "from", + "to", + "perBox" + ], + properties: { + from: { + $ref: "#/$defs/port", + description: "The first port of the range." + }, + to: { + $ref: "#/$defs/port", + description: "The last port of the range, inclusive." + }, + perBox: { + type: "integer", + minimum: 1, + maximum: 65535, + description: "How many ports each box's block holds. A box's port offsets are below it." + } + }, + additionalProperties: false + }, + stateRoot: { + type: "string", + minLength: 1, + description: "Where boxes on this host keep state, as an environment reference such as ${XDG_STATE_HOME}/chant/boxes, which the runtime expands on the machine. A box's state directory is /. A literal machine path, such as /Users/... or anything under $HOME, is a WSP124 finding. Default ${XDG_STATE_HOME}/chant/boxes." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + port: { + type: "integer", + minimum: 1, + maximum: 65535 + }, + fileGlob: { + type: "string", + description: "A glob over file paths, relative to the workspace root: * and ? within one segment, ** across segments, [...] classes and {a,b} alternatives. No leading /, no . or .. segments.", + pattern: "^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$" + } + } + }; } }); -// node_modules/@intentius/chant/src/held-elsewhere.ts -var init_held_elsewhere = __esm({ - "node_modules/@intentius/chant/src/held-elsewhere.ts"() { - } +// node_modules/@intentius/chant/src/workspace/tree.ts +var tree_exports = {}; +__export(tree_exports, { + gitTop: () => gitTop, + gitTree: () => gitTree, + joinPath: () => joinPath, + resolveCommit: () => resolveCommit, + skippedDir: () => skippedDir, + workingTree: () => workingTree }); - -// node_modules/@intentius/chant/src/provenance.ts -function isPathPrefix(prefix, path) { - if (prefix === "") return true; - if (!path.startsWith(prefix)) return false; - if (path.length === prefix.length) return true; - const next = path[prefix.length]; - return next === "." || next === "["; +import { execFileSync } from "node:child_process"; +import { readdirSync, readFileSync as readFileSync4, statSync as statSync2 } from "node:fs"; +import { join as join8 } from "node:path"; +function joinPath(...parts) { + return parts.filter((p) => p !== "" && p !== ".").join("/"); } -function setProvenance(entity, prov) { - if (!Object.isExtensible(entity)) return; - const existing = entity[PROVENANCE]; - if (existing) { - existing.sourceFile ??= prov.sourceFile; - existing.composite ??= prov.composite; - existing.compositeInstance ??= prov.compositeInstance; - if (prov.paths) { - existing.paths ??= {}; - for (const [path, origin] of Object.entries(prov.paths)) { - existing.paths[path] ??= origin; +function workingTree(root) { + return { + label: "", + stat(path) { + try { + const s = statSync2(join8(root, path)); + return s.isDirectory() ? "dir" : s.isFile() ? "file" : void 0; + } catch { + return void 0; + } + }, + list(path) { + let dirents; + try { + dirents = readdirSync(join8(root, path), { withFileTypes: true }); + } catch { + return void 0; + } + const out = []; + for (const d of dirents) { + let type = d.isDirectory() ? "dir" : d.isFile() ? "file" : void 0; + if (!type && d.isSymbolicLink()) { + try { + const s = statSync2(join8(root, path, d.name)); + type = s.isDirectory() ? "dir" : s.isFile() ? "file" : void 0; + } catch { + } + } + if (type) out.push({ name: d.name, type }); } + return out; + }, + read(path) { + return readFileSync4(join8(root, path), "utf-8"); + }, + bytes(path) { + return readFileSync4(join8(root, path)); } - return; - } - Object.defineProperty(entity, PROVENANCE, { - value: { ...prov, ...prov.paths ? { paths: { ...prov.paths } } : {} }, - enumerable: false, - writable: true, - configurable: true - }); + }; } -function getProvenance(entity) { - return entity[PROVENANCE]; +function git(cwd, args) { + return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"], maxBuffer: 512 * 1024 * 1024 }); } -function setPathProvenance(entity, path, origin) { - setProvenance(entity, { paths: { [path]: origin } }); +function gitTop(cwd) { + try { + return git(cwd, ["rev-parse", "--show-toplevel"]).trim(); + } catch { + return void 0; + } } -function originOfPath(paths, path) { - if (!paths) return void 0; - let best; - for (const key of Object.keys(paths)) { - if (!isPathPrefix(key, path)) continue; - if (best === void 0 || key.length > best.length) best = key; +function resolveCommit(top, rev) { + if (rev.startsWith("-")) return void 0; + try { + return git(top, ["rev-parse", "--verify", "--quiet", `${rev}^{commit}`]).trim(); + } catch { + return void 0; } - return best === void 0 ? void 0 : paths[best]; } -var PROVENANCE; -var init_provenance = __esm({ - "node_modules/@intentius/chant/src/provenance.ts"() { - PROVENANCE = /* @__PURE__ */ Symbol.for("chant.provenance"); +function gitTree(top, commit, prefix = "") { + const entries = /* @__PURE__ */ new Map([["", "dir"]]); + const children = /* @__PURE__ */ new Map([["", []]]); + const out = git(top, ["ls-tree", "-r", "-t", "-z", "--full-tree", commit]); + for (const line of out.split("\0")) { + if (!line) continue; + const tab = line.indexOf(" "); + const type = line.slice(0, tab).split(" ")[1]; + const full = line.slice(tab + 1); + let path; + if (prefix === "") path = full; + else if (full.startsWith(`${prefix}/`)) path = full.slice(prefix.length + 1); + else continue; + const kind = type === "tree" ? "dir" : type === "blob" ? "file" : void 0; + if (!kind) continue; + entries.set(path, kind); + const slash = path.lastIndexOf("/"); + const parent = slash < 0 ? "" : path.slice(0, slash); + if (!children.has(parent)) children.set(parent, []); + children.get(parent).push({ name: path.slice(slash + 1), type: kind }); + if (kind === "dir" && !children.has(path)) children.set(path, []); + } + return { + label: ` at ${commit.slice(0, 8)}`, + stat: (path) => entries.get(path), + list: (path) => entries.get(path) === "dir" ? [...children.get(path) ?? []] : void 0, + read(path) { + if (entries.get(path) !== "file") throw new Error(`${path} is not a file${` at ${commit.slice(0, 8)}`}`); + return git(top, ["cat-file", "blob", `${commit}:${joinPath(prefix, path)}`]); + }, + bytes(path) { + if (entries.get(path) !== "file") throw new Error(`${path} is not a file${` at ${commit.slice(0, 8)}`}`); + return execFileSync("git", ["cat-file", "blob", `${commit}:${joinPath(prefix, path)}`], { cwd: top, stdio: ["ignore", "pipe", "pipe"], maxBuffer: 512 * 1024 * 1024 }); + } + }; +} +function skippedDir(name) { + return name === "node_modules" || name.startsWith("."); +} +var init_tree = __esm({ + "node_modules/@intentius/chant/src/workspace/tree.ts"() { } }); -// node_modules/@intentius/chant/src/composite.ts -function isCompositeInstance(value) { - return typeof value === "object" && value !== null && COMPOSITE_MARKER in value && value[COMPOSITE_MARKER] === true; -} -function Composite(factory, name) { - const id = /* @__PURE__ */ Symbol(); - const compositeName = name ?? "anonymous"; - const definition = ((props) => { - const members = factory(props); - for (const [key, value] of Object.entries(members)) { - if (!isDeclarable(value) && !isCompositeInstance(value)) { - throw new Error( - `Composite "${compositeName}" member "${key}" is not a Declarable or CompositeInstance` - ); - } +// node_modules/@intentius/chant/src/workspace/glob.ts +function expandGlob(tree, glob) { + const segments = glob.split("/"); + const matchers = segments.map( + (s) => s === "**" ? "**" : isLiteral(s) ? s : (0, import_picomatch.default)(s, { dot: false }) + ); + const found = /* @__PURE__ */ new Set(); + const subdirs = (dir) => (tree.list(dir) ?? []).filter((e) => e.type === "dir" && !skippedDir(e.name)).map((e) => e.name); + const walk = (dir, index) => { + if (index === matchers.length) { + if (dir !== "") found.add(dir); + return; } - const instance = {}; - Object.defineProperty(instance, COMPOSITE_MARKER, { value: true, enumerable: false }); - Object.defineProperty(instance, "members", { value: members, enumerable: false }); - Object.defineProperty(instance, "_definition", { value: definition, enumerable: false }); - return Object.assign(instance, members); - }); - Object.defineProperty(definition, "compositeName", { value: compositeName, writable: false }); - Object.defineProperty(definition, "_id", { value: id, writable: false }); - CompositeRegistry.register(definition); - return definition; -} -function expandComposite(prefix, instance, instanceName = prefix) { - const result = /* @__PURE__ */ new Map(); - const shared = instance[SHARED_PROPS]; - const compositeName = instance._definition?.compositeName; - for (const [memberName, member] of Object.entries(instance.members)) { - const fullName = `${prefix}${memberName[0].toUpperCase()}${memberName.slice(1)}`; - if (isCompositeInstance(member)) { - const nested = expandComposite(fullName, member, instanceName); - for (const [nestedName, nestedEntity] of nested) { - if (compositeName) setProvenance(nestedEntity, { composite: compositeName }); - result.set(nestedName, nestedEntity); - } - } else { - if (compositeName) setProvenance(member, { composite: compositeName }); - result.set(fullName, member); + const m = matchers[index]; + if (m === "**") { + walk(dir, index + 1); + for (const name of subdirs(dir)) walk(joinPath(dir, name), index); + return; } - } - if (compositeName) { - for (const entity of result.values()) { - setPathProvenance(entity, "", { kind: "composite", composite: compositeName, instance: instanceName }); + if (typeof m === "string") { + const next = joinPath(dir, m); + if (tree.stat(next) === "dir") walk(next, index + 1); + return; } + for (const name of subdirs(dir)) if (m(name)) walk(joinPath(dir, name), index + 1); + }; + walk("", 0); + return [...found].sort(); +} +var import_picomatch, isLiteral; +var init_glob = __esm({ + "node_modules/@intentius/chant/src/workspace/glob.ts"() { + import_picomatch = __toESM(require_picomatch2(), 1); + init_tree(); + isLiteral = (segment) => !/[*?[\]{}()!+@]/.test(segment); } - if (shared) { - for (const entity of result.values()) { - if ("props" in entity) { - const store = entity; - let existing = store[ORIGINAL_PROPS]; - if (existing === void 0) { - existing = entity.props; - Object.defineProperty(entity, ORIGINAL_PROPS, { - value: existing, - enumerable: false, - configurable: true - }); - } - const merged = {}; - for (const [k, v] of Object.entries(shared)) { - if (v !== void 0) { - merged[k] = v; +}); + +// node_modules/@intentius/chant/src/workspace/workspace-kinds.schema.json +var workspace_kinds_schema_default; +var init_workspace_kinds_schema = __esm({ + "node_modules/@intentius/chant/src/workspace/workspace-kinds.schema.json"() { + workspace_kinds_schema_default = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://intentius.io/chant/schemas/workspace/kinds/v1/workspace-kinds.schema.json", + title: "workspace-kinds.json", + description: "Member kinds a plugin supplies (#2524 D3, #2535, ws-031). A package publishes this file as data at its ./workspace-kinds subpath. chant reads it with the file system and never imports the package, so reading kinds never loads a lexicon.", + type: "object", + required: [ + "schema", + "kinds" + ], + properties: { + $schema: { + type: "string", + description: "An editor hint. chant ignores it." + }, + $comment: { + type: "string", + description: "A note for people. chant ignores it." + }, + schema: { + const: 1, + description: "The kinds format version." + }, + kinds: { + type: "array", + minItems: 1, + items: { + $ref: "#/$defs/kind" } } - for (const [k, v] of Object.entries(existing)) { - if (v !== void 0) { - if (Array.isArray(v) && Array.isArray(merged[k])) { - merged[k] = [...merged[k], ...v]; - } else { - merged[k] = v; + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false, + $defs: { + kind: { + type: "object", + required: [ + "name", + "description", + "precedence", + "probe" + ], + properties: { + name: { + type: "string", + pattern: "^[a-z][a-z0-9-]{0,39}$", + description: "The kind's name, as a member's kind field names it. chant, workspace, other and examples are built in and can't be supplied." + }, + description: { + type: "string", + minLength: 1, + description: "One line saying what the member's directory holds, for listings and error messages." + }, + precedence: { + type: "integer", + minimum: 1, + maximum: 999, + description: "When the probes of several kinds claim one directory, the highest precedence decides. Two claiming kinds with the same highest precedence are a tie, and a tie fails. The built-in chant kind has 500 and workspace has 1000." + }, + probe: { + $ref: "#/$defs/probe" + }, + outputs: { + type: "array", + uniqueItems: true, + description: "The outputs every member of this kind exposes as link targets (#2524 D6, #2539). A member entry of the kind may list more in its own outputs field. Without this field the kind exposes only what each entry lists.", + items: { + type: "string", + minLength: 1, + maxLength: 255, + pattern: "^[^\\u0000-\\u001f]+$" + } + }, + graph: { + $ref: "#/$defs/graph" } - } - } - Object.defineProperty(entity, "props", { - value: merged, - enumerable: false, - configurable: true - }); - if (compositeName) { - for (const k of Object.keys(shared)) { - if (shared[k] === void 0 || existing[k] !== void 0) continue; - setPathProvenance(entity, k, { - kind: "composite", - composite: compositeName, - instance: instanceName - }); - } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false + }, + probe: { + type: "object", + description: "What the probe checks in a member's directory. It runs no code. It passes when any of its clauses does, and it needs at least one.", + minProperties: 1, + properties: { + anyFile: { + type: "array", + minItems: 1, + uniqueItems: true, + description: "The directory passes when a file matching one of these names sits directly in it. A * in a name matches any run of characters, so *.tf matches every Terraform file.", + items: { + $ref: "#/$defs/fileName" + } + }, + anyBlock: { + type: "object", + description: "The directory passes when a file directly in it, whose name matches one of in, has a line opening an unlabelled block named in blocks: leading space, the name, optional space, then {. No file is parsed.", + required: [ + "in", + "blocks" + ], + properties: { + in: { + type: "array", + minItems: 1, + uniqueItems: true, + items: { + $ref: "#/$defs/fileName" + } + }, + blocks: { + type: "array", + minItems: 1, + uniqueItems: true, + items: { + type: "string", + pattern: "^[A-Za-z_][A-Za-z0-9_-]{0,63}$" + } + } + }, + additionalProperties: false + } + }, + additionalProperties: false + }, + fileName: { + type: "string", + description: "A file name, with no directory part. A * matches any run of characters.", + pattern: "^(?!\\.\\.?$)[^/\\\\]+$" + }, + graph: { + type: "object", + description: "How chant workspace graph reads a member of this kind (#2874). chant writes a reader project of its own outside the workspace, with a chant.config.json that declares lexicon and puts config under that lexicon's key, and runs the member's chant graph there. In every string key and value of config, {member} becomes the member's name, {dir} its absolute directory and {workspace} the absolute workspace root. Without this field a member of the kind is listed with kind-not-run.", + required: [ + "lexicon", + "config" + ], + properties: { + lexicon: { + type: "string", + pattern: "^[a-z][a-z0-9-]{0,39}$", + description: "The lexicon that reads the member, by name. The package that supplies the kind must be @intentius/chant-lexicon-, so the lexicon chant loads is the one the declaration pins." + }, + config: { + type: "object", + description: "The lexicon's config namespace for the reader project, such as terraform's roots. Placeholders are substituted; nothing else is interpreted." + } + }, + patternProperties: { + "^x-": true + }, + additionalProperties: false } } - } - } - return result; -} -var COMPOSITE_MARKER, CompositeRegistry, SHARED_PROPS, ORIGINAL_PROPS; -var init_composite = __esm({ - "node_modules/@intentius/chant/src/composite.ts"() { - init_declarable(); - init_provenance(); - COMPOSITE_MARKER = /* @__PURE__ */ Symbol.for("chant.composite"); - CompositeRegistry = class { - static definitions = /* @__PURE__ */ new Map(); - static register(definition) { - this.definitions.set(definition._id, definition); - } - static getAll() { - return Array.from(this.definitions.values()); - } - static clear() { - this.definitions.clear(); - } - static get size() { - return this.definitions.size; - } }; - SHARED_PROPS = /* @__PURE__ */ Symbol.for("chant.composite.shared"); - ORIGINAL_PROPS = /* @__PURE__ */ Symbol.for("chant.composite.origProps"); } }); -// node_modules/@intentius/chant/src/secret-provenance.ts -function isSecretDeclaration(value) { - return typeof value === "object" && value !== null && SECRET_DECLARATION_MARKER in value && value[SECRET_DECLARATION_MARKER] === true; -} -var SECRET_DECLARATION_MARKER; -var init_secret_provenance = __esm({ - "node_modules/@intentius/chant/src/secret-provenance.ts"() { - init_declarable(); - SECRET_DECLARATION_MARKER = /* @__PURE__ */ Symbol.for("chant.secret-declaration"); +// node_modules/@intentius/chant/src/workspace/kinds.ts +function holdsChantProject(tree, dir) { + const pkg = joinPath(dir, "package.json"); + if (tree.stat(pkg) === "file") { + try { + const json2 = JSON.parse(tree.read(pkg)); + for (const field of ["dependencies", "devDependencies", "peerDependencies"]) { + const deps = json2[field]; + if (deps && typeof deps === "object" && Object.keys(deps).some(isChantPackage)) return true; + } + } catch { + } + } + const search = (at, depth) => { + const entries = tree.list(at) ?? []; + if (entries.some((e) => e.type === "file" && CONFIG_FILES.includes(e.name))) return true; + if (depth === PROJECT_SEARCH_DEPTH) return false; + return entries.some((e) => e.type === "dir" && !skippedDir(e.name) && search(joinPath(at, e.name), depth + 1)); + }; + return search(dir, 0); +} +function isChantPackage(name) { + return name === "@intentius/chant" || name.startsWith("@intentius/chant-lexicon-"); +} +var KINDS_SCHEMA_ID, EXAMPLES_KIND, BUILTIN_KINDS, BUILTIN_KIND_NAMES, CONFIG_FILES, PROJECT_SEARCH_DEPTH; +var init_kinds = __esm({ + "node_modules/@intentius/chant/src/workspace/kinds.ts"() { + init_workspace_kinds_schema(); + init_tree(); + KINDS_SCHEMA_ID = workspace_kinds_schema_default.$id; + EXAMPLES_KIND = "examples"; + BUILTIN_KINDS = [ + { + name: "chant", + description: "a chant project, with a chant.config.ts or chant.config.json in its directory", + probe: { anyFile: ["chant.config.ts", "chant.config.json"] }, + precedence: 500, + shape: "member", + outputs: { from: "chant-source" }, + source: "builtin" + }, + { + name: "workspace", + description: "a nested workspace, with its own chant.workspace.json; opaque to the outer one", + probe: { anyFile: ["chant.workspace.json", "chant.workspace.jsonc"] }, + precedence: 1e3, + shape: "member", + outputs: { from: "none" }, + source: "builtin" + }, + { + name: "other", + description: "a directory chant does not read; the entry says why in `because`", + probe: { directory: true }, + precedence: 0, + shape: "member", + outputs: { from: "declared", names: [] }, + source: "builtin" + }, + { + name: EXAMPLES_KIND, + description: "an example group: every directory its glob matches that holds a chant project is built and linted", + probe: { chantProject: true }, + precedence: 0, + shape: "group", + outputs: { from: "none" }, + source: "builtin" + } + ]; + BUILTIN_KIND_NAMES = BUILTIN_KINDS.map((k) => k.name); + CONFIG_FILES = ["chant.config.ts", "chant.config.json"]; + PROJECT_SEARCH_DEPTH = 4; } }); -// node_modules/@intentius/chant/src/secret-materialization.ts -var vault, REDACTED, SecretMaterial; -var init_secret_materialization = __esm({ - "node_modules/@intentius/chant/src/secret-materialization.ts"() { - vault = /* @__PURE__ */ new WeakMap(); - REDACTED = "[secret material]"; - SecretMaterial = class _SecretMaterial { - constructor() { +// node_modules/@intentius/chant/src/workspace/jsonc.ts +function pointerToken(token) { + return String(token).replace(/~/g, "~0").replace(/\//g, "~1"); +} +function parseJsonText(text, options) { + const lineStarts = [0]; + for (let i2 = 0; i2 < text.length; i2++) if (text.charCodeAt(i2) === 10) lineStarts.push(i2 + 1); + const toLocation = (offset) => { + let lo = 0; + let hi = lineStarts.length - 1; + while (lo < hi) { + const mid = lo + hi + 1 >> 1; + if (lineStarts[mid] <= offset) lo = mid; + else hi = mid - 1; + } + return { line: lo + 1, column: offset - lineStarts[lo] + 1 }; + }; + const values = /* @__PURE__ */ new Map(); + const keys = /* @__PURE__ */ new Map(); + let i = text.charCodeAt(0) === 65279 ? 1 : 0; + const fail = (message, offset = i) => { + throw new JsonSyntaxError(message, offset); + }; + const describe3 = (offset) => offset >= text.length ? "the end of the file" : `${JSON.stringify(text[offset])}`; + function skip() { + for (; ; ) { + const c = text[i]; + if (c === " " || c === " " || c === "\n" || c === "\r") { + i++; + } else if (c === "/" && (text[i + 1] === "/" || text[i + 1] === "*")) { + if (!options.jsonc) fail("comments are only allowed in chant.workspace.jsonc"); + if (text[i + 1] === "/") { + while (i < text.length && text[i] !== "\n") i++; + } else { + const end = text.indexOf("*/", i + 2); + if (end < 0) fail("unterminated /* comment"); + i = end + 2; + } + } else { + return; } - /** Wrap plaintext in an opaque handle. Call inside a generator only. */ - static mint(plaintext) { - const handle = new _SecretMaterial(); - vault.set(handle, plaintext); - return handle; + } + } + function parseString() { + const start = i; + i++; + for (; ; ) { + if (i >= text.length) fail("unterminated string", start); + const c = text.charCodeAt(i); + if (c === 34) break; + if (c < 32) fail("control character in a string; escape it", i); + i += c === 92 ? 2 : 1; + } + i++; + try { + return JSON.parse(text.slice(start, i)); + } catch { + return fail("invalid escape in a string", start); + } + } + function parseValue2(pointer) { + skip(); + values.set(pointer, i); + const c = text[i]; + if (c === "{") return parseObject(pointer); + if (c === "[") return parseArray(pointer); + if (c === '"') return parseString(); + for (const [word, value] of [ + ["true", true], + ["false", false], + ["null", null] + ]) { + if (text.startsWith(word, i)) { + i += word.length; + return value; } - toString() { - return REDACTED; + } + const m = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text.slice(i, i + 64)); + if (m) { + i += m[0].length; + return Number(m[0]); + } + return fail(`expected a value, found ${describe3(i)}`); + } + function parseObject(pointer) { + const obj = {}; + const seen = /* @__PURE__ */ new Set(); + i++; + skip(); + if (text[i] === "}") { + i++; + return obj; + } + for (; ; ) { + skip(); + if (text[i] !== '"') fail(`expected a quoted key, found ${describe3(i)}`); + const keyAt = i; + const key = parseString(); + if (seen.has(key)) fail(`duplicate key ${JSON.stringify(key)}`, keyAt); + seen.add(key); + const child = `${pointer}/${pointerToken(key)}`; + keys.set(child, keyAt); + skip(); + if (text[i] !== ":") fail(`expected ":" after key ${JSON.stringify(key)}, found ${describe3(i)}`); + i++; + Object.defineProperty(obj, key, { value: parseValue2(child), enumerable: true, writable: true, configurable: true }); + skip(); + if (text[i] === ",") { + i++; + skip(); + if (text[i] === "}") { + if (!options.jsonc) fail("trailing comma; only chant.workspace.jsonc allows one"); + i++; + return obj; + } + continue; } - toJSON() { - return REDACTED; + if (text[i] === "}") { + i++; + return obj; } - /** node:util.inspect (console.log) sees the redaction marker, not the vault. */ - [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() { - return REDACTED; + fail(`expected "," or "}", found ${describe3(i)}`); + } + } + function parseArray(pointer) { + const arr = []; + i++; + skip(); + if (text[i] === "]") { + i++; + return arr; + } + for (; ; ) { + arr.push(parseValue2(`${pointer}/${arr.length}`)); + skip(); + if (text[i] === ",") { + i++; + skip(); + if (text[i] === "]") { + if (!options.jsonc) fail("trailing comma; only chant.workspace.jsonc allows one"); + i++; + return arr; + } + continue; + } + if (text[i] === "]") { + i++; + return arr; + } + fail(`expected "," or "]", found ${describe3(i)}`); + } + } + try { + skip(); + if (i >= text.length) fail("the file is empty"); + const value = parseValue2(""); + skip(); + if (i < text.length) fail(`unexpected ${describe3(i)} after the value`); + return { + ok: true, + value, + locate(pointer, key) { + if (key && keys.has(pointer)) return toLocation(keys.get(pointer)); + for (let p = pointer; ; p = p.slice(0, p.lastIndexOf("/"))) { + const at = values.get(p); + if (at !== void 0) return toLocation(at); + if (p === "") return toLocation(0); + } } }; + } catch (err) { + if (!(err instanceof JsonSyntaxError)) throw err; + return { ok: false, message: err.message, location: toLocation(err.offset) }; } -}); - -// node_modules/@intentius/chant/src/intrinsic.ts -function isIntrinsic(value) { - return typeof value === "object" && value !== null && INTRINSIC_MARKER in value && value[INTRINSIC_MARKER] === true; } -var INTRINSIC_MARKER; -var init_intrinsic = __esm({ - "node_modules/@intentius/chant/src/intrinsic.ts"() { - INTRINSIC_MARKER = /* @__PURE__ */ Symbol.for("chant.intrinsic"); +var JsonSyntaxError; +var init_jsonc = __esm({ + "node_modules/@intentius/chant/src/workspace/jsonc.ts"() { + JsonSyntaxError = class extends Error { + constructor(message, offset) { + super(message); + this.offset = offset; + } + offset; + }; } }); -// node_modules/@intentius/chant/src/effect-receipt.ts -function isEffectReceipt(value) { - return typeof value === "object" && value !== null && EFFECT_RECEIPT_MARKER in value && value[EFFECT_RECEIPT_MARKER] === true; +// node_modules/@intentius/chant/src/workspace/declaration.ts +var declaration_exports = {}; +__export(declaration_exports, { + CHANT_PACKAGE: () => CHANT_PACKAGE, + DECLARATION_FILES: () => DECLARATION_FILES, + DECLARATION_SCHEMA_ID: () => DECLARATION_SCHEMA_ID, + DECLARATION_SCHEMA_VERSION: () => DECLARATION_SCHEMA_VERSION, + DEFAULT_STATE_ROOT: () => DEFAULT_STATE_ROOT, + DIAGRAM_TOOLS: () => DIAGRAM_TOOLS, + NAME_PATTERN: () => NAME_PATTERN, + RESERVED_NAMES: () => RESERVED_NAMES, + WORKSPACE_ERROR_CODES: () => WORKSPACE_ERROR_CODES, + WorkspaceReadError: () => WorkspaceReadError2, + boxServicesProblem: () => boxServicesProblem, + compareVersions: () => compareVersions, + declaredDiagrams: () => declaredDiagrams, + declaredRecordKinds: () => declaredRecordKinds, + findDeclarationDir: () => findDeclarationDir, + isInside: () => isInside, + ownerOf: () => ownerOf, + parseDeclaration: () => parseDeclaration, + pinnedChant: () => pinnedChant, + readDeclaration: () => readDeclaration, + readerVersion: () => readerVersion, + resolveGroups: () => resolveGroups, + rootExclusions: () => rootExclusions +}); +import { readFileSync as readFileSync5 } from "node:fs"; +import { createRequire as createRequire4 } from "node:module"; +import { fileURLToPath } from "node:url"; +function readerVersion() { + readerVersionCache ??= JSON.parse(readFileSync5(fileURLToPath(new URL("../../package.json", import.meta.url)), "utf-8")).version; + return readerVersionCache; +} +function compareVersions(a, b) { + const ma = SEMVER.exec(a); + const mb = SEMVER.exec(b); + if (!ma || !mb) throw new Error(`not a version: ${ma ? b : a}`); + for (let i = 1; i <= 3; i++) { + const d = Number(ma[i]) - Number(mb[i]); + if (d !== 0) return d; + } + if (ma[4] === mb[4]) return 0; + if (ma[4] === void 0) return 1; + if (mb[4] === void 0) return -1; + return ma[4] < mb[4] ? -1 : 1; +} +function validator() { + if (compiled) return compiled; + const require3 = createRequire4(import.meta.url); + const mod = require3("ajv/dist/2020"); + const Ajv = mod.default ?? mod; + compiled = new Ajv({ allErrors: true, strict: true }).compile(declaration_schema_default); + return compiled; +} +function explain(e, value) { + const def = /#\/\$defs\/([A-Za-z]+)\//.exec(e.schemaPath)?.[1]; + if (e.keyword === "pattern") { + const shown = JSON.stringify(value); + if (def === "name" && typeof value === "string" && RESERVED_NAMES.includes(value)) { + return `${shown} is reserved; pick another name`; + } + if (def === "name") return `${shown} is not a valid name: use lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters`; + if (def === "kindName") return `${shown} is not a valid kind or role name`; + if (def === "dir") return `${shown} is not a directory inside the workspace: use a relative path with / separators, and no . or .. segments`; + if (def === "path") return `${shown} is not a path inside the member or workspace: use a relative path with / separators, and no . or .. segments`; + if (def === "glob") return `${shown} is not a glob inside the workspace: use a relative pattern with / separators, and no . or .. segments`; + if (def === "version") return `${shown} is not a version such as 1.2.3`; + return `${shown} is not allowed here`; + } + if (e.keyword === "additionalProperties") { + return `unknown field ${JSON.stringify(e.params.additionalProperty)}; only fields named x-... may be added`; + } + if (e.keyword === "required") { + const missing = String(e.params.missingProperty); + if (missing === "because" && e.instancePath.endsWith("/handWritten")) return `a hand-written generated file needs "because", saying why it is kept by hand`; + if (missing === "because") return `a member of kind other needs "because", saying why it is there`; + return `missing required field ${JSON.stringify(missing)}`; + } + if (e.keyword === "const" && e.instancePath === "/schema") return `schema must be 1, the only declaration format this chant reads`; + return e.message ?? "is invalid"; +} +function valueAt(root, pointer) { + let v = root; + for (const token of pointer.split("/").slice(1)) { + const key = token.replace(/~1/g, "/").replace(/~0/g, "~"); + if (v === null || typeof v !== "object") return void 0; + v = v[key]; + } + return v; +} +function pinnedChant(obj) { + if (!Array.isArray(obj.pins)) return void 0; + const index = obj.pins.findIndex( + (p) => p !== null && typeof p === "object" && p.package === CHANT_PACKAGE && typeof p.version === "string" + ); + return index < 0 ? void 0 : { version: obj.pins[index].version, index }; +} +function parseDeclaration(text, file2, reader = readerVersion(), options = {}) { + const parsed = parseJsonText(text, { jsonc: file2.endsWith(".jsonc") }); + if (!parsed.ok) { + throw new WorkspaceReadError2("declaration-unparseable", parsed.message, { file: file2, ...parsed.location }); + } + const at = (pointer, key = false) => ({ file: file2, ...parsed.locate(pointer, key) }); + const raw = parsed.value; + if (raw === null || typeof raw !== "object" || Array.isArray(raw)) { + throw new WorkspaceReadError2("declaration-invalid", "the declaration must be a JSON object", at("")); + } + const obj = raw; + const pin = options.rootChant ? pinnedChant(obj) : void 0; + if (pin && pin.version !== reader) { + throw new WorkspaceReadError2( + "root-chant-required", + `this declaration pins ${CHANT_PACKAGE} ${pin.version}, and this is chant ${reader}; the root's chant reads it, so install ${CHANT_PACKAGE}@${pin.version} at the workspace root`, + at(`/pins/${pin.index}/version`) + ); + } + if (typeof obj.minReader === "string" && SEMVER.test(obj.minReader) && compareVersions(reader, obj.minReader) < 0) { + throw new WorkspaceReadError2( + "reader-too-old", + `this declaration needs chant ${obj.minReader} or newer to read it, and this is chant ${reader}`, + at("/minReader") + ); + } + const validate = validator(); + if (!validate(raw)) { + const errors = (validate.errors ?? []).filter((e) => !SUMMARY_KEYWORDS.has(e.keyword)); + errors.sort((a, b) => b.instancePath.split("/").length - a.instancePath.split("/").length); + const first = errors[0] ?? validate.errors[0]; + const isKey = first.keyword === "additionalProperties"; + const pointer = isKey ? `${first.instancePath}/${pointerToken(String(first.params.additionalProperty))}` : first.instancePath; + const where = first.instancePath === "" ? "" : ` (at ${first.instancePath})`; + const more = errors.length > 1 ? `; ${errors.length - 1} more problem${errors.length > 2 ? "s" : ""} after this one` : ""; + throw new WorkspaceReadError2("declaration-invalid", `${explain(first, valueAt(raw, first.instancePath))}${where}${more}`, at(pointer, isKey)); + } + const entries = obj.members.map((e, i) => { + const pointer = `/members/${i}`; + const suppress = (e.suppress ?? []).map((x) => ({ check: x.check, because: x.because })); + if (e.kind === EXAMPLES_KIND) { + const glob = e.glob; + return { + type: "group", + name: e.name, + kind: EXAMPLES_KIND, + globs: typeof glob === "string" ? [glob] : [...glob], + suppress, + pointer, + globLocation: parsed.locate(`${pointer}/glob`) + }; + } + const roles = (e.roles ?? []).map( + (r) => typeof r === "string" ? { name: r, path: null } : { name: r.name, path: r.path ?? null } + ); + const generated = (e.generated ?? []).map((g, j) => ({ + path: g.path, + generator: g.generator, + sources: [...g.sources ?? []], + handWritten: g.handWritten ? { because: g.handWritten.because } : null, + pointer: `${pointer}/generated/${j}` + })); + const links = (e.links ?? []).map((l, j) => ({ + member: l.member, + output: l.output, + kind: l.kind ?? null, + pointer: `${pointer}/links/${j}` + })); + const records = recordKindsOf(e.records, e.dir, e.name, `${pointer}/records`); + const diagrams = diagramsOf(e.diagrams, e.name, `${pointer}/diagrams`); + const box = boxOf(e.box, `${pointer}/box`); + return { + type: "member", + name: e.name, + dir: e.dir, + kind: e.kind, + roles, + generated, + outputs: e.outputs === void 0 ? null : [...e.outputs], + links, + records, + diagrams, + box, + upstream: e.upstream ?? null, + because: e.because ?? null, + suppress, + pointer + }; + }); + const names = /* @__PURE__ */ new Map(); + for (const e of entries) { + const first = names.get(e.name); + if (first) { + throw new WorkspaceReadError2( + "declaration-invalid", + `the name ${JSON.stringify(e.name)} is already used by the entry at ${first.pointer}`, + at(`${e.pointer}/name`) + ); + } + names.set(e.name, e); + } + const members = entries.filter((e) => e.type === "member"); + const byDir = /* @__PURE__ */ new Map(); + for (const m of members) { + const other = byDir.get(m.dir); + if (other) { + throw new WorkspaceReadError2( + "placement-invalid", + `member ${m.name} has the same directory as member ${other.name} (${m.dir})`, + at(`${m.pointer}/dir`) + ); + } + byDir.set(m.dir, m); + } + for (const m of members) { + const outer = members.find((o) => o !== m && o.dir !== "." && isInside(m.dir, o.dir)); + if (outer) { + throw new WorkspaceReadError2( + "placement-invalid", + `member ${m.name} (${m.dir}) sits inside member ${outer.name} (${outer.dir}); only the root member "." may contain other members`, + at(`${m.pointer}/dir`) + ); + } + } + for (const m of members) { + const seen = /* @__PURE__ */ new Map(); + for (const g of m.generated) { + const first = seen.get(g.path); + if (first) { + throw new WorkspaceReadError2("declaration-invalid", `member ${m.name} lists the generated file ${g.path} twice; the first is at ${first.pointer}`, at(`${g.pointer}/path`)); + } + seen.set(g.path, g); + const full = m.dir === "." ? g.path : `${m.dir}/${g.path}`; + const inner2 = members.find((o) => o !== m && o.dir !== "." && isInside(o.dir, m.dir) && isInside(full, o.dir)); + if (inner2) { + throw new WorkspaceReadError2( + "placement-invalid", + `member ${m.name} lists the generated file ${g.path}, which sits inside member ${inner2.name} (${inner2.dir}); list it there`, + at(`${g.pointer}/path`) + ); + } + } + } + const ownRecords = recordKindsOf(obj.records, ".", null, "/records"); + const byPath = /* @__PURE__ */ new Map(); + const byName = /* @__PURE__ */ new Map(); + for (const r of [...ownRecords, ...members.flatMap((m) => m.records)]) { + const first = byPath.get(r.path); + if (first) throw new WorkspaceReadError2("declaration-invalid", `the record kind ${r.path} is already declared at ${first.pointer}`, at(`${r.pointer}/kind`)); + byPath.set(r.path, r); + if (r.name === null) continue; + const named = byName.get(r.name); + if (named) throw new WorkspaceReadError2("declaration-invalid", `the record kind name ${JSON.stringify(r.name)} is already given at ${named.pointer}`, at(`${r.pointer}/name`)); + byName.set(r.name, r); + } + for (const m of members) { + const seen = /* @__PURE__ */ new Map(); + for (const c of m.box?.capabilities ?? []) { + const first = seen.get(c.name); + if (first) throw new WorkspaceReadError2("declaration-invalid", `member ${m.name}'s box lists the capability ${c.name} twice; the first is at ${first.pointer}`, at(`${c.pointer}/name`)); + seen.set(c.name, c); + } + const problem = m.box ? boxServicesProblem(m.name, m.box.services) : null; + if (problem) throw new WorkspaceReadError2("declaration-invalid", problem.message, at(problem.pointer)); + } + const ownDiagrams = diagramsOf(obj.diagrams, null, "/diagrams"); + const byDiagramName = /* @__PURE__ */ new Map(); + for (const d of [...ownDiagrams, ...members.flatMap((m) => m.diagrams)]) { + const first = byDiagramName.get(d.name); + if (first) { + throw new WorkspaceReadError2("declaration-invalid", `the diagram name ${JSON.stringify(d.name)} is already used by the diagram at ${first.pointer}`, at(`${d.pointer}/name`)); + } + byDiagramName.set(d.name, d); + } + const hosts = hostsOf(obj, members, at); + const pins = (obj.pins ?? []).map((p) => ({ + package: p.package ?? null, + version: p.version ?? null, + path: p.path ?? null, + integrity: p.integrity ?? null + })); + return { + name: obj.name, + schema: obj.schema, + minReader: obj.minReader ?? null, + entries, + members, + groups: entries.filter((e) => e.type === "group"), + pins, + checks: { ...obj.checks ?? {} }, + quorum: typeof obj.quorum === "number" ? obj.quorum : null, + records: ownRecords, + diagrams: ownDiagrams, + hosts, + changes: changesOf(obj.changes), + file: file2 + }; } -function splitReceiptEntities(entities) { - const applyBound = /* @__PURE__ */ new Map(); - const receipts = /* @__PURE__ */ new Map(); - for (const [name, entity] of entities) { - if (isEffectReceipt(entity)) receipts.set(name, entity); - else applyBound.set(name, entity); +function changesOf(block2) { + if (block2 === void 0) return null; + return { severity: block2.severity ?? "warn", ignore: [...block2.ignore ?? []] }; +} +function recordKindsOf(raw, dir, member, pointer) { + return (raw ?? []).map((r, i) => ({ + kind: r.kind, + path: dir === "." ? r.kind : `${dir}/${r.kind}`, + name: r.name ?? null, + member, + pointer: `${pointer}/${i}` + })); +} +function diagramsOf(raw, member, pointer) { + return (raw ?? []).map((d, i) => ({ + name: d.name, + title: d.title, + source: d.source ?? null, + render: d.render ?? null, + renderer: { tool: d.renderer.tool, version: d.renderer.version, args: [...d.renderer.args ?? []] }, + sourceHash: d.sourceHash ?? null, + member, + pointer: `${pointer}/${i}` + })); +} +function boxOf(raw, pointer) { + if (raw === void 0) return null; + const b = raw; + return { + capabilities: (b.capabilities ?? []).map((c, i) => ({ name: c.name, broker: c.broker ?? null, scope: [...c.scope ?? []], pointer: `${pointer}/capabilities/${i}` })), + // The schema requires host and slot together, and host for ports, state and cookies. + isolation: b.host === void 0 ? null : { host: b.host, slot: b.slot, ports: { ...b.ports ?? {} }, state: { ...b.state ?? {} }, cookies: [...b.cookies ?? []] }, + intent: b.intent ?? null, + services: (b.services ?? []).map((s, i) => ({ + name: s.name, + cmd: s.cmd, + needs: [...s.needs ?? []], + httpPort: s.httpPort ?? null, + duration: s.duration ?? null, + health: s.health ?? null, + optional: s.optional ?? false, + pointer: `${pointer}/services/${i}` + })), + pointer + }; +} +function boxServicesProblem(member, services) { + const byName = /* @__PURE__ */ new Map(); + for (const s of services) { + const first = byName.get(s.name); + if (first) return { message: `member ${member}'s box declares the service ${s.name} twice; the first is at ${first.pointer}`, pointer: `${s.pointer}/name` }; + byName.set(s.name, s); + } + let routed; + for (const s of services) { + if (s.httpPort === null) continue; + if (routed) { + return { + message: `member ${member}'s box gives both ${routed.name} (port ${routed.httpPort}) and ${s.name} (port ${s.httpPort}) an httpPort, and the supervisor routes the sprite's URL to one service`, + pointer: `${s.pointer}/httpPort` + }; + } + routed = s; } - return { applyBound, receipts }; + for (const s of services) { + const j = s.needs.findIndex((n) => !byName.has(n)); + if (j >= 0) { + const known = services.map((x) => x.name).join(", "); + return { message: `member ${member}'s box service ${s.name} needs ${JSON.stringify(s.needs[j])}, which the block does not declare; declared services: ${known}`, pointer: `${s.pointer}/needs/${j}` }; + } + } + const cycle = serviceCycle(services); + if (cycle) { + const s = byName.get(cycle[0]); + return { message: `member ${member}'s box services need each other in a cycle: ${cycle.join(" -> ")}`, pointer: `${s.pointer}/needs` }; + } + return null; } -var EFFECT_RECEIPT_MARKER; -var init_effect_receipt = __esm({ - "node_modules/@intentius/chant/src/effect-receipt.ts"() { - init_declarable(); - init_intrinsic(); - EFFECT_RECEIPT_MARKER = /* @__PURE__ */ Symbol.for("chant.effect-receipt"); +function serviceCycle(services) { + const byName = new Map(services.map((s) => [s.name, s])); + const state = /* @__PURE__ */ new Map(); + const visit = (name, trail) => { + const st = state.get(name); + if (st === "done") return null; + if (st === "visiting") return [...trail.slice(trail.indexOf(name)), name]; + state.set(name, "visiting"); + for (const dep of byName.get(name)?.needs ?? []) { + const found = visit(dep, [...trail, name]); + if (found) return found; + } + state.set(name, "done"); + return null; + }; + for (const s of services) { + const found = visit(s.name, []); + if (found) return found; } -}); - -// node_modules/@intentius/chant/src/build-params.ts -function buildParamValues(provenance) { - return Object.fromEntries(provenance.map((p) => [p.name, p.value])); + return null; } -var init_build_params = __esm({ - "node_modules/@intentius/chant/src/build-params.ts"() { +function hostsOf(obj, members, at) { + const hosts = (obj.hosts ?? []).map((h, i) => ({ + name: h.name, + ports: { ...h.ports }, + stateRoot: h.stateRoot ?? null, + pointer: `/hosts/${i}` + })); + const invalid = (message, pointer) => new WorkspaceReadError2("declaration-invalid", message, at(pointer)); + const byName = /* @__PURE__ */ new Map(); + for (const h of hosts) { + const first = byName.get(h.name); + if (first) throw invalid(`the host name ${JSON.stringify(h.name)} is already used by the host at ${first.pointer}`, `${h.pointer}/name`); + byName.set(h.name, h); + if (h.ports.from > h.ports.to) throw invalid(`host ${h.name}'s port range starts at ${h.ports.from}, after its end ${h.ports.to}`, `${h.pointer}/ports`); + } + for (const m of members) { + const iso = m.box?.isolation; + if (!iso) continue; + const box = m.box.pointer; + const host = byName.get(iso.host); + if (!host) { + const known = hosts.map((h) => h.name).join(", ") || "none are declared"; + throw invalid(`member ${m.name}'s box names the host ${JSON.stringify(iso.host)}, which hosts does not declare; declared hosts: ${known}`, `${box}/host`); + } + const { from, to, perBox } = host.ports; + const last = from + (iso.slot + 1) * perBox - 1; + if (last > to) { + const slots = Math.floor((to - from + 1) / perBox); + throw invalid( + `member ${m.name}'s box has slot ${iso.slot} on host ${host.name}, which needs ports ${from + iso.slot * perBox} to ${last}, past the end of the host's range (${to}); the range holds ${slots} slot${slots === 1 ? "" : "s"}`, + `${box}/slot` + ); + } + for (const [port, offset] of Object.entries(iso.ports)) { + if (offset >= perBox) { + throw invalid(`member ${m.name}'s box gives port ${port} offset ${offset}, and host ${host.name} gives each box ${perBox} port${perBox === 1 ? "" : "s"} (offsets 0 to ${perBox - 1})`, `${box}/ports/${pointerToken(port)}`); + } + } } -}); - -// node_modules/@intentius/chant/src/types.ts -var init_types = __esm({ - "node_modules/@intentius/chant/src/types.ts"() { + return hosts; +} +function declaredRecordKinds(declaration) { + return [...declaration.records, ...declaration.members.flatMap((m) => m.records)]; +} +function declaredDiagrams(declaration) { + return [...declaration.diagrams, ...declaration.members.flatMap((m) => m.diagrams)]; +} +function isInside(path, dir) { + if (dir === ".") return true; + return path === dir || path.startsWith(`${dir}/`); +} +function readDeclaration(tree, dir = "", options = {}) { + const present = DECLARATION_FILES.map((name) => joinPath(dir, name)).filter((p) => tree.stat(p) === "file"); + if (present.length === 0) { + throw new WorkspaceReadError2("declaration-missing", `no ${DECLARATION_FILES.join(" or ")} in ${dir || "the workspace root"}${tree.label}`); } -}); - -// node_modules/@intentius/chant/src/errors.ts -var errors_exports2 = {}; -__export(errors_exports2, { - BuildError: () => BuildError, - DiscoveryError: () => DiscoveryError, - LintError: () => LintError -}); -var DiscoveryError, BuildError, LintError; -var init_errors3 = __esm({ - "node_modules/@intentius/chant/src/errors.ts"() { - DiscoveryError = class extends Error { - file; - type; - constructor(file2, message, type) { - super(message); - this.name = "DiscoveryError"; - this.file = file2; - this.type = type; - } - toJSON() { - return { - name: this.name, - file: this.file, - message: this.message, - type: this.type - }; - } - }; - BuildError = class extends Error { - entityName; - constructor(entityName, message) { - super(message); - this.name = "BuildError"; - this.entityName = entityName; + if (present.length > 1) { + throw new WorkspaceReadError2( + "declaration-ambiguous", + `both ${present.join(" and ")} exist${tree.label}; keep one of them`, + { file: present[1], line: 1, column: 1 } + ); + } + return parseDeclaration(tree.read(present[0]), present[0], readerVersion(), options); +} +function findDeclarationDir(tree, start) { + for (let dir = start; ; dir = dir.includes("/") ? dir.slice(0, dir.lastIndexOf("/")) : "") { + if (DECLARATION_FILES.some((name) => tree.stat(joinPath(dir, name)) === "file")) return dir; + if (dir === "") return void 0; + } +} +function resolveGroups(declaration, tree) { + const at = (g) => ({ file: declaration.file, ...g.globLocation }); + const claimed = /* @__PURE__ */ new Map(); + const resolved = []; + for (const group of declaration.groups) { + const dirs = [...new Set(group.globs.flatMap((g) => expandGlob(tree, g)))].sort(); + const matches2 = []; + const skipped = []; + for (const dir of dirs) { + if (!holdsChantProject(tree, dir)) { + skipped.push(dir); + continue; } - toJSON() { - return { - name: this.name, - entityName: this.entityName, - message: this.message - }; + const clash = (message) => new WorkspaceReadError2("placement-invalid", `group ${group.name} matches ${dir}, ${message}`, at(group)); + for (const m of declaration.members) { + if (m.dir === ".") continue; + if (m.dir === dir) throw clash(`which is member ${m.name}'s directory; a match is never a member`); + if (isInside(m.dir, dir)) throw clash(`which contains member ${m.name} (${m.dir})`); + if (m.kind === "workspace" && isInside(dir, m.dir)) { + throw clash(`which sits inside the nested workspace ${m.name}; that workspace declares its own examples`); + } } - }; - LintError = class extends Error { - file; - line; - column; - ruleId; - constructor(file2, line, column, ruleId, message) { + const other = claimed.get(dir); + if (other) throw clash(`which group ${other.name} also matches`); + claimed.set(dir, group); + matches2.push(dir); + } + resolved.push({ group, matches: matches2, skipped }); + } + return resolved; +} +function ownerOf(declaration, groups, path) { + for (const g of groups) { + const match = g.matches.find((m) => isInside(path, m)); + if (match) return { group: g.group, match }; + } + let best; + for (const m of declaration.members) { + if (!isInside(path, m.dir)) continue; + if (!best || best.dir === "." || m.dir !== "." && m.dir.length > best.dir.length) best = m; + } + return best ? { member: best } : void 0; +} +function rootExclusions(declaration, groups) { + const out = []; + for (const m of declaration.members) if (m.dir !== ".") out.push({ dir: m.dir, owner: m.name }); + for (const g of groups) { + for (const dir of g.matches) { + if (declaration.members.some((m) => m.dir !== "." && isInside(dir, m.dir))) continue; + out.push({ dir, owner: g.group.name }); + } + } + return out.sort((a, b) => a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0); +} +var DECLARATION_SCHEMA_ID, DECLARATION_FILES, DECLARATION_SCHEMA_VERSION, RESERVED_NAMES, NAME_PATTERN, WORKSPACE_ERROR_CODES, WorkspaceReadError2, DIAGRAM_TOOLS, DEFAULT_STATE_ROOT, CHANT_PACKAGE, readerVersionCache, SEMVER, compiled, SUMMARY_KEYWORDS; +var init_declaration = __esm({ + "node_modules/@intentius/chant/src/workspace/declaration.ts"() { + init_declaration_schema(); + init_glob(); + init_kinds(); + init_jsonc(); + init_tree(); + DECLARATION_SCHEMA_ID = declaration_schema_default.$id; + DECLARATION_FILES = ["chant.workspace.json", "chant.workspace.jsonc"]; + DECLARATION_SCHEMA_VERSION = 1; + RESERVED_NAMES = ["_workspace", "_members"]; + NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,39}$/; + WORKSPACE_ERROR_CODES = [ + /** No chant.workspace.json or .jsonc between the directory and the git root. */ + "declaration-missing", + /** Both chant.workspace.json and chant.workspace.jsonc are present. */ + "declaration-ambiguous", + /** The file is not valid JSON (or JSONC, for .jsonc). */ + "declaration-unparseable", + /** The file does not match the declaration schema, or repeats a name. */ + "declaration-invalid", + /** A member or group match breaks a placement rule (#2524 D2, ws-051). */ + "placement-invalid", + /** The declaration's minReader is newer than this chant. */ + "reader-too-old", + /** The declaration pins another chant, which is not installed at the root (#2524 D15, ws-021). */ + "root-chant-required", + /** `--at` was given outside a git repository. */ + "not-a-git-repository", + /** `--at` names no commit. */ + "revision-unknown" + ]; + WorkspaceReadError2 = class extends Error { + constructor(code, message, location) { super(message); - this.name = "LintError"; - this.file = file2; - this.line = line; - this.column = column; - this.ruleId = ruleId; + this.code = code; + this.location = location; + this.name = "WorkspaceReadError"; } - toJSON() { - return { - name: this.name, - file: this.file, - line: this.line, - column: this.column, - ruleId: this.ruleId, - message: this.message - }; + code; + location; + /** `file:line:column: message`, or the message alone. */ + describe() { + const l = this.location; + return l ? `${l.file}:${l.line}:${l.column}: ${this.message}` : this.message; } }; + DIAGRAM_TOOLS = ["d2", "mermaid", "graphviz", "excalidraw"]; + DEFAULT_STATE_ROOT = "${XDG_STATE_HOME}/chant/boxes"; + CHANT_PACKAGE = "@intentius/chant"; + SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/; + SUMMARY_KEYWORDS = /* @__PURE__ */ new Set(["if", "then", "else", "oneOf", "anyOf"]); } }); -// node_modules/@intentius/chant/src/attrref.ts -var AttrRef; -var init_attrref = __esm({ - "node_modules/@intentius/chant/src/attrref.ts"() { - init_intrinsic(); - AttrRef = class { - [INTRINSIC_MARKER] = true; - parent; - attribute; - logicalName; - constructor(parent, attribute) { - this.parent = new WeakRef(parent); - this.attribute = attribute; - } - /** - * Set the logical name for this attribute reference - * @internal - */ - _setLogicalName(name) { - this.logicalName = name; - } - /** - * Get the logical name assigned to this attribute reference. - */ - getLogicalName() { - return this.logicalName; - } - /** - * Refuse to become a string (#2349). - * - * An `AttrRef` stands for a value the build resolves later, so it has no - * string form here. Without this, `` `${bucket.arn}-suffix` `` produced - * `"[object Object]-suffix"` and shipped it — and the fold path produced - * exactly the same wrong string from the `{__attrRef}` envelope, so the two - * paths agreed and the differential harness reported nothing. Agreement on a - * wrong value is the failure this class of check exists to catch, which is - * why this throws rather than returning something more helpful-looking. - * - * `toJSON` below is the honest serialization and is untouched: a serializer - * that wants the envelope asks for it by name. - */ - toString() { - const where = this.logicalName ? `${this.logicalName}.${this.attribute}` : `.${this.attribute}`; - throw new Error( - `A resource attribute reference (${where}) has no string form: it stands for a value the build resolves later, and interpolating it into a plain template literal would produce "[object Object]". Use the lexicon's own intrinsic, whose interior handles references \u2014 \`Sub\`\${\u2026}\`\` for CloudFormation \u2014 or move the reference out of the template.` - ); - } - /** - * The same refusal for `+` and for anything else that coerces, so - * `"prefix" + bucket.arn` fails where `` `${bucket.arn}` `` fails rather - * than taking a different path to the same wrong string. - */ - [Symbol.toPrimitive]() { - return this.toString(); +// node_modules/@intentius/chant/src/discovery/walk.ts +import { execFileSync as execFileSync2 } from "node:child_process"; +import { closeSync, existsSync as existsSync5, openSync, readdirSync as readdirSync2, readSync, statSync as statSync3 } from "node:fs"; +import { isAbsolute as isAbsolute2, join as join9, relative as relative2, resolve as resolve4, sep as sep2 } from "node:path"; +function partsBelow(home, full) { + const rel = relative2(home, resolve4(full)); + if (rel === "" || rel === ".." || rel.startsWith(`..${sep2}`) || isAbsolute2(rel)) return void 0; + return rel.split(sep2); +} +function compileGlobs(globs) { + if (!globs || globs.exclude.length === 0 && globs.include.length === 0) return void 0; + const home = resolve4(globs.root); + const matcher = (patterns) => { + if (patterns.length === 0) return () => false; + const match = (0, import_picomatch2.default)(patterns, { dot: true }); + return (full) => { + const parts = partsBelow(home, full); + return parts !== void 0 && parts.some((_, i) => match(parts.slice(0, i + 1).join("/"))); + }; + }; + const bases = globs.include.map((p) => import_picomatch2.default.scan(p).base).filter((b) => b !== ""); + return { + excluded: matcher(globs.exclude), + included: matcher(globs.include), + includeBelow: (full) => { + const parts = partsBelow(home, full); + if (parts === void 0) return false; + const rel = parts.join("/"); + return bases.some((b) => b.startsWith(`${rel}/`)); + } + }; +} +function gitIgnoredBelow(root) { + let out; + try { + out = execFileSync2("git", ["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"], { + cwd: root, + encoding: "utf-8", + stdio: ["ignore", "pipe", "ignore"], + maxBuffer: 256 * 1024 * 1024 + }); + } catch { + return /* @__PURE__ */ new Set(); + } + const ignored = /* @__PURE__ */ new Set(); + const abs = resolve4(root); + for (const entry of out.split("\0")) { + if (entry === "") continue; + const rel = entry.endsWith("/") ? entry.slice(0, -1) : entry; + if (rel === "." || rel === "") return /* @__PURE__ */ new Set(); + ignored.add(join9(abs, rel)); + } + return ignored; +} +function isProjectBoundary(dir) { + if (existsSync5(join9(dir, "chant.config.ts"))) return true; + const json2 = join9(dir, "chant.config.json"); + return existsSync5(json2) && !isLintOnlyFragment(json2); +} +function childProjectsAreBoundaries(walker, root) { + return walker === "ops" || findProjectConfig(root).configPath !== void 0; +} +async function workspaceMemberDirs(root) { + const found = findWorkspaceRoot(root); + if (!found) return []; + const start = resolve4(root); + const [{ readDeclaration: readDeclaration2, resolveGroups: resolveGroups2, rootExclusions: rootExclusions2 }, { workingTree: workingTree2 }] = await Promise.all([ + Promise.resolve().then(() => (init_declaration(), declaration_exports)), + Promise.resolve().then(() => (init_tree(), tree_exports)) + ]); + let dirs; + try { + const tree = workingTree2(found.dir); + const declaration = readDeclaration2(tree); + dirs = rootExclusions2(declaration, resolveGroups2(declaration, tree)).map((e) => resolve4(found.dir, e.dir)); + } catch { + return []; + } + return dirs.filter((d) => partsBelow(start, d) !== void 0); +} +function readHead(file2, bytes) { + let fd; + try { + fd = openSync(file2, "r"); + const buf = Buffer.alloc(bytes); + const n = readSync(fd, buf, 0, bytes, 0); + return buf.toString("utf8", 0, n); + } catch { + return ""; + } finally { + if (fd !== void 0) closeSync(fd); + } +} +function walkDiscovery(opts) { + const out = []; + const globs = compileGlobs(opts.globs); + const ignored = gitIgnoredBelow(opts.root); + const boundaries = childProjectsAreBoundaries(opts.walker, opts.root); + const excludeDirs = new Set((opts.excludeDirs ?? []).map((d) => resolve4(d))); + const dotDirsKept = opts.walker === "audit" ? AUDIT_DOT_DIRS : /* @__PURE__ */ new Set(); + const limit = opts.limit; + const isIgnored = (full) => ignored.size > 0 && ignored.has(resolve4(full)); + const take = (full) => { + if (limit && out.length >= limit.max) { + limit.truncated = true; + return false; + } + out.push(full); + return true; + }; + const kind = (dir, e) => { + if (e.isDirectory()) return "dir"; + if (e.isFile()) return "file"; + if (opts.followSymlinks && e.isSymbolicLink()) { + try { + const s = statSync3(join9(dir, e.name)); + return s.isDirectory() ? "dir" : s.isFile() ? "file" : void 0; + } catch { + return void 0; } - /** - * Serialize to a generic envelope. Lexicon-specific serializers should - * read `getLogicalName()` and `attribute` directly instead of relying - * on this format. - * @throws {Error} If logical name has not been set - */ - toJSON() { - if (!this.logicalName) { - throw new Error( - `Cannot serialize AttrRef for attribute "${this.attribute}": logical name not set` - ); + } + return void 0; + }; + const walk = (dir, probing) => { + let entries; + try { + entries = readdirSync2(dir, { withFileTypes: true }); + } catch { + return true; + } + if (opts.sorted) entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0); + for (const e of entries) { + if (limit?.truncated) return false; + const full = join9(dir, e.name); + const type = kind(dir, e); + if (type === "dir") { + if (NEVER_ENTER.has(e.name) || excludeDirs.has(resolve4(full))) continue; + const dotSkip = e.name.startsWith(".") && !dotDirsKept.has(e.name); + if (dotSkip && opts.takeSkippedDir?.(e.name, full)) { + if (!take(full)) return false; + continue; } - return { - __attrRef: { entity: this.logicalName, attribute: this.attribute } - }; + const ruleSkip = dotSkip || e.name === "dist" || isIgnored(full) && !opts.keepIgnored?.(full) || boundaries && isProjectBoundary(full); + if (ruleSkip || probing) { + if (globs?.included(full)) { + if (!walk(full, false)) return false; + } else if (globs?.includeBelow(full)) { + if (!walk(full, true)) return false; + } + continue; + } + if (!walk(full, false)) return false; + } else if (type === "file") { + const skipped = probing || isIgnored(full) && !opts.keepIgnored?.(full) || (globs?.excluded(full) ?? false); + if (skipped && !globs?.included(full)) continue; + if (!opts.accept(e.name, full)) continue; + if (!take(full)) return false; } - }; + } + return true; + }; + walk(opts.root, false); + return out; +} +var import_picomatch2, AUDIT_DOT_DIRS, NEVER_ENTER; +var init_walk = __esm({ + "node_modules/@intentius/chant/src/discovery/walk.ts"() { + import_picomatch2 = __toESM(require_picomatch2(), 1); + init_project_root(); + init_config(); + AUDIT_DOT_DIRS = /* @__PURE__ */ new Set([".github", ".forgejo"]); + NEVER_ENTER = /* @__PURE__ */ new Set(["node_modules", ".git"]); } }); -// node_modules/@intentius/chant/src/utils.ts -function isAttrRefLike(value) { - if (value instanceof AttrRef) return true; - return typeof value === "object" && value !== null && "parent" in value && "attribute" in value && "_setLogicalName" in value && typeof value.parent === "object" && typeof value.attribute === "string"; +// node_modules/@intentius/chant/src/audit/terraform-state.ts +function isTerraformStateFile(path) { + const name = path.split("/").pop() ?? path; + return /\.tfstate(\.backup)?$/i.test(name); } -function getAttributes(entity) { - const attributes = []; - const obj = entity; - for (const key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - const value = obj[key]; - if (isAttrRefLike(value)) { - attributes.push(key); - } - } - } - return attributes; -} -var LOGICAL_NAME_SYMBOL; -var init_utils = __esm({ - "node_modules/@intentius/chant/src/utils.ts"() { - init_attrref(); - LOGICAL_NAME_SYMBOL = /* @__PURE__ */ Symbol.for("chant.logicalName"); - } -}); - -// node_modules/@intentius/chant/src/builder.ts -var init_builder = __esm({ - "node_modules/@intentius/chant/src/builder.ts"() { - } -}); - -// node_modules/@intentius/chant/src/serializer.ts -var init_serializer = __esm({ - "node_modules/@intentius/chant/src/serializer.ts"() { - } -}); - -// node_modules/@intentius/chant/src/lexicon-output.ts -function sanitizeLogicalId(...parts) { - const segments = parts.join("_").split(/[^A-Za-z0-9]+/).filter((segment) => segment.length > 0); - if (segments.length === 0) return "Output"; - return segments.map((segment, i) => i === 0 ? segment : segment.charAt(0).toUpperCase() + segment.slice(1)).join(""); -} -function isLexiconOutput(value) { - return typeof value === "object" && value !== null && LEXICON_OUTPUT_MARKER in value && value[LEXICON_OUTPUT_MARKER] === true; -} -var LEXICON_OUTPUT_MARKER, LexiconOutput; -var init_lexicon_output = __esm({ - "node_modules/@intentius/chant/src/lexicon-output.ts"() { - init_intrinsic(); - init_utils(); - LEXICON_OUTPUT_MARKER = /* @__PURE__ */ Symbol.for("chant.lexiconOutput"); - LexiconOutput = class _LexiconOutput { - [INTRINSIC_MARKER] = true; - /** @internal Brand marker — see {@link LEXICON_OUTPUT_MARKER}. Declared - * here only for type purposes; the real, non-enumerable property is - * installed by the constructor. */ - [LEXICON_OUTPUT_MARKER]; - sourceLexicon; - sourceEntity; - sourceAttribute; - outputName; - /** @internal WeakRef to the source entity object for identity-based matching */ - _sourceParent; - /** - * @internal Intrinsic value when constructed from an Intrinsic rather than AttrRef. - * Readable outside the class (like `_sourceParent` above) so the entity-wire - * encoder can reach it without an `as unknown as` cast that would erase type - * checking on every field it reads (#1047). - */ - _intrinsic; - /** - * @internal The already-resolved literal (string/number/boolean) when - * constructed from neither an AttrRef nor an Intrinsic — non-null exactly - * when `_intrinsic` is null AND `sourceAttribute` is null. There is no - * source entity or attribute to reference, so `getOutputValue()` returns - * this value verbatim rather than fabricating a `Fn::GetAtt` out of an - * unset attribute (chant #1121). Readable outside the class for the same - * reason as `_intrinsic`/`_sourceParent` above. - */ - _literalValue; - constructor(ref, name) { - Object.defineProperty(this, LEXICON_OUTPUT_MARKER, { - value: true, - enumerable: false - }); - if (isAttrRefLike(ref)) { - const parent = ref.parent.deref(); - if (!parent) { - throw new Error("Cannot create LexiconOutput: parent entity has been garbage collected"); - } - if (!("lexicon" in parent) || typeof parent.lexicon !== "string") { - throw new Error("Cannot create LexiconOutput: parent entity has no lexicon field"); - } - this.sourceLexicon = parent.lexicon; - this.sourceEntity = ""; - this.sourceAttribute = ref.attribute; - this.outputName = name; - this._sourceParent = ref.parent; - this._intrinsic = null; - this._literalValue = null; - } else if (isIntrinsic(ref)) { - this.sourceLexicon = ""; - this.sourceEntity = ""; - this.sourceAttribute = null; - this.outputName = name; - this._sourceParent = null; - this._intrinsic = ref; - this._literalValue = null; - } else if (typeof ref === "string" || typeof ref === "number" || typeof ref === "boolean") { - this.sourceLexicon = ""; - this.sourceEntity = ""; - this.sourceAttribute = null; - this.outputName = name; - this._sourceParent = null; - this._intrinsic = null; - this._literalValue = ref; - } else { - throw new Error( - `output(ref, "${name}"): ref must be an AttrRef, an Intrinsic, or an already-resolved string/number/boolean \u2014 got ${ref === null ? "null" : typeof ref} instead. If this came from a resource member access (e.g. "resource.SomeField"), that member is neither a generated attribute nor a real value here \u2014 check for a typo or a property that CloudFormation does not expose via Fn::GetAtt.` - ); - } - } - /** - * Set the source entity logical name. - * Called during build when entity names are resolved. - * @internal - */ - _setSourceEntity(name) { - this.sourceEntity = name; - } - /** - * Returns the CloudFormation Output Value for this output. - * For a literal output: the resolved value itself, verbatim. - * For AttrRef-based outputs: emits Fn::GetAtt. - * For Intrinsic-based outputs: delegates to the intrinsic's toJSON(). - */ - getOutputValue() { - if (this._literalValue !== null) { - return this._literalValue; - } - if (this._intrinsic) { - return this._intrinsic.toJSON(); - } - return { "Fn::GetAtt": [this.sourceEntity, this.sourceAttribute] }; - } - /** - * Create a LexiconOutput with an auto-generated name from entity name and attribute. - * Used during cross-lexicon ref auto-detection. - * - * The name is sanitized to a valid CloudFormation logical id (see - * {@link sanitizeLogicalId}) since it is used verbatim as the `Outputs` - * key by lexicon serializers (e.g. AWS CloudFormation), which reject - * dots or underscores in logical ids. - * - * @param ref - The AttrRef pointing to the source entity - * @param entityName - The logical name of the source entity - * @returns A LexiconOutput with a name derived from `{entityName}{Attribute}` - */ - static auto(ref, entityName) { - const name = sanitizeLogicalId(entityName, ref.attribute); - const output = new _LexiconOutput(ref, name); - output._setSourceEntity(entityName); - return output; - } - toJSON() { - return { "chant::output": this.outputName }; - } - }; - } -}); - -// node_modules/@intentius/chant/src/discovery/files.ts -import { readdir, open } from "node:fs/promises"; -import { existsSync as existsSync4 } from "node:fs"; -import { join as join6 } from "node:path"; -async function isGeneratedFile(file2) { - let fh; - try { - fh = await open(file2, "r"); - const { buffer, bytesRead } = await fh.read({ buffer: Buffer.alloc(256), position: 0 }); - return buffer.toString("utf8", 0, bytesRead).includes(GENERATED_MARKER); - } catch { - return false; - } finally { - await fh?.close(); - } -} -async function findInfraFiles(path) { - const files = []; - let sourceRoot = null; - async function scanDirectory(dir) { - let entries; - try { - entries = await readdir(dir, { withFileTypes: true }); - } catch (error51) { - return; - } - for (const entry of entries) { - const fullPath = join6(dir, entry.name); - if (entry.isDirectory() && entry.name === "node_modules") { - continue; - } - if (entry.isDirectory()) { - const configPath = join6(fullPath, "chant.config.ts"); - if (existsSync4(configPath)) { - if (sourceRoot === null) { - sourceRoot = fullPath; - } else { - continue; - } - } - await scanDirectory(fullPath); - } else if (entry.isFile()) { - if (entry.name.endsWith(".ts") && !entry.name.endsWith(".test.ts") && !entry.name.endsWith(".spec.ts") && !await isGeneratedFile(fullPath)) { - files.push(fullPath); - } - } - } - } - await scanDirectory(path); - return files; -} -var GENERATED_MARKER; -var init_files = __esm({ - "node_modules/@intentius/chant/src/discovery/files.ts"() { - GENERATED_MARKER = "Generated by chant \u2014 do not edit directly"; - } -}); - -// node_modules/@intentius/chant/src/discovery/import.ts -async function importModule(path) { - const failed = evaluationFailures.get(path); - if (failed) throw failed; - try { - return await import(path); - } catch (error51) { - const message = error51 instanceof Error ? error51.message : "Unknown import error"; - const discoveryError = new DiscoveryError(path, message, "import"); - evaluationFailures.set(path, discoveryError); - throw discoveryError; - } -} -var evaluationFailures; -var init_import = __esm({ - "node_modules/@intentius/chant/src/discovery/import.ts"() { - init_errors3(); - evaluationFailures = /* @__PURE__ */ new Map(); - } -}); - -// node_modules/@intentius/chant/src/discovery/collect.ts -import { basename, dirname as dirname7, relative as relative2, resolve as resolve3 } from "node:path"; -function exportKey(rawName, file2) { - if (rawName !== "default") return rawName; - return basename(file2).replace(/\.ts$/, "").replace(/\.op$/, ""); -} -function stackPrefix(file2, buildRoot) { - const dir = dirname7(file2); - const rel = buildRoot ? relative2(resolve3(buildRoot), resolve3(dir)) : dir; - const segments = rel.split(/[^A-Za-z0-9]+/).filter((s) => s.length > 0); - return segments.map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(""); -} -function enumerateEntries(modules) { - const entries = []; - for (const { file: file2, exports } of modules) { - const sortedExports = Object.entries(exports).sort(([a], [b]) => a.localeCompare(b)); - for (const [rawName, value] of sortedExports) { - const name = exportKey(rawName, file2); - if (isDeclarable(value)) { - entries.push({ bareKey: name, value, file: file2, provenance: { sourceFile: file2, paths: AUTHORED_ROOT } }); - } else if (Array.isArray(value)) { - for (let i = 0; i < value.length; i++) { - const item = value[i]; - if (isDeclarable(item)) { - entries.push({ bareKey: `${name}_${i}`, value: item, file: file2, provenance: { sourceFile: file2, paths: AUTHORED_ROOT } }); - } else if (isCompositeInstance(item)) { - const indexedName = `${name}_${i}`; - for (const [expandedName, entity] of expandComposite(indexedName, item)) { - entries.push({ - bareKey: expandedName, - value: entity, - file: file2, - provenance: { sourceFile: file2, compositeInstance: indexedName } - }); - } - } - } - } else if (isCompositeInstance(value)) { - for (const [expandedName, entity] of expandComposite(name, value)) { - entries.push({ - bareKey: expandedName, - value: entity, - file: file2, - provenance: { sourceFile: file2, compositeInstance: name } - }); - } - } else if (isLexiconOutput(value)) { - entries.push({ bareKey: name, value, file: file2, provenance: { sourceFile: file2 } }); - } - } - } - return entries; -} -function collectEntities(modules, buildRoot) { - const entries = enumerateEntries(modules); - const dirsByKey = /* @__PURE__ */ new Map(); - for (const { bareKey, value, file: file2 } of entries) { - const dir = dirname7(file2); - let byDir = dirsByKey.get(bareKey); - if (!byDir) { - byDir = /* @__PURE__ */ new Map(); - dirsByKey.set(bareKey, byDir); - } - let objs = byDir.get(dir); - if (!objs) { - objs = /* @__PURE__ */ new Set(); - byDir.set(dir, objs); - } - objs.add(value); - } - const crossDirKeys = /* @__PURE__ */ new Set(); - for (const [bareKey, byDir] of dirsByKey) { - const dirsWithObjects = [...byDir.values()].filter((objs) => objs.size > 0).length; - const distinctObjects = /* @__PURE__ */ new Set(); - for (const objs of byDir.values()) for (const o of objs) distinctObjects.add(o); - if (dirsWithObjects > 1 && distinctObjects.size > 1) crossDirKeys.add(bareKey); - } - const entities = /* @__PURE__ */ new Map(); - const claimedByDir = /* @__PURE__ */ new Map(); - for (const { bareKey, value, file: file2, provenance } of entries) { - const dir = dirname7(file2); - let perDir = claimedByDir.get(bareKey); - if (!perDir) { - perDir = /* @__PURE__ */ new Map(); - claimedByDir.set(bareKey, perDir); - } - const claimed = perDir.get(dir); - if (claimed !== void 0 && claimed !== value) { - throw new DiscoveryError(file2, `Duplicate export name "${bareKey}" found`, "resolution"); - } - perDir.set(dir, value); - const key = crossDirKeys.has(bareKey) ? `${stackPrefix(file2, buildRoot)}${bareKey}` : bareKey; - const existing = entities.get(key); - if (existing !== void 0) { - if (existing !== value) { - throw new DiscoveryError(file2, `Duplicate export name "${bareKey}" found`, "resolution"); - } - continue; - } - setProvenance(value, provenance); - entities.set(key, value); - } - return entities; -} -var AUTHORED_ROOT; -var init_collect = __esm({ - "node_modules/@intentius/chant/src/discovery/collect.ts"() { - init_declarable(); - init_composite(); - init_lexicon_output(); - init_errors3(); - init_provenance(); - AUTHORED_ROOT = { "": { kind: "authored" } }; - } -}); - -// node_modules/@intentius/chant/src/discovery/cycles.ts -function normalizeGraph(graph) { - if (graph instanceof Map) return graph; - const result = /* @__PURE__ */ new Map(); - for (const [node, neighbors] of Object.entries(graph)) { - result.set(node, new Set(neighbors)); - } - return result; -} -function detectCycles(graph) { - const g = normalizeGraph(graph); - const WHITE = 0; - const GRAY = 1; - const BLACK = 2; - const color = /* @__PURE__ */ new Map(); - const parent = /* @__PURE__ */ new Map(); - const cycles = []; - const reportedCycles = /* @__PURE__ */ new Set(); - for (const node of g.keys()) { - color.set(node, WHITE); - } - function dfs(node) { - color.set(node, GRAY); - const neighbors = g.get(node) ?? /* @__PURE__ */ new Set(); - for (const neighbor of neighbors) { - const c = color.get(neighbor); - if (c === void 0 || c === WHITE) { - if (c === void 0) { - continue; - } - parent.set(neighbor, node); - dfs(neighbor); - } else if (c === GRAY) { - const cycle = [neighbor]; - let current = node; - while (current !== neighbor) { - cycle.push(current); - current = parent.get(current); - } - cycle.push(neighbor); - cycle.reverse(); - const key = normalizeCycleKey(cycle); - if (!reportedCycles.has(key)) { - reportedCycles.add(key); - cycles.push(cycle.slice(0, -1)); - } - } - } - color.set(node, BLACK); - } - for (const node of g.keys()) { - if (color.get(node) === WHITE) { - dfs(node); - } - } - return cycles; -} -function normalizeCycleKey(cycle) { - const nodes = cycle.slice(0, -1); - let minIdx = 0; - for (let i = 1; i < nodes.length; i++) { - if (nodes[i] < nodes[minIdx]) { - minIdx = i; - } - } - const rotated = [...nodes.slice(minIdx), ...nodes.slice(0, minIdx)]; - return rotated.join(","); -} -var init_cycles = __esm({ - "node_modules/@intentius/chant/src/discovery/cycles.ts"() { - } -}); - -// node_modules/@intentius/chant/src/sort.ts -function topologicalSort(dependencies) { - const cycles = detectCycles(dependencies); - if (cycles.length > 0) { - const cycleStr = cycles[0].join(" -> "); - throw new BuildError( - cycles[0][0], - `Circular dependency detected: ${cycleStr}` - ); - } - const sorted = []; - const visited = /* @__PURE__ */ new Set(); - const visiting = /* @__PURE__ */ new Set(); - function visit(node) { - if (visited.has(node)) { - return; - } - visiting.add(node); - const deps = dependencies[node] || []; - for (const dep of deps) { - if (!visited.has(dep)) { - visit(dep); - } - } - visiting.delete(node); - visited.add(node); - sorted.push(node); - } - for (const node of Object.keys(dependencies)) { - if (!visited.has(node)) { - visit(node); - } - } - return sorted; +function isTerraformWorkDir(path) { + const parts = path.split("/"); + return parts.includes(".terraform"); } -var init_sort = __esm({ - "node_modules/@intentius/chant/src/sort.ts"() { - init_errors3(); - init_cycles(); - } -}); - -// node_modules/@intentius/chant/src/discovery/resolve.ts -function resolveAttrRefs(entities) { - for (const [name, entity] of entities.entries()) { - entity[LOGICAL_NAME_SYMBOL] = name; - } - for (const [name, entity] of entities.entries()) { - const attributes = getAttributes(entity); - for (const attrName of attributes) { - const attrRef = entity[attrName]; - if (isAttrRefLike(attrRef)) { - const parent = attrRef.parent.deref(); - if (!parent) { - throw new Error( - `Cannot resolve AttrRef on "${name}.${attrName}": parent has been garbage collected` - ); - } - let parentLogicalName; - for (const [entityName, entityValue] of entities.entries()) { - if (entityValue === parent) { - parentLogicalName = entityName; - break; - } - } - if (!parentLogicalName) { - throw new Error( - `Cannot resolve AttrRef on "${name}.${attrName}": parent entity not found in entities collection` - ); - } - attrRef._setLogicalName(parentLogicalName); - } - } - } +function isTerraformStatePath(path) { + return isTerraformStateFile(path) || isTerraformWorkDir(path); } -var init_resolve = __esm({ - "node_modules/@intentius/chant/src/discovery/resolve.ts"() { - init_utils(); - } -}); - -// node_modules/@intentius/chant/src/discovery/graph.ts -function buildDependencyGraph(entities) { - const graph = /* @__PURE__ */ new Map(); - for (const name of entities.keys()) { - graph.set(name, /* @__PURE__ */ new Set()); - } - const entityToName = /* @__PURE__ */ new Map(); - for (const [name, entity] of entities.entries()) { - entityToName.set(entity, name); - } - for (const [name, entity] of entities.entries()) { - const dependencies = graph.get(name); - const visited = /* @__PURE__ */ new Set(); - scanProperties(entity, entities, entityToName, dependencies, visited, entity); - } - return graph; +function escapeRegExp(literal2) { + return literal2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } -function scanProperties(obj, entities, entityToName, dependencies, visited, rootEntity) { - if (!isDeclarable(obj) && !visited.has(obj)) { - visited.add(obj); - } - if (Array.isArray(obj)) { - for (const item of obj) { - findDependencies(item, entities, entityToName, dependencies, visited, rootEntity); - } - return; - } - for (const prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - const propValue = obj[prop]; - findDependencies( - propValue, - entities, - entityToName, - dependencies, - visited, - rootEntity - ); - } +function gitignoreCoversTerraformState(gitignore, path) { + const name = path.split("/").pop() ?? path; + for (const raw of gitignore.split("\n")) { + const line = raw.trim(); + if (line === "" || line.startsWith("#") || line.startsWith("!")) continue; + const pattern2 = line.replace(/^\*\*\//, "").replace(/^\//, "").replace(/\/$/, ""); + if (pattern2 === "" || pattern2.includes("/")) continue; + const re = new RegExp(`^${pattern2.split("*").map(escapeRegExp).join("[^/]*")}$`); + if (re.test(name) || path.split("/").some((segment) => re.test(segment))) return true; } + return false; } -function findDependencies(value, entities, entityToName, dependencies, visited, rootEntity) { - if (value === null || value === void 0) { - return; - } - if (typeof value !== "object") { - return; - } - if (isAttrRefLike(value)) { - if (visited.has(value)) { - return; - } - visited.add(value); - const parent = value.parent.deref(); - if (parent && isDeclarable(parent) && parent !== rootEntity) { - const parentName = entityToName.get(parent); - if (parentName) { - dependencies.add(parentName); - } - } - return; - } - if (isDeclarable(value)) { - if (value === rootEntity) { - if (visited.has(value)) { - const referencedName2 = entityToName.get(value); - if (referencedName2) { - dependencies.add(referencedName2); - } - return; - } - visited.add(value); - scanProperties(value, entities, entityToName, dependencies, visited, rootEntity); - return; - } - const referencedName = entityToName.get(value); - if (referencedName) { - dependencies.add(referencedName); - } - return; - } - if (visited.has(value)) { - return; +function nestedGitignoreCovering(path, readGitignore) { + const parts = path.split("/"); + for (let depth = parts.length - 1; depth > 0; depth--) { + const dir = parts.slice(0, depth).join("/"); + const body = readGitignore(dir); + if (body !== void 0 && gitignoreCoversTerraformState(body, parts.slice(depth).join("/"))) return dir; } - scanProperties(value, entities, entityToName, dependencies, visited, rootEntity); + return void 0; } -var init_graph = __esm({ - "node_modules/@intentius/chant/src/discovery/graph.ts"() { - init_declarable(); - init_utils(); +var init_terraform_state = __esm({ + "node_modules/@intentius/chant/src/audit/terraform-state.ts"() { } }); // node_modules/typescript/lib/typescript.js var require_typescript = __commonJS({ "node_modules/typescript/lib/typescript.js"(exports, module) { - var ts34 = {}; + var ts37 = {}; ((module2) => { "use strict"; var __defProp2 = Object.defineProperty; @@ -21555,7 +24830,7 @@ var require_typescript = __commonJS({ NodeBuilderFlags: () => NodeBuilderFlags, NodeCheckFlags: () => NodeCheckFlags, NodeFactoryFlags: () => NodeFactoryFlags, - NodeFlags: () => NodeFlags6, + NodeFlags: () => NodeFlags7, NodeResolutionFeatures: () => NodeResolutionFeatures, ObjectFlags: () => ObjectFlags, OperationCanceledException: () => OperationCanceledException, @@ -21585,7 +24860,7 @@ var require_typescript = __commonJS({ ScriptElementKindModifier: () => ScriptElementKindModifier, ScriptKind: () => ScriptKind2, ScriptSnapshot: () => ScriptSnapshot, - ScriptTarget: () => ScriptTarget5, + ScriptTarget: () => ScriptTarget6, SemanticClassificationFormat: () => SemanticClassificationFormat, SemanticMeaning: () => SemanticMeaning, SemicolonPreference: () => SemicolonPreference, @@ -21603,7 +24878,7 @@ var require_typescript = __commonJS({ SymbolDisplayPartKind: () => SymbolDisplayPartKind, SymbolFlags: () => SymbolFlags, SymbolFormatFlags: () => SymbolFormatFlags, - SyntaxKind: () => SyntaxKind10, + SyntaxKind: () => SyntaxKind11, Ternary: () => Ternary, ThrottledCancellationToken: () => ThrottledCancellationToken, TokenClass: () => TokenClass, @@ -21678,7 +24953,7 @@ var require_typescript = __commonJS({ canHaveIllegalTypeParameters: () => canHaveIllegalTypeParameters, canHaveJSDoc: () => canHaveJSDoc, canHaveLocals: () => canHaveLocals, - canHaveModifiers: () => canHaveModifiers, + canHaveModifiers: () => canHaveModifiers2, canHaveModuleSpecifier: () => canHaveModuleSpecifier, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, @@ -21881,7 +25156,7 @@ var require_typescript = __commonJS({ createSolutionBuilderWithWatch: () => createSolutionBuilderWithWatch, createSolutionBuilderWithWatchHost: () => createSolutionBuilderWithWatchHost, createSortedArray: () => createSortedArray, - createSourceFile: () => createSourceFile5, + createSourceFile: () => createSourceFile6, createSourceMapGenerator: () => createSourceMapGenerator, createSourceMapSource: () => createSourceMapSource, createSuperAccessVariableStatement: () => createSuperAccessVariableStatement, @@ -22306,7 +25581,7 @@ var require_typescript = __commonJS({ getModeForResolutionAtIndex: () => getModeForResolutionAtIndex, getModeForUsageLocation: () => getModeForUsageLocation, getModifiedTime: () => getModifiedTime, - getModifiers: () => getModifiers, + getModifiers: () => getModifiers2, getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, @@ -22606,7 +25881,7 @@ var require_typescript = __commonJS({ isArrayLiteralOrObjectLiteralDestructuringPattern: () => isArrayLiteralOrObjectLiteralDestructuringPattern, isArrayTypeNode: () => isArrayTypeNode2, isArrowFunction: () => isArrowFunction8, - isAsExpression: () => isAsExpression7, + isAsExpression: () => isAsExpression8, isAssertClause: () => isAssertClause, isAssertEntry: () => isAssertEntry, isAssertionExpression: () => isAssertionExpression, @@ -22746,8 +26021,8 @@ var require_typescript = __commonJS({ isExcludedFile: () => isExcludedFile, isExclusivelyTypeOnlyImportOrExport: () => isExclusivelyTypeOnlyImportOrExport, isExpandoPropertyDeclaration: () => isExpandoPropertyDeclaration, - isExportAssignment: () => isExportAssignment3, - isExportDeclaration: () => isExportDeclaration2, + isExportAssignment: () => isExportAssignment4, + isExportDeclaration: () => isExportDeclaration3, isExportModifier: () => isExportModifier, isExportName: () => isExportName, isExportNamespaceAsDefaultDeclaration: () => isExportNamespaceAsDefaultDeclaration, @@ -22805,7 +26080,7 @@ var require_typescript = __commonJS({ isHeritageClause: () => isHeritageClause, isHoistedFunction: () => isHoistedFunction, isHoistedVariableStatement: () => isHoistedVariableStatement, - isIdentifier: () => isIdentifier26, + isIdentifier: () => isIdentifier28, isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword, isIdentifierName: () => isIdentifierName, isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode, @@ -22822,7 +26097,7 @@ var require_typescript = __commonJS({ isImportAttributes: () => isImportAttributes, isImportCall: () => isImportCall, isImportClause: () => isImportClause, - isImportDeclaration: () => isImportDeclaration7, + isImportDeclaration: () => isImportDeclaration8, isImportEqualsDeclaration: () => isImportEqualsDeclaration, isImportKeyword: () => isImportKeyword, isImportMeta: () => isImportMeta, @@ -23003,7 +26278,7 @@ var require_typescript = __commonJS({ isNamedExportBindings: () => isNamedExportBindings, isNamedExports: () => isNamedExports2, isNamedImportBindings: () => isNamedImportBindings, - isNamedImports: () => isNamedImports5, + isNamedImports: () => isNamedImports6, isNamedImportsOrExports: () => isNamedImportsOrExports, isNamedTupleMember: () => isNamedTupleMember, isNamespaceBody: () => isNamespaceBody, @@ -23026,7 +26301,7 @@ var require_typescript = __commonJS({ isNonGlobalAmbientModule: () => isNonGlobalAmbientModule, isNonNullAccess: () => isNonNullAccess, isNonNullChain: () => isNonNullChain, - isNonNullExpression: () => isNonNullExpression5, + isNonNullExpression: () => isNonNullExpression6, isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName, isNotEmittedStatement: () => isNotEmittedStatement, isNullishCoalesce: () => isNullishCoalesce, @@ -23039,7 +26314,7 @@ var require_typescript = __commonJS({ isObjectBindingPattern: () => isObjectBindingPattern3, isObjectLiteralElement: () => isObjectLiteralElement, isObjectLiteralElementLike: () => isObjectLiteralElementLike, - isObjectLiteralExpression: () => isObjectLiteralExpression12, + isObjectLiteralExpression: () => isObjectLiteralExpression13, isObjectLiteralMethod: () => isObjectLiteralMethod, isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor, isObjectTypeDeclaration: () => isObjectTypeDeclaration, @@ -23057,7 +26332,7 @@ var require_typescript = __commonJS({ isParameter: () => isParameter, isParameterPropertyDeclaration: () => isParameterPropertyDeclaration, isParameterPropertyModifier: () => isParameterPropertyModifier, - isParenthesizedExpression: () => isParenthesizedExpression7, + isParenthesizedExpression: () => isParenthesizedExpression8, isParenthesizedTypeNode: () => isParenthesizedTypeNode, isParseTreeNode: () => isParseTreeNode, isPartOfParameterDeclaration: () => isPartOfParameterDeclaration, @@ -23081,10 +26356,10 @@ var require_typescript = __commonJS({ isPrologueDirective: () => isPrologueDirective, isPropertyAccessChain: () => isPropertyAccessChain, isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression, - isPropertyAccessExpression: () => isPropertyAccessExpression16, + isPropertyAccessExpression: () => isPropertyAccessExpression17, isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName, isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode, - isPropertyAssignment: () => isPropertyAssignment11, + isPropertyAssignment: () => isPropertyAssignment12, isPropertyDeclaration: () => isPropertyDeclaration, isPropertyName: () => isPropertyName, isPropertyNameLiteral: () => isPropertyNameLiteral, @@ -23118,13 +26393,13 @@ var require_typescript = __commonJS({ isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName: () => isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, isRootedDiskPath: () => isRootedDiskPath, isSameEntityName: () => isSameEntityName, - isSatisfiesExpression: () => isSatisfiesExpression5, + isSatisfiesExpression: () => isSatisfiesExpression6, isSemicolonClassElement: () => isSemicolonClassElement, isSetAccessor: () => isSetAccessor, isSetAccessorDeclaration: () => isSetAccessorDeclaration, isShiftOperatorOrHigher: () => isShiftOperatorOrHigher, isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol, - isShorthandPropertyAssignment: () => isShorthandPropertyAssignment6, + isShorthandPropertyAssignment: () => isShorthandPropertyAssignment7, isSideEffectImport: () => isSideEffectImport, isSignedNumericLiteral: () => isSignedNumericLiteral, isSimpleCopiableExpression: () => isSimpleCopiableExpression, @@ -23139,7 +26414,7 @@ var require_typescript = __commonJS({ isSourceFileNotJson: () => isSourceFileNotJson, isSourceMapping: () => isSourceMapping, isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration, - isSpreadAssignment: () => isSpreadAssignment6, + isSpreadAssignment: () => isSpreadAssignment7, isSpreadElement: () => isSpreadElement5, isStatement: () => isStatement, isStatementButNotDeclaration: () => isStatementButNotDeclaration, @@ -23201,7 +26476,7 @@ var require_typescript = __commonJS({ isTupleTypeNode: () => isTupleTypeNode, isTypeAlias: () => isTypeAlias, isTypeAliasDeclaration: () => isTypeAliasDeclaration2, - isTypeAssertionExpression: () => isTypeAssertionExpression2, + isTypeAssertionExpression: () => isTypeAssertionExpression3, isTypeDeclaration: () => isTypeDeclaration, isTypeElement: () => isTypeElement, isTypeKeyword: () => isTypeKeyword, @@ -23240,7 +26515,7 @@ var require_typescript = __commonJS({ isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire, isVariableDeclarationList: () => isVariableDeclarationList, isVariableLike: () => isVariableLike, - isVariableStatement: () => isVariableStatement11, + isVariableStatement: () => isVariableStatement12, isVoidExpression: () => isVoidExpression, isWatchSet: () => isWatchSet, isWhileStatement: () => isWhileStatement, @@ -23371,7 +26646,7 @@ var require_typescript = __commonJS({ parseJSDocTypeExpressionForTests: () => parseJSDocTypeExpressionForTests, parseJsonConfigFileContent: () => parseJsonConfigFileContent, parseJsonSourceFileConfigFileContent: () => parseJsonSourceFileConfigFileContent, - parseJsonText: () => parseJsonText, + parseJsonText: () => parseJsonText2, parseListTypeOption: () => parseListTypeOption, parseNodeFactory: () => parseNodeFactory, parseNodeModuleFromPath: () => parseNodeModuleFromPath, @@ -25064,18 +28339,18 @@ var require_typescript = __commonJS({ function patternText({ prefix, suffix }) { return `${prefix}*${suffix}`; } - function matchedText(pattern, candidate) { - Debug.assert(isPatternMatch(pattern, candidate)); - return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length); + function matchedText(pattern2, candidate) { + Debug.assert(isPatternMatch(pattern2, candidate)); + return candidate.substring(pattern2.prefix.length, candidate.length - pattern2.suffix.length); } function findBestPatternMatch(values, getPattern, candidate) { let matchedValue; let longestMatchPrefixLength = -1; for (let i = 0; i < values.length; i++) { const v = values[i]; - const pattern = getPattern(v); - if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) { - longestMatchPrefixLength = pattern.prefix.length; + const pattern2 = getPattern(v); + if (pattern2.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern2, candidate)) { + longestMatchPrefixLength = pattern2.prefix.length; matchedValue = v; } } @@ -25490,7 +28765,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, function formatSyntaxKind(kind) { return formatEnum( kind, - SyntaxKind10, + SyntaxKind11, /*isFlags*/ false ); @@ -25517,7 +28792,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, function formatNodeFlags(flags) { return formatEnum( flags, - NodeFlags6, + NodeFlags7, /*isFlags*/ true ); @@ -25787,7 +29062,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { value() { - const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : isIdentifier26(this) ? `Identifier '${idText(this)}'` : isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : isStringLiteral15(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : isNumericLiteral5(this) ? `NumericLiteral ${this.text}` : isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : isParameter(this) ? "ParameterDeclaration" : isConstructorDeclaration2(this) ? "ConstructorDeclaration" : isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : isTypePredicateNode(this) ? "TypePredicateNode" : isTypeReferenceNode3(this) ? "TypeReferenceNode" : isFunctionTypeNode(this) ? "FunctionTypeNode" : isConstructorTypeNode(this) ? "ConstructorTypeNode" : isTypeQueryNode(this) ? "TypeQueryNode" : isTypeLiteralNode2(this) ? "TypeLiteralNode" : isArrayTypeNode2(this) ? "ArrayTypeNode" : isTupleTypeNode(this) ? "TupleTypeNode" : isOptionalTypeNode(this) ? "OptionalTypeNode" : isRestTypeNode(this) ? "RestTypeNode" : isUnionTypeNode2(this) ? "UnionTypeNode" : isIntersectionTypeNode2(this) ? "IntersectionTypeNode" : isConditionalTypeNode(this) ? "ConditionalTypeNode" : isInferTypeNode(this) ? "InferTypeNode" : isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : isThisTypeNode(this) ? "ThisTypeNode" : isTypeOperatorNode(this) ? "TypeOperatorNode" : isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : isMappedTypeNode(this) ? "MappedTypeNode" : isLiteralTypeNode(this) ? "LiteralTypeNode" : isNamedTupleMember(this) ? "NamedTupleMember" : isImportTypeNode(this) ? "ImportTypeNode" : formatSyntaxKind(this.kind); + const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : isIdentifier28(this) ? `Identifier '${idText(this)}'` : isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : isStringLiteral15(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : isNumericLiteral5(this) ? `NumericLiteral ${this.text}` : isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : isParameter(this) ? "ParameterDeclaration" : isConstructorDeclaration2(this) ? "ConstructorDeclaration" : isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : isTypePredicateNode(this) ? "TypePredicateNode" : isTypeReferenceNode3(this) ? "TypeReferenceNode" : isFunctionTypeNode(this) ? "FunctionTypeNode" : isConstructorTypeNode(this) ? "ConstructorTypeNode" : isTypeQueryNode(this) ? "TypeQueryNode" : isTypeLiteralNode2(this) ? "TypeLiteralNode" : isArrayTypeNode2(this) ? "ArrayTypeNode" : isTupleTypeNode(this) ? "TupleTypeNode" : isOptionalTypeNode(this) ? "OptionalTypeNode" : isRestTypeNode(this) ? "RestTypeNode" : isUnionTypeNode2(this) ? "UnionTypeNode" : isIntersectionTypeNode2(this) ? "IntersectionTypeNode" : isConditionalTypeNode(this) ? "ConditionalTypeNode" : isInferTypeNode(this) ? "InferTypeNode" : isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : isThisTypeNode(this) ? "ThisTypeNode" : isTypeOperatorNode(this) ? "TypeOperatorNode" : isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : isMappedTypeNode(this) ? "MappedTypeNode" : isLiteralTypeNode(this) ? "LiteralTypeNode" : isNamedTupleMember(this) ? "NamedTupleMember" : isImportTypeNode(this) ? "ImportTypeNode" : formatSyntaxKind(this.kind); return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; } }, @@ -25826,9 +29101,9 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, if (nodeIsSynthesized(this)) return ""; let text = weakNodeTextMap.get(this); if (text === void 0) { - const parseNode = getParseTreeNode(this); - const sourceFile = parseNode && getSourceFileOfNode(parseNode); - text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + const parseNode2 = getParseTreeNode(this); + const sourceFile = parseNode2 && getSourceFileOfNode(parseNode2); + text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode2, includeTrivia) : ""; weakNodeTextMap.set(this, text); } return text; @@ -26938,7 +30213,7 @@ ${lanes.join("\n")} })(tracingEnabled || (tracingEnabled = {})); var startTracing = tracingEnabled.startTracing; var dumpTracingLegend = tracingEnabled.dumpLegend; - var SyntaxKind10 = /* @__PURE__ */ ((SyntaxKind52) => { + var SyntaxKind11 = /* @__PURE__ */ ((SyntaxKind52) => { SyntaxKind52[SyntaxKind52["Unknown"] = 0] = "Unknown"; SyntaxKind52[SyntaxKind52["EndOfFileToken"] = 1] = "EndOfFileToken"; SyntaxKind52[SyntaxKind52["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; @@ -27444,8 +30719,8 @@ ${lanes.join("\n")} /* LastKeyword */ ] = "LastContextualKeyword"; return SyntaxKind52; - })(SyntaxKind10 || {}); - var NodeFlags6 = /* @__PURE__ */ ((NodeFlags32) => { + })(SyntaxKind11 || {}); + var NodeFlags7 = /* @__PURE__ */ ((NodeFlags32) => { NodeFlags32[NodeFlags32["None"] = 0] = "None"; NodeFlags32[NodeFlags32["Let"] = 1] = "Let"; NodeFlags32[NodeFlags32["Const"] = 2] = "Const"; @@ -27494,7 +30769,7 @@ ${lanes.join("\n")} /* HasAsyncFunctions */ ] = "IdentifierIsInJSDocNamespace"; return NodeFlags32; - })(NodeFlags6 || {}); + })(NodeFlags7 || {}); var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => { ModifierFlags3[ModifierFlags3["None"] = 0] = "None"; ModifierFlags3[ModifierFlags3["Public"] = 1] = "Public"; @@ -28347,7 +31622,7 @@ ${lanes.join("\n")} ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred"; return ScriptKind7; })(ScriptKind2 || {}); - var ScriptTarget5 = /* @__PURE__ */ ((ScriptTarget12) => { + var ScriptTarget6 = /* @__PURE__ */ ((ScriptTarget12) => { ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3"; ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5"; ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015"; @@ -28367,7 +31642,7 @@ ${lanes.join("\n")} /* ESNext */ ] = "Latest"; return ScriptTarget12; - })(ScriptTarget5 || {}); + })(ScriptTarget6 || {}); var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => { LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard"; LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX"; @@ -30079,9 +33354,9 @@ ${lanes.join("\n")} return process.memoryUsage().heapUsed; }, getFileSize(path) { - const stat2 = statSync4(path); - if (stat2 == null ? void 0 : stat2.isFile()) { - return stat2.size; + const stat = statSync6(path); + if (stat == null ? void 0 : stat.isFile()) { + return stat.size; } return 0; }, @@ -30123,7 +33398,7 @@ ${lanes.join("\n")} } }; return nodeSystem; - function statSync4(path) { + function statSync6(path) { try { return _fs.statSync(path, statSyncOptions); } catch { @@ -30182,7 +33457,7 @@ ${lanes.join("\n")} activeSession.post("Profiler.stop", (err, { profile }) => { var _a3; if (!err) { - if ((_a3 = statSync4(profilePath)) == null ? void 0 : _a3.isDirectory()) { + if ((_a3 = statSync6(profilePath)) == null ? void 0 : _a3.isDirectory()) { profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`); } try { @@ -30299,19 +33574,19 @@ ${lanes.join("\n")} if (entry === "." || entry === "..") { continue; } - let stat2; + let stat; if (typeof dirent === "string" || dirent.isSymbolicLink()) { const name = combinePaths(path, entry); - stat2 = statSync4(name); - if (!stat2) { + stat = statSync6(name); + if (!stat) { continue; } } else { - stat2 = dirent; + stat = dirent; } - if (stat2.isFile()) { + if (stat.isFile()) { files.push(entry); - } else if (stat2.isDirectory()) { + } else if (stat.isDirectory()) { directories.push(entry); } } @@ -30326,15 +33601,15 @@ ${lanes.join("\n")} return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath); } function fileSystemEntryExists(path, entryKind) { - const stat2 = statSync4(path); - if (!stat2) { + const stat = statSync6(path); + if (!stat) { return false; } switch (entryKind) { case 0: - return stat2.isFile(); + return stat.isFile(); case 1: - return stat2.isDirectory(); + return stat.isDirectory(); default: return false; } @@ -30368,7 +33643,7 @@ ${lanes.join("\n")} } function getModifiedTime3(path) { var _a3; - return (_a3 = statSync4(path)) == null ? void 0 : _a3.mtime; + return (_a3 = statSync6(path)) == null ? void 0 : _a3.mtime; } function setModifiedTime(path, time3) { try { @@ -30832,11 +34107,11 @@ ${lanes.join("\n")} return toComponents; } const components = toComponents.slice(start); - const relative7 = []; + const relative8 = []; for (; start < fromComponents.length; start++) { - relative7.push(".."); + relative8.push(".."); } - return ["", ...relative7, ...components]; + return ["", ...relative8, ...components]; } function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative"); @@ -36853,7 +40128,7 @@ ${lanes.join("\n")} return expr.name; case 213: const arg = expr.argumentExpression; - if (isIdentifier26(arg)) { + if (isIdentifier28(arg)) { return arg; } } @@ -36871,13 +40146,13 @@ ${lanes.join("\n")} } function getDeclarationIdentifier(node) { const name = getNameOfDeclaration(node); - return name && isIdentifier26(name) ? name : void 0; + return name && isIdentifier28(name) ? name : void 0; } function nodeHasName(statement, name) { - if (isNamedDeclaration(statement) && isIdentifier26(statement.name) && idText(statement.name) === idText(name)) { + if (isNamedDeclaration(statement) && isIdentifier28(statement.name) && idText(statement.name) === idText(name)) { return true; } - if (isVariableStatement11(statement) && some(statement.declarationList.declarations, (d) => nodeHasName(d, name))) { + if (isVariableStatement12(statement) && some(statement.declarationList.declarations, (d) => nodeHasName(d, name))) { return true; } return false; @@ -36923,7 +40198,7 @@ ${lanes.join("\n")} return nameForNamelessJSDocTypedef(declaration); case 278: { const { expression } = declaration; - return isIdentifier26(expression) ? expression : void 0; + return isIdentifier28(expression) ? expression : void 0; } case 213: const expr = declaration; @@ -36940,15 +40215,15 @@ ${lanes.join("\n")} function getAssignedName(node) { if (!node.parent) { return void 0; - } else if (isPropertyAssignment11(node.parent) || isBindingElement(node.parent)) { + } else if (isPropertyAssignment12(node.parent) || isBindingElement(node.parent)) { return node.parent.name; } else if (isBinaryExpression4(node.parent) && node === node.parent.right) { - if (isIdentifier26(node.parent.left)) { + if (isIdentifier28(node.parent.left)) { return node.parent.left; } else if (isAccessExpression(node.parent.left)) { return getElementOrPropertyAccessArgumentExpressionOrName(node.parent.left); } - } else if (isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name)) { + } else if (isVariableDeclaration7(node.parent) && isIdentifier28(node.parent.name)) { return node.parent.name; } } @@ -36957,7 +40232,7 @@ ${lanes.join("\n")} return filter(node.modifiers, isDecorator); } } - function getModifiers(node) { + function getModifiers2(node) { if (hasSyntacticModifier( node, 98303 @@ -36968,9 +40243,9 @@ ${lanes.join("\n")} } function getJSDocParameterTagsWorker(param, noCache) { if (param.name) { - if (isIdentifier26(param.name)) { + if (isIdentifier28(param.name)) { const name = param.name.escapedText; - return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier26(tag.name) && tag.name.escapedText === name); + return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier28(tag.name) && tag.name.escapedText === name); } else { const i = param.parent.parameters.indexOf(param); Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); @@ -37220,7 +40495,7 @@ ${lanes.join("\n")} return node.kind === 179 || node.kind === 178; } function isPropertyAccessChain(node) { - return isPropertyAccessExpression16(node) && !!(node.flags & 64); + return isPropertyAccessExpression17(node) && !!(node.flags & 64); } function isElementAccessChain(node) { return isElementAccessExpression8(node) && !!(node.flags & 64); @@ -37233,7 +40508,7 @@ ${lanes.join("\n")} return !!(node.flags & 64) && (kind === 212 || kind === 213 || kind === 214 || kind === 236); } function isOptionalChainRoot(node) { - return isOptionalChain2(node) && !isNonNullExpression5(node) && !!node.questionDotToken; + return isOptionalChain2(node) && !isNonNullExpression6(node) && !!node.questionDotToken; } function isExpressionOfOptionalChainRoot(node) { return isOptionalChainRoot(node.parent) && node.parent.expression === node; @@ -37245,7 +40520,7 @@ ${lanes.join("\n")} return node.kind === 227 && node.operatorToken.kind === 61; } function isConstTypeReference(node) { - return isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; + return isTypeReferenceNode3(node) && isIdentifier28(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; } function skipPartiallyEmittedExpressions(node) { return skipOuterExpressions( @@ -37255,7 +40530,7 @@ ${lanes.join("\n")} ); } function isNonNullChain(node) { - return isNonNullExpression5(node) && !!(node.flags & 64); + return isNonNullExpression6(node) && !!(node.flags & 64); } function isBreakOrContinueStatement(node) { return node.kind === 253 || node.kind === 252; @@ -37342,11 +40617,11 @@ ${lanes.join("\n")} return node.kind === 11 || isTemplateLiteralKind(node.kind); } function isImportAttributeName(node) { - return isStringLiteral15(node) || isIdentifier26(node); + return isStringLiteral15(node) || isIdentifier28(node); } function isGeneratedIdentifier(node) { var _a3; - return isIdentifier26(node) && ((_a3 = node.emitNode) == null ? void 0 : _a3.autoGenerate) !== void 0; + return isIdentifier28(node) && ((_a3 = node.emitNode) == null ? void 0 : _a3.autoGenerate) !== void 0; } function isGeneratedPrivateIdentifier(node) { var _a3; @@ -37360,7 +40635,7 @@ ${lanes.join("\n")} return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name); } function isPrivateIdentifierPropertyAccessExpression(node) { - return isPropertyAccessExpression16(node) && isPrivateIdentifier(node.name); + return isPropertyAccessExpression17(node) && isPrivateIdentifier(node.name); } function isModifierKind(token) { switch (token) { @@ -37741,20 +41016,20 @@ ${lanes.join("\n")} return false; } function isScopeMarker(node) { - return isExportAssignment3(node) || isExportDeclaration2(node); + return isExportAssignment4(node) || isExportDeclaration3(node); } function hasScopeMarker(statements) { return some(statements, isScopeMarker); } function needsScopeMarker(result) { - return !isAnyImportOrReExport(result) && !isExportAssignment3(result) && !hasSyntacticModifier( + return !isAnyImportOrReExport(result) && !isExportAssignment4(result) && !hasSyntacticModifier( result, 32 /* Export */ ) && !isAmbientModule(result); } function isExternalModuleIndicator(result) { - return isAnyImportOrReExport(result) || isExportAssignment3(result) || hasSyntacticModifier( + return isAnyImportOrReExport(result) || isExportAssignment4(result) || hasSyntacticModifier( result, 32 /* Export */ @@ -38394,8 +41669,8 @@ ${lanes.join("\n")} if (isClassStaticBlockDeclaration(parent2)) return child === parent2.modifiers; if (isPropertySignature3(parent2)) return child === parent2.initializer; if (isPropertyDeclaration(parent2)) return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2); - if (isPropertyAssignment11(parent2)) return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike); - if (isShorthandPropertyAssignment6(parent2)) return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike); + if (isPropertyAssignment12(parent2)) return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike); + if (isShorthandPropertyAssignment7(parent2)) return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike); if (isMethodDeclaration(parent2)) return child === parent2.exclamationToken; if (isConstructorDeclaration2(parent2)) return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration); if (isGetAccessorDeclaration(parent2)) return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration); @@ -38509,14 +41784,14 @@ ${lanes.join("\n")} ); } function getNonDecoratorTokenPosOfNode(node, sourceFile) { - const lastDecorator = !nodeIsMissing(node) && canHaveModifiers(node) ? findLast(node.modifiers, isDecorator) : void 0; + const lastDecorator = !nodeIsMissing(node) && canHaveModifiers2(node) ? findLast(node.modifiers, isDecorator) : void 0; if (!lastDecorator) { return getTokenPosOfNode(node, sourceFile); } return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end); } function getNonModifierTokenPosOfNode(node, sourceFile) { - const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : void 0; + const lastModifier = !nodeIsMissing(node) && canHaveModifiers2(node) && node.modifiers ? last(node.modifiers) : void 0; if (!lastModifier) { return getTokenPosOfNode(node, sourceFile); } @@ -38529,7 +41804,7 @@ ${lanes.join("\n")} return !!findAncestor(node, isJSDocTypeExpression); } function isExportNamespaceAsDefaultDeclaration(node) { - return !!(isExportDeclaration2(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name)); + return !!(isExportDeclaration3(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name)); } function moduleExportNameTextUnescaped(node) { return node.kind === 11 ? node.text : unescapeLeadingUnderscores(node.escapedText); @@ -39192,7 +42467,7 @@ ${lanes.join("\n")} return isModuleDeclaration(node) && isStringLiteral15(node.name); } function isEffectiveModuleDeclaration(node) { - return isModuleDeclaration(node) || isIdentifier26(node); + return isModuleDeclaration(node) || isIdentifier28(node); } function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); @@ -39358,7 +42633,7 @@ ${lanes.join("\n")} return isAnyImportOrReExport(node) || isModuleDeclaration(node) || isImportTypeNode(node) || isImportCall(node); } function isAnyImportOrReExport(node) { - return isAnyImportSyntax(node) || isExportDeclaration2(node); + return isAnyImportSyntax(node) || isExportDeclaration3(node); } function getEnclosingContainer(node) { return findAncestor(node.parent, (n) => !!(getContainerFlags(n) & 1)); @@ -39415,7 +42690,7 @@ ${lanes.join("\n")} case 167: return entityNameToString(name.left) + "." + entityNameToString(name.right); case 212: - if (isIdentifier26(name.name) || isPrivateIdentifier(name.name)) { + if (isIdentifier28(name.name) || isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return Debug.assertNever(name.name); @@ -39690,10 +42965,10 @@ ${lanes.join("\n")} return isCustomPrologue(node) && isFunctionDeclaration5(node); } function isHoistedVariable(node) { - return isIdentifier26(node.name) && !node.initializer; + return isIdentifier28(node.name) && !node.initializer; } function isHoistedVariableStatement(node) { - return isCustomPrologue(node) && isVariableStatement11(node) && every(node.declarationList.declarations, isHoistedVariable); + return isCustomPrologue(node) && isVariableStatement12(node) && every(node.declarationList.declarations, isHoistedVariable); } function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { return node.kind !== 12 ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0; @@ -39892,14 +43167,14 @@ ${lanes.join("\n")} } function isCommonJsExportedExpression(node) { if (!isInJSFile(node)) return false; - return isObjectLiteralExpression12(node.parent) && isBinaryExpression4(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 || isCommonJsExportPropertyAssignment(node.parent); + return isObjectLiteralExpression13(node.parent) && isBinaryExpression4(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 || isCommonJsExportPropertyAssignment(node.parent); } function isCommonJsExportPropertyAssignment(node) { if (!isInJSFile(node)) return false; return isBinaryExpression4(node) && getAssignmentDeclarationKind(node) === 1; } function isValidESSymbolDeclaration(node) { - return (isVariableDeclaration7(node) ? isVarConst(node) && isIdentifier26(node.name) && isVariableDeclarationInVariableStatement(node) : isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : isPropertySignature3(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node); + return (isVariableDeclaration7(node) ? isVarConst(node) && isIdentifier28(node.name) && isVariableDeclarationInVariableStatement(node) : isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : isPropertySignature3(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node); } function introducesArgumentsExoticObject(node) { switch (node.kind) { @@ -39942,7 +43217,7 @@ ${lanes.join("\n")} } function forEachPropertyAssignment(objectLiteral, key, callback, key2) { return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => { - if (!isPropertyAssignment11(property)) return void 0; + if (!isPropertyAssignment12(property)) return void 0; const propName2 = tryGetTextOfPropertyName(property.name); return key === propName2 || key2 && key2 === propName2 ? callback(property) : void 0; }); @@ -39950,7 +43225,7 @@ ${lanes.join("\n")} function getTsConfigObjectLiteralExpression(tsConfigSourceFile) { if (tsConfigSourceFile && tsConfigSourceFile.statements.length) { const expression = tsConfigSourceFile.statements[0].expression; - return tryCast(expression, isObjectLiteralExpression12); + return tryCast(expression, isObjectLiteralExpression13); } } function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) { @@ -40056,7 +43331,7 @@ ${lanes.join("\n")} } } function isInTopLevelContext(node) { - if (isIdentifier26(node) && (isClassDeclaration5(node.parent) || isFunctionDeclaration5(node.parent)) && node.parent.name === node) { + if (isIdentifier28(node) && (isClassDeclaration5(node.parent) || isFunctionDeclaration5(node.parent)) && node.parent.name === node) { node = node.parent; } const container = getThisContainer( @@ -40148,7 +43423,7 @@ ${lanes.join("\n")} return !!node && isVariableDeclaration7(node) && ((_a3 = node.initializer) == null ? void 0 : _a3.kind) === 110; } function isThisInitializedObjectBindingExpression(node) { - return !!node && (isShorthandPropertyAssignment6(node) || isPropertyAssignment11(node)) && isBinaryExpression4(node.parent.parent) && node.parent.parent.operatorToken.kind === 64 && node.parent.parent.right.kind === 110; + return !!node && (isShorthandPropertyAssignment7(node) || isPropertyAssignment12(node)) && isBinaryExpression4(node.parent.parent) && node.parent.parent.operatorToken.kind === 64 && node.parent.parent.right.kind === 110; } function getEntityNameFromTypeNode(node) { switch (node.kind) { @@ -40426,7 +43701,7 @@ ${lanes.join("\n")} return !!node && !!(node.flags & 16777216); } function isJSDocIndexSignature(node) { - return isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 154 || node.typeArguments[0].kind === 150); + return isTypeReferenceNode3(node) && isIdentifier28(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 154 || node.typeArguments[0].kind === 150); } function isRequireCall(callExpression, requireStringLiteralLikeArgument) { if (callExpression.kind !== 214) { @@ -40467,7 +43742,7 @@ ${lanes.join("\n")} ); } function isRequireVariableStatement(node) { - return isVariableStatement11(node) && node.declarationList.declarations.length > 0 && every(node.declarationList.declarations, (decl) => isVariableDeclarationInitializedToRequire(decl)); + return isVariableStatement12(node) && node.declarationList.declarations.length > 0 && every(node.declarationList.declarations, (decl) => isVariableDeclarationInitializedToRequire(decl)); } function isSingleOrDoubleQuote(charCode) { return charCode === 39 || charCode === 34; @@ -40476,7 +43751,7 @@ ${lanes.join("\n")} return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34; } function isAssignmentDeclaration(decl) { - return isBinaryExpression4(decl) || isAccessExpression(decl) || isIdentifier26(decl) || isCallExpression16(decl); + return isBinaryExpression4(decl) || isAccessExpression(decl) || isIdentifier28(decl) || isCallExpression16(decl); } function getEffectiveInitializer(node) { if (isInJSFile(node) && node.initializer && isBinaryExpression4(node.initializer) && (node.initializer.operatorToken.kind === 57 || node.initializer.operatorToken.kind === 61) && node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) { @@ -40489,7 +43764,7 @@ ${lanes.join("\n")} return init && getExpandoInitializer(init, isPrototypeAccess(node.name)); } function hasExpandoValueProperty(node, isPrototypeAssignment) { - return forEach(node.properties, (p) => isPropertyAssignment11(p) && isIdentifier26(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment)); + return forEach(node.properties, (p) => isPropertyAssignment12(p) && isIdentifier28(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment)); } function getAssignedExpandoInitializer(node) { if (node && node.parent && isBinaryExpression4(node.parent) && node.parent.operatorToken.kind === 64) { @@ -40511,7 +43786,7 @@ ${lanes.join("\n")} if (initializer3.kind === 219 || initializer3.kind === 232 || initializer3.kind === 220) { return initializer3; } - if (isObjectLiteralExpression12(initializer3) && (initializer3.properties.length === 0 || isPrototypeAssignment)) { + if (isObjectLiteralExpression13(initializer3) && (initializer3.properties.length === 0 || isPrototypeAssignment)) { return initializer3; } } @@ -40528,7 +43803,7 @@ ${lanes.join("\n")} function getNameOfExpando(node) { if (isBinaryExpression4(node.parent)) { const parent2 = (node.parent.operatorToken.kind === 57 || node.parent.operatorToken.kind === 61) && isBinaryExpression4(node.parent.parent) ? node.parent.parent : node.parent; - if (parent2.operatorToken.kind === 64 && isIdentifier26(parent2.left)) { + if (parent2.operatorToken.kind === 64 && isIdentifier28(parent2.left)) { return parent2.left; } } else if (isVariableDeclaration7(node.parent)) { @@ -40539,7 +43814,7 @@ ${lanes.join("\n")} if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer3)) { return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer3); } - if (isMemberName(name) && isLiteralLikeAccess(initializer3) && (initializer3.expression.kind === 110 || isIdentifier26(initializer3.expression) && (initializer3.expression.escapedText === "window" || initializer3.expression.escapedText === "self" || initializer3.expression.escapedText === "global"))) { + if (isMemberName(name) && isLiteralLikeAccess(initializer3) && (initializer3.expression.kind === 110 || isIdentifier28(initializer3.expression) && (initializer3.expression.escapedText === "window" || initializer3.expression.escapedText === "self" || initializer3.expression.escapedText === "global"))) { return isSameEntityName(name, getNameOrArgument(initializer3)); } if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer3)) { @@ -40558,33 +43833,33 @@ ${lanes.join("\n")} return node; } function isExportsIdentifier(node) { - return isIdentifier26(node) && node.escapedText === "exports"; + return isIdentifier28(node) && node.escapedText === "exports"; } function isModuleIdentifier(node) { - return isIdentifier26(node) && node.escapedText === "module"; + return isIdentifier28(node) && node.escapedText === "module"; } function isModuleExportsAccessExpression(node) { - return (isPropertyAccessExpression16(node) || isLiteralLikeElementAccess(node)) && isModuleIdentifier(node.expression) && getElementOrPropertyAccessName(node) === "exports"; + return (isPropertyAccessExpression17(node) || isLiteralLikeElementAccess(node)) && isModuleIdentifier(node.expression) && getElementOrPropertyAccessName(node) === "exports"; } function getAssignmentDeclarationKind(expr) { const special = getAssignmentDeclarationKindWorker(expr); return special === 5 || isInJSFile(expr) ? special : 0; } function isBindableObjectDefinePropertyCall(expr) { - return length(expr.arguments) === 3 && isPropertyAccessExpression16(expr.expression) && isIdentifier26(expr.expression.expression) && idText(expr.expression.expression) === "Object" && idText(expr.expression.name) === "defineProperty" && isStringOrNumericLiteralLike(expr.arguments[1]) && isBindableStaticNameExpression( + return length(expr.arguments) === 3 && isPropertyAccessExpression17(expr.expression) && isIdentifier28(expr.expression.expression) && idText(expr.expression.expression) === "Object" && idText(expr.expression.name) === "defineProperty" && isStringOrNumericLiteralLike(expr.arguments[1]) && isBindableStaticNameExpression( expr.arguments[0], /*excludeThisKeyword*/ true ); } function isLiteralLikeAccess(node) { - return isPropertyAccessExpression16(node) || isLiteralLikeElementAccess(node); + return isPropertyAccessExpression17(node) || isLiteralLikeElementAccess(node); } function isLiteralLikeElementAccess(node) { return isElementAccessExpression8(node) && isStringOrNumericLiteralLike(node.argumentExpression); } function isBindableStaticAccessExpression(node, excludeThisKeyword) { - return isPropertyAccessExpression16(node) && (!excludeThisKeyword && node.expression.kind === 110 || isIdentifier26(node.name) && isBindableStaticNameExpression( + return isPropertyAccessExpression17(node) && (!excludeThisKeyword && node.expression.kind === 110 || isIdentifier28(node.name) && isBindableStaticNameExpression( node.expression, /*excludeThisKeyword*/ true @@ -40601,7 +43876,7 @@ ${lanes.join("\n")} return isEntityNameExpression(node) || isBindableStaticAccessExpression(node, excludeThisKeyword); } function getNameOrArgument(expr) { - if (isPropertyAccessExpression16(expr)) { + if (isPropertyAccessExpression17(expr)) { return expr.name; } return expr.argumentExpression; @@ -40627,7 +43902,7 @@ ${lanes.join("\n")} expr.left.expression, /*excludeThisKeyword*/ true - ) && getElementOrPropertyAccessName(expr.left) === "prototype" && isObjectLiteralExpression12(getInitializerOfBinaryExpression(expr))) { + ) && getElementOrPropertyAccessName(expr.left) === "prototype" && isObjectLiteralExpression13(getInitializerOfBinaryExpression(expr))) { return 6; } return getAssignmentDeclarationPropertyAccessKind(expr.left); @@ -40636,7 +43911,7 @@ ${lanes.join("\n")} return isVoidExpression(node) && isNumericLiteral5(node.expression) && node.expression.text === "0"; } function getElementOrPropertyAccessArgumentExpressionOrName(node) { - if (isPropertyAccessExpression16(node)) { + if (isPropertyAccessExpression17(node)) { return node.name; } const arg = skipParentheses(node.argumentExpression); @@ -40648,7 +43923,7 @@ ${lanes.join("\n")} function getElementOrPropertyAccessName(node) { const name = getElementOrPropertyAccessArgumentExpressionOrName(node); if (name) { - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { return name.escapedText; } if (isStringLiteralLike4(name) || isNumericLiteral5(name)) { @@ -40671,7 +43946,7 @@ ${lanes.join("\n")} return 3; } let nextToLast = lhs; - while (!isIdentifier26(nextToLast.expression)) { + while (!isIdentifier28(nextToLast.expression)) { nextToLast = nextToLast.expression; } const id = nextToLast.expression; @@ -40848,7 +44123,7 @@ ${lanes.join("\n")} } function isJSDocConstructSignature(node) { const param = isJSDocFunctionType(node) ? firstOrUndefined(node.parameters) : void 0; - const name = tryCast(param && param.name, isIdentifier26); + const name = tryCast(param && param.name, isIdentifier28); return !!name && name.escapedText === "new"; } function isJSDocTypeAlias(node) { @@ -40875,7 +44150,7 @@ ${lanes.join("\n")} } } function getSingleVariableOfVariableStatement(node) { - return isVariableStatement11(node) ? firstOrUndefined(node.declarationList.declarations) : void 0; + return isVariableStatement12(node) ? firstOrUndefined(node.declarationList.declarations) : void 0; } function getNestedModuleDeclaration(node) { return isModuleDeclaration(node) && node.body && node.body.kind === 268 ? node.body : void 0; @@ -41010,7 +44285,7 @@ ${lanes.join("\n")} }); } function ownsJSDocTag(hostNode, tag) { - return !(isJSDocTypeTag(tag) || isJSDocSatisfiesTag(tag)) || !tag.parent || !isJSDoc(tag.parent) || !isParenthesizedExpression7(tag.parent.parent) || tag.parent.parent === hostNode; + return !(isJSDocTypeTag(tag) || isJSDocSatisfiesTag(tag)) || !tag.parent || !isJSDoc(tag.parent) || !isParenthesizedExpression8(tag.parent.parent) || tag.parent.parent === hostNode; } function getNextJSDocCommentLocation(node) { const parent2 = node.parent; @@ -41026,7 +44301,7 @@ ${lanes.join("\n")} if (node.symbol) { return node.symbol; } - if (!isIdentifier26(node.name)) { + if (!isIdentifier28(node.name)) { return void 0; } const name = node.name.escapedText; @@ -41322,7 +44597,7 @@ ${lanes.join("\n")} return isAliasableExpression(e); } function getExportAssignmentExpression(node) { - return isExportAssignment3(node) ? node.expression : node.right; + return isExportAssignment4(node) ? node.expression : node.right; } function getPropertyAssignmentAliasLikeExpression(node) { return node.kind === 305 ? node.name : node.kind === 304 ? node.initializer : node.parent.right; @@ -41534,7 +44809,7 @@ ${lanes.join("\n")} return startsWith(symbol2.escapedName, "__#"); } function isProtoSetter(node) { - return isIdentifier26(node) ? idText(node) === "__proto__" : isStringLiteral15(node) && node.text === "__proto__"; + return isIdentifier28(node) ? idText(node) === "__proto__" : isStringLiteral15(node) && node.text === "__proto__"; } function isAnonymousFunctionDefinition(node, cb) { node = skipOuterExpressions(node); @@ -41563,11 +44838,11 @@ ${lanes.join("\n")} case 305: return !!node.objectAssignmentInitializer; case 261: - return isIdentifier26(node.name) && !!node.initializer; + return isIdentifier28(node.name) && !!node.initializer; case 170: - return isIdentifier26(node.name) && !!node.initializer && !node.dotDotDotToken; + return isIdentifier28(node.name) && !!node.initializer && !node.dotDotDotToken; case 209: - return isIdentifier26(node.name) && !!node.initializer && !node.dotDotDotToken; + return isIdentifier28(node.name) && !!node.initializer && !node.dotDotDotToken; case 173: return !!node.initializer; case 227: @@ -41576,7 +44851,7 @@ ${lanes.join("\n")} case 77: case 76: case 78: - return isIdentifier26(node.left); + return isIdentifier28(node.left); } break; case 278: @@ -42769,7 +46044,7 @@ ${lanes.join("\n")} return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node); } function getSyntacticModifierFlagsNoCache(node) { - let flags = canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0; + let flags = canHaveModifiers2(node) ? modifiersToFlags(node.modifiers) : 0; if (node.flags & 8 || node.kind === 80 && node.flags & 4096) { flags |= 32; } @@ -42904,10 +46179,10 @@ ${lanes.join("\n")} return node.kind === 80 || node.kind === 110 || node.kind === 108 || node.kind === 237 || node.kind === 212 && isDottedName(node.expression) || node.kind === 218 && isDottedName(node.expression); } function isPropertyAccessEntityNameExpression(node) { - return isPropertyAccessExpression16(node) && isIdentifier26(node.name) && isEntityNameExpression(node.expression); + return isPropertyAccessExpression17(node) && isIdentifier28(node.name) && isEntityNameExpression(node.expression); } function tryGetPropertyAccessOrIdentifierToString(expr) { - if (isPropertyAccessExpression16(expr)) { + if (isPropertyAccessExpression17(expr)) { const baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression); if (baseStr !== void 0) { return baseStr + "." + entityNameToString(expr.name); @@ -42917,7 +46192,7 @@ ${lanes.join("\n")} if (baseStr !== void 0 && isPropertyName(expr.argumentExpression)) { return baseStr + "." + getPropertyNameForPropertyNameNode(expr.argumentExpression); } - } else if (isIdentifier26(expr)) { + } else if (isIdentifier28(expr)) { return unescapeLeadingUnderscores(expr.escapedText); } else if (isJsxNamespacedName(expr)) { return getTextOfJsxNamespacedName(expr); @@ -42931,10 +46206,10 @@ ${lanes.join("\n")} return node.parent.kind === 167 && node.parent.right === node || node.parent.kind === 212 && node.parent.name === node || node.parent.kind === 237 && node.parent.name === node; } function isRightSideOfAccessExpression(node) { - return !!node.parent && (isPropertyAccessExpression16(node.parent) && node.parent.name === node || isElementAccessExpression8(node.parent) && node.parent.argumentExpression === node); + return !!node.parent && (isPropertyAccessExpression17(node.parent) && node.parent.name === node || isElementAccessExpression8(node.parent) && node.parent.argumentExpression === node); } function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) { - return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression16(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; + return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression17(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; } function isInstanceOfExpression(node) { return isBinaryExpression4(node) && node.operatorToken.kind === 104; @@ -43120,14 +46395,14 @@ ${lanes.join("\n")} return createRange(pos, range.end); } function moveRangePastDecorators(node) { - const lastDecorator = canHaveModifiers(node) ? findLast(node.modifiers, isDecorator) : void 0; + const lastDecorator = canHaveModifiers2(node) ? findLast(node.modifiers, isDecorator) : void 0; return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? moveRangePos(node, lastDecorator.end) : node; } function moveRangePastModifiers(node) { if (isPropertyDeclaration(node) || isMethodDeclaration(node)) { return moveRangePos(node, node.name.pos); } - const lastModifier = canHaveModifiers(node) ? lastOrUndefined(node.modifiers) : void 0; + const lastModifier = canHaveModifiers2(node) ? lastOrUndefined(node.modifiers) : void 0; return lastModifier && !positionIsSynthesized(lastModifier.end) ? moveRangePos(node, lastModifier.end) : moveRangePastDecorators(node); } function createTokenRange(pos, token) { @@ -43229,12 +46504,12 @@ ${lanes.join("\n")} } } function isDeclarationNameOfEnumOrNamespace(node) { - const parseNode = getParseTreeNode(node); - if (parseNode) { - switch (parseNode.parent.kind) { + const parseNode2 = getParseTreeNode(node); + if (parseNode2) { + switch (parseNode2.parent.kind) { case 267: case 268: - return parseNode === parseNode.parent.name; + return parseNode2 === parseNode2.parent.name; } } return false; @@ -43450,7 +46725,7 @@ ${lanes.join("\n")} return res; } } else if (access.kind === 213) { - if (isIdentifier26(access.argumentExpression) || isStringLiteralLike4(access.argumentExpression)) { + if (isIdentifier28(access.argumentExpression) || isStringLiteralLike4(access.argumentExpression)) { const res = action(access.argumentExpression); if (res !== void 0) { return res; @@ -43462,7 +46737,7 @@ ${lanes.join("\n")} if (isAccessExpression(access.expression)) { return walkAccessExpression(access.expression); } - if (isIdentifier26(access.expression)) { + if (isIdentifier28(access.expression)) { return action(access.expression); } return void 0; @@ -44353,9 +47628,9 @@ ${lanes.join("\n")} if (!patterns || !patterns.length) { return void 0; } - const pattern = patterns.map((pattern2) => `(?:${pattern2})`).join("|"); + const pattern2 = patterns.map((pattern22) => `(?:${pattern22})`).join("|"); const terminator = usage === "exclude" ? "(?:$|/)" : "$"; - return `^(?:${pattern})${terminator}`; + return `^(?:${pattern2})${terminator}`; } function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === void 0 || specs.length === 0) { @@ -44367,8 +47642,8 @@ ${lanes.join("\n")} return !/[.*?]/.test(lastPathComponent); } function getPatternFromSpec(spec, basePath, usage) { - const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); - return pattern && `^(?:${pattern})${usage === "exclude" ? "(?:$|/)" : "$"}`; + const pattern2 = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); + return pattern2 && `^(?:${pattern2})${usage === "exclude" ? "(?:$|/)" : "$"}`; } function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) { let subpattern = ""; @@ -44428,21 +47703,21 @@ ${lanes.join("\n")} currentDirectory = normalizePath(currentDirectory); const absolutePath = combinePaths(currentDirectory, path); return { - includeFilePatterns: map2(getRegularExpressionsForWildcards(includes, absolutePath, "files"), (pattern) => `^${pattern}$`), + includeFilePatterns: map2(getRegularExpressionsForWildcards(includes, absolutePath, "files"), (pattern2) => `^${pattern2}$`), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames2) }; } - function getRegexFromPattern(pattern, useCaseSensitiveFileNames2) { - return new RegExp(pattern, useCaseSensitiveFileNames2 ? "" : "i"); + function getRegexFromPattern(pattern2, useCaseSensitiveFileNames2) { + return new RegExp(pattern2, useCaseSensitiveFileNames2 ? "" : "i"); } function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames2, currentDirectory); - const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames2)); + const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern2) => getRegexFromPattern(pattern2, useCaseSensitiveFileNames2)); const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames2); const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames2); const results = includeFileRegexes ? includeFileRegexes.map(() => []) : [[]]; @@ -44784,14 +48059,14 @@ ${lanes.join("\n")} false ); } - function tryParsePattern(pattern) { - const indexOfStar = pattern.indexOf("*"); + function tryParsePattern(pattern2) { + const indexOfStar = pattern2.indexOf("*"); if (indexOfStar === -1) { - return pattern; + return pattern2; } - return pattern.indexOf("*", indexOfStar + 1) !== -1 ? void 0 : { - prefix: pattern.substr(0, indexOfStar), - suffix: pattern.substr(indexOfStar + 1) + return pattern2.indexOf("*", indexOfStar + 1) !== -1 ? void 0 : { + prefix: pattern2.substr(0, indexOfStar), + suffix: pattern2.substr(indexOfStar + 1) }; } var parsedPatternsCache = /* @__PURE__ */ new WeakMap(); @@ -45024,7 +48299,7 @@ ${lanes.join("\n")} return !!(useSite.flags & 33554432) || isInJSDoc(useSite) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); } function isShorthandPropertyNameUseSite(useSite) { - return isIdentifier26(useSite) && isShorthandPropertyAssignment6(useSite.parent) && useSite.parent.name === useSite; + return isIdentifier28(useSite) && isShorthandPropertyAssignment7(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { while (node.kind === 80 || node.kind === 212) { @@ -45059,7 +48334,7 @@ ${lanes.join("\n")} return (heritageClause == null ? void 0 : heritageClause.token) === 119 || (heritageClause == null ? void 0 : heritageClause.parent.kind) === 265; } function isIdentifierTypeReference(node) { - return isTypeReferenceNode3(node) && isIdentifier26(node.typeName); + return isTypeReferenceNode3(node) && isIdentifier28(node.typeName); } function arrayIsHomogeneous(array2, comparer = equateValues) { if (array2.length < 2) return true; @@ -45128,7 +48403,7 @@ ${lanes.join("\n")} Debug.assertIsDefined(node.parent); while (true) { const parent2 = node.parent; - if (isParenthesizedExpression7(parent2)) { + if (isParenthesizedExpression8(parent2)) { node = parent2; continue; } @@ -45320,7 +48595,7 @@ ${lanes.join("\n")} } } function canHaveExportModifier(node) { - return isEnumDeclaration(node) || isVariableStatement11(node) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isInterfaceDeclaration2(node) || isTypeDeclaration(node) || isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node); + return isEnumDeclaration(node) || isVariableStatement12(node) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isInterfaceDeclaration2(node) || isTypeDeclaration(node) || isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node); } function isOptionalJSDocPropertyLikeTag(node) { if (!isJSDocPropertyLikeTag(node)) { @@ -45360,10 +48635,10 @@ ${lanes.join("\n")} } function isNonNullAccess(node) { const kind = node.kind; - return (kind === 212 || kind === 213) && isNonNullExpression5(node.expression); + return (kind === 212 || kind === 213) && isNonNullExpression6(node.expression); } function isJSDocSatisfiesExpression(node) { - return isInJSFile(node) && isParenthesizedExpression7(node) && hasJSDocNodes(node) && !!getJSDocSatisfiesTag(node); + return isInJSFile(node) && isParenthesizedExpression8(node) && hasJSDocNodes(node) && !!getJSDocSatisfiesTag(node); } function getJSDocSatisfiesExpressionType(node) { return Debug.checkDefined(tryGetJSDocSatisfiesTypeNode(node)); @@ -45373,10 +48648,10 @@ ${lanes.join("\n")} return tag && tag.typeExpression && tag.typeExpression.type; } function getEscapedTextOfJsxAttributeName(node) { - return isIdentifier26(node) ? node.escapedText : getEscapedTextOfJsxNamespacedName(node); + return isIdentifier28(node) ? node.escapedText : getEscapedTextOfJsxNamespacedName(node); } function getTextOfJsxAttributeName(node) { - return isIdentifier26(node) ? idText(node) : getTextOfJsxNamespacedName(node); + return isIdentifier28(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isJsxAttributeName(node) { const kind = node.kind; @@ -45389,7 +48664,7 @@ ${lanes.join("\n")} return `${idText(node.namespace)}:${idText(node.name)}`; } function intrinsicTagNameToString(node) { - return isIdentifier26(node) ? idText(node) : getTextOfJsxNamespacedName(node); + return isIdentifier28(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isTypeUsableAsPropertyName(type) { return !!(type.flags & 8576); @@ -45404,7 +48679,7 @@ ${lanes.join("\n")} return Debug.fail(); } function isExpandoPropertyDeclaration(declaration) { - return !!declaration && (isPropertyAccessExpression16(declaration) || isElementAccessExpression8(declaration) || isBinaryExpression4(declaration)); + return !!declaration && (isPropertyAccessExpression17(declaration) || isElementAccessExpression8(declaration) || isBinaryExpression4(declaration)); } function hasResolutionModeOverride(node) { if (node === void 0) { @@ -45417,7 +48692,7 @@ ${lanes.join("\n")} return stringReplace.call(s, "*", replacement); } function getNameFromImportAttribute(node) { - return isIdentifier26(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text); + return isIdentifier28(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text); } function isSourceElement(node) { switch (node.kind) { @@ -46128,7 +49403,7 @@ ${lanes.join("\n")} } } function isSideEffectImport(node) { - const ancestor = findAncestor(node, isImportDeclaration7); + const ancestor = findAncestor(node, isImportDeclaration8); return !!ancestor && !ancestor.importClause; } var unprefixedNodeCoreModulesList = [ @@ -46853,7 +50128,7 @@ ${lanes.join("\n")} var _a3; if (!node.body) return Debug.fail(`Cannot convert a FunctionDeclaration without a body`); const updated = factory2.createFunctionExpression( - (_a3 = getModifiers(node)) == null ? void 0 : _a3.filter((modifier) => !isExportModifier(modifier) && !isDefaultModifier(modifier)), + (_a3 = getModifiers2(node)) == null ? void 0 : _a3.filter((modifier) => !isExportModifier(modifier) && !isDefaultModifier(modifier)), node.asteriskToken, node.name, node.typeParameters, @@ -46895,7 +50170,7 @@ ${lanes.join("\n")} function convertToArrayAssignmentElement(element) { if (isBindingElement(element)) { if (element.dotDotDotToken) { - Debug.assertNode(element.name, isIdentifier26); + Debug.assertNode(element.name, isIdentifier28); return setOriginalNode(setTextRange(factory2.createSpreadElement(element.name), element), element); } const expression = convertToAssignmentElementTarget(element.name); @@ -46912,14 +50187,14 @@ ${lanes.join("\n")} function convertToObjectAssignmentElement(element) { if (isBindingElement(element)) { if (element.dotDotDotToken) { - Debug.assertNode(element.name, isIdentifier26); + Debug.assertNode(element.name, isIdentifier28); return setOriginalNode(setTextRange(factory2.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { const expression = convertToAssignmentElementTarget(element.name); return setOriginalNode(setTextRange(factory2.createPropertyAssignment(element.propertyName, element.initializer ? factory2.createAssignment(expression, element.initializer) : expression), element), element); } - Debug.assertNode(element.name, isIdentifier26); + Debug.assertNode(element.name, isIdentifier28); return setOriginalNode(setTextRange(factory2.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } return cast(element, isObjectLiteralElementLike); @@ -46944,7 +50219,7 @@ ${lanes.join("\n")} node ); } - return cast(node, isObjectLiteralExpression12); + return cast(node, isObjectLiteralExpression13); } function convertToArrayAssignmentPattern(node) { if (isArrayBindingPattern(node)) { @@ -49082,7 +52357,7 @@ ${lanes.join("\n")} node.expression = expression; node.questionDotToken = questionDotToken; node.name = name; - node.transformFlags = propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | (isIdentifier26(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); + node.transformFlags = propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | (isIdentifier28(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); node.jsDoc = void 0; node.flowNode = void 0; return node; @@ -49105,7 +52380,7 @@ ${lanes.join("\n")} } function updatePropertyAccessExpression(node, expression, name) { if (isPropertyAccessChain(node)) { - return updatePropertyAccessChain(node, expression, node.questionDotToken, cast(name, isIdentifier26)); + return updatePropertyAccessChain(node, expression, node.questionDotToken, cast(name, isIdentifier28)); } return node.expression !== expression || node.name !== name ? update(createPropertyAccessExpression(expression, name), node) : node; } @@ -49419,7 +52694,7 @@ ${lanes.join("\n")} node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); - if ((operator === 46 || operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { + if ((operator === 46 || operator === 47) && isIdentifier28(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { node.transformFlags |= 268435456; } return node; @@ -49435,7 +52710,7 @@ ${lanes.join("\n")} node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); - if (isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { + if (isIdentifier28(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { node.transformFlags |= 268435456; } return node; @@ -49457,7 +52732,7 @@ ${lanes.join("\n")} if (operatorKind === 61) { node.transformFlags |= 32; } else if (operatorKind === 64) { - if (isObjectLiteralExpression12(node.left)) { + if (isObjectLiteralExpression13(node.left)) { node.transformFlags |= 1024 | 128 | 4096 | propagateAssignmentPatternFlags(node.left); } else if (isArrayLiteralExpression7(node.left)) { node.transformFlags |= 1024 | 4096 | propagateAssignmentPatternFlags(node.left); @@ -51420,7 +54695,7 @@ ${lanes.join("\n")} if (isGeneratedIdentifier(node)) { return cloneGeneratedIdentifier(node); } - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { return cloneIdentifier(node); } if (isGeneratedPrivateIdentifier(node)) { @@ -51618,7 +54893,7 @@ ${lanes.join("\n")} } } function isIgnorableParen(node) { - return isParenthesizedExpression7(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node)); + return isParenthesizedExpression8(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node)); } function restoreOuterExpressions(outerExpression, innerExpression, kinds = 63) { if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) { @@ -51686,7 +54961,7 @@ ${lanes.join("\n")} /*optionalChain*/ false ); - } else if (isPropertyAccessExpression16(callee)) { + } else if (isPropertyAccessExpression17(callee)) { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createPropertyAccessExpression( @@ -51768,7 +55043,7 @@ ${lanes.join("\n")} } function getName(node, allowComments, allowSourceMaps, emitFlags = 0, ignoreAssignedName) { const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node); - if (nodeName && isIdentifier26(nodeName) && !isGeneratedIdentifier(nodeName)) { + if (nodeName && isIdentifier28(nodeName) && !isGeneratedIdentifier(nodeName)) { const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent); emitFlags |= getEmitFlags(nodeName); if (!allowSourceMaps) emitFlags |= 96; @@ -51934,7 +55209,7 @@ ${lanes.join("\n")} } else { modifierArray = modifiers; } - return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature3(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration2(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression7(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction8(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement11(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration5(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration5(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration2(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration2(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration7(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment3(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration2(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node); + return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature3(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration2(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression7(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction8(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement12(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration5(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration5(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration2(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration2(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration8(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment4(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration3(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node); } function replaceDecoratorsAndModifiers(node, modifierArray) { return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration5(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node); @@ -52097,7 +55372,7 @@ ${lanes.join("\n")} return tokenValue; } function propagateNameFlags(node) { - return node && isIdentifier26(node) ? propagateIdentifierNameFlags(node) : propagateChildFlags(node); + return node && isIdentifier28(node) ? propagateIdentifierNameFlags(node) : propagateChildFlags(node); } function propagateIdentifierNameFlags(node) { return propagateChildFlags(node) & ~67108864; @@ -52503,8 +55778,8 @@ ${lanes.join("\n")} PrivateIdentifierKind2["Accessor"] = "a"; return PrivateIdentifierKind2; })(PrivateIdentifierKind || {}); - function createEmitHelperFactory(context) { - const factory2 = context.factory; + function createEmitHelperFactory(context2) { + const factory2 = context2.factory; const immutableTrue = memoize(() => setInternalEmitFlags( factory2.createTrue(), 8 @@ -52568,7 +55843,7 @@ ${lanes.join("\n")} ); } function createDecorateHelper(decoratorExpressions, target, memberName, descriptor) { - context.requestEmitHelper(decorateHelper); + context2.requestEmitHelper(decorateHelper); const argumentsArray = []; argumentsArray.push(factory2.createArrayLiteralExpression( decoratorExpressions, @@ -52590,7 +55865,7 @@ ${lanes.join("\n")} ); } function createMetadataHelper(metadataKey, metadataValue) { - context.requestEmitHelper(metadataHelper); + context2.requestEmitHelper(metadataHelper); return factory2.createCallExpression( getUnscopedHelperName("__metadata"), /*typeArguments*/ @@ -52602,7 +55877,7 @@ ${lanes.join("\n")} ); } function createParamHelper(expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); + context2.requestEmitHelper(paramHelper); return setTextRange( factory2.createCallExpression( getUnscopedHelperName("__param"), @@ -52689,7 +55964,7 @@ ${lanes.join("\n")} ); } function createESDecorateClassElementAccessHasMethod(elementName) { - const propertyName = elementName.computed ? elementName.name : isIdentifier26(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name; + const propertyName = elementName.computed ? elementName.name : isIdentifier28(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name; return factory2.createPropertyAssignment( "has", factory2.createArrowFunction( @@ -52738,7 +56013,7 @@ ${lanes.join("\n")} return contextIn.kind === "class" ? createESDecorateClassContextObject(contextIn) : createESDecorateClassElementContextObject(contextIn); } function createESDecorateHelper(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - context.requestEmitHelper(esDecorateHelper); + context2.requestEmitHelper(esDecorateHelper); return factory2.createCallExpression( getUnscopedHelperName("__esDecorate"), /*typeArguments*/ @@ -52754,7 +56029,7 @@ ${lanes.join("\n")} ); } function createRunInitializersHelper(thisArg, initializers, value) { - context.requestEmitHelper(runInitializersHelper); + context2.requestEmitHelper(runInitializersHelper); return factory2.createCallExpression( getUnscopedHelperName("__runInitializers"), /*typeArguments*/ @@ -52763,7 +56038,7 @@ ${lanes.join("\n")} ); } function createAssignHelper(attributesSegments) { - if (getEmitScriptTarget(context.getCompilerOptions()) >= 2) { + if (getEmitScriptTarget(context2.getCompilerOptions()) >= 2) { return factory2.createCallExpression( factory2.createPropertyAccessExpression(factory2.createIdentifier("Object"), "assign"), /*typeArguments*/ @@ -52771,7 +56046,7 @@ ${lanes.join("\n")} attributesSegments ); } - context.requestEmitHelper(assignHelper); + context2.requestEmitHelper(assignHelper); return factory2.createCallExpression( getUnscopedHelperName("__assign"), /*typeArguments*/ @@ -52780,7 +56055,7 @@ ${lanes.join("\n")} ); } function createAwaitHelper(expression) { - context.requestEmitHelper(awaitHelper); + context2.requestEmitHelper(awaitHelper); return factory2.createCallExpression( getUnscopedHelperName("__await"), /*typeArguments*/ @@ -52789,8 +56064,8 @@ ${lanes.join("\n")} ); } function createAsyncGeneratorHelper(generatorFunc, hasLexicalThis) { - context.requestEmitHelper(awaitHelper); - context.requestEmitHelper(asyncGeneratorHelper); + context2.requestEmitHelper(awaitHelper); + context2.requestEmitHelper(asyncGeneratorHelper); (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 524288 | 1048576; return factory2.createCallExpression( getUnscopedHelperName("__asyncGenerator"), @@ -52804,8 +56079,8 @@ ${lanes.join("\n")} ); } function createAsyncDelegatorHelper(expression) { - context.requestEmitHelper(awaitHelper); - context.requestEmitHelper(asyncDelegator); + context2.requestEmitHelper(awaitHelper); + context2.requestEmitHelper(asyncDelegator); return factory2.createCallExpression( getUnscopedHelperName("__asyncDelegator"), /*typeArguments*/ @@ -52814,7 +56089,7 @@ ${lanes.join("\n")} ); } function createAsyncValuesHelper(expression) { - context.requestEmitHelper(asyncValues); + context2.requestEmitHelper(asyncValues); return factory2.createCallExpression( getUnscopedHelperName("__asyncValues"), /*typeArguments*/ @@ -52823,7 +56098,7 @@ ${lanes.join("\n")} ); } function createRestHelper(value, elements, computedTempVariables, location) { - context.requestEmitHelper(restHelper); + context2.requestEmitHelper(restHelper); const propertyNames = []; let computedTempVariableOffset = 0; for (let i = 0; i < elements.length - 1; i++) { @@ -52863,7 +56138,7 @@ ${lanes.join("\n")} ); } function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) { - context.requestEmitHelper(awaiterHelper); + context2.requestEmitHelper(awaiterHelper); const generatorFunc = factory2.createFunctionExpression( /*modifiers*/ void 0, @@ -52894,7 +56169,7 @@ ${lanes.join("\n")} ); } function createExtendsHelper(name) { - context.requestEmitHelper(extendsHelper); + context2.requestEmitHelper(extendsHelper); return factory2.createCallExpression( getUnscopedHelperName("__extends"), /*typeArguments*/ @@ -52907,7 +56182,7 @@ ${lanes.join("\n")} ); } function createTemplateObjectHelper(cooked, raw) { - context.requestEmitHelper(templateObjectHelper); + context2.requestEmitHelper(templateObjectHelper); return factory2.createCallExpression( getUnscopedHelperName("__makeTemplateObject"), /*typeArguments*/ @@ -52916,7 +56191,7 @@ ${lanes.join("\n")} ); } function createSpreadArrayHelper(to, from, packFrom) { - context.requestEmitHelper(spreadArrayHelper); + context2.requestEmitHelper(spreadArrayHelper); return factory2.createCallExpression( getUnscopedHelperName("__spreadArray"), /*typeArguments*/ @@ -52925,7 +56200,7 @@ ${lanes.join("\n")} ); } function createPropKeyHelper(expr) { - context.requestEmitHelper(propKeyHelper); + context2.requestEmitHelper(propKeyHelper); return factory2.createCallExpression( getUnscopedHelperName("__propKey"), /*typeArguments*/ @@ -52934,16 +56209,16 @@ ${lanes.join("\n")} ); } function createSetFunctionNameHelper(f, name, prefix) { - context.requestEmitHelper(setFunctionNameHelper); - return context.factory.createCallExpression( + context2.requestEmitHelper(setFunctionNameHelper); + return context2.factory.createCallExpression( getUnscopedHelperName("__setFunctionName"), /*typeArguments*/ void 0, - prefix ? [f, name, context.factory.createStringLiteral(prefix)] : [f, name] + prefix ? [f, name, context2.factory.createStringLiteral(prefix)] : [f, name] ); } function createValuesHelper(expression) { - context.requestEmitHelper(valuesHelper); + context2.requestEmitHelper(valuesHelper); return factory2.createCallExpression( getUnscopedHelperName("__values"), /*typeArguments*/ @@ -52952,7 +56227,7 @@ ${lanes.join("\n")} ); } function createReadHelper(iteratorRecord, count) { - context.requestEmitHelper(readHelper); + context2.requestEmitHelper(readHelper); return factory2.createCallExpression( getUnscopedHelperName("__read"), /*typeArguments*/ @@ -52961,7 +56236,7 @@ ${lanes.join("\n")} ); } function createGeneratorHelper(body) { - context.requestEmitHelper(generatorHelper); + context2.requestEmitHelper(generatorHelper); return factory2.createCallExpression( getUnscopedHelperName("__generator"), /*typeArguments*/ @@ -52970,7 +56245,7 @@ ${lanes.join("\n")} ); } function createImportStarHelper(expression) { - context.requestEmitHelper(importStarHelper); + context2.requestEmitHelper(importStarHelper); return factory2.createCallExpression( getUnscopedHelperName("__importStar"), /*typeArguments*/ @@ -52979,11 +56254,11 @@ ${lanes.join("\n")} ); } function createImportStarCallbackHelper() { - context.requestEmitHelper(importStarHelper); + context2.requestEmitHelper(importStarHelper); return getUnscopedHelperName("__importStar"); } function createImportDefaultHelper(expression) { - context.requestEmitHelper(importDefaultHelper); + context2.requestEmitHelper(importDefaultHelper); return factory2.createCallExpression( getUnscopedHelperName("__importDefault"), /*typeArguments*/ @@ -52992,8 +56267,8 @@ ${lanes.join("\n")} ); } function createExportStarHelper(moduleExpression, exportsExpression = factory2.createIdentifier("exports")) { - context.requestEmitHelper(exportStarHelper); - context.requestEmitHelper(createBindingHelper); + context2.requestEmitHelper(exportStarHelper); + context2.requestEmitHelper(createBindingHelper); return factory2.createCallExpression( getUnscopedHelperName("__exportStar"), /*typeArguments*/ @@ -53002,7 +56277,7 @@ ${lanes.join("\n")} ); } function createClassPrivateFieldGetHelper(receiver, state, kind, f) { - context.requestEmitHelper(classPrivateFieldGetHelper); + context2.requestEmitHelper(classPrivateFieldGetHelper); let args; if (!f) { args = [receiver, state, factory2.createStringLiteral(kind)]; @@ -53017,7 +56292,7 @@ ${lanes.join("\n")} ); } function createClassPrivateFieldSetHelper(receiver, state, value, kind, f) { - context.requestEmitHelper(classPrivateFieldSetHelper); + context2.requestEmitHelper(classPrivateFieldSetHelper); let args; if (!f) { args = [receiver, state, value, factory2.createStringLiteral(kind)]; @@ -53032,7 +56307,7 @@ ${lanes.join("\n")} ); } function createClassPrivateFieldInHelper(state, receiver) { - context.requestEmitHelper(classPrivateFieldInHelper); + context2.requestEmitHelper(classPrivateFieldInHelper); return factory2.createCallExpression( getUnscopedHelperName("__classPrivateFieldIn"), /*typeArguments*/ @@ -53041,7 +56316,7 @@ ${lanes.join("\n")} ); } function createAddDisposableResourceHelper(envBinding, value, async) { - context.requestEmitHelper(addDisposableResourceHelper); + context2.requestEmitHelper(addDisposableResourceHelper); return factory2.createCallExpression( getUnscopedHelperName("__addDisposableResource"), /*typeArguments*/ @@ -53050,7 +56325,7 @@ ${lanes.join("\n")} ); } function createDisposeResourcesHelper(envBinding) { - context.requestEmitHelper(disposeResourcesHelper); + context2.requestEmitHelper(disposeResourcesHelper); return factory2.createCallExpression( getUnscopedHelperName("__disposeResources"), /*typeArguments*/ @@ -53059,12 +56334,12 @@ ${lanes.join("\n")} ); } function createRewriteRelativeImportExtensionsHelper(expression) { - context.requestEmitHelper(rewriteRelativeImportExtensionsHelper); + context2.requestEmitHelper(rewriteRelativeImportExtensionsHelper); return factory2.createCallExpression( getUnscopedHelperName("__rewriteRelativeImportExtension"), /*typeArguments*/ void 0, - context.getCompilerOptions().jsx === 1 ? [expression, factory2.createTrue()] : [expression] + context2.getCompilerOptions().jsx === 1 ? [expression, factory2.createTrue()] : [expression] ); } } @@ -53612,7 +56887,7 @@ ${lanes.join("\n")} })(name => super[name], (name, value) => super[name] = value);` }; function isCallToHelper(firstSegment, helperName) { - return isCallExpression16(firstSegment) && isIdentifier26(firstSegment.expression) && (getEmitFlags(firstSegment.expression) & 8192) !== 0 && firstSegment.expression.escapedText === helperName; + return isCallExpression16(firstSegment) && isIdentifier28(firstSegment.expression) && (getEmitFlags(firstSegment.expression) & 8192) !== 0 && firstSegment.expression.escapedText === helperName; } function isNumericLiteral5(node) { return node.kind === 9; @@ -53671,7 +56946,7 @@ ${lanes.join("\n")} function isEqualsGreaterThanToken(node) { return node.kind === 39; } - function isIdentifier26(node) { + function isIdentifier28(node) { return node.kind === 80; } function isPrivateIdentifier(node) { @@ -53848,10 +57123,10 @@ ${lanes.join("\n")} function isArrayLiteralExpression7(node) { return node.kind === 210; } - function isObjectLiteralExpression12(node) { + function isObjectLiteralExpression13(node) { return node.kind === 211; } - function isPropertyAccessExpression16(node) { + function isPropertyAccessExpression17(node) { return node.kind === 212; } function isElementAccessExpression8(node) { @@ -53866,10 +57141,10 @@ ${lanes.join("\n")} function isTaggedTemplateExpression5(node) { return node.kind === 216; } - function isTypeAssertionExpression2(node) { + function isTypeAssertionExpression3(node) { return node.kind === 217; } - function isParenthesizedExpression7(node) { + function isParenthesizedExpression8(node) { return node.kind === 218; } function isFunctionExpression7(node) { @@ -53920,13 +57195,13 @@ ${lanes.join("\n")} function isExpressionWithTypeArguments(node) { return node.kind === 234; } - function isAsExpression7(node) { + function isAsExpression8(node) { return node.kind === 235; } - function isSatisfiesExpression5(node) { + function isSatisfiesExpression6(node) { return node.kind === 239; } - function isNonNullExpression5(node) { + function isNonNullExpression6(node) { return node.kind === 236; } function isMetaProperty(node) { @@ -53950,7 +57225,7 @@ ${lanes.join("\n")} function isBlock6(node) { return node.kind === 242; } - function isVariableStatement11(node) { + function isVariableStatement12(node) { return node.kind === 244; } function isEmptyStatement(node) { @@ -54040,7 +57315,7 @@ ${lanes.join("\n")} function isImportEqualsDeclaration(node) { return node.kind === 272; } - function isImportDeclaration7(node) { + function isImportDeclaration8(node) { return node.kind === 273; } function isImportClause(node) { @@ -54067,16 +57342,16 @@ ${lanes.join("\n")} function isNamespaceExport(node) { return node.kind === 281; } - function isNamedImports5(node) { + function isNamedImports6(node) { return node.kind === 276; } function isImportSpecifier(node) { return node.kind === 277; } - function isExportAssignment3(node) { + function isExportAssignment4(node) { return node.kind === 278; } - function isExportDeclaration2(node) { + function isExportDeclaration3(node) { return node.kind === 279; } function isNamedExports2(node) { @@ -54148,13 +57423,13 @@ ${lanes.join("\n")} function isCatchClause(node) { return node.kind === 300; } - function isPropertyAssignment11(node) { + function isPropertyAssignment12(node) { return node.kind === 304; } - function isShorthandPropertyAssignment6(node) { + function isShorthandPropertyAssignment7(node) { return node.kind === 305; } - function isSpreadAssignment6(node) { + function isSpreadAssignment7(node) { return node.kind === 306; } function isEnumMember(node) { @@ -54482,7 +57757,7 @@ ${lanes.join("\n")} } } function createExpressionForPropertyName(factory2, memberName) { - if (isIdentifier26(memberName)) { + if (isIdentifier28(memberName)) { return factory2.createStringLiteralFromNode(memberName); } else if (isComputedPropertyName(memberName)) { return setParent(setTextRange(factory2.cloneNode(memberName.expression), memberName.expression), memberName.expression.parent); @@ -54503,7 +57778,7 @@ ${lanes.join("\n")} get: getAccessor && setTextRange( setOriginalNode( factory2.createFunctionExpression( - getModifiers(getAccessor), + getModifiers2(getAccessor), /*asteriskToken*/ void 0, /*name*/ @@ -54523,7 +57798,7 @@ ${lanes.join("\n")} set: setAccessor && setTextRange( setOriginalNode( factory2.createFunctionExpression( - getModifiers(setAccessor), + getModifiers2(setAccessor), /*asteriskToken*/ void 0, /*name*/ @@ -54599,7 +57874,7 @@ ${lanes.join("\n")} setOriginalNode( setTextRange( factory2.createFunctionExpression( - getModifiers(method), + getModifiers2(method), method.asteriskToken, /*name*/ void 0, @@ -54696,7 +57971,7 @@ ${lanes.join("\n")} return isCommaExpression(node) || isCommaListExpression(node); } function isJSDocTypeAssertion(node) { - return isParenthesizedExpression7(node) && isInJSFile(node) && !!getJSDocTypeTag(node); + return isParenthesizedExpression8(node) && isInJSFile(node) && !!getJSDocTypeTag(node); } function getJSDocTypeAssertionType(node) { const type = getJSDocType(node); @@ -54746,13 +58021,13 @@ ${lanes.join("\n")} ); } function getExternalHelpersModuleName(node) { - const parseNode = getOriginalNode(node, isSourceFile); - const emitNode = parseNode && parseNode.emitNode; + const parseNode2 = getOriginalNode(node, isSourceFile); + const emitNode = parseNode2 && parseNode2.emitNode; return emitNode && emitNode.externalHelpersModuleName; } function hasRecordedExternalHelpers(sourceFile) { - const parseNode = getOriginalNode(sourceFile, isSourceFile); - const emitNode = parseNode && parseNode.emitNode; + const parseNode2 = getOriginalNode(sourceFile, isSourceFile); + const emitNode = parseNode2 && parseNode2.emitNode; return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers); } function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) { @@ -54785,8 +58060,8 @@ ${lanes.join("\n")} helperFactory.getUnscopedHelperName(name) )) ); - const parseNode = getOriginalNode(sourceFile, isSourceFile); - const emitNode = getOrCreateEmitNode(parseNode); + const parseNode2 = getOriginalNode(sourceFile, isSourceFile); + const emitNode = getOrCreateEmitNode(parseNode2); emitNode.externalHelpers = true; const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration( /*modifiers*/ @@ -54841,8 +58116,8 @@ ${lanes.join("\n")} } const create = some(helpers) || (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4; if (create) { - const parseNode = getOriginalNode(node, isSourceFile); - const emitNode = getOrCreateEmitNode(parseNode); + const parseNode2 = getOriginalNode(node, isSourceFile); + const emitNode = getOrCreateEmitNode(parseNode2); return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory2.createUniqueName(externalHelpersModuleNameText)); } } @@ -54893,7 +58168,7 @@ ${lanes.join("\n")} if (isDeclarationBindingElement(bindingElement)) { return bindingElement.initializer; } - if (isPropertyAssignment11(bindingElement)) { + if (isPropertyAssignment12(bindingElement)) { const initializer3 = bindingElement.initializer; return isAssignmentExpression( initializer3, @@ -54901,7 +58176,7 @@ ${lanes.join("\n")} true ) ? initializer3.right : void 0; } - if (isShorthandPropertyAssignment6(bindingElement)) { + if (isShorthandPropertyAssignment7(bindingElement)) { return bindingElement.objectAssignmentInitializer; } if (isAssignmentExpression( @@ -54955,7 +58230,7 @@ ${lanes.join("\n")} } function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { const propertyName = tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement); - Debug.assert(!!propertyName || isSpreadAssignment6(bindingElement), "Invalid property name for binding element."); + Debug.assert(!!propertyName || isSpreadAssignment7(bindingElement), "Invalid property name for binding element."); return propertyName; } function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { @@ -55007,8 +58282,8 @@ ${lanes.join("\n")} if (fullName) { let rightNode = fullName; while (true) { - if (isIdentifier26(rightNode) || !rightNode.body) { - return isIdentifier26(rightNode) ? rightNode : rightNode.name; + if (isIdentifier28(rightNode) || !rightNode.body) { + return isIdentifier28(rightNode) ? rightNode : rightNode.name; } rightNode = rightNode.body; } @@ -55034,7 +58309,7 @@ ${lanes.join("\n")} return isQuestionToken(node) || isExclamationToken(node); } function isIdentifierOrThisTypeNode(node) { - return isIdentifier26(node) || isThisTypeNode(node); + return isIdentifier28(node) || isThisTypeNode(node); } function isReadonlyKeywordOrPlusOrMinusToken(node) { return isReadonlyKeyword(node) || isPlusToken(node) || isMinusToken(node); @@ -55043,7 +58318,7 @@ ${lanes.join("\n")} return isQuestionToken(node) || isPlusToken(node) || isMinusToken(node); } function isModuleName(node) { - return isIdentifier26(node) || isStringLiteral15(node); + return isIdentifier28(node) || isStringLiteral15(node); } function isExponentiationOperator(kind) { return kind === 43; @@ -55373,7 +58648,7 @@ ${lanes.join("\n")} } } function isSyntheticParenthesizedExpression(node) { - return isParenthesizedExpression7(node) && nodeIsSynthesized(node) && !node.emitNode; + return isParenthesizedExpression8(node) && nodeIsSynthesized(node) && !node.emitNode; } function flattenCommaListWorker(node, expressions) { if (isSyntheticParenthesizedExpression(node)) { @@ -55414,7 +58689,7 @@ ${lanes.join("\n")} function setTextRange(range, location) { return location ? setTextRangePosEnd(range, location.pos, location.end) : range; } - function canHaveModifiers(node) { + function canHaveModifiers2(node) { const kind = node.kind; return kind === 169 || kind === 170 || kind === 172 || kind === 173 || kind === 174 || kind === 175 || kind === 177 || kind === 178 || kind === 179 || kind === 182 || kind === 186 || kind === 219 || kind === 220 || kind === 232 || kind === 244 || kind === 263 || kind === 264 || kind === 265 || kind === 266 || kind === 267 || kind === 268 || kind === 272 || kind === 273 || kind === 278 || kind === 279; } @@ -55458,11 +58733,11 @@ ${lanes.join("\n")} return forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || getImportMetaIfNecessary(sourceFile); } function isAnExternalModuleIndicatorNode(node) { - return canHaveModifiers(node) && hasModifierOfKind( + return canHaveModifiers2(node) && hasModifierOfKind( node, 95 /* ExportKeyword */ - ) || isImportEqualsDeclaration(node) && isExternalModuleReference(node.moduleReference) || isImportDeclaration7(node) || isExportAssignment3(node) || isExportDeclaration2(node) ? node : void 0; + ) || isImportEqualsDeclaration(node) && isExternalModuleReference(node.moduleReference) || isImportDeclaration8(node) || isExportAssignment4(node) || isExportDeclaration3(node) ? node : void 0; } function getImportMetaIfNecessary(sourceFile) { return sourceFile.flags & 8388608 ? walkTreeForImportMeta(sourceFile) : void 0; @@ -56535,7 +59810,7 @@ ${lanes.join("\n")} function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); } - function createSourceFile5(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) { + function createSourceFile6(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) { var _a3, _b; (_a3 = tracing) == null ? void 0 : _a3.push( tracing.Phase.Parse, @@ -56589,7 +59864,7 @@ ${lanes.join("\n")} function parseIsolatedEntityName(text, languageVersion) { return Parser.parseIsolatedEntityName(text, languageVersion); } - function parseJsonText(fileName, sourceText) { + function parseJsonText2(fileName, sourceText) { return Parser.parseJsonText(fileName, sourceText); } function isExternalModule(file2) { @@ -56715,7 +59990,7 @@ ${lanes.join("\n")} var _a3; scriptKind2 = ensureScriptKind(fileName2, scriptKind2); if (scriptKind2 === 6) { - const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes); + const result2 = parseJsonText22(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes); convertToJson( result2, (_a3 = result2.statements[0]) == null ? void 0 : _a3.expression, @@ -56760,7 +60035,7 @@ ${lanes.join("\n")} return isValid ? entityName : void 0; } Parser2.parseIsolatedEntityName = parseIsolatedEntityName2; - function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2, syntaxCursor2, setParentNodes = false) { + function parseJsonText22(fileName2, sourceText2, languageVersion2 = 2, syntaxCursor2, setParentNodes = false) { initializeState( fileName2, sourceText2, @@ -56856,7 +60131,7 @@ ${lanes.join("\n")} clearState(); return result; } - Parser2.parseJsonText = parseJsonText2; + Parser2.parseJsonText = parseJsonText22; function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind, _jsDocParsingMode) { NodeConstructor2 = objectAllocator.getNodeConstructor(); TokenConstructor2 = objectAllocator.getTokenConstructor(); @@ -57121,8 +60396,8 @@ ${lanes.join("\n")} /* AwaitContext */ ); } - function doOutsideOfContext(context, func) { - const contextFlagsToClear = context & contextFlags; + function doOutsideOfContext(context2, func) { + const contextFlagsToClear = context2 & contextFlags; if (contextFlagsToClear) { setContextFlag( /*val*/ @@ -57139,8 +60414,8 @@ ${lanes.join("\n")} } return func(); } - function doInsideOfContext(context, func) { - const contextFlagsToSet = context & ~contextFlags; + function doInsideOfContext(context2, func) { + const contextFlagsToSet = context2 & ~contextFlags; if (contextFlagsToSet) { setContextFlag( /*val*/ @@ -57330,7 +60605,7 @@ ${lanes.join("\n")} } return token() > 118; } - function isIdentifier27() { + function isIdentifier29() { if (token() === 80) { return true; } @@ -57362,7 +60637,7 @@ ${lanes.join("\n")} parseErrorAt(skipTrivia(sourceText, node.template.pos), node.template.end, Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); return; } - const expressionText = isIdentifier26(node) ? idText(node) : void 0; + const expressionText = isIdentifier28(node) ? idText(node) : void 0; if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString( 27 @@ -57657,7 +60932,7 @@ ${lanes.join("\n")} ); } function parseIdentifier(diagnosticMessage, privateIdentifierDiagnosticMessage) { - return createIdentifier(isIdentifier27(), diagnosticMessage, privateIdentifierDiagnosticMessage); + return createIdentifier(isIdentifier29(), diagnosticMessage, privateIdentifierDiagnosticMessage); } function parseIdentifierName(diagnosticMessage) { return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage); @@ -57810,14 +61085,14 @@ ${lanes.join("\n")} if (!inErrorRecovery) { return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); } else { - return isIdentifier27() && !isHeritageClauseExtendsOrImplementsKeyword(); + return isIdentifier29() && !isHeritageClauseExtendsOrImplementsKeyword(); } case 8: return isBindingIdentifierOrPrivateIdentifierOrPattern(); case 10: return token() === 28 || token() === 26 || isBindingIdentifierOrPrivateIdentifierOrPattern(); case 19: - return token() === 103 || token() === 87 || isIdentifier27(); + return token() === 103 || token() === 87 || isIdentifier29(); case 15: switch (token()) { case 28: @@ -57876,7 +61151,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifier() { nextToken(); - return isIdentifier27(); + return isIdentifier29(); } function nextTokenIsIdentifierOrKeyword() { nextToken(); @@ -58167,8 +61442,8 @@ ${lanes.join("\n")} nextToken(); return false; } - function parsingContextErrors(context) { - switch (context) { + function parsingContextErrors(context2) { + switch (context2) { case 0: return token() === 90 ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString( 95 @@ -58231,7 +61506,7 @@ ${lanes.join("\n")} return Debug.fail("ParsingContext.Count used as a context"); // Not a real context, only a marker. default: - Debug.assertNever(context); + Debug.assertNever(context2); } } function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { @@ -58300,8 +61575,8 @@ ${lanes.join("\n")} function isMissingList(arr) { return !!arr.isMissingList; } - function parseBracketedList(kind, parseElement, open2, close) { - if (parseExpected(open2)) { + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { const result = parseDelimitedList(kind, parseElement); parseExpected(close); return result; @@ -58900,10 +62175,10 @@ ${lanes.join("\n")} } if (isModifierKind(token())) { nextToken(); - if (isIdentifier27()) { + if (isIdentifier29()) { return true; } - } else if (!isIdentifier27()) { + } else if (!isIdentifier29()) { return false; } else { nextToken(); @@ -59463,7 +62738,7 @@ ${lanes.join("\n")} case 21: return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: - return isIdentifier27(); + return isIdentifier29(); } } function isStartOfParenthesizedOrFunctionType() { @@ -59625,7 +62900,7 @@ ${lanes.join("\n")} false ); } - if (isIdentifier27() || token() === 110) { + if (isIdentifier29() || token() === 110) { nextToken(); return true; } @@ -59656,7 +62931,7 @@ ${lanes.join("\n")} } function parseTypeOrTypePredicate() { const pos = getNodePos(); - const typePredicateVariable = isIdentifier27() && tryParse(parseTypePredicatePrefix); + const typePredicateVariable = isIdentifier29() && tryParse(parseTypePredicatePrefix); const type = parseType(); if (typePredicateVariable) { return finishNode(factory2.createTypePredicateNode( @@ -59748,7 +63023,7 @@ ${lanes.join("\n")} case 102: return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: - return isIdentifier27(); + return isIdentifier29(); } } function isStartOfExpression() { @@ -59775,7 +63050,7 @@ ${lanes.join("\n")} if (isBinaryOperator2()) { return true; } - return isIdentifier27(); + return isIdentifier29(); } } function isStartOfExpressionStatement() { @@ -59861,7 +63136,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifierOnSameLine() { nextToken(); - return !scanner2.hasPrecedingLineBreak() && isIdentifier27(); + return !scanner2.hasPrecedingLineBreak() && isIdentifier29(); } function parseYieldExpression() { const pos = getNodePos(); @@ -59984,7 +63259,7 @@ ${lanes.join("\n")} } return 1; } - if (!isIdentifier27() && second !== 110) { + if (!isIdentifier29() && second !== 110) { return 0; } switch (nextToken()) { @@ -60007,7 +63282,7 @@ ${lanes.join("\n")} first2 === 30 /* LessThanToken */ ); - if (!isIdentifier27() && token() !== 87) { + if (!isIdentifier29() && token() !== 87) { return 0; } if (languageVariant === 1) { @@ -60736,7 +64011,7 @@ ${lanes.join("\n")} ); return finishNode(factory2.createJsxSpreadAttribute(expression), pos); } - function parseJsxClosingElement(open2, inExpressionContext) { + function parseJsxClosingElement(open, inExpressionContext) { const pos = getNodePos(); parseExpected( 31 @@ -60750,7 +64025,7 @@ ${lanes.join("\n")} /*shouldAdvance*/ false )) { - if (inExpressionContext || !tagNamesAreEquivalent(open2.tagName, tagName)) { + if (inExpressionContext || !tagNamesAreEquivalent(open.tagName, tagName)) { nextToken(); } else { scanJsxText(); @@ -60804,13 +64079,13 @@ ${lanes.join("\n")} if (node.flags & 64) { return true; } - if (isNonNullExpression5(node)) { + if (isNonNullExpression6(node)) { let expr = node.expression; - while (isNonNullExpression5(expr) && !(expr.flags & 64)) { + while (isNonNullExpression6(expr) && !(expr.flags & 64)) { expr = expr.expression; } if (expr.flags & 64) { - while (isNonNullExpression5(node)) { + while (isNonNullExpression6(node)) { node.flags |= 64; node = node.expression; } @@ -61175,7 +64450,7 @@ ${lanes.join("\n")} 42 /* AsteriskToken */ ); - const tokenIsIdentifier = isIdentifier27(); + const tokenIsIdentifier = isIdentifier29(); const name = parsePropertyName(); const questionToken = parseOptionalToken( 58 @@ -61681,7 +64956,7 @@ ${lanes.join("\n")} let node; const hasParen = token() === 21; const expression = allowInAnd(parseExpression); - if (isIdentifier26(expression) && parseOptional( + if (isIdentifier28(expression) && parseOptional( 59 /* ColonToken */ )) { @@ -61983,7 +65258,7 @@ ${lanes.join("\n")} case 89: return parseDebuggerStatement(); case 60: - return parseDeclaration(); + return parseDeclaration2(); case 134: case 120: case 156: @@ -62003,7 +65278,7 @@ ${lanes.join("\n")} case 148: case 162: if (isStartOfDeclaration()) { - return parseDeclaration(); + return parseDeclaration2(); } break; } @@ -62012,7 +65287,7 @@ ${lanes.join("\n")} function isDeclareModifier(modifier) { return modifier.kind === 138; } - function parseDeclaration() { + function parseDeclaration2() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const modifiers = parseModifiers( @@ -62100,7 +65375,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner2.hasPrecedingLineBreak() && (isIdentifier27() || token() === 11); + return !scanner2.hasPrecedingLineBreak() && (isIdentifier29() || token() === 11); } function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { if (token() !== 19) { @@ -62936,16 +66211,16 @@ ${lanes.join("\n")} ); const afterImportPos = scanner2.getTokenFullStart(); let identifier; - if (isIdentifier27()) { + if (isIdentifier29()) { identifier = parseIdentifier(); } let phaseModifier; - if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 || isIdentifier27() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier27() || tokenAfterImportDefinitelyProducesImportDeclaration())) { + if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 || isIdentifier29() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier29() || tokenAfterImportDefinitelyProducesImportDeclaration())) { phaseModifier = 156; - identifier = isIdentifier27() ? parseIdentifier() : void 0; + identifier = isIdentifier29() ? parseIdentifier() : void 0; } else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && (token() === 161 ? !lookAhead(nextTokenIsStringLiteral) : token() !== 28 && token() !== 64)) { phaseModifier = 166; - identifier = isIdentifier27() ? parseIdentifier() : void 0; + identifier = isIdentifier29() ? parseIdentifier() : void 0; } if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() && phaseModifier !== 166) { return parseImportEqualsDeclaration( @@ -63171,7 +66446,7 @@ ${lanes.join("\n")} } function parseImportOrExportSpecifier(kind) { const pos = getNodePos(); - let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier27(); + let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier29(); let checkIdentifierStart = scanner2.getTokenStart(); let checkIdentifierEnd = scanner2.getTokenEnd(); let isTypeOnly = false; @@ -63229,7 +66504,7 @@ ${lanes.join("\n")} const node = kind === 277 ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); function parseNameWithKeywordCheck() { - checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier27(); + checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier29(); checkIdentifierStart = scanner2.getTokenStart(); checkIdentifierEnd = scanner2.getTokenEnd(); return parseIdentifierName(); @@ -63987,7 +67262,7 @@ ${lanes.join("\n")} case 189: return isObjectOrObjectArrayTypeReference(node.elementType); default: - return isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; + return isTypeReferenceNode3(node) && isIdentifier28(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; } } function parseParameterOrPropertyTag(start2, tagName, target, indent3) { @@ -64108,7 +67383,7 @@ ${lanes.join("\n")} function parseImportTag(start2, tagName, margin, indentText) { const afterImportTagPos = scanner2.getTokenFullStart(); let identifier; - if (isIdentifier27()) { + if (isIdentifier29()) { identifier = parseIdentifier(); } const importClause = tryParseImportClause( @@ -64303,8 +67578,8 @@ ${lanes.join("\n")} return finishNode(factory2.createJSDocOverloadTag(tagName, typeExpression, comment), start2, end2); } function escapedTextsEqual(a, b) { - while (!isIdentifier26(a) || !isIdentifier26(b)) { - if (!isIdentifier26(a) && !isIdentifier26(b) && a.right.escapedText === b.right.escapedText) { + while (!isIdentifier28(a) || !isIdentifier28(b)) { + if (!isIdentifier28(a) && !isIdentifier28(b) && a.right.escapedText === b.right.escapedText) { a = a.left; b = b.left; } else { @@ -64324,7 +67599,7 @@ ${lanes.join("\n")} case 60: if (canParseTag) { const child = tryParseChildTag(target, indent3); - if (child && (child.kind === 342 || child.kind === 349) && name && (isIdentifier26(child.name) || !escapedTextsEqual(name, child.name.left))) { + if (child && (child.kind === 342 || child.kind === 349) && name && (isIdentifier28(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } return child; @@ -64923,44 +68198,44 @@ ${lanes.join("\n")} reportDiagnostic(pos, end - pos, Diagnostics.resolution_mode_should_be_either_require_or_import); return void 0; } - function processCommentPragmas(context, sourceText) { + function processCommentPragmas(context2, sourceText) { const pragmas = []; for (const range of getLeadingCommentRanges(sourceText, 0) || emptyArray) { const comment = sourceText.substring(range.pos, range.end); extractPragmas(pragmas, range, comment); } - context.pragmas = /* @__PURE__ */ new Map(); + context2.pragmas = /* @__PURE__ */ new Map(); for (const pragma of pragmas) { - if (context.pragmas.has(pragma.name)) { - const currentValue = context.pragmas.get(pragma.name); + if (context2.pragmas.has(pragma.name)) { + const currentValue = context2.pragmas.get(pragma.name); if (currentValue instanceof Array) { currentValue.push(pragma.args); } else { - context.pragmas.set(pragma.name, [currentValue, pragma.args]); + context2.pragmas.set(pragma.name, [currentValue, pragma.args]); } continue; } - context.pragmas.set(pragma.name, pragma.args); + context2.pragmas.set(pragma.name, pragma.args); } } - function processPragmasIntoFields(context, reportDiagnostic) { - context.checkJsDirective = void 0; - context.referencedFiles = []; - context.typeReferenceDirectives = []; - context.libReferenceDirectives = []; - context.amdDependencies = []; - context.hasNoDefaultLib = false; - context.pragmas.forEach((entryOrList, key) => { + function processPragmasIntoFields(context2, reportDiagnostic) { + context2.checkJsDirective = void 0; + context2.referencedFiles = []; + context2.typeReferenceDirectives = []; + context2.libReferenceDirectives = []; + context2.amdDependencies = []; + context2.hasNoDefaultLib = false; + context2.pragmas.forEach((entryOrList, key) => { switch (key) { case "reference": { - const referencedFiles = context.referencedFiles; - const typeReferenceDirectives = context.typeReferenceDirectives; - const libReferenceDirectives = context.libReferenceDirectives; + const referencedFiles = context2.referencedFiles; + const typeReferenceDirectives = context2.typeReferenceDirectives; + const libReferenceDirectives = context2.libReferenceDirectives; forEach(toArray(entryOrList), (arg) => { const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments; const preserve = _preserve === "true" ? true : void 0; if (arg.arguments["no-default-lib"] === "true") { - context.hasNoDefaultLib = true; + context2.hasNoDefaultLib = true; } else if (types) { const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic); typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {}, ...preserve ? { preserve } : {} }); @@ -64975,7 +68250,7 @@ ${lanes.join("\n")} break; } case "amd-dependency": { - context.amdDependencies = map2( + context2.amdDependencies = map2( toArray(entryOrList), (x) => ({ name: x.arguments.name, path: x.arguments.path }) ); @@ -64984,21 +68259,21 @@ ${lanes.join("\n")} case "amd-module": { if (entryOrList instanceof Array) { for (const entry of entryOrList) { - if (context.moduleName) { + if (context2.moduleName) { reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments); } - context.moduleName = entry.arguments.name; + context2.moduleName = entry.arguments.name; } } else { - context.moduleName = entryOrList.arguments.name; + context2.moduleName = entryOrList.arguments.name; } break; } case "ts-nocheck": case "ts-check": { forEach(toArray(entryOrList), (entry) => { - if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { - context.checkJsDirective = { + if (!context2.checkJsDirective || entry.range.pos > context2.checkJsDirective.pos) { + context2.checkJsDirective = { enabled: key === "ts-check", end: entry.range.end, pos: entry.range.pos @@ -67016,7 +70291,7 @@ ${lanes.join("\n")} host.onUnRecoverableConfigFileDiagnostic(configFileText); return void 0; } - const result = parseJsonText(configFileName, configFileText); + const result = parseJsonText2(configFileName, configFileText); const cwd = host.getCurrentDirectory(); result.path = toPath(configFileName, cwd, createGetCanonicalFileName(host.useCaseSensitiveFileNames)); result.resolvedPath = result.path; @@ -67039,7 +70314,7 @@ ${lanes.join("\n")} return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic }; } function parseConfigFileTextToJson(fileName, jsonText) { - const jsonSourceFile = parseJsonText(fileName, jsonText); + const jsonSourceFile = parseJsonText2(fileName, jsonText); return { config: convertConfigFileToObject( jsonSourceFile, @@ -67052,7 +70327,7 @@ ${lanes.join("\n")} } function readJsonConfigFile(fileName, readFile4) { const textOrDiagnostic = tryReadFile(fileName, readFile4); - return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] }; + return isString(textOrDiagnostic) ? parseJsonText2(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] }; } function tryReadFile(fileName, readFile4) { let text; @@ -67189,7 +70464,7 @@ ${lanes.join("\n")} getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json" )); if (isArrayLiteralExpression7(rootExpression)) { - const firstObject = find(rootExpression.elements, isObjectLiteralExpression12); + const firstObject = find(rootExpression.elements, isObjectLiteralExpression13); if (firstObject) { return convertToJson( sourceFile, @@ -68392,8 +71667,8 @@ ${lanes.join("\n")} ".json" /* Json */ )); - const includeFilePatterns = map2(getRegularExpressionsForWildcards(includes, basePath, "files"), (pattern) => `^${pattern}$`); - jsonOnlyIncludeRegexes = includeFilePatterns ? includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, host.useCaseSensitiveFileNames)) : emptyArray; + const includeFilePatterns = map2(getRegularExpressionsForWildcards(includes, basePath, "files"), (pattern2) => `^${pattern2}$`); + jsonOnlyIncludeRegexes = includeFilePatterns ? includeFilePatterns.map((pattern2) => getRegexFromPattern(pattern2, host.useCaseSensitiveFileNames)) : emptyArray; } const includeIndex = findIndex(jsonOnlyIncludeRegexes, (re) => re.test(file2)); if (includeIndex !== -1) { @@ -69405,11 +72680,11 @@ ${lanes.join("\n")} if (i < rootLength) { return void 0; } - const sep2 = directory.lastIndexOf(directorySeparator, i - 1); - if (sep2 === -1) { + const sep4 = directory.lastIndexOf(directorySeparator, i - 1); + if (sep4 === -1) { return void 0; } - return directory.substr(0, Math.max(sep2, rootLength)); + return directory.substr(0, Math.max(sep4, rootLength)); } } } @@ -70716,10 +73991,10 @@ ${lanes.join("\n")} } function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetExportOrImport; - function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) { + function loadModuleFromTargetExportOrImport(target, subpath, pattern2, key) { var _a3, _b; if (typeof target === "string") { - if (!pattern && subpath.length > 0 && !endsWith(target, "/")) { + if (!pattern2 && subpath.length > 0 && !endsWith(target, "/")) { if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); } @@ -70730,7 +74005,7 @@ ${lanes.join("\n")} } if (!startsWith(target, "./")) { if (isImports && !startsWith(target, "../") && !startsWith(target, "/") && !isRootedDiskPath(target)) { - const combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + const combinedLookup = pattern2 ? target.replace(/\*/g, subpath) : target + subpath; traceIfEnabled(state, Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); traceIfEnabled(state, Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); const result = nodeModuleNameResolverWorker( @@ -70789,9 +74064,9 @@ ${lanes.join("\n")} ); } if (state.traceEnabled) { - trace(state.host, Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + trace(state.host, Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern2 ? target.replace(/\*/g, subpath) : target + subpath); } - const finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); + const finalPath = toAbsolutePath(pattern2 ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) return inputLink; return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField( @@ -70809,7 +74084,7 @@ ${lanes.join("\n")} if (condition === "default" || state.conditions.includes(condition) || isApplicableVersionedTypesKey(state.conditions, condition)) { traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); const subTarget = target[condition]; - const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern, key); + const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern2, key); if (result) { traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition); traceIfEnabled(state, Diagnostics.Exiting_conditional_exports); @@ -70834,7 +74109,7 @@ ${lanes.join("\n")} ); } for (const elem of target) { - const result = loadModuleFromTargetExportOrImport(elem, subpath, pattern, key); + const result = loadModuleFromTargetExportOrImport(elem, subpath, pattern2, key); if (result) { return result; } @@ -71784,9 +75059,9 @@ ${lanes.join("\n")} return symbol2; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - const hasExportModifier2 = !!(getCombinedModifierFlags(node) & 32) || jsdocTreatAsExported(node); + const hasExportModifier3 = !!(getCombinedModifierFlags(node) & 32) || jsdocTreatAsExported(node); if (symbolFlags & 2097152) { - if (node.kind === 282 || node.kind === 272 && hasExportModifier2) { + if (node.kind === 282 || node.kind === 272 && hasExportModifier3) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { Debug.assertNode(container, canHaveLocals); @@ -71801,7 +75076,7 @@ ${lanes.join("\n")} } } else { if (isJSDocTypeAlias(node)) Debug.assert(isInJSFile(node)); - if (!isAmbientModule(node) && (hasExportModifier2 || container.flags & 128)) { + if (!isAmbientModule(node) && (hasExportModifier3 || container.flags & 128)) { if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier( node, 2048 @@ -71928,7 +75203,7 @@ ${lanes.join("\n")} } else if (containerFlags & 64) { seenThisKeyword = false; bindChildren(node); - Debug.assertNotNode(node, isIdentifier26); + Debug.assertNotNode(node, isIdentifier28); node.flags = seenThisKeyword ? node.flags | 256 : node.flags & ~256; } else { bindChildren(node); @@ -72281,7 +75556,7 @@ ${lanes.join("\n")} return isLogicalOrCoalescingAssignmentExpression(skipParentheses(node)); } function isTopLevelLogicalExpression(node) { - while (isParenthesizedExpression7(node.parent) || isPrefixUnaryExpression4(node.parent) && node.parent.operator === 54) { + while (isParenthesizedExpression8(node.parent) || isPrefixUnaryExpression4(node.parent) && node.parent.operator === 54) { node = node.parent; } return !isStatementCondition(node) && !isLogicalExpression(node.parent) && !(isOptionalChain2(node.parent) && node.parent.expression === node); @@ -72935,7 +76210,7 @@ ${lanes.join("\n")} } if (node.expression.kind === 212) { const propertyAccess = node.expression; - if (isIdentifier26(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { + if (isIdentifier28(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256, currentFlow, node); } } @@ -73011,7 +76286,7 @@ ${lanes.join("\n")} } function hasExportDeclarations(node) { const body = isSourceFile(node) ? node : tryCast(node.body, isModuleBlock); - return !!body && body.statements.some((s) => isExportDeclaration2(s) || isExportAssignment3(s)); + return !!body && body.statements.some((s) => isExportDeclaration3(s) || isExportAssignment4(s)); } function setExportContextFlag(node) { if (node.flags & 33554432 && !hasExportDeclarations(node)) { @@ -73033,11 +76308,11 @@ ${lanes.join("\n")} if (isModuleAugmentationExternal(node)) { declareModuleSymbol(node); } else { - let pattern; + let pattern2; if (node.name.kind === 11) { const { text } = node.name; - pattern = tryParsePattern(text); - if (pattern === void 0) { + pattern2 = tryParsePattern(text); + if (pattern2 === void 0) { errorOnFirstToken(node.name, Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text); } } @@ -73047,7 +76322,7 @@ ${lanes.join("\n")} 110735 /* ValueModuleExcludes */ ); - file2.patternAmbientModules = append(file2.patternAmbientModules, pattern && !isString(pattern) ? { pattern, symbol: symbol2 } : void 0); + file2.patternAmbientModules = append(file2.patternAmbientModules, pattern2 && !isString(pattern2) ? { pattern: pattern2, symbol: symbol2 } : void 0); } } else { const state = declareModuleSymbol(node); @@ -73174,7 +76449,7 @@ ${lanes.join("\n")} file2.symbol, declName.parent, isTopLevel, - !!findAncestor(declName, (d) => isPropertyAccessExpression16(d) && d.name.escapedText === "prototype"), + !!findAncestor(declName, (d) => isPropertyAccessExpression17(d) && d.name.escapedText === "prototype"), /*containerIsClass*/ false ); @@ -73195,7 +76470,7 @@ ${lanes.join("\n")} container = declName.parent.expression.name; break; case 5: - container = isExportsOrModuleExportsOrAlias(file2, declName.parent.expression) ? file2 : isPropertyAccessExpression16(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression; + container = isExportsOrModuleExportsOrAlias(file2, declName.parent.expression) ? file2 : isPropertyAccessExpression17(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression; break; case 0: return Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration"); @@ -73311,7 +76586,7 @@ ${lanes.join("\n")} } } function isEvalOrArgumentsIdentifier(node) { - return isIdentifier26(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); + return isIdentifier28(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { if (name && name.kind === 80) { @@ -73372,7 +76647,7 @@ ${lanes.join("\n")} } function checkStrictModeLabeledStatement(node) { if (inStrictMode && getEmitScriptTarget(options) >= 2) { - if (isDeclarationStatement(node.statement) || isVariableStatement11(node.statement)) { + if (isDeclarationStatement(node.statement) || isVariableStatement12(node.statement)) { errorOnFirstToken(node.label, Diagnostics.A_label_is_not_allowed_here); } } @@ -73535,7 +76810,7 @@ ${lanes.join("\n")} break; case 5: const expression = node.left.expression; - if (isInJSFile(node) && isIdentifier26(expression)) { + if (isInJSFile(node) && isIdentifier28(expression)) { const symbol2 = lookupSymbolForName(blockScopeContainer, expression.escapedText); if (isThisInitializedDeclaration(symbol2 == null ? void 0 : symbol2.valueDeclaration)) { bindThisPropertyAssignment(node); @@ -73952,7 +77227,7 @@ ${lanes.join("\n")} if (isEmptyObjectLiteral(assignedExpression) || container === file2 && isExportsOrModuleExportsOrAlias(file2, assignedExpression)) { return; } - if (isObjectLiteralExpression12(assignedExpression) && every(assignedExpression.properties, isShorthandPropertyAssignment6)) { + if (isObjectLiteralExpression13(assignedExpression) && every(assignedExpression.properties, isShorthandPropertyAssignment7)) { forEach(assignedExpression.properties, bindExportAssignedObjectMemberAlias); return; } @@ -73979,7 +77254,7 @@ ${lanes.join("\n")} } function bindThisPropertyAssignment(node) { Debug.assert(isInJSFile(node)); - const hasPrivateIdentifier = isBinaryExpression4(node) && isPropertyAccessExpression16(node.left) && isPrivateIdentifier(node.left.name) || isPropertyAccessExpression16(node) && isPrivateIdentifier(node.name); + const hasPrivateIdentifier = isBinaryExpression4(node) && isPropertyAccessExpression17(node.left) && isPrivateIdentifier(node.left.name) || isPropertyAccessExpression17(node) && isPrivateIdentifier(node.name); if (hasPrivateIdentifier) { return; } @@ -74172,12 +77447,12 @@ ${lanes.join("\n")} return; } const rootExpr = getLeftmostAccessExpression(node.left); - if (isIdentifier26(rootExpr) && ((_a3 = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a3.flags) & 2097152) { + if (isIdentifier28(rootExpr) && ((_a3 = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a3.flags) & 2097152) { return; } setParent(node.left, node); setParent(node.right, node); - if (isIdentifier26(node.left.expression) && container === file2 && isExportsOrModuleExportsOrAlias(file2, node.left.expression)) { + if (isIdentifier28(node.left.expression) && container === file2 && isExportsOrModuleExportsOrAlias(file2, node.left.expression)) { bindExportsPropertyAssignment(node); } else if (hasDynamicName(node)) { bindAnonymousDeclaration( @@ -74201,7 +77476,7 @@ ${lanes.join("\n")} } } function bindStaticPropertyAssignment(node) { - Debug.assert(!isIdentifier26(node)); + Debug.assert(!isIdentifier28(node)); setParent(node.expression, node); bindPropertyAssignment( node.expression, @@ -74252,14 +77527,14 @@ ${lanes.join("\n")} } else if (isCallExpression16(declaration) && isBindableObjectDefinePropertyCall(declaration)) { if (some(declaration.arguments[2].properties, (p) => { const id = getNameOfDeclaration(p); - return !!id && isIdentifier26(id) && idText(id) === "set"; + return !!id && isIdentifier28(id) && idText(id) === "set"; })) { includes |= 65536 | 4; excludes |= 78783; } if (some(declaration.arguments[2].properties, (p) => { const id = getNameOfDeclaration(p); - return !!id && isIdentifier26(id) && idText(id) === "get"; + return !!id && isIdentifier28(id) && idText(id) === "get"; })) { includes |= 32768 | 4; excludes |= 46015; @@ -74295,7 +77570,7 @@ ${lanes.join("\n")} if (node && isCallExpression16(node)) { return !!getAssignedExpandoInitializer(node); } - let init = !node ? void 0 : isVariableDeclaration7(node) ? node.initializer : isBinaryExpression4(node) ? node.right : isPropertyAccessExpression16(node) && isBinaryExpression4(node.parent) ? node.parent.right : void 0; + let init = !node ? void 0 : isVariableDeclaration7(node) ? node.initializer : isBinaryExpression4(node) ? node.right : isPropertyAccessExpression17(node) && isBinaryExpression4(node.parent) ? node.parent.right : void 0; init = init && getRightMostAssignedExpression(init); if (init) { const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration7(node) ? node.name : isBinaryExpression4(node) ? node.left : node); @@ -74310,7 +77585,7 @@ ${lanes.join("\n")} return expr.parent; } function lookupSymbolForPropertyAccess(node, lookupContainer = container) { - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { return lookupSymbolForName(lookupContainer, node.escapedText); } else { const symbol2 = lookupSymbolForPropertyAccess(node.expression); @@ -74320,7 +77595,7 @@ ${lanes.join("\n")} function forEachIdentifierInEntityName(e, parent3, action) { if (isExportsOrModuleExportsOrAlias(file2, e)) { return file2.symbol; - } else if (isIdentifier26(e)) { + } else if (isIdentifier28(e)) { return action(e, lookupSymbolForPropertyAccess(e), parent3); } else { const s = forEachIdentifierInEntityName(e.expression, parent3, action); @@ -74569,7 +77844,7 @@ ${lanes.join("\n")} if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { - const isError = unreachableCodeIsError(options) && !(node.flags & 33554432) && (!isVariableStatement11(node) || !!(getCombinedNodeFlags(node.declarationList) & 7) || node.declarationList.declarations.some((d) => !!d.initializer)); + const isError = unreachableCodeIsError(options) && !(node.flags & 33554432) && (!isVariableStatement12(node) || !!(getCombinedNodeFlags(node.declarationList) & 7) || node.declarationList.declarations.some((d) => !!d.initializer)); eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected)); } } @@ -74590,7 +77865,7 @@ ${lanes.join("\n")} } function isExecutableStatement(s) { return !isFunctionDeclaration5(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above - !(isVariableStatement11(s) && !(getCombinedNodeFlags(s) & 7) && s.declarationList.declarations.some((d) => !d.initializer)); + !(isVariableStatement12(s) && !(getCombinedNodeFlags(s) & 7) && s.declarationList.declarations.some((d) => !d.initializer)); } function isPurelyTypeDeclaration(s) { switch (s.kind) { @@ -74615,7 +77890,7 @@ ${lanes.join("\n")} node = q3.dequeue(); if (isExportsIdentifier(node) || isModuleExportsAccessExpression(node)) { return true; - } else if (isIdentifier26(node)) { + } else if (isIdentifier28(node)) { const symbol2 = lookupSymbolForName(sourceFile, node.escapedText); if (!!symbol2 && !!symbol2.valueDeclaration && isVariableDeclaration7(symbol2.valueDeclaration) && !!symbol2.valueDeclaration.initializer) { const init = symbol2.valueDeclaration.initializer; @@ -74869,24 +78144,24 @@ ${lanes.join("\n")} tryGetRealFileNameForNonJsDeclarationFileName: () => tryGetRealFileNameForNonJsDeclarationFileName, updateModuleSpecifier: () => updateModuleSpecifier }); - var stringToRegex = memoizeOne((pattern) => { + var stringToRegex = memoizeOne((pattern2) => { try { - let slash = pattern.indexOf("/"); + let slash = pattern2.indexOf("/"); if (slash !== 0) { - return new RegExp(pattern); + return new RegExp(pattern2); } - const lastSlash = pattern.lastIndexOf("/"); + const lastSlash = pattern2.lastIndexOf("/"); if (slash === lastSlash) { - return new RegExp(pattern); + return new RegExp(pattern2); } - while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) { - if (pattern[slash - 1] !== "\\") { - return new RegExp(pattern); + while ((slash = pattern2.indexOf("/", slash + 1)) !== lastSlash) { + if (pattern2[slash - 1] !== "\\") { + return new RegExp(pattern2); } } - const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, ""); - pattern = pattern.substring(1, lastSlash); - return new RegExp(pattern, flags); + const flags = pattern2.substring(lastSlash + 1).replace(/[^iu]/g, ""); + pattern2 = pattern2.substring(1, lastSlash); + return new RegExp(pattern2, flags); } catch { return void 0; } @@ -75008,8 +78283,8 @@ ${lanes.join("\n")} } function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) { const info = getInfo(importingSourceFile.fileName, host); - const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, compilerOptions, options); - return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule( + const modulePaths2 = getAllModulePaths(info, nodeModulesFileName, host, preferences, compilerOptions, options); + return firstDefined(modulePaths2, (modulePath) => tryGetModuleNameAsNodeModule( modulePath, info, importingSourceFile, @@ -75023,8 +78298,8 @@ ${lanes.join("\n")} } function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) { const info = getInfo(importingSourceFileName, host); - const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, compilerOptions, options); - return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule( + const modulePaths2 = getAllModulePaths(info, toFileName2, host, userPreferences, compilerOptions, options); + return firstDefined(modulePaths2, (modulePath) => tryGetModuleNameAsNodeModule( modulePath, info, importingSourceFile, @@ -75079,7 +78354,7 @@ ${lanes.join("\n")} computedWithoutCache }; } - let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker( + let [kind, specifiers, moduleSourceFile, modulePaths2, cache] = tryGetModuleSpecifiersFromCacheWorker( moduleSymbol, importingSourceFile, host, @@ -75089,9 +78364,9 @@ ${lanes.join("\n")} if (specifiers) return { kind, moduleSpecifiers: specifiers, computedWithoutCache }; if (!moduleSourceFile) return { kind: void 0, moduleSpecifiers: emptyArray, computedWithoutCache }; computedWithoutCache = true; - modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options)); + modulePaths2 || (modulePaths2 = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options)); const result = computeModuleSpecifiers( - modulePaths, + modulePaths2, compilerOptions, importingSourceFile, host, @@ -75099,7 +78374,7 @@ ${lanes.join("\n")} options, forAutoImport ); - cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers); + cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths2, result.moduleSpecifiers); return result; } function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, preferences, options = {}) { @@ -75114,10 +78389,10 @@ ${lanes.join("\n")} getModuleSpecifierPreferences(preferences, host, compilerOptions, importingFile) ); } - function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) { + function computeModuleSpecifiers(modulePaths2, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) { const info = getInfo(importingSourceFile.fileName, host); const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile); - const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach( + const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths2, (modulePath) => forEach( host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), (reason) => { if (reason.kind !== 3 || reason.file !== importingSourceFile.path) return void 0; @@ -75133,12 +78408,12 @@ ${lanes.join("\n")} if (existingSpecifier) { return { kind: void 0, moduleSpecifiers: [existingSpecifier], computedWithoutCache: true }; } - const importedFileIsInNodeModules = some(modulePaths, (p) => p.isInNodeModules); + const importedFileIsInNodeModules = some(modulePaths2, (p) => p.isInNodeModules); let nodeModulesSpecifiers; let pathsSpecifiers; let redirectPathsSpecifiers; let relativeSpecifiers; - for (const modulePath of modulePaths) { + for (const modulePath of modulePaths2) { const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule( modulePath, info, @@ -75184,9 +78459,9 @@ ${lanes.join("\n")} return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true }; } function isExcludedByRegex(moduleSpecifier, excludeRegexes) { - return some(excludeRegexes, (pattern) => { + return some(excludeRegexes, (pattern2) => { var _a3; - return !!((_a3 = stringToRegex(pattern)) == null ? void 0 : _a3.test(moduleSpecifier)); + return !!((_a3 = stringToRegex(pattern2)) == null ? void 0 : _a3.test(moduleSpecifier)); }); } function getInfo(importingSourceFileName, host) { @@ -75315,9 +78590,9 @@ ${lanes.join("\n")} if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) { return; } - const relative7 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName); + const relative8 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName); for (const symlinkDirectory of symlinkDirectories) { - const option = resolvePath3(symlinkDirectory, relative7); + const option = resolvePath3(symlinkDirectory, relative8); const result2 = cb(option, target === referenceRedirect); shouldFilterIgnoredPaths = true; if (result2) return result2; @@ -75336,11 +78611,11 @@ ${lanes.join("\n")} const cached2 = cache.get(importingFilePath, importedFilePath, preferences, options); if (cached2 == null ? void 0 : cached2.modulePaths) return cached2.modulePaths; } - const modulePaths = getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options); + const modulePaths2 = getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options); if (cache) { - cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths); + cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths2); } - return modulePaths; + return modulePaths2; } var runtimeDependencyFields = ["dependencies", "peerDependencies", "optionalDependencies"]; function getAllRuntimeDependencies(packageJson) { @@ -75457,18 +78732,18 @@ ${lanes.join("\n")} for (const key in paths) { for (const patternText2 of paths[key]) { const normalized = normalizePath(patternText2); - const pattern = getRelativePathIfInSameVolume(normalized, baseDirectory, getCanonicalFileName) ?? normalized; - const indexOfStar = pattern.indexOf("*"); + const pattern2 = getRelativePathIfInSameVolume(normalized, baseDirectory, getCanonicalFileName) ?? normalized; + const indexOfStar = pattern2.indexOf("*"); const candidates = allowedEndings.map((ending) => ({ ending, value: processEnding(relativeToBaseUrl, [ending], compilerOptions) })); - if (tryGetExtensionFromPath2(pattern)) { + if (tryGetExtensionFromPath2(pattern2)) { candidates.push({ ending: void 0, value: relativeToBaseUrl }); } if (indexOfStar !== -1) { - const prefix = pattern.substring(0, indexOfStar); - const suffix = pattern.substring(indexOfStar + 1); + const prefix = pattern2.substring(0, indexOfStar); + const suffix = pattern2.substring(indexOfStar + 1); for (const { ending, value } of candidates) { if (value.length >= prefix.length + suffix.length && startsWith(value, prefix) && endsWith(value, suffix) && validateEnding({ ending, value })) { const matchedStar = value.substring(prefix.length, value.length - suffix.length); @@ -75477,7 +78752,7 @@ ${lanes.join("\n")} } } } - } else if (some(candidates, (c) => c.ending !== 0 && pattern === c.value) || some(candidates, (c) => c.ending === 0 && pattern === c.value && validateEnding(c))) { + } else if (some(candidates, (c) => c.ending !== 0 && pattern2 === c.value) || some(candidates, (c) => c.ending === 0 && pattern2 === c.value && validateEnding(c))) { return key; } } @@ -76349,7 +79624,7 @@ ${lanes.join("\n")} return node && getTypeOfAssignmentPattern(node) || errorType; }, getPropertySymbolOfDestructuringAssignment: (locationIn) => { - const location = getParseTreeNode(locationIn, isIdentifier26); + const location = getParseTreeNode(locationIn, isIdentifier28); return location ? getPropertySymbolOfDestructuringAssignment(location) : void 0; }, signatureToString: (signature, enclosingDeclaration, flags, kind) => { @@ -76439,7 +79714,7 @@ ${lanes.join("\n")} return !!node && isValidPropertyAccess(node, escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: (nodeIn, type, property) => { - const node = getParseTreeNode(nodeIn, isPropertyAccessExpression16); + const node = getParseTreeNode(nodeIn, isPropertyAccessExpression17); return !!node && isValidPropertyAccessForCompletions(node, type, property); }, getSignatureFromDeclaration: (declarationIn) => { @@ -76451,7 +79726,7 @@ ${lanes.join("\n")} return node ? isImplementationOfOverload(node) : void 0; }, getImmediateAliasedSymbol, - getAliasedSymbol: resolveAlias, + getAliasedSymbol: resolveAlias2, getEmitResolver, requiresAddingImplicitUndefined, getExportsOfModule: getExportsOfModuleAsArray, @@ -77205,10 +80480,10 @@ ${lanes.join("\n")} initializeTypeChecker(); return checker; function isDefinitelyReferenceToGlobalSymbolObject(node) { - if (!isPropertyAccessExpression16(node)) return false; - if (!isIdentifier26(node.name)) return false; - if (!isPropertyAccessExpression16(node.expression) && !isIdentifier26(node.expression)) return false; - if (isIdentifier26(node.expression)) { + if (!isPropertyAccessExpression17(node)) return false; + if (!isIdentifier28(node.name)) return false; + if (!isPropertyAccessExpression17(node.expression) && !isIdentifier28(node.expression)) return false; + if (isIdentifier28(node.expression)) { return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol( "Symbol", 111551 | 1048576, @@ -77216,7 +80491,7 @@ ${lanes.join("\n")} void 0 ) || unknownSymbol); } - if (!isIdentifier26(node.expression.expression)) return false; + if (!isIdentifier28(node.expression.expression)) return false; return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol; } function getCachedType(key) { @@ -77803,7 +81078,7 @@ ${lanes.join("\n")} } if (isPropertyDeclaration(declaration2) && getContainingClass(usage2) === getContainingClass(declaration2)) { const propName2 = declaration2.name; - if (isIdentifier26(propName2) || isPrivateIdentifier(propName2)) { + if (isIdentifier28(propName2) || isPrivateIdentifier(propName2)) { const type = getTypeOfSymbol(getSymbolOfDeclaration(declaration2)); const staticBlocks = filter(declaration2.parent.members, isClassStaticBlockDeclaration); if (isPropertyInitializedInStaticBlocks(propName2, type, staticBlocks, declaration2.parent.pos, current.pos)) { @@ -78003,7 +81278,7 @@ ${lanes.join("\n")} return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg); } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { - if (!isIdentifier26(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) { + if (!isIdentifier28(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) { return false; } const container = getThisContainer( @@ -78291,7 +81566,7 @@ ${lanes.join("\n")} const commonJSPropertyAccess = getCommonJSPropertyAccess(node); if (commonJSPropertyAccess) { const name = getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0]; - return isIdentifier26(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; + return isIdentifier28(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; } if (isVariableDeclaration7(node) || node.moduleReference.kind === 284) { const immediate = resolveExternalModuleName( @@ -78357,7 +81632,7 @@ ${lanes.join("\n")} return resolved; } function isSyntacticDefault(node) { - return isExportAssignment3(node) && !node.isExportEquals || hasSyntacticModifier( + return isExportAssignment4(node) && !node.isExportEquals || hasSyntacticModifier( node, 2048 /* Default */ @@ -78549,7 +81824,7 @@ ${lanes.join("\n")} const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find( (decl) => { var _a22, _b2; - return !!(isExportDeclaration2(decl) && decl.moduleSpecifier && ((_b2 = (_a22 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a22.exports) == null ? void 0 : _b2.has( + return !!(isExportDeclaration3(decl) && decl.moduleSpecifier && ((_b2 = (_a22 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a22.exports) == null ? void 0 : _b2.has( "default" /* Default */ ))); @@ -78645,8 +81920,8 @@ ${lanes.join("\n")} var _a3; const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier; const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); - const name = !isPropertyAccessExpression16(specifier) && specifier.propertyName || specifier.name; - if (!isIdentifier26(name) && name.kind !== 11) { + const name = !isPropertyAccessExpression17(specifier) && specifier.propertyName || specifier.name; + if (!isIdentifier28(name) && name.kind !== 11) { return void 0; } const nameText = moduleExportNameTextEscaped(name); @@ -78699,7 +81974,7 @@ ${lanes.join("\n")} var _a3; const moduleName = getFullyQualifiedName(moduleSymbol, node); const declarationName = declarationNameToString(name); - const suggestion = isIdentifier26(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0; + const suggestion = isIdentifier28(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0; if (suggestion !== void 0) { const suggestionName = symbolToString(suggestion); const diagnostic = error210(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); @@ -78770,7 +82045,7 @@ ${lanes.join("\n")} const commonJSPropertyAccess = getCommonJSPropertyAccess(root); const resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias); const name = node.propertyName || node.name; - if (commonJSPropertyAccess && resolved && isIdentifier26(name)) { + if (commonJSPropertyAccess && resolved && isIdentifier28(name)) { return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias); } markSymbolOfAliasDeclarationIfTypeOnly( @@ -78784,7 +82059,7 @@ ${lanes.join("\n")} return resolved; } function getCommonJSPropertyAccess(node) { - if (isVariableDeclaration7(node) && node.initializer && isPropertyAccessExpression16(node.initializer)) { + if (isVariableDeclaration7(node) && node.initializer && isPropertyAccessExpression17(node.initializer)) { return node.initializer; } } @@ -78832,7 +82107,7 @@ ${lanes.join("\n")} return resolved; } function getTargetOfExportAssignment(node, dontResolveAlias) { - const expression = isExportAssignment3(node) ? node.expression : node.right; + const expression = isExportAssignment4(node) ? node.expression : node.right; const resolved = getTargetOfAliasLikeExpression(expression, dontResolveAlias); markSymbolOfAliasDeclarationIfTypeOnly( node, @@ -78913,9 +82188,9 @@ ${lanes.join("\n")} return (symbol2.flags & (2097152 | excludes)) === 2097152 || !!(symbol2.flags & 2097152 && symbol2.flags & 67108864); } function resolveSymbol(symbol2, dontResolveAlias) { - return !dontResolveAlias && isNonLocalAlias(symbol2) ? resolveAlias(symbol2) : symbol2; + return !dontResolveAlias && isNonLocalAlias(symbol2) ? resolveAlias2(symbol2) : symbol2; } - function resolveAlias(symbol2) { + function resolveAlias2(symbol2) { Debug.assert((symbol2.flags & 2097152) !== 0, "Should only get Alias here."); const links = getSymbolLinks(symbol2); if (!links.aliasTarget) { @@ -78936,24 +82211,24 @@ ${lanes.join("\n")} function tryResolveAlias(symbol2) { const links = getSymbolLinks(symbol2); if (links.aliasTarget !== resolvingSymbol) { - return resolveAlias(symbol2); + return resolveAlias2(symbol2); } return void 0; } function getSymbolFlags(symbol2, excludeTypeOnlyMeanings, excludeLocalMeanings) { const typeOnlyDeclaration = excludeTypeOnlyMeanings && getTypeOnlyAliasDeclaration(symbol2); - const typeOnlyDeclarationIsExportStar = typeOnlyDeclaration && isExportDeclaration2(typeOnlyDeclaration); + const typeOnlyDeclarationIsExportStar = typeOnlyDeclaration && isExportDeclaration3(typeOnlyDeclaration); const typeOnlyResolution = typeOnlyDeclaration && (typeOnlyDeclarationIsExportStar ? resolveExternalModuleName( typeOnlyDeclaration.moduleSpecifier, typeOnlyDeclaration.moduleSpecifier, /*ignoreErrors*/ true - ) : resolveAlias(typeOnlyDeclaration.symbol)); + ) : resolveAlias2(typeOnlyDeclaration.symbol)); const typeOnlyExportStarTargets = typeOnlyDeclarationIsExportStar && typeOnlyResolution ? getExportsOfModule(typeOnlyResolution) : void 0; let flags = excludeLocalMeanings ? 0 : symbol2.flags; let seenSymbols; while (symbol2.flags & 2097152) { - const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol2)); + const target = getExportSymbolOfValueSymbolIfExported(resolveAlias2(symbol2)); if (!typeOnlyDeclarationIsExportStar && target === typeOnlyResolution || (typeOnlyExportStarTargets == null ? void 0 : typeOnlyExportStarTargets.get(target.escapedName)) === target) { break; } @@ -78976,7 +82251,7 @@ ${lanes.join("\n")} return flags; } function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty, exportStarDeclaration, exportStarName) { - if (!aliasDeclaration || isPropertyAccessExpression16(aliasDeclaration)) return false; + if (!aliasDeclaration || isPropertyAccessExpression17(aliasDeclaration)) return false; const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration); if (isTypeOnlyImportOrExportDeclaration(aliasDeclaration)) { const links2 = getSymbolLinks(sourceSymbol); @@ -79027,7 +82302,7 @@ ${lanes.join("\n")} return links.typeOnlyDeclaration || void 0; } if (links.typeOnlyDeclaration) { - const resolved = links.typeOnlyDeclaration.kind === 279 ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol2.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol); + const resolved = links.typeOnlyDeclaration.kind === 279 ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol2.escapedName)) : resolveAlias2(links.typeOnlyDeclaration.symbol); return getSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0; } return void 0; @@ -79148,7 +82423,7 @@ ${lanes.join("\n")} } symbol2 = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning)); if (!symbol2 && namespace.flags & 2097152) { - symbol2 = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning)); + symbol2 = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias2(namespace)), right.escapedText, meaning)); } if (!symbol2) { if (!ignoreErrors) { @@ -79203,7 +82478,7 @@ ${lanes.join("\n")} true ); } - return symbol2.flags & meaning || dontResolveAlias ? symbol2 : resolveAlias(symbol2); + return symbol2.flags & meaning || dontResolveAlias ? symbol2 : resolveAlias2(symbol2); } function resolveEntityNameFromAssignmentDeclaration(name, meaning) { if (isJSDocTypeReference(name.parent)) { @@ -79239,7 +82514,7 @@ ${lanes.join("\n")} return getDeclarationOfJSPrototypeContainer(symbol2); } } - if (host2 && (isObjectLiteralMethod(host2) || isPropertyAssignment11(host2)) && isBinaryExpression4(host2.parent.parent) && getAssignmentDeclarationKind(host2.parent.parent) === 6) { + if (host2 && (isObjectLiteralMethod(host2) || isPropertyAssignment12(host2)) && isBinaryExpression4(host2.parent.parent) && getAssignmentDeclarationKind(host2.parent.parent) === 6) { const symbol2 = getSymbolOfDeclaration(host2.parent.parent.left); if (symbol2) { return getDeclarationOfJSPrototypeContainer(symbol2); @@ -79304,7 +82579,7 @@ ${lanes.join("\n")} location.initializer, /*requireStringLiteralLikeArgument*/ true - ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration7, isJSDocImportTag, isExportDeclaration2))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression); + ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration8, isJSDocImportTag, isExportDeclaration3))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression); const mode = contextSpecifier && isStringLiteralLike4(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile); const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _f.resolvedModule; @@ -79315,7 +82590,7 @@ ${lanes.join("\n")} error210(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); } if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) { - const importOrExport = ((_g = findAncestor(location, isImportDeclaration7)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration2)); + const importOrExport = ((_g = findAncestor(location, isImportDeclaration8)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration3)); if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) { error210( errorNode, @@ -79324,7 +82599,7 @@ ${lanes.join("\n")} ); } } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) { - const importOrExport = ((_h = findAncestor(location, isImportDeclaration7)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration2)); + const importOrExport = ((_h = findAncestor(location, isImportDeclaration8)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration3)); if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) { const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference)); error210(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension); @@ -79374,7 +82649,7 @@ ${lanes.join("\n")} } if (errorNode && (moduleKind === 100 || moduleKind === 101)) { const isSyncImport = currentSourceFile.impliedNodeFormat === 1 && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration); - const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration2(l) || isImportDeclaration7(l) || isJSDocImportTag(l)); + const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration3(l) || isImportDeclaration8(l) || isJSDocImportTag(l)); if (isSyncImport && sourceFile.impliedNodeFormat === 99 && !hasResolutionModeOverride(overrideHost)) { if (findAncestor(location, isImportEqualsDeclaration)) { error210(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference); @@ -79401,13 +82676,13 @@ ${lanes.join("\n")} return void 0; } if (patternAmbientModules) { - const pattern = findBestPatternMatch(patternAmbientModules, (_) => _.pattern, moduleReference); - if (pattern) { + const pattern2 = findBestPatternMatch(patternAmbientModules, (_) => _.pattern, moduleReference); + if (pattern2) { const augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference); if (augmentation) { return getMergedSymbol(augmentation); } - return getMergedSymbol(pattern.symbol); + return getMergedSymbol(pattern2.symbol); } } if (!errorNode) { @@ -79551,7 +82826,7 @@ ${lanes.join("\n")} return symbol2; } const referenceParent = referencingLocation.parent; - const namespaceImport = isImportDeclaration7(referenceParent) && getNamespaceDeclarationNode(referenceParent); + const namespaceImport = isImportDeclaration8(referenceParent) && getNamespaceDeclarationNode(referenceParent); if (namespaceImport || isImportCall(referenceParent)) { const reference = isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier; const type = getTypeOfSymbol(symbol2); @@ -79899,7 +83174,7 @@ ${lanes.join("\n")} function getVariableDeclarationOfObjectLiteral(symbol2, meaning) { const firstDecl = !!length(symbol2.declarations) && first(symbol2.declarations); if (meaning & 111551 && firstDecl && firstDecl.parent && isVariableDeclaration7(firstDecl.parent)) { - if (isObjectLiteralExpression12(firstDecl) && firstDecl === firstDecl.parent.initializer || isTypeLiteralNode2(firstDecl) && firstDecl === firstDecl.parent.type) { + if (isObjectLiteralExpression13(firstDecl) && firstDecl === firstDecl.parent.initializer || isTypeLiteralNode2(firstDecl) && firstDecl === firstDecl.parent.type) { return getSymbolOfDeclaration(firstDecl.parent); } } @@ -80160,7 +83435,7 @@ ${lanes.join("\n")} 282 /* ExportSpecifier */ ))) { - const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + const resolvedImportedSymbol = resolveAlias2(symbolFromSymbolTable); const candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { return candidate; @@ -80209,7 +83484,7 @@ ${lanes.join("\n")} 282 /* ExportSpecifier */ ); - symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias2(symbolFromSymbolTable) : symbolFromSymbolTable; const flags = shouldResolveAlias ? getSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; if (flags & meaning) { qualify = true; @@ -80397,7 +83672,7 @@ ${lanes.join("\n")} ) && // import clause without export isDeclarationVisible(anyImportSyntax.parent)) { return addVisibleAlias(declaration, anyImportSyntax); - } else if (isVariableDeclaration7(declaration) && isVariableStatement11(declaration.parent.parent) && !hasSyntacticModifier( + } else if (isVariableDeclaration7(declaration) && isVariableStatement12(declaration.parent.parent) && !hasSyntacticModifier( declaration.parent.parent, 32 /* Export */ @@ -80411,7 +83686,7 @@ ${lanes.join("\n")} ) && isDeclarationVisible(declaration.parent)) { return addVisibleAlias(declaration, declaration); } else if (isBindingElement(declaration)) { - if (symbol2.flags & 2097152 && isInJSFile(declaration) && ((_a3 = declaration.parent) == null ? void 0 : _a3.parent) && isVariableDeclaration7(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement11(declaration.parent.parent.parent.parent) && !hasSyntacticModifier( + if (symbol2.flags & 2097152 && isInJSFile(declaration) && ((_a3 = declaration.parent) == null ? void 0 : _a3.parent) && isVariableDeclaration7(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement12(declaration.parent.parent.parent.parent) && !hasSyntacticModifier( declaration.parent.parent.parent.parent, 32 /* Export */ @@ -80645,11 +83920,11 @@ ${lanes.join("\n")} evaluateEntityNameExpression, isExpandoFunctionDeclaration, hasLateBindableName, - shouldRemoveDeclaration(context, node) { - return !(context.internalFlags & 8 && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1); + shouldRemoveDeclaration(context2, node) { + return !(context2.internalFlags & 8 && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1); }, - createRecoveryBoundary(context) { - return createRecoveryBoundary(context); + createRecoveryBoundary(context2) { + return createRecoveryBoundary(context2); }, isDefinitelyReferenceToGlobalSymbolObject, getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration, @@ -80673,75 +83948,75 @@ ${lanes.join("\n")} isUndefinedIdentifierExpression(node) { return getSymbolAtLocation(node) === undefinedSymbol; }, - isEntityNameVisible(context, entityName, shouldComputeAliasToMakeVisible) { - return isEntityNameVisible(entityName, context.enclosingDeclaration, shouldComputeAliasToMakeVisible); + isEntityNameVisible(context2, entityName, shouldComputeAliasToMakeVisible) { + return isEntityNameVisible(entityName, context2.enclosingDeclaration, shouldComputeAliasToMakeVisible); }, - serializeExistingTypeNode(context, typeNode, addUndefined) { - return serializeExistingTypeNode(context, typeNode, !!addUndefined); + serializeExistingTypeNode(context2, typeNode, addUndefined) { + return serializeExistingTypeNode(context2, typeNode, !!addUndefined); }, serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol2) { - const context = syntacticContext; + const context2 = syntacticContext; const signature = getSignatureFromDeclaration(signatureDeclaration); symbol2 ?? (symbol2 = getSymbolOfDeclaration(signatureDeclaration)); - const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol2)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper); - return serializeInferredReturnTypeForSignature(context, signature, returnType); + const returnType = context2.enclosingSymbolTypes.get(getSymbolId(symbol2)) ?? instantiateType(getReturnTypeOfSignature(signature), context2.mapper); + return serializeInferredReturnTypeForSignature(context2, signature, returnType); }, serializeTypeOfExpression(syntacticContext, expr) { - const context = syntacticContext; - const type = instantiateType(getWidenedType(getRegularTypeOfExpression(expr)), context.mapper); - return typeToTypeNodeHelper(type, context); + const context2 = syntacticContext; + const type = instantiateType(getWidenedType(getRegularTypeOfExpression(expr)), context2.mapper); + return typeToTypeNodeHelper(type, context2); }, serializeTypeOfDeclaration(syntacticContext, declaration, symbol2) { var _a3; - const context = syntacticContext; + const context2 = syntacticContext; symbol2 ?? (symbol2 = getSymbolOfDeclaration(declaration)); - let type = (_a3 = context.enclosingSymbolTypes) == null ? void 0 : _a3.get(getSymbolId(symbol2)); + let type = (_a3 = context2.enclosingSymbolTypes) == null ? void 0 : _a3.get(getSymbolId(symbol2)); if (type === void 0) { - type = symbol2.flags & 98304 && declaration.kind === 179 ? instantiateType(getWriteTypeOfSymbol(symbol2), context.mapper) : symbol2 && !(symbol2.flags & (2048 | 131072)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol2)), context.mapper) : errorType; + type = symbol2.flags & 98304 && declaration.kind === 179 ? instantiateType(getWriteTypeOfSymbol(symbol2), context2.mapper) : symbol2 && !(symbol2.flags & (2048 | 131072)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol2)), context2.mapper) : errorType; } - const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration); + const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context2.enclosingDeclaration); if (addUndefinedForParameter) { type = getOptionalType(type); } - return serializeInferredTypeForDeclaration(symbol2, context, type); + return serializeInferredTypeForDeclaration(symbol2, context2, type); }, - serializeNameOfParameter(context, parameter) { - return parameterToParameterDeclarationName(getSymbolOfDeclaration(parameter), parameter, context); + serializeNameOfParameter(context2, parameter) { + return parameterToParameterDeclarationName(getSymbolOfDeclaration(parameter), parameter, context2); }, serializeEntityName(syntacticContext, node) { - const context = syntacticContext; + const context2 = syntacticContext; const symbol2 = getSymbolAtLocation( node, /*ignoreErrors*/ true ); if (!symbol2) return void 0; - if (!isValueSymbolAccessible(symbol2, context.enclosingDeclaration)) return void 0; + if (!isValueSymbolAccessible(symbol2, context2.enclosingDeclaration)) return void 0; return symbolToExpression( symbol2, - context, + context2, 111551 | 1048576 /* ExportValue */ ); }, - serializeTypeName(context, node, isTypeOf, typeArguments) { - return serializeTypeName(context, node, isTypeOf, typeArguments); + serializeTypeName(context2, node, isTypeOf, typeArguments) { + return serializeTypeName(context2, node, isTypeOf, typeArguments); }, getJsDocPropertyOverride(syntacticContext, jsDocTypeLiteral, jsDocProperty) { - const context = syntacticContext; - const name = isIdentifier26(jsDocProperty.name) ? jsDocProperty.name : jsDocProperty.name.right; - const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, jsDocTypeLiteral), name.escapedText); - const overrideTypeNode = typeViaParent && jsDocProperty.typeExpression && getTypeFromTypeNode2(context, jsDocProperty.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0; + const context2 = syntacticContext; + const name = isIdentifier28(jsDocProperty.name) ? jsDocProperty.name : jsDocProperty.name.right; + const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context2, jsDocTypeLiteral), name.escapedText); + const overrideTypeNode = typeViaParent && jsDocProperty.typeExpression && getTypeFromTypeNode2(context2, jsDocProperty.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context2) : void 0; return overrideTypeNode; }, - enterNewScope(context, node) { + enterNewScope(context2, node) { if (isFunctionLike(node) || isJSDocSignature(node)) { const signature = getSignatureFromDeclaration(node); - return enterNewScope(context, node, signature.parameters, signature.typeParameters); + return enterNewScope(context2, node, signature.parameters, signature.typeParameters); } else { const typeParameters = isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))]; return enterNewScope( - context, + context2, node, /*expandedParams*/ void 0, @@ -80749,47 +84024,47 @@ ${lanes.join("\n")} ); } }, - markNodeReuse(context, range, location) { - return setTextRange2(context, range, location); + markNodeReuse(context2, range, location) { + return setTextRange2(context2, range, location); }, - trackExistingEntityName(context, node) { - return trackExistingEntityName(node, context); + trackExistingEntityName(context2, node) { + return trackExistingEntityName(node, context2); }, - trackComputedName(context, accessExpression) { - trackComputedName(accessExpression, context.enclosingDeclaration, context); + trackComputedName(context2, accessExpression) { + trackComputedName(accessExpression, context2.enclosingDeclaration, context2); }, getModuleSpecifierOverride(syntacticContext, parent2, lit2) { - const context = syntacticContext; - if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit2)) { + const context2 = syntacticContext; + if (context2.bundled || context2.enclosingFile !== getSourceFileOfNode(lit2)) { let name = lit2.text; const originalName = name; const nodeSymbol = getNodeLinks(parent2).resolvedSymbol; const meaning = parent2.isTypeOf ? 111551 : 788968; const parentSymbol = nodeSymbol && isSymbolAccessible( nodeSymbol, - context.enclosingDeclaration, + context2.enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ false ).accessibility === 0 && lookupSymbolChain( nodeSymbol, - context, + context2, meaning, /*yieldModuleSymbol*/ true )[0]; if (parentSymbol && isExternalModuleSymbol(parentSymbol)) { - name = getSpecifierForModuleSymbol(parentSymbol, context); + name = getSpecifierForModuleSymbol(parentSymbol, context2); } else { const targetFile = getExternalModuleFileFromDeclaration(parent2); if (targetFile) { - name = getSpecifierForModuleSymbol(targetFile.symbol, context); + name = getSpecifierForModuleSymbol(targetFile.symbol, context2); } } if (name.includes("/node_modules/")) { - context.encounteredError = true; - if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(name); + context2.encounteredError = true; + if (context2.tracker.reportLikelyUnsafeImportRequiredError) { + context2.tracker.reportLikelyUnsafeImportRequiredError(name); } } if (name !== originalName) { @@ -80797,15 +84072,15 @@ ${lanes.join("\n")} } } }, - canReuseTypeNode(context, typeNode) { - return canReuseTypeNode(context, typeNode); + canReuseTypeNode(context2, typeNode) { + return canReuseTypeNode(context2, typeNode); }, canReuseTypeNodeAnnotation(syntacticContext, node, existing, symbol2, requiresAddingUndefined) { var _a3; - const context = syntacticContext; - if (context.enclosingDeclaration === void 0) return false; + const context2 = syntacticContext; + if (context2.enclosingDeclaration === void 0) return false; symbol2 ?? (symbol2 = getSymbolOfDeclaration(node)); - let type = (_a3 = context.enclosingSymbolTypes) == null ? void 0 : _a3.get(getSymbolId(symbol2)); + let type = (_a3 = context2.enclosingSymbolTypes) == null ? void 0 : _a3.get(getSymbolId(symbol2)); if (type === void 0) { if (symbol2.flags & 98304) { type = node.kind === 179 ? getWriteTypeOfSymbol(symbol2) : getTypeOfAccessors(symbol2); @@ -80827,7 +84102,7 @@ ${lanes.join("\n")} }; return { syntacticBuilderResolver, - typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out), + typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context2) => typeToTypeNodeHelper(type, context2), out), typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, flags, @@ -80837,7 +84112,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context) + (context2) => typePredicateToTypePredicateNodeHelper(typePredicate, context2) ), serializeTypeForDeclaration: (declaration, symbol2, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80848,7 +84123,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol2, context) + (context2) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol2, context2) ), serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80859,7 +84134,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context) + (context2) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context2) ), serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80870,7 +84145,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context) + (context2) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context2) ), indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80881,14 +84156,14 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => indexInfoToIndexSignatureDeclarationHelper( + (context2) => indexInfoToIndexSignatureDeclarationHelper( indexInfo, - context, + context2, /*typeNode*/ void 0 ) ), - signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context) => signatureToSignatureDeclarationHelper(signature, kind, context), out), + signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context2) => signatureToSignatureDeclarationHelper(signature, kind, context2), out), symbolToEntityName: (symbol2, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, flags, @@ -80898,9 +84173,9 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => symbolToName( + (context2) => symbolToName( symbol2, - context, + context2, meaning, /*expectsIdentifier*/ false @@ -80915,7 +84190,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => symbolToExpression(symbol2, context, meaning) + (context2) => symbolToExpression(symbol2, context2, meaning) ), symbolToTypeParameterDeclarations: (symbol2, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80926,7 +84201,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => typeParametersToTypeParameterDeclarations(symbol2, context) + (context2) => typeParametersToTypeParameterDeclarations(symbol2, context2) ), symbolToParameterDeclaration: (symbol2, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80937,9 +84212,9 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => symbolToParameterDeclaration(symbol2, context) + (context2) => symbolToParameterDeclaration(symbol2, context2) ), - typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context), out), + typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, (context2) => typeParameterToDeclaration(parameter, context2), out), symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, flags, @@ -80949,7 +84224,7 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => symbolTableToDeclarationStatements(symbolTable, context) + (context2) => symbolTableToDeclarationStatements(symbolTable, context2) ), symbolToNode: (symbol2, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2( enclosingDeclaration, @@ -80960,18 +84235,18 @@ ${lanes.join("\n")} void 0, /*verbosityLevel*/ void 0, - (context) => symbolToNode(symbol2, context, meaning) + (context2) => symbolToNode(symbol2, context2, meaning) ), symbolToDeclarations }; - function getTypeFromTypeNode2(context, node, noMappedTypes) { + function getTypeFromTypeNode2(context2, node, noMappedTypes) { const type = getTypeFromTypeNodeWithoutContext(node); - if (!context.mapper) return type; - const mappedType = instantiateType(type, context.mapper); + if (!context2.mapper) return type; + const mappedType = instantiateType(type, context2.mapper); return noMappedTypes && mappedType !== type ? void 0 : mappedType; } - function setTextRange2(context, range, location) { - if (!nodeIsSynthesized(range) || !(range.flags & 16) || !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(range))) { + function setTextRange2(context2, range, location) { + if (!nodeIsSynthesized(range) || !(range.flags & 16) || !context2.enclosingFile || context2.enclosingFile !== getSourceFileOfNode(getOriginalNode(range))) { range = factory.cloneNode(range); } if (range === location) return range; @@ -80985,24 +84260,24 @@ ${lanes.join("\n")} if (!original) { setOriginalNode(range, location); } - if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(getOriginalNode(location))) { + if (context2.enclosingFile && context2.enclosingFile === getSourceFileOfNode(getOriginalNode(location))) { return setTextRange(range, location); } return range; } - function symbolToNode(symbol2, context, meaning) { - if (context.internalFlags & 1) { + function symbolToNode(symbol2, context2, meaning) { + if (context2.internalFlags & 1) { if (symbol2.valueDeclaration) { const name = getNameOfDeclaration(symbol2.valueDeclaration); if (name && isComputedPropertyName(name)) return name; } const nameType = getSymbolLinks(symbol2).nameType; if (nameType && nameType.flags & (1024 | 8192)) { - context.enclosingDeclaration = nameType.symbol.valueDeclaration; - return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + context2.enclosingDeclaration = nameType.symbol.valueDeclaration; + return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context2, meaning)); } } - return symbolToExpression(symbol2, context, meaning); + return symbolToExpression(symbol2, context2, meaning); } function symbolToDeclarations(symbol2, meaning, flags, maximumLength, verbosityLevel, out) { const nodes = withContext2( @@ -81015,7 +84290,7 @@ ${lanes.join("\n")} void 0, maximumLength, verbosityLevel, - (context) => symbolToDeclarationsWorker(symbol2, context), + (context2) => symbolToDeclarationsWorker(symbol2, context2), out ); return mapDefined(nodes, (node) => { @@ -81063,21 +84338,21 @@ ${lanes.join("\n")} } return simplifyModifiers(interfaceDecl, isInterfaceDeclaration2, symbol2); } - function symbolToDeclarationsWorker(symbol2, context) { + function symbolToDeclarationsWorker(symbol2, context2) { const type = getDeclaredTypeOfSymbol(symbol2); - context.typeStack.push(type.id); - context.typeStack.push(-1); + context2.typeStack.push(type.id); + context2.typeStack.push(-1); const table = createSymbolTable([symbol2]); - const statements = symbolTableToDeclarationStatements(table, context); - context.typeStack.pop(); - context.typeStack.pop(); + const statements = symbolTableToDeclarationStatements(table, context2); + context2.typeStack.pop(); + context2.typeStack.pop(); return statements; } function withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, cb, out) { const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0) & 4 ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0; flags = flags || 0; const maxTruncationLength = maximumLength || (flags & 1 ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength); - const context = { + const context2 = { enclosingDeclaration, enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration), flags, @@ -81114,104 +84389,104 @@ ${lanes.join("\n")} truncated: false } }; - context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost); - const resultingNode = cb(context); - if (context.truncating && context.flags & 1) { - context.tracker.reportTruncationError(); + context2.tracker = new SymbolTrackerImpl(context2, tracker, moduleResolverHost); + const resultingNode = cb(context2); + if (context2.truncating && context2.flags & 1) { + context2.tracker.reportTruncationError(); } if (out) { - out.canIncreaseExpansionDepth = context.out.canIncreaseExpansionDepth; - out.truncated = context.out.truncated; + out.canIncreaseExpansionDepth = context2.out.canIncreaseExpansionDepth; + out.truncated = context2.out.truncated; } - return context.encounteredError ? void 0 : resultingNode; + return context2.encounteredError ? void 0 : resultingNode; } - function addSymbolTypeToContext(context, symbol2, type) { + function addSymbolTypeToContext(context2, symbol2, type) { const id = getSymbolId(symbol2); - const oldType = context.enclosingSymbolTypes.get(id); - context.enclosingSymbolTypes.set(id, type); + const oldType = context2.enclosingSymbolTypes.get(id); + context2.enclosingSymbolTypes.set(id, type); return restore; function restore() { if (oldType) { - context.enclosingSymbolTypes.set(id, oldType); + context2.enclosingSymbolTypes.set(id, oldType); } else { - context.enclosingSymbolTypes.delete(id); + context2.enclosingSymbolTypes.delete(id); } } } - function saveRestoreFlags(context) { - const flags = context.flags; - const internalFlags = context.internalFlags; - const depth = context.depth; + function saveRestoreFlags(context2) { + const flags = context2.flags; + const internalFlags = context2.internalFlags; + const depth = context2.depth; return restore; function restore() { - context.flags = flags; - context.internalFlags = internalFlags; - context.depth = depth; + context2.flags = flags; + context2.internalFlags = internalFlags; + context2.depth = depth; } } - function checkTruncationLengthIfExpanding(context) { - return context.maxExpansionDepth >= 0 && checkTruncationLength(context); + function checkTruncationLengthIfExpanding(context2) { + return context2.maxExpansionDepth >= 0 && checkTruncationLength(context2); } - function checkTruncationLength(context) { - if (context.truncating) return context.truncating; - return context.truncating = context.approximateLength > context.maxTruncationLength; + function checkTruncationLength(context2) { + if (context2.truncating) return context2.truncating; + return context2.truncating = context2.approximateLength > context2.maxTruncationLength; } - function canPossiblyExpandType(type, context) { - for (let i = 0; i < context.typeStack.length - 1; i++) { - if (context.typeStack[i] === type.id) { + function canPossiblyExpandType(type, context2) { + for (let i = 0; i < context2.typeStack.length - 1; i++) { + if (context2.typeStack[i] === type.id) { return false; } } - return context.depth < context.maxExpansionDepth || context.depth === context.maxExpansionDepth && !context.out.canIncreaseExpansionDepth; + return context2.depth < context2.maxExpansionDepth || context2.depth === context2.maxExpansionDepth && !context2.out.canIncreaseExpansionDepth; } - function shouldExpandType(type, context, isAlias = false) { + function shouldExpandType(type, context2, isAlias = false) { if (!isAlias && isLibType(type)) { return false; } - for (let i = 0; i < context.typeStack.length - 1; i++) { - if (context.typeStack[i] === type.id) { + for (let i = 0; i < context2.typeStack.length - 1; i++) { + if (context2.typeStack[i] === type.id) { return false; } } - const result = context.depth < context.maxExpansionDepth; + const result = context2.depth < context2.maxExpansionDepth; if (!result) { - context.out.canIncreaseExpansionDepth = true; + context2.out.canIncreaseExpansionDepth = true; } return result; } - function typeToTypeNodeHelper(type, context) { - const restoreFlags = saveRestoreFlags(context); - if (type) context.typeStack.push(type.id); - const typeNode = typeToTypeNodeWorker(type, context); - if (type) context.typeStack.pop(); + function typeToTypeNodeHelper(type, context2) { + const restoreFlags = saveRestoreFlags(context2); + if (type) context2.typeStack.push(type.id); + const typeNode = typeToTypeNodeWorker(type, context2); + if (type) context2.typeStack.pop(); restoreFlags(); return typeNode; } - function typeToTypeNodeWorker(type, context) { + function typeToTypeNodeWorker(type, context2) { var _a3, _b; if (cancellationToken && cancellationToken.throwIfCancellationRequested) { cancellationToken.throwIfCancellationRequested(); } - const inTypeAlias = context.flags & 8388608; - context.flags &= ~8388608; + const inTypeAlias = context2.flags & 8388608; + context2.flags &= ~8388608; let expandingEnum = false; if (!type) { - if (!(context.flags & 262144)) { - context.encounteredError = true; + if (!(context2.flags & 262144)) { + context2.encounteredError = true; return void 0; } - context.approximateLength += 3; + context2.approximateLength += 3; return factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - if (!(context.flags & 536870912)) { + if (!(context2.flags & 536870912)) { type = getReducedType(type); } if (type.flags & 1) { if (type.aliasSymbol) { - return factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); + return factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context2)); } if (type === unresolvedType) { return addSyntheticLeadingComment(factory.createKeywordTypeNode( @@ -81219,7 +84494,7 @@ ${lanes.join("\n")} /* AnyKeyword */ ), 3, "unresolved"); } - context.approximateLength += 3; + context2.approximateLength += 3; return factory.createKeywordTypeNode( type === intrinsicMarkerType ? 141 : 133 /* AnyKeyword */ @@ -81232,28 +84507,28 @@ ${lanes.join("\n")} ); } if (type.flags & 4) { - context.approximateLength += 6; + context2.approximateLength += 6; return factory.createKeywordTypeNode( 154 /* StringKeyword */ ); } if (type.flags & 8) { - context.approximateLength += 6; + context2.approximateLength += 6; return factory.createKeywordTypeNode( 150 /* NumberKeyword */ ); } if (type.flags & 64) { - context.approximateLength += 6; + context2.approximateLength += 6; return factory.createKeywordTypeNode( 163 /* BigIntKeyword */ ); } if (type.flags & 16 && !type.aliasSymbol) { - context.approximateLength += 7; + context2.approximateLength += 7; return factory.createKeywordTypeNode( 136 /* BooleanKeyword */ @@ -81264,7 +84539,7 @@ ${lanes.join("\n")} const parentSymbol = getParentOfSymbol(type.symbol); const parentName = symbolToTypeNode( parentSymbol, - context, + context2, 788968 /* Type */ ); @@ -81295,10 +84570,10 @@ ${lanes.join("\n")} return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`."); } } - if (!shouldExpandType(type, context)) { + if (!shouldExpandType(type, context2)) { return symbolToTypeNode( type.symbol, - context, + context2, 788968 /* Type */ ); @@ -81307,117 +84582,117 @@ ${lanes.join("\n")} } } if (type.flags & 128) { - context.approximateLength += type.value.length + 2; + context2.approximateLength += type.value.length + 2; return factory.createLiteralTypeNode(setEmitFlags( - factory.createStringLiteral(type.value, !!(context.flags & 268435456)), + factory.createStringLiteral(type.value, !!(context2.flags & 268435456)), 16777216 /* NoAsciiEscaping */ )); } if (type.flags & 256) { const value = type.value; - context.approximateLength += ("" + value).length; + context2.approximateLength += ("" + value).length; return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(41, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value)); } if (type.flags & 2048) { - context.approximateLength += pseudoBigIntToString(type.value).length + 1; + context2.approximateLength += pseudoBigIntToString(type.value).length + 1; return factory.createLiteralTypeNode(factory.createBigIntLiteral(type.value)); } if (type.flags & 512) { - context.approximateLength += type.intrinsicName.length; + context2.approximateLength += type.intrinsicName.length; return factory.createLiteralTypeNode(type.intrinsicName === "true" ? factory.createTrue() : factory.createFalse()); } if (type.flags & 8192) { - if (!(context.flags & 1048576)) { - if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { - context.approximateLength += 6; + if (!(context2.flags & 1048576)) { + if (isValueSymbolAccessible(type.symbol, context2.enclosingDeclaration)) { + context2.approximateLength += 6; return symbolToTypeNode( type.symbol, - context, + context2, 111551 /* Value */ ); } - if (context.tracker.reportInaccessibleUniqueSymbolError) { - context.tracker.reportInaccessibleUniqueSymbolError(); + if (context2.tracker.reportInaccessibleUniqueSymbolError) { + context2.tracker.reportInaccessibleUniqueSymbolError(); } } - context.approximateLength += 13; + context2.approximateLength += 13; return factory.createTypeOperatorNode(158, factory.createKeywordTypeNode( 155 /* SymbolKeyword */ )); } if (type.flags & 16384) { - context.approximateLength += 4; + context2.approximateLength += 4; return factory.createKeywordTypeNode( 116 /* VoidKeyword */ ); } if (type.flags & 32768) { - context.approximateLength += 9; + context2.approximateLength += 9; return factory.createKeywordTypeNode( 157 /* UndefinedKeyword */ ); } if (type.flags & 65536) { - context.approximateLength += 4; + context2.approximateLength += 4; return factory.createLiteralTypeNode(factory.createNull()); } if (type.flags & 131072) { - context.approximateLength += 5; + context2.approximateLength += 5; return factory.createKeywordTypeNode( 146 /* NeverKeyword */ ); } if (type.flags & 4096) { - context.approximateLength += 6; + context2.approximateLength += 6; return factory.createKeywordTypeNode( 155 /* SymbolKeyword */ ); } if (type.flags & 67108864) { - context.approximateLength += 6; + context2.approximateLength += 6; return factory.createKeywordTypeNode( 151 /* ObjectKeyword */ ); } if (isThisTypeParameter(type)) { - if (context.flags & 4194304) { - if (!context.encounteredError && !(context.flags & 32768)) { - context.encounteredError = true; + if (context2.flags & 4194304) { + if (!context2.encounteredError && !(context2.flags & 32768)) { + context2.encounteredError = true; } - (_b = (_a3 = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a3); + (_b = (_a3 = context2.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a3); } - context.approximateLength += 4; + context2.approximateLength += 4; return factory.createThisTypeNode(); } - if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { + if (!inTypeAlias && type.aliasSymbol && (context2.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context2.enclosingDeclaration))) { if (!shouldExpandType( type, - context, + context2, /*isAlias*/ true )) { - const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); + const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context2); if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes); if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) { return factory.createArrayTypeNode(typeArgumentNodes[0]); } - return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes); + return symbolToTypeNode(type.aliasSymbol, context2, 788968, typeArgumentNodes); } - context.depth += 1; + context2.depth += 1; } const objectFlags = getObjectFlags(type); if (objectFlags & 4) { Debug.assert(!!(type.flags & 524288)); - if (shouldExpandType(type, context)) { - context.depth += 1; + if (shouldExpandType(type, context2)) { + context2.depth += 1; return createAnonymousTypeNode( type, /*forceClassExpansion*/ @@ -81429,8 +84704,8 @@ ${lanes.join("\n")} return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type); } if (type.flags & 262144 || objectFlags & 3) { - if (type.flags & 262144 && contains(context.inferTypeParameters, type)) { - context.approximateLength += symbolName(type.symbol).length + 6; + if (type.flags & 262144 && contains(context2.inferTypeParameters, type)) { + context2.approximateLength += symbolName(type.symbol).length + 6; let constraintNode; const constraint = getConstraintOfTypeParameter(type); if (constraint) { @@ -81440,23 +84715,23 @@ ${lanes.join("\n")} true ); if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) { - context.approximateLength += 9; - constraintNode = constraint && typeToTypeNodeHelper(constraint, context); + context2.approximateLength += 9; + constraintNode = constraint && typeToTypeNodeHelper(constraint, context2); } } - return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode)); + return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context2, constraintNode)); } - if (context.flags & 4 && type.flags & 262144) { - const name2 = typeParameterToName(type, context); - context.approximateLength += idText(name2).length; + if (context2.flags & 4 && type.flags & 262144) { + const name2 = typeParameterToName(type, context2); + context2.approximateLength += idText(name2).length; return factory.createTypeReferenceNode( factory.createIdentifier(idText(name2)), /*typeArguments*/ void 0 ); } - if (objectFlags & 3 && shouldExpandType(type, context)) { - context.depth += 1; + if (objectFlags & 3 && shouldExpandType(type, context2)) { + context2.depth += 1; return createAnonymousTypeNode( type, /*forceClassExpansion*/ @@ -81468,7 +84743,7 @@ ${lanes.join("\n")} if (type.symbol) { return symbolToTypeNode( type.symbol, - context, + context2, 788968 /* Type */ ); @@ -81486,19 +84761,19 @@ ${lanes.join("\n")} if (type.flags & (1048576 | 2097152)) { const types = type.flags & 1048576 ? formatUnionTypes(type.types, expandingEnum) : type.types; if (length(types) === 1) { - return typeToTypeNodeHelper(types[0], context); + return typeToTypeNodeHelper(types[0], context2); } const typeNodes = mapToTypeNodes( types, - context, + context2, /*isBareList*/ true ); if (typeNodes && typeNodes.length > 0) { return type.flags & 1048576 ? factory.createUnionTypeNode(typeNodes) : factory.createIntersectionTypeNode(typeNodes); } else { - if (!context.encounteredError && !(context.flags & 262144)) { - context.encounteredError = true; + if (!context2.encounteredError && !(context2.flags & 262144)) { + context2.encounteredError = true; } return void 0; } @@ -81509,8 +84784,8 @@ ${lanes.join("\n")} } if (type.flags & 4194304) { const indexedType = type.type; - context.approximateLength += 6; - const indexTypeNode = typeToTypeNodeHelper(indexedType, context); + context2.approximateLength += 6; + const indexTypeNode = typeToTypeNodeHelper(indexedType, context2); return factory.createTypeOperatorNode(143, indexTypeNode); } if (type.flags & 134217728) { @@ -81519,51 +84794,51 @@ ${lanes.join("\n")} const templateHead = factory.createTemplateHead(texts[0]); const templateSpans = factory.createNodeArray( map2(types, (t, i) => factory.createTemplateLiteralTypeSpan( - typeToTypeNodeHelper(t, context), + typeToTypeNodeHelper(t, context2), (i < types.length - 1 ? factory.createTemplateMiddle : factory.createTemplateTail)(texts[i + 1]) )) ); - context.approximateLength += 2; + context2.approximateLength += 2; return factory.createTemplateLiteralType(templateHead, templateSpans); } if (type.flags & 268435456) { - const typeNode = typeToTypeNodeHelper(type.type, context); - return symbolToTypeNode(type.symbol, context, 788968, [typeNode]); + const typeNode = typeToTypeNodeHelper(type.type, context2); + return symbolToTypeNode(type.symbol, context2, 788968, [typeNode]); } if (type.flags & 8388608) { - const objectTypeNode = typeToTypeNodeHelper(type.objectType, context); - const indexTypeNode = typeToTypeNodeHelper(type.indexType, context); - context.approximateLength += 2; + const objectTypeNode = typeToTypeNodeHelper(type.objectType, context2); + const indexTypeNode = typeToTypeNodeHelper(type.indexType, context2); + context2.approximateLength += 2; return factory.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); } if (type.flags & 16777216) { return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2)); } if (type.flags & 33554432) { - const typeNode = typeToTypeNodeHelper(type.baseType, context); + const typeNode = typeToTypeNodeHelper(type.baseType, context2); const noInferSymbol = isNoInferType(type) && getGlobalTypeSymbol( "NoInfer", /*reportErrors*/ false ); - return noInferSymbol ? symbolToTypeNode(noInferSymbol, context, 788968, [typeNode]) : typeNode; + return noInferSymbol ? symbolToTypeNode(noInferSymbol, context2, 788968, [typeNode]) : typeNode; } return Debug.fail("Should be unreachable."); function conditionalTypeToTypeNode(type2) { - const checkTypeNode = typeToTypeNodeHelper(type2.checkType, context); - context.approximateLength += 15; - if (context.flags & 4 && type2.root.isDistributive && !(type2.checkType.flags & 262144)) { + const checkTypeNode = typeToTypeNodeHelper(type2.checkType, context2); + context2.approximateLength += 15; + if (context2.flags & 4 && type2.root.isDistributive && !(type2.checkType.flags & 262144)) { const newParam = createTypeParameter(createSymbol(262144, "T")); - const name = typeParameterToName(newParam, context); + const name = typeParameterToName(newParam, context2); const newTypeVariable = factory.createTypeReferenceNode(name); - context.approximateLength += 37; + context2.approximateLength += 37; const newMapper = prependTypeMapping(type2.root.checkType, newParam, type2.mapper); - const saveInferTypeParameters2 = context.inferTypeParameters; - context.inferTypeParameters = type2.root.inferTypeParameters; - const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context); - context.inferTypeParameters = saveInferTypeParameters2; - const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper)); - const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper)); + const saveInferTypeParameters2 = context2.inferTypeParameters; + context2.inferTypeParameters = type2.root.inferTypeParameters; + const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context2); + context2.inferTypeParameters = saveInferTypeParameters2; + const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context2, type2.root.node.trueType), newMapper)); + const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context2, type2.root.node.falseType), newMapper)); return factory.createConditionalTypeNode( checkTypeNode, factory.createInferTypeNode(factory.createTypeParameterDeclaration( @@ -81573,7 +84848,7 @@ ${lanes.join("\n")} )), factory.createConditionalTypeNode( factory.createTypeReferenceNode(factory.cloneNode(name)), - typeToTypeNodeHelper(type2.checkType, context), + typeToTypeNodeHelper(type2.checkType, context2), factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode2, trueTypeNode2, falseTypeNode2), factory.createKeywordTypeNode( 146 @@ -81586,10 +84861,10 @@ ${lanes.join("\n")} ) ); } - const saveInferTypeParameters = context.inferTypeParameters; - context.inferTypeParameters = type2.root.inferTypeParameters; - const extendsTypeNode = typeToTypeNodeHelper(type2.extendsType, context); - context.inferTypeParameters = saveInferTypeParameters; + const saveInferTypeParameters = context2.inferTypeParameters; + context2.inferTypeParameters = type2.root.inferTypeParameters; + const extendsTypeNode = typeToTypeNodeHelper(type2.extendsType, context2); + context2.inferTypeParameters = saveInferTypeParameters; const trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type2)); const falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type2)); return factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode); @@ -81597,16 +84872,16 @@ ${lanes.join("\n")} function typeToTypeNodeOrCircularityElision(type2) { var _a22, _b2, _c; if (type2.flags & 1048576) { - if ((_a22 = context.visitedTypes) == null ? void 0 : _a22.has(getTypeId(type2))) { - if (!(context.flags & 131072)) { - context.encounteredError = true; - (_c = (_b2 = context.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2); + if ((_a22 = context2.visitedTypes) == null ? void 0 : _a22.has(getTypeId(type2))) { + if (!(context2.flags & 131072)) { + context2.encounteredError = true; + (_c = (_b2 = context2.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2); } - return createElidedInformationPlaceholder(context); + return createElidedInformationPlaceholder(context2); } - return visitAndTransformType(type2, (type3) => typeToTypeNodeHelper(type3, context)); + return visitAndTransformType(type2, (type3) => typeToTypeNodeHelper(type3, context2)); } - return typeToTypeNodeHelper(type2, context); + return typeToTypeNodeHelper(type2, context2); } function isMappedTypeHomomorphic(type2) { return !!getHomomorphicTypeVariable(type2); @@ -81623,11 +84898,11 @@ ${lanes.join("\n")} let newTypeVariable; let templateType = getTemplateTypeFromMappedType(type2); const typeParameter = getTypeParameterFromMappedType(type2); - const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2) && context.flags & 4 && !(getConstraintTypeFromMappedType(type2).flags & 262144 && ((_a22 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a22.flags) & 4194304); + const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2) && context2.flags & 4 && !(getConstraintTypeFromMappedType(type2).flags & 262144 && ((_a22 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a22.flags) & 4194304); if (isMappedTypeWithKeyofConstraintDeclaration(type2)) { - if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4) { + if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context2.flags & 4) { const newConstraintParam = createTypeParameter(createSymbol(262144, "T")); - const name = typeParameterToName(newConstraintParam, context); + const name = typeParameterToName(newConstraintParam, context2); const target = type2.target; newTypeVariable = factory.createTypeReferenceNode(name); templateType = instantiateType( @@ -81635,25 +84910,25 @@ ${lanes.join("\n")} makeArrayTypeMapper([getTypeParameterFromMappedType(target), getModifiersTypeFromMappedType(target)], [typeParameter, newConstraintParam]) ); } - appropriateConstraintTypeNode = factory.createTypeOperatorNode(143, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)); + appropriateConstraintTypeNode = factory.createTypeOperatorNode(143, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context2)); } else if (needsModifierPreservingWrapper) { const newParam = createTypeParameter(createSymbol(262144, "T")); - const name = typeParameterToName(newParam, context); + const name = typeParameterToName(newParam, context2); newTypeVariable = factory.createTypeReferenceNode(name); appropriateConstraintTypeNode = newTypeVariable; } else { - appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context); + appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context2); } - const typeParameterNode = typeParameterToDeclarationWithConstraint(typeParameter, context, appropriateConstraintTypeNode); + const typeParameterNode = typeParameterToDeclarationWithConstraint(typeParameter, context2, appropriateConstraintTypeNode); const cleanup = enterNewScope( - context, + context2, type2.declaration, /*expandedParams*/ void 0, [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(type2.declaration.typeParameter))] ); - const nameTypeNode = type2.declaration.nameType ? typeToTypeNodeHelper(getNameTypeFromMappedType(type2), context) : void 0; - const templateTypeNode = typeToTypeNodeHelper(removeMissingType(templateType, !!(getMappedTypeModifiers(type2) & 4)), context); + const nameTypeNode = type2.declaration.nameType ? typeToTypeNodeHelper(getNameTypeFromMappedType(type2), context2) : void 0; + const templateTypeNode = typeToTypeNodeHelper(removeMissingType(templateType, !!(getMappedTypeModifiers(type2) & 4)), context2); cleanup(); const mappedTypeNode = factory.createMappedTypeNode( readonlyToken, @@ -81664,21 +84939,21 @@ ${lanes.join("\n")} /*members*/ void 0 ); - context.approximateLength += 10; + context2.approximateLength += 10; const result = setEmitFlags( mappedTypeNode, 1 /* SingleLine */ ); - if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4) { - const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper); + if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context2.flags & 4) { + const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context2, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper); return factory.createConditionalTypeNode( - typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context), + typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context2), factory.createInferTypeNode(factory.createTypeParameterDeclaration( /*modifiers*/ void 0, factory.cloneNode(newTypeVariable.typeName), - originalConstraint.flags & 2 ? void 0 : typeToTypeNodeHelper(originalConstraint, context) + originalConstraint.flags & 2 ? void 0 : typeToTypeNodeHelper(originalConstraint, context2) )), result, factory.createKeywordTypeNode( @@ -81688,12 +84963,12 @@ ${lanes.join("\n")} ); } else if (needsModifierPreservingWrapper) { return factory.createConditionalTypeNode( - typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context), + typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context2), factory.createInferTypeNode(factory.createTypeParameterDeclaration( /*modifiers*/ void 0, factory.cloneNode(newTypeVariable.typeName), - factory.createTypeOperatorNode(143, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)) + factory.createTypeOperatorNode(143, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context2)) )), result, factory.createKeywordTypeNode( @@ -81713,44 +84988,44 @@ ${lanes.join("\n")} if (isInstantiationExpressionType) { const instantiationExpressionType = type2; const existing = instantiationExpressionType.node; - if (isTypeQueryNode(existing) && getTypeFromTypeNode2(context, existing) === type2) { - const typeNode = syntacticNodeBuilder.tryReuseExistingTypeNode(context, existing); + if (isTypeQueryNode(existing) && getTypeFromTypeNode2(context2, existing) === type2) { + const typeNode = syntacticNodeBuilder.tryReuseExistingTypeNode(context2, existing); if (typeNode) { return typeNode; } } - if ((_a22 = context.visitedTypes) == null ? void 0 : _a22.has(typeId)) { - return createElidedInformationPlaceholder(context); + if ((_a22 = context2.visitedTypes) == null ? void 0 : _a22.has(typeId)) { + return createElidedInformationPlaceholder(context2); } return visitAndTransformType(type2, createTypeNodeFromObjectType); } const isInstanceType = isClassInstanceSide(type2) ? 788968 : 111551; if (isJSConstructor(symbol2.valueDeclaration)) { - return symbolToTypeNode(symbol2, context, isInstanceType); - } else if (!forceExpansion && (symbol2.flags & 32 && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol2) && !(symbol2.valueDeclaration && isClassLike(symbol2.valueDeclaration) && context.flags & 2048 && (!isClassDeclaration5(symbol2.valueDeclaration) || isSymbolAccessible( + return symbolToTypeNode(symbol2, context2, isInstanceType); + } else if (!forceExpansion && (symbol2.flags & 32 && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol2) && !(symbol2.valueDeclaration && isClassLike(symbol2.valueDeclaration) && context2.flags & 2048 && (!isClassDeclaration5(symbol2.valueDeclaration) || isSymbolAccessible( symbol2, - context.enclosingDeclaration, + context2.enclosingDeclaration, isInstanceType, /*shouldComputeAliasesToMakeVisible*/ false ).accessibility !== 0)) || symbol2.flags & (384 | 512) || shouldWriteTypeOfFunctionSymbol())) { - if (shouldExpandType(type2, context)) { - context.depth += 1; + if (shouldExpandType(type2, context2)) { + context2.depth += 1; } else { - return symbolToTypeNode(symbol2, context, isInstanceType); + return symbolToTypeNode(symbol2, context2, isInstanceType); } } - if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) { + if ((_b2 = context2.visitedTypes) == null ? void 0 : _b2.has(typeId)) { const typeAlias = getTypeAliasForTypeLiteral(type2); if (typeAlias) { return symbolToTypeNode( typeAlias, - context, + context2, 788968 /* Type */ ); } else { - return createElidedInformationPlaceholder(context); + return createElidedInformationPlaceholder(context2); } } else { return visitAndTransformType(type2, createTypeNodeFromObjectType); @@ -81769,8 +85044,8 @@ ${lanes.join("\n")} /* ModuleBlock */ )); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return (!!(context.flags & 4096) || ((_a32 = context.visitedTypes) == null ? void 0 : _a32.has(typeId))) && // it is type of the symbol uses itself recursively - (!(context.flags & 8) || isValueSymbolAccessible(symbol2, context.enclosingDeclaration)); + return (!!(context2.flags & 4096) || ((_a32 = context2.visitedTypes) == null ? void 0 : _a32.has(typeId))) && // it is type of the symbol uses itself recursively + (!(context2.flags & 8) || isValueSymbolAccessible(symbol2, context2.enclosingDeclaration)); } } } @@ -81779,65 +85054,65 @@ ${lanes.join("\n")} const typeId = type2.id; const isConstructorObject = getObjectFlags(type2) & 16 && type2.symbol && type2.symbol.flags & 32; const id = getObjectFlags(type2) & 4 && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0; - if (!context.visitedTypes) { - context.visitedTypes = /* @__PURE__ */ new Set(); + if (!context2.visitedTypes) { + context2.visitedTypes = /* @__PURE__ */ new Set(); } - if (id && !context.symbolDepth) { - context.symbolDepth = /* @__PURE__ */ new Map(); + if (id && !context2.symbolDepth) { + context2.symbolDepth = /* @__PURE__ */ new Map(); } - const links = context.maxExpansionDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration); - const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`; + const links = context2.maxExpansionDepth >= 0 ? void 0 : context2.enclosingDeclaration && getNodeLinks(context2.enclosingDeclaration); + const key = `${getTypeId(type2)}|${context2.flags}|${context2.internalFlags}`; if (links) { links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map()); } const cachedResult = (_a22 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a22.get(key); if (cachedResult) { (_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach( - ([symbol2, enclosingDeclaration, meaning]) => context.tracker.trackSymbol( + ([symbol2, enclosingDeclaration, meaning]) => context2.tracker.trackSymbol( symbol2, enclosingDeclaration, meaning ) ); if (cachedResult.truncating) { - context.truncating = true; + context2.truncating = true; } - context.approximateLength += cachedResult.addedLength; + context2.approximateLength += cachedResult.addedLength; return deepCloneOrReuseNode(cachedResult.node); } let depth; if (id) { - depth = context.symbolDepth.get(id) || 0; + depth = context2.symbolDepth.get(id) || 0; if (depth > 10) { - return createElidedInformationPlaceholder(context); + return createElidedInformationPlaceholder(context2); } - context.symbolDepth.set(id, depth + 1); + context2.symbolDepth.set(id, depth + 1); } - context.visitedTypes.add(typeId); - const prevTrackedSymbols = context.trackedSymbols; - context.trackedSymbols = void 0; - const startLength = context.approximateLength; + context2.visitedTypes.add(typeId); + const prevTrackedSymbols = context2.trackedSymbols; + context2.trackedSymbols = void 0; + const startLength = context2.approximateLength; const result = transform22(type2); - const addedLength = context.approximateLength - startLength; - if (!context.reportedDiagnostic && !context.encounteredError) { + const addedLength = context2.approximateLength - startLength; + if (!context2.reportedDiagnostic && !context2.encounteredError) { (_c = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _c.set(key, { node: result, - truncating: context.truncating, + truncating: context2.truncating, addedLength, - trackedSymbols: context.trackedSymbols + trackedSymbols: context2.trackedSymbols }); } - context.visitedTypes.delete(typeId); + context2.visitedTypes.delete(typeId); if (id) { - context.symbolDepth.set(id, depth); + context2.symbolDepth.set(id, depth); } - context.trackedSymbols = prevTrackedSymbols; + context2.trackedSymbols = prevTrackedSymbols; return result; function deepCloneOrReuseNode(node) { if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) { return node; } - return setTextRange2(context, factory.cloneNode(visitEachChild( + return setTextRange2(context2, factory.cloneNode(visitEachChild( node, deepCloneOrReuseNode, /*context*/ @@ -81864,7 +85139,7 @@ ${lanes.join("\n")} const resolved = resolveStructuredTypeMembers(type2); if (!resolved.properties.length && !resolved.indexInfos.length) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - context.approximateLength += 2; + context2.approximateLength += 2; return setEmitFlags( factory.createTypeLiteralNode( /*members*/ @@ -81876,12 +85151,12 @@ ${lanes.join("\n")} } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { const signature = resolved.callSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 185, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 185, context2); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { const signature = resolved.constructSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 186, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 186, context2); return signatureNode; } } @@ -81890,21 +85165,21 @@ ${lanes.join("\n")} const types = map2(abstractSignatures, getOrCreateTypeFromSignature); const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per // the logic in `createTypeNodesFromResolvedType`. - (context.flags & 2048 ? countWhere(resolved.properties, (p) => !(p.flags & 4194304)) : length(resolved.properties)); + (context2.flags & 2048 ? countWhere(resolved.properties, (p) => !(p.flags & 4194304)) : length(resolved.properties)); if (typeElementCount) { types.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved)); } - return typeToTypeNodeHelper(getIntersectionType(types), context); + return typeToTypeNodeHelper(getIntersectionType(types), context2); } - const restoreFlags = saveRestoreFlags(context); - context.flags |= 4194304; + const restoreFlags = saveRestoreFlags(context2); + context2.flags |= 4194304; const members = createTypeNodesFromResolvedType(resolved); restoreFlags(); const typeLiteralNode = factory.createTypeLiteralNode(members); - context.approximateLength += 2; + context2.approximateLength += 2; setEmitFlags( typeLiteralNode, - context.flags & 1024 ? 0 : 1 + context2.flags & 1024 ? 0 : 1 /* SingleLine */ ); return typeLiteralNode; @@ -81912,18 +85187,18 @@ ${lanes.join("\n")} function typeReferenceToTypeNode(type2) { let typeArguments = getTypeArguments(type2); if (type2.target === globalArrayType || type2.target === globalReadonlyArrayType) { - if (context.flags & 2) { - const typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context); + if (context2.flags & 2) { + const typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context2); return factory.createTypeReferenceNode(type2.target === globalArrayType ? "Array" : "ReadonlyArray", [typeArgumentNode]); } - const elementType = typeToTypeNodeHelper(typeArguments[0], context); + const elementType = typeToTypeNodeHelper(typeArguments[0], context2); const arrayType = factory.createArrayTypeNode(elementType); return type2.target === globalArrayType ? arrayType : factory.createTypeOperatorNode(148, arrayType); } else if (type2.target.objectFlags & 8) { typeArguments = sameMap(typeArguments, (t, i) => removeMissingType(t, !!(type2.target.elementFlags[i] & 2))); if (typeArguments.length > 0) { const arity = getTypeReferenceArity(type2); - const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context); + const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context2); if (tupleConstituentNodes) { const { labeledElementDeclarations } = type2.target; for (let i = 0; i < tupleConstituentNodes.length; i++) { @@ -81954,7 +85229,7 @@ ${lanes.join("\n")} return type2.target.readonly ? factory.createTypeOperatorNode(148, tupleTypeNode) : tupleTypeNode; } } - if (context.encounteredError || context.flags & 524288) { + if (context2.encounteredError || context2.flags & 524288) { const tupleTypeNode = setEmitFlags( factory.createTupleTypeNode([]), 1 @@ -81962,9 +85237,9 @@ ${lanes.join("\n")} ); return type2.target.readonly ? factory.createTypeOperatorNode(148, tupleTypeNode) : tupleTypeNode; } - context.encounteredError = true; + context2.encounteredError = true; return void 0; - } else if (context.flags & 2048 && type2.symbol.valueDeclaration && isClassLike(type2.symbol.valueDeclaration) && !isValueSymbolAccessible(type2.symbol, context.enclosingDeclaration)) { + } else if (context2.flags & 2048 && type2.symbol.valueDeclaration && isClassLike(type2.symbol.valueDeclaration) && !isValueSymbolAccessible(type2.symbol, context2.enclosingDeclaration)) { return createAnonymousTypeNode(type2); } else { const outerTypeParameters = type2.target.outerTypeParameters; @@ -81979,10 +85254,10 @@ ${lanes.join("\n")} i++; } while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent2); if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) { - const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context); - const restoreFlags2 = saveRestoreFlags(context); - context.flags |= 16; - const ref = symbolToTypeNode(parent2, context, 788968, typeArgumentSlice); + const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context2); + const restoreFlags2 = saveRestoreFlags(context2); + context2.flags |= 16; + const ref = symbolToTypeNode(parent2, context2, 788968, typeArgumentSlice); restoreFlags2(); resultType = !resultType ? ref : appendReferenceToType(resultType, ref); } @@ -82019,11 +85294,11 @@ ${lanes.join("\n")} } } } - typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context); + typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context2); } - const restoreFlags = saveRestoreFlags(context); - context.flags |= 16; - const finalRef = symbolToTypeNode(type2.symbol, context, 788968, typeArgumentNodes); + const restoreFlags = saveRestoreFlags(context2); + context2.flags |= 16; + const finalRef = symbolToTypeNode(type2.symbol, context2, 788968, typeArgumentNodes); restoreFlags(); return !resultType ? finalRef : appendReferenceToType(resultType, finalRef); } @@ -82033,7 +85308,7 @@ ${lanes.join("\n")} let typeArguments = root.typeArguments; let qualifier = root.qualifier; if (qualifier) { - if (isIdentifier26(qualifier)) { + if (isIdentifier28(qualifier)) { if (typeArguments !== getIdentifierTypeArguments(qualifier)) { qualifier = setIdentifierTypeArguments(factory.cloneNode(qualifier), typeArguments); } @@ -82059,7 +85334,7 @@ ${lanes.join("\n")} } else { let typeArguments = root.typeArguments; let typeName = root.typeName; - if (isIdentifier26(typeName)) { + if (isIdentifier28(typeName)) { if (typeArguments !== getIdentifierTypeArguments(typeName)) { typeName = setIdentifierTypeArguments(factory.cloneNode(typeName), typeArguments); } @@ -82083,20 +85358,20 @@ ${lanes.join("\n")} function getAccessStack(ref) { let state = ref.typeName; const ids = []; - while (!isIdentifier26(state)) { + while (!isIdentifier28(state)) { ids.unshift(state.right); state = state.left; } ids.unshift(state); return ids; } - function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) { + function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context22, typeNode) { if (indexInfo.components) { const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => { var _a22; - return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a22 = isEntityNameVisible( + return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context22.enclosingDeclaration && ((_a22 = isEntityNameVisible( e.name.expression, - context2.enclosingDeclaration, + context22.enclosingDeclaration, /*shouldComputeAliasToMakeVisible*/ false )) == null ? void 0 : _a22.accessibility) === 0); @@ -82106,9 +85381,9 @@ ${lanes.join("\n")} return !hasLateBindableName(e); }); return map2(newComponents, (e) => { - trackComputedName(e.name.expression, context2.enclosingDeclaration, context2); + trackComputedName(e.name.expression, context22.enclosingDeclaration, context22); return setTextRange2( - context2, + context22, factory.createPropertySignature( indexInfo.isReadonly ? [factory.createModifier( 148 @@ -82119,19 +85394,19 @@ ${lanes.join("\n")} 58 /* QuestionToken */ ) : void 0, - typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2) + typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context22) ), e ); }); } } - return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)]; + return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context22, typeNode)]; } function createTypeNodesFromResolvedType(resolvedType) { - if (checkTruncationLength(context)) { - context.out.truncated = true; - if (context.flags & 1) { + if (checkTruncationLength(context2)) { + context2.out.truncated = true; + if (context2.flags & 1) { return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3, "elided")]; } return [factory.createPropertySignature( @@ -82144,40 +85419,40 @@ ${lanes.join("\n")} void 0 )]; } - context.typeStack.push(-1); + context2.typeStack.push(-1); const typeElements = []; for (const signature of resolvedType.callSignatures) { - typeElements.push(signatureToSignatureDeclarationHelper(signature, 180, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 180, context2)); } for (const signature of resolvedType.constructSignatures) { if (signature.flags & 4) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 181, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 181, context2)); } for (const info of resolvedType.indexInfos) { - typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 ? createElidedInformationPlaceholder(context) : void 0)); + typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context2, resolvedType.objectFlags & 1024 ? createElidedInformationPlaceholder(context2) : void 0)); } const properties = resolvedType.properties; if (!properties) { - context.typeStack.pop(); + context2.typeStack.pop(); return typeElements; } let i = 0; for (const propertySymbol of properties) { - if (isExpanding(context) && propertySymbol.flags & 4194304) { + if (isExpanding(context2) && propertySymbol.flags & 4194304) { continue; } i++; - if (context.flags & 2048) { + if (context2.flags & 2048) { if (propertySymbol.flags & 4194304) { continue; } - if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 | 4) && context.tracker.reportPrivateInBaseOfClassExpression) { - context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName)); + if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 | 4) && context2.tracker.reportPrivateInBaseOfClassExpression) { + context2.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName)); } } - if (checkTruncationLength(context) && i + 2 < properties.length - 1) { - context.out.truncated = true; - if (context.flags & 1) { + if (checkTruncationLength(context2) && i + 2 < properties.length - 1) { + context2.out.truncated = true; + if (context2.flags & 1) { const typeElement = typeElements.pop(); typeElements.push(addSyntheticTrailingComment(typeElement, 3, `... ${properties.length - i} more elided ...`)); } else { @@ -82191,18 +85466,18 @@ ${lanes.join("\n")} void 0 )); } - addPropertyToElementList(properties[properties.length - 1], context, typeElements); + addPropertyToElementList(properties[properties.length - 1], context2, typeElements); break; } - addPropertyToElementList(propertySymbol, context, typeElements); + addPropertyToElementList(propertySymbol, context2, typeElements); } - context.typeStack.pop(); + context2.typeStack.pop(); return typeElements.length ? typeElements : void 0; } } - function createElidedInformationPlaceholder(context) { - context.approximateLength += 3; - if (!(context.flags & 1)) { + function createElidedInformationPlaceholder(context2) { + context2.approximateLength += 3; + if (!(context2.flags & 1)) { return factory.createTypeReferenceNode( factory.createIdentifier("..."), /*typeArguments*/ @@ -82214,17 +85489,17 @@ ${lanes.join("\n")} /* AnyKeyword */ ), 3, "elided"); } - function shouldUsePlaceholderForProperty(propertySymbol, context) { + function shouldUsePlaceholderForProperty(propertySymbol, context2) { var _a3; const depth = 3; - return !!(getCheckFlags(propertySymbol) & 8192) && (contains(context.reverseMappedStack, propertySymbol) || ((_a3 = context.reverseMappedStack) == null ? void 0 : _a3[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16) || isDeeplyNestedReverseMappedTypeProperty()); + return !!(getCheckFlags(propertySymbol) & 8192) && (contains(context2.reverseMappedStack, propertySymbol) || ((_a3 = context2.reverseMappedStack) == null ? void 0 : _a3[0]) && !(getObjectFlags(last(context2.reverseMappedStack).links.propertyType) & 16) || isDeeplyNestedReverseMappedTypeProperty()); function isDeeplyNestedReverseMappedTypeProperty() { var _a22; - if ((((_a22 = context.reverseMappedStack) == null ? void 0 : _a22.length) ?? 0) < depth) { + if ((((_a22 = context2.reverseMappedStack) == null ? void 0 : _a22.length) ?? 0) < depth) { return false; } for (let i = 0; i < depth; i++) { - const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i]; + const prop = context2.reverseMappedStack[context2.reverseMappedStack.length - 1 - i]; if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) { return false; } @@ -82232,33 +85507,33 @@ ${lanes.join("\n")} return true; } } - function addPropertyToElementList(propertySymbol, context, typeElements) { + function addPropertyToElementList(propertySymbol, context2, typeElements) { var _a3; const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192); - const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol); - const saveEnclosingDeclaration = context.enclosingDeclaration; - context.enclosingDeclaration = void 0; - if (context.tracker.canTrackSymbol && isLateBoundName(propertySymbol.escapedName)) { + const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context2) ? anyType : getNonMissingTypeOfSymbol(propertySymbol); + const saveEnclosingDeclaration = context2.enclosingDeclaration; + context2.enclosingDeclaration = void 0; + if (context2.tracker.canTrackSymbol && isLateBoundName(propertySymbol.escapedName)) { if (propertySymbol.declarations) { const decl = first(propertySymbol.declarations); if (hasLateBindableName(decl)) { if (isBinaryExpression4(decl)) { const name = getNameOfDeclaration(decl); if (name && isElementAccessExpression8(name) && isPropertyAccessEntityNameExpression(name.argumentExpression)) { - trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context); + trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context2); } } else { - trackComputedName(decl.name.expression, saveEnclosingDeclaration, context); + trackComputedName(decl.name.expression, saveEnclosingDeclaration, context2); } } } else { - context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); + context2.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); } } - context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a3 = propertySymbol.declarations) == null ? void 0 : _a3[0]) || saveEnclosingDeclaration; - const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); - context.enclosingDeclaration = saveEnclosingDeclaration; - context.approximateLength += symbolName(propertySymbol).length + 1; + context2.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a3 = propertySymbol.declarations) == null ? void 0 : _a3[0]) || saveEnclosingDeclaration; + const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context2); + context2.enclosingDeclaration = saveEnclosingDeclaration; + context2.approximateLength += symbolName(propertySymbol).length + 1; if (propertySymbol.flags & 98304) { const writeType = getWriteTypeOfSymbol(propertySymbol); if (!isErrorType(propertyType) && !isErrorType(writeType)) { @@ -82278,8 +85553,8 @@ ${lanes.join("\n")} const getterSignature = getSignatureFromDeclaration(getterDeclaration); typeElements.push( setCommentRange2( - context, - signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 178, context, { name: propertyName }), + context2, + signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 178, context2, { name: propertyName }), getterDeclaration ) ); @@ -82293,8 +85568,8 @@ ${lanes.join("\n")} const setterSignature = getSignatureFromDeclaration(setterDeclaration); typeElements.push( setCommentRange2( - context, - signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 179, context, { name: propertyName }), + context2, + signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 179, context2, { name: propertyName }), setterDeclaration ) ); @@ -82319,8 +85594,8 @@ ${lanes.join("\n")} ); typeElements.push( setCommentRange2( - context, - signatureToSignatureDeclarationHelper(fakeGetterSignature, 178, context, { name: propertyName }), + context2, + signatureToSignatureDeclarationHelper(fakeGetterSignature, 178, context2, { name: propertyName }), propDeclaration ) ); @@ -82342,7 +85617,7 @@ ${lanes.join("\n")} /* None */ ); typeElements.push( - signatureToSignatureDeclarationHelper(fakeSetterSignature, 179, context, { name: propertyName }) + signatureToSignatureDeclarationHelper(fakeSetterSignature, 179, context2, { name: propertyName }) ); return; } @@ -82359,7 +85634,7 @@ ${lanes.join("\n")} /* Call */ ); for (const signature of signatures) { - const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 174, context, { name: propertyName, questionToken: optionalToken }); + const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 174, context2, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration)); } if (signatures.length || !optionalToken) { @@ -82367,15 +85642,15 @@ ${lanes.join("\n")} } } let propertyTypeNode; - if (shouldUsePlaceholderForProperty(propertySymbol, context)) { - propertyTypeNode = createElidedInformationPlaceholder(context); + if (shouldUsePlaceholderForProperty(propertySymbol, context2)) { + propertyTypeNode = createElidedInformationPlaceholder(context2); } else { if (propertyIsReverseMapped) { - context.reverseMappedStack || (context.reverseMappedStack = []); - context.reverseMappedStack.push(propertySymbol); + context2.reverseMappedStack || (context2.reverseMappedStack = []); + context2.reverseMappedStack.push(propertySymbol); } propertyTypeNode = propertyType ? serializeTypeForDeclaration( - context, + context2, /*declaration*/ void 0, propertyType, @@ -82385,7 +85660,7 @@ ${lanes.join("\n")} /* AnyKeyword */ ); if (propertyIsReverseMapped) { - context.reverseMappedStack.pop(); + context2.reverseMappedStack.pop(); } } const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken( @@ -82393,7 +85668,7 @@ ${lanes.join("\n")} /* ReadonlyKeyword */ )] : void 0; if (modifiers) { - context.approximateLength += 9; + context2.approximateLength += 9; } const propertySignature = factory.createPropertySignature( modifiers, @@ -82414,24 +85689,24 @@ ${lanes.join("\n")} setSyntheticLeadingComments(node, [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); } } else if (range) { - setCommentRange2(context, node, range); + setCommentRange2(context2, node, range); } return node; } } - function setCommentRange2(context, node, range) { - if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(range)) { + function setCommentRange2(context2, node, range) { + if (context2.enclosingFile && context2.enclosingFile === getSourceFileOfNode(range)) { return setCommentRange(node, range); } return node; } - function mapToTypeNodes(types, context, isBareList) { + function mapToTypeNodes(types, context2, isBareList) { if (some(types)) { - if (checkTruncationLength(context)) { - context.out.truncated = true; + if (checkTruncationLength(context2)) { + context2.out.truncated = true; if (!isBareList) { return [ - context.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( + context2.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( 133 /* AnyKeyword */ ), 3, "elided") : factory.createTypeReferenceNode( @@ -82442,8 +85717,8 @@ ${lanes.join("\n")} ]; } else if (types.length > 2) { return [ - typeToTypeNodeHelper(types[0], context), - context.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( + typeToTypeNodeHelper(types[0], context2), + context2.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( 133 /* AnyKeyword */ ), 3, `... ${types.length - 2} more elided ...`) : factory.createTypeReferenceNode( @@ -82451,20 +85726,20 @@ ${lanes.join("\n")} /*typeArguments*/ void 0 ), - typeToTypeNodeHelper(types[types.length - 1], context) + typeToTypeNodeHelper(types[types.length - 1], context2) ]; } } - const mayHaveNameCollisions = !(context.flags & 64); + const mayHaveNameCollisions = !(context2.flags & 64); const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0; const result = []; let i = 0; for (const type of types) { i++; - if (checkTruncationLength(context) && i + 2 < types.length - 1) { - context.out.truncated = true; + if (checkTruncationLength(context2) && i + 2 < types.length - 1) { + context2.out.truncated = true; result.push( - context.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( + context2.flags & 1 ? addSyntheticLeadingComment(factory.createKeywordTypeNode( 133 /* AnyKeyword */ ), 3, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode( @@ -82473,14 +85748,14 @@ ${lanes.join("\n")} void 0 ) ); - const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context); + const typeNode2 = typeToTypeNodeHelper(types[types.length - 1], context2); if (typeNode2) { result.push(typeNode2); } break; } - context.approximateLength += 2; - const typeNode = typeToTypeNodeHelper(type, context); + context2.approximateLength += 2; + const typeNode = typeToTypeNodeHelper(type, context2); if (typeNode) { result.push(typeNode); if (seenNames && isIdentifierTypeReference(typeNode)) { @@ -82489,12 +85764,12 @@ ${lanes.join("\n")} } } if (seenNames) { - const restoreFlags = saveRestoreFlags(context); - context.flags |= 64; + const restoreFlags = saveRestoreFlags(context2); + context2.flags |= 64; seenNames.forEach((types2) => { if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) { for (const [type, resultIndex] of types2) { - result[resultIndex] = typeToTypeNodeHelper(type, context); + result[resultIndex] = typeToTypeNodeHelper(type, context2); } } }); @@ -82506,9 +85781,9 @@ ${lanes.join("\n")} function typesAreSameReference(a, b) { return a === b || !!a.symbol && a.symbol === b.symbol || !!a.aliasSymbol && a.aliasSymbol === b.aliasSymbol; } - function indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, typeNode) { + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode) { const name = getNameFromIndexInfo(indexInfo) || "x"; - const indexerTypeNode = typeToTypeNodeHelper(indexInfo.keyType, context); + const indexerTypeNode = typeToTypeNodeHelper(indexInfo.keyType, context2); const indexingParameter = factory.createParameterDeclaration( /*modifiers*/ void 0, @@ -82522,12 +85797,12 @@ ${lanes.join("\n")} void 0 ); if (!typeNode) { - typeNode = typeToTypeNodeHelper(indexInfo.type || anyType, context); + typeNode = typeToTypeNodeHelper(indexInfo.type || anyType, context2); } - if (!indexInfo.type && !(context.flags & 2097152)) { - context.encounteredError = true; + if (!indexInfo.type && !(context2.flags & 2097152)) { + context2.encounteredError = true; } - context.approximateLength += name.length + 4; + context2.approximateLength += name.length + 4; return factory.createIndexSignature( indexInfo.isReadonly ? [factory.createToken( 148 @@ -82537,7 +85812,7 @@ ${lanes.join("\n")} typeNode ); } - function signatureToSignatureDeclarationHelper(signature, kind, context, options) { + function signatureToSignatureDeclarationHelper(signature, kind, context2, options) { var _a3; let typeParameters; let typeArguments; @@ -82546,27 +85821,27 @@ ${lanes.join("\n")} /*skipUnionExpanding*/ true )[0]; - const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper); - context.approximateLength += 3; - if (context.flags & 32 && signature.target && signature.mapper && signature.target.typeParameters) { - typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context)); + const cleanup = enterNewScope(context2, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper); + context2.approximateLength += 3; + if (context2.flags & 32 && signature.target && signature.mapper && signature.target.typeParameters) { + typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context2)); } else { - typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context)); + typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context2)); } - const restoreFlags = saveRestoreFlags(context); - context.flags &= ~256; + const restoreFlags = saveRestoreFlags(context2); + context2.flags &= ~256; const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration( parameter, - context, + context2, kind === 177 /* Constructor */ )); - const thisParameter = context.flags & 33554432 ? void 0 : tryGetThisParameterDeclaration(signature, context); + const thisParameter = context2.flags & 33554432 ? void 0 : tryGetThisParameterDeclaration(signature, context2); if (thisParameter) { parameters.unshift(thisParameter); } restoreFlags(); - const returnTypeNode = serializeReturnTypeForSignature(context, signature); + const returnTypeNode = serializeReturnTypeForSignature(context2, signature); let modifiers = options == null ? void 0 : options.modifiers; if (kind === 186 && signature.flags & 4) { const flags = modifiersToFlags(modifiers); @@ -82609,7 +85884,7 @@ ${lanes.join("\n")} modifiers, /*asteriskToken*/ void 0, - (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier26) : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier28) : factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, @@ -82619,7 +85894,7 @@ ${lanes.join("\n")} modifiers, /*asteriskToken*/ void 0, - (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier26) : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier28) : factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, @@ -82653,18 +85928,18 @@ ${lanes.join("\n")} cleanup == null ? void 0 : cleanup(); return node; } - function createRecoveryBoundary(context) { + function createRecoveryBoundary(context2) { if (cancellationToken && cancellationToken.throwIfCancellationRequested) { cancellationToken.throwIfCancellationRequested(); } let trackedSymbols; let unreportedErrors; let hadError = false; - const oldTracker = context.tracker; - const oldTrackedSymbols = context.trackedSymbols; - context.trackedSymbols = void 0; - const oldEncounteredError = context.encounteredError; - context.tracker = new SymbolTrackerImpl(context, { + const oldTracker = context2.tracker; + const oldTrackedSymbols = context2.trackedSymbols; + context2.trackedSymbols = void 0; + const oldEncounteredError = context2.encounteredError; + context2.tracker = new SymbolTrackerImpl(context2, { ...oldTracker.inner, reportCyclicStructureError() { markError(() => oldTracker.reportCyclicStructureError()); @@ -82688,8 +85963,8 @@ ${lanes.join("\n")} (trackedSymbols ?? (trackedSymbols = [])).push([sym, decl, meaning]); return false; }, - moduleResolverHost: context.tracker.moduleResolverHost - }, context.tracker.moduleResolverHost); + moduleResolverHost: context2.tracker.moduleResolverHost + }, context2.tracker.moduleResolverHost); return { startRecoveryScope, finalizeBoundary, @@ -82716,15 +85991,15 @@ ${lanes.join("\n")} }; } function finalizeBoundary() { - context.tracker = oldTracker; - context.trackedSymbols = oldTrackedSymbols; - context.encounteredError = oldEncounteredError; + context2.tracker = oldTracker; + context2.trackedSymbols = oldTrackedSymbols; + context2.encounteredError = oldEncounteredError; unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn()); if (hadError) { return false; } trackedSymbols == null ? void 0 : trackedSymbols.forEach( - ([symbol2, enclosingDeclaration, meaning]) => context.tracker.trackSymbol( + ([symbol2, enclosingDeclaration, meaning]) => context2.tracker.trackSymbol( symbol2, enclosingDeclaration, meaning @@ -82733,23 +86008,23 @@ ${lanes.join("\n")} return true; } } - function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) { - const cleanupContext = cloneNodeBuilderContext(context); + function enterNewScope(context2, declaration, expandedParams, typeParameters, originalParameters, mapper) { + const cleanupContext = cloneNodeBuilderContext(context2); let cleanupParams; let cleanupTypeParams; - const oldEnclosingDecl = context.enclosingDeclaration; - const oldMapper = context.mapper; + const oldEnclosingDecl = context2.enclosingDeclaration; + const oldMapper = context2.mapper; if (mapper) { - context.mapper = mapper; + context2.mapper = mapper; } - if (context.enclosingDeclaration && declaration) { + if (context2.enclosingDeclaration && declaration) { let pushFakeScope2 = function(kind, addAll) { - Debug.assert(context.enclosingDeclaration); + Debug.assert(context2.enclosingDeclaration); let existingFakeScope; - if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind) { - existingFakeScope = context.enclosingDeclaration; - } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind) { - existingFakeScope = context.enclosingDeclaration.parent; + if (getNodeLinks(context2.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind) { + existingFakeScope = context2.enclosingDeclaration; + } else if (context2.enclosingDeclaration.parent && getNodeLinks(context2.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind) { + existingFakeScope = context2.enclosingDeclaration.parent; } Debug.assertOptionalNode(existingFakeScope, isBlock6); const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable(); @@ -82770,8 +86045,8 @@ ${lanes.join("\n")} const fakeScope = factory.createBlock(emptyArray); getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind; fakeScope.locals = locals; - setParent(fakeScope, context.enclosingDeclaration); - context.enclosingDeclaration = fakeScope; + setParent(fakeScope, context2.enclosingDeclaration); + context2.enclosingDeclaration = fakeScope; } else { return function undo() { forEach(newLocals, (s) => locals.delete(s)); @@ -82823,12 +86098,12 @@ ${lanes.join("\n")} } } ); - if (context.flags & 4 && some(typeParameters)) { + if (context2.flags & 4 && some(typeParameters)) { cleanupTypeParams = pushFakeScope2( "typeParams", (add) => { for (const typeParam of typeParameters ?? emptyArray) { - const typeParamName = typeParameterToName(typeParam, context).escapedText; + const typeParamName = typeParameterToName(typeParam, context2).escapedText; add(typeParamName, typeParam.symbol); } } @@ -82839,13 +86114,13 @@ ${lanes.join("\n")} cleanupParams == null ? void 0 : cleanupParams(); cleanupTypeParams == null ? void 0 : cleanupTypeParams(); cleanupContext(); - context.enclosingDeclaration = oldEnclosingDecl; - context.mapper = oldMapper; + context2.enclosingDeclaration = oldEnclosingDecl; + context2.mapper = oldMapper; }; } - function tryGetThisParameterDeclaration(signature, context) { + function tryGetThisParameterDeclaration(signature, context2) { if (signature.thisParameter) { - return symbolToParameterDeclaration(signature.thisParameter, context); + return symbolToParameterDeclaration(signature.thisParameter, context2); } if (signature.declaration && isInJSFile(signature.declaration)) { const thisTag = getJSDocThisTag(signature.declaration); @@ -82858,29 +86133,29 @@ ${lanes.join("\n")} "this", /*questionToken*/ void 0, - typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context) + typeToTypeNodeHelper(getTypeFromTypeNode2(context2, thisTag.typeExpression), context2) ); } } } - function typeParameterToDeclarationWithConstraint(type, context, constraintNode) { - const restoreFlags = saveRestoreFlags(context); - context.flags &= ~512; + function typeParameterToDeclarationWithConstraint(type, context2, constraintNode) { + const restoreFlags = saveRestoreFlags(context2); + context2.flags &= ~512; const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type)); - const name = typeParameterToName(type, context); + const name = typeParameterToName(type, context2); const defaultParameter = getDefaultFromTypeParameter(type); - const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context); + const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context2); restoreFlags(); return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode); } - function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) { - return !canPossiblyExpandType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context); + function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context2) { + return !canPossiblyExpandType(type, context2) && typeNode && getTypeFromTypeNode2(context2, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context2, typeNode) || typeToTypeNodeHelper(type, context2); } - function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) { - const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context); - return typeParameterToDeclarationWithConstraint(type, context, constraintNode); + function typeParameterToDeclaration(type, context2, constraint = getConstraintOfTypeParameter(type)) { + const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context2); + return typeParameterToDeclarationWithConstraint(type, context2, constraintNode); } - function typePredicateToTypePredicateNodeHelper(typePredicate, context) { + function typePredicateToTypePredicateNodeHelper(typePredicate, context2) { const assertsModifier = typePredicate.kind === 2 || typePredicate.kind === 3 ? factory.createToken( 131 /* AssertsKeyword */ @@ -82890,7 +86165,7 @@ ${lanes.join("\n")} 16777216 /* NoAsciiEscaping */ ) : factory.createThisTypeNode(); - const typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context); + const typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context2); return factory.createTypePredicateNode(assertsModifier, parameterName, typeNode); } function getEffectiveParameterDeclaration(parameterSymbol) { @@ -82910,17 +86185,17 @@ ${lanes.join("\n")} ); } } - function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { + function symbolToParameterDeclaration(parameterSymbol, context2, preserveModifierFlags) { const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol); const parameterType = getTypeOfSymbol(parameterSymbol); - const parameterTypeNode = serializeTypeForDeclaration(context, parameterDeclaration, parameterType, parameterSymbol); - const modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map2(getModifiers(parameterDeclaration), factory.cloneNode) : void 0; + const parameterTypeNode = serializeTypeForDeclaration(context2, parameterDeclaration, parameterType, parameterSymbol); + const modifiers = !(context2.flags & 8192) && preserveModifierFlags && parameterDeclaration && canHaveModifiers2(parameterDeclaration) ? map2(getModifiers2(parameterDeclaration), factory.cloneNode) : void 0; const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768; const dotDotDotToken = isRest ? factory.createToken( 26 /* DotDotDotToken */ ) : void 0; - const name = parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context); + const name = parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context2); const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384; const questionToken = isOptional ? factory.createToken( 58 @@ -82935,10 +86210,10 @@ ${lanes.join("\n")} /*initializer*/ void 0 ); - context.approximateLength += symbolName(parameterSymbol).length + 3; + context2.approximateLength += symbolName(parameterSymbol).length + 3; return parameterNode; } - function parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context) { + function parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context2) { return parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 ? setEmitFlags( factory.cloneNode(parameterDeclaration.name), 16777216 @@ -82951,8 +86226,8 @@ ${lanes.join("\n")} function cloneBindingName(node) { return elideInitializerAndSetEmitFlags(node); function elideInitializerAndSetEmitFlags(node2) { - if (context.tracker.canTrackSymbol && isComputedPropertyName(node2) && isLateBindableName(node2)) { - trackComputedName(node2.expression, context.enclosingDeclaration, context); + if (context2.tracker.canTrackSymbol && isComputedPropertyName(node2) && isLateBindableName(node2)) { + trackComputedName(node2.expression, context2.enclosingDeclaration, context2); } let visited = visitEachChild( node2, @@ -82984,8 +86259,8 @@ ${lanes.join("\n")} } } } - function trackComputedName(accessExpression, enclosingDeclaration, context) { - if (!context.tracker.canTrackSymbol) return; + function trackComputedName(accessExpression, enclosingDeclaration, context2) { + if (!context2.tracker.canTrackSymbol) return; const firstIdentifier = getFirstIdentifier(accessExpression); const name = resolveName( enclosingDeclaration, @@ -82997,7 +86272,7 @@ ${lanes.join("\n")} true ); if (name) { - context.tracker.trackSymbol( + context2.tracker.trackSymbol( name, enclosingDeclaration, 111551 @@ -83014,7 +86289,7 @@ ${lanes.join("\n")} true ); if (fallback) { - context.tracker.trackSymbol( + context2.tracker.trackSymbol( fallback, enclosingDeclaration, 111551 @@ -83023,14 +86298,14 @@ ${lanes.join("\n")} } } } - function lookupSymbolChain(symbol2, context, meaning, yieldModuleSymbol) { - context.tracker.trackSymbol(symbol2, context.enclosingDeclaration, meaning); - return lookupSymbolChainWorker(symbol2, context, meaning, yieldModuleSymbol); + function lookupSymbolChain(symbol2, context2, meaning, yieldModuleSymbol) { + context2.tracker.trackSymbol(symbol2, context2.enclosingDeclaration, meaning); + return lookupSymbolChainWorker(symbol2, context2, meaning, yieldModuleSymbol); } - function lookupSymbolChainWorker(symbol2, context, meaning, yieldModuleSymbol) { + function lookupSymbolChainWorker(symbol2, context2, meaning, yieldModuleSymbol) { let chain; const isTypeParameter = symbol2.flags & 262144; - if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64) && !(context.internalFlags & 4)) { + if (!isTypeParameter && (context2.enclosingDeclaration || context2.flags & 64) && !(context2.internalFlags & 4)) { chain = Debug.checkDefined(getSymbolChain( symbol2, meaning, @@ -83043,13 +86318,13 @@ ${lanes.join("\n")} } return chain; function getSymbolChain(symbol22, meaning2, endOfChain) { - let accessibleSymbolChain = getAccessibleSymbolChain(symbol22, context.enclosingDeclaration, meaning2, !!(context.flags & 128)); + let accessibleSymbolChain = getAccessibleSymbolChain(symbol22, context2.enclosingDeclaration, meaning2, !!(context2.flags & 128)); let parentSpecifiers; - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) { - const parents = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol22, context.enclosingDeclaration, meaning2); + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context2.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) { + const parents = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol22, context2.enclosingDeclaration, meaning2); if (length(parents)) { parentSpecifiers = parents.map( - (symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0 + (symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context2) : void 0 ); const indices = parents.map((_, i) => i); indices.sort(sortByBestName); @@ -83108,38 +86383,38 @@ ${lanes.join("\n")} } } } - function typeParametersToTypeParameterDeclarations(symbol2, context) { + function typeParametersToTypeParameterDeclarations(symbol2, context2) { let typeParameterNodes; const targetSymbol = getTargetSymbol(symbol2); if (targetSymbol.flags & (32 | 64 | 524288)) { - typeParameterNodes = factory.createNodeArray(map2(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol2), (tp) => typeParameterToDeclaration(tp, context))); + typeParameterNodes = factory.createNodeArray(map2(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol2), (tp) => typeParameterToDeclaration(tp, context2))); } return typeParameterNodes; } - function lookupTypeParameterNodes(chain, index, context) { + function lookupTypeParameterNodes(chain, index, context2) { var _a3; Debug.assert(chain && 0 <= index && index < chain.length); const symbol2 = chain[index]; const symbolId = getSymbolId(symbol2); - if ((_a3 = context.typeParameterSymbolList) == null ? void 0 : _a3.has(symbolId)) { + if ((_a3 = context2.typeParameterSymbolList) == null ? void 0 : _a3.has(symbolId)) { return void 0; } - if (context.mustCreateTypeParameterSymbolList) { - context.mustCreateTypeParameterSymbolList = false; - context.typeParameterSymbolList = new Set(context.typeParameterSymbolList); + if (context2.mustCreateTypeParameterSymbolList) { + context2.mustCreateTypeParameterSymbolList = false; + context2.typeParameterSymbolList = new Set(context2.typeParameterSymbolList); } - context.typeParameterSymbolList.add(symbolId); + context2.typeParameterSymbolList.add(symbolId); let typeParameterNodes; - if (context.flags & 512 && index < chain.length - 1) { + if (context2.flags & 512 && index < chain.length - 1) { const parentSymbol = symbol2; const nextSymbol = chain[index + 1]; if (getCheckFlags(nextSymbol) & 1) { const params2 = getTypeParametersOfClassOrInterface( - parentSymbol.flags & 2097152 ? resolveAlias(parentSymbol) : parentSymbol + parentSymbol.flags & 2097152 ? resolveAlias2(parentSymbol) : parentSymbol ); - typeParameterNodes = mapToTypeNodes(map2(params2, (t) => getMappedType(t, nextSymbol.links.mapper)), context); + typeParameterNodes = mapToTypeNodes(map2(params2, (t) => getMappedType(t, nextSymbol.links.mapper)), context2); } else { - typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol2, context); + typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol2, context2); } } return typeParameterNodes; @@ -83150,7 +86425,7 @@ ${lanes.join("\n")} } return top; } - function getSpecifierForModuleSymbol(symbol2, context, overrideImportMode) { + function getSpecifierForModuleSymbol(symbol2, context2, overrideImportMode) { let file2 = getDeclarationOfKind( symbol2, 308 @@ -83174,22 +86449,22 @@ ${lanes.join("\n")} return symbol2.escapedName.substring(1, symbol2.escapedName.length - 1); } } - if (!context.enclosingFile || !context.tracker.moduleResolverHost) { + if (!context2.enclosingFile || !context2.tracker.moduleResolverHost) { if (ambientModuleSymbolRegex.test(symbol2.escapedName)) { return symbol2.escapedName.substring(1, symbol2.escapedName.length - 1); } return getSourceFileOfNode(getNonAugmentationDeclaration(symbol2)).fileName; } - const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration); + const enclosingDeclaration = getOriginalNode(context2.enclosingDeclaration); const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0; - const contextFile = context.enclosingFile; + const contextFile = context2.enclosingFile; const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile); const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode); const links = getSymbolLinks(symbol2); let specifier = links.specifierCache && links.specifierCache.get(cacheKey); if (!specifier) { const isBundle2 = !!compilerOptions.outFile; - const { moduleResolverHost } = context.tracker; + const { moduleResolverHost } = context2.tracker; const specifierCompilerOptions = isBundle2 ? { ...compilerOptions, baseUrl: moduleResolverHost.getCommonSourceDirectory() } : compilerOptions; specifier = first(getModuleSpecifiers( symbol2, @@ -83212,13 +86487,13 @@ ${lanes.join("\n")} const identifier = factory.createIdentifier(unescapeLeadingUnderscores(symbol2.escapedName)); return symbol2.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol2.parent), identifier) : identifier; } - function symbolToTypeNode(symbol2, context, meaning, overrideTypeArguments) { - const chain = lookupSymbolChain(symbol2, context, meaning, !(context.flags & 16384)); + function symbolToTypeNode(symbol2, context2, meaning, overrideTypeArguments) { + const chain = lookupSymbolChain(symbol2, context2, meaning, !(context2.flags & 16384)); const isTypeOf = meaning === 111551; if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { const nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : void 0; - const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context); - const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration)); + const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context2); + const contextFile = getSourceFileOfNode(getOriginalNode(context2.enclosingDeclaration)); const targetFile = getSourceFileOfModule(chain[0]); let specifier; let attributes; @@ -83226,7 +86501,7 @@ ${lanes.join("\n")} if ((targetFile == null ? void 0 : targetFile.impliedNodeFormat) === 99 && targetFile.impliedNodeFormat !== (contextFile == null ? void 0 : contextFile.impliedNodeFormat)) { specifier = getSpecifierForModuleSymbol( chain[0], - context, + context2, 99 /* ESNext */ ); @@ -83241,13 +86516,13 @@ ${lanes.join("\n")} } } if (!specifier) { - specifier = getSpecifierForModuleSymbol(chain[0], context); + specifier = getSpecifierForModuleSymbol(chain[0], context2); } - if (!(context.flags & 67108864) && getEmitModuleResolutionKind(compilerOptions) !== 1 && specifier.includes("/node_modules/")) { + if (!(context2.flags & 67108864) && getEmitModuleResolutionKind(compilerOptions) !== 1 && specifier.includes("/node_modules/")) { const oldSpecifier = specifier; if (getEmitModuleResolutionKind(compilerOptions) === 3 || getEmitModuleResolutionKind(compilerOptions) === 99) { const swappedMode = (contextFile == null ? void 0 : contextFile.impliedNodeFormat) === 99 ? 1 : 99; - specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode); + specifier = getSpecifierForModuleSymbol(chain[0], context2, swappedMode); if (specifier.includes("/node_modules/")) { specifier = oldSpecifier; } else { @@ -83262,17 +86537,17 @@ ${lanes.join("\n")} } } if (!attributes) { - context.encounteredError = true; - if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier); + context2.encounteredError = true; + if (context2.tracker.reportLikelyUnsafeImportRequiredError) { + context2.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier); } } } const lit2 = factory.createLiteralTypeNode(factory.createStringLiteral(specifier)); - context.approximateLength += specifier.length + 10; + context2.approximateLength += specifier.length + 10; if (!nonRootParts || isEntityName(nonRootParts)) { if (nonRootParts) { - const lastId = isIdentifier26(nonRootParts) ? nonRootParts : nonRootParts.right; + const lastId = isIdentifier28(nonRootParts) ? nonRootParts : nonRootParts.right; setIdentifierTypeArguments( lastId, /*typeArguments*/ @@ -83293,7 +86568,7 @@ ${lanes.join("\n")} if (isTypeOf) { return factory.createTypeQueryNode(entityName); } else { - const lastId = isIdentifier26(entityName) ? entityName : entityName.right; + const lastId = isIdentifier28(entityName) ? entityName : entityName.right; const lastTypeArgs = getIdentifierTypeArguments(lastId); setIdentifierTypeArguments( lastId, @@ -83303,15 +86578,15 @@ ${lanes.join("\n")} return factory.createTypeReferenceNode(entityName, lastTypeArgs); } function createAccessFromSymbolChain(chain2, index, stopper) { - const typeParameterNodes = index === chain2.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain2, index, context); + const typeParameterNodes = index === chain2.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain2, index, context2); const symbol22 = chain2[index]; const parent2 = chain2[index - 1]; let symbolName2; if (index === 0) { - context.flags |= 16777216; - symbolName2 = getNameOfSymbolAsWritten(symbol22, context); - context.approximateLength += (symbolName2 ? symbolName2.length : 0) + 1; - context.flags ^= 16777216; + context2.flags |= 16777216; + symbolName2 = getNameOfSymbolAsWritten(symbol22, context2); + context2.approximateLength += (symbolName2 ? symbolName2.length : 0) + 1; + context2.flags ^= 16777216; } else { if (parent2 && getExportsOfSymbol(parent2)) { const exports2 = getExportsOfSymbol(parent2); @@ -83332,10 +86607,10 @@ ${lanes.join("\n")} } return LHS; } - symbolName2 = getNameOfSymbolAsWritten(symbol22, context); + symbolName2 = getNameOfSymbolAsWritten(symbol22, context2); } - context.approximateLength += symbolName2.length + 1; - if (!(context.flags & 16) && parent2 && getMembersOfSymbol(parent2) && getMembersOfSymbol(parent2).get(symbol22.escapedName) && getSymbolIfSameReference(getMembersOfSymbol(parent2).get(symbol22.escapedName), symbol22)) { + context2.approximateLength += symbolName2.length + 1; + if (!(context2.flags & 16) && parent2 && getMembersOfSymbol(parent2) && getMembersOfSymbol(parent2).get(symbol22.escapedName) && getSymbolIfSameReference(getMembersOfSymbol(parent2).get(symbol22.escapedName), symbol22)) { const LHS = createAccessFromSymbolChain(chain2, index - 1, stopper); if (isIndexedAccessTypeNode(LHS)) { return factory.createIndexedAccessTypeNode(LHS, factory.createLiteralTypeNode(factory.createStringLiteral(symbolName2))); @@ -83360,9 +86635,9 @@ ${lanes.join("\n")} return identifier; } } - function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) { + function typeParameterShadowsOtherTypeParameterInScope(escapedName, context2, type) { const result = resolveName( - context.enclosingDeclaration, + context2.enclosingDeclaration, escapedName, 788968, /*nameNotFoundMessage*/ @@ -83375,17 +86650,17 @@ ${lanes.join("\n")} } return false; } - function typeParameterToName(type, context) { + function typeParameterToName(type, context2) { var _a3, _b, _c, _d; - if (context.flags & 4 && context.typeParameterNames) { - const cached2 = context.typeParameterNames.get(getTypeId(type)); + if (context2.flags & 4 && context2.typeParameterNames) { + const cached2 = context2.typeParameterNames.get(getTypeId(type)); if (cached2) { return cached2; } } let result = symbolToName( type.symbol, - context, + context2, 788968, /*expectsIdentifier*/ true @@ -83395,13 +86670,13 @@ ${lanes.join("\n")} } const decl = (_b = (_a3 = type.symbol) == null ? void 0 : _a3.declarations) == null ? void 0 : _b[0]; if (decl && isTypeParameterDeclaration(decl)) { - result = setTextRange2(context, result, decl.name); + result = setTextRange2(context2, result, decl.name); } - if (context.flags & 4) { + if (context2.flags & 4) { const rawtext = result.escapedText; - let i = ((_c = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _c.get(rawtext)) || 0; + let i = ((_c = context2.typeParameterNamesByTextNextNameCount) == null ? void 0 : _c.get(rawtext)) || 0; let text = rawtext; - while (((_d = context.typeParameterNamesByText) == null ? void 0 : _d.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) { + while (((_d = context2.typeParameterNamesByText) == null ? void 0 : _d.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context2, type)) { i++; text = `${rawtext}_${i}`; } @@ -83410,33 +86685,33 @@ ${lanes.join("\n")} result = factory.createIdentifier(text); setIdentifierTypeArguments(result, typeArguments); } - if (context.mustCreateTypeParametersNamesLookups) { - context.mustCreateTypeParametersNamesLookups = false; - context.typeParameterNames = new Map(context.typeParameterNames); - context.typeParameterNamesByTextNextNameCount = new Map(context.typeParameterNamesByTextNextNameCount); - context.typeParameterNamesByText = new Set(context.typeParameterNamesByText); + if (context2.mustCreateTypeParametersNamesLookups) { + context2.mustCreateTypeParametersNamesLookups = false; + context2.typeParameterNames = new Map(context2.typeParameterNames); + context2.typeParameterNamesByTextNextNameCount = new Map(context2.typeParameterNamesByTextNextNameCount); + context2.typeParameterNamesByText = new Set(context2.typeParameterNamesByText); } - context.typeParameterNamesByTextNextNameCount.set(rawtext, i); - context.typeParameterNames.set(getTypeId(type), result); - context.typeParameterNamesByText.add(text); + context2.typeParameterNamesByTextNextNameCount.set(rawtext, i); + context2.typeParameterNames.set(getTypeId(type), result); + context2.typeParameterNamesByText.add(text); } return result; } - function symbolToName(symbol2, context, meaning, expectsIdentifier) { - const chain = lookupSymbolChain(symbol2, context, meaning); - if (expectsIdentifier && chain.length !== 1 && !context.encounteredError && !(context.flags & 65536)) { - context.encounteredError = true; + function symbolToName(symbol2, context2, meaning, expectsIdentifier) { + const chain = lookupSymbolChain(symbol2, context2, meaning); + if (expectsIdentifier && chain.length !== 1 && !context2.encounteredError && !(context2.flags & 65536)) { + context2.encounteredError = true; } return createEntityNameFromSymbolChain(chain, chain.length - 1); function createEntityNameFromSymbolChain(chain2, index) { - const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context); + const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context2); const symbol22 = chain2[index]; if (index === 0) { - context.flags |= 16777216; + context2.flags |= 16777216; } - const symbolName2 = getNameOfSymbolAsWritten(symbol22, context); + const symbolName2 = getNameOfSymbolAsWritten(symbol22, context2); if (index === 0) { - context.flags ^= 16777216; + context2.flags ^= 16777216; } const identifier = setEmitFlags( factory.createIdentifier(symbolName2), @@ -83448,23 +86723,23 @@ ${lanes.join("\n")} return index > 0 ? factory.createQualifiedName(createEntityNameFromSymbolChain(chain2, index - 1), identifier) : identifier; } } - function symbolToExpression(symbol2, context, meaning) { - const chain = lookupSymbolChain(symbol2, context, meaning); + function symbolToExpression(symbol2, context2, meaning) { + const chain = lookupSymbolChain(symbol2, context2, meaning); return createExpressionFromSymbolChain(chain, chain.length - 1); function createExpressionFromSymbolChain(chain2, index) { - const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context); + const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context2); const symbol22 = chain2[index]; if (index === 0) { - context.flags |= 16777216; + context2.flags |= 16777216; } - let symbolName2 = getNameOfSymbolAsWritten(symbol22, context); + let symbolName2 = getNameOfSymbolAsWritten(symbol22, context2); if (index === 0) { - context.flags ^= 16777216; + context2.flags ^= 16777216; } let firstChar = symbolName2.charCodeAt(0); if (isSingleOrDoubleQuote(firstChar) && some(symbol22.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { - const specifier = getSpecifierForModuleSymbol(symbol22, context); - context.approximateLength += 2 + specifier.length; + const specifier = getSpecifierForModuleSymbol(symbol22, context2); + context2.approximateLength += 2 + specifier.length; return factory.createStringLiteral(specifier); } if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) { @@ -83475,7 +86750,7 @@ ${lanes.join("\n")} ); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol22; - context.approximateLength += 1 + symbolName2.length; + context2.approximateLength += 1 + symbolName2.length; return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier; } else { if (firstChar === 91) { @@ -83485,14 +86760,14 @@ ${lanes.join("\n")} let expression; if (isSingleOrDoubleQuote(firstChar) && !(symbol22.flags & 8)) { const literalText = stripQuotes(symbolName2).replace(/\\./g, (s) => s.substring(1)); - context.approximateLength += literalText.length + 2; + context2.approximateLength += literalText.length + 2; expression = factory.createStringLiteral( literalText, firstChar === 39 /* singleQuote */ ); } else if ("" + +symbolName2 === symbolName2) { - context.approximateLength += symbolName2.length; + context2.approximateLength += symbolName2.length; expression = factory.createNumericLiteral(+symbolName2); } if (!expression) { @@ -83503,10 +86778,10 @@ ${lanes.join("\n")} ); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol22; - context.approximateLength += symbolName2.length; + context2.approximateLength += symbolName2.length; expression = identifier; } - context.approximateLength += 2; + context2.approximateLength += 2; return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), expression); } } @@ -83534,10 +86809,10 @@ ${lanes.join("\n")} false ), "'"))); } - function getPropertyNameNodeForSymbol(symbol2, context) { + function getPropertyNameNodeForSymbol(symbol2, context2) { const hashPrivateName = getClonedHashPrivateName(symbol2); if (hashPrivateName) { - const shouldEmitErroneousFieldName = !!context.tracker.reportPrivateInBaseOfClassExpression && context.flags & 2048; + const shouldEmitErroneousFieldName = !!context2.tracker.reportPrivateInBaseOfClassExpression && context2.flags & 2048; if (!shouldEmitErroneousFieldName) { return hashPrivateName; } else { @@ -83557,14 +86832,14 @@ ${lanes.join("\n")} const stringNamed = !!length(symbol2.declarations) && every(symbol2.declarations, isStringNamed); const singleQuote = !!length(symbol2.declarations) && every(symbol2.declarations, isSingleQuotedStringNamed); const isMethod = !!(symbol2.flags & 8192); - const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol2, context, singleQuote, stringNamed, isMethod); + const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol2, context2, singleQuote, stringNamed, isMethod); if (fromNameType) { return fromNameType; } const rawName = unescapeLeadingUnderscores(symbol2.escapedName); return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } - function getPropertyNameNodeForSymbolFromNameType(symbol2, context, singleQuote, stringNamed, isMethod) { + function getPropertyNameNodeForSymbolFromNameType(symbol2, context2, singleQuote, stringNamed, isMethod) { const nameType = getSymbolLinks(symbol2).nameType; if (nameType) { if (nameType.flags & 384) { @@ -83580,29 +86855,29 @@ ${lanes.join("\n")} if (nameType.flags & 8192) { return factory.createComputedPropertyName(symbolToExpression( nameType.symbol, - context, + context2, 111551 /* Value */ )); } } } - function cloneNodeBuilderContext(context) { - const oldMustCreateTypeParameterSymbolList = context.mustCreateTypeParameterSymbolList; - const oldMustCreateTypeParametersNamesLookups = context.mustCreateTypeParametersNamesLookups; - context.mustCreateTypeParameterSymbolList = true; - context.mustCreateTypeParametersNamesLookups = true; - const oldTypeParameterNames = context.typeParameterNames; - const oldTypeParameterNamesByText = context.typeParameterNamesByText; - const oldTypeParameterNamesByTextNextNameCount = context.typeParameterNamesByTextNextNameCount; - const oldTypeParameterSymbolList = context.typeParameterSymbolList; + function cloneNodeBuilderContext(context2) { + const oldMustCreateTypeParameterSymbolList = context2.mustCreateTypeParameterSymbolList; + const oldMustCreateTypeParametersNamesLookups = context2.mustCreateTypeParametersNamesLookups; + context2.mustCreateTypeParameterSymbolList = true; + context2.mustCreateTypeParametersNamesLookups = true; + const oldTypeParameterNames = context2.typeParameterNames; + const oldTypeParameterNamesByText = context2.typeParameterNamesByText; + const oldTypeParameterNamesByTextNextNameCount = context2.typeParameterNamesByTextNextNameCount; + const oldTypeParameterSymbolList = context2.typeParameterSymbolList; return () => { - context.typeParameterNames = oldTypeParameterNames; - context.typeParameterNamesByText = oldTypeParameterNamesByText; - context.typeParameterNamesByTextNextNameCount = oldTypeParameterNamesByTextNextNameCount; - context.typeParameterSymbolList = oldTypeParameterSymbolList; - context.mustCreateTypeParameterSymbolList = oldMustCreateTypeParameterSymbolList; - context.mustCreateTypeParametersNamesLookups = oldMustCreateTypeParametersNamesLookups; + context2.typeParameterNames = oldTypeParameterNames; + context2.typeParameterNamesByText = oldTypeParameterNamesByText; + context2.typeParameterNamesByTextNextNameCount = oldTypeParameterNamesByTextNextNameCount; + context2.typeParameterSymbolList = oldTypeParameterSymbolList; + context2.mustCreateTypeParameterSymbolList = oldMustCreateTypeParameterSymbolList; + context2.mustCreateTypeParametersNamesLookups = oldMustCreateTypeParametersNamesLookups; }; } function getDeclarationWithTypeAnnotation(symbol2, enclosingDeclaration) { @@ -83623,24 +86898,24 @@ ${lanes.join("\n")} } return enclosingDeclaration; } - function serializeInferredTypeForDeclaration(symbol2, context, type) { - if (type.flags & 8192 && type.symbol === symbol2 && (!context.enclosingDeclaration || some(symbol2.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) { - context.flags |= 1048576; + function serializeInferredTypeForDeclaration(symbol2, context2, type) { + if (type.flags & 8192 && type.symbol === symbol2 && (!context2.enclosingDeclaration || some(symbol2.declarations, (d) => getSourceFileOfNode(d) === context2.enclosingFile))) { + context2.flags |= 1048576; } - const result = typeToTypeNodeHelper(type, context); + const result = typeToTypeNodeHelper(type, context2); return result; } - function serializeTypeForDeclaration(context, declaration, type, symbol2) { + function serializeTypeForDeclaration(context2, declaration, type, symbol2) { var _a3; let result; - const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration); + const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context2.enclosingDeclaration); const decl = declaration ?? symbol2.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol2) ?? ((_a3 = symbol2.declarations) == null ? void 0 : _a3[0]); - if (!canPossiblyExpandType(type, context) && decl) { - const restore = addSymbolTypeToContext(context, symbol2, type); + if (!canPossiblyExpandType(type, context2) && decl) { + const restore = addSymbolTypeToContext(context2, symbol2, type); if (isAccessor(decl)) { - result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol2, context); + result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol2, context2); } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608)) { - result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol2, context); + result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol2, context2); } restore(); } @@ -83648,7 +86923,7 @@ ${lanes.join("\n")} if (addUndefinedForParameter) { type = getOptionalType(type); } - result = serializeInferredTypeForDeclaration(symbol2, context, type); + result = serializeInferredTypeForDeclaration(symbol2, context2, type); } return result ?? factory.createKeywordTypeNode( 133 @@ -83678,21 +86953,21 @@ ${lanes.join("\n")} } return false; } - function serializeReturnTypeForSignature(context, signature) { - const suppressAny = context.flags & 256; - const restoreFlags = saveRestoreFlags(context); - if (suppressAny) context.flags &= ~256; + function serializeReturnTypeForSignature(context2, signature) { + const suppressAny = context2.flags & 256; + const restoreFlags = saveRestoreFlags(context2); + if (suppressAny) context2.flags &= ~256; let returnTypeNode; const returnType = getReturnTypeOfSignature(signature); if (!(suppressAny && isTypeAny(returnType))) { - if (signature.declaration && !nodeIsSynthesized(signature.declaration) && !canPossiblyExpandType(returnType, context)) { + if (signature.declaration && !nodeIsSynthesized(signature.declaration) && !canPossiblyExpandType(returnType, context2)) { const declarationSymbol = getSymbolOfDeclaration(signature.declaration); - const restore = addSymbolTypeToContext(context, declarationSymbol, returnType); - returnTypeNode = syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, declarationSymbol, context); + const restore = addSymbolTypeToContext(context2, declarationSymbol, returnType); + returnTypeNode = syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, declarationSymbol, context2); restore(); } if (!returnTypeNode) { - returnTypeNode = serializeInferredReturnTypeForSignature(context, signature, returnType); + returnTypeNode = serializeInferredReturnTypeForSignature(context2, signature, returnType); } } if (!returnTypeNode && !suppressAny) { @@ -83704,15 +86979,15 @@ ${lanes.join("\n")} restoreFlags(); return returnTypeNode; } - function serializeInferredReturnTypeForSignature(context, signature, returnType) { - const oldSuppressReportInferenceFallback = context.suppressReportInferenceFallback; - context.suppressReportInferenceFallback = true; + function serializeInferredReturnTypeForSignature(context2, signature, returnType) { + const oldSuppressReportInferenceFallback = context2.suppressReportInferenceFallback; + context2.suppressReportInferenceFallback = true; const typePredicate = getTypePredicateOfSignature(signature); - const returnTypeNode = typePredicate ? typePredicateToTypePredicateNodeHelper(context.mapper ? instantiateTypePredicate(typePredicate, context.mapper) : typePredicate, context) : typeToTypeNodeHelper(returnType, context); - context.suppressReportInferenceFallback = oldSuppressReportInferenceFallback; + const returnTypeNode = typePredicate ? typePredicateToTypePredicateNodeHelper(context2.mapper ? instantiateTypePredicate(typePredicate, context2.mapper) : typePredicate, context2) : typeToTypeNodeHelper(returnType, context2); + context2.suppressReportInferenceFallback = oldSuppressReportInferenceFallback; return returnTypeNode; } - function trackExistingEntityName(node, context, enclosingDeclaration = context.enclosingDeclaration) { + function trackExistingEntityName(node, context2, enclosingDeclaration = context2.enclosingDeclaration) { let introducesError = false; const leftmost = getFirstIdentifier(node); if (isInJSFile(node) && (isExportsIdentifier(leftmost) || isModuleExportsAccessExpression(leftmost.parent) || isQualifiedName2(leftmost.parent) && isModuleIdentifier(leftmost.parent.left) && isExportsIdentifier(leftmost.parent.right))) { @@ -83737,7 +87012,7 @@ ${lanes.join("\n")} false ).accessibility !== 0) { introducesError = true; - context.tracker.reportInaccessibleThisError(); + context2.tracker.reportInaccessibleThisError(); } return { introducesError, node: attachSymbolToLeftmostIdentifier(node) }; } @@ -83749,7 +87024,7 @@ ${lanes.join("\n")} /*dontResolveAlias*/ true ); - if (context.enclosingDeclaration && !(sym && sym.flags & 262144)) { + if (context2.enclosingDeclaration && !(sym && sym.flags & 262144)) { sym = getExportSymbolOfValueSymbolIfExported(sym); const symAtLocation = resolveEntityName( leftmost, @@ -83758,7 +87033,7 @@ ${lanes.join("\n")} true, /*dontResolveAlias*/ true, - context.enclosingDeclaration + context2.enclosingDeclaration ); if ( // Check for unusable parameters symbols @@ -83767,7 +87042,7 @@ ${lanes.join("\n")} symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym) ) { if (symAtLocation !== unknownSymbol) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } introducesError = true; return { introducesError, node, sym }; @@ -83789,10 +87064,10 @@ ${lanes.join("\n")} /*shouldComputeAliasesToMakeVisible*/ false ).accessibility !== 0) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); introducesError = true; } else { - context.tracker.trackSymbol(sym, enclosingDeclaration, meaning); + context2.tracker.trackSymbol(sym, enclosingDeclaration, meaning); } return { introducesError, node: attachSymbolToLeftmostIdentifier(node) }; } @@ -83800,9 +87075,9 @@ ${lanes.join("\n")} function attachSymbolToLeftmostIdentifier(node2) { if (node2 === leftmost) { const type = getDeclaredTypeOfSymbol(sym); - const name = sym.flags & 262144 ? typeParameterToName(type, context) : factory.cloneNode(node2); + const name = sym.flags & 262144 ? typeParameterToName(type, context2) : factory.cloneNode(node2); name.symbol = sym; - return setTextRange2(context, setEmitFlags( + return setTextRange2(context2, setEmitFlags( name, 16777216 /* NoAsciiEscaping */ @@ -83814,10 +87089,10 @@ ${lanes.join("\n")} /*context*/ void 0 ); - return setTextRange2(context, updated, node2); + return setTextRange2(context2, updated, node2); } } - function serializeTypeName(context, node, isTypeOf, typeArguments) { + function serializeTypeName(context2, node, isTypeOf, typeArguments) { const meaning = isTypeOf ? 111551 : 788968; const symbol2 = resolveEntityName( node, @@ -83826,19 +87101,19 @@ ${lanes.join("\n")} true ); if (!symbol2) return void 0; - const resolvedSymbol = symbol2.flags & 2097152 ? resolveAlias(symbol2) : symbol2; + const resolvedSymbol = symbol2.flags & 2097152 ? resolveAlias2(symbol2) : symbol2; if (isSymbolAccessible( symbol2, - context.enclosingDeclaration, + context2.enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ false ).accessibility !== 0) return void 0; - return symbolToTypeNode(resolvedSymbol, context, meaning, typeArguments); + return symbolToTypeNode(resolvedSymbol, context2, meaning, typeArguments); } - function canReuseTypeNode(context, existing) { + function canReuseTypeNode(context2, existing) { const type = getTypeFromTypeNode2( - context, + context2, existing, /*noMappedTypes*/ true @@ -83861,22 +87136,22 @@ ${lanes.join("\n")} if (!symbol2) return false; if (symbol2.flags & 262144) { const declaredType = getDeclaredTypeOfSymbol(symbol2); - return !(context.mapper && getMappedType(declaredType, context.mapper) !== declaredType); + return !(context2.mapper && getMappedType(declaredType, context2.mapper) !== declaredType); } if (isInJSDoc(existing)) { return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && !!(symbol2.flags & 788968); } } if (isTypeOperatorNode(existing) && existing.operator === 158 && existing.type.kind === 155) { - const effectiveEnclosingContext = context.enclosingDeclaration && getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration); + const effectiveEnclosingContext = context2.enclosingDeclaration && getEnclosingDeclarationIgnoringFakeScope(context2.enclosingDeclaration); return !!findAncestor(existing, (n) => n === effectiveEnclosingContext); } return true; } - function serializeExistingTypeNode(context, typeNode, addUndefined) { - const type = getTypeFromTypeNode2(context, typeNode); - if (addUndefined && !someType(type, (t) => !!(t.flags & 32768)) && canReuseTypeNode(context, typeNode)) { - const clone22 = syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode); + function serializeExistingTypeNode(context2, typeNode, addUndefined) { + const type = getTypeFromTypeNode2(context2, typeNode); + if (addUndefined && !someType(type, (t) => !!(t.flags & 32768)) && canReuseTypeNode(context2, typeNode)) { + const clone22 = syntacticNodeBuilder.tryReuseExistingTypeNode(context2, typeNode); if (clone22) { return factory.createUnionTypeNode([clone22, factory.createKeywordTypeNode( 157 @@ -83884,9 +87159,9 @@ ${lanes.join("\n")} )]); } } - return typeToTypeNodeHelper(type, context); + return typeToTypeNodeHelper(type, context2); } - function symbolTableToDeclarationStatements(symbolTable, context) { + function symbolTableToDeclarationStatements(symbolTable, context2) { var _a3; const serializePropertySymbolForClass = makeSerializePropertySymbol( factory.createPropertyDeclaration, @@ -83900,12 +87175,12 @@ ${lanes.join("\n")} /*useAccessors*/ false ); - const enclosingDeclaration = context.enclosingDeclaration; + const enclosingDeclaration = context2.enclosingDeclaration; let results = []; const visitedSymbols = /* @__PURE__ */ new Set(); const deferredPrivatesStack = []; - const oldcontext = context; - context = { + const oldcontext = context2; + context2 = { ...oldcontext, usedSymbolNames: new Set(oldcontext.usedSymbolNames), remappedSymbolNames: /* @__PURE__ */ new Map(), @@ -83916,7 +87191,7 @@ ${lanes.join("\n")} ...oldcontext.tracker.inner, trackSymbol: (sym, decl, meaning) => { var _a22, _b; - if ((_a22 = context.remappedSymbolNames) == null ? void 0 : _a22.has(getSymbolId(sym))) return false; + if ((_a22 = context2.remappedSymbolNames) == null ? void 0 : _a22.has(getSymbolId(sym))) return false; const accessibleResult = isSymbolAccessible( sym, decl, @@ -83925,7 +87200,7 @@ ${lanes.join("\n")} false ); if (accessibleResult.accessibility === 0) { - const chain = lookupSymbolChainWorker(sym, context, meaning); + const chain = lookupSymbolChainWorker(sym, context2, meaning); if (!(sym.flags & 4)) { const root = chain[0]; const contextFile = getSourceFileOfNode(oldcontext.enclosingDeclaration); @@ -83939,12 +87214,12 @@ ${lanes.join("\n")} return false; } }; - context.tracker = new SymbolTrackerImpl(context, tracker, oldcontext.tracker.moduleResolverHost); + context2.tracker = new SymbolTrackerImpl(context2, tracker, oldcontext.tracker.moduleResolverHost); forEachEntry(symbolTable, (symbol2, name) => { const baseName = unescapeLeadingUnderscores(name); void getInternalSymbolName(symbol2, baseName); }); - let addingDeclare = !context.bundled; + let addingDeclare = !context2.bundled; const exportEquals = symbolTable.get( "export=" /* ExportEquals */ @@ -83959,16 +87234,16 @@ ${lanes.join("\n")} return !!node && node.kind === 80; } function getNamesOfDeclaration(statement) { - if (isVariableStatement11(statement)) { + if (isVariableStatement12(statement)) { return filter(map2(statement.declarationList.declarations, getNameOfDeclaration), isIdentifierAndNotUndefined); } return filter([getNameOfDeclaration(statement)], isIdentifierAndNotUndefined); } function flattenExportAssignedNamespace(statements) { - const exportAssignment = find(statements, isExportAssignment3); + const exportAssignment = find(statements, isExportAssignment4); const nsIndex = findIndex(statements, isModuleDeclaration); let ns = nsIndex !== -1 ? statements[nsIndex] : void 0; - if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier26(exportAssignment.expression) && isIdentifier26(ns.name) && idText(ns.name) === idText(exportAssignment.expression) && ns.body && isModuleBlock(ns.body)) { + if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier28(exportAssignment.expression) && isIdentifier28(ns.name) && idText(ns.name) === idText(exportAssignment.expression) && ns.body && isModuleBlock(ns.body)) { const excessExports = filter(statements, (s) => !!(getEffectiveModifierFlags(s) & 32)); const name = ns.name; let body = ns.body; @@ -84007,7 +87282,7 @@ ${lanes.join("\n")} s, 32 /* Export */ - ) || isExportAssignment3(s) || isExportDeclaration2(s)); + ) || isExportAssignment4(s) || isExportDeclaration3(s)); forEach(body.statements, (s) => { addResult( s, @@ -84021,9 +87296,9 @@ ${lanes.join("\n")} return statements; } function mergeExportDeclarations(statements) { - const exports2 = filter(statements, (d) => isExportDeclaration2(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports2(d.exportClause)); + const exports2 = filter(statements, (d) => isExportDeclaration3(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports2(d.exportClause)); if (length(exports2) > 1) { - const nonExports = filter(statements, (d) => !isExportDeclaration2(d) || !!d.moduleSpecifier || !d.exportClause); + const nonExports = filter(statements, (d) => !isExportDeclaration3(d) || !!d.moduleSpecifier || !d.exportClause); statements = [ ...nonExports, factory.createExportDeclaration( @@ -84037,7 +87312,7 @@ ${lanes.join("\n")} ) ]; } - const reexports = filter(statements, (d) => isExportDeclaration2(d) && !!d.moduleSpecifier && !!d.exportClause && isNamedExports2(d.exportClause)); + const reexports = filter(statements, (d) => isExportDeclaration3(d) && !!d.moduleSpecifier && !!d.exportClause && isNamedExports2(d.exportClause)); if (length(reexports) > 1) { const groups = group(reexports, (decl) => isStringLiteral15(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"); if (groups.length !== reexports.length) { @@ -84061,7 +87336,7 @@ ${lanes.join("\n")} return statements; } function inlineExportModifiers(statements) { - const index = findIndex(statements, (d) => isExportDeclaration2(d) && !d.moduleSpecifier && !d.attributes && !!d.exportClause && isNamedExports2(d.exportClause)); + const index = findIndex(statements, (d) => isExportDeclaration3(d) && !d.moduleSpecifier && !d.attributes && !!d.exportClause && isNamedExports2(d.exportClause)); if (index >= 0) { const exportDecl = statements[index]; const replacements = mapDefined(exportDecl.exportClause.elements, (e) => { @@ -84121,8 +87396,8 @@ ${lanes.join("\n")} const symbols = Array.from(symbolTable2.values()); for (const symbol2 of symbols) { i++; - if (checkTruncationLengthIfExpanding(context) && i + 2 < symbolTable2.size - 1) { - context.out.truncated = true; + if (checkTruncationLengthIfExpanding(context2) && i + 2 < symbolTable2.size - 1) { + context2.out.truncated = true; results.push(createTruncationStatement(`... (${symbolTable2.size - i} more ...)`)); serializeSymbol( symbols[symbols.length - 1], @@ -84160,10 +87435,10 @@ ${lanes.join("\n")} visitedSymbols.add(getSymbolId(visitedSym)); const skipMembershipCheck = !isPrivate; if (skipMembershipCheck || !!length(symbol2.declarations) && some(symbol2.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) { - const scopeCleanup = cloneNodeBuilderContext(context); - context.tracker.pushErrorFallbackNode(find(symbol2.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile)); + const scopeCleanup = cloneNodeBuilderContext(context2); + context2.tracker.pushErrorFallbackNode(find(symbol2.declarations, (d) => getSourceFileOfNode(d) === context2.enclosingFile)); serializeSymbolWorker(symbol2, isPrivate, propertyAsAlias); - context.tracker.popErrorFallbackNode(); + context2.tracker.popErrorFallbackNode(); scopeCleanup(); } } @@ -84171,8 +87446,8 @@ ${lanes.join("\n")} var _a22, _b, _c, _d, _e, _f, _g; const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName); const isDefault = escapedSymbolName === "default"; - if (isPrivate && !(context.flags & 131072) && isStringANonContextualKeyword(symbolName2) && !isDefault) { - context.encounteredError = true; + if (isPrivate && !(context2.flags & 131072) && isStringANonContextualKeyword(symbolName2) && !isDefault) { + context2.encounteredError = true; return; } let needsPostExportDefault = isDefault && !!(symbol2.flags & -113 || symbol2.flags & 16 && length(getPropertiesOfType(getTypeOfSymbol(symbol2)))) && !(symbol2.flags & 2097152); @@ -84200,12 +87475,12 @@ ${lanes.join("\n")} const type = getTypeOfSymbol(symbol2); const localName = getInternalSymbolName(symbol2, symbolName2); if (type.symbol && type.symbol !== symbol2 && type.symbol.flags & 16 && some(type.symbol.declarations, isFunctionExpressionOrArrowFunction) && (((_a22 = type.symbol.members) == null ? void 0 : _a22.size) || ((_b = type.symbol.exports) == null ? void 0 : _b.size))) { - if (!context.remappedSymbolReferences) { - context.remappedSymbolReferences = /* @__PURE__ */ new Map(); + if (!context2.remappedSymbolReferences) { + context2.remappedSymbolReferences = /* @__PURE__ */ new Map(); } - context.remappedSymbolReferences.set(getSymbolId(type.symbol), symbol2); + context2.remappedSymbolReferences.set(getSymbolId(type.symbol), symbol2); serializeSymbolWorker(type.symbol, isPrivate, propertyAsAlias, escapedSymbolName); - context.remappedSymbolReferences.delete(getSymbolId(type.symbol)); + context2.remappedSymbolReferences.delete(getSymbolId(type.symbol)); } else if (!(symbol2.flags & 16) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol2)) { serializeAsFunctionNamespaceMerge(type, symbol2, localName, modifierFlags); } else { @@ -84215,10 +87490,10 @@ ${lanes.join("\n")} if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { textRange = textRange.parent.parent; } - const propertyAccessRequire = (_e = symbol2.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression16); - if (propertyAccessRequire && isBinaryExpression4(propertyAccessRequire.parent) && isIdentifier26(propertyAccessRequire.parent.right) && ((_f = type.symbol) == null ? void 0 : _f.valueDeclaration) && isSourceFile(type.symbol.valueDeclaration)) { + const propertyAccessRequire = (_e = symbol2.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression17); + if (propertyAccessRequire && isBinaryExpression4(propertyAccessRequire.parent) && isIdentifier28(propertyAccessRequire.parent.right) && ((_f = type.symbol) == null ? void 0 : _f.valueDeclaration) && isSourceFile(type.symbol.valueDeclaration)) { const alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right; - context.approximateLength += 12 + (((_g = alias == null ? void 0 : alias.escapedText) == null ? void 0 : _g.length) ?? 0); + context2.approximateLength += 12 + (((_g = alias == null ? void 0 : alias.escapedText) == null ? void 0 : _g.length) ?? 0); addResult( factory.createExportDeclaration( /*modifiers*/ @@ -84235,15 +87510,15 @@ ${lanes.join("\n")} 0 /* None */ ); - context.tracker.trackSymbol( + context2.tracker.trackSymbol( type.symbol, - context.enclosingDeclaration, + context2.enclosingDeclaration, 111551 /* Value */ ); } else { const statement = setTextRange2( - context, + context2, factory.createVariableStatement( /*modifiers*/ void 0, @@ -84253,7 +87528,7 @@ ${lanes.join("\n")} /*exclamationToken*/ void 0, serializeTypeForDeclaration( - context, + context2, /*declaration*/ void 0, type, @@ -84264,10 +87539,10 @@ ${lanes.join("\n")} ), textRange ); - context.approximateLength += 7 + name.length; + context2.approximateLength += 7 + name.length; addResult(statement, name !== localName ? modifierFlags & ~32 : modifierFlags); if (name !== localName && !isPrivate) { - context.approximateLength += 16 + name.length + localName.length; + context2.approximateLength += 16 + name.length + localName.length; addResult( factory.createExportDeclaration( /*modifiers*/ @@ -84319,8 +87594,8 @@ ${lanes.join("\n")} const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); if (!resolvedModule) continue; const isTypeOnly = node.isTypeOnly; - const specifier = getSpecifierForModuleSymbol(resolvedModule, context); - context.approximateLength += 17 + specifier.length; + const specifier = getSpecifierForModuleSymbol(resolvedModule, context2); + context2.approximateLength += 17 + specifier.length; addResult( factory.createExportDeclaration( /*modifiers*/ @@ -84338,7 +87613,7 @@ ${lanes.join("\n")} } if (needsPostExportDefault) { const internalSymbolName = getInternalSymbolName(symbol2, symbolName2); - context.approximateLength += 16 + internalSymbolName.length; + context2.approximateLength += 16 + internalSymbolName.length; addResult( factory.createExportAssignment( /*modifiers*/ @@ -84352,7 +87627,7 @@ ${lanes.join("\n")} ); } else if (needsExportDeclaration) { const internalSymbolName = getInternalSymbolName(symbol2, symbolName2); - context.approximateLength += 22 + symbolName2.length + internalSymbolName.length; + context2.approximateLength += 22 + symbolName2.length + internalSymbolName.length; addResult( factory.createExportDeclaration( /*modifiers*/ @@ -84375,21 +87650,21 @@ ${lanes.join("\n")} if (some(symbol2.declarations, isPartOfParameterDeclaration)) return; Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]); getUnusedName(unescapeLeadingUnderscores(symbol2.escapedName), symbol2); - const isExternalImportAlias = !!(symbol2.flags & 2097152) && !some(symbol2.declarations, (d) => !!findAncestor(d, isExportDeclaration2) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference)); + const isExternalImportAlias = !!(symbol2.flags & 2097152) && !some(symbol2.declarations, (d) => !!findAncestor(d, isExportDeclaration3) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference)); deferredPrivatesStack[isExternalImportAlias ? 0 : deferredPrivatesStack.length - 1].set(getSymbolId(symbol2), symbol2); } function isExportingScope(enclosingDeclaration2) { return isSourceFile(enclosingDeclaration2) && (isExternalOrCommonJsModule(enclosingDeclaration2) || isJsonSourceFile(enclosingDeclaration2)) || isAmbientModule(enclosingDeclaration2) && !isGlobalScopeAugmentation(enclosingDeclaration2); } function addResult(node, additionalModifierFlags) { - if (canHaveModifiers(node)) { + if (canHaveModifiers2(node)) { const oldModifierFlags = getEffectiveModifierFlags(node); let newModifierFlags = 0; - const enclosingDeclaration2 = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); + const enclosingDeclaration2 = context2.enclosingDeclaration && (isJSDocTypeAlias(context2.enclosingDeclaration) ? getSourceFileOfNode(context2.enclosingDeclaration) : context2.enclosingDeclaration); if (additionalModifierFlags & 32 && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) { newModifierFlags |= 32; } - if (addingDeclare && !(newModifierFlags & 32) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 33554432)) && (isEnumDeclaration(node) || isVariableStatement11(node) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isModuleDeclaration(node))) { + if (addingDeclare && !(newModifierFlags & 32) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 33554432)) && (isEnumDeclaration(node) || isVariableStatement12(node) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isModuleDeclaration(node))) { newModifierFlags |= 128; } if (additionalModifierFlags & 2048 && (isClassDeclaration5(node) || isInterfaceDeclaration2(node) || isFunctionDeclaration5(node))) { @@ -84398,7 +87673,7 @@ ${lanes.join("\n")} if (newModifierFlags) { node = factory.replaceModifiers(node, newModifierFlags | oldModifierFlags); } - context.approximateLength += modifiersLength(newModifierFlags | oldModifierFlags); + context2.approximateLength += modifiersLength(newModifierFlags | oldModifierFlags); } results.push(node); } @@ -84406,16 +87681,16 @@ ${lanes.join("\n")} var _a22; const aliasType = getDeclaredTypeOfTypeAlias(symbol2); const typeParams = getSymbolLinks(symbol2).typeParameters; - const typeParamDecls = map2(typeParams, (p) => typeParameterToDeclaration(p, context)); + const typeParamDecls = map2(typeParams, (p) => typeParameterToDeclaration(p, context2)); const jsdocAliasDecl = (_a22 = symbol2.declarations) == null ? void 0 : _a22.find(isJSDocTypeAlias); const commentText = getTextOfJSDocComment2(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0); - const restoreFlags = saveRestoreFlags(context); - context.flags |= 8388608; - const oldEnclosingDecl = context.enclosingDeclaration; - context.enclosingDeclaration = jsdocAliasDecl; - const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && syntacticNodeBuilder.tryReuseExistingTypeNode(context, jsdocAliasDecl.typeExpression.type) || typeToTypeNodeHelper(aliasType, context); + const restoreFlags = saveRestoreFlags(context2); + context2.flags |= 8388608; + const oldEnclosingDecl = context2.enclosingDeclaration; + context2.enclosingDeclaration = jsdocAliasDecl; + const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && syntacticNodeBuilder.tryReuseExistingTypeNode(context2, jsdocAliasDecl.typeExpression.type) || typeToTypeNodeHelper(aliasType, context2); const internalSymbolName = getInternalSymbolName(symbol2, symbolName2); - context.approximateLength += 8 + ((commentText == null ? void 0 : commentText.length) ?? 0) + internalSymbolName.length; + context2.approximateLength += 8 + ((commentText == null ? void 0 : commentText.length) ?? 0) + internalSymbolName.length; addResult( setSyntheticLeadingComments( factory.createTypeAliasDeclaration( @@ -84430,14 +87705,14 @@ ${lanes.join("\n")} modifierFlags ); restoreFlags(); - context.enclosingDeclaration = oldEnclosingDecl; + context2.enclosingDeclaration = oldEnclosingDecl; } function serializeInterface(symbol2, symbolName2, modifierFlags) { const internalSymbolName = getInternalSymbolName(symbol2, symbolName2); - context.approximateLength += 14 + internalSymbolName.length; + context2.approximateLength += 14 + internalSymbolName.length; const interfaceType = getDeclaredTypeOfClassOrInterface(symbol2); const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol2); - const typeParamDecls = map2(localParams, (p) => typeParameterToDeclaration(p, context)); + const typeParamDecls = map2(localParams, (p) => typeParameterToDeclaration(p, context2)); const baseTypes = getBaseTypes(interfaceType); const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : void 0; const members = serializePropertySymbolsForClassOrInterface( @@ -84483,8 +87758,8 @@ ${lanes.join("\n")} let i = 0; for (const prop of props) { i++; - if (checkTruncationLengthIfExpanding(context) && i + 2 < props.length - 1) { - context.out.truncated = true; + if (checkTruncationLengthIfExpanding(context2) && i + 2 < props.length - 1) { + context2.out.truncated = true; const placeholder = createTruncationProperty(`... ${props.length - i} more ... `, isClass); elements.push(placeholder); const result2 = isClass ? serializePropertySymbolForClass(props[props.length - 1], isStatic2, baseType) : serializePropertySymbolForInterface(props[props.length - 1], baseType); @@ -84495,7 +87770,7 @@ ${lanes.join("\n")} } break; } - context.approximateLength += 1; + context2.approximateLength += 1; const result = isClass ? serializePropertySymbolForClass(prop, isStatic2, baseType) : serializePropertySymbolForInterface(prop, baseType); if (isArray(result)) { elements.push(...result); @@ -84506,7 +87781,7 @@ ${lanes.join("\n")} return elements; } function createTruncationProperty(dotDotDotText, isClass) { - if (context.flags & 1) { + if (context2.flags & 1) { return addSyntheticLeadingComment(factory.createNotEmittedTypeElement(), 3, dotDotDotText); } return isClass ? factory.createPropertyDeclaration( @@ -84552,32 +87827,32 @@ ${lanes.join("\n")} } function serializeModule(symbol2, symbolName2, modifierFlags) { const members = getNamespaceMembersForSerialization(symbol2); - const expanding = isExpanding(context); + const expanding = isExpanding(context2); const locationMap = arrayToMultiMap(members, (m) => m.parent && m.parent === symbol2 || expanding ? "real" : "merged"); const realMembers = locationMap.get("real") || emptyArray; const mergedMembers = locationMap.get("merged") || emptyArray; if (length(realMembers) || expanding) { let localName; if (expanding) { - const oldFlags = context.flags; - context.flags |= 512 | 2; + const oldFlags = context2.flags; + context2.flags |= 512 | 2; localName = symbolToNode( symbol2, - context, + context2, /*meaning*/ -1 /* All */ ); - context.flags = oldFlags; + context2.flags = oldFlags; } else { const localText = getInternalSymbolName(symbol2, symbolName2); localName = factory.createIdentifier(localText); - context.approximateLength += localText.length; + context2.approximateLength += localText.length; } serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol2.flags & (16 | 67108864))); } if (length(mergedMembers)) { - const containingFile = getSourceFileOfNode(context.enclosingDeclaration); + const containingFile = getSourceFileOfNode(context2.enclosingDeclaration); const localName = getInternalSymbolName(symbol2, symbolName2); const nsBody = factory.createModuleBlock([factory.createExportDeclaration( /*modifiers*/ @@ -84594,7 +87869,7 @@ ${lanes.join("\n")} const localName2 = getInternalSymbolName(s, name); const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s); if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) { - (_b = (_a22 = context.tracker) == null ? void 0 : _a22.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a22, containingFile, symbol2, s); + (_b = (_a22 = context2.tracker) == null ? void 0 : _a22.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a22, containingFile, symbol2, s); return void 0; } const target = aliasDecl && getTargetOfAliasDeclaration( @@ -84628,14 +87903,14 @@ ${lanes.join("\n")} } function serializeEnum(symbol2, symbolName2, modifierFlags) { const internalSymbolName = getInternalSymbolName(symbol2, symbolName2); - context.approximateLength += 9 + internalSymbolName.length; + context2.approximateLength += 9 + internalSymbolName.length; const members = []; const memberProps = filter(getPropertiesOfType(getTypeOfSymbol(symbol2)), (p) => !!(p.flags & 8)); let i = 0; for (const p of memberProps) { i++; - if (checkTruncationLengthIfExpanding(context) && i + 2 < memberProps.length - 1) { - context.out.truncated = true; + if (checkTruncationLengthIfExpanding(context2) && i + 2 < memberProps.length - 1) { + context2.out.truncated = true; members.push(factory.createEnumMember(` ... ${memberProps.length - i} more ... `)); const last2 = memberProps[memberProps.length - 1]; const initializedValue = last2.declarations && last2.declarations[0] && isEnumMember(last2.declarations[0]) ? getConstantValue2(last2.declarations[0]) : void 0; @@ -84651,7 +87926,7 @@ ${lanes.join("\n")} const memberDecl = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? p.declarations[0] : void 0; let initializer3; let initializerLength; - if (isExpanding(context) && memberDecl && memberDecl.initializer) { + if (isExpanding(context2) && memberDecl && memberDecl.initializer) { initializer3 = getSynthesizedDeepClone(memberDecl.initializer); initializerLength = memberDecl.initializer.end - memberDecl.initializer.pos; } else { @@ -84660,7 +87935,7 @@ ${lanes.join("\n")} initializerLength = (initializer3 == null ? void 0 : initializer3.text.length) ?? 0; } const memberName = unescapeLeadingUnderscores(p.escapedName); - context.approximateLength += 4 + memberName.length + initializerLength; + context2.approximateLength += 4 + memberName.length + initializerLength; const member = factory.createEnumMember( memberName, initializer3 @@ -84683,13 +87958,13 @@ ${lanes.join("\n")} /* Call */ ); for (const sig of signatures) { - context.approximateLength += 1; - const decl = signatureToSignatureDeclarationHelper(sig, 263, context, { name: factory.createIdentifier(localName) }); - addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags); + context2.approximateLength += 1; + const decl = signatureToSignatureDeclarationHelper(sig, 263, context2, { name: factory.createIdentifier(localName) }); + addResult(setTextRange2(context2, decl, getSignatureTextRangeLocation(sig)), modifierFlags); } if (!(symbol2.flags & (512 | 1024) && !!symbol2.exports && !!symbol2.exports.size)) { const props = filter(getPropertiesOfType(type), isNamespaceMember); - context.approximateLength += localName.length; + context2.approximateLength += localName.length; serializeAsNamespaceDeclaration( props, factory.createIdentifier(localName), @@ -84700,7 +87975,7 @@ ${lanes.join("\n")} } } function createTruncationStatement(dotDotDotText) { - if (context.flags & 1) { + if (context2.flags & 1) { return addSyntheticLeadingComment(factory.createEmptyStatement(), 3, dotDotDotText); } return factory.createExpressionStatement(factory.createIdentifier(dotDotDotText)); @@ -84717,11 +87992,11 @@ ${lanes.join("\n")} return signature.declaration; } function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) { - const nodeFlags = isIdentifier26(localName) ? 32 : 0; - const expanding = isExpanding(context); + const nodeFlags = isIdentifier28(localName) ? 32 : 0; + const expanding = isExpanding(context2); if (length(props)) { - context.approximateLength += 14; - const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) || expanding ? "local" : "remote"); + context2.approximateLength += 14; + const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context2.enclosingDeclaration)) || expanding ? "local" : "remote"); const localProps = localVsRemoteMap.get("local") || emptyArray; let fakespace = parseNodeFactory.createModuleDeclaration( /*modifiers*/ @@ -84737,20 +88012,20 @@ ${lanes.join("\n")} results = []; const oldAddingDeclare = addingDeclare; addingDeclare = false; - const subcontext = { ...context, enclosingDeclaration: fakespace }; - const oldContext = context; - context = subcontext; + const subcontext = { ...context2, enclosingDeclaration: fakespace }; + const oldContext = context2; + context2 = subcontext; visitSymbolTable( createSymbolTable(localProps), suppressNewPrivateContext, /*propertyAsAlias*/ true ); - context = oldContext; + context2 = oldContext; addingDeclare = oldAddingDeclare; const declarations = results; results = oldResults; - const defaultReplaced = map2(declarations, (d) => isExportAssignment3(d) && !d.isExportEquals && isIdentifier26(d.expression) ? factory.createExportDeclaration( + const defaultReplaced = map2(declarations, (d) => isExportAssignment4(d) && !d.isExportEquals && isIdentifier28(d.expression) ? factory.createExportDeclaration( /*modifiers*/ void 0, /*isTypeOnly*/ @@ -84778,7 +88053,7 @@ ${lanes.join("\n")} ); addResult(fakespace, modifierFlags); } else if (expanding) { - context.approximateLength += 14; + context2.approximateLength += 14; addResult( factory.createModuleDeclaration( /*modifiers*/ @@ -84796,18 +88071,18 @@ ${lanes.join("\n")} } function sanitizeJSDocImplements(clauses) { const result = mapDefined(clauses, (e) => { - const oldEnclosing = context.enclosingDeclaration; - context.enclosingDeclaration = e; + const oldEnclosing = context2.enclosingDeclaration; + context2.enclosingDeclaration = e; let expr = e.expression; if (isEntityNameExpression(expr)) { - if (isIdentifier26(expr) && idText(expr) === "") { + if (isIdentifier28(expr) && idText(expr) === "") { return cleanup( /*result*/ void 0 ); } let introducesError; - ({ introducesError, node: expr } = trackExistingEntityName(expr, context)); + ({ introducesError, node: expr } = trackExistingEntityName(expr, context2)); if (introducesError) { return cleanup( /*result*/ @@ -84817,10 +88092,10 @@ ${lanes.join("\n")} } return cleanup(factory.createExpressionWithTypeArguments( expr, - map2(e.typeArguments, (a) => syntacticNodeBuilder.tryReuseExistingTypeNode(context, a) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context)) + map2(e.typeArguments, (a) => syntacticNodeBuilder.tryReuseExistingTypeNode(context2, a) || typeToTypeNodeHelper(getTypeFromTypeNode2(context2, a), context2)) )); function cleanup(result2) { - context.enclosingDeclaration = oldEnclosing; + context2.enclosingDeclaration = oldEnclosing; return result2; } }); @@ -84831,13 +88106,13 @@ ${lanes.join("\n")} } function serializeAsClass(symbol2, localName, modifierFlags) { var _a22, _b; - context.approximateLength += 9 + localName.length; + context2.approximateLength += 9 + localName.length; const originalDecl = (_a22 = symbol2.declarations) == null ? void 0 : _a22.find(isClassLike); - const oldEnclosing = context.enclosingDeclaration; - context.enclosingDeclaration = originalDecl || oldEnclosing; + const oldEnclosing = context2.enclosingDeclaration; + context2.enclosingDeclaration = originalDecl || oldEnclosing; const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol2); - const typeParamDecls = map2(localParams, (p) => typeParameterToDeclaration(p, context)); - forEach(localParams, (p) => context.approximateLength += symbolName(p.symbol).length); + const typeParamDecls = map2(localParams, (p) => typeParameterToDeclaration(p, context2)); + forEach(localParams, (p) => context2.approximateLength += symbolName(p.symbol).length); const classType = getTypeWithThisArgument(getDeclaredTypeOfClassOrInterface(symbol2)); const baseTypes = getBaseTypes(classType); const originalImplements = originalDecl && getEffectiveImplementsTypeNodes(originalDecl); @@ -84845,7 +88120,7 @@ ${lanes.join("\n")} const staticType = getTypeOfSymbol(symbol2); const isClass = !!((_b = staticType.symbol) == null ? void 0 : _b.valueDeclaration) && isClassLike(staticType.symbol.valueDeclaration); const staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType) : anyType; - context.approximateLength += (length(baseTypes) ? 8 : 0) + (length(implementsExpressions) ? 11 : 0); + context2.approximateLength += (length(baseTypes) ? 8 : 0) + (length(implementsExpressions) ? 11 : 0); const heritageClauses = [ ...!length(baseTypes) ? [] : [factory.createHeritageClause(96, map2(baseTypes, (b) => serializeBaseType(b, staticBaseType, localName)))], ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(119, implementsExpressions)] @@ -84853,7 +88128,7 @@ ${lanes.join("\n")} const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType)); const publicSymbolProps = filter(symbolProps, (s) => !isHashPrivate(s)); const hasPrivateIdentifier = some(symbolProps, isHashPrivate); - const privateProperties = hasPrivateIdentifier ? isExpanding(context) ? serializePropertySymbolsForClassOrInterface( + const privateProperties = hasPrivateIdentifier ? isExpanding(context2) ? serializePropertySymbolsForClassOrInterface( filter(symbolProps, isHashPrivate), /*isClass*/ true, @@ -84871,8 +88146,8 @@ ${lanes.join("\n")} /*initializer*/ void 0 )] : emptyArray; - if (hasPrivateIdentifier && !isExpanding(context)) { - context.approximateLength += 9; + if (hasPrivateIdentifier && !isExpanding(context2)) { + context2.approximateLength += 9; } const publicProperties = serializePropertySymbolsForClassOrInterface( publicSymbolProps, @@ -84895,7 +88170,7 @@ ${lanes.join("\n")} 1 /* Construct */ )); - if (isNonConstructableClassLikeInJsFile) context.approximateLength += 21; + if (isNonConstructableClassLikeInJsFile) context2.approximateLength += 21; const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration( factory.createModifiersFromModifierFlags( 2 @@ -84912,10 +88187,10 @@ ${lanes.join("\n")} /* Constructor */ ); const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); - context.enclosingDeclaration = oldEnclosing; + context2.enclosingDeclaration = oldEnclosing; addResult( setTextRange2( - context, + context2, factory.createClassDeclaration( /*modifiers*/ void 0, @@ -84934,15 +88209,15 @@ ${lanes.join("\n")} if (isImportSpecifier(d) || isExportSpecifier(d)) { return moduleExportNameTextUnescaped(d.propertyName || d.name); } - if (isBinaryExpression4(d) || isExportAssignment3(d)) { - const expression = isExportAssignment3(d) ? d.expression : d.right; - if (isPropertyAccessExpression16(expression)) { + if (isBinaryExpression4(d) || isExportAssignment4(d)) { + const expression = isExportAssignment4(d) ? d.expression : d.right; + if (isPropertyAccessExpression17(expression)) { return idText(expression.name); } } if (isAliasSymbolDeclaration(d)) { const name = getNameOfDeclaration(d); - if (name && isIdentifier26(name)) { + if (name && isIdentifier28(name)) { return idText(name); } } @@ -84970,10 +88245,10 @@ ${lanes.join("\n")} switch (node.kind) { case 209: if (((_b = (_a22 = node.parent) == null ? void 0 : _a22.parent) == null ? void 0 : _b.kind) === 261) { - const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); + const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context2); const { propertyName } = node; - const propertyNameText = propertyName && isIdentifier26(propertyName) ? idText(propertyName) : void 0; - context.approximateLength += 24 + localName.length + specifier2.length + ((propertyNameText == null ? void 0 : propertyNameText.length) ?? 0); + const propertyNameText = propertyName && isIdentifier28(propertyName) ? idText(propertyName) : void 0; + context2.approximateLength += 24 + localName.length + specifier2.length + ((propertyNameText == null ? void 0 : propertyNameText.length) ?? 0); addResult( factory.createImportDeclaration( /*modifiers*/ @@ -85010,11 +88285,11 @@ ${lanes.join("\n")} } break; case 261: - if (isPropertyAccessExpression16(node.initializer)) { + if (isPropertyAccessExpression17(node.initializer)) { const initializer3 = node.initializer; const uniqueName = factory.createUniqueName(localName); - const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); - context.approximateLength += 22 + specifier2.length + idText(uniqueName).length; + const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context2); + context2.approximateLength += 22 + specifier2.length + idText(uniqueName).length; addResult( factory.createImportEqualsDeclaration( /*modifiers*/ @@ -85027,7 +88302,7 @@ ${lanes.join("\n")} 0 /* None */ ); - context.approximateLength += 12 + localName.length + idText(uniqueName).length + idText(initializer3.name).length; + context2.approximateLength += 12 + localName.length + idText(uniqueName).length + idText(initializer3.name).length; addResult( factory.createImportEqualsDeclaration( /*modifiers*/ @@ -85048,7 +88323,7 @@ ${lanes.join("\n")} break; } const isLocalImport = !(target.flags & 512) && !isVariableDeclaration7(node); - context.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length; + context2.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length; addResult( factory.createImportEqualsDeclaration( /*modifiers*/ @@ -85058,11 +88333,11 @@ ${lanes.join("\n")} factory.createIdentifier(localName), isLocalImport ? symbolToName( target, - context, + context2, -1, /*expectsIdentifier*/ false - ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))) + ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context2))) ), isLocalImport ? modifierFlags : 0 /* None */ @@ -85076,11 +88351,11 @@ ${lanes.join("\n")} ); break; case 274: { - const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); - const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier; - const attributes = isImportDeclaration7(node.parent) ? node.parent.attributes : void 0; + const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context2); + const specifier2 = context2.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier; + const attributes = isImportDeclaration8(node.parent) ? node.parent.attributes : void 0; const isTypeOnly = isJSDocImportTag(node.parent); - context.approximateLength += 14 + localName.length + 3 + (isTypeOnly ? 4 : 0); + context2.approximateLength += 14 + localName.length + 3 + (isTypeOnly ? 4 : 0); addResult( factory.createImportDeclaration( /*modifiers*/ @@ -85101,10 +88376,10 @@ ${lanes.join("\n")} break; } case 275: { - const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); - const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier; + const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context2); + const specifier2 = context2.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier; const isTypeOnly = isJSDocImportTag(node.parent.parent); - context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); + context2.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); addResult( factory.createImportDeclaration( /*modifiers*/ @@ -85125,7 +88400,7 @@ ${lanes.join("\n")} break; } case 281: - context.approximateLength += 19 + localName.length + 3; + context2.approximateLength += 19 + localName.length + 3; addResult( factory.createExportDeclaration( /*modifiers*/ @@ -85133,17 +88408,17 @@ ${lanes.join("\n")} /*isTypeOnly*/ false, factory.createNamespaceExport(factory.createIdentifier(localName)), - factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)) + factory.createStringLiteral(getSpecifierForModuleSymbol(target, context2)) ), 0 /* None */ ); break; case 277: { - const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); - const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier; + const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context2); + const specifier2 = context2.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier; const isTypeOnly = isJSDocImportTag(node.parent.parent.parent); - context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); + context2.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); addResult( factory.createImportDeclaration( /*modifiers*/ @@ -85201,7 +88476,7 @@ ${lanes.join("\n")} } } function serializeExportSpecifier(localName, targetName, specifier) { - context.approximateLength += 16 + localName.length + (localName !== targetName ? targetName.length : 0); + context2.approximateLength += 16 + localName.length + (localName !== targetName ? targetName.length : 0); addResult( factory.createExportDeclaration( /*modifiers*/ @@ -85236,7 +88511,7 @@ ${lanes.join("\n")} true ); if (target && length(target.declarations) && some(target.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(enclosingDeclaration))) { - const expr = aliasDecl && (isExportAssignment3(aliasDecl) || isBinaryExpression4(aliasDecl) ? getExportAssignmentExpression(aliasDecl) : getPropertyAssignmentAliasLikeExpression(aliasDecl)); + const expr = aliasDecl && (isExportAssignment4(aliasDecl) || isBinaryExpression4(aliasDecl) ? getExportAssignmentExpression(aliasDecl) : getPropertyAssignmentAliasLikeExpression(aliasDecl)); const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0; const referenced = first2 && resolveEntityName( first2, @@ -85250,17 +88525,17 @@ ${lanes.join("\n")} if (referenced || target) { includePrivateSymbol(referenced || target); } - const prevDisableTrackSymbol = context.tracker.disableTrackSymbol; - context.tracker.disableTrackSymbol = true; + const prevDisableTrackSymbol = context2.tracker.disableTrackSymbol; + context2.tracker.disableTrackSymbol = true; if (isExportAssignmentCompatibleSymbolName) { - context.approximateLength += 10; + context2.approximateLength += 10; results.push(factory.createExportAssignment( /*modifiers*/ void 0, isExportEquals, symbolToExpression( target, - context, + context2, -1 /* All */ ) @@ -85272,7 +88547,7 @@ ${lanes.join("\n")} serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target))); } else { const varName = getUnusedName(name, symbol2); - context.approximateLength += varName.length + 10; + context2.approximateLength += varName.length + 10; addResult( factory.createImportEqualsDeclaration( /*modifiers*/ @@ -85282,7 +88557,7 @@ ${lanes.join("\n")} factory.createIdentifier(varName), symbolToName( target, - context, + context2, -1, /*expectsIdentifier*/ false @@ -85294,7 +88569,7 @@ ${lanes.join("\n")} serializeExportSpecifier(name, varName); } } - context.tracker.disableTrackSymbol = prevDisableTrackSymbol; + context2.tracker.disableTrackSymbol = prevDisableTrackSymbol; return true; } else { const varName = getUnusedName(name, symbol2); @@ -85308,8 +88583,8 @@ ${lanes.join("\n")} /* Export */ ); } else { - const flags = ((_a22 = context.enclosingDeclaration) == null ? void 0 : _a22.kind) === 268 && (!(symbol2.flags & 98304) || symbol2.flags & 65536) ? 1 : 2; - context.approximateLength += varName.length + 5; + const flags = ((_a22 = context2.enclosingDeclaration) == null ? void 0 : _a22.kind) === 268 && (!(symbol2.flags & 98304) || symbol2.flags & 65536) ? 1 : 2; + context2.approximateLength += varName.length + 5; const statement = factory.createVariableStatement( /*modifiers*/ void 0, @@ -85319,7 +88594,7 @@ ${lanes.join("\n")} /*exclamationToken*/ void 0, serializeTypeForDeclaration( - context, + context2, /*declaration*/ void 0, typeToSerialize, @@ -85335,7 +88610,7 @@ ${lanes.join("\n")} ); } if (isExportAssignmentCompatibleSymbolName) { - context.approximateLength += varName.length + 10; + context2.approximateLength += varName.length + 10; results.push(factory.createExportAssignment( /*modifiers*/ void 0, @@ -85352,7 +88627,7 @@ ${lanes.join("\n")} } function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) { var _a22; - const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration); + const ctxSrc = getSourceFileOfNode(context2.enclosingDeclaration); return getObjectFlags(typeToSerialize) & (16 | 32) && !some((_a22 = typeToSerialize.symbol) == null ? void 0 : _a22.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType( @@ -85378,7 +88653,7 @@ ${lanes.join("\n")} return function serializePropertySymbol(p, isStatic2, baseType) { var _a22, _b, _c, _d, _e, _f; const modifierFlags = getDeclarationModifierFlagsFromSymbol(p); - const omitType = !!(modifierFlags & 2) && !isExpanding(context); + const omitType = !!(modifierFlags & 2) && !isExpanding(context2); if (isStatic2 && p.flags & (788968 | 1920 | 2097152)) { return []; } @@ -85386,8 +88661,8 @@ ${lanes.join("\n")} return []; } const flag = modifierFlags & ~1024 | (isStatic2 ? 256 : 0); - const name = getPropertyNameNodeForSymbol(p, context); - const firstPropertyLikeDecl = (_a22 = p.declarations) == null ? void 0 : _a22.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration7, isPropertySignature3, isBinaryExpression4, isPropertyAccessExpression16)); + const name = getPropertyNameNodeForSymbol(p, context2); + const firstPropertyLikeDecl = (_a22 = p.declarations) == null ? void 0 : _a22.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration7, isPropertySignature3, isBinaryExpression4, isPropertyAccessExpression17)); if (p.flags & 98304 && useAccessors) { const result = []; if (p.flags & 65536) { @@ -85398,7 +88673,7 @@ ${lanes.join("\n")} if (isCallExpression16(d) && isBindableObjectDefinePropertyCall(d)) { return forEach(d.arguments[2].properties, (propDecl) => { const id = getNameOfDeclaration(propDecl); - if (!!id && isIdentifier26(id) && idText(id) === "set") { + if (!!id && isIdentifier28(id) && idText(id) === "set") { return propDecl; } }); @@ -85407,9 +88682,9 @@ ${lanes.join("\n")} Debug.assert(!!setter); const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0; const setterDeclaration = (_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor); - context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2); + context2.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2); result.push(setTextRange2( - context, + context2, factory.createSetAccessorDeclaration( factory.createModifiersFromModifierFlags(flag), name, @@ -85418,10 +88693,10 @@ ${lanes.join("\n")} void 0, /*dotDotDotToken*/ void 0, - paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value", + paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context2) : "value", /*questionToken*/ void 0, - omitType ? void 0 : serializeTypeForDeclaration(context, setterDeclaration, getWriteTypeOfSymbol(p), p) + omitType ? void 0 : serializeTypeForDeclaration(context2, setterDeclaration, getWriteTypeOfSymbol(p), p) )], /*body*/ void 0 @@ -85431,14 +88706,14 @@ ${lanes.join("\n")} } if (p.flags & 32768) { const getterDeclaration = (_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor); - context.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2); + context2.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2); result.push(setTextRange2( - context, + context2, factory.createGetAccessorDeclaration( factory.createModifiersFromModifierFlags(flag), name, [], - omitType ? void 0 : serializeTypeForDeclaration(context, getterDeclaration, getTypeOfSymbol(p), p), + omitType ? void 0 : serializeTypeForDeclaration(context2, getterDeclaration, getTypeOfSymbol(p), p), /*body*/ void 0 ), @@ -85448,9 +88723,9 @@ ${lanes.join("\n")} return result; } else if (p.flags & (4 | 3 | 98304)) { const modifierFlags2 = (isReadonlySymbol(p) ? 8 : 0) | flag; - context.approximateLength += 2 + (omitType ? 0 : 2) + modifiersLength(modifierFlags2); + context2.approximateLength += 2 + (omitType ? 0 : 2) + modifiersLength(modifierFlags2); return setTextRange2( - context, + context2, createProperty2( factory.createModifiersFromModifierFlags(modifierFlags2), name, @@ -85458,7 +88733,7 @@ ${lanes.join("\n")} 58 /* QuestionToken */ ) : void 0, - omitType ? void 0 : serializeTypeForDeclaration(context, (_d = p.declarations) == null ? void 0 : _d.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p), + omitType ? void 0 : serializeTypeForDeclaration(context2, (_d = p.declarations) == null ? void 0 : _d.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ @@ -85476,9 +88751,9 @@ ${lanes.join("\n")} ); if (omitType) { const modifierFlags2 = (isReadonlySymbol(p) ? 8 : 0) | flag; - context.approximateLength += 1 + modifiersLength(modifierFlags2); + context2.approximateLength += 1 + modifiersLength(modifierFlags2); return setTextRange2( - context, + context2, createProperty2( factory.createModifiersFromModifierFlags(modifierFlags2), name, @@ -85496,11 +88771,11 @@ ${lanes.join("\n")} } const results2 = []; for (const sig of signatures) { - context.approximateLength += 1; + context2.approximateLength += 1; const decl = signatureToSignatureDeclarationHelper( sig, methodKind, - context, + context2, { name, questionToken: p.flags & 16777216 ? factory.createToken( @@ -85511,7 +88786,7 @@ ${lanes.join("\n")} } ); const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration; - results2.push(setTextRange2(context, decl, location)); + results2.push(setTextRange2(context2, decl, location)); } return results2; } @@ -85595,7 +88870,7 @@ ${lanes.join("\n")} } if (privateProtected) { return [setTextRange2( - context, + context2, factory.createConstructorDeclaration( factory.createModifiersFromModifierFlags(privateProtected), /*parameters*/ @@ -85609,9 +88884,9 @@ ${lanes.join("\n")} } const results2 = []; for (const sig of signatures) { - context.approximateLength += 1; - const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context); - results2.push(setTextRange2(context, decl, sig.declaration)); + context2.approximateLength += 1; + const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context2); + results2.push(setTextRange2(context2, decl, sig.declaration)); } return results2; } @@ -85628,7 +88903,7 @@ ${lanes.join("\n")} } results2.push(indexInfoToIndexSignatureDeclarationHelper( info, - context, + context2, /*typeNode*/ void 0 )); @@ -85654,7 +88929,7 @@ ${lanes.join("\n")} tempName, /*exclamationToken*/ void 0, - typeToTypeNodeHelper(staticType, context) + typeToTypeNodeHelper(staticType, context2) ) ], 2 @@ -85676,17 +88951,17 @@ ${lanes.join("\n")} let typeArgs; let reference; if (t.target && isSymbolAccessibleByFlags(t.target.symbol, enclosingDeclaration, flags)) { - typeArgs = map2(getTypeArguments(t), (t2) => typeToTypeNodeHelper(t2, context)); + typeArgs = map2(getTypeArguments(t), (t2) => typeToTypeNodeHelper(t2, context2)); reference = symbolToExpression( t.target.symbol, - context, + context2, 788968 /* Type */ ); } else if (t.symbol && isSymbolAccessibleByFlags(t.symbol, enclosingDeclaration, flags)) { reference = symbolToExpression( t.symbol, - context, + context2, 788968 /* Type */ ); @@ -85708,7 +88983,7 @@ ${lanes.join("\n")} return factory.createExpressionWithTypeArguments( symbolToExpression( t.symbol, - context, + context2, 788968 /* Type */ ), @@ -85721,8 +88996,8 @@ ${lanes.join("\n")} var _a22, _b; const id = symbol2 ? getSymbolId(symbol2) : void 0; if (id) { - if (context.remappedSymbolNames.has(id)) { - return context.remappedSymbolNames.get(id); + if (context2.remappedSymbolNames.has(id)) { + return context2.remappedSymbolNames.get(id); } } if (symbol2) { @@ -85730,21 +89005,21 @@ ${lanes.join("\n")} } let i = 0; const original = input; - while ((_a22 = context.usedSymbolNames) == null ? void 0 : _a22.has(input)) { + while ((_a22 = context2.usedSymbolNames) == null ? void 0 : _a22.has(input)) { i++; input = `${original}_${i}`; } - (_b = context.usedSymbolNames) == null ? void 0 : _b.add(input); + (_b = context2.usedSymbolNames) == null ? void 0 : _b.add(input); if (id) { - context.remappedSymbolNames.set(id, input); + context2.remappedSymbolNames.set(id, input); } return input; } function getNameCandidateWorker(symbol2, localName) { if (localName === "default" || localName === "__class" || localName === "__function") { - const restoreFlags = saveRestoreFlags(context); - context.flags |= 16777216; - const nameCandidate = getNameOfSymbolAsWritten(symbol2, context); + const restoreFlags = saveRestoreFlags(context2); + context2.flags |= 16777216; + const nameCandidate = getNameOfSymbolAsWritten(symbol2, context2); restoreFlags(); localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate; } @@ -85758,16 +89033,16 @@ ${lanes.join("\n")} } function getInternalSymbolName(symbol2, localName) { const id = getSymbolId(symbol2); - if (context.remappedSymbolNames.has(id)) { - return context.remappedSymbolNames.get(id); + if (context2.remappedSymbolNames.has(id)) { + return context2.remappedSymbolNames.get(id); } localName = getNameCandidateWorker(symbol2, localName); - context.remappedSymbolNames.set(id, localName); + context2.remappedSymbolNames.set(id, localName); return localName; } } - function isExpanding(context) { - return context.maxExpansionDepth !== -1; + function isExpanding(context2) { + return context2.maxExpansionDepth !== -1; } function isHashPrivate(s) { return !!s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name); @@ -85850,7 +89125,7 @@ ${lanes.join("\n")} function isDefaultBindingContext(location) { return location.kind === 308 || isAmbientModule(location); } - function getNameOfSymbolFromNameType(symbol2, context) { + function getNameOfSymbolFromNameType(symbol2, context2) { const nameType = getSymbolLinks(symbol2).nameType; if (nameType) { if (nameType.flags & 384) { @@ -85868,19 +89143,19 @@ ${lanes.join("\n")} return name; } if (nameType.flags & 8192) { - return `[${getNameOfSymbolAsWritten(nameType.symbol, context)}]`; + return `[${getNameOfSymbolAsWritten(nameType.symbol, context2)}]`; } } } - function getNameOfSymbolAsWritten(symbol2, context) { + function getNameOfSymbolAsWritten(symbol2, context2) { var _a3; - if ((_a3 = context == null ? void 0 : context.remappedSymbolReferences) == null ? void 0 : _a3.has(getSymbolId(symbol2))) { - symbol2 = context.remappedSymbolReferences.get(getSymbolId(symbol2)); + if ((_a3 = context2 == null ? void 0 : context2.remappedSymbolReferences) == null ? void 0 : _a3.has(getSymbolId(symbol2))) { + symbol2 = context2.remappedSymbolReferences.get(getSymbolId(symbol2)); } - if (context && symbol2.escapedName === "default" && !(context.flags & 16384) && // If it's not the first part of an entity name, it must print as `default` - (!(context.flags & 16777216) || // if the symbol is synthesized, it will only be referenced externally it must print as `default` + if (context2 && symbol2.escapedName === "default" && !(context2.flags & 16384) && // If it's not the first part of an entity name, it must print as `default` + (!(context2.flags & 16777216) || // if the symbol is synthesized, it will only be referenced externally it must print as `default` !symbol2.declarations || // if not in the same binding context (source file, module declaration), it must print as `default` - context.enclosingDeclaration && findAncestor(symbol2.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) { + context2.enclosingDeclaration && findAncestor(symbol2.declarations[0], isDefaultBindingContext) !== findAncestor(context2.enclosingDeclaration, isDefaultBindingContext))) { return "default"; } if (symbol2.declarations && symbol2.declarations.length) { @@ -85893,7 +89168,7 @@ ${lanes.join("\n")} if (isComputedPropertyName(name2) && !(getCheckFlags(symbol2) & 4096)) { const nameType = getSymbolLinks(symbol2).nameType; if (nameType && nameType.flags & 384) { - const result = getNameOfSymbolFromNameType(symbol2, context); + const result = getNameOfSymbolFromNameType(symbol2, context2); if (result !== void 0) { return result; } @@ -85911,13 +89186,13 @@ ${lanes.join("\n")} case 232: case 219: case 220: - if (context && !context.encounteredError && !(context.flags & 131072)) { - context.encounteredError = true; + if (context2 && !context2.encounteredError && !(context2.flags & 131072)) { + context2.encounteredError = true; } return declaration.kind === 232 ? "(Anonymous class)" : "(Anonymous function)"; } } - const name = getNameOfSymbolFromNameType(symbol2, context); + const name = getNameOfSymbolFromNameType(symbol2, context2); return name !== void 0 ? name : symbolName(symbol2); } function isDeclarationVisible(node) { @@ -86307,11 +89582,11 @@ ${lanes.join("\n")} if (isTypeAny(parentType)) { return parentType; } - const pattern = declaration.parent; + const pattern2 = declaration.parent; if (strictNullChecks && declaration.flags & 33554432 && isPartOfParameterDeclaration(declaration)) { parentType = getNonNullableType(parentType); - } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts( - getTypeOfInitializer(pattern.parent.initializer), + } else if (strictNullChecks && pattern2.parent.initializer && !hasTypeFacts( + getTypeOfInitializer(pattern2.parent.initializer), 65536 /* EQUndefined */ )) { @@ -86323,7 +89598,7 @@ ${lanes.join("\n")} } const accessFlags = 32 | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 : 0); let type; - if (pattern.kind === 207) { + if (pattern2.kind === 207) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 || !isValidSpreadType(parentType)) { @@ -86331,7 +89606,7 @@ ${lanes.join("\n")} return errorType; } const literalMembers = []; - for (const element of pattern.elements) { + for (const element of pattern2.elements) { if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } @@ -86344,8 +89619,8 @@ ${lanes.join("\n")} type = getFlowTypeOfDestructuring(declaration, declaredType); } } else { - const elementType = checkIteratedTypeOrElementType(65 | (declaration.dotDotDotToken ? 0 : 128), parentType, undefinedType, pattern); - const index = pattern.elements.indexOf(declaration); + const elementType = checkIteratedTypeOrElementType(65 | (declaration.dotDotDotToken ? 0 : 128), parentType, undefinedType, pattern2); + const index = pattern2.elements.indexOf(declaration); if (declaration.dotDotDotToken) { const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 ? getBaseConstraintOrType(t) : t); type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType); @@ -86677,11 +89952,11 @@ ${lanes.join("\n")} } function getJSContainerObjectType(decl, symbol2, init) { var _a3, _b; - if (!isInJSFile(decl) || !init || !isObjectLiteralExpression12(init) || init.properties.length) { + if (!isInJSFile(decl) || !init || !isObjectLiteralExpression13(init) || init.properties.length) { return void 0; } const exports2 = createSymbolTable(); - while (isBinaryExpression4(decl) || isPropertyAccessExpression16(decl)) { + while (isBinaryExpression4(decl) || isPropertyAccessExpression17(decl)) { const s2 = getSymbolOfNode(decl); if ((_a3 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a3.size) { mergeSymbolTable(exports2, s2.exports); @@ -86756,7 +90031,7 @@ ${lanes.join("\n")} if (containsSameNamedThisProperty(expression.left, expression.right)) { return anyType; } - const isDirectExport = kind === 1 && (isPropertyAccessExpression16(expression.left) || isElementAccessExpression8(expression.left)) && (isModuleExportsAccessExpression(expression.left.expression) || isIdentifier26(expression.left.expression) && isExportsIdentifier(expression.left.expression)); + const isDirectExport = kind === 1 && (isPropertyAccessExpression17(expression.left) || isElementAccessExpression8(expression.left)) && (isModuleExportsAccessExpression(expression.left.expression) || isIdentifier28(expression.left.expression) && isExportsIdentifier(expression.left.expression)); const type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right)) : getWidenedLiteralType(checkExpressionCached(expression.right)); if (type.flags & 524288 && kind === 2 && symbol2.escapedName === "export=") { const exportedType = resolveStructuredTypeMembers(type); @@ -86827,7 +90102,7 @@ ${lanes.join("\n")} return type; } function containsSameNamedThisProperty(thisProperty, expression) { - return isPropertyAccessExpression16(thisProperty) && thisProperty.expression.kind === 110 && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); + return isPropertyAccessExpression17(thisProperty) && thisProperty.expression.kind === 110 && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); } function isDeclarationInConstructor(expression) { const thisContainer = getThisContainer( @@ -86866,11 +90141,11 @@ ${lanes.join("\n")} } return includePatternInType ? nonInferrableAnyType : anyType; } - function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) { + function getTypeFromObjectBindingPattern(pattern2, includePatternInType, reportErrors2) { const members = createSymbolTable(); let stringIndexInfo; let objectFlags = 128 | 131072; - forEach(pattern.elements, (e) => { + forEach(pattern2.elements, (e) => { const name = e.propertyName || e.name; if (e.dotDotDotToken) { stringIndexInfo = createIndexInfo( @@ -86902,13 +90177,13 @@ ${lanes.join("\n")} ); result.objectFlags |= objectFlags; if (includePatternInType) { - result.pattern = pattern; + result.pattern = pattern2; result.objectFlags |= 131072; } return result; } - function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2) { - const elements = pattern.elements; + function getTypeFromArrayBindingPattern(pattern2, includePatternInType, reportErrors2) { + const elements = pattern2.elements; const lastElement = lastOrUndefined(elements); const restElement = lastElement && lastElement.kind === 209 && lastElement.dotDotDotToken ? lastElement : void 0; if (elements.length === 0 || elements.length === 1 && restElement) { @@ -86924,14 +90199,14 @@ ${lanes.join("\n")} let result = createTupleType(elementTypes, elementFlags); if (includePatternInType) { result = cloneTypeReference(result); - result.pattern = pattern; + result.pattern = pattern2; result.objectFlags |= 131072; } return result; } - function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) { - if (includePatternInType) contextualBindingPatterns.push(pattern); - const result = pattern.kind === 207 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2); + function getTypeFromBindingPattern(pattern2, includePatternInType = false, reportErrors2 = false) { + if (includePatternInType) contextualBindingPatterns.push(pattern2); + const result = pattern2.kind === 207 ? getTypeFromObjectBindingPattern(pattern2, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern2, includePatternInType, reportErrors2); if (includePatternInType) contextualBindingPatterns.pop(); return result; } @@ -87074,18 +90349,18 @@ ${lanes.join("\n")} let type; if (declaration.kind === 278) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); - } else if (isBinaryExpression4(declaration) || isInJSFile(declaration) && (isCallExpression16(declaration) || (isPropertyAccessExpression16(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression4(declaration.parent))) { + } else if (isBinaryExpression4(declaration) || isInJSFile(declaration) && (isCallExpression16(declaration) || (isPropertyAccessExpression17(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression4(declaration.parent))) { type = getWidenedTypeForAssignmentDeclaration(symbol2); - } else if (isPropertyAccessExpression16(declaration) || isElementAccessExpression8(declaration) || isIdentifier26(declaration) || isStringLiteralLike4(declaration) || isNumericLiteral5(declaration) || isClassDeclaration5(declaration) || isFunctionDeclaration5(declaration) || isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration) || isMethodSignature(declaration) || isSourceFile(declaration)) { + } else if (isPropertyAccessExpression17(declaration) || isElementAccessExpression8(declaration) || isIdentifier28(declaration) || isStringLiteralLike4(declaration) || isNumericLiteral5(declaration) || isClassDeclaration5(declaration) || isFunctionDeclaration5(declaration) || isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration) || isMethodSignature(declaration) || isSourceFile(declaration)) { if (symbol2.flags & (16 | 8192 | 32 | 384 | 512)) { return getTypeOfFuncClassEnumModule(symbol2); } type = isBinaryExpression4(declaration.parent) ? getWidenedTypeForAssignmentDeclaration(symbol2) : tryGetTypeFromEffectiveTypeNode(declaration) || anyType; - } else if (isPropertyAssignment11(declaration)) { + } else if (isPropertyAssignment12(declaration)) { type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration); } else if (isJsxAttribute(declaration)) { type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration); - } else if (isShorthandPropertyAssignment6(declaration)) { + } else if (isShorthandPropertyAssignment7(declaration)) { type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation( declaration.name, 0 @@ -87309,13 +90584,13 @@ ${lanes.join("\n")} )) { return errorType; } - const targetSymbol = resolveAlias(symbol2); + const targetSymbol = resolveAlias2(symbol2); const exportSymbol = symbol2.declarations && getTargetOfAliasDeclaration( getDeclarationOfAliasSymbol(symbol2), /*dontRecursivelyResolve*/ true ); - const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment3(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0); + const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment4(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0); links.type ?? (links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol2.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol2.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 ? getTypeOfSymbol(targetSymbol) : errorType); if (!popTypeResolution()) { reportCircularityError(exportSymbol ?? symbol2); @@ -87970,7 +91245,7 @@ ${lanes.join("\n")} } function getDeclaredTypeOfAlias(symbol2) { const links = getSymbolLinks(symbol2); - return links.declaredType || (links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol2))); + return links.declaredType || (links.declaredType = getDeclaredTypeOfSymbol(resolveAlias2(symbol2))); } function getDeclaredTypeOfSymbol(symbol2) { return tryGetDeclaredTypeOfSymbol(symbol2) || errorType; @@ -90975,7 +94250,7 @@ ${lanes.join("\n")} true ); if (aliasSymbol2 && aliasSymbol2 !== unknownSymbol) { - const resolved = resolveAlias(aliasSymbol2); + const resolved = resolveAlias2(aliasSymbol2); if (resolved && resolved.flags & 524288) { newAliasSymbol = resolved; aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node) || (typeParameters ? [] : void 0); @@ -91156,7 +94431,7 @@ ${lanes.join("\n")} return true; } function getIntendedTypeFromJSDocTypeReference(node) { - if (isIdentifier26(node.typeName)) { + if (isIdentifier28(node.typeName)) { const typeArgs = node.typeArguments; switch (node.typeName.escapedText) { case "String": @@ -92951,7 +96226,7 @@ ${lanes.join("\n")} if (symbol2.flags & (16 | 8192)) { const parent2 = findAncestor(node.parent, (n) => !isAccessExpression(n)) || node.parent; if (isCallLikeExpression(parent2)) { - return isCallOrNewExpression(parent2) && isIdentifier26(node) && hasMatchingArgument(parent2, node); + return isCallOrNewExpression(parent2) && isIdentifier28(node) && hasMatchingArgument(parent2, node); } return every(symbol2.declarations, (d) => !isFunctionLike(d) || isDeprecatedDeclaration2(d)); } @@ -93433,7 +96708,7 @@ ${lanes.join("\n")} const checkTypeDeferred = isDeferredType(checkType, checkTuples); let combinedMapper; if (root.inferTypeParameters) { - const context = createInferenceContext( + const context2 = createInferenceContext( root.inferTypeParameters, /*signature*/ void 0, @@ -93441,18 +96716,18 @@ ${lanes.join("\n")} /* None */ ); if (mapper) { - context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper); + context2.nonFixingMapper = combineTypeMappers(context2.nonFixingMapper, mapper); } if (!checkTypeDeferred) { inferTypes( - context.inferences, + context2.inferences, checkType, extendsType, 512 | 1024 /* AlwaysStrict */ ); } - combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper; + combinedMapper = mapper ? combineTypeMappers(context2.mapper, mapper) : context2.mapper; } const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType; if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) { @@ -93589,7 +96864,7 @@ ${lanes.join("\n")} return links.resolvedType; } function getIdentifierChain(node) { - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { return [node]; } else { return append(getIdentifierChain(node.left), node.right); @@ -93928,7 +97203,7 @@ ${lanes.join("\n")} return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(parent2)).thisType; } } - if (parent2 && isObjectLiteralExpression12(parent2) && isBinaryExpression4(parent2.parent) && getAssignmentDeclarationKind(parent2.parent) === 6) { + if (parent2 && isObjectLiteralExpression13(parent2) && isBinaryExpression4(parent2.parent) && getAssignmentDeclarationKind(parent2.parent) === 6) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent2.parent.left).parent).thisType; } const host2 = node.flags & 16777216 ? getHostSignatureFromJSDoc(node) : void 0; @@ -94162,12 +97437,12 @@ ${lanes.join("\n")} void 0 ); } - function createBackreferenceMapper(context, index) { - const forwardInferences = context.inferences.slice(index); + function createBackreferenceMapper(context2, index) { + const forwardInferences = context2.inferences.slice(index); return createTypeMapper(map2(forwardInferences, (i) => i.typeParameter), map2(forwardInferences, () => unknownType)); } - function createOuterReturnMapper(context) { - return context.outerReturnMapper ?? (context.outerReturnMapper = mergeTypeMappers(context.returnMapper, cloneInferenceContext(context).mapper)); + function createOuterReturnMapper(context2) { + return context2.outerReturnMapper ?? (context2.outerReturnMapper = mergeTypeMappers(context2.returnMapper, cloneInferenceContext(context2).mapper)); } function combineTypeMappers(mapper1, mapper2) { return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2; @@ -95246,7 +98521,7 @@ ${lanes.join("\n")} function* generateObjectLiteralElements(node) { if (!length(node.properties)) return; for (const prop of node.properties) { - if (isSpreadAssignment6(prop)) continue; + if (isSpreadAssignment7(prop)) continue; const type = getLiteralTypeFromProperty( getSymbolOfDeclaration(prop), 8576 @@ -96243,7 +99518,7 @@ ${lanes.join("\n")} Debug.assertNode(propDeclaration, isObjectLiteralElementLike); const name = propDeclaration.name; errorNode = name; - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { suggestion = getSuggestionForNonexistentProperty(name, errorTarget); } } @@ -98957,12 +102232,12 @@ ${lanes.join("\n")} function createWideningContext(parent2, propertyName, siblings) { return { parent: parent2, propertyName, siblings, resolvedProperties: void 0 }; } - function getSiblingsOfContext(context) { - if (!context.siblings) { + function getSiblingsOfContext(context2) { + if (!context2.siblings) { const siblings = []; - for (const type of getSiblingsOfContext(context.parent)) { + for (const type of getSiblingsOfContext(context2.parent)) { if (isObjectLiteralType2(type)) { - const prop = getPropertyOfObjectType(type, context.propertyName); + const prop = getPropertyOfObjectType(type, context2.propertyName); if (prop) { forEachType(getTypeOfSymbol(prop), (t) => { siblings.push(t); @@ -98970,31 +102245,31 @@ ${lanes.join("\n")} } } } - context.siblings = siblings; + context2.siblings = siblings; } - return context.siblings; + return context2.siblings; } - function getPropertiesOfContext(context) { - if (!context.resolvedProperties) { + function getPropertiesOfContext(context2) { + if (!context2.resolvedProperties) { const names = /* @__PURE__ */ new Map(); - for (const t of getSiblingsOfContext(context)) { + for (const t of getSiblingsOfContext(context2)) { if (isObjectLiteralType2(t) && !(getObjectFlags(t) & 2097152)) { for (const prop of getPropertiesOfType(t)) { names.set(prop.escapedName, prop); } } } - context.resolvedProperties = arrayFrom(names.values()); + context2.resolvedProperties = arrayFrom(names.values()); } - return context.resolvedProperties; + return context2.resolvedProperties; } - function getWidenedProperty(prop, context) { + function getWidenedProperty(prop, context2) { if (!(prop.flags & 4)) { return prop; } const original = getTypeOfSymbol(prop); - const propContext = context && createWideningContext( - context, + const propContext = context2 && createWideningContext( + context2, prop.escapedName, /*siblings*/ void 0 @@ -99012,13 +102287,13 @@ ${lanes.join("\n")} undefinedProperties.set(prop.escapedName, result); return result; } - function getWidenedTypeOfObjectLiteral(type, context) { + function getWidenedTypeOfObjectLiteral(type, context2) { const members = createSymbolTable(); for (const prop of getPropertiesOfObjectType(type)) { - members.set(prop.escapedName, getWidenedProperty(prop, context)); + members.set(prop.escapedName, getWidenedProperty(prop, context2)); } - if (context) { - for (const prop of getPropertiesOfContext(context)) { + if (context2) { + for (const prop of getPropertiesOfContext(context2)) { if (!members.has(prop.escapedName)) { members.set(prop.escapedName, getUndefinedProperty(prop)); } @@ -99035,18 +102310,18 @@ ${lanes.join("\n")} void 0 ); } - function getWidenedTypeWithContext(type, context) { + function getWidenedTypeWithContext(type, context2) { if (getObjectFlags(type) & 196608) { - if (context === void 0 && type.widened) { + if (context2 === void 0 && type.widened) { return type.widened; } let result; if (type.flags & (1 | 98304)) { result = anyType; } else if (isObjectLiteralType2(type)) { - result = getWidenedTypeOfObjectLiteral(type, context); + result = getWidenedTypeOfObjectLiteral(type, context2); } else if (type.flags & 1048576) { - const unionContext = context || createWideningContext( + const unionContext = context2 || createWideningContext( /*parent*/ void 0, /*propertyName*/ @@ -99064,7 +102339,7 @@ ${lanes.join("\n")} } else if (isArrayOrTupleType(type)) { result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType)); } - if (result && context === void 0) { + if (result && context2 === void 0) { type.widened = result; } return result || type; @@ -99122,7 +102397,7 @@ ${lanes.join("\n")} break; case 170: const param = declaration; - if (isIdentifier26(param.name)) { + if (isIdentifier28(param.name)) { const originalKeywordKind = identifierToKeywordKind(param.name); if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.includes(param) && (resolveName( param, @@ -99260,11 +102535,11 @@ ${lanes.join("\n")} function createInferenceContext(typeParameters, signature, flags, compareTypes) { return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable); } - function cloneInferenceContext(context, extraFlags = 0) { - return context && createInferenceContextWorker(map2(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); + function cloneInferenceContext(context2, extraFlags = 0) { + return context2 && createInferenceContextWorker(map2(context2.inferences, cloneInferenceInfo), context2.signature, context2.flags | extraFlags, context2.compareTypes); } function createInferenceContextWorker(inferences, signature, flags, compareTypes) { - const context = { + const context2 = { inferences, signature, flags, @@ -99273,28 +102548,28 @@ ${lanes.join("\n")} // initialize to a noop mapper so the context object is available, but the underlying object shape is right upon construction nonFixingMapper: reportUnmeasurableMapper }; - context.mapper = makeFixingMapperForContext(context); - context.nonFixingMapper = makeNonFixingMapperForContext(context); - return context; + context2.mapper = makeFixingMapperForContext(context2); + context2.nonFixingMapper = makeNonFixingMapperForContext(context2); + return context2; } - function makeFixingMapperForContext(context) { + function makeFixingMapperForContext(context2) { return makeDeferredTypeMapper( - map2(context.inferences, (i) => i.typeParameter), - map2(context.inferences, (inference, i) => () => { + map2(context2.inferences, (i) => i.typeParameter), + map2(context2.inferences, (inference, i) => () => { if (!inference.isFixed) { - inferFromIntraExpressionSites(context); - clearCachedInferences(context.inferences); + inferFromIntraExpressionSites(context2); + clearCachedInferences(context2.inferences); inference.isFixed = true; } - return getInferredType(context, i); + return getInferredType(context2, i); }) ); } - function makeNonFixingMapperForContext(context) { + function makeNonFixingMapperForContext(context2) { return makeDeferredTypeMapper( - map2(context.inferences, (i) => i.typeParameter), - map2(context.inferences, (_, i) => () => { - return getInferredType(context, i); + map2(context2.inferences, (i) => i.typeParameter), + map2(context2.inferences, (_, i) => () => { + return getInferredType(context2, i); }) ); } @@ -99305,12 +102580,12 @@ ${lanes.join("\n")} } } } - function addIntraExpressionInferenceSite(context, node, type) { - (context.intraExpressionInferenceSites ?? (context.intraExpressionInferenceSites = [])).push({ node, type }); + function addIntraExpressionInferenceSite(context2, node, type) { + (context2.intraExpressionInferenceSites ?? (context2.intraExpressionInferenceSites = [])).push({ node, type }); } - function inferFromIntraExpressionSites(context) { - if (context.intraExpressionInferenceSites) { - for (const { node, type } of context.intraExpressionInferenceSites) { + function inferFromIntraExpressionSites(context2) { + if (context2.intraExpressionInferenceSites) { + for (const { node, type } of context2.intraExpressionInferenceSites) { const contextualType = node.kind === 175 ? getContextualTypeForObjectLiteralMethod( node, 2 @@ -99321,10 +102596,10 @@ ${lanes.join("\n")} /* NoConstraints */ ); if (contextualType) { - inferTypes(context.inferences, type, contextualType); + inferTypes(context2.inferences, type, contextualType); } } - context.intraExpressionInferenceSites = void 0; + context2.intraExpressionInferenceSites = void 0; } } function createInferenceInfo(typeParameter) { @@ -99351,12 +102626,12 @@ ${lanes.join("\n")} impliedArity: inference.impliedArity }; } - function cloneInferredPartOfContext(context) { - const inferences = filter(context.inferences, hasInferenceCandidates); - return inferences.length ? createInferenceContextWorker(map2(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : void 0; + function cloneInferredPartOfContext(context2) { + const inferences = filter(context2.inferences, hasInferenceCandidates); + return inferences.length ? createInferenceContextWorker(map2(inferences, cloneInferenceInfo), context2.signature, context2.flags, context2.compareTypes) : void 0; } - function getMapperFromContext(context) { - return context && context.mapper; + function getMapperFromContext(context2) { + return context2 && context2.mapper; } function couldContainTypeVariables(type) { const objectFlags = getObjectFlags(type); @@ -100380,35 +103655,35 @@ ${lanes.join("\n")} ) : getCommonSupertype(baseCandidates); return getWidenedType(unwidenedType); } - function getInferredType(context, index) { - const inference = context.inferences[index]; + function getInferredType(context2, index) { + const inference = context2.inferences[index]; if (!inference.inferredType) { let inferredType; let fallbackType; - if (context.signature) { - const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0; + if (context2.signature) { + const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context2.signature) : void 0; const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0; if (inferredCovariantType || inferredContravariantType) { - const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 | 1)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType)))); + const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 | 1)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context2.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType)))); inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType; fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType; - } else if (context.flags & 1) { + } else if (context2.flags & 1) { inferredType = silentNeverType; } else { const defaultType = getDefaultFromTypeParameter(inference.typeParameter); if (defaultType) { - inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper)); + inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context2, index), context2.nonFixingMapper)); } } } else { inferredType = getTypeFromInference(inference); } - inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2)); + inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context2.flags & 2)); const constraint = getConstraintOfTypeParameter(inference.typeParameter); if (constraint) { - const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); - if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { - inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; + const instantiatedConstraint = instantiateType(constraint, context2.nonFixingMapper); + if (!inferredType || !context2.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + inference.inferredType = fallbackType && context2.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; } } clearActiveMapperCaches(); @@ -100418,10 +103693,10 @@ ${lanes.join("\n")} function getDefaultTypeArgumentType(isInJavaScriptFile) { return isInJavaScriptFile ? anyType : unknownType; } - function getInferredTypes(context) { + function getInferredTypes(context2) { const result = []; - for (let i = 0; i < context.inferences.length; i++) { - result.push(getInferredType(context, i)); + for (let i = 0; i < context2.inferences.length; i++) { + result.push(getInferredType(context2, i)); } return result; } @@ -100517,7 +103792,7 @@ ${lanes.join("\n")} const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && `${key}.${propName2}`; } - if (isElementAccessExpression8(node) && isIdentifier26(node.argumentExpression)) { + if (isElementAccessExpression8(node) && isIdentifier28(node.argumentExpression)) { const symbol2 = getResolvedSymbol(node.argumentExpression); if (isConstantVariable(symbol2) || isParameterOrMutableLocalVariable(symbol2) && !isSymbolAssigned(symbol2)) { const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); @@ -100566,7 +103841,7 @@ ${lanes.join("\n")} return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); } } - if (isElementAccessExpression8(source) && isElementAccessExpression8(target) && isIdentifier26(source.argumentExpression) && isIdentifier26(target.argumentExpression)) { + if (isElementAccessExpression8(source) && isElementAccessExpression8(target) && isIdentifier28(source.argumentExpression) && isIdentifier28(target.argumentExpression)) { const symbol2 = getResolvedSymbol(source.argumentExpression); if (symbol2 === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol2) || isParameterOrMutableLocalVariable(symbol2) && !isSymbolAssigned(symbol2))) { return isMatchingReference(source.expression, target.expression); @@ -100581,7 +103856,7 @@ ${lanes.join("\n")} return false; } function getAccessedPropertyName(access) { - if (isPropertyAccessExpression16(access)) { + if (isPropertyAccessExpression17(access)) { return access.name.escapedText; } if (isElementAccessExpression8(access)) { @@ -100990,9 +104265,9 @@ ${lanes.join("\n")} return errorType; } function getInitialTypeOfBindingElement(node) { - const pattern = node.parent; - const parentType = getInitialType(pattern.parent); - const type = pattern.kind === 207 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); + const pattern2 = node.parent; + const parentType = getInitialType(pattern2.parent); + const type = pattern2.kind === 207 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern2.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); return getTypeWithDefault(type, node.initializer); } function getTypeOfInitializer(node) { @@ -101259,7 +104534,7 @@ ${lanes.join("\n")} function isEvolvingArrayOperationTarget(node) { const root = getReferenceRoot(node); const parent2 = root.parent; - const isLengthPushOrUnshift = isPropertyAccessExpression16(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 && isIdentifier26(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); + const isLengthPushOrUnshift = isPropertyAccessExpression17(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 && isIdentifier28(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); const isElementAssignment = parent2.kind === 213 && parent2.expression === root && parent2.parent.kind === 227 && parent2.parent.operatorToken.kind === 64 && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind( getTypeOfExpression(parent2.argumentExpression), 296 @@ -101941,7 +105216,7 @@ ${lanes.join("\n")} } function getCandidateDiscriminantPropertyAccess(expr) { if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) { - if (isIdentifier26(expr)) { + if (isIdentifier28(expr)) { const symbol2 = getResolvedSymbol(expr); const declaration = getExportSymbolOfValueSymbolIfExported(symbol2).valueDeclaration; if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) { @@ -101952,7 +105227,7 @@ ${lanes.join("\n")} if (isMatchingReference(reference, expr.expression)) { return expr; } - } else if (isIdentifier26(expr)) { + } else if (isIdentifier28(expr)) { const symbol2 = getResolvedSymbol(expr); if (isConstantVariable(symbol2)) { const declaration = symbol2.valueDeclaration; @@ -101961,7 +105236,7 @@ ${lanes.join("\n")} } if (isBindingElement(declaration) && !declaration.initializer) { const parent2 = declaration.parent.parent; - if (isVariableDeclaration7(parent2) && !parent2.type && parent2.initializer && (isIdentifier26(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) { + if (isVariableDeclaration7(parent2) && !parent2.type && parent2.initializer && (isIdentifier28(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) { return declaration; } } @@ -102496,7 +105771,7 @@ ${lanes.join("\n")} ) : neverType)); } function isMatchingConstructorReference(expr) { - return (isPropertyAccessExpression16(expr) && idText(expr.name) === "constructor" || isElementAccessExpression8(expr) && isStringLiteralLike4(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression); + return (isPropertyAccessExpression17(expr) && idText(expr.name) === "constructor" || isElementAccessExpression8(expr) && isStringLiteralLike4(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression); } function narrowTypeByConstructor(type, operator, identifier, assumeTrue) { if (assumeTrue ? operator !== 35 && operator !== 37 : operator !== 36 && operator !== 38) { @@ -102638,9 +105913,9 @@ ${lanes.join("\n")} return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue); } } - if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression16(callExpression.expression)) { + if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression17(callExpression.expression)) { const callAccess = callExpression.expression; - if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && isIdentifier26(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) { + if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && isIdentifier28(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) { const argument = callExpression.arguments[0]; if (isStringLiteralLike4(argument) && getAccessedPropertyName(reference) === escapeLeadingUnderscores(argument.text)) { return getTypeWithFacts( @@ -102960,7 +106235,7 @@ ${lanes.join("\n")} )); } function hasContextualTypeWithNoGenericTypes(node, checkMode) { - const contextualType = (isIdentifier26(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 ? getContextualType2( + const contextualType = (isIdentifier28(node) || isPropertyAccessExpression17(node) || isElementAccessExpression8(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 ? getContextualType2( node, 8 /* SkipBindingPatterns */ @@ -102984,7 +106259,7 @@ ${lanes.join("\n")} if (parent2 === void 0) { return "quit"; } - if (isExportAssignment3(parent2)) { + if (isExportAssignment4(parent2)) { return parent2.expression === n && isEntityNameExpression(n); } if (isExportSpecifier(parent2)) { @@ -103018,9 +106293,9 @@ ${lanes.join("\n")} case 8: return markDecoratorAliasReferenced(location); case 0: { - if (isIdentifier26(location) && (isExpressionNode(location) || isShorthandPropertyAssignment6(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) { + if (isIdentifier28(location) && (isExpressionNode(location) || isShorthandPropertyAssignment7(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) { if (isPropertyAccessOrQualifiedName(location.parent)) { - const left = isPropertyAccessExpression16(location.parent) ? location.parent.expression : location.parent.left; + const left = isPropertyAccessExpression17(location.parent) ? location.parent.expression : location.parent.left; if (left !== location) return; } markIdentifierAliasReferenced(location); @@ -103034,7 +106309,7 @@ ${lanes.join("\n")} } return markPropertyAliasReferenced(location); } - if (isExportAssignment3(location)) { + if (isExportAssignment4(location)) { return markExportAssignmentAliasReferenced(location); } if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) { @@ -103071,8 +106346,8 @@ ${lanes.join("\n")} } } function markPropertyAliasReferenced(location, propSymbol, parentType) { - const left = isPropertyAccessExpression16(location) ? location.expression : location.left; - if (isThisIdentifier(left) || !isIdentifier26(left)) { + const left = isPropertyAccessExpression17(location) ? location.expression : location.left; + if (isThisIdentifier(left) || !isIdentifier28(left)) { return; } const parentSymbol = getResolvedSymbol(left); @@ -103090,7 +106365,7 @@ ${lanes.join("\n")} } let prop = propSymbol; if (!prop && !parentType) { - const right = isPropertyAccessExpression16(location) ? location.name : location.right; + const right = isPropertyAccessExpression17(location) ? location.name : location.right; const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right); const assignmentKind = getAssignmentTargetKind(location); const apparentType = getApparentType(assignmentKind !== 0 || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType); @@ -103102,7 +106377,7 @@ ${lanes.join("\n")} return; } function markExportAssignmentAliasReferenced(location) { - if (isIdentifier26(location.expression)) { + if (isIdentifier28(location.expression)) { const id = location.expression; const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName( id, @@ -103193,7 +106468,7 @@ ${lanes.join("\n")} ); if (symbol2 && (symbol2 === undefinedSymbol || symbol2 === globalThisSymbol || symbol2.declarations && isGlobalSourceFile(getDeclarationContainer(symbol2.declarations[0])))) { } else { - const target = symbol2 && (symbol2.flags & 2097152 ? resolveAlias(symbol2) : symbol2); + const target = symbol2 && (symbol2.flags & 2097152 ? resolveAlias2(symbol2) : symbol2); if (!target || getSymbolFlags(target) & 111551) { markExportAsReferenced(location); markIdentifierAliasReferenced(exportedName); @@ -103258,7 +106533,7 @@ ${lanes.join("\n")} 111551 /* Value */ ) && !isInTypeQuery(location)) { - const target = resolveAlias(symbol2); + const target = resolveAlias2(symbol2); if (getSymbolFlags( symbol2, /*excludeTypeOnlyMeanings*/ @@ -103287,7 +106562,7 @@ ${lanes.join("\n")} } function markExportAsReferenced(node) { const symbol2 = getSymbolOfDeclaration(node); - const target = resolveAlias(symbol2); + const target = resolveAlias2(symbol2); if (target) { const markAlias = target === unknownSymbol || getSymbolFlags( symbol2, @@ -103313,7 +106588,7 @@ ${lanes.join("\n")} true ); if (rootSymbol && rootSymbol.flags & 2097152) { - if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { + if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias2(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { markAliasSymbolAsReferenced(rootSymbol); } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) { const diag2 = error210(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled); @@ -103361,9 +106636,9 @@ ${lanes.join("\n")} const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~4194304; if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 && !(rootDeclaration.kind === 170 && isSomeSymbolAssigned(rootDeclaration))) { - const pattern = declaration.parent; + const pattern2 = declaration.parent; const narrowedType = getFlowTypeOfReference( - pattern, + pattern2, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ @@ -103537,7 +106812,7 @@ ${lanes.join("\n")} const declarationContainer = getControlFlowContainer(declaration); let flowContainer = getControlFlowContainer(node); const isOuterVariable = flowContainer !== declarationContainer; - const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment6(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); + const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment7(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); const isModuleExports = symbol2.flags & 134217728; const typeIsAutomatic = type === autoType || type === autoArrayType; const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 236; @@ -103572,14 +106847,14 @@ ${lanes.join("\n")} var _a3; const parent2 = node.parent; if (parent2) { - if (isPropertyAccessExpression16(parent2) && parent2.expression === node) { + if (isPropertyAccessExpression17(parent2) && parent2.expression === node) { return false; } if (isExportSpecifier(parent2) && parent2.isTypeOnly) { return false; } const greatGrandparent = (_a3 = parent2.parent) == null ? void 0 : _a3.parent; - if (greatGrandparent && isExportDeclaration2(greatGrandparent) && greatGrandparent.isTypeOnly) { + if (greatGrandparent && isExportDeclaration3(greatGrandparent) && greatGrandparent.isTypeOnly) { return false; } } @@ -103846,9 +107121,9 @@ ${lanes.join("\n")} return container.parent.parent.left.expression; } else if (container.kind === 219 && container.parent.kind === 304 && container.parent.parent.kind === 211 && isBinaryExpression4(container.parent.parent.parent) && getAssignmentDeclarationKind(container.parent.parent.parent) === 6) { return container.parent.parent.parent.left.expression; - } else if (container.kind === 219 && isPropertyAssignment11(container.parent) && isIdentifier26(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression12(container.parent.parent) && isCallExpression16(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9) { + } else if (container.kind === 219 && isPropertyAssignment12(container.parent) && isIdentifier28(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression13(container.parent.parent) && isCallExpression16(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9) { return container.parent.parent.parent.arguments[0].expression; - } else if (isMethodDeclaration(container) && isIdentifier26(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && isObjectLiteralExpression12(container.parent) && isCallExpression16(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && getAssignmentDeclarationKind(container.parent.parent) === 9) { + } else if (isMethodDeclaration(container) && isIdentifier28(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && isObjectLiteralExpression13(container.parent) && isCallExpression16(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && getAssignmentDeclarationKind(container.parent.parent) === 9) { return container.parent.parent.arguments[0].expression; } } @@ -104043,7 +107318,7 @@ ${lanes.join("\n")} const target = parent2.left; if (isAccessExpression(target)) { const { expression } = target; - if (inJs && isIdentifier26(expression)) { + if (inJs && isIdentifier28(expression)) { const sourceFile = getSourceFileOfNode(parent2); if (sourceFile.commonJsModuleIndicator && getResolvedSymbol(expression) === sourceFile.symbol) { return void 0; @@ -104337,10 +107612,10 @@ ${lanes.join("\n")} if (canHaveSymbol(e) && e.symbol) { return e.symbol; } - if (isIdentifier26(e)) { + if (isIdentifier28(e)) { return getResolvedSymbol(e); } - if (isPropertyAccessExpression16(e)) { + if (isPropertyAccessExpression17(e)) { const lhsType = getTypeOfExpression(e.expression); return isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText); } @@ -104388,7 +107663,7 @@ ${lanes.join("\n")} const overallAnnotation = getEffectiveTypeAnnotationNode(decl2); if (overallAnnotation) { return getTypeFromTypeNode(overallAnnotation); - } else if (isIdentifier26(lhs.expression)) { + } else if (isIdentifier28(lhs.expression)) { const id = lhs.expression; const parentSymbol = resolveName( id, @@ -104435,7 +107710,7 @@ ${lanes.join("\n")} if (kind === 4) { return true; } - if (!isInJSFile(declaration) || kind !== 5 || !isIdentifier26(declaration.left.expression)) { + if (!isInJSFile(declaration) || kind !== 5 || !isIdentifier28(declaration.left.expression)) { return false; } const name = declaration.left.expression.escapedText; @@ -104595,7 +107870,7 @@ ${lanes.join("\n")} } function getContextualTypeForObjectLiteralElement(element, contextFlags) { const objectLiteral = element.parent; - const propertyAssignmentType = isPropertyAssignment11(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags); + const propertyAssignmentType = isPropertyAssignment12(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags); if (propertyAssignmentType) { return propertyAssignmentType; } @@ -104824,7 +108099,7 @@ ${lanes.join("\n")} /*noReductions*/ true ); - return apparentType.flags & 1048576 && isObjectLiteralExpression12(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; + return apparentType.flags & 1048576 && isObjectLiteralExpression13(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; } } function instantiateContextualType(contextualType, node, contextFlags) { @@ -105043,10 +108318,10 @@ ${lanes.join("\n")} function getEffectiveFirstArgumentForJsxSignature(signature, node) { return isJsxOpeningFragment(node) || getJsxReferenceKind(node) !== 0 ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node); } - function getJsxPropsTypeFromCallSignature(sig, context) { + function getJsxPropsTypeFromCallSignature(sig, context2) { let propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType); - propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType); - const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + propsType = getJsxManagedAttributesFromLocatedAttributes(context2, getJsxNamespaceAt(context2), propsType); + const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context2); if (!isErrorType(intrinsicAttribs)) { propsType = intersectTypes(intrinsicAttribs, propsType); } @@ -105071,62 +108346,62 @@ ${lanes.join("\n")} const instanceType = getReturnTypeOfSignature(sig); return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); } - function getStaticTypeOfReferencedJsxConstructor(context) { - if (isJsxOpeningFragment(context)) return getJSXFragmentType(context); - if (isJsxIntrinsicTagName(context.tagName)) { - const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context); - const fakeSignature = createSignatureForJSXIntrinsic(context, result); + function getStaticTypeOfReferencedJsxConstructor(context2) { + if (isJsxOpeningFragment(context2)) return getJSXFragmentType(context2); + if (isJsxIntrinsicTagName(context2.tagName)) { + const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context2); + const fakeSignature = createSignatureForJSXIntrinsic(context2, result); return getOrCreateTypeFromSignature(fakeSignature); } - const tagType = checkExpressionCached(context.tagName); + const tagType = checkExpressionCached(context2.tagName); if (tagType.flags & 128) { - const result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context); + const result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context2); if (!result) { return errorType; } - const fakeSignature = createSignatureForJSXIntrinsic(context, result); + const fakeSignature = createSignatureForJSXIntrinsic(context2, result); return getOrCreateTypeFromSignature(fakeSignature); } return tagType; } - function getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType) { + function getJsxManagedAttributesFromLocatedAttributes(context2, ns, attributesType) { const managedSym = getJsxLibraryManagedAttributes(ns); if (managedSym) { - const ctorType = getStaticTypeOfReferencedJsxConstructor(context); - const result = instantiateAliasOrInterfaceWithDefaults(managedSym, isInJSFile(context), ctorType, attributesType); + const ctorType = getStaticTypeOfReferencedJsxConstructor(context2); + const result = instantiateAliasOrInterfaceWithDefaults(managedSym, isInJSFile(context2), ctorType, attributesType); if (result) { return result; } } return attributesType; } - function getJsxPropsTypeFromClassType(sig, context) { - const ns = getJsxNamespaceAt(context); + function getJsxPropsTypeFromClassType(sig, context2) { + const ns = getJsxNamespaceAt(context2); const forcedLookupLocation = getJsxElementPropertiesName(ns); let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); if (!attributesType) { - if (!!forcedLookupLocation && !!length(context.attributes.properties)) { - error210(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); + if (!!forcedLookupLocation && !!length(context2.attributes.properties)) { + error210(context2, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); } return unknownType; } - attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType); + attributesType = getJsxManagedAttributesFromLocatedAttributes(context2, ns, attributesType); if (isTypeAny(attributesType)) { return attributesType; } else { let apparentAttributesType = attributesType; - const intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + const intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context2); if (!isErrorType(intrinsicClassAttribs)) { const typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); const hostClassType = getReturnTypeOfSignature(sig); let libraryManagedAttributeType; if (typeParams) { - const inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isInJSFile(context)); + const inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isInJSFile(context2)); libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); } else libraryManagedAttributeType = intrinsicClassAttribs; apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } - const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context2); if (!isErrorType(intrinsicAttribs)) { apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); } @@ -105805,7 +109080,7 @@ ${lanes.join("\n")} return name.includes("-"); } function isJsxIntrinsicTagName(tagName) { - return isIdentifier26(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName); + return isIdentifier28(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName); } function checkJsxAttribute(node, checkMode) { return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType; @@ -105851,7 +109126,7 @@ ${lanes.join("\n")} } if (contextualType) { const prop = getPropertyOfType(contextualType, member.escapedName); - if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier26(attributeDecl.name)) { + if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier28(attributeDecl.name)) { addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); } } @@ -106016,7 +109291,7 @@ ${lanes.join("\n")} if (!links.resolvedSymbol) { const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node); if (!isErrorType(intrinsicElementsType)) { - if (!isIdentifier26(node.tagName) && !isJsxNamespacedName(node.tagName)) return Debug.fail(); + if (!isIdentifier28(node.tagName) && !isJsxNamespacedName(node.tagName)) return Debug.fail(); const propName2 = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText; const intrinsicProp = getPropertyOfType(intrinsicElementsType, propName2); if (intrinsicProp) { @@ -106518,7 +109793,7 @@ ${lanes.join("\n")} return; } if (nodeText2 !== void 0 && nodeText2.length < 100) { - if (isIdentifier26(node) && nodeText2 === "undefined") { + if (isIdentifier28(node) && nodeText2 === "undefined") { error210(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined"); return; } @@ -106572,7 +109847,7 @@ ${lanes.join("\n")} if (nonNullType.flags & 16384) { if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); - if (isIdentifier26(node) && nodeText2 === "undefined") { + if (isIdentifier28(node) && nodeText2 === "undefined") { error210(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2); return nonNullType; } @@ -106770,7 +110045,7 @@ ${lanes.join("\n")} } } else { if (isAnyLike) { - if (isIdentifier26(left) && parentSymbol) { + if (isIdentifier28(left) && parentSymbol) { markLinkedReferences( node, 2, @@ -106825,7 +110100,7 @@ ${lanes.join("\n")} if (compilerOptions.noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1) { propType = getUnionType([propType, missingType]); } - if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression16(node)) { + if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression17(node)) { error210(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText)); } if (indexInfo.declaration && isDeprecatedDeclaration2(indexInfo.declaration)) { @@ -106859,7 +110134,7 @@ ${lanes.join("\n")} false, suggestion.valueDeclaration ); - return !(file2 !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression16(node) && node.expression.kind === 110 && suggestionHasNoExtendsOrDecorators); + return !(file2 !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression17(node) && node.expression.kind === 110 && suggestionHasNoExtendsOrDecorators); } } return false; @@ -106887,7 +110162,7 @@ ${lanes.join("\n")} } } } - } else if (strictNullChecks && prop && prop.valueDeclaration && isPropertyAccessExpression16(prop.valueDeclaration) && getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) && getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) { + } else if (strictNullChecks && prop && prop.valueDeclaration && isPropertyAccessExpression17(prop.valueDeclaration) && getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) && getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) { assumeUninitialized = true; } const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); @@ -107048,7 +110323,7 @@ ${lanes.join("\n")} let props = getPropertiesOfType(containingType); if (typeof name !== "string") { const parent2 = name.parent; - if (isPropertyAccessExpression16(parent2)) { + if (isPropertyAccessExpression17(parent2)) { props = filter(props, (prop) => isValidPropertyAccessForCompletions(parent2, containingType, prop)); } name = idText(name); @@ -107480,17 +110755,17 @@ ${lanes.join("\n")} return void 0; } function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) { - const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0, compareTypes); + const context2 = createInferenceContext(getTypeParametersForMapper(signature), signature, 0, compareTypes); const restType = getEffectiveRestType(contextualSignature); const mapper = inferenceContext && (restType && restType.flags & 262144 ? inferenceContext.nonFixingMapper : inferenceContext.mapper); const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature; applyToParameterTypes(sourceSignature, signature, (source, target) => { - inferTypes(context.inferences, source, target); + inferTypes(context2.inferences, source, target); }); if (!inferenceContext) { applyToReturnTypes(contextualSignature, signature, (source, target) => { inferTypes( - context.inferences, + context2.inferences, source, target, 128 @@ -107498,13 +110773,13 @@ ${lanes.join("\n")} ); }); } - return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration)); + return getSignatureInstantiation(signature, getInferredTypes(context2), isInJSFile(contextualSignature.declaration)); } - function inferJsxTypeArguments(node, signature, checkMode, context) { + function inferJsxTypeArguments(node, signature, checkMode, context2) { const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node); - const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode); - inferTypes(context.inferences, checkAttrType, paramType); - return getInferredTypes(context); + const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context2, checkMode); + inferTypes(context2.inferences, checkAttrType, paramType); + return getInferredTypes(context2); } function getThisArgumentType(thisArgumentNode) { if (!thisArgumentNode) { @@ -107513,9 +110788,9 @@ ${lanes.join("\n")} const thisArgumentType = checkExpression(thisArgumentNode); return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain2(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType; } - function inferTypeArguments(node, signature, args, checkMode, context) { + function inferTypeArguments(node, signature, args, checkMode, context2) { if (isJsxOpeningLikeElement(node)) { - return inferJsxTypeArguments(node, signature, checkMode, context); + return inferJsxTypeArguments(node, signature, checkMode, context2); } if (node.kind !== 171 && node.kind !== 227) { const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p)); @@ -107543,24 +110818,24 @@ ${lanes.join("\n")} const contextualSignature = getSingleCallSignature(instantiatedType); const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType; inferTypes( - context.inferences, + context2.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */ ); } - const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags); + const returnContext = createInferenceContext(signature.typeParameters, signature, context2.flags); const returnSourceType = instantiateType(contextualType, outerContext && createOuterReturnMapper(outerContext)); inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); - context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0; + context2.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0; } } } const restType = getNonArrayRestType(signature); const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; if (restType && restType.flags & 262144) { - const info = find(context.inferences, (info2) => info2.typeParameter === restType); + const info = find(context2.inferences, (info2) => info2.typeParameter === restType); if (info) { info.impliedArity = findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : void 0; } @@ -107568,23 +110843,23 @@ ${lanes.join("\n")} const thisType = getThisTypeOfSignature(signature); if (thisType && couldContainTypeVariables(thisType)) { const thisArgumentNode = getThisArgumentOfCall(node); - inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType); + inferTypes(context2.inferences, getThisArgumentType(thisArgumentNode), thisType); } for (let i = 0; i < argCount; i++) { const arg = args[i]; if (arg.kind !== 233) { const paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { - const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); - inferTypes(context.inferences, argType, paramType); + const argType = checkExpressionWithContextualType(arg, paramType, context2, checkMode); + inferTypes(context2.inferences, argType, paramType); } } } if (restType && couldContainTypeVariables(restType)) { - const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode); - inferTypes(context.inferences, spreadType, restType); + const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context2, checkMode); + inferTypes(context2.inferences, spreadType, restType); } - return getInferredTypes(context); + return getInferredTypes(context2); } function getMutableArrayOrTupleType(type) { return type.flags & 1048576 ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType( @@ -107598,12 +110873,12 @@ ${lanes.join("\n")} /* Variadic */ ]); } - function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) { + function getSpreadArgumentType(args, index, argCount, restType, context2, checkMode) { const inConstContext = isConstTypeVariable(restType); if (index >= argCount - 1) { const arg = args[argCount - 1]; if (isSpreadArgument(arg)) { - const spreadType = arg.kind === 238 ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode); + const spreadType = arg.kind === 238 ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context2, checkMode); if (isArrayLikeType(spreadType)) { return getMutableArrayOrTupleType(spreadType); } @@ -107637,7 +110912,7 @@ ${lanes.join("\n")} 256 /* Contextual */ ); - const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); + const argType = checkExpressionWithContextualType(arg, contextualType, context2, checkMode); const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind( contextualType, 402784252 | 4194304 | 134217728 | 268435456 @@ -108012,7 +111287,7 @@ ${lanes.join("\n")} } function getDiagnosticSpanForCallNode(node) { const sourceFile = getSourceFileOfNode(node); - const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression16(node.expression) ? node.expression.name : node.expression); + const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression17(node.expression) ? node.expression.name : node.expression); return { start, length: length2, sourceFile }; } function getDiagnosticForCallNode(node, message, ...args) { @@ -108031,10 +111306,10 @@ ${lanes.join("\n")} } function getErrorNodeForCallNode(callLike) { if (isCallOrNewExpression(callLike)) { - return isPropertyAccessExpression16(callLike.expression) ? callLike.expression.name : callLike.expression; + return isPropertyAccessExpression17(callLike.expression) ? callLike.expression.name : callLike.expression; } if (isTaggedTemplateExpression5(callLike)) { - return isPropertyAccessExpression16(callLike.tag) ? callLike.tag.name : callLike.tag; + return isPropertyAccessExpression17(callLike.tag) ? callLike.tag.name : callLike.tag; } if (isJsxOpeningLikeElement(callLike)) { return callLike.tagName; @@ -108042,7 +111317,7 @@ ${lanes.join("\n")} return callLike; } function isPromiseResolveArityError(node) { - if (!isCallExpression16(node) || !isIdentifier26(node.expression)) return false; + if (!isCallExpression16(node) || !isIdentifier28(node.expression)) return false; const symbol2 = resolveName( node.expression, node.expression.escapedText, @@ -108053,7 +111328,7 @@ ${lanes.join("\n")} false ); const decl = symbol2 == null ? void 0 : symbol2.valueDeclaration; - if (!decl || !isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !isNewExpression19(decl.parent.parent) || !isIdentifier26(decl.parent.parent.expression)) { + if (!decl || !isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !isNewExpression19(decl.parent.parent) || !isIdentifier28(decl.parent.parent.expression)) { return false; } const globalPromiseSymbol = getGlobalPromiseConstructorSymbol( @@ -109031,7 +112306,7 @@ ${lanes.join("\n")} if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) { return resolveUntypedCall(node); } - if (isPotentiallyUncalledDecorator(node, callSignatures) && !isParenthesizedExpression7(node.expression)) { + if (isPotentiallyUncalledDecorator(node, callSignatures) && !isParenthesizedExpression8(node.expression)) { const nodeStr = getTextOfNode( node.expression, /*includeTrivia*/ @@ -109127,7 +112402,7 @@ ${lanes.join("\n")} ); if (jsxFactorySymbol === void 0) return sourceFileLinks.jsxFragmentType = errorType; if (jsxFactorySymbol.escapedName === ReactNames.Fragment) return sourceFileLinks.jsxFragmentType = getTypeOfSymbol(jsxFactorySymbol); - const resolvedAlias = (jsxFactorySymbol.flags & 2097152) === 0 ? jsxFactorySymbol : resolveAlias(jsxFactorySymbol); + const resolvedAlias = (jsxFactorySymbol.flags & 2097152) === 0 ? jsxFactorySymbol : resolveAlias2(jsxFactorySymbol); const reactExports = jsxFactorySymbol && getExportsOfSymbol(resolvedAlias); const typeSymbol = reactExports && getSymbol2( reactExports, @@ -109283,10 +112558,10 @@ ${lanes.join("\n")} if (!node || !isInJSFile(node)) { return false; } - const func = isFunctionDeclaration5(node) || isFunctionExpression7(node) ? node : (isVariableDeclaration7(node) || isPropertyAssignment11(node)) && node.initializer && isFunctionExpression7(node.initializer) ? node.initializer : void 0; + const func = isFunctionDeclaration5(node) || isFunctionExpression7(node) ? node : (isVariableDeclaration7(node) || isPropertyAssignment12(node)) && node.initializer && isFunctionExpression7(node.initializer) ? node.initializer : void 0; if (func) { if (getJSDocClassTag(node)) return true; - if (isPropertyAssignment11(walkUpParenthesizedExpressions(func.parent))) return false; + if (isPropertyAssignment12(walkUpParenthesizedExpressions(func.parent))) return false; const symbol2 = getSymbolOfDeclaration(func); return !!((_a3 = symbol2 == null ? void 0 : symbol2.members) == null ? void 0 : _a3.size); } @@ -109373,7 +112648,7 @@ ${lanes.join("\n")} } if (parent2 && isBinaryExpression4(parent2) && isPrototypeAccess(parent2.left) && parent2.operatorToken.kind === 64) { const right = getInitializerOfBinaryExpression(parent2); - return isObjectLiteralExpression12(right) && right; + return isObjectLiteralExpression13(right) && right; } } function checkCallExpression(node, checkMode) { @@ -109464,10 +112739,10 @@ ${lanes.join("\n")} function isSymbolOrSymbolForCall(node) { if (!isCallExpression16(node)) return false; let left = node.expression; - if (isPropertyAccessExpression16(left) && left.name.escapedText === "for") { + if (isPropertyAccessExpression17(left) && left.name.escapedText === "for") { left = left.expression; } - if (!isIdentifier26(left) || left.escapedText !== "Symbol") { + if (!isIdentifier28(left) || left.escapedText !== "Symbol") { return false; } const globalESSymbol = getGlobalESSymbolConstructorSymbol( @@ -109604,7 +112879,7 @@ ${lanes.join("\n")} )) { return false; } - if (!isIdentifier26(node.expression)) return Debug.fail(); + if (!isIdentifier28(node.expression)) return Debug.fail(); const resolvedRequire = resolveName( node.expression, node.expression.escapedText, @@ -109722,7 +112997,7 @@ ${lanes.join("\n")} } function checkAssertionDeferred(node) { const { type } = getAssertionTypeAndExpression(node); - const errNode = isParenthesizedExpression7(node) ? type : node; + const errNode = isParenthesizedExpression8(node) ? type : node; const links = getNodeLinks(node); Debug.assertIsDefined(links.assertionExpressionType); const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType)); @@ -109944,7 +113219,7 @@ ${lanes.join("\n")} const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter); return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`; } - Debug.assert(isIdentifier26(d.name)); + Debug.assert(isIdentifier28(d.name)); return d.name.escapedText; } function getParameterNameAtPosition(signature, pos, overrideRestType) { @@ -109991,7 +113266,7 @@ ${lanes.join("\n")} const associatedName = associatedNames == null ? void 0 : associatedNames[index]; const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken); if (associatedName) { - Debug.assert(isIdentifier26(associatedName.name)); + Debug.assert(isIdentifier28(associatedName.name)); return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement }; } return void 0; @@ -110002,10 +113277,10 @@ ${lanes.join("\n")} return void 0; } function getParameterDeclarationIdentifier(symbol2) { - return symbol2.valueDeclaration && isParameter(symbol2.valueDeclaration) && isIdentifier26(symbol2.valueDeclaration.name) && symbol2.valueDeclaration.name; + return symbol2.valueDeclaration && isParameter(symbol2.valueDeclaration) && isIdentifier28(symbol2.valueDeclaration.name) && symbol2.valueDeclaration.name; } function isValidDeclarationForTupleLabel(d) { - return d.kind === 203 || isParameter(d) && d.name && isIdentifier26(d.name); + return d.kind === 203 || isParameter(d) && d.name && isIdentifier28(d.name); } function getNameableDeclarationAtPosition(signature, pos) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -110146,7 +113421,7 @@ ${lanes.join("\n")} function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; } - function inferFromAnnotatedParametersAndReturn(signature, context, inferenceContext) { + function inferFromAnnotatedParametersAndReturn(signature, context2, inferenceContext) { const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); for (let i = 0; i < len; i++) { const declaration = signature.parameters[i].valueDeclaration; @@ -110158,36 +113433,36 @@ ${lanes.join("\n")} false, isOptionalDeclaration(declaration) ); - const target = getTypeAtPosition(context, i); + const target = getTypeAtPosition(context2, i); inferTypes(inferenceContext.inferences, source, target); } } const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration); if (typeNode) { const source = getTypeFromTypeNode(typeNode); - const target = getReturnTypeOfSignature(context); + const target = getReturnTypeOfSignature(context2); inferTypes(inferenceContext.inferences, source, target); } } - function assignContextualParameterTypes(signature, context) { - if (context.typeParameters) { + function assignContextualParameterTypes(signature, context2) { + if (context2.typeParameters) { if (!signature.typeParameters) { - signature.typeParameters = context.typeParameters; + signature.typeParameters = context2.typeParameters; } else { return; } } - if (context.thisParameter) { + if (context2.thisParameter) { const parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { signature.thisParameter = createSymbolWithType( - context.thisParameter, + context2.thisParameter, /*type*/ void 0 ); } - assignParameterType(signature.thisParameter, getTypeOfSymbol(context.thisParameter)); + assignParameterType(signature.thisParameter, getTypeOfSymbol(context2.thisParameter)); } } const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -110195,7 +113470,7 @@ ${lanes.join("\n")} const parameter = signature.parameters[i]; const declaration = parameter.valueDeclaration; if (!getEffectiveTypeAnnotationNode(declaration)) { - let type = tryGetTypeAtPosition(context, i); + let type = tryGetTypeAtPosition(context2, i); if (type && declaration.initializer) { let initializerType = checkDeclarationInitializer( declaration, @@ -110212,7 +113487,7 @@ ${lanes.join("\n")} if (signatureHasRestParameter(signature)) { const parameter = last(signature.parameters); if (parameter.valueDeclaration ? !getEffectiveTypeAnnotationNode(parameter.valueDeclaration) : !!(getCheckFlags(parameter) & 65536)) { - const contextualParameterType = getRestTypeAtPosition(context, len); + const contextualParameterType = getRestTypeAtPosition(context2, len); assignParameterType(parameter, contextualParameterType); } } @@ -110250,8 +113525,8 @@ ${lanes.join("\n")} Debug.assertEqual(links.type, contextualType, "Parameter symbol already has a cached type which differs from newly assigned type"); } } - function assignBindingElementTypes(pattern, parentType) { - for (const element of pattern.elements) { + function assignBindingElementTypes(pattern2, parentType) { + for (const element of pattern2.elements) { if (!isOmittedExpression(element)) { const type = getBindingElementTypeFromParentType( element, @@ -110887,7 +114162,7 @@ ${lanes.join("\n")} if (!(returnType.flags & 16)) return void 0; return forEach(func.parameters, (param, i) => { const initType = getTypeOfSymbol(param.symbol); - if (!initType || initType.flags & 16 || !isIdentifier26(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { + if (!initType || initType.flags & 16 || !isIdentifier28(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { return; } const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType); @@ -111086,7 +114361,7 @@ ${lanes.join("\n")} if (!writableType || writableType === falseType || writableType === regularFalseType) { return true; } - if (writableProp && writableProp.valueDeclaration && isPropertyAssignment11(writableProp.valueDeclaration)) { + if (writableProp && writableProp.valueDeclaration && isPropertyAssignment12(writableProp.valueDeclaration)) { const initializer3 = writableProp.valueDeclaration.initializer; const rawOriginalType = checkExpression(initializer3); if (rawOriginalType === falseType || rawOriginalType === regularFalseType) { @@ -111159,7 +114434,7 @@ ${lanes.join("\n")} error210(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } - if (isPropertyAccessExpression16(expr) && isPrivateIdentifier(expr.name)) { + if (isPropertyAccessExpression17(expr) && isPrivateIdentifier(expr.name)) { error210(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); } const links = getNodeLinks(expr); @@ -111551,7 +114826,7 @@ ${lanes.join("\n")} const nonRestNames = []; if (allProperties) { for (const otherProperty of allProperties) { - if (!isSpreadAssignment6(otherProperty)) { + if (!isSpreadAssignment7(otherProperty)) { nonRestNames.push(otherProperty.name); } } @@ -112315,7 +115590,7 @@ ${lanes.join("\n")} } function isIndirectCall(node) { return node.parent.kind === 218 && isNumericLiteral5(node.left) && node.left.text === "0" && (isCallExpression16(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 216) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior. - (isAccessExpression(node.right) || isIdentifier26(node.right) && node.right.escapedText === "eval"); + (isAccessExpression(node.right) || isIdentifier28(node.right) && node.right.escapedText === "eval"); } function checkForDisallowedESSymbolOperand(operator2) { const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint( @@ -112365,7 +115640,7 @@ ${lanes.join("\n")} } if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)) { let headMessage; - if (exactOptionalPropertyTypes && isPropertyAccessExpression16(left) && maybeTypeOfKind( + if (exactOptionalPropertyTypes && isPropertyAccessExpression17(left) && maybeTypeOfKind( valueType, 32768 /* Undefined */ @@ -112391,7 +115666,7 @@ ${lanes.join("\n")} case 4: const symbol2 = getSymbolOfNode(left); const init = getAssignedExpandoInitializer(right); - return !!init && isObjectLiteralExpression12(init) && !!((_a3 = symbol2 == null ? void 0 : symbol2.exports) == null ? void 0 : _a3.size); + return !!init && isObjectLiteralExpression13(init) && !!((_a3 = symbol2 == null ? void 0 : symbol2.exports) == null ? void 0 : _a3.size); default: return false; } @@ -112464,7 +115739,7 @@ ${lanes.join("\n")} } } function isGlobalNaN(expr) { - if (isIdentifier26(expr) && expr.escapedText === "NaN") { + if (isIdentifier28(expr) && expr.escapedText === "NaN") { const globalNaNSymbol = getGlobalNaNSymbol(); return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); } @@ -112569,7 +115844,7 @@ ${lanes.join("\n")} } function isTemplateLiteralContext(node) { const parent2 = node.parent; - return isParenthesizedExpression7(parent2) && isTemplateLiteralContext(parent2) || isElementAccessExpression8(parent2) && parent2.argumentExpression === node; + return isParenthesizedExpression8(parent2) && isTemplateLiteralContext(parent2) || isElementAccessExpression8(parent2) && parent2.argumentExpression === node; } function checkTemplateExpression(node) { const texts = [node.head.text]; @@ -112689,9 +115964,9 @@ ${lanes.join("\n")} } return type; } - function padObjectLiteralType(type, pattern) { + function padObjectLiteralType(type, pattern2) { let missingElements; - for (const e of pattern.elements) { + for (const e of pattern2.elements) { if (e.initializer) { const name = getPropertyNameFromBindingElement(e); if (name && !getPropertyOfType(type, name)) { @@ -112725,11 +116000,11 @@ ${lanes.join("\n")} const exprType = getLiteralTypeFromPropertyName(e.propertyName || e.name); return isTypeUsableAsPropertyName(exprType) ? getPropertyNameFromType(exprType) : void 0; } - function padTupleType(type, pattern) { - if (type.target.combinedFlags & 12 || getTypeReferenceArity(type) >= pattern.elements.length) { + function padTupleType(type, pattern2) { + if (type.target.combinedFlags & 12 || getTypeReferenceArity(type) >= pattern2.elements.length) { return type; } - const patternElements = pattern.elements; + const patternElements = pattern2.elements; const elementTypes = getElementTypes(type).slice(); const elementFlags = type.target.elementFlags.slice(); for (let i = getTypeReferenceArity(type); i < patternElements.length; i++) { @@ -112841,7 +116116,7 @@ ${lanes.join("\n")} node, 0 /* None */ - )) || (isParenthesizedExpression7(parent2) || isArrayLiteralExpression7(parent2) || isSpreadElement5(parent2)) && isConstContext(parent2) || (isPropertyAssignment11(parent2) || isShorthandPropertyAssignment6(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent); + )) || (isParenthesizedExpression8(parent2) || isArrayLiteralExpression7(parent2) || isSpreadElement5(parent2)) && isConstContext(parent2) || (isPropertyAssignment12(parent2) || isShorthandPropertyAssignment7(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent); } function checkExpressionForMutableLocation(node, checkMode, forceTuple) { const type = checkExpression(node, checkMode, forceTuple); @@ -112903,13 +116178,13 @@ ${lanes.join("\n")} skippedGenericFunction(node, checkMode); return anyFunctionType; } - const context = getInferenceContext(node); - const returnType = context.signature && getReturnTypeOfSignature(context.signature); + const context2 = getInferenceContext(node); + const returnType = context2.signature && getReturnTypeOfSignature(context2.signature); const returnSignature = returnType && getSingleCallOrConstructSignature(returnType); - if (returnSignature && !returnSignature.typeParameters && !every(context.inferences, hasInferenceCandidates)) { - const uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters); + if (returnSignature && !returnSignature.typeParameters && !every(context2.inferences, hasInferenceCandidates)) { + const uniqueTypeParameters = getUniqueTypeParameters(context2, signature.typeParameters); const instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters); - const inferences = map2(context.inferences, (info) => createInferenceInfo(info.typeParameter)); + const inferences = map2(context2.inferences, (info) => createInferenceInfo(info.typeParameter)); applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => { inferTypes( inferences, @@ -112925,14 +116200,14 @@ ${lanes.join("\n")} applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => { inferTypes(inferences, source, target); }); - if (!hasOverlappingInferences(context.inferences, inferences)) { - mergeInferences(context.inferences, inferences); - context.inferredTypeParameters = concatenate(context.inferredTypeParameters, uniqueTypeParameters); + if (!hasOverlappingInferences(context2.inferences, inferences)) { + mergeInferences(context2.inferences, inferences); + context2.inferredTypeParameters = concatenate(context2.inferredTypeParameters, uniqueTypeParameters); return getOrCreateTypeFromSignature(instantiatedSignature); } } } - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context2)); } } } @@ -112941,8 +116216,8 @@ ${lanes.join("\n")} } function skippedGenericFunction(node, checkMode) { if (checkMode & 2) { - const context = getInferenceContext(node); - context.flags |= 4; + const context2 = getInferenceContext(node); + context2.flags |= 4; } } function hasInferenceCandidates(info) { @@ -112966,14 +116241,14 @@ ${lanes.join("\n")} } } } - function getUniqueTypeParameters(context, typeParameters) { + function getUniqueTypeParameters(context2, typeParameters) { const result = []; let oldTypeParameters; let newTypeParameters; for (const tp of typeParameters) { const name = tp.symbol.escapedName; - if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) { - const newName = getUniqueTypeParameterName(concatenate(context.inferredTypeParameters, result), name); + if (hasTypeParameterByName(context2.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) { + const newName = getUniqueTypeParameterName(concatenate(context2.inferredTypeParameters, result), name); const symbol2 = createSymbol(262144, newName); const newTypeParameter = createTypeParameter(symbol2); newTypeParameter.target = tp; @@ -113320,14 +116595,14 @@ ${lanes.join("\n")} if (!(func.kind === 177 && nodeIsPresent(func.body))) { error210(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 177 && isIdentifier26(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 177 && isIdentifier28(node.name) && node.name.escapedText === "constructor") { error210(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) { error210(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } - if (node.name && isIdentifier26(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { + if (node.name && isIdentifier28(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { if (func.parameters.indexOf(node) !== 0) { error210(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } @@ -113408,8 +116683,8 @@ ${lanes.join("\n")} } } } - function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { - for (const element of pattern.elements) { + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern2, predicateVariableNode, predicateVariableName) { + for (const element of pattern2.elements) { if (isOmittedExpression(element)) { continue; } @@ -113685,7 +116960,7 @@ ${lanes.join("\n")} } function checkMethodDeclaration(node) { if (!checkGrammarMethod(node)) checkGrammarComputedPropertyName(node.name); - if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier26(node.name) && idText(node.name) === "constructor") { + if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier28(node.name) && idText(node.name) === "constructor") { error210(node.name, Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); @@ -113795,7 +117070,7 @@ ${lanes.join("\n")} return !!forEachChild27(node, nodeImmediatelyReferencesSuperOrThis); } function checkAccessorDeclaration(node) { - if (isIdentifier26(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { + if (isIdentifier28(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { error210(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor); } addLazyDiagnostic(checkAccessorDeclarationDiagnostics); @@ -114411,7 +117686,7 @@ ${lanes.join("\n")} case 278: case 227: const node2 = d; - const expression = isExportAssignment3(node2) ? node2.expression : node2.right; + const expression = isExportAssignment4(node2) ? node2.expression : node2.right; if (!isEntityNameExpression(expression)) { return 1; } @@ -114422,7 +117697,7 @@ ${lanes.join("\n")} case 275: case 274: let result = 0; - const target = resolveAlias(getSymbolOfDeclaration(d)); + const target = resolveAlias2(getSymbolOfDeclaration(d)); forEach(target.declarations, (d2) => { result |= getDeclarationSpaces(d2); }); @@ -114759,13 +118034,13 @@ ${lanes.join("\n")} const sourceFile = getSourceFileOfNode(decorator); if (!hasParseDiagnostics(sourceFile)) { let node = decorator.expression; - if (isParenthesizedExpression7(node)) { + if (isParenthesizedExpression8(node)) { return false; } let canHaveCallExpression = true; let errorNode; while (true) { - if (isExpressionWithTypeArguments(node) || isNonNullExpression5(node)) { + if (isExpressionWithTypeArguments(node) || isNonNullExpression6(node)) { node = node.expression; continue; } @@ -114780,7 +118055,7 @@ ${lanes.join("\n")} canHaveCallExpression = false; continue; } - if (isPropertyAccessExpression16(node)) { + if (isPropertyAccessExpression17(node)) { if (node.questionDotToken) { errorNode = node.questionDotToken; } @@ -114788,7 +118063,7 @@ ${lanes.join("\n")} canHaveCallExpression = false; continue; } - if (!isIdentifier26(node)) { + if (!isIdentifier28(node)) { errorNode = node; } break; @@ -114909,7 +118184,7 @@ ${lanes.join("\n")} return void 0; } if (commonEntityName) { - if (!isIdentifier26(commonEntityName) || !isIdentifier26(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) { + if (!isIdentifier28(commonEntityName) || !isIdentifier28(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) { return void 0; } } else { @@ -115216,7 +118491,7 @@ ${lanes.join("\n")} addDiagnostic(declaration, 0, createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { - return isIdentifier26(node) && idText(node).charCodeAt(0) === 95; + return isIdentifier28(node) && idText(node).charCodeAt(0) === 95; } function checkUnusedClassMembers(node, addDiagnostic) { for (const member of node.members) { @@ -115541,7 +118816,7 @@ ${lanes.join("\n")} function checkWeakMapSetCollision(node) { const enclosingBlockScope = getEnclosingBlockScopeContainer(node); if (getNodeCheckFlags(enclosingBlockScope) & 1048576) { - Debug.assert(isNamedDeclaration(node) && isIdentifier26(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier"); + Debug.assert(isNamedDeclaration(node) && isIdentifier28(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier"); errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText); } } @@ -115570,7 +118845,7 @@ ${lanes.join("\n")} } } if (hasCollision) { - Debug.assert(isNamedDeclaration(node) && isIdentifier26(node.name), "The target of a Reflect collision check should be an identifier"); + Debug.assert(isNamedDeclaration(node) && isIdentifier28(node.name), "The target of a Reflect collision check should be an identifier"); errorSkippedOn("noEmit", node, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, declarationNameToString(node.name), "Reflect"); } } @@ -115595,7 +118870,7 @@ ${lanes.join("\n")} } const symbol2 = getSymbolOfDeclaration(node); if (symbol2.flags & 1) { - if (!isIdentifier26(node.name)) return Debug.fail(); + if (!isIdentifier28(node.name)) return Debug.fail(); const localDeclarationSymbol = resolveName( node, node.name.escapedText, @@ -115641,7 +118916,7 @@ ${lanes.join("\n")} } } if (isBindingElement(node)) { - if (node.propertyName && isIdentifier26(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) { + if (node.propertyName && isIdentifier28(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) { potentialUnusedRenamedBindingElementsInTypes.push(node); return; } @@ -115736,7 +119011,7 @@ ${lanes.join("\n")} if (node === symbol2.valueDeclaration) { const initializer3 = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node); if (initializer3) { - const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression12(initializer3) && (initializer3.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a3 = symbol2.exports) == null ? void 0 : _a3.size); + const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression13(initializer3) && (initializer3.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a3 = symbol2.exports) == null ? void 0 : _a3.size); if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 250) { const initializerType = checkExpressionCached(initializer3); checkTypeAssignableToAndOptionallyElaborate( @@ -115891,11 +119166,11 @@ ${lanes.join("\n")} return; } const type = location === condExpr2 ? condType : checkExpression(location); - if (type.flags & 1024 && isPropertyAccessExpression16(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { + if (type.flags & 1024 && isPropertyAccessExpression17(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { error210(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false"); return; } - const isPropertyExpressionCast = isPropertyAccessExpression16(location) && isTypeAssertion(location.expression); + const isPropertyExpressionCast = isPropertyAccessExpression17(location) && isTypeAssertion(location.expression); if (!hasTypeFacts( type, 4194304 @@ -115910,7 +119185,7 @@ ${lanes.join("\n")} if (callSignatures.length === 0 && !isPromise) { return; } - const testedNode = isIdentifier26(location) ? location : isPropertyAccessExpression16(location) ? location.name : void 0; + const testedNode = isIdentifier28(location) ? location : isPropertyAccessExpression17(location) ? location.name : void 0; const testedSymbol = testedNode && getSymbolAtLocation(testedNode); if (!testedSymbol && !isPromise) { return; @@ -115933,18 +119208,18 @@ ${lanes.join("\n")} } function isSymbolUsedInConditionBody(expr, body, testedNode, testedSymbol) { return !!forEachChild27(body, function check2(childNode) { - if (isIdentifier26(childNode)) { + if (isIdentifier28(childNode)) { const childSymbol = getSymbolAtLocation(childNode); if (childSymbol && childSymbol === testedSymbol) { - if (isIdentifier26(expr) || isIdentifier26(testedNode) && isBinaryExpression4(testedNode.parent)) { + if (isIdentifier28(expr) || isIdentifier28(testedNode) && isBinaryExpression4(testedNode.parent)) { return true; } let testedExpression = testedNode.parent; let childExpression = childNode.parent; while (testedExpression && childExpression) { - if (isIdentifier26(testedExpression) && isIdentifier26(childExpression) || testedExpression.kind === 110 && childExpression.kind === 110) { + if (isIdentifier28(testedExpression) && isIdentifier28(childExpression) || testedExpression.kind === 110 && childExpression.kind === 110) { return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression); - } else if (isPropertyAccessExpression16(testedExpression) && isPropertyAccessExpression16(childExpression)) { + } else if (isPropertyAccessExpression17(testedExpression) && isPropertyAccessExpression17(childExpression)) { if (getSymbolAtLocation(testedExpression.name) !== getSymbolAtLocation(childExpression.name)) { return false; } @@ -115965,7 +119240,7 @@ ${lanes.join("\n")} function isSymbolUsedInBinaryExpressionChain(node, testedSymbol) { while (isBinaryExpression4(node) && node.operatorToken.kind === 56) { const isUsed = forEachChild27(node.right, function visit(child) { - if (isIdentifier26(child)) { + if (isIdentifier28(child)) { const symbol2 = getSymbolAtLocation(child); if (symbol2 && symbol2 === testedSymbol) { return true; @@ -116948,7 +120223,7 @@ ${lanes.join("\n")} } function checkThrowStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (isIdentifier26(node.expression) && !node.expression.escapedText) { + if (isIdentifier28(node.expression) && !node.expression.escapedText) { grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } } @@ -117092,7 +120367,7 @@ ${lanes.join("\n")} const parameters = /* @__PURE__ */ new Set(); const excludedParameters = /* @__PURE__ */ new Set(); forEach(node.parameters, ({ name }, index) => { - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { parameters.add(name.escapedText); } if (isBindingPattern(name)) { @@ -117103,12 +120378,12 @@ ${lanes.join("\n")} if (containsArguments) { const lastJSDocParamIndex = jsdocParameters.length - 1; const lastJSDocParam = jsdocParameters[lastJSDocParamIndex]; - if (isJs && lastJSDocParam && isIdentifier26(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) { + if (isJs && lastJSDocParam && isIdentifier28(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) { error210(lastJSDocParam.name, Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, idText(lastJSDocParam.name)); } } else { forEach(jsdocParameters, ({ name, isNameFirst }, index) => { - if (excludedParameters.has(index) || isIdentifier26(name) && parameters.has(name.escapedText)) { + if (excludedParameters.has(index) || isIdentifier28(name) && parameters.has(name.escapedText)) { return; } if (isQualifiedName2(name)) { @@ -117264,7 +120539,7 @@ ${lanes.join("\n")} 4194304 /* SetFunctionName */ ); - if ((isPropertyAssignment11(parent2) || isPropertyDeclaration(parent2) || isBindingElement(parent2)) && isComputedPropertyName(parent2.name)) { + if ((isPropertyAssignment12(parent2) || isPropertyDeclaration(parent2) || isBindingElement(parent2)) && isComputedPropertyName(parent2.name)) { checkExternalEmitHelpers( location, 8388608 @@ -117710,7 +120985,7 @@ ${lanes.join("\n")} if (uninitialized && !(derived.flags & 33554432) && !(baseDeclarationFlags & 64) && !(derivedDeclarationFlags & 64) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432)))) { const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol)); const propName2 = uninitialized.name; - if (uninitialized.exclamationToken || !constructor || !isIdentifier26(propName2) || !strictNullChecks || !isPropertyInitializedInConstructor(propName2, type, constructor)) { + if (uninitialized.exclamationToken || !constructor || !isIdentifier28(propName2) || !strictNullChecks || !isPropertyInitializedInConstructor(propName2, type, constructor)) { const errorMessage2 = Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration; error210(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType)); } @@ -117828,7 +121103,7 @@ ${lanes.join("\n")} } if (!isStatic(member) && isPropertyWithoutInitializer(member)) { const propName2 = member.name; - if (isIdentifier26(propName2) || isPrivateIdentifier(propName2) || isComputedPropertyName(propName2)) { + if (isIdentifier28(propName2) || isPrivateIdentifier(propName2) || isComputedPropertyName(propName2)) { const type = getTypeOfSymbol(getSymbolOfDeclaration(member)); if (!(type.flags & 3 || containsUndefinedType(type))) { if (!constructor || !isPropertyInitializedInConstructor(propName2, type, constructor)) { @@ -118209,7 +121484,7 @@ ${lanes.join("\n")} grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); } } - if (isIdentifier26(node.name)) { + if (isIdentifier28(node.name)) { checkCollisionsForDeclarationName(node, node.name); if (!(node.flags & (32 | 2048))) { const sourceFile = getSourceFileOfNode(node); @@ -118388,7 +121663,7 @@ ${lanes.join("\n")} function checkAliasSymbol(node) { var _a3, _b, _c, _d, _e; let symbol2 = getSymbolOfDeclaration(node); - const target = resolveAlias(symbol2); + const target = resolveAlias2(symbol2); if (target !== unknownSymbol) { symbol2 = getMergedSymbol(symbol2.exportSymbol || symbol2); if (isInJSFile(node) && !(target.flags & 111551) && !isTypeOnlyImportOrExportDeclaration(node)) { @@ -118418,9 +121693,9 @@ ${lanes.join("\n")} node.kind !== 261 /* VariableDeclaration */ ); - const importDeclaration = findAncestor(node, or(isImportDeclaration7, isImportEqualsDeclaration)); + const importDeclaration = findAncestor(node, or(isImportDeclaration8, isImportEqualsDeclaration)); const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "..."; - const importedIdentifier = unescapeLeadingUnderscores(isIdentifier26(errorNode) ? errorNode.escapedText : symbol2.escapedName); + const importedIdentifier = unescapeLeadingUnderscores(isIdentifier28(errorNode) ? errorNode.escapedText : symbol2.escapedName); error210( errorNode, Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation, @@ -118508,7 +121783,7 @@ ${lanes.join("\n")} if (!(symbol2.flags & 2097152) || isDeprecatedSymbol(symbol2) || !getDeclarationOfAliasSymbol(symbol2)) { return symbol2; } - const targetSymbol = resolveAlias(symbol2); + const targetSymbol = resolveAlias2(symbol2); if (targetSymbol === unknownSymbol) return targetSymbol; while (symbol2.flags & 2097152) { const target = getImmediateAliasedSymbol(symbol2); @@ -118579,7 +121854,7 @@ ${lanes.join("\n")} isImportAttributes2 ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls ); } - const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration7(declaration) ? (_a3 = declaration.importClause) == null ? void 0 : _a3.isTypeOnly : declaration.isTypeOnly); + const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration8(declaration) ? (_a3 = declaration.importClause) == null ? void 0 : _a3.isTypeOnly : declaration.isTypeOnly); if (isTypeOnly) { return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); } @@ -118653,7 +121928,7 @@ ${lanes.join("\n")} /* ExportImportEquals */ ); if (node.moduleReference.kind !== 284) { - const target = resolveAlias(getSymbolOfDeclaration(node)); + const target = resolveAlias2(getSymbolOfDeclaration(node)); if (target !== unknownSymbol) { const targetFlags = getSymbolFlags(target); if (targetFlags & 111551) { @@ -119249,8 +122524,8 @@ ${lanes.join("\n")} Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes."); } } - function checkDeferredNodes(context) { - const links = getNodeLinks(context); + function checkDeferredNodes(context2) { + const links = getNodeLinks(context2); if (links.deferredNodes) { links.deferredNodes.forEach(checkDeferredNode); } @@ -119636,7 +122911,7 @@ ${lanes.join("\n")} case 3: return getSymbolOfNode(entityName.parent); case 5: - if (isPropertyAccessExpression16(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) { + if (isPropertyAccessExpression17(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) { return void 0; } // falls through @@ -119894,15 +123169,15 @@ ${lanes.join("\n")} true, getHostSignatureFromJSDoc(name) ); - if (!symbol2 && isIdentifier26(name) && container) { + if (!symbol2 && isIdentifier28(name) && container) { symbol2 = getMergedSymbol(getSymbol2(getExportsOfSymbol(container), name.escapedText, meaning)); } if (symbol2) { return symbol2; } } - const left = isIdentifier26(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container); - const right = isIdentifier26(name) ? name.escapedText : name.right.escapedText; + const left = isIdentifier28(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container); + const right = isIdentifier28(name) ? name.escapedText : name.right.escapedText; if (left) { const proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype"); const t = proto ? getTypeOfSymbol(proto) : getDeclaredTypeOfSymbol(left); @@ -120004,7 +123279,7 @@ ${lanes.join("\n")} case 206: return isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : void 0; case 95: - return isExportAssignment3(node.parent) ? Debug.checkDefined(node.parent.symbol) : void 0; + return isExportAssignment4(node.parent) ? Debug.checkDefined(node.parent.symbol) : void 0; case 102: if (isMetaProperty(node.parent) && node.parent.name.escapedText === "defer") { return void 0; @@ -120032,7 +123307,7 @@ ${lanes.join("\n")} } } function getIndexInfosAtLocation(node) { - if (isIdentifier26(node) && isPropertyAccessExpression16(node.parent) && node.parent.name === node) { + if (isIdentifier28(node) && isPropertyAccessExpression17(node.parent) && node.parent.name === node) { const keyType = getLiteralTypeFromPropertyName(node); const objectType = getTypeOfExpression(node.parent.expression); const objectTypes = objectType.flags & 1048576 ? objectType.types : [objectType]; @@ -120161,7 +123436,7 @@ ${lanes.join("\n")} return checkDestructuringAssignment(expr, iteratedType || errorType); } if (expr.parent.kind === 304) { - const node2 = cast(expr.parent.parent, isObjectLiteralExpression12); + const node2 = cast(expr.parent.parent, isObjectLiteralExpression13); const typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node2) || errorType; const propertyIndex = indexOfNode(node2.properties, expr.parent); return checkObjectLiteralDestructuringPropertyAssignment(node2, typeOfParentObjectLiteral, propertyIndex); @@ -120259,11 +123534,11 @@ ${lanes.join("\n")} } function isArgumentsLocalBinding(nodeIn) { if (isGeneratedIdentifier(nodeIn)) return false; - const node = getParseTreeNode(nodeIn, isIdentifier26); + const node = getParseTreeNode(nodeIn, isIdentifier28); if (!node) return false; const parent2 = node.parent; if (!parent2) return false; - const isPropertyName2 = (isPropertyAccessExpression16(parent2) || isPropertyAssignment11(parent2)) && parent2.name === node; + const isPropertyName2 = (isPropertyAccessExpression17(parent2) || isPropertyAssignment12(parent2)) && parent2.name === node; return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol; } function isNameOfModuleOrEnumDeclaration(node) { @@ -120271,7 +123546,7 @@ ${lanes.join("\n")} } function getReferencedExportContainer(nodeIn, prefixLocals) { var _a3; - const node = getParseTreeNode(nodeIn, isIdentifier26); + const node = getParseTreeNode(nodeIn, isIdentifier28); if (node) { let symbol2 = getReferencedValueSymbol( node, @@ -120304,7 +123579,7 @@ ${lanes.join("\n")} if (specifier) { return specifier; } - const node = getParseTreeNode(nodeIn, isIdentifier26); + const node = getParseTreeNode(nodeIn, isIdentifier28); if (node) { const symbol2 = getReferencedValueOrAliasSymbol(node); if (isNonLocalAlias( @@ -120373,7 +123648,7 @@ ${lanes.join("\n")} } function getReferencedDeclarationWithCollidingName(nodeIn) { if (!isGeneratedIdentifier(nodeIn)) { - const node = getParseTreeNode(nodeIn, isIdentifier26); + const node = getParseTreeNode(nodeIn, isIdentifier28); if (node) { const symbol2 = getReferencedValueSymbol(node); if (symbol2 && isSymbolOfDeclarationWithCollidingName(symbol2)) { @@ -120435,7 +123710,7 @@ ${lanes.join("\n")} const container = getSourceFileOfNode(symbol2.valueDeclaration); const fileSymbol = container && getSymbolOfDeclaration(container); void resolveExternalModuleSymbol(fileSymbol); - const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol2)); + const target = getExportSymbolOfValueSymbolIfExported(resolveAlias2(symbol2)); if (target === unknownSymbol) { return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol2); } @@ -120615,14 +123890,14 @@ ${lanes.join("\n")} forEachNodeRecursively(node2, checkIdentifiers); } function isExpressionNodeOrShorthandPropertyAssignmentName(node2) { - return isExpressionNode(node2) || isShorthandPropertyAssignment6(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2; + return isExpressionNode(node2) || isShorthandPropertyAssignment7(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2; } function checkSingleIdentifier(node2) { const nodeLinks2 = getNodeLinks(node2); nodeLinks2.calculatedFlags |= 536870912; - if (isIdentifier26(node2)) { + if (isIdentifier28(node2)) { nodeLinks2.calculatedFlags |= 32768 | 16384; - if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression16(node2.parent) && node2.parent.name === node2)) { + if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression17(node2.parent) && node2.parent.name === node2)) { const s = getResolvedSymbol(node2); if (s && s !== unknownSymbol) { checkIdentifierCalculateNodeCheckFlags(node2, s); @@ -120725,7 +124000,7 @@ ${lanes.join("\n")} true, location ); - const resolvedValueSymbol = valueSymbol && valueSymbol.flags & 2097152 ? resolveAlias(valueSymbol) : valueSymbol; + const resolvedValueSymbol = valueSymbol && valueSymbol.flags & 2097152 ? resolveAlias2(valueSymbol) : valueSymbol; isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration( valueSymbol, 111551 @@ -120740,7 +124015,7 @@ ${lanes.join("\n")} true, location ); - const resolvedTypeSymbol = typeSymbol && typeSymbol.flags & 2097152 ? resolveAlias(typeSymbol) : typeSymbol; + const resolvedTypeSymbol = typeSymbol && typeSymbol.flags & 2097152 ? resolveAlias2(typeSymbol) : typeSymbol; if (!valueSymbol) { isTypeOnly || (isTypeOnly = !!(typeSymbol && getTypeOnlyAliasDeclaration( typeSymbol, @@ -120905,7 +124180,7 @@ ${lanes.join("\n")} } function getReferencedValueDeclaration(referenceIn) { if (!isGeneratedIdentifier(referenceIn)) { - const reference = getParseTreeNode(referenceIn, isIdentifier26); + const reference = getParseTreeNode(referenceIn, isIdentifier28); if (reference) { const symbol2 = getReferencedValueSymbol(reference); if (symbol2) { @@ -120917,7 +124192,7 @@ ${lanes.join("\n")} } function getReferencedValueDeclarations(referenceIn) { if (!isGeneratedIdentifier(referenceIn)) { - const reference = getParseTreeNode(referenceIn, isIdentifier26); + const reference = getParseTreeNode(referenceIn, isIdentifier28); if (reference) { const symbol2 = getReferencedValueSymbol(reference); if (symbol2) { @@ -121077,9 +124352,9 @@ ${lanes.join("\n")} getJsxFactoryEntity, getJsxFragmentFactoryEntity, isBindingCapturedByNode: (node, decl) => { - const parseNode = getParseTreeNode(node); + const parseNode2 = getParseTreeNode(node); const parseDecl = getParseTreeNode(decl); - return !!parseNode && !!parseDecl && (isVariableDeclaration7(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl); + return !!parseNode2 && !!parseDecl && (isVariableDeclaration7(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode2, parseDecl); }, getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => { const n = getParseTreeNode(node); @@ -121514,7 +124789,7 @@ ${lanes.join("\n")} if (isParameter(node) && parameterIsThisKeyword(node)) { return grammarErrorOnFirstToken(node, Diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters); } - const blockScopeKind = isVariableStatement11(node) ? node.declarationList.flags & 7 : 0; + const blockScopeKind = isVariableStatement12(node) ? node.declarationList.flags & 7 : 0; let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator; let flags = 0; let sawExportBeforeDecorators = false; @@ -122172,7 +125447,7 @@ ${lanes.join("\n")} if (prop.kind === 306) { if (inDestructuring) { const expression = skipParentheses(prop.expression); - if (isArrayLiteralExpression7(expression) || isObjectLiteralExpression12(expression)) { + if (isArrayLiteralExpression7(expression) || isObjectLiteralExpression13(expression)) { return grammarErrorOnNode(prop.expression, Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } } @@ -122188,7 +125463,7 @@ ${lanes.join("\n")} if (name.kind === 81) { grammarErrorOnNode(name, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); } - if (canHaveModifiers(prop) && prop.modifiers) { + if (canHaveModifiers2(prop) && prop.modifiers) { for (const mod of prop.modifiers) { if (isModifier(mod) && (mod.kind !== 134 || prop.kind !== 175)) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); @@ -122278,7 +125553,7 @@ ${lanes.join("\n")} } } function checkGrammarJsxName(node) { - if (isPropertyAccessExpression16(node) && isJsxNamespacedName(node.expression)) { + if (isPropertyAccessExpression17(node) && isJsxNamespacedName(node.expression)) { return grammarErrorOnNode(node.expression, Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names); } if (isJsxNamespacedName(node) && getJSXTransformEnabled(compilerOptions) && !isIntrinsicJsxName(node.namespace.escapedText)) { @@ -122344,7 +125619,7 @@ ${lanes.join("\n")} } } } - if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536) && isIdentifier26(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { + if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536) && isIdentifier28(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { grammarErrorOnNode(forInOrOfStatement.initializer, Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } @@ -122592,7 +125867,7 @@ ${lanes.join("\n")} return expr.kind === 10 || expr.kind === 225 && expr.operator === 41 && expr.operand.kind === 10; } function isSimpleLiteralEnumReference(expr) { - if ((isPropertyAccessExpression16(expr) || isElementAccessExpression8(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { + if ((isPropertyAccessExpression17(expr) || isElementAccessExpression8(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { return !!(checkExpressionCached(expr).flags & 1056); } } @@ -123140,7 +126415,7 @@ ${lanes.join("\n")} switch (name.parent.kind) { case 277: case 282: - return isIdentifier26(name) || name.kind === 11; + return isIdentifier28(name) || name.kind === 11; default: return isDeclarationName(name); } @@ -123200,7 +126475,7 @@ ${lanes.join("\n")} }; } var SymbolTrackerImpl = class _SymbolTrackerImpl { - constructor(context, tracker, moduleResolverHost) { + constructor(context2, tracker, moduleResolverHost) { this.moduleResolverHost = void 0; this.inner = void 0; this.disableTrackSymbol = false; @@ -123210,7 +126485,7 @@ ${lanes.join("\n")} } this.inner = tracker; this.moduleResolverHost = moduleResolverHost; - this.context = context; + this.context = context2; this.canTrackSymbol = !!((_a3 = this.inner) == null ? void 0 : _a3.trackSymbol); } trackSymbol(symbol2, enclosingDeclaration, meaning) { @@ -123390,47 +126665,47 @@ ${lanes.join("\n")} Debug.assertEachNode(nodes, test); return nodes; } - function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor = visitNodes2) { - context.startLexicalEnvironment(); + function visitLexicalEnvironment(statements, visitor, context2, start, ensureUseStrict, nodesVisitor = visitNodes2) { + context2.startLexicalEnvironment(); statements = nodesVisitor(statements, visitor, isStatement, start); - if (ensureUseStrict) statements = context.factory.ensureUseStrict(statements); - return factory.mergeLexicalEnvironment(statements, context.endLexicalEnvironment()); + if (ensureUseStrict) statements = context2.factory.ensureUseStrict(statements); + return factory.mergeLexicalEnvironment(statements, context2.endLexicalEnvironment()); } - function visitParameterList(nodes, visitor, context, nodesVisitor = visitNodes2) { + function visitParameterList(nodes, visitor, context2, nodesVisitor = visitNodes2) { let updated; - context.startLexicalEnvironment(); + context2.startLexicalEnvironment(); if (nodes) { - context.setLexicalEnvironmentFlags(1, true); + context2.setLexicalEnvironmentFlags(1, true); updated = nodesVisitor(nodes, visitor, isParameter); - if (context.getLexicalEnvironmentFlags() & 2 && getEmitScriptTarget(context.getCompilerOptions()) >= 2) { - updated = addDefaultValueAssignmentsIfNeeded(updated, context); + if (context2.getLexicalEnvironmentFlags() & 2 && getEmitScriptTarget(context2.getCompilerOptions()) >= 2) { + updated = addDefaultValueAssignmentsIfNeeded(updated, context2); } - context.setLexicalEnvironmentFlags(1, false); + context2.setLexicalEnvironmentFlags(1, false); } - context.suspendLexicalEnvironment(); + context2.suspendLexicalEnvironment(); return updated; } - function addDefaultValueAssignmentsIfNeeded(parameters, context) { + function addDefaultValueAssignmentsIfNeeded(parameters, context2) { let result; for (let i = 0; i < parameters.length; i++) { const parameter = parameters[i]; - const updated = addDefaultValueAssignmentIfNeeded(parameter, context); + const updated = addDefaultValueAssignmentIfNeeded(parameter, context2); if (result || updated !== parameter) { if (!result) result = parameters.slice(0, i); result[i] = updated; } } if (result) { - return setTextRange(context.factory.createNodeArray(result, parameters.hasTrailingComma), parameters); + return setTextRange(context2.factory.createNodeArray(result, parameters.hasTrailingComma), parameters); } return parameters; } - function addDefaultValueAssignmentIfNeeded(parameter, context) { - return parameter.dotDotDotToken ? parameter : isBindingPattern(parameter.name) ? addDefaultValueAssignmentForBindingPattern(parameter, context) : parameter.initializer ? addDefaultValueAssignmentForInitializer(parameter, parameter.name, parameter.initializer, context) : parameter; + function addDefaultValueAssignmentIfNeeded(parameter, context2) { + return parameter.dotDotDotToken ? parameter : isBindingPattern(parameter.name) ? addDefaultValueAssignmentForBindingPattern(parameter, context2) : parameter.initializer ? addDefaultValueAssignmentForInitializer(parameter, parameter.name, parameter.initializer, context2) : parameter; } - function addDefaultValueAssignmentForBindingPattern(parameter, context) { - const { factory: factory2 } = context; - context.addInitializationStatement( + function addDefaultValueAssignmentForBindingPattern(parameter, context2) { + const { factory: factory2 } = context2; + context2.addInitializationStatement( factory2.createVariableStatement( /*modifiers*/ void 0, @@ -123467,9 +126742,9 @@ ${lanes.join("\n")} void 0 ); } - function addDefaultValueAssignmentForInitializer(parameter, name, initializer3, context) { - const factory2 = context.factory; - context.addInitializationStatement( + function addDefaultValueAssignmentForInitializer(parameter, name, initializer3, context2) { + const factory2 = context2.factory; + context2.addInitializationStatement( factory2.createIfStatement( factory2.createTypeCheck(factory2.cloneNode(name), "undefined"), setEmitFlags( @@ -123515,32 +126790,32 @@ ${lanes.join("\n")} void 0 ); } - function visitFunctionBody(node, visitor, context, nodeVisitor = visitNode) { - context.resumeLexicalEnvironment(); + function visitFunctionBody(node, visitor, context2, nodeVisitor = visitNode) { + context2.resumeLexicalEnvironment(); const updated = nodeVisitor(node, visitor, isConciseBody); - const declarations = context.endLexicalEnvironment(); + const declarations = context2.endLexicalEnvironment(); if (some(declarations)) { if (!updated) { - return context.factory.createBlock(declarations); + return context2.factory.createBlock(declarations); } - const block2 = context.factory.converters.convertToFunctionBlock(updated); + const block2 = context2.factory.converters.convertToFunctionBlock(updated); const statements = factory.mergeLexicalEnvironment(block2.statements, declarations); - return context.factory.updateBlock(block2, statements); + return context2.factory.updateBlock(block2, statements); } return updated; } - function visitIterationBody(body, visitor, context, nodeVisitor = visitNode) { - context.startBlockScope(); - const updated = nodeVisitor(body, visitor, isStatement, context.factory.liftToBlock); + function visitIterationBody(body, visitor, context2, nodeVisitor = visitNode) { + context2.startBlockScope(); + const updated = nodeVisitor(body, visitor, isStatement, context2.factory.liftToBlock); Debug.assert(updated); - const declarations = context.endBlockScope(); + const declarations = context2.endBlockScope(); if (some(declarations)) { if (isBlock6(updated)) { declarations.push(...updated.statements); - return context.factory.updateBlock(updated, declarations); + return context2.factory.updateBlock(updated, declarations); } declarations.push(updated); - return context.factory.createBlock(declarations); + return context2.factory.createBlock(declarations); } return updated; } @@ -123556,29 +126831,29 @@ ${lanes.join("\n")} return discarded ? discardVisitor(node) : visitor(node); }, isExpression); } - function visitEachChild(node, visitor, context = nullTransformationContext, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) { + function visitEachChild(node, visitor, context2 = nullTransformationContext, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) { if (node === void 0) { return void 0; } const fn = visitEachChildTable[node.kind]; - return fn === void 0 ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); + return fn === void 0 ? node : fn(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor); } var visitEachChildTable = { [ 167 /* QualifiedName */ - ]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateQualifiedName( + ]: function visitEachChildOfQualifiedName(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateQualifiedName( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isEntityName)), - Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier28)) ); }, [ 168 /* ComputedPropertyName */ - ]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateComputedPropertyName( + ]: function visitEachChildOfComputedPropertyName(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateComputedPropertyName( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -123587,11 +126862,11 @@ ${lanes.join("\n")} [ 169 /* TypeParameter */ - ]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeParameterDeclaration( + ]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), nodeVisitor(node.constraint, visitor, isTypeNode), nodeVisitor(node.default, visitor, isTypeNode) ); @@ -123599,8 +126874,8 @@ ${lanes.join("\n")} [ 170 /* Parameter */ - ]: function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateParameterDeclaration( + ]: function visitEachChildOfParameterDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, @@ -123613,8 +126888,8 @@ ${lanes.join("\n")} [ 171 /* Decorator */ - ]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateDecorator( + ]: function visitEachChildOfDecorator(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateDecorator( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -123623,8 +126898,8 @@ ${lanes.join("\n")} [ 172 /* PropertySignature */ - ]: function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updatePropertySignature( + ]: function visitEachChildOfPropertySignature(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updatePropertySignature( node, nodesVisitor(node.modifiers, visitor, isModifier), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), @@ -123635,8 +126910,8 @@ ${lanes.join("\n")} [ 173 /* PropertyDeclaration */ - ]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updatePropertyDeclaration( + ]: function visitEachChildOfPropertyDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updatePropertyDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), @@ -123649,8 +126924,8 @@ ${lanes.join("\n")} [ 174 /* MethodSignature */ - ]: function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateMethodSignature( + ]: function visitEachChildOfMethodSignature(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateMethodSignature( node, nodesVisitor(node.modifiers, visitor, isModifier), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), @@ -123663,71 +126938,71 @@ ${lanes.join("\n")} [ 175 /* MethodDeclaration */ - ]: function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateMethodDeclaration( + ]: function visitEachChildOfMethodDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateMethodDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), - visitParameterList(node.parameters, visitor, context, nodesVisitor), + visitParameterList(node.parameters, visitor, context2, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 177 /* Constructor */ - ]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateConstructorDeclaration( + ]: function visitEachChildOfConstructorDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateConstructorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - visitParameterList(node.parameters, visitor, context, nodesVisitor), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitParameterList(node.parameters, visitor, context2, nodesVisitor), + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 178 /* GetAccessor */ - ]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateGetAccessorDeclaration( + ]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateGetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), - visitParameterList(node.parameters, visitor, context, nodesVisitor), + visitParameterList(node.parameters, visitor, context2, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 179 /* SetAccessor */ - ]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateSetAccessorDeclaration( + ]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateSetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), - visitParameterList(node.parameters, visitor, context, nodesVisitor), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitParameterList(node.parameters, visitor, context2, nodesVisitor), + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 176 /* ClassStaticBlockDeclaration */ - ]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return context.factory.updateClassStaticBlockDeclaration( + ]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context2.startLexicalEnvironment(); + context2.suspendLexicalEnvironment(); + return context2.factory.updateClassStaticBlockDeclaration( node, - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 180 /* CallSignature */ - ]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateCallSignature( + ]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateCallSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, isParameter), @@ -123737,8 +127012,8 @@ ${lanes.join("\n")} [ 181 /* ConstructSignature */ - ]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateConstructSignature( + ]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateConstructSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, isParameter), @@ -123748,8 +127023,8 @@ ${lanes.join("\n")} [ 182 /* IndexSignature */ - ]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateIndexSignature( + ]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateIndexSignature( node, nodesVisitor(node.modifiers, visitor, isModifierLike), nodesVisitor(node.parameters, visitor, isParameter), @@ -123760,8 +127035,8 @@ ${lanes.join("\n")} [ 183 /* TypePredicate */ - ]: function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypePredicateNode( + ]: function visitEachChildOfTypePredicateNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypePredicateNode( node, nodeVisitor(node.assertsModifier, visitor, isAssertsKeyword), Debug.checkDefined(nodeVisitor(node.parameterName, visitor, isIdentifierOrThisTypeNode)), @@ -123771,8 +127046,8 @@ ${lanes.join("\n")} [ 184 /* TypeReference */ - ]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeReferenceNode( + ]: function visitEachChildOfTypeReferenceNode(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeReferenceNode( node, Debug.checkDefined(nodeVisitor(node.typeName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) @@ -123781,8 +127056,8 @@ ${lanes.join("\n")} [ 185 /* FunctionType */ - ]: function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateFunctionTypeNode( + ]: function visitEachChildOfFunctionTypeNode(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateFunctionTypeNode( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, isParameter), @@ -123792,8 +127067,8 @@ ${lanes.join("\n")} [ 186 /* ConstructorType */ - ]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateConstructorTypeNode( + ]: function visitEachChildOfConstructorTypeNode(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateConstructorTypeNode( node, nodesVisitor(node.modifiers, visitor, isModifier), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -123804,8 +127079,8 @@ ${lanes.join("\n")} [ 187 /* TypeQuery */ - ]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeQueryNode( + ]: function visitEachChildOfTypeQueryNode(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeQueryNode( node, Debug.checkDefined(nodeVisitor(node.exprName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) @@ -123814,8 +127089,8 @@ ${lanes.join("\n")} [ 188 /* TypeLiteral */ - ]: function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeLiteralNode( + ]: function visitEachChildOfTypeLiteralNode(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeLiteralNode( node, nodesVisitor(node.members, visitor, isTypeElement) ); @@ -123823,8 +127098,8 @@ ${lanes.join("\n")} [ 189 /* ArrayType */ - ]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateArrayTypeNode( + ]: function visitEachChildOfArrayTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateArrayTypeNode( node, Debug.checkDefined(nodeVisitor(node.elementType, visitor, isTypeNode)) ); @@ -123832,8 +127107,8 @@ ${lanes.join("\n")} [ 190 /* TupleType */ - ]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateTupleTypeNode( + ]: function visitEachChildOfTupleTypeNode(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateTupleTypeNode( node, nodesVisitor(node.elements, visitor, isTypeNode) ); @@ -123841,8 +127116,8 @@ ${lanes.join("\n")} [ 191 /* OptionalType */ - ]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateOptionalTypeNode( + ]: function visitEachChildOfOptionalTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateOptionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123850,8 +127125,8 @@ ${lanes.join("\n")} [ 192 /* RestType */ - ]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateRestTypeNode( + ]: function visitEachChildOfRestTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateRestTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123859,8 +127134,8 @@ ${lanes.join("\n")} [ 193 /* UnionType */ - ]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateUnionTypeNode( + ]: function visitEachChildOfUnionTypeNode(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateUnionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); @@ -123868,8 +127143,8 @@ ${lanes.join("\n")} [ 194 /* IntersectionType */ - ]: function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateIntersectionTypeNode( + ]: function visitEachChildOfIntersectionTypeNode(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateIntersectionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); @@ -123877,8 +127152,8 @@ ${lanes.join("\n")} [ 195 /* ConditionalType */ - ]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateConditionalTypeNode( + ]: function visitEachChildOfConditionalTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateConditionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.checkType, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.extendsType, visitor, isTypeNode)), @@ -123889,8 +127164,8 @@ ${lanes.join("\n")} [ 196 /* InferType */ - ]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateInferTypeNode( + ]: function visitEachChildOfInferTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateInferTypeNode( node, Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)) ); @@ -123898,8 +127173,8 @@ ${lanes.join("\n")} [ 206 /* ImportType */ - ]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportTypeNode( + ]: function visitEachChildOfImportTypeNode(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportTypeNode( node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), nodeVisitor(node.attributes, visitor, isImportAttributes), @@ -123911,8 +127186,8 @@ ${lanes.join("\n")} [ 303 /* ImportTypeAssertionContainer */ - ]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportTypeAssertionContainer( + ]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportTypeAssertionContainer( node, Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)), node.multiLine @@ -123921,11 +127196,11 @@ ${lanes.join("\n")} [ 203 /* NamedTupleMember */ - ]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateNamedTupleMember( + ]: function visitEachChildOfNamedTupleMember(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateNamedTupleMember( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123933,8 +127208,8 @@ ${lanes.join("\n")} [ 197 /* ParenthesizedType */ - ]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateParenthesizedType( + ]: function visitEachChildOfParenthesizedType(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateParenthesizedType( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123942,8 +127217,8 @@ ${lanes.join("\n")} [ 199 /* TypeOperator */ - ]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeOperatorNode( + ]: function visitEachChildOfTypeOperatorNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeOperatorNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123951,8 +127226,8 @@ ${lanes.join("\n")} [ 200 /* IndexedAccessType */ - ]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateIndexedAccessTypeNode( + ]: function visitEachChildOfIndexedAccessType(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateIndexedAccessTypeNode( node, Debug.checkDefined(nodeVisitor(node.objectType, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.indexType, visitor, isTypeNode)) @@ -123961,8 +127236,8 @@ ${lanes.join("\n")} [ 201 /* MappedType */ - ]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateMappedTypeNode( + ]: function visitEachChildOfMappedType(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateMappedTypeNode( node, tokenVisitor ? nodeVisitor(node.readonlyToken, tokenVisitor, isReadonlyKeywordOrPlusOrMinusToken) : node.readonlyToken, Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)), @@ -123975,8 +127250,8 @@ ${lanes.join("\n")} [ 202 /* LiteralType */ - ]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateLiteralTypeNode( + ]: function visitEachChildOfLiteralTypeNode(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateLiteralTypeNode( node, Debug.checkDefined(nodeVisitor(node.literal, visitor, isLiteralTypeLiteral)) ); @@ -123984,8 +127259,8 @@ ${lanes.join("\n")} [ 204 /* TemplateLiteralType */ - ]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTemplateLiteralType( + ]: function visitEachChildOfTemplateLiteralType(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTemplateLiteralType( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateLiteralTypeSpan) @@ -123994,8 +127269,8 @@ ${lanes.join("\n")} [ 205 /* TemplateLiteralTypeSpan */ - ]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTemplateLiteralTypeSpan( + ]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTemplateLiteralTypeSpan( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail)) @@ -124005,8 +127280,8 @@ ${lanes.join("\n")} [ 207 /* ObjectBindingPattern */ - ]: function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateObjectBindingPattern( + ]: function visitEachChildOfObjectBindingPattern(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateObjectBindingPattern( node, nodesVisitor(node.elements, visitor, isBindingElement) ); @@ -124014,8 +127289,8 @@ ${lanes.join("\n")} [ 208 /* ArrayBindingPattern */ - ]: function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateArrayBindingPattern( + ]: function visitEachChildOfArrayBindingPattern(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateArrayBindingPattern( node, nodesVisitor(node.elements, visitor, isArrayBindingElement) ); @@ -124023,8 +127298,8 @@ ${lanes.join("\n")} [ 209 /* BindingElement */ - ]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateBindingElement( + ]: function visitEachChildOfBindingElement(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateBindingElement( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, nodeVisitor(node.propertyName, visitor, isPropertyName), @@ -124036,8 +127311,8 @@ ${lanes.join("\n")} [ 210 /* ArrayLiteralExpression */ - ]: function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateArrayLiteralExpression( + ]: function visitEachChildOfArrayLiteralExpression(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateArrayLiteralExpression( node, nodesVisitor(node.elements, visitor, isExpression) ); @@ -124045,8 +127320,8 @@ ${lanes.join("\n")} [ 211 /* ObjectLiteralExpression */ - ]: function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateObjectLiteralExpression( + ]: function visitEachChildOfObjectLiteralExpression(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateObjectLiteralExpression( node, nodesVisitor(node.properties, visitor, isObjectLiteralElementLike) ); @@ -124054,13 +127329,13 @@ ${lanes.join("\n")} [ 212 /* PropertyAccessExpression */ - ]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return isPropertyAccessChain(node) ? context.factory.updatePropertyAccessChain( + ]: function visitEachChildOfPropertyAccessExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return isPropertyAccessChain(node) ? context2.factory.updatePropertyAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken, Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName)) - ) : context.factory.updatePropertyAccessExpression( + ) : context2.factory.updatePropertyAccessExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName)) @@ -124069,13 +127344,13 @@ ${lanes.join("\n")} [ 213 /* ElementAccessExpression */ - ]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return isElementAccessChain(node) ? context.factory.updateElementAccessChain( + ]: function visitEachChildOfElementAccessExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return isElementAccessChain(node) ? context2.factory.updateElementAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken, Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression)) - ) : context.factory.updateElementAccessExpression( + ) : context2.factory.updateElementAccessExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression)) @@ -124084,14 +127359,14 @@ ${lanes.join("\n")} [ 214 /* CallExpression */ - ]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return isCallChain(node) ? context.factory.updateCallChain( + ]: function visitEachChildOfCallExpression(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return isCallChain(node) ? context2.factory.updateCallChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken, nodesVisitor(node.typeArguments, visitor, isTypeNode), nodesVisitor(node.arguments, visitor, isExpression) - ) : context.factory.updateCallExpression( + ) : context2.factory.updateCallExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -124101,8 +127376,8 @@ ${lanes.join("\n")} [ 215 /* NewExpression */ - ]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateNewExpression( + ]: function visitEachChildOfNewExpression(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateNewExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -124112,8 +127387,8 @@ ${lanes.join("\n")} [ 216 /* TaggedTemplateExpression */ - ]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTaggedTemplateExpression( + ]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTaggedTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.tag, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -124123,8 +127398,8 @@ ${lanes.join("\n")} [ 217 /* TypeAssertionExpression */ - ]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeAssertion( + ]: function visitEachChildOfTypeAssertionExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeAssertion( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) @@ -124133,8 +127408,8 @@ ${lanes.join("\n")} [ 218 /* ParenthesizedExpression */ - ]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateParenthesizedExpression( + ]: function visitEachChildOfParenthesizedExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateParenthesizedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124142,37 +127417,37 @@ ${lanes.join("\n")} [ 219 /* FunctionExpression */ - ]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateFunctionExpression( + ]: function visitEachChildOfFunctionExpression(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateFunctionExpression( node, nodesVisitor(node.modifiers, visitor, isModifier), tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, - nodeVisitor(node.name, visitor, isIdentifier26), + nodeVisitor(node.name, visitor, isIdentifier28), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), - visitParameterList(node.parameters, visitor, context, nodesVisitor), + visitParameterList(node.parameters, visitor, context2, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 220 /* ArrowFunction */ - ]: function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateArrowFunction( + ]: function visitEachChildOfArrowFunction(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateArrowFunction( node, nodesVisitor(node.modifiers, visitor, isModifier), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), - visitParameterList(node.parameters, visitor, context, nodesVisitor), + visitParameterList(node.parameters, visitor, context2, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), tokenVisitor ? Debug.checkDefined(nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, isEqualsGreaterThanToken)) : node.equalsGreaterThanToken, - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 221 /* DeleteExpression */ - ]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateDeleteExpression( + ]: function visitEachChildOfDeleteExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateDeleteExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124180,8 +127455,8 @@ ${lanes.join("\n")} [ 222 /* TypeOfExpression */ - ]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeOfExpression( + ]: function visitEachChildOfTypeOfExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeOfExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124189,8 +127464,8 @@ ${lanes.join("\n")} [ 223 /* VoidExpression */ - ]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateVoidExpression( + ]: function visitEachChildOfVoidExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateVoidExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124198,8 +127473,8 @@ ${lanes.join("\n")} [ 224 /* AwaitExpression */ - ]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateAwaitExpression( + ]: function visitEachChildOfAwaitExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateAwaitExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124207,8 +127482,8 @@ ${lanes.join("\n")} [ 225 /* PrefixUnaryExpression */ - ]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updatePrefixUnaryExpression( + ]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updatePrefixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); @@ -124216,8 +127491,8 @@ ${lanes.join("\n")} [ 226 /* PostfixUnaryExpression */ - ]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updatePostfixUnaryExpression( + ]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updatePostfixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); @@ -124225,8 +127500,8 @@ ${lanes.join("\n")} [ 227 /* BinaryExpression */ - ]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateBinaryExpression( + ]: function visitEachChildOfBinaryExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateBinaryExpression( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isExpression)), tokenVisitor ? Debug.checkDefined(nodeVisitor(node.operatorToken, tokenVisitor, isBinaryOperatorToken)) : node.operatorToken, @@ -124236,8 +127511,8 @@ ${lanes.join("\n")} [ 228 /* ConditionalExpression */ - ]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateConditionalExpression( + ]: function visitEachChildOfConditionalExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateConditionalExpression( node, Debug.checkDefined(nodeVisitor(node.condition, visitor, isExpression)), tokenVisitor ? Debug.checkDefined(nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken)) : node.questionToken, @@ -124249,8 +127524,8 @@ ${lanes.join("\n")} [ 229 /* TemplateExpression */ - ]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTemplateExpression( + ]: function visitEachChildOfTemplateExpression(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateSpan) @@ -124259,8 +127534,8 @@ ${lanes.join("\n")} [ 230 /* YieldExpression */ - ]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateYieldExpression( + ]: function visitEachChildOfYieldExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateYieldExpression( node, tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, nodeVisitor(node.expression, visitor, isExpression) @@ -124269,8 +127544,8 @@ ${lanes.join("\n")} [ 231 /* SpreadElement */ - ]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateSpreadElement( + ]: function visitEachChildOfSpreadElement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateSpreadElement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124278,11 +127553,11 @@ ${lanes.join("\n")} [ 232 /* ClassExpression */ - ]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateClassExpression( + ]: function visitEachChildOfClassExpression(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateClassExpression( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - nodeVisitor(node.name, visitor, isIdentifier26), + nodeVisitor(node.name, visitor, isIdentifier28), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isClassElement) @@ -124291,8 +127566,8 @@ ${lanes.join("\n")} [ 234 /* ExpressionWithTypeArguments */ - ]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExpressionWithTypeArguments( + ]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExpressionWithTypeArguments( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode) @@ -124301,8 +127576,8 @@ ${lanes.join("\n")} [ 235 /* AsExpression */ - ]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateAsExpression( + ]: function visitEachChildOfAsExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateAsExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) @@ -124311,8 +127586,8 @@ ${lanes.join("\n")} [ 239 /* SatisfiesExpression */ - ]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateSatisfiesExpression( + ]: function visitEachChildOfSatisfiesExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateSatisfiesExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) @@ -124321,11 +127596,11 @@ ${lanes.join("\n")} [ 236 /* NonNullExpression */ - ]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return isOptionalChain2(node) ? context.factory.updateNonNullChain( + ]: function visitEachChildOfNonNullExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return isOptionalChain2(node) ? context2.factory.updateNonNullChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) - ) : context.factory.updateNonNullExpression( + ) : context2.factory.updateNonNullExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124333,18 +127608,18 @@ ${lanes.join("\n")} [ 237 /* MetaProperty */ - ]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateMetaProperty( + ]: function visitEachChildOfMetaProperty(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateMetaProperty( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, // Misc [ 240 /* TemplateSpan */ - ]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTemplateSpan( + ]: function visitEachChildOfTemplateSpan(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTemplateSpan( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail)) @@ -124354,8 +127629,8 @@ ${lanes.join("\n")} [ 242 /* Block */ - ]: function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateBlock( + ]: function visitEachChildOfBlock(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); @@ -124363,8 +127638,8 @@ ${lanes.join("\n")} [ 244 /* VariableStatement */ - ]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateVariableStatement( + ]: function visitEachChildOfVariableStatement(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateVariableStatement( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.declarationList, visitor, isVariableDeclarationList)) @@ -124373,8 +127648,8 @@ ${lanes.join("\n")} [ 245 /* ExpressionStatement */ - ]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExpressionStatement( + ]: function visitEachChildOfExpressionStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExpressionStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124382,92 +127657,92 @@ ${lanes.join("\n")} [ 246 /* IfStatement */ - ]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateIfStatement( + ]: function visitEachChildOfIfStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateIfStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), - Debug.checkDefined(nodeVisitor(node.thenStatement, visitor, isStatement, context.factory.liftToBlock)), - nodeVisitor(node.elseStatement, visitor, isStatement, context.factory.liftToBlock) + Debug.checkDefined(nodeVisitor(node.thenStatement, visitor, isStatement, context2.factory.liftToBlock)), + nodeVisitor(node.elseStatement, visitor, isStatement, context2.factory.liftToBlock) ); }, [ 247 /* DoStatement */ - ]: function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateDoStatement( + ]: function visitEachChildOfDoStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateDoStatement( node, - visitIterationBody(node.statement, visitor, context, nodeVisitor), + visitIterationBody(node.statement, visitor, context2, nodeVisitor), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, [ 248 /* WhileStatement */ - ]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateWhileStatement( + ]: function visitEachChildOfWhileStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateWhileStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), - visitIterationBody(node.statement, visitor, context, nodeVisitor) + visitIterationBody(node.statement, visitor, context2, nodeVisitor) ); }, [ 249 /* ForStatement */ - ]: function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateForStatement( + ]: function visitEachChildOfForStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateForStatement( node, nodeVisitor(node.initializer, visitor, isForInitializer), nodeVisitor(node.condition, visitor, isExpression), nodeVisitor(node.incrementor, visitor, isExpression), - visitIterationBody(node.statement, visitor, context, nodeVisitor) + visitIterationBody(node.statement, visitor, context2, nodeVisitor) ); }, [ 250 /* ForInStatement */ - ]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateForInStatement( + ]: function visitEachChildOfForInStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateForInStatement( node, Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), - visitIterationBody(node.statement, visitor, context, nodeVisitor) + visitIterationBody(node.statement, visitor, context2, nodeVisitor) ); }, [ 251 /* ForOfStatement */ - ]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateForOfStatement( + ]: function visitEachChildOfForOfStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateForOfStatement( node, tokenVisitor ? nodeVisitor(node.awaitModifier, tokenVisitor, isAwaitKeyword) : node.awaitModifier, Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), - visitIterationBody(node.statement, visitor, context, nodeVisitor) + visitIterationBody(node.statement, visitor, context2, nodeVisitor) ); }, [ 252 /* ContinueStatement */ - ]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateContinueStatement( + ]: function visitEachChildOfContinueStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateContinueStatement( node, - nodeVisitor(node.label, visitor, isIdentifier26) + nodeVisitor(node.label, visitor, isIdentifier28) ); }, [ 253 /* BreakStatement */ - ]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateBreakStatement( + ]: function visitEachChildOfBreakStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateBreakStatement( node, - nodeVisitor(node.label, visitor, isIdentifier26) + nodeVisitor(node.label, visitor, isIdentifier28) ); }, [ 254 /* ReturnStatement */ - ]: function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateReturnStatement( + ]: function visitEachChildOfReturnStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateReturnStatement( node, nodeVisitor(node.expression, visitor, isExpression) ); @@ -124475,18 +127750,18 @@ ${lanes.join("\n")} [ 255 /* WithStatement */ - ]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateWithStatement( + ]: function visitEachChildOfWithStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateWithStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), - Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) + Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context2.factory.liftToBlock)) ); }, [ 256 /* SwitchStatement */ - ]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateSwitchStatement( + ]: function visitEachChildOfSwitchStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateSwitchStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.caseBlock, visitor, isCaseBlock)) @@ -124495,18 +127770,18 @@ ${lanes.join("\n")} [ 257 /* LabeledStatement */ - ]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateLabeledStatement( + ]: function visitEachChildOfLabeledStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateLabeledStatement( node, - Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier26)), - Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) + Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier28)), + Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context2.factory.liftToBlock)) ); }, [ 258 /* ThrowStatement */ - ]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateThrowStatement( + ]: function visitEachChildOfThrowStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateThrowStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124514,8 +127789,8 @@ ${lanes.join("\n")} [ 259 /* TryStatement */ - ]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTryStatement( + ]: function visitEachChildOfTryStatement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTryStatement( node, Debug.checkDefined(nodeVisitor(node.tryBlock, visitor, isBlock6)), nodeVisitor(node.catchClause, visitor, isCatchClause), @@ -124525,8 +127800,8 @@ ${lanes.join("\n")} [ 261 /* VariableDeclaration */ - ]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateVariableDeclaration( + ]: function visitEachChildOfVariableDeclaration(node, visitor, context2, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateVariableDeclaration( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)), tokenVisitor ? nodeVisitor(node.exclamationToken, tokenVisitor, isExclamationToken) : node.exclamationToken, @@ -124537,8 +127812,8 @@ ${lanes.join("\n")} [ 262 /* VariableDeclarationList */ - ]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateVariableDeclarationList( + ]: function visitEachChildOfVariableDeclarationList(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateVariableDeclarationList( node, nodesVisitor(node.declarations, visitor, isVariableDeclaration7) ); @@ -124546,26 +127821,26 @@ ${lanes.join("\n")} [ 263 /* FunctionDeclaration */ - ]: function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - return context.factory.updateFunctionDeclaration( + ]: function visitEachChildOfFunctionDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, tokenVisitor) { + return context2.factory.updateFunctionDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, - nodeVisitor(node.name, visitor, isIdentifier26), + nodeVisitor(node.name, visitor, isIdentifier28), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), - visitParameterList(node.parameters, visitor, context, nodesVisitor), + visitParameterList(node.parameters, visitor, context2, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), - visitFunctionBody(node.body, visitor, context, nodeVisitor) + visitFunctionBody(node.body, visitor, context2, nodeVisitor) ); }, [ 264 /* ClassDeclaration */ - ]: function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateClassDeclaration( + ]: function visitEachChildOfClassDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateClassDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - nodeVisitor(node.name, visitor, isIdentifier26), + nodeVisitor(node.name, visitor, isIdentifier28), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isClassElement) @@ -124574,11 +127849,11 @@ ${lanes.join("\n")} [ 265 /* InterfaceDeclaration */ - ]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateInterfaceDeclaration( + ]: function visitEachChildOfInterfaceDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateInterfaceDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isTypeElement) @@ -124587,11 +127862,11 @@ ${lanes.join("\n")} [ 266 /* TypeAliasDeclaration */ - ]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateTypeAliasDeclaration( + ]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateTypeAliasDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -124599,19 +127874,19 @@ ${lanes.join("\n")} [ 267 /* EnumDeclaration */ - ]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateEnumDeclaration( + ]: function visitEachChildOfEnumDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateEnumDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), nodesVisitor(node.members, visitor, isEnumMember) ); }, [ 268 /* ModuleDeclaration */ - ]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateModuleDeclaration( + ]: function visitEachChildOfModuleDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateModuleDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleName)), @@ -124621,8 +127896,8 @@ ${lanes.join("\n")} [ 269 /* ModuleBlock */ - ]: function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateModuleBlock( + ]: function visitEachChildOfModuleBlock(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateModuleBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); @@ -124630,8 +127905,8 @@ ${lanes.join("\n")} [ 270 /* CaseBlock */ - ]: function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateCaseBlock( + ]: function visitEachChildOfCaseBlock(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateCaseBlock( node, nodesVisitor(node.clauses, visitor, isCaseOrDefaultClause) ); @@ -124639,29 +127914,29 @@ ${lanes.join("\n")} [ 271 /* NamespaceExportDeclaration */ - ]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateNamespaceExportDeclaration( + ]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateNamespaceExportDeclaration( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, [ 272 /* ImportEqualsDeclaration */ - ]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportEqualsDeclaration( + ]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportEqualsDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), node.isTypeOnly, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference)) ); }, [ 273 /* ImportDeclaration */ - ]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportDeclaration( + ]: function visitEachChildOfImportDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.importClause, visitor, isImportClause), @@ -124672,8 +127947,8 @@ ${lanes.join("\n")} [ 301 /* ImportAttributes */ - ]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateImportAttributes( + ]: function visitEachChildOfImportAttributes(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportAttributes( node, nodesVisitor(node.elements, visitor, isImportAttribute), node.multiLine @@ -124682,8 +127957,8 @@ ${lanes.join("\n")} [ 302 /* ImportAttribute */ - ]: function visitEachChildOfImportAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportAttribute( + ]: function visitEachChildOfImportAttribute(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportAttribute( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isImportAttributeName)), Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression)) @@ -124692,37 +127967,37 @@ ${lanes.join("\n")} [ 274 /* ImportClause */ - ]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportClause( + ]: function visitEachChildOfImportClause(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportClause( node, node.phaseModifier, - nodeVisitor(node.name, visitor, isIdentifier26), + nodeVisitor(node.name, visitor, isIdentifier28), nodeVisitor(node.namedBindings, visitor, isNamedImportBindings) ); }, [ 275 /* NamespaceImport */ - ]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateNamespaceImport( + ]: function visitEachChildOfNamespaceImport(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateNamespaceImport( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, [ 281 /* NamespaceExport */ - ]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateNamespaceExport( + ]: function visitEachChildOfNamespaceExport(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateNamespaceExport( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, [ 276 /* NamedImports */ - ]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateNamedImports( + ]: function visitEachChildOfNamedImports(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateNamedImports( node, nodesVisitor(node.elements, visitor, isImportSpecifier) ); @@ -124730,19 +128005,19 @@ ${lanes.join("\n")} [ 277 /* ImportSpecifier */ - ]: function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportSpecifier( + ]: function visitEachChildOfImportSpecifier(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateImportSpecifier( node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, isModuleExportName), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, [ 278 /* ExportAssignment */ - ]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExportAssignment( + ]: function visitEachChildOfExportAssignment(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExportAssignment( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) @@ -124751,8 +128026,8 @@ ${lanes.join("\n")} [ 279 /* ExportDeclaration */ - ]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExportDeclaration( + ]: function visitEachChildOfExportDeclaration(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), node.isTypeOnly, @@ -124764,8 +128039,8 @@ ${lanes.join("\n")} [ 280 /* NamedExports */ - ]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateNamedExports( + ]: function visitEachChildOfNamedExports(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateNamedExports( node, nodesVisitor(node.elements, visitor, isExportSpecifier) ); @@ -124773,8 +128048,8 @@ ${lanes.join("\n")} [ 282 /* ExportSpecifier */ - ]: function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExportSpecifier( + ]: function visitEachChildOfExportSpecifier(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExportSpecifier( node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, isModuleExportName), @@ -124785,8 +128060,8 @@ ${lanes.join("\n")} [ 284 /* ExternalModuleReference */ - ]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateExternalModuleReference( + ]: function visitEachChildOfExternalModuleReference(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateExternalModuleReference( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124795,8 +128070,8 @@ ${lanes.join("\n")} [ 285 /* JsxElement */ - ]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxElement( + ]: function visitEachChildOfJsxElement(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxElement( node, Debug.checkDefined(nodeVisitor(node.openingElement, visitor, isJsxOpeningElement)), nodesVisitor(node.children, visitor, isJsxChild), @@ -124806,8 +128081,8 @@ ${lanes.join("\n")} [ 286 /* JsxSelfClosingElement */ - ]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxSelfClosingElement( + ]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxSelfClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -124817,8 +128092,8 @@ ${lanes.join("\n")} [ 287 /* JsxOpeningElement */ - ]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxOpeningElement( + ]: function visitEachChildOfJsxOpeningElement(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxOpeningElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -124828,8 +128103,8 @@ ${lanes.join("\n")} [ 288 /* JsxClosingElement */ - ]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxClosingElement( + ]: function visitEachChildOfJsxClosingElement(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)) ); @@ -124837,18 +128112,18 @@ ${lanes.join("\n")} [ 296 /* JsxNamespacedName */ - ]: function forEachChildInJsxNamespacedName2(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxNamespacedName( + ]: function forEachChildInJsxNamespacedName2(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxNamespacedName( node, - Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier26)), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) + Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier28)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)) ); }, [ 289 /* JsxFragment */ - ]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxFragment( + ]: function visitEachChildOfJsxFragment(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxFragment( node, Debug.checkDefined(nodeVisitor(node.openingFragment, visitor, isJsxOpeningFragment)), nodesVisitor(node.children, visitor, isJsxChild), @@ -124858,8 +128133,8 @@ ${lanes.join("\n")} [ 292 /* JsxAttribute */ - ]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxAttribute( + ]: function visitEachChildOfJsxAttribute(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxAttribute( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isJsxAttributeName)), nodeVisitor(node.initializer, visitor, isStringLiteralOrJsxExpression) @@ -124868,8 +128143,8 @@ ${lanes.join("\n")} [ 293 /* JsxAttributes */ - ]: function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxAttributes( + ]: function visitEachChildOfJsxAttributes(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxAttributes( node, nodesVisitor(node.properties, visitor, isJsxAttributeLike) ); @@ -124877,8 +128152,8 @@ ${lanes.join("\n")} [ 294 /* JsxSpreadAttribute */ - ]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxSpreadAttribute( + ]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxSpreadAttribute( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124886,8 +128161,8 @@ ${lanes.join("\n")} [ 295 /* JsxExpression */ - ]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateJsxExpression( + ]: function visitEachChildOfJsxExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateJsxExpression( node, nodeVisitor(node.expression, visitor, isExpression) ); @@ -124896,8 +128171,8 @@ ${lanes.join("\n")} [ 297 /* CaseClause */ - ]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateCaseClause( + ]: function visitEachChildOfCaseClause(node, visitor, context2, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateCaseClause( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.statements, visitor, isStatement) @@ -124906,8 +128181,8 @@ ${lanes.join("\n")} [ 298 /* DefaultClause */ - ]: function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateDefaultClause( + ]: function visitEachChildOfDefaultClause(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateDefaultClause( node, nodesVisitor(node.statements, visitor, isStatement) ); @@ -124915,8 +128190,8 @@ ${lanes.join("\n")} [ 299 /* HeritageClause */ - ]: function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateHeritageClause( + ]: function visitEachChildOfHeritageClause(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateHeritageClause( node, nodesVisitor(node.types, visitor, isExpressionWithTypeArguments) ); @@ -124924,8 +128199,8 @@ ${lanes.join("\n")} [ 300 /* CatchClause */ - ]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateCatchClause( + ]: function visitEachChildOfCatchClause(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateCatchClause( node, nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration7), Debug.checkDefined(nodeVisitor(node.block, visitor, isBlock6)) @@ -124935,8 +128210,8 @@ ${lanes.join("\n")} [ 304 /* PropertyAssignment */ - ]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updatePropertyAssignment( + ]: function visitEachChildOfPropertyAssignment(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updatePropertyAssignment( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), Debug.checkDefined(nodeVisitor(node.initializer, visitor, isExpression)) @@ -124945,18 +128220,18 @@ ${lanes.join("\n")} [ 305 /* ShorthandPropertyAssignment */ - ]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateShorthandPropertyAssignment( + ]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateShorthandPropertyAssignment( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier28)), nodeVisitor(node.objectAssignmentInitializer, visitor, isExpression) ); }, [ 306 /* SpreadAssignment */ - ]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateSpreadAssignment( + ]: function visitEachChildOfSpreadAssignment(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateSpreadAssignment( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124965,8 +128240,8 @@ ${lanes.join("\n")} [ 307 /* EnumMember */ - ]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateEnumMember( + ]: function visitEachChildOfEnumMember(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updateEnumMember( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), nodeVisitor(node.initializer, visitor, isExpression) @@ -124976,18 +128251,18 @@ ${lanes.join("\n")} [ 308 /* SourceFile */ - ]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateSourceFile( + ]: function visitEachChildOfSourceFile(node, visitor, context2, _nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateSourceFile( node, - visitLexicalEnvironment(node.statements, visitor, context) + visitLexicalEnvironment(node.statements, visitor, context2) ); }, // Transformation nodes [ 356 /* PartiallyEmittedExpression */ - ]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updatePartiallyEmittedExpression( + ]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context2, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context2.factory.updatePartiallyEmittedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); @@ -124995,8 +128270,8 @@ ${lanes.join("\n")} [ 357 /* CommaListExpression */ - ]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateCommaListExpression( + ]: function visitEachChildOfCommaListExpression(node, visitor, context2, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context2.factory.updateCommaListExpression( node, nodesVisitor(node.elements, visitor, isExpression) ); @@ -125558,19 +128833,19 @@ ${lanes.join("\n")} } function containsDefaultReference(node) { if (!node) return false; - if (!isNamedImports5(node) && !isNamedExports2(node)) return false; + if (!isNamedImports6(node) && !isNamedExports2(node)) return false; return some(node.elements, isNamedDefaultReference); } function isNamedDefaultReference(e) { return moduleExportNameIsDefault(e.propertyName || e.name); } - function chainBundle(context, transformSourceFile) { + function chainBundle(context2, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { - return context.factory.createBundle(map2(node.sourceFiles, transformSourceFile)); + return context2.factory.createBundle(map2(node.sourceFiles, transformSourceFile)); } } function getExportNeedsImportStarHelper(node) { @@ -125584,7 +128859,7 @@ ${lanes.join("\n")} if (!bindings) { return false; } - if (!isNamedImports5(bindings)) return false; + if (!isNamedImports6(bindings)) return false; let defaultRefCount = 0; for (const binding of bindings.elements) { if (isNamedDefaultReference(binding)) { @@ -125594,11 +128869,11 @@ ${lanes.join("\n")} return defaultRefCount > 0 && defaultRefCount !== bindings.elements.length || !!(bindings.elements.length - defaultRefCount) && isDefaultImport(node); } function getImportNeedsImportDefaultHelper(node) { - return !getImportNeedsImportStarHelper(node) && (isDefaultImport(node) || !!node.importClause && isNamedImports5(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)); + return !getImportNeedsImportStarHelper(node) && (isDefaultImport(node) || !!node.importClause && isNamedImports6(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)); } - function collectExternalModuleInfo(context, sourceFile) { - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + function collectExternalModuleInfo(context2, sourceFile) { + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const externalImports = []; const exportSpecifiers = new IdentifierNameMultiMap(); const exportedBindings = []; @@ -125697,7 +128972,7 @@ ${lanes.join("\n")} /* Default */ )) { if (!hasExportDefault) { - multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context2.factory.getDeclarationName(node)); hasExportDefault = true; } } else { @@ -125712,7 +128987,7 @@ ${lanes.join("\n")} break; } } - const externalHelpersImportDeclaration = createExternalHelpersImportDeclarationIfNeeded(context.factory, context.getEmitHelperFactory(), sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault); + const externalHelpersImportDeclaration = createExternalHelpersImportDeclarationIfNeeded(context2.factory, context2.getEmitHelperFactory(), sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault); if (externalHelpersImportDeclaration) { externalImports.unshift(externalHelpersImportDeclaration); } @@ -125744,7 +129019,7 @@ ${lanes.join("\n")} exportedFunctions.add(getOriginalNode(node, isFunctionDeclaration5)); if (isDefault) { if (!hasExportDefault) { - multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context2.factory.getDeclarationName(node)); hasExportDefault = true; } } else { @@ -125865,10 +129140,10 @@ ${lanes.join("\n")} } }; function isSimpleCopiableExpression(expression) { - return isStringLiteralLike4(expression) || expression.kind === 9 || isKeyword(expression.kind) || isIdentifier26(expression); + return isStringLiteralLike4(expression) || expression.kind === 9 || isKeyword(expression.kind) || isIdentifier28(expression); } function isSimpleInlineableExpression(expression) { - return !isIdentifier26(expression) && isSimpleCopiableExpression(expression); + return !isIdentifier28(expression) && isSimpleCopiableExpression(expression); } function isCompoundAssignment(kind) { return kind >= 65 && kind <= 79; @@ -126074,7 +129349,7 @@ ${lanes.join("\n")} return walkUpLexicalEnvironments(env2, (env22) => getPrivateIdentifier(env22.privateEnv, name)); } function isSimpleParameter(node) { - return !node.initializer && isIdentifier26(node.name); + return !node.initializer && isIdentifier28(node.name); } function isSimpleParameterList(nodes) { return every(nodes, isSimpleParameter); @@ -126091,7 +129366,7 @@ ${lanes.join("\n")} FlattenLevel2[FlattenLevel2["ObjectRest"] = 1] = "ObjectRest"; return FlattenLevel2; })(FlattenLevel || {}); - function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { + function flattenDestructuringAssignment(node, visitor, context2, level, needsValue, createAssignmentCallback) { let location = node; let value; if (isDestructuringAssignment(node)) { @@ -126107,21 +129382,21 @@ ${lanes.join("\n")} } let expressions; const flattenContext = { - context, + context: context2, level, - downlevelIteration: !!context.getCompilerOptions().downlevelIteration, + downlevelIteration: !!context2.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression, emitBindingOrAssignment, - createArrayBindingOrAssignmentPattern: (elements) => makeArrayAssignmentPattern(context.factory, elements), - createObjectBindingOrAssignmentPattern: (elements) => makeObjectAssignmentPattern(context.factory, elements), + createArrayBindingOrAssignmentPattern: (elements) => makeArrayAssignmentPattern(context2.factory, elements), + createObjectBindingOrAssignmentPattern: (elements) => makeObjectAssignmentPattern(context2.factory, elements), createArrayBindingOrAssignmentElement: makeAssignmentElement, visitor }; if (value) { value = visitNode(value, visitor, isExpression); Debug.assert(value); - if (isIdentifier26(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) { + if (isIdentifier28(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) { value = ensureIdentifier( flattenContext, value, @@ -126155,14 +129430,14 @@ ${lanes.join("\n")} } expressions.push(value); } - return context.factory.inlineExpressions(expressions) || context.factory.createOmittedExpression(); + return context2.factory.inlineExpressions(expressions) || context2.factory.createOmittedExpression(); function emitExpression(expression) { expressions = append(expressions, expression); } function emitBindingOrAssignment(target, value2, location2, original) { - Debug.assertNode(target, createAssignmentCallback ? isIdentifier26 : isExpression); + Debug.assertNode(target, createAssignmentCallback ? isIdentifier28 : isExpression); const expression = createAssignmentCallback ? createAssignmentCallback(target, value2, location2) : setTextRange( - context.factory.createAssignment(Debug.checkDefined(visitNode(target, visitor, isExpression)), value2), + context2.factory.createAssignment(Debug.checkDefined(visitNode(target, visitor, isExpression)), value2), location2 ); expression.original = original; @@ -126173,13 +129448,13 @@ ${lanes.join("\n")} const target = getTargetOfBindingOrAssignmentElement(element); if (isBindingOrAssignmentPattern(target)) { return bindingOrAssignmentPatternAssignsToName(target, escapedName); - } else if (isIdentifier26(target)) { + } else if (isIdentifier28(target)) { return target.escapedText === escapedName; } return false; } - function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) { - const elements = getElementsOfBindingOrAssignmentPattern(pattern); + function bindingOrAssignmentPatternAssignsToName(pattern2, escapedName) { + const elements = getElementsOfBindingOrAssignmentPattern(pattern2); for (const element of elements) { if (bindingOrAssignmentElementAssignsToName(element, escapedName)) { return true; @@ -126195,28 +129470,28 @@ ${lanes.join("\n")} const target = getTargetOfBindingOrAssignmentElement(element); return !!target && isBindingOrAssignmentPattern(target) && bindingOrAssignmentPatternContainsNonLiteralComputedName(target); } - function bindingOrAssignmentPatternContainsNonLiteralComputedName(pattern) { - return !!forEach(getElementsOfBindingOrAssignmentPattern(pattern), bindingOrAssignmentElementContainsNonLiteralComputedName); + function bindingOrAssignmentPatternContainsNonLiteralComputedName(pattern2) { + return !!forEach(getElementsOfBindingOrAssignmentPattern(pattern2), bindingOrAssignmentElementContainsNonLiteralComputedName); } - function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables = false, skipInitializer) { + function flattenDestructuringBinding(node, visitor, context2, level, rval, hoistTempVariables = false, skipInitializer) { let pendingExpressions; const pendingDeclarations = []; const declarations = []; const flattenContext = { - context, + context: context2, level, - downlevelIteration: !!context.getCompilerOptions().downlevelIteration, + downlevelIteration: !!context2.getCompilerOptions().downlevelIteration, hoistTempVariables, emitExpression, emitBindingOrAssignment, - createArrayBindingOrAssignmentPattern: (elements) => makeArrayBindingPattern(context.factory, elements), - createObjectBindingOrAssignmentPattern: (elements) => makeObjectBindingPattern(context.factory, elements), - createArrayBindingOrAssignmentElement: (name) => makeBindingElement(context.factory, name), + createArrayBindingOrAssignmentPattern: (elements) => makeArrayBindingPattern(context2.factory, elements), + createObjectBindingOrAssignmentPattern: (elements) => makeObjectBindingPattern(context2.factory, elements), + createArrayBindingOrAssignmentElement: (name) => makeBindingElement(context2.factory, name), visitor }; if (isVariableDeclaration7(node)) { let initializer3 = getInitializerOfBindingOrAssignmentElement(node); - if (initializer3 && (isIdentifier26(initializer3) && bindingOrAssignmentElementAssignsToName(node, initializer3.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) { + if (initializer3 && (isIdentifier28(initializer3) && bindingOrAssignmentElementAssignsToName(node, initializer3.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) { initializer3 = ensureIdentifier( flattenContext, Debug.checkDefined(visitNode(initializer3, flattenContext.visitor, isExpression)), @@ -126224,7 +129499,7 @@ ${lanes.join("\n")} false, initializer3 ); - node = context.factory.updateVariableDeclaration( + node = context2.factory.updateVariableDeclaration( node, node.name, /*exclamationToken*/ @@ -126237,12 +129512,12 @@ ${lanes.join("\n")} } flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); if (pendingExpressions) { - const temp = context.factory.createTempVariable( + const temp = context2.factory.createTempVariable( /*recordTempVariable*/ void 0 ); if (hoistTempVariables) { - const value = context.factory.inlineExpressions(pendingExpressions); + const value = context2.factory.inlineExpressions(pendingExpressions); pendingExpressions = void 0; emitBindingOrAssignment( temp, @@ -126253,24 +129528,24 @@ ${lanes.join("\n")} void 0 ); } else { - context.hoistVariableDeclaration(temp); + context2.hoistVariableDeclaration(temp); const pendingDeclaration = last(pendingDeclarations); pendingDeclaration.pendingExpressions = append( pendingDeclaration.pendingExpressions, - context.factory.createAssignment(temp, pendingDeclaration.value) + context2.factory.createAssignment(temp, pendingDeclaration.value) ); addRange(pendingDeclaration.pendingExpressions, pendingExpressions); pendingDeclaration.value = temp; } } for (const { pendingExpressions: pendingExpressions2, name, value, location, original } of pendingDeclarations) { - const variable = context.factory.createVariableDeclaration( + const variable = context2.factory.createVariableDeclaration( name, /*exclamationToken*/ void 0, /*type*/ void 0, - pendingExpressions2 ? context.factory.inlineExpressions(append(pendingExpressions2, value)) : value + pendingExpressions2 ? context2.factory.inlineExpressions(append(pendingExpressions2, value)) : value ); variable.original = original; setTextRange(variable, location); @@ -126283,7 +129558,7 @@ ${lanes.join("\n")} function emitBindingOrAssignment(target, value, location, original) { Debug.assertNode(target, isBindingName); if (pendingExpressions) { - value = context.factory.inlineExpressions(append(pendingExpressions, value)); + value = context2.factory.inlineExpressions(append(pendingExpressions, value)); pendingExpressions = void 0; } pendingDeclarations.push({ pendingExpressions, name: target, value, location, original }); @@ -126326,8 +129601,8 @@ ${lanes.join("\n")} ); } } - function flattenObjectBindingOrAssignmentPattern(flattenContext, parent2, pattern, value, location) { - const elements = getElementsOfBindingOrAssignmentPattern(pattern); + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent2, pattern2, value, location) { + const elements = getElementsOfBindingOrAssignmentPattern(pattern2); const numElements = elements.length; if (numElements !== 1) { const reuseIdentifierExpressions = !isDeclarationBindingElement(parent2) || numElements !== 0; @@ -126343,7 +129618,7 @@ ${lanes.join("\n")} bindingElements = append(bindingElements, visitNode(element, flattenContext.visitor, isBindingOrAssignmentElement)); } else { if (bindingElements) { - flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern2); bindingElements = void 0; } const rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); @@ -126360,19 +129635,19 @@ ${lanes.join("\n")} } } else if (i === numElements - 1) { if (bindingElements) { - flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern2); bindingElements = void 0; } - const rhsValue = flattenContext.context.getEmitHelperFactory().createRestHelper(value, elements, computedTempVariables, pattern); + const rhsValue = flattenContext.context.getEmitHelperFactory().createRestHelper(value, elements, computedTempVariables, pattern2); flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } if (bindingElements) { - flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern2); } } - function flattenArrayBindingOrAssignmentPattern(flattenContext, parent2, pattern, value, location) { - const elements = getElementsOfBindingOrAssignmentPattern(pattern); + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent2, pattern2, value, location) { + const elements = getElementsOfBindingOrAssignmentPattern(pattern2); const numElements = elements.length; if (flattenContext.level < 1 && flattenContext.downlevelIteration) { value = ensureIdentifier( @@ -126434,7 +129709,7 @@ ${lanes.join("\n")} } } if (bindingElements) { - flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern2); } if (restContainingElements) { for (const [id, element] of restContainingElements) { @@ -126450,7 +129725,7 @@ ${lanes.join("\n")} const initializer3 = getInitializerOfBindingOrAssignmentElement(element); if (initializer3 && !isSimpleInlineableExpression(initializer3)) return false; if (isBindingOrAssignmentPattern(target)) return every(getElementsOfBindingOrAssignmentPattern(target), isSimpleBindingOrAssignmentElement); - return isIdentifier26(target); + return isIdentifier28(target); } function createDefaultValueCheck(flattenContext, value, defaultValue, location) { value = ensureIdentifier( @@ -126491,7 +129766,7 @@ ${lanes.join("\n")} } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { - if (isIdentifier26(value) && reuseIdentifierExpressions) { + if (isIdentifier28(value) && reuseIdentifierExpressions) { return value; } else { const temp = flattenContext.context.factory.createTempVariable( @@ -126563,7 +129838,7 @@ ${lanes.join("\n")} statement.expression, /*excludeCompoundAssignment*/ true - ) && isIdentifier26(statement.expression.left) && ((_a3 = node.emitNode) == null ? void 0 : _a3.classThis) === statement.expression.left && statement.expression.right.kind === 110; + ) && isIdentifier28(statement.expression.left) && ((_a3 = node.emitNode) == null ? void 0 : _a3.classThis) === statement.expression.left && statement.expression.right.kind === 110; } function classHasClassThisAssignment(node) { var _a3; @@ -126608,8 +129883,8 @@ ${lanes.join("\n")} } return factory2.createStringLiteralFromNode(name); } - function getAssignedNameOfPropertyName(context, name, assignedNameText) { - const { factory: factory2 } = context; + function getAssignedNameOfPropertyName(context2, name, assignedNameText) { + const { factory: factory2 } = context2; if (assignedNameText !== void 0) { const assignedName2 = factory2.createStringLiteral(assignedNameText); return { assignedName: assignedName2, name }; @@ -126618,20 +129893,20 @@ ${lanes.join("\n")} const assignedName2 = factory2.createStringLiteralFromNode(name); return { assignedName: assignedName2, name }; } - if (isPropertyNameLiteral(name.expression) && !isIdentifier26(name.expression)) { + if (isPropertyNameLiteral(name.expression) && !isIdentifier28(name.expression)) { const assignedName2 = factory2.createStringLiteralFromNode(name.expression); return { assignedName: assignedName2, name }; } const assignedName = factory2.getGeneratedNameForNode(name); - context.hoistVariableDeclaration(assignedName); - const key = context.getEmitHelperFactory().createPropKeyHelper(name.expression); + context2.hoistVariableDeclaration(assignedName); + const key = context2.getEmitHelperFactory().createPropKeyHelper(name.expression); const assignment = factory2.createAssignment(assignedName, key); const updatedName = factory2.updateComputedPropertyName(name, assignment); return { assignedName, name: updatedName }; } - function createClassNamedEvaluationHelperBlock(context, assignedName, thisExpression = context.factory.createThis()) { - const { factory: factory2 } = context; - const expression = context.getEmitHelperFactory().createSetFunctionNameHelper(thisExpression, assignedName); + function createClassNamedEvaluationHelperBlock(context2, assignedName, thisExpression = context2.factory.createThis()) { + const { factory: factory2 } = context2; + const expression = context2.getEmitHelperFactory().createSetFunctionNameHelper(thisExpression, assignedName); const statement = factory2.createExpressionStatement(expression); const body = factory2.createBlock( [statement], @@ -126657,12 +129932,12 @@ ${lanes.join("\n")} function classHasDeclaredOrExplicitlyAssignedName(node) { return !!node.name || classHasExplicitlyAssignedName(node); } - function injectClassNamedEvaluationHelperBlockIfMissing(context, node, assignedName, thisExpression) { + function injectClassNamedEvaluationHelperBlockIfMissing(context2, node, assignedName, thisExpression) { if (classHasExplicitlyAssignedName(node)) { return node; } - const { factory: factory2 } = context; - const namedEvaluationBlock = createClassNamedEvaluationHelperBlock(context, assignedName, thisExpression); + const { factory: factory2 } = context2; + const namedEvaluationBlock = createClassNamedEvaluationHelperBlock(context2, assignedName, thisExpression); if (node.name) { setSourceMapRange(namedEvaluationBlock.body.statements[0], node.name); } @@ -126689,39 +129964,39 @@ ${lanes.join("\n")} getOrCreateEmitNode(node).assignedName = assignedName; return node; } - function finishTransformNamedEvaluation(context, expression, assignedName, ignoreEmptyStringLiteral) { + function finishTransformNamedEvaluation(context2, expression, assignedName, ignoreEmptyStringLiteral) { if (ignoreEmptyStringLiteral && isStringLiteral15(assignedName) && isEmptyStringLiteral(assignedName)) { return expression; } - const { factory: factory2 } = context; + const { factory: factory2 } = context2; const innerExpression = skipOuterExpressions(expression); - const updatedExpression = isClassExpression(innerExpression) ? cast(injectClassNamedEvaluationHelperBlockIfMissing(context, innerExpression, assignedName), isClassExpression) : context.getEmitHelperFactory().createSetFunctionNameHelper(innerExpression, assignedName); + const updatedExpression = isClassExpression(innerExpression) ? cast(injectClassNamedEvaluationHelperBlockIfMissing(context2, innerExpression, assignedName), isClassExpression) : context2.getEmitHelperFactory().createSetFunctionNameHelper(innerExpression, assignedName); return factory2.restoreOuterExpressions(expression, updatedExpression); } - function transformNamedEvaluationOfPropertyAssignment(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; - const { assignedName, name } = getAssignedNameOfPropertyName(context, node.name, assignedNameText); - const initializer3 = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + function transformNamedEvaluationOfPropertyAssignment(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; + const { assignedName, name } = getAssignedNameOfPropertyName(context2, node.name, assignedNameText); + const initializer3 = finishTransformNamedEvaluation(context2, node.initializer, assignedName, ignoreEmptyStringLiteral); return factory2.updatePropertyAssignment( node, name, initializer3 ); } - function transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfShorthandAssignmentProperty(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.objectAssignmentInitializer); - const objectAssignmentInitializer = finishTransformNamedEvaluation(context, node.objectAssignmentInitializer, assignedName, ignoreEmptyStringLiteral); + const objectAssignmentInitializer = finishTransformNamedEvaluation(context2, node.objectAssignmentInitializer, assignedName, ignoreEmptyStringLiteral); return factory2.updateShorthandPropertyAssignment( node, node.name, objectAssignmentInitializer ); } - function transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfVariableDeclaration(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); - const initializer3 = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + const initializer3 = finishTransformNamedEvaluation(context2, node.initializer, assignedName, ignoreEmptyStringLiteral); return factory2.updateVariableDeclaration( node, node.name, @@ -126730,10 +130005,10 @@ ${lanes.join("\n")} initializer3 ); } - function transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfParameterDeclaration(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); - const initializer3 = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + const initializer3 = finishTransformNamedEvaluation(context2, node.initializer, assignedName, ignoreEmptyStringLiteral); return factory2.updateParameterDeclaration( node, node.modifiers, @@ -126744,10 +130019,10 @@ ${lanes.join("\n")} initializer3 ); } - function transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfBindingElement(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); - const initializer3 = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + const initializer3 = finishTransformNamedEvaluation(context2, node.initializer, assignedName, ignoreEmptyStringLiteral); return factory2.updateBindingElement( node, node.dotDotDotToken, @@ -126756,10 +130031,10 @@ ${lanes.join("\n")} initializer3 ); } - function transformNamedEvaluationOfPropertyDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; - const { assignedName, name } = getAssignedNameOfPropertyName(context, node.name, assignedNameText); - const initializer3 = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + function transformNamedEvaluationOfPropertyDeclaration(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; + const { assignedName, name } = getAssignedNameOfPropertyName(context2, node.name, assignedNameText); + const initializer3 = finishTransformNamedEvaluation(context2, node.initializer, assignedName, ignoreEmptyStringLiteral); return factory2.updatePropertyDeclaration( node, node.modifiers, @@ -126769,10 +130044,10 @@ ${lanes.join("\n")} initializer3 ); } - function transformNamedEvaluationOfAssignmentExpression(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfAssignmentExpression(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.left, node.right); - const right = finishTransformNamedEvaluation(context, node.right, assignedName, ignoreEmptyStringLiteral); + const right = finishTransformNamedEvaluation(context2, node.right, assignedName, ignoreEmptyStringLiteral); return factory2.updateBinaryExpression( node, node.left, @@ -126780,34 +130055,34 @@ ${lanes.join("\n")} right ); } - function transformNamedEvaluationOfExportAssignment(context, node, ignoreEmptyStringLiteral, assignedNameText) { - const { factory: factory2 } = context; + function transformNamedEvaluationOfExportAssignment(context2, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context2; const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : factory2.createStringLiteral(node.isExportEquals ? "" : "default"); - const expression = finishTransformNamedEvaluation(context, node.expression, assignedName, ignoreEmptyStringLiteral); + const expression = finishTransformNamedEvaluation(context2, node.expression, assignedName, ignoreEmptyStringLiteral); return factory2.updateExportAssignment( node, node.modifiers, expression ); } - function transformNamedEvaluation(context, node, ignoreEmptyStringLiteral, assignedName) { + function transformNamedEvaluation(context2, node, ignoreEmptyStringLiteral, assignedName) { switch (node.kind) { case 304: - return transformNamedEvaluationOfPropertyAssignment(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfPropertyAssignment(context2, node, ignoreEmptyStringLiteral, assignedName); case 305: - return transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfShorthandAssignmentProperty(context2, node, ignoreEmptyStringLiteral, assignedName); case 261: - return transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfVariableDeclaration(context2, node, ignoreEmptyStringLiteral, assignedName); case 170: - return transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfParameterDeclaration(context2, node, ignoreEmptyStringLiteral, assignedName); case 209: - return transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfBindingElement(context2, node, ignoreEmptyStringLiteral, assignedName); case 173: - return transformNamedEvaluationOfPropertyDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfPropertyDeclaration(context2, node, ignoreEmptyStringLiteral, assignedName); case 227: - return transformNamedEvaluationOfAssignmentExpression(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfAssignmentExpression(context2, node, ignoreEmptyStringLiteral, assignedName); case 278: - return transformNamedEvaluationOfExportAssignment(context, node, ignoreEmptyStringLiteral, assignedName); + return transformNamedEvaluationOfExportAssignment(context2, node, ignoreEmptyStringLiteral, assignedName); } } var ProcessLevel = /* @__PURE__ */ ((ProcessLevel2) => { @@ -126815,7 +130090,7 @@ ${lanes.join("\n")} ProcessLevel2[ProcessLevel2["All"] = 1] = "All"; return ProcessLevel2; })(ProcessLevel || {}); - function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) { + function processTaggedTemplateExpression(context2, node, visitor, currentSourceFile, recordTaggedTemplateString, level) { const tag = visitNode(node.tag, visitor, isExpression); Debug.assert(tag); const templateArguments = [void 0]; @@ -126823,9 +130098,9 @@ ${lanes.join("\n")} const rawStrings = []; const template = node.template; if (level === 0 && !hasInvalidEscape(template)) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } - const { factory: factory2 } = context; + const { factory: factory2 } = context2; if (isNoSubstitutionTemplateLiteral5(template)) { cookedStrings.push(createTemplateCooked(factory2, template)); rawStrings.push(getRawLiteral(factory2, template, currentSourceFile)); @@ -126838,7 +130113,7 @@ ${lanes.join("\n")} templateArguments.push(Debug.checkDefined(visitNode(templateSpan.expression, visitor, isExpression))); } } - const helperCall = context.getEmitHelperFactory().createTemplateObjectHelper( + const helperCall = context2.getEmitHelperFactory().createTemplateObjectHelper( factory2.createArrayLiteralExpression(cookedStrings), factory2.createArrayLiteralExpression(rawStrings) ); @@ -126877,7 +130152,7 @@ ${lanes.join("\n")} return setTextRange(factory2.createStringLiteral(text), node); } var USE_NEW_TYPE_METADATA_FORMAT = false; - function transformTypeScript(context) { + function transformTypeScript(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, @@ -126885,22 +130160,22 @@ ${lanes.join("\n")} resumeLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); const legacyDecorators = !!compilerOptions.experimentalDecorators; - const typeSerializer = compilerOptions.emitDecoratorMetadata ? createRuntimeTypeSerializer(context) : void 0; - const previousOnEmitNode = context.onEmitNode; - const previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution( + const typeSerializer = compilerOptions.emitDecoratorMetadata ? createRuntimeTypeSerializer(context2) : void 0; + const previousOnEmitNode = context2.onEmitNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.onSubstituteNode = onSubstituteNode; + context2.enableSubstitution( 212 /* PropertyAccessExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 213 /* ElementAccessExpression */ ); @@ -126929,7 +130204,7 @@ ${lanes.join("\n")} } currentSourceFile = node; const visited = saveStateAndInvoke(node, visitSourceFile); - addEmitHelpers(visited, context.readEmitHelpers()); + addEmitHelpers(visited, context2.readEmitHelpers()); currentSourceFile = void 0; return visited; } @@ -126999,7 +130274,7 @@ ${lanes.join("\n")} } function isElisionBlocked(node) { const parsed = getParseTreeNode(node); - if (parsed === node || isExportAssignment3(node)) { + if (parsed === node || isExportAssignment4(node)) { return false; } if (!parsed || parsed.kind !== node.kind) { @@ -127007,7 +130282,7 @@ ${lanes.join("\n")} } switch (node.kind) { case 273: - Debug.assertNode(parsed, isImportDeclaration7); + Debug.assertNode(parsed, isImportDeclaration8); if (node.importClause !== parsed.importClause) { return true; } @@ -127028,7 +130303,7 @@ ${lanes.join("\n")} } break; case 279: - Debug.assertNode(parsed, isExportDeclaration2); + Debug.assertNode(parsed, isExportDeclaration3); if (node.exportClause !== parsed.exportClause) { return true; } @@ -127042,7 +130317,7 @@ ${lanes.join("\n")} function visitElidableStatement(node) { if (isElisionBlocked(node)) { if (node.transformFlags & 1) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } return node; } @@ -127090,7 +130365,7 @@ ${lanes.join("\n")} case 175: return visitMethodDeclaration(node, parent2); case 176: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 241: return node; case 182: @@ -127250,7 +130525,7 @@ ${lanes.join("\n")} case 287: return visitJsxJsxOpeningElement(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitSourceFile(node) { @@ -127260,7 +130535,7 @@ ${lanes.join("\n")} visitLexicalEnvironment( node.statements, sourceElementVisitor, - context, + context2, /*start*/ 0, alwaysStrict @@ -127312,7 +130587,7 @@ ${lanes.join("\n")} ); } if (promoteToIIFE) { - context.startLexicalEnvironment(); + context2.startLexicalEnvironment(); } const moveModifiers = promoteToIIFE || facts & 8; let modifiers = moveModifiers ? visitNodes2(node.modifiers, modifierElidingVisitor, isModifierLike) : visitNodes2(node.modifiers, visitor, isModifierLike); @@ -127359,7 +130634,7 @@ ${lanes.join("\n")} /* NoTokenSourceMaps */ ); statements.push(returnStatement); - insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); + insertStatementsAfterStandardPrologue(statements, context2.endLexicalEnvironment()); const iife = factory2.createImmediatelyInvokedArrowFunction(statements); setInternalEmitFlags( iife, @@ -127615,7 +130890,7 @@ ${lanes.join("\n")} return factory2.createIdentifier(""); } else if (isComputedPropertyName(name)) { return generateNameForComputedPropertyName && !isSimpleInlineableExpression(name.expression) ? factory2.getGeneratedNameForNode(name) : name.expression; - } else if (isIdentifier26(name)) { + } else if (isIdentifier28(name)) { return factory2.createStringLiteral(idText(name)); } else { return factory2.cloneNode(name); @@ -127639,7 +130914,7 @@ ${lanes.join("\n")} if (node.token === 119) { return void 0; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitExpressionWithTypeArguments(node) { return factory2.updateExpressionWithTypeArguments( @@ -127698,7 +130973,7 @@ ${lanes.join("\n")} node, /*modifiers*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), transformConstructorBody(node.body, node) ); } @@ -127734,7 +131009,7 @@ ${lanes.join("\n")} function transformConstructorBody(body, constructor) { const parametersWithPropertyAssignments = constructor && filter(constructor.parameters, (p) => isParameterPropertyDeclaration(p, constructor)); if (!some(parametersWithPropertyAssignments)) { - return visitFunctionBody(body, visitor, context); + return visitFunctionBody(body, visitor, context2); } let statements = []; resumeLexicalEnvironment(); @@ -127777,7 +131052,7 @@ ${lanes.join("\n")} } function transformParameterWithPropertyAssignment(node) { const name = node.name; - if (!isIdentifier26(name)) { + if (!isIdentifier28(name)) { return void 0; } const propertyName = setParent(setTextRange(factory2.cloneNode(name), name), name.parent); @@ -127833,10 +131108,10 @@ ${lanes.join("\n")} void 0, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - visitFunctionBody(node.body, visitor, context) + visitFunctionBody(node.body, visitor, context2) ); } function shouldEmitAccessorDeclaration(node) { @@ -127859,10 +131134,10 @@ ${lanes.join("\n")} node, modifiers, visitPropertyNameOfClassElement(node), - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - visitFunctionBody(node.body, visitor, context) || factory2.createBlock([]) + visitFunctionBody(node.body, visitor, context2) || factory2.createBlock([]) ); } function visitSetAccessor(node, parent2) { @@ -127878,8 +131153,8 @@ ${lanes.join("\n")} node, modifiers, visitPropertyNameOfClassElement(node), - visitParameterList(node.parameters, visitor, context), - visitFunctionBody(node.body, visitor, context) || factory2.createBlock([]) + visitParameterList(node.parameters, visitor, context2), + visitFunctionBody(node.body, visitor, context2) || factory2.createBlock([]) ); } function visitFunctionDeclaration(node) { @@ -127893,10 +131168,10 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - visitFunctionBody(node.body, visitor, context) || factory2.createBlock([]) + visitFunctionBody(node.body, visitor, context2) || factory2.createBlock([]) ); if (isExportOfNamespace(node)) { const statements = [updated]; @@ -127916,10 +131191,10 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - visitFunctionBody(node.body, visitor, context) || factory2.createBlock([]) + visitFunctionBody(node.body, visitor, context2) || factory2.createBlock([]) ); return updated; } @@ -127929,11 +131204,11 @@ ${lanes.join("\n")} visitNodes2(node.modifiers, modifierVisitor, isModifier), /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, node.equalsGreaterThanToken, - visitFunctionBody(node.body, visitor, context) + visitFunctionBody(node.body, visitor, context2) ); return updated; } @@ -127979,7 +131254,7 @@ ${lanes.join("\n")} node ); } else { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function transformInitializedVariable(node) { @@ -127988,7 +131263,7 @@ ${lanes.join("\n")} return flattenDestructuringAssignment( node, visitor, - context, + context2, 0, /*needsValue*/ false, @@ -128022,12 +131297,12 @@ ${lanes.join("\n")} } function visitParenthesizedExpression(node) { const innerExpression = skipOuterExpressions(node.expression, ~(38 | 16)); - if (isAssertionExpression(innerExpression) || isSatisfiesExpression5(innerExpression)) { + if (isAssertionExpression(innerExpression) || isSatisfiesExpression6(innerExpression)) { const expression = visitNode(node.expression, visitor, isExpression); Debug.assert(expression); return factory2.createPartiallyEmittedExpression(expression, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssertionExpression(node) { const expression = visitNode(node.expression, visitor, isExpression); @@ -128261,7 +131536,7 @@ ${lanes.join("\n")} return true; } function declaredNameInScope(node) { - Debug.assertNode(node.name, isIdentifier26); + Debug.assertNode(node.name, isIdentifier28); return node.name.escapedText; } function addVarForEnumOrModuleDeclaration(statements, node) { @@ -128303,7 +131578,7 @@ ${lanes.join("\n")} if (!shouldEmitModuleDeclaration(node)) { return factory2.createNotEmittedStatement(node); } - Debug.assertNode(node.name, isIdentifier26, "A TypeScript namespace should have an Identifier name."); + Debug.assertNode(node.name, isIdentifier28, "A TypeScript namespace should have an Identifier name."); enableSubstitutionForNamespaceExports(); const statements = []; let emitFlags = 4; @@ -128480,7 +131755,7 @@ ${lanes.join("\n")} return !node.isTypeOnly && shouldEmitAliasDeclaration(node) ? node : void 0; } function visitExportAssignment(node) { - return compilerOptions.verbatimModuleSyntax || resolver.isValueAliasDeclaration(node) ? visitEachChild(node, visitor, context) : void 0; + return compilerOptions.verbatimModuleSyntax || resolver.isValueAliasDeclaration(node) ? visitEachChild(node, visitor, context2) : void 0; } function visitExportDeclaration(node) { if (node.isTypeOnly) { @@ -128517,7 +131792,7 @@ ${lanes.join("\n")} return allowEmpty || some(elements) ? factory2.updateNamedExports(node, elements) : void 0; } function visitNamespaceExports(node) { - return factory2.updateNamespaceExport(node, Debug.checkDefined(visitNode(node.name, visitor, isIdentifier26))); + return factory2.updateNamespaceExport(node, Debug.checkDefined(visitNode(node.name, visitor, isIdentifier28))); } function visitNamedExportBindings(node, allowEmpty) { return isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty); @@ -128536,7 +131811,7 @@ ${lanes.join("\n")} if (!shouldEmitAliasDeclaration(node)) { return void 0; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } if (!shouldEmitImportEqualsDeclaration(node)) { return void 0; @@ -128671,7 +131946,7 @@ ${lanes.join("\n")} function enableSubstitutionForNonQualifiedEnumMembers() { if ((enabledSubstitutions & 8) === 0) { enabledSubstitutions |= 8; - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -128680,15 +131955,15 @@ ${lanes.join("\n")} function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); - context.enableSubstitution( + context2.enableSubstitution( 305 /* ShorthandPropertyAssignment */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 268 /* ModuleDeclaration */ ); @@ -128720,7 +131995,7 @@ ${lanes.join("\n")} node = previousOnSubstituteNode(hint, node); if (hint === 1) { return substituteExpression(node); - } else if (isShorthandPropertyAssignment6(node)) { + } else if (isShorthandPropertyAssignment7(node)) { return substituteShorthandPropertyAssignment(node); } return node; @@ -128799,13 +132074,13 @@ ${lanes.join("\n")} if (getIsolatedModules(compilerOptions)) { return void 0; } - return isPropertyAccessExpression16(node) || isElementAccessExpression8(node) ? resolver.getConstantValue(node) : void 0; + return isPropertyAccessExpression17(node) || isElementAccessExpression8(node) ? resolver.getConstantValue(node) : void 0; } function shouldEmitAliasDeclaration(node) { return compilerOptions.verbatimModuleSyntax || isInJSFile(node) || resolver.isReferencedAliasDeclaration(node); } } - function transformClassFields(context) { + function transformClassFields(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, @@ -128814,9 +132089,9 @@ ${lanes.join("\n")} startLexicalEnvironment, resumeLexicalEnvironment, addBlockScopedVariable - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); const legacyDecorators = !!compilerOptions.experimentalDecorators; @@ -128828,10 +132103,10 @@ ${lanes.join("\n")} const shouldTransformThisInStaticInitializers = languageVersion < 9; const shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2; const shouldTransformAnything = shouldTransformInitializers || shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformAutoAccessors === -1; - const previousOnSubstituteNode = context.onSubstituteNode; - context.onSubstituteNode = onSubstituteNode; - const previousOnEmitNode = context.onEmitNode; - context.onEmitNode = onEmitNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onSubstituteNode = onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + context2.onEmitNode = onEmitNode; let shouldTransformPrivateStaticElementsInFile = false; let enabledSubstitutions = 0; let classAliases; @@ -128844,7 +132119,7 @@ ${lanes.join("\n")} let currentClassElement; let shouldSubstituteThisWithClassThis = false; let previousShouldSubstituteThisWithClassThis = false; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; @@ -128854,8 +132129,8 @@ ${lanes.join("\n")} if (!shouldTransformAnything && !shouldTransformPrivateStaticElementsInFile) { return node; } - const visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + const visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); return visited; } function modifierVisitor(node) { @@ -128948,7 +132223,7 @@ ${lanes.join("\n")} } } function fallbackVisitor(node) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function discardedValueVisitor(node) { switch (node.kind) { @@ -128984,7 +132259,7 @@ ${lanes.join("\n")} function heritageClauseVisitor(node) { switch (node.kind) { case 299: - return visitEachChild(node, heritageClauseVisitor, context); + return visitEachChild(node, heritageClauseVisitor, context2); case 234: return visitExpressionWithTypeArgumentsInHeritageClause(node); default: @@ -129074,55 +132349,55 @@ ${lanes.join("\n")} node ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitPropertyAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitVariableStatement(node) { const savedPendingStatements = pendingStatements; pendingStatements = []; - const visitedNode = visitEachChild(node, visitor, context); + const visitedNode = visitEachChild(node, visitor, context2); const statement = some(pendingStatements) ? [visitedNode, ...pendingStatements] : visitedNode; pendingStatements = savedPendingStatements; return statement; } function visitVariableDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitParameterDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitBindingElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitExportAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { node = transformNamedEvaluation( - context, + context2, node, /*ignoreEmptyStringLiteral*/ true, node.isExportEquals ? "" : "default" ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function injectPendingExpressions(expression) { if (some(pendingExpressions)) { - if (isParenthesizedExpression7(expression)) { + if (isParenthesizedExpression8(expression)) { pendingExpressions.push(expression.expression); expression = factory2.updateParenthesizedExpression(expression, factory2.inlineExpressions(pendingExpressions)); } else { @@ -129151,7 +132426,7 @@ ${lanes.join("\n")} function visitMethodOrAccessorDeclaration(node) { Debug.assert(!hasDecorators(node)); if (!isPrivateIdentifierClassElementDeclaration(node) || !shouldTransformClassElementToWeakMap(node)) { - return visitEachChild(node, classElementVisitor, context); + return visitEachChild(node, classElementVisitor, context2); } const info = accessPrivateIdentifier2(node.name); Debug.assert(info, "Undeclared private name for property declaration."); @@ -129169,10 +132444,10 @@ ${lanes.join("\n")} functionName, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - visitFunctionBody(node.body, visitor, context) + visitFunctionBody(node.body, visitor, context2) ) ) ); @@ -129288,7 +132563,7 @@ ${lanes.join("\n")} ); } if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } return factory2.updatePropertyDeclaration( node, @@ -129410,7 +132685,7 @@ ${lanes.join("\n")} ); } } - if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier26(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier28(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1) { return visitInvalidSuperProperty(node); @@ -129426,7 +132701,7 @@ ${lanes.join("\n")} return superProperty; } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitElementAccessExpression(node) { if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { @@ -129445,7 +132720,7 @@ ${lanes.join("\n")} return superProperty; } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitPreOrPostfixUnaryExpression(node, discarded) { if (node.operator === 46 || node.operator === 47) { @@ -129483,8 +132758,8 @@ ${lanes.join("\n")} if (classConstructor && superClassReference) { let setterName; let getterName; - if (isPropertyAccessExpression16(operand)) { - if (isIdentifier26(operand.name)) { + if (isPropertyAccessExpression17(operand)) { + if (isIdentifier28(operand.name)) { getterName = setterName = factory2.createStringLiteralFromNode(operand.name); } } else { @@ -129512,7 +132787,7 @@ ${lanes.join("\n")} } } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForStatement(node) { return factory2.updateForStatement( @@ -129520,7 +132795,7 @@ ${lanes.join("\n")} visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, discardedValueVisitor, isExpression), - visitIterationBody(node.statement, visitor, context) + visitIterationBody(node.statement, visitor, context2) ); } function visitExpressionStatement(node) { @@ -129574,7 +132849,7 @@ ${lanes.join("\n")} setTextRange(invocation, node); return invocation; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitTaggedTemplateExpression(node) { var _a3; @@ -129609,7 +132884,7 @@ ${lanes.join("\n")} visitNode(node.template, visitor, isTemplateLiteral) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformClassStaticBlockDeclaration(node) { if (lexicalEnvironment) { @@ -129676,7 +132951,7 @@ ${lanes.join("\n")} } if (isAssignmentExpression(node)) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); Debug.assertNode(node, isAssignmentExpression); } const left = skipOuterExpressions( @@ -129706,7 +132981,7 @@ ${lanes.join("\n")} ); } if (classConstructor && superClassReference) { - let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier26(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; + let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier28(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; if (setterName) { let expression = visitNode(node.right, visitor, isExpression); if (isCompoundAssignment(node.operatorToken.kind)) { @@ -129754,7 +133029,7 @@ ${lanes.join("\n")} if (isPrivateIdentifierInExpression(node)) { return transformPrivateIdentifierInInExpression(node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCommaListExpression(node, discarded) { const elements = discarded ? visitCommaListElements(node.elements, discardedValueVisitor) : visitCommaListElements(node.elements, visitor, discardedValueVisitor); @@ -129893,7 +133168,7 @@ ${lanes.join("\n")} void 0 ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitInNewClassLexicalEnvironment(node, visitor2) { var _a3; @@ -129906,11 +133181,11 @@ ${lanes.join("\n")} const shouldAlwaysTransformPrivateStaticElements = getInternalEmitFlags(node) & 32; if (shouldTransformPrivateElementsOrClassStaticBlocks || shouldAlwaysTransformPrivateStaticElements) { const name = getNameOfDeclaration(node); - if (name && isIdentifier26(name)) { + if (name && isIdentifier28(name)) { getPrivateIdentifierEnvironment().data.className = name; } else if ((_a3 = node.emitNode) == null ? void 0 : _a3.assignedName) { if (isStringLiteral15(node.emitNode.assignedName)) { - if (node.emitNode.assignedName.textSourceNode && isIdentifier26(node.emitNode.assignedName.textSourceNode)) { + if (node.emitNode.assignedName.textSourceNode && isIdentifier28(node.emitNode.assignedName.textSourceNode)) { getPrivateIdentifierEnvironment().data.className = node.emitNode.assignedName.textSourceNode; } else if (isIdentifierText(node.emitNode.assignedName.text, languageVersion)) { const prefixName = factory2.createIdentifier(node.emitNode.assignedName.text); @@ -130130,7 +133405,7 @@ ${lanes.join("\n")} } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } return void 0; } @@ -130258,7 +133533,7 @@ ${lanes.join("\n")} } const extendsClauseElement = getEffectiveBaseTypeNode(container); const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106); - const parameters = visitParameterList(constructor ? constructor.parameters : void 0, visitor, context); + const parameters = visitParameterList(constructor ? constructor.parameters : void 0, visitor, context2); const body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { return constructor; @@ -130347,7 +133622,7 @@ ${lanes.join("\n")} /*node*/ void 0, visitor, - context + context2 ); } resumeLexicalEnvironment(); @@ -130518,7 +133793,7 @@ ${lanes.join("\n")} function transformPropertyWorker(property, receiver) { const emitAssignment = !useDefineForClassFields; if (isNamedEvaluation(property, isAnonymousClassNeedingAssignedName)) { - property = transformNamedEvaluation(context, property); + property = transformNamedEvaluation(context2, property); } const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name; if (hasStaticModifier(property)) { @@ -130561,10 +133836,10 @@ ${lanes.join("\n")} return void 0; } let initializer3 = visitNode(property.initializer, visitor, isExpression); - if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier26(propertyName)) { + if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier28(propertyName)) { const localName = factory2.cloneNode(propertyName); if (initializer3) { - if (isParenthesizedExpression7(initializer3) && isCommaExpression(initializer3.expression) && isCallToHelper(initializer3.expression.left, "___runInitializers") && isVoidExpression(initializer3.expression.right) && isNumericLiteral5(initializer3.expression.right.expression)) { + if (isParenthesizedExpression8(initializer3) && isCommaExpression(initializer3.expression) && isCallToHelper(initializer3.expression.left, "___runInitializers") && isVoidExpression(initializer3.expression.right) && isNumericLiteral5(initializer3.expression.right.expression)) { initializer3 = initializer3.expression.left; } initializer3 = factory2.inlineExpressions([initializer3, localName]); @@ -130601,7 +133876,7 @@ ${lanes.join("\n")} const expression = factory2.createAssignment(memberAccess, initializer3); return expression; } else { - const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier26(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier28(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; const descriptor = factory2.createPropertyDescriptor({ value: initializer3, configurable: true, writable: true, enumerable: true }); return factory2.createObjectDefinePropertyCall(receiver, name, descriptor); } @@ -130609,7 +133884,7 @@ ${lanes.join("\n")} function enableSubstitutionForClassAliases() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -130619,39 +133894,39 @@ ${lanes.join("\n")} function enableSubstitutionForClassStaticThisOrSuperReference() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; - context.enableSubstitution( + context2.enableSubstitution( 110 /* ThisKeyword */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 263 /* FunctionDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 219 /* FunctionExpression */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 177 /* Constructor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 178 /* GetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 179 /* SetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 175 /* MethodDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 173 /* PropertyDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 168 /* ComputedPropertyName */ ); @@ -130670,7 +133945,7 @@ ${lanes.join("\n")} ); } function visitInvalidSuperProperty(node) { - return isPropertyAccessExpression16(node) ? factory2.updatePropertyAccessExpression( + return isPropertyAccessExpression17(node) ? factory2.updatePropertyAccessExpression( node, factory2.createVoidZero(), node.name @@ -130700,7 +133975,7 @@ ${lanes.join("\n")} } return factory2.createAssignment(generatedName, expression); } - return inlinable || isIdentifier26(innerExpression) ? void 0 : expression; + return inlinable || isIdentifier28(innerExpression) ? void 0 : expression; } } function startClassLexicalEnvironment() { @@ -130870,7 +134145,7 @@ ${lanes.join("\n")} const parameter = factory2.getGeneratedNameForNode(node); const info = accessPrivateIdentifier2(node.name); if (!info) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } let receiver = node.expression; if (isThisProperty(node) || isSuperProperty(node) || !isSimpleCopiableExpression(node.expression)) { @@ -130893,7 +134168,7 @@ ${lanes.join("\n")} ); } function visitDestructuringAssignmentTarget(node) { - if (isObjectLiteralExpression12(node) || isArrayLiteralExpression7(node)) { + if (isObjectLiteralExpression13(node) || isArrayLiteralExpression7(node)) { return visitAssignmentPattern(node); } if (isPrivateIdentifierPropertyAccessExpression(node)) { @@ -130903,7 +134178,7 @@ ${lanes.join("\n")} if (facts & 1) { return visitInvalidSuperProperty(node); } else if (classConstructor && superClassReference) { - const name = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier26(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; + const name = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier28(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; if (name) { const temp = factory2.createTempVariable( /*recordTempVariable*/ @@ -130921,11 +134196,11 @@ ${lanes.join("\n")} } } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } if (isAssignmentExpression( node, @@ -130943,14 +134218,14 @@ ${lanes.join("\n")} const expression = visitDestructuringAssignmentTarget(node.expression); return factory2.updateSpreadElement(node, expression); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitArrayAssignmentElement(node) { if (isArrayBindingOrAssignmentElement(node)) { if (isSpreadElement5(node)) return visitAssignmentRestElement(node); if (!isOmittedExpression(node)) return visitAssignmentElement(node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentProperty(node) { const name = visitNode(node.name, visitor, isPropertyName); @@ -130966,27 +134241,27 @@ ${lanes.join("\n")} const assignmentElement = visitDestructuringAssignmentTarget(node.initializer); return factory2.updatePropertyAssignment(node, name, assignmentElement); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitShorthandAssignmentProperty(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node); + node = transformNamedEvaluation(context2, node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentRestProperty(node) { if (isLeftHandSideExpression(node.expression)) { const expression = visitDestructuringAssignmentTarget(node.expression); return factory2.updateSpreadAssignment(node, expression); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitObjectAssignmentElement(node) { Debug.assertNode(node, isObjectBindingOrAssignmentElement); - if (isSpreadAssignment6(node)) return visitAssignmentRestProperty(node); - if (isShorthandPropertyAssignment6(node)) return visitShorthandAssignmentProperty(node); - if (isPropertyAssignment11(node)) return visitAssignmentProperty(node); - return visitEachChild(node, visitor, context); + if (isSpreadAssignment7(node)) return visitAssignmentRestProperty(node); + if (isShorthandPropertyAssignment7(node)) return visitShorthandAssignmentProperty(node); + if (isPropertyAssignment12(node)) return visitAssignmentProperty(node); + return visitEachChild(node, visitor, context2); } function visitAssignmentPattern(node) { if (isArrayLiteralExpression7(node)) { @@ -131148,13 +134423,13 @@ ${lanes.join("\n")} function isStaticPropertyDeclarationOrClassStaticBlock(node) { return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node); } - function createRuntimeTypeSerializer(context) { + function createRuntimeTypeSerializer(context2) { const { factory: factory2, hoistVariableDeclaration - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); let currentLexicalScope; @@ -131203,7 +134478,7 @@ ${lanes.join("\n")} const numParameters = parameters.length; for (let i = 0; i < numParameters; i++) { const parameter = parameters[i]; - if (i === 0 && isIdentifier26(parameter.name) && parameter.name.escapedText === "this") { + if (i === 0 && isIdentifier28(parameter.name) && parameter.name.escapedText === "this") { continue; } if (parameter.dotDotDotToken) { @@ -131374,7 +134649,7 @@ ${lanes.join("\n")} continue; } const serializedConstituent = serializeTypeNode(typeNode); - if (isIdentifier26(serializedConstituent) && serializedConstituent.escapedText === "Object") { + if (isIdentifier28(serializedConstituent) && serializedConstituent.escapedText === "Object") { return serializedConstituent; } if (serializedType) { @@ -131392,7 +134667,7 @@ ${lanes.join("\n")} // temp vars used in fallback isGeneratedIdentifier(left) ? isGeneratedIdentifier(right) : ( // entity names - isIdentifier26(left) ? isIdentifier26(right) && left.escapedText === right.escapedText : isPropertyAccessExpression16(left) ? isPropertyAccessExpression16(right) && equateSerializedTypeNodes(left.expression, right.expression) && equateSerializedTypeNodes(left.name, right.name) : ( + isIdentifier28(left) ? isIdentifier28(right) && left.escapedText === right.escapedText : isPropertyAccessExpression17(left) ? isPropertyAccessExpression17(right) && equateSerializedTypeNodes(left.expression, right.expression) && equateSerializedTypeNodes(left.name, right.name) : ( // `void 0` isVoidExpression(left) ? isVoidExpression(right) && isNumericLiteral5(left.expression) && left.expression.text === "0" && isNumericLiteral5(right.expression) && right.expression.text === "0" : ( // `"undefined"` or `"function"` in `typeof` checks @@ -131400,7 +134675,7 @@ ${lanes.join("\n")} // used in `typeof` checks for fallback isTypeOfExpression(left) ? isTypeOfExpression(right) && equateSerializedTypeNodes(left.expression, right.expression) : ( // parens in `typeof` checks with temps - isParenthesizedExpression7(left) ? isParenthesizedExpression7(right) && equateSerializedTypeNodes(left.expression, right.expression) : ( + isParenthesizedExpression8(left) ? isParenthesizedExpression8(right) && equateSerializedTypeNodes(left.expression, right.expression) : ( // conditionals used in fallback isConditionalExpression4(left) ? isConditionalExpression4(right) && equateSerializedTypeNodes(left.condition, right.condition) && equateSerializedTypeNodes(left.whenTrue, right.whenTrue) && equateSerializedTypeNodes(left.whenFalse, right.whenFalse) : ( // logical binary and assignments used in fallback @@ -131519,22 +134794,22 @@ ${lanes.join("\n")} return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory2.createIdentifier(name); } } - function transformLegacyDecorators(context) { + function transformLegacyDecorators(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, hoistVariableDeclaration - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - const previousOnSubstituteNode = context.onSubstituteNode; - context.onSubstituteNode = onSubstituteNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onSubstituteNode = onSubstituteNode; let classAliases; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { - const visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + const visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); return visited; } function modifierVisitor(node) { @@ -131564,7 +134839,7 @@ ${lanes.join("\n")} case 170: return visitParameterDeclaration(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitClassDeclaration(node) { @@ -131577,7 +134852,7 @@ ${lanes.join("\n")} true, node ))) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } const statements = classOrConstructorParameterIsDecorated( /*useLegacyDecorators*/ @@ -132011,7 +135286,7 @@ ${lanes.join("\n")} return factory2.createIdentifier(""); } else if (isComputedPropertyName(name)) { return generateNameForComputedPropertyName && !isSimpleInlineableExpression(name.expression) ? factory2.getGeneratedNameForNode(name) : name.expression; - } else if (isIdentifier26(name)) { + } else if (isIdentifier28(name)) { return factory2.createStringLiteral(idText(name)); } else { return factory2.cloneNode(name); @@ -132019,7 +135294,7 @@ ${lanes.join("\n")} } function enableSubstitutionForClassAliases() { if (!classAliases) { - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -132084,27 +135359,27 @@ ${lanes.join("\n")} return void 0; } } - function transformESDecorators(context) { + function transformESDecorators(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const languageVersion = getEmitScriptTarget(context.getCompilerOptions()); + } = context2; + const languageVersion = getEmitScriptTarget(context2.getCompilerOptions()); let top; let classInfo; let classThis; let classSuper; let pendingExpressions; let shouldTransformPrivateStaticElementsInFile; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { top = void 0; shouldTransformPrivateStaticElementsInFile = false; - const visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + const visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); if (shouldTransformPrivateStaticElementsInFile) { addInternalEmitFlags( visited, @@ -132283,12 +135558,12 @@ ${lanes.join("\n")} case 219: case 263: { enterOther(); - const result = visitEachChild(node, fallbackVisitor, context); + const result = visitEachChild(node, fallbackVisitor, context2); exitOther(); return result; } default: - return visitEachChild(node, fallbackVisitor, context); + return visitEachChild(node, fallbackVisitor, context2); } } function fallbackVisitor(node) { @@ -132357,7 +135632,7 @@ ${lanes.join("\n")} } } function getHelperVariableName(node) { - let declarationName = node.name && isIdentifier26(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name) : node.name && isPrivateIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name).slice(1) : node.name && isStringLiteral15(node.name) && isIdentifierText( + let declarationName = node.name && isIdentifier28(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name) : node.name && isPrivateIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name).slice(1) : node.name && isStringLiteral15(node.name) && isIdentifierText( node.name.text, 99 /* ESNext */ @@ -132497,7 +135772,7 @@ ${lanes.join("\n")} false, node )) { - node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, factory2.createStringLiteral("")); + node = injectClassNamedEvaluationHelperBlockIfMissing(context2, node, factory2.createStringLiteral("")); } const classReference = factory2.getLocalName( node, @@ -132598,7 +135873,7 @@ ${lanes.join("\n")} } return outerThis; default: - return visitEachChild(node2, thisVisitor, context); + return visitEachChild(node2, thisVisitor, context2); } }, isExpression); const statement = factory2.createExpressionStatement(expression); @@ -132851,7 +136126,7 @@ ${lanes.join("\n")} /* Default */ ); if (!node.name) { - node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, className); + node = injectClassNamedEvaluationHelperBlockIfMissing(context2, node, className); } if (isExport && isDefault) { const iife = transformClassLike(node); @@ -133087,13 +136362,13 @@ ${lanes.join("\n")} const statements = isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo2.staticNonFieldDecorationStatements ?? (classInfo2.staticNonFieldDecorationStatements = []) : classInfo2.nonStaticNonFieldDecorationStatements ?? (classInfo2.nonStaticNonFieldDecorationStatements = []) : isPropertyDeclaration(member) && !isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo2.staticFieldDecorationStatements ?? (classInfo2.staticFieldDecorationStatements = []) : classInfo2.nonStaticFieldDecorationStatements ?? (classInfo2.nonStaticFieldDecorationStatements = []) : Debug.fail(); const kind = isGetAccessorDeclaration(member) ? "getter" : isSetAccessorDeclaration(member) ? "setter" : isMethodDeclaration(member) ? "method" : isAutoAccessorPropertyDeclaration(member) ? "accessor" : isPropertyDeclaration(member) ? "field" : Debug.fail(); let propertyName; - if (isIdentifier26(member.name) || isPrivateIdentifier(member.name)) { + if (isIdentifier28(member.name) || isPrivateIdentifier(member.name)) { propertyName = { computed: false, name: member.name }; } else if (isPropertyNameLiteral(member.name)) { propertyName = { computed: true, name: factory2.createStringLiteralFromNode(member.name) }; } else { const expression = member.name.expression; - if (isPropertyNameLiteral(expression) && !isIdentifier26(expression)) { + if (isPropertyNameLiteral(expression) && !isIdentifier28(expression)) { propertyName = { computed: true, name: factory2.createStringLiteralFromNode(expression) }; } else { enterName(); @@ -133102,7 +136377,7 @@ ${lanes.join("\n")} exitName(); } } - const context2 = { + const context22 = { kind, name: propertyName, static: isStatic(member), @@ -133125,7 +136400,7 @@ ${lanes.join("\n")} memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor"); descriptor = factory2.createAssignment(descriptorName, descriptor); } - const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor ?? factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(), methodExtraInitializersName); + const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor ?? factory2.createNull(), memberDecoratorsName, context22, factory2.createNull(), methodExtraInitializersName); const esDecorateStatement = factory2.createExpressionStatement(esDecorateExpression); setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); statements.push(esDecorateStatement); @@ -133149,7 +136424,7 @@ ${lanes.join("\n")} isAutoAccessorPropertyDeclaration(member) ? factory2.createThis() : factory2.createNull(), descriptor ?? factory2.createNull(), memberDecoratorsName, - context2, + context22, initializersName, extraInitializersName ); @@ -133236,14 +136511,14 @@ ${lanes.join("\n")} enterClassElement(node); let result; if (isClassNamedEvaluationHelperBlock(node)) { - result = visitEachChild(node, visitor, context); + result = visitEachChild(node, visitor, context2); } else if (isClassThisAssignmentBlock(node)) { const savedClassThis = classThis; classThis = void 0; - result = visitEachChild(node, visitor, context); + result = visitEachChild(node, visitor, context2); classThis = savedClassThis; } else { - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); result = node; if (classInfo) { classInfo.hasStaticInitializers = true; @@ -133270,7 +136545,7 @@ ${lanes.join("\n")} } function visitPropertyDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } enterClassElement(node); Debug.assert(!isAmbientPropertyDeclaration(node), "Not yet implemented."); @@ -133398,7 +136673,7 @@ ${lanes.join("\n")} setTextRange(invocation, node); return invocation; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitTaggedTemplateExpression(node) { if (isSuperProperty(node.tag) && classThis) { @@ -133415,17 +136690,17 @@ ${lanes.join("\n")} template ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitPropertyAccessExpression(node) { - if (isSuperProperty(node) && isIdentifier26(node.name) && classThis && classSuper) { + if (isSuperProperty(node) && isIdentifier28(node.name) && classThis && classSuper) { const propertyName = factory2.createStringLiteralFromNode(node.name); const superProperty = factory2.createReflectGetCall(classSuper, propertyName, classThis); setOriginalNode(superProperty, node.expression); setTextRange(superProperty, node.expression); return superProperty; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitElementAccessExpression(node) { if (isSuperProperty(node) && classThis && classSuper) { @@ -133435,11 +136710,11 @@ ${lanes.join("\n")} setTextRange(superProperty, node.expression); return superProperty; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitParameterDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } const updated = factory2.updateParameterDeclaration( node, @@ -133482,11 +136757,11 @@ ${lanes.join("\n")} visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, discardedValueVisitor, isExpression), - visitIterationBody(node.statement, visitor, context) + visitIterationBody(node.statement, visitor, context2) ); } function visitExpressionStatement(node) { - return visitEachChild(node, discardedValueVisitor, context); + return visitEachChild(node, discardedValueVisitor, context2); } function visitBinaryExpression(node, discarded) { if (isDestructuringAssignment(node)) { @@ -133496,11 +136771,11 @@ ${lanes.join("\n")} } if (isAssignmentExpression(node)) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); - return visitEachChild(node, visitor, context); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); + return visitEachChild(node, visitor, context2); } if (isSuperProperty(node.left) && classThis && classSuper) { - let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier26(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; + let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier28(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; if (setterName) { let expression = visitNode(node.right, visitor, isExpression); if (isCompoundAssignment(node.operatorToken.kind)) { @@ -133549,13 +136824,13 @@ ${lanes.join("\n")} const right = visitNode(node.right, discarded ? discardedValueVisitor : visitor, isExpression); return factory2.updateBinaryExpression(node, left, node.operatorToken, right); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitPreOrPostfixUnaryExpression(node, discarded) { if (node.operator === 46 || node.operator === 47) { const operand = skipParentheses(node.operand); if (isSuperProperty(operand) && classThis && classSuper) { - let setterName = isElementAccessExpression8(operand) ? visitNode(operand.argumentExpression, visitor, isExpression) : isIdentifier26(operand.name) ? factory2.createStringLiteralFromNode(operand.name) : void 0; + let setterName = isElementAccessExpression8(operand) ? visitNode(operand.argumentExpression, visitor, isExpression) : isIdentifier28(operand.name) ? factory2.createStringLiteralFromNode(operand.name) : void 0; if (setterName) { let getterName = setterName; if (!isSimpleInlineableExpression(setterName)) { @@ -133578,7 +136853,7 @@ ${lanes.join("\n")} } } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCommaListExpression(node, discarded) { const elements = discarded ? visitCommaListElements(node.elements, discardedValueVisitor) : visitCommaListElements(node.elements, visitor, discardedValueVisitor); @@ -133590,7 +136865,7 @@ ${lanes.join("\n")} const name2 = visitNode(node, visitor, isPropertyName); return { referencedName: referencedName2, name: name2 }; } - if (isPropertyNameLiteral(node.expression) && !isIdentifier26(node.expression)) { + if (isPropertyNameLiteral(node.expression) && !isIdentifier28(node.expression)) { const referencedName2 = factory2.createStringLiteralFromNode(node.expression); const name2 = visitNode(node, visitor, isPropertyName); return { referencedName: referencedName2, name: name2 }; @@ -133617,28 +136892,28 @@ ${lanes.join("\n")} } function visitPropertyAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitVariableDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitBindingElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitDestructuringAssignmentTarget(node) { - if (isObjectLiteralExpression12(node) || isArrayLiteralExpression7(node)) { + if (isObjectLiteralExpression13(node) || isArrayLiteralExpression7(node)) { return visitAssignmentPattern(node); } if (isSuperProperty(node) && classThis && classSuper) { - const propertyName = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier26(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; + const propertyName = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier28(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; if (propertyName) { const paramName = factory2.createTempVariable( /*recordTempVariable*/ @@ -133658,7 +136933,7 @@ ${lanes.join("\n")} return expression; } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentElement(node) { if (isAssignmentExpression( @@ -133667,7 +136942,7 @@ ${lanes.join("\n")} true )) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); } const assignmentTarget = visitDestructuringAssignmentTarget(node.left); const initializer3 = visitNode(node.right, visitor, isExpression); @@ -133681,13 +136956,13 @@ ${lanes.join("\n")} const expression = visitDestructuringAssignmentTarget(node.expression); return factory2.updateSpreadElement(node, expression); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitArrayAssignmentElement(node) { Debug.assertNode(node, isArrayBindingOrAssignmentElement); if (isSpreadElement5(node)) return visitAssignmentRestElement(node); if (!isOmittedExpression(node)) return visitAssignmentElement(node); - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentProperty(node) { const name = visitNode(node.name, visitor, isPropertyName); @@ -133703,27 +136978,27 @@ ${lanes.join("\n")} const assignmentElement = visitDestructuringAssignmentTarget(node.initializer); return factory2.updatePropertyAssignment(node, name, assignmentElement); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitShorthandAssignmentProperty(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.objectAssignmentInitializer)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.objectAssignmentInitializer)); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitAssignmentRestProperty(node) { if (isLeftHandSideExpression(node.expression)) { const expression = visitDestructuringAssignmentTarget(node.expression); return factory2.updateSpreadAssignment(node, expression); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitObjectAssignmentElement(node) { Debug.assertNode(node, isObjectBindingOrAssignmentElement); - if (isSpreadAssignment6(node)) return visitAssignmentRestProperty(node); - if (isShorthandPropertyAssignment6(node)) return visitShorthandAssignmentProperty(node); - if (isPropertyAssignment11(node)) return visitAssignmentProperty(node); - return visitEachChild(node, visitor, context); + if (isSpreadAssignment7(node)) return visitAssignmentRestProperty(node); + if (isShorthandPropertyAssignment7(node)) return visitShorthandAssignmentProperty(node); + if (isPropertyAssignment12(node)) return visitAssignmentProperty(node); + return visitEachChild(node, visitor, context2); } function visitAssignmentPattern(node) { if (isArrayLiteralExpression7(node)) { @@ -133736,9 +137011,9 @@ ${lanes.join("\n")} } function visitExportAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.expression)); + node = transformNamedEvaluation(context2, node, canIgnoreEmptyStringLiteralInAssignedName(node.expression)); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitParenthesizedExpression(node, discarded) { const visitorFunc = discarded ? discardedValueVisitor : visitor; @@ -133753,7 +137028,7 @@ ${lanes.join("\n")} function injectPendingExpressionsCommon(pendingExpressions2, expression) { if (some(pendingExpressions2)) { if (expression) { - if (isParenthesizedExpression7(expression)) { + if (isParenthesizedExpression8(expression)) { pendingExpressions2.push(expression.expression); expression = factory2.updateParenthesizedExpression(expression, factory2.inlineExpressions(pendingExpressions2)); } else { @@ -134070,16 +137345,16 @@ ${lanes.join("\n")} ); } } - function transformES2017(context) { + function transformES2017(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, resumeLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); let enabledSubstitutions = 0; let enclosingSuperContainerFlags = 0; @@ -134089,19 +137364,19 @@ ${lanes.join("\n")} let lexicalArgumentsBinding; const substitutedSuperAccessors = []; let contextFlags = 0; - const previousOnEmitNode = context.onEmitNode; - const previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - return chainBundle(context, transformSourceFile); + const previousOnEmitNode = context2.onEmitNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.onSubstituteNode = onSubstituteNode; + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } setContextFlag(1, false); setContextFlag(2, !isEffectiveStrictModeSourceFile(node, compilerOptions)); - const visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + const visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); return visited; } function setContextFlag(flag, val) { @@ -134141,7 +137416,7 @@ ${lanes.join("\n")} return cb(value); } function visitDefault(node) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function argumentsVisitor(node) { switch (node.kind) { @@ -134162,7 +137437,7 @@ ${lanes.join("\n")} } break; } - return visitEachChild(node, argumentsVisitor, context); + return visitEachChild(node, argumentsVisitor, context2); } function visitor(node) { if ((node.transformFlags & 256) === 0) { @@ -134182,15 +137457,15 @@ ${lanes.join("\n")} case 220: return doWithContext(1, visitArrowFunction, node); case 212: - if (capturedSuperProperties && isPropertyAccessExpression16(node) && node.expression.kind === 108) { + if (capturedSuperProperties && isPropertyAccessExpression17(node) && node.expression.kind === 108) { capturedSuperProperties.add(node.name.escapedText); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 213: if (capturedSuperProperties && node.expression.kind === 108) { hasSuperElementAccess = true; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 178: return doWithContext(1 | 2, visitGetAccessorDeclaration, node); case 179: @@ -134201,7 +137476,7 @@ ${lanes.join("\n")} case 232: return doWithContext(1 | 2, visitDefault, node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function asyncBodyVisitor(node) { @@ -134228,7 +137503,7 @@ ${lanes.join("\n")} case 246: case 255: case 257: - return visitEachChild(node, asyncBodyVisitor, context); + return visitEachChild(node, asyncBodyVisitor, context2); default: return Debug.assertNever(node, "Unhandled node."); } @@ -134250,11 +137525,11 @@ ${lanes.join("\n")} if (catchClauseUnshadowedNames) { const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = catchClauseUnshadowedNames; - const result = visitEachChild(node, asyncBodyVisitor, context); + const result = visitEachChild(node, asyncBodyVisitor, context2); enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames; return result; } else { - return visitEachChild(node, asyncBodyVisitor, context); + return visitEachChild(node, asyncBodyVisitor, context2); } } function visitVariableStatementInAsyncBody(node) { @@ -134266,7 +137541,7 @@ ${lanes.join("\n")} ); return expression ? factory2.createExpressionStatement(expression) : void 0; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForInStatementInAsyncBody(node) { return factory2.updateForInStatement( @@ -134277,7 +137552,7 @@ ${lanes.join("\n")} true ) : Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)), Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), - visitIterationBody(node.statement, asyncBodyVisitor, context) + visitIterationBody(node.statement, asyncBodyVisitor, context2) ); } function visitForOfStatementInAsyncBody(node) { @@ -134290,7 +137565,7 @@ ${lanes.join("\n")} true ) : Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)), Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), - visitIterationBody(node.statement, asyncBodyVisitor, context) + visitIterationBody(node.statement, asyncBodyVisitor, context2) ); } function visitForStatementInAsyncBody(node) { @@ -134304,12 +137579,12 @@ ${lanes.join("\n")} ) : visitNode(node.initializer, visitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, visitor, isExpression), - visitIterationBody(node.statement, asyncBodyVisitor, context) + visitIterationBody(node.statement, asyncBodyVisitor, context2) ); } function visitAwaitExpression(node) { if (inTopLevelContext()) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } return setOriginalNode( setTextRange( @@ -134329,7 +137604,7 @@ ${lanes.join("\n")} const updated = factory2.updateConstructorDeclaration( node, visitNodes2(node.modifiers, visitor, isModifier), - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), transformMethodBody(node) ); lexicalArgumentsBinding = savedLexicalArgumentsBinding; @@ -134349,7 +137624,7 @@ ${lanes.join("\n")} void 0, /*typeParameters*/ void 0, - parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context), + parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node) @@ -134364,7 +137639,7 @@ ${lanes.join("\n")} node, visitNodes2(node.modifiers, visitor, isModifierLike), node.name, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, transformMethodBody(node) @@ -134379,7 +137654,7 @@ ${lanes.join("\n")} node, visitNodes2(node.modifiers, visitor, isModifierLike), node.name, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), transformMethodBody(node) ); lexicalArgumentsBinding = savedLexicalArgumentsBinding; @@ -134397,10 +137672,10 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context), + parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context) + functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context2) ); lexicalArgumentsBinding = savedLexicalArgumentsBinding; return updated; @@ -134417,10 +137692,10 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context), + parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, - functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context) + functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context2) ); lexicalArgumentsBinding = savedLexicalArgumentsBinding; return updated; @@ -134433,15 +137708,15 @@ ${lanes.join("\n")} visitNodes2(node.modifiers, visitor, isModifier), /*typeParameters*/ void 0, - parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context), + parameters = functionFlags & 2 ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, node.equalsGreaterThanToken, - functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context) + functionFlags & 2 ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context2) ); } function recordDeclarationName({ name }, names) { - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { names.add(name.escapedText); } else { for (const element of name.elements) { @@ -134469,7 +137744,7 @@ ${lanes.join("\n")} forEach(node.declarations, hoistVariable); } function hoistVariable({ name }) { - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { hoistVariableDeclaration(name); } else { for (const element of name.elements) { @@ -134490,7 +137765,7 @@ ${lanes.join("\n")} return Debug.checkDefined(visitNode(converted, visitor, isExpression)); } function collidesWithParameterName({ name }) { - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { return enclosingFunctionParameterNames.has(name.escapedText); } else { for (const element of name.elements) { @@ -134507,7 +137782,7 @@ ${lanes.join("\n")} const savedHasSuperElementAccess = hasSuperElementAccess; capturedSuperProperties = /* @__PURE__ */ new Set(); hasSuperElementAccess = false; - let updated = visitFunctionBody(node.body, visitor, context); + let updated = visitFunctionBody(node.body, visitor, context2); const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration); const emitSuperHelpers = languageVersion >= 2 && (resolver.hasNodeCheckFlag( node, @@ -134572,7 +137847,7 @@ ${lanes.join("\n")} } function transformAsyncFunctionParameterList(node) { if (isSimpleParameterList(node.parameters)) { - return visitParameterList(node.parameters, visitor, context); + return visitParameterList(node.parameters, visitor, context2); } const newParameters = []; for (const parameter of node.parameters) { @@ -134613,7 +137888,7 @@ ${lanes.join("\n")} return newParametersArray; } function transformAsyncFunctionBody(node, outerParameters) { - const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0; + const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context2) : void 0; resumeLexicalEnvironment(); const original = getOriginalNode(node, isFunctionLike); const nodeType = original.type; @@ -134638,7 +137913,7 @@ ${lanes.join("\n")} Debug.assert(i < outerParameters.length); const originalParameter = node.parameters[i]; const outerParameter = outerParameters[i]; - Debug.assertNode(outerParameter.name, isIdentifier26); + Debug.assertNode(outerParameter.name, isIdentifier28); if (originalParameter.initializer || originalParameter.dotDotDotToken) { Debug.assert(i === outerParameters.length - 1); parameterBindings.push(factory2.createSpreadElement(outerParameter.name)); @@ -134762,39 +138037,39 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution( + context2.enableSubstitution( 214 /* CallExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 212 /* PropertyAccessExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 213 /* ElementAccessExpression */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 264 /* ClassDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 175 /* MethodDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 178 /* GetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 179 /* SetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 177 /* Constructor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 244 /* VariableStatement */ ); @@ -134873,7 +138148,7 @@ ${lanes.join("\n")} function substituteCallExpression(node) { const expression = node.expression; if (isSuperProperty(expression)) { - const argumentExpression = isPropertyAccessExpression16(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + const argumentExpression = isPropertyAccessExpression17(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return factory2.createCallExpression( factory2.createPropertyAccessExpression(argumentExpression, "call"), /*typeArguments*/ @@ -135055,21 +138330,21 @@ ${lanes.join("\n")} ) ); } - function transformES2018(context) { + function transformES2018(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, resumeLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - const previousOnEmitNode = context.onEmitNode; - context.onEmitNode = onEmitNode; - const previousOnSubstituteNode = context.onSubstituteNode; - context.onSubstituteNode = onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + context2.onEmitNode = onEmitNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onSubstituteNode = onSubstituteNode; let exportedVariableStatement = false; let enabledSubstitutions = 0; let enclosingFunctionFlags; @@ -135081,7 +138356,7 @@ ${lanes.join("\n")} let capturedSuperProperties; let hasSuperElementAccess; const substitutedSuperAccessors = []; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function affectsSubtree(excludeFacts, includeFacts) { return hierarchyFacts !== (hierarchyFacts & ~excludeFacts | includeFacts); } @@ -135105,7 +138380,7 @@ ${lanes.join("\n")} } currentSourceFile = node; const visited = visitSourceFile(node); - addEmitHelpers(visited, context.readEmitHelpers()); + addEmitHelpers(visited, context2.readEmitHelpers()); currentSourceFile = void 0; taggedTemplateStringDeclarations = void 0; return visited; @@ -135140,7 +138415,7 @@ ${lanes.join("\n")} return cb(value); } function visitDefault(node) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitorWorker(node, expressionResultIsUnused2) { if ((node.transformFlags & 128) === 0) { @@ -135258,15 +138533,15 @@ ${lanes.join("\n")} case 216: return visitTaggedTemplateExpression(node); case 212: - if (capturedSuperProperties && isPropertyAccessExpression16(node) && node.expression.kind === 108) { + if (capturedSuperProperties && isPropertyAccessExpression17(node) && node.expression.kind === 108) { capturedSuperProperties.add(node.name.escapedText); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 213: if (capturedSuperProperties && node.expression.kind === 108) { hasSuperElementAccess = true; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 264: case 232: return doWithHierarchyFacts( @@ -135277,7 +138552,7 @@ ${lanes.join("\n")} /* ClassOrFunctionIncludes */ ); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitAwaitExpression(node) { @@ -135295,7 +138570,7 @@ ${lanes.join("\n")} node ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitYieldExpression(node) { if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { @@ -135341,7 +138616,7 @@ ${lanes.join("\n")} node ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitReturnStatement(node) { if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { @@ -135352,7 +138627,7 @@ ${lanes.join("\n")} ) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2) { @@ -135362,7 +138637,7 @@ ${lanes.join("\n")} } return factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock), node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function chunkObjectLiteralElements(elements) { let chunkObject; @@ -135403,13 +138678,13 @@ ${lanes.join("\n")} return emitHelpers().createAssignHelper(objects); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitExpressionStatement(node) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } function visitParenthesizedExpression(node, expressionResultIsUnused2) { - return visitEachChild(node, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, context); + return visitEachChild(node, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, context2); } function visitSourceFile(node) { const ancestorFacts = enterSubtree( @@ -135418,7 +138693,7 @@ ${lanes.join("\n")} /* SourceFileIncludes */ ); exportedVariableStatement = false; - const visited = visitEachChild(node, visitor, context); + const visited = visitEachChild(node, visitor, context2); const statement = concatenate( visited.statements, taggedTemplateStringDeclarations && [ @@ -135435,7 +138710,7 @@ ${lanes.join("\n")} } function visitTaggedTemplateExpression(node) { return processTaggedTemplateExpression( - context, + context2, node, visitor, currentSourceFile, @@ -135449,7 +138724,7 @@ ${lanes.join("\n")} return flattenDestructuringAssignment( node, visitor, - context, + context2, 1, !expressionResultIsUnused2 ); @@ -135462,11 +138737,11 @@ ${lanes.join("\n")} visitNode(node.right, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, isExpression) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCommaListExpression(node, expressionResultIsUnused2) { if (expressionResultIsUnused2) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } let result; for (let i = 0; i < node.elements.length; i++) { @@ -135495,7 +138770,7 @@ ${lanes.join("\n")} const visitedBindings = flattenDestructuringBinding( updatedDecl, visitor, - context, + context2, 1 /* ObjectRest */ ); @@ -135525,7 +138800,7 @@ ${lanes.join("\n")} block2 ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitVariableStatement(node) { if (hasSyntacticModifier( @@ -135535,11 +138810,11 @@ ${lanes.join("\n")} )) { const savedExportedVariableStatement = exportedVariableStatement; exportedVariableStatement = true; - const visited = visitEachChild(node, visitor, context); + const visited = visitEachChild(node, visitor, context2); exportedVariableStatement = savedExportedVariableStatement; return visited; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitVariableDeclaration(node) { if (exportedVariableStatement) { @@ -135564,14 +138839,14 @@ ${lanes.join("\n")} return flattenDestructuringBinding( node, visitor, - context, + context2, 1, /*rval*/ void 0, exportedVariableStatement2 ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForStatement(node) { return factory2.updateForStatement( @@ -135579,11 +138854,11 @@ ${lanes.join("\n")} visitNode(node.initializer, visitorWithUnusedExpressionResult, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, visitorWithUnusedExpressionResult, isExpression), - visitIterationBody(node.statement, visitor, context) + visitIterationBody(node.statement, visitor, context2) ); } function visitVoidExpression(node) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } function visitForOfStatement(node, outermostLabeledStatement) { const ancestorFacts = enterSubtree( @@ -135594,7 +138869,7 @@ ${lanes.join("\n")} if (node.initializer.transformFlags & 65536 || isAssignmentPattern(node.initializer) && containsObjectRestOrSpread(node.initializer)) { node = transformForOfStatementWithObjectRest(node); } - const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); + const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context2), outermostLabeledStatement); exitSubtree(ancestorFacts); return result; } @@ -135656,7 +138931,7 @@ ${lanes.join("\n")} statements.push(visitNode(binding, visitor, isStatement)); let bodyLocation; let statementsLocation; - const statement = visitIterationBody(node.statement, visitor, context); + const statement = visitIterationBody(node.statement, visitor, context2); if (isBlock6(statement)) { addRange(statements, statement.statements); bodyLocation = statement; @@ -135682,11 +138957,11 @@ ${lanes.join("\n")} } function transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) { const expression = visitNode(node.expression, visitor, isExpression); - const iterator = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const iterator = isIdentifier28(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); - const result = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( + const result = isIdentifier28(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -135865,7 +139140,7 @@ ${lanes.join("\n")} visitNode(node.initializer, visitor, isExpression) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function collectParametersWithPrecedingObjectRestOrSpread(node) { let parameters; @@ -135886,7 +139161,7 @@ ${lanes.join("\n")} const updated = factory2.updateConstructorDeclaration( node, node.modifiers, - visitParameterList(node.parameters, parameterVisitor, context), + visitParameterList(node.parameters, parameterVisitor, context2), transformFunctionBody2(node) ); enclosingFunctionFlags = savedEnclosingFunctionFlags; @@ -135902,7 +139177,7 @@ ${lanes.join("\n")} node, node.modifiers, visitNode(node.name, visitor, isPropertyName), - visitParameterList(node.parameters, parameterVisitor, context), + visitParameterList(node.parameters, parameterVisitor, context2), /*type*/ void 0, transformFunctionBody2(node) @@ -135920,7 +139195,7 @@ ${lanes.join("\n")} node, node.modifiers, visitNode(node.name, visitor, isPropertyName), - visitParameterList(node.parameters, parameterVisitor, context), + visitParameterList(node.parameters, parameterVisitor, context2), transformFunctionBody2(node) ); enclosingFunctionFlags = savedEnclosingFunctionFlags; @@ -135945,7 +139220,7 @@ ${lanes.join("\n")} ), /*typeParameters*/ void 0, - enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context), + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context2), /*type*/ void 0, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node) @@ -135966,7 +139241,7 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context), + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context2), /*type*/ void 0, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node) @@ -135985,7 +139260,7 @@ ${lanes.join("\n")} node.modifiers, /*typeParameters*/ void 0, - visitParameterList(node.parameters, parameterVisitor, context), + visitParameterList(node.parameters, parameterVisitor, context2), /*type*/ void 0, node.equalsGreaterThanToken, @@ -136007,7 +139282,7 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context), + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context2), /*type*/ void 0, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node) @@ -136018,7 +139293,7 @@ ${lanes.join("\n")} } function transformAsyncGeneratorFunctionParameterList(node) { if (isSimpleParameterList(node.parameters)) { - return visitParameterList(node.parameters, visitor, context); + return visitParameterList(node.parameters, visitor, context2); } const newParameters = []; for (const parameter of node.parameters) { @@ -136043,7 +139318,7 @@ ${lanes.join("\n")} return newParametersArray; } function transformAsyncGeneratorFunctionBody(node) { - const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0; + const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context2) : void 0; resumeLexicalEnvironment(); const savedCapturedSuperProperties = capturedSuperProperties; const savedHasSuperElementAccess = hasSuperElementAccess; @@ -136149,7 +139424,7 @@ ${lanes.join("\n")} const declarations = flattenDestructuringBinding( parameter, visitor, - context, + context2, 0, factory2.getGeneratedNameForNode(parameter) ); @@ -136223,7 +139498,7 @@ ${lanes.join("\n")} const declarations = flattenDestructuringBinding( parameter, visitor, - context, + context2, 1, factory2.getGeneratedNameForNode(parameter), /*hoistTempVariables*/ @@ -136252,39 +139527,39 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution( + context2.enableSubstitution( 214 /* CallExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 212 /* PropertyAccessExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 213 /* ElementAccessExpression */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 264 /* ClassDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 175 /* MethodDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 178 /* GetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 179 /* SetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 177 /* Constructor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 244 /* VariableStatement */ ); @@ -136363,7 +139638,7 @@ ${lanes.join("\n")} function substituteCallExpression(node) { const expression = node.expression; if (isSuperProperty(expression)) { - const argumentExpression = isPropertyAccessExpression16(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + const argumentExpression = isPropertyAccessExpression17(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return factory2.createCallExpression( factory2.createPropertyAccessExpression(argumentExpression, "call"), /*typeArguments*/ @@ -136407,14 +139682,14 @@ ${lanes.join("\n")} } } } - function transformES2019(context) { - const factory2 = context.factory; - return chainBundle(context, transformSourceFile); + function transformES2019(context2) { + const factory2 = context2.factory; + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { if ((node.transformFlags & 64) === 0) { @@ -136424,7 +139699,7 @@ ${lanes.join("\n")} case 300: return visitCatchClause(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitCatchClause(node) { @@ -136438,20 +139713,20 @@ ${lanes.join("\n")} visitNode(node.block, visitor, isBlock6) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } - function transformES2020(context) { + function transformES2020(context2) { const { factory: factory2, hoistVariableDeclaration - } = context; - return chainBundle(context, transformSourceFile); + } = context2; + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { if ((node.transformFlags & 32) === 0) { @@ -136480,16 +139755,16 @@ ${lanes.join("\n")} Debug.assertNotNode(updated, isSyntheticReference); return updated; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 227: if (node.operatorToken.kind === 61) { return transformNullishCoalescingExpression(node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); case 221: return visitDeleteExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function flattenChain(chain) { @@ -136524,7 +139799,7 @@ ${lanes.join("\n")} thisArg = expression; } } - expression = node.kind === 212 ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier26)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); + expression = node.kind === 212 ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier28)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); return thisArg ? factory2.createSyntheticReferenceExpression(expression, thisArg) : expression; } function visitNonOptionalCallExpression(node, captureThisArg) { @@ -136536,7 +139811,7 @@ ${lanes.join("\n")} false ); } - if (isParenthesizedExpression7(node.expression) && isOptionalChain2(skipParentheses(node.expression))) { + if (isParenthesizedExpression8(node.expression) && isOptionalChain2(skipParentheses(node.expression))) { const expression = visitNonOptionalParenthesizedExpression( node.expression, /*captureThisArg*/ @@ -136556,7 +139831,7 @@ ${lanes.join("\n")} args ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { @@ -136606,7 +139881,7 @@ ${lanes.join("\n")} thisArg = rightExpression; } } - rightExpression = segment.kind === 212 ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier26)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); + rightExpression = segment.kind === 212 ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier28)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); break; case 214: if (i === 0 && leftThisArg) { @@ -136719,17 +139994,17 @@ ${lanes.join("\n")} ), node) : factory2.updateDeleteExpression(node, visitNode(node.expression, visitor, isExpression)); } } - function transformES2021(context) { + function transformES2021(context2) { const { hoistVariableDeclaration, factory: factory2 - } = context; - return chainBundle(context, transformSourceFile); + } = context2; + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { if ((node.transformFlags & 16) === 0) { @@ -136738,7 +140013,7 @@ ${lanes.join("\n")} if (isLogicalOrCoalescingAssignmentExpression(node)) { return transformLogicalAssignment(node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformLogicalAssignment(binaryExpression) { const operator = binaryExpression.operatorToken; @@ -136753,7 +140028,7 @@ ${lanes.join("\n")} propertyAccessTarget, left.expression ); - if (isPropertyAccessExpression16(left)) { + if (isPropertyAccessExpression17(left)) { assignmentTarget = factory2.createPropertyAccessExpression( propertyAccessTarget, left.name @@ -136790,25 +140065,25 @@ ${lanes.join("\n")} ); } } - function transformESNext(context) { + function transformESNext(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, hoistVariableDeclaration, startLexicalEnvironment, endLexicalEnvironment - } = context; + } = context2; let exportBindings; let exportVars; let defaultExportBinding; let exportEqualsBinding; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } const visited = visitNode(node, visitor, isSourceFile); - addEmitHelpers(visited, context.readEmitHelpers()); + addEmitHelpers(visited, context2.readEmitHelpers()); exportVars = void 0; exportBindings = void 0; defaultExportBinding = void 0; @@ -136830,7 +140105,7 @@ ${lanes.join("\n")} case 256: return visitSwitchStatement(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitSourceFile(node) { @@ -136899,7 +140174,7 @@ ${lanes.join("\n")} } return factory2.updateSourceFile(node, topLevelStatements); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitBlock(node) { const usingKind = getUsingKindOfStatements(node.statements); @@ -136926,7 +140201,7 @@ ${lanes.join("\n")} ] ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForStatement(node) { if (node.initializer && isUsingVariableDeclarationList(node.initializer)) { @@ -136950,7 +140225,7 @@ ${lanes.join("\n")} isStatement ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForOfStatement(node) { if (isUsingVariableDeclarationList(node.initializer)) { @@ -137008,7 +140283,7 @@ ${lanes.join("\n")} isStatement ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCaseOrDefaultClause(node, envBinding) { if (getUsingKindOfStatements(node.statements) !== 0) { @@ -137041,7 +140316,7 @@ ${lanes.join("\n")} ); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitSwitchStatement(node) { const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses); @@ -137063,7 +140338,7 @@ ${lanes.join("\n")} /* Async */ ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) { const statements = []; @@ -137071,15 +140346,15 @@ ${lanes.join("\n")} const statement = statementsIn[i]; const usingKind = getUsingKind(statement); if (usingKind) { - Debug.assertNode(statement, isVariableStatement11); + Debug.assertNode(statement, isVariableStatement12); const declarations = []; for (let declaration of statement.declarationList.declarations) { - if (!isIdentifier26(declaration.name)) { + if (!isIdentifier28(declaration.name)) { declarations.length = 0; break; } if (isNamedEvaluation(declaration)) { - declaration = transformNamedEvaluation(context, declaration); + declaration = transformNamedEvaluation(context2, declaration); } const initializer3 = visitNode(declaration.initializer, visitor, isExpression) ?? factory2.createVoidZero(); declarations.push(factory2.updateVariableDeclaration( @@ -137171,7 +140446,7 @@ ${lanes.join("\n")} let innerExpression = skipOuterExpressions(expression); if (isNamedEvaluation(innerExpression)) { innerExpression = transformNamedEvaluation( - context, + context2, innerExpression, /*ignoreEmptyStringLiteral*/ false, @@ -137221,7 +140496,7 @@ ${lanes.join("\n")} expression = factory2.createAssignment(factory2.getDeclarationName(node), expression); if (isNamedEvaluation(expression)) { expression = transformNamedEvaluation( - context, + context2, expression, /*ignoreEmptyStringLiteral*/ false @@ -137247,7 +140522,7 @@ ${lanes.join("\n")} expression = factory2.createAssignment(defaultExportBinding, expression); if (isNamedEvaluation(expression)) { expression = transformNamedEvaluation( - context, + context2, expression, /*ignoreEmptyStringLiteral*/ false, @@ -137283,7 +140558,7 @@ ${lanes.join("\n")} function hoistInitializedVariable(node) { Debug.assertIsDefined(node.initializer); let target; - if (isIdentifier26(node.name)) { + if (isIdentifier28(node.name)) { target = factory2.cloneNode(node.name); setEmitFlags(target, getEmitFlags(target) & ~(32768 | 16384 | 65536)); } else { @@ -137456,7 +140731,7 @@ ${lanes.join("\n")} return getUsingKindOfVariableDeclarationList(node.declarationList); } function getUsingKind(statement) { - return isVariableStatement11(statement) ? getUsingKindOfVariableStatement(statement) : 0; + return isVariableStatement12(statement) ? getUsingKindOfVariableStatement(statement) : 0; } function getUsingKindOfStatements(statements) { let result = 0; @@ -137476,15 +140751,15 @@ ${lanes.join("\n")} } return result; } - function transformJsx(context) { + function transformJsx(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers - } = context; - const compilerOptions = context.getCompilerOptions(); + } = context2; + const compilerOptions = context2.getCompilerOptions(); let currentSourceFile; let currentFileState; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function getCurrentFileNameExpression() { if (currentFileState.filenameDeclaration) { return currentFileState.filenameDeclaration.name; @@ -137551,8 +140826,8 @@ ${lanes.join("\n")} currentSourceFile = node; currentFileState = {}; currentFileState.importSpecifier = getJSXImplicitImportBase(compilerOptions, node); - let visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + let visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); let statements = visited.statements; if (currentFileState.filenameDeclaration) { statements = insertStatementAfterCustomPrologue(statements.slice(), factory2.createVariableStatement( @@ -137663,7 +140938,7 @@ ${lanes.join("\n")} case 295: return visitJsxExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function transformJsxChildToExpression(node) { @@ -137696,15 +140971,15 @@ ${lanes.join("\n")} } function hasProto(obj) { return obj.properties.some( - (p) => isPropertyAssignment11(p) && (isIdentifier26(p.name) && idText(p.name) === "__proto__" || isStringLiteral15(p.name) && p.name.text === "__proto__") + (p) => isPropertyAssignment12(p) && (isIdentifier28(p.name) && idText(p.name) === "__proto__" || isStringLiteral15(p.name) && p.name.text === "__proto__") ); } function hasKeyAfterPropsSpread(node) { let spread = false; for (const elem of node.attributes.properties) { - if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression12(elem.expression) || elem.expression.properties.some(isSpreadAssignment6))) { + if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression13(elem.expression) || elem.expression.properties.some(isSpreadAssignment7))) { spread = true; - } else if (spread && isJsxAttribute(elem) && isIdentifier26(elem.name) && elem.name.escapedText === "key") { + } else if (spread && isJsxAttribute(elem) && isIdentifier28(elem.name) && elem.name.escapedText === "key") { return true; } } @@ -137760,7 +141035,7 @@ ${lanes.join("\n")} function visitJsxOpeningLikeElementJSX(node, children, isChild, location) { const tagName = getTagName(node); const childrenProp = children && children.length ? convertJsxChildrenToChildrenPropAssignment(children) : void 0; - const keyAttr = find(node.attributes.properties, (p) => !!p.name && isIdentifier26(p.name) && p.name.escapedText === "key"); + const keyAttr = find(node.attributes.properties, (p) => !!p.name && isIdentifier28(p.name) && p.name.escapedText === "key"); const attrs = keyAttr ? filter(node.attributes.properties, (p) => p !== keyAttr) : node.attributes.properties; const objectProperties = length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) : factory2.createObjectLiteralExpression(childrenProp ? [childrenProp] : emptyArray); return visitJsxOpeningLikeElementOrFragmentJSX( @@ -137816,7 +141091,7 @@ ${lanes.join("\n")} const objectProperties = length(attrs) ? transformJsxAttributesToObjectProps(attrs) : factory2.createNull(); const callee = currentFileState.importSpecifier === void 0 ? createJsxFactoryExpression( factory2, - context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), + context2.getEmitResolver().getJsxFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217 node @@ -137855,8 +141130,8 @@ ${lanes.join("\n")} function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) { const element = createExpressionForJsxFragment( factory2, - context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), - context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), + context2.getEmitResolver().getJsxFactoryEntity(currentSourceFile), + context2.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217 mapDefined(children, transformJsxChildToExpression), @@ -137869,7 +141144,7 @@ ${lanes.join("\n")} return element; } function transformJsxSpreadAttributeToProps(node) { - if (isObjectLiteralExpression12(node.expression) && !hasProto(node.expression)) { + if (isObjectLiteralExpression13(node.expression) && !hasProto(node.expression)) { return sameMap(node.expression.properties, (p) => Debug.checkDefined(visitNode(p, visitor, isObjectLiteralElementLike))); } return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression))); @@ -137890,9 +141165,9 @@ ${lanes.join("\n")} let properties = []; for (const attr of attrs) { if (isJsxSpreadAttribute(attr)) { - if (isObjectLiteralExpression12(attr.expression) && !hasProto(attr.expression)) { + if (isObjectLiteralExpression13(attr.expression) && !hasProto(attr.expression)) { for (const prop of attr.expression.properties) { - if (isSpreadAssignment6(prop)) { + if (isSpreadAssignment7(prop)) { finishObjectLiteralIfNeeded(); expressions.push(Debug.checkDefined(visitNode(prop.expression, visitor, isExpression))); continue; @@ -137911,7 +141186,7 @@ ${lanes.join("\n")} properties.push(children); } finishObjectLiteralIfNeeded(); - if (expressions.length && !isObjectLiteralExpression12(expressions[0])) { + if (expressions.length && !isObjectLiteralExpression13(expressions[0])) { expressions.unshift(factory2.createObjectLiteralExpression()); } return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions); @@ -138014,7 +141289,7 @@ ${lanes.join("\n")} return getTagName(node.openingElement); } else { const tagName = node.tagName; - if (isIdentifier26(tagName) && isIntrinsicJsxName(tagName.escapedText)) { + if (isIdentifier28(tagName) && isIntrinsicJsxName(tagName.escapedText)) { return factory2.createStringLiteral(idText(tagName)); } else if (isJsxNamespacedName(tagName)) { return factory2.createStringLiteral(idText(tagName.namespace) + ":" + idText(tagName.name)); @@ -138025,7 +141300,7 @@ ${lanes.join("\n")} } function getAttributeName(node) { const name = node.name; - if (isIdentifier26(name)) { + if (isIdentifier28(name)) { const text = idText(name); return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text); } @@ -138291,17 +141566,17 @@ ${lanes.join("\n")} hearts: 9829, diams: 9830 })); - function transformES2016(context) { + function transformES2016(context2) { const { factory: factory2, hoistVariableDeclaration - } = context; - return chainBundle(context, transformSourceFile); + } = context2; + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { if ((node.transformFlags & 512) === 0) { @@ -138311,7 +141586,7 @@ ${lanes.join("\n")} case 227: return visitBinaryExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitBinaryExpression(node) { @@ -138321,7 +141596,7 @@ ${lanes.join("\n")} case 43: return visitExponentiationExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitExponentiationAssignmentExpression(node) { @@ -138346,7 +141621,7 @@ ${lanes.join("\n")} ), left ); - } else if (isPropertyAccessExpression16(left)) { + } else if (isPropertyAccessExpression17(left)) { const expressionTemp = factory2.createTempVariable(hoistVariableDeclaration); target = setTextRange( factory2.createPropertyAccessExpression( @@ -138383,7 +141658,7 @@ ${lanes.join("\n")} function createSpreadSegment(kind, expression) { return { kind, expression }; } - function transformES2015(context) { + function transformES2015(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, @@ -138391,13 +141666,13 @@ ${lanes.join("\n")} resumeLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const compilerOptions = context.getCompilerOptions(); - const resolver = context.getEmitResolver(); - const previousOnSubstituteNode = context.onSubstituteNode; - const previousOnEmitNode = context.onEmitNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; + } = context2; + const compilerOptions = context2.getCompilerOptions(); + const resolver = context2.getEmitResolver(); + const previousOnSubstituteNode = context2.onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + context2.onEmitNode = onEmitNode; + context2.onSubstituteNode = onSubstituteNode; let currentSourceFile; let currentText; let hierarchyFacts; @@ -138410,7 +141685,7 @@ ${lanes.join("\n")} } let convertedLoopState; let enabledSubstitutions = 0; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; @@ -138418,7 +141693,7 @@ ${lanes.join("\n")} currentSourceFile = node; currentText = node.text; const visited = visitSourceFile(node); - addEmitHelpers(visited, context.readEmitHelpers()); + addEmitHelpers(visited, context2.readEmitHelpers()); currentSourceFile = void 0; currentText = void 0; taggedTemplateStringDeclarations = void 0; @@ -138628,7 +141903,7 @@ ${lanes.join("\n")} case 223: return visitVoidExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitSourceFile(node) { @@ -138674,11 +141949,11 @@ ${lanes.join("\n")} if (convertedLoopState !== void 0) { const savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps |= 2; - const result = visitEachChild(node, visitor, context); + const result = visitEachChild(node, visitor, context2); convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; return result; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCaseBlock(node) { const ancestorFacts = enterSubtree( @@ -138686,7 +141961,7 @@ ${lanes.join("\n")} 0 /* BlockScopeIncludes */ ); - const updated = visitEachChild(node, visitor, context); + const updated = visitEachChild(node, visitor, context2); exitSubtree( ancestorFacts, 0, @@ -138724,7 +141999,7 @@ ${lanes.join("\n")} } else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { return returnCapturedThis(node); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitThisKeyword(node) { hierarchyFacts |= 65536; @@ -138741,7 +142016,7 @@ ${lanes.join("\n")} return node; } function visitVoidExpression(node) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } function visitIdentifier(node) { if (convertedLoopState) { @@ -138817,7 +142092,7 @@ ${lanes.join("\n")} return factory2.createReturnStatement(returnExpression); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitClassDeclaration(node) { const variable = factory2.createVariableDeclaration( @@ -139015,7 +142290,7 @@ ${lanes.join("\n")} convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { - return visitParameterList(constructor && !hasSynthesizedSuper ? constructor.parameters : void 0, visitor, context) || []; + return visitParameterList(constructor && !hasSynthesizedSuper ? constructor.parameters : void 0, visitor, context2) || []; } function createDefaultConstructorBody(node, isDerivedClass) { const statements = []; @@ -139040,7 +142315,7 @@ ${lanes.join("\n")} return block2; } function isUninitializedVariableStatement(node) { - return isVariableStatement11(node) && every(node.declarationList.declarations, (decl) => isIdentifier26(decl.name) && !decl.initializer); + return isVariableStatement12(node) && every(node.declarationList.declarations, (decl) => isIdentifier28(decl.name) && !decl.initializer); } function containsSuperCall(node) { if (isSuperCall(node)) { @@ -139124,7 +142399,7 @@ ${lanes.join("\n")} return isGeneratedIdentifier(node) && idText(node) === "_super"; } function isThisCapturingVariableStatement(node) { - return isVariableStatement11(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]); + return isVariableStatement12(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]); } function isThisCapturingVariableDeclaration(node) { return isVariableDeclaration7(node) && isCapturedThis(node.name) && !!node.initializer; @@ -139137,7 +142412,7 @@ ${lanes.join("\n")} ) && isCapturedThis(node.left); } function isTransformedSuperCall(node) { - return isCallExpression16(node) && isPropertyAccessExpression16(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier26(node.expression.name) && (idText(node.expression.name) === "call" || idText(node.expression.name) === "apply") && node.arguments.length >= 1 && node.arguments[0].kind === 110; + return isCallExpression16(node) && isPropertyAccessExpression17(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier28(node.expression.name) && (idText(node.expression.name) === "call" || idText(node.expression.name) === "apply") && node.arguments.length >= 1 && node.arguments[0].kind === 110; } function isTransformedSuperCallWithFallback(node) { return isBinaryExpression4(node) && node.operatorToken.kind === 57 && node.right.kind === 110 && isTransformedSuperCall(node.left); @@ -139309,7 +142584,7 @@ ${lanes.join("\n")} return factory2.updateBlock(body, visitNodes2(body.statements, elideUnusedThisCaptureWorker, isStatement)); } function injectSuperPresenceCheckWorker(node) { - if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier26(node.arguments[1]) && idText(node.arguments[1]) === "arguments") { + if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier28(node.arguments[1]) && idText(node.arguments[1]) === "arguments") { return factory2.createLogicalAnd( factory2.createStrictInequality( createSyntheticSuper(), @@ -139489,7 +142764,7 @@ ${lanes.join("\n")} flattenDestructuringBinding( parameter, visitor, - context, + context2, 0, factory2.getGeneratedNameForNode(parameter) ) @@ -139663,7 +142938,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, factory2.createVariableDeclarationList( - flattenDestructuringBinding(parameter, visitor, context, 0, expressionName) + flattenDestructuringBinding(parameter, visitor, context2, 0, expressionName) ) ), parameter @@ -139834,8 +143109,8 @@ ${lanes.join("\n")} const propertyName = visitNode(member.name, visitor, isPropertyName); Debug.assert(propertyName); let e; - if (!isPrivateIdentifier(propertyName) && getUseDefineForClassFields(context.getCompilerOptions())) { - const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier26(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + if (!isPrivateIdentifier(propertyName) && getUseDefineForClassFields(context2.getCompilerOptions())) { + const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier28(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; e = factory2.createObjectDefinePropertyCall(receiver, name, factory2.createPropertyDescriptor({ value: memberFunction, enumerable: false, writable: true, configurable: true })); } else { const memberName = createMemberAccessForPropertyName( @@ -139985,7 +143260,7 @@ ${lanes.join("\n")} void 0, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, transformFunctionBody2(node) @@ -140018,7 +143293,7 @@ ${lanes.join("\n")} ); const savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; - const parameters = visitParameterList(node.parameters, visitor, context); + const parameters = visitParameterList(node.parameters, visitor, context2); const body = transformFunctionBody2(node); const name = hierarchyFacts & 32768 ? factory2.getLocalName(node) : node.name; exitSubtree( @@ -140050,7 +143325,7 @@ ${lanes.join("\n")} 65 /* FunctionIncludes */ ); - const parameters = visitParameterList(node.parameters, visitor, context); + const parameters = visitParameterList(node.parameters, visitor, context2); const body = transformFunctionBody2(node); const name = hierarchyFacts & 32768 ? factory2.getLocalName(node) : node.name; exitSubtree( @@ -140085,7 +143360,7 @@ ${lanes.join("\n")} 65 /* FunctionIncludes */ ); - const parameters = visitParameterList(node.parameters, visitor, context); + const parameters = visitParameterList(node.parameters, visitor, context2); const body = transformFunctionBody2(node); if (hierarchyFacts & 32768 && !name && (node.kind === 263 || node.kind === 219)) { name = factory2.getGeneratedNameForNode(node); @@ -140205,7 +143480,7 @@ ${lanes.join("\n")} } function visitBlock(node, isFunctionBody2) { if (isFunctionBody2) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } const ancestorFacts = hierarchyFacts & 256 ? enterSubtree( 7104, @@ -140216,7 +143491,7 @@ ${lanes.join("\n")} 128 /* BlockIncludes */ ); - const updated = visitEachChild(node, visitor, context); + const updated = visitEachChild(node, visitor, context2); exitSubtree( ancestorFacts, 0, @@ -140226,17 +143501,17 @@ ${lanes.join("\n")} return updated; } function visitExpressionStatement(node) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } function visitParenthesizedExpression(node, expressionResultIsUnused2) { - return visitEachChild(node, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, context); + return visitEachChild(node, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, context2); } function visitBinaryExpression(node, expressionResultIsUnused2) { if (isDestructuringAssignment(node)) { return flattenDestructuringAssignment( node, visitor, - context, + context2, 0, !expressionResultIsUnused2 ); @@ -140249,11 +143524,11 @@ ${lanes.join("\n")} Debug.checkDefined(visitNode(node.right, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, isExpression)) ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCommaListExpression(node, expressionResultIsUnused2) { if (expressionResultIsUnused2) { - return visitEachChild(node, visitorWithUnusedExpressionResult, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context2); } let result; for (let i = 0; i < node.elements.length; i++) { @@ -140292,7 +143567,7 @@ ${lanes.join("\n")} assignment = flattenDestructuringAssignment( decl, visitor, - context, + context2, 0 /* All */ ); @@ -140309,7 +143584,7 @@ ${lanes.join("\n")} updated = void 0; } } else { - updated = visitEachChild(node, visitor, context); + updated = visitEachChild(node, visitor, context2); } exitSubtree( ancestorFacts, @@ -140338,7 +143613,7 @@ ${lanes.join("\n")} } return declarationList; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function getRangeUnion(declarations) { let pos = -1, end = -1; @@ -140379,7 +143654,7 @@ ${lanes.join("\n")} factory2.createVoidZero() ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitVariableDeclaration(node) { const ancestorFacts = enterSubtree( @@ -140392,14 +143667,14 @@ ${lanes.join("\n")} updated = flattenDestructuringBinding( node, visitor, - context, + context2, 0, /*rval*/ void 0, (ancestorFacts & 32) !== 0 ); } else { - updated = visitEachChild(node, visitor, context); + updated = visitEachChild(node, visitor, context2); } exitSubtree( ancestorFacts, @@ -140508,7 +143783,7 @@ ${lanes.join("\n")} const declarations = flattenDestructuringBinding( firstOriginalDeclaration, visitor, - context, + context2, 0, boundValue ); @@ -140593,7 +143868,7 @@ ${lanes.join("\n")} const expression = visitNode(node.expression, visitor, isExpression); Debug.assert(expression); const counter = factory2.createLoopVariable(); - const rhsReference = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const rhsReference = isIdentifier28(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -140657,11 +143932,11 @@ ${lanes.join("\n")} function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) { const expression = visitNode(node.expression, visitor, isExpression); Debug.assert(expression); - const iterator = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const iterator = isIdentifier28(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); - const result = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( + const result = isIdentifier28(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -140812,7 +144087,7 @@ ${lanes.join("\n")} } } if (numInitialProperties < 0) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } const temp = factory2.createTempVariable(hoistVariableDeclaration); const expressions = []; @@ -140891,7 +144166,7 @@ ${lanes.join("\n")} void 0, ancestorFacts ) : factory2.restoreEnclosingLabel( - isForStatement(node) ? visitEachChildOfForStatement2(node) : visitEachChild(node, visitor, context), + isForStatement(node) ? visitEachChildOfForStatement2(node) : visitEachChild(node, visitor, context2), outermostLabeledStatement, convertedLoopState && resetLabel ); @@ -141550,7 +144825,7 @@ ${lanes.join("\n")} const vars = flattenDestructuringBinding( node.variableDeclaration, visitor, - context, + context2, 0, temp ); @@ -141563,7 +144838,7 @@ ${lanes.join("\n")} ); updated = factory2.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); } else { - updated = visitEachChild(node, visitor, context); + updated = visitEachChild(node, visitor, context2); } exitSubtree( ancestorFacts, @@ -141608,7 +144883,7 @@ ${lanes.join("\n")} /* FunctionIncludes */ ); let updated; - const parameters = visitParameterList(node.parameters, visitor, context); + const parameters = visitParameterList(node.parameters, visitor, context2); const body = transformFunctionBody2(node); if (node.kind === 178) { updated = factory2.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); @@ -141635,10 +144910,10 @@ ${lanes.join("\n")} ); } function visitComputedPropertyName(node) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitYieldExpression(node) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitArrayLiteralExpression(node) { if (some(node.elements, isSpreadElement5)) { @@ -141651,7 +144926,7 @@ ${lanes.join("\n")} !!node.elements.hasTrailingComma ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCallExpression(node) { if (getInternalEmitFlags(node) & 1) { @@ -141675,14 +144950,14 @@ ${lanes.join("\n")} } function visitTypeScriptClassWrapper(node) { const body = cast(cast(skipOuterExpressions(node.expression), isArrowFunction8).body, isBlock6); - const isVariableStatementWithInitializer = (stmt) => isVariableStatement11(stmt) && !!first(stmt.declarationList.declarations).initializer; + const isVariableStatementWithInitializer = (stmt) => isVariableStatement12(stmt) && !!first(stmt.declarationList.declarations).initializer; const savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; const bodyStatements = visitNodes2(body.statements, classWrapperStatementVisitor, isStatement); convertedLoopState = savedConvertedLoopState; const classStatements = filter(bodyStatements, isVariableStatementWithInitializer); const remainingStatements = filter(bodyStatements, (stmt) => !isVariableStatementWithInitializer(stmt)); - const varStatement = cast(first(classStatements), isVariableStatement11); + const varStatement = cast(first(classStatements), isVariableStatement12); const variable = varStatement.declarationList.declarations[0]; const initializer3 = skipOuterExpressions(variable.initializer); let aliasAssignment = tryCast(initializer3, isAssignmentExpression); @@ -141707,7 +144982,7 @@ ${lanes.join("\n")} factory2.createExpressionStatement( factory2.createAssignment( aliasAssignment.left, - cast(variable.name, isIdentifier26) + cast(variable.name, isIdentifier28) ) ) ); @@ -141721,7 +144996,7 @@ ${lanes.join("\n")} } const returnStatement = tryCast(elementAt(funcStatements, classBodyEnd), isReturnStatement4); for (const statement of remainingStatements) { - if (isReturnStatement4(statement) && (returnStatement == null ? void 0 : returnStatement.expression) && !isIdentifier26(returnStatement.expression)) { + if (isReturnStatement4(statement) && (returnStatement == null ? void 0 : returnStatement.expression) && !isIdentifier28(returnStatement.expression)) { statements.push(returnStatement); } else { statements.push(statement); @@ -141817,7 +145092,7 @@ ${lanes.join("\n")} if (isSuperCall(node)) { hierarchyFacts |= 131072; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitNewExpression(node) { if (some(node.arguments, isSpreadElement5)) { @@ -141841,7 +145116,7 @@ ${lanes.join("\n")} [] ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformAndSpreadElements(elements, isArgumentList, multiLine, hasTrailingComma) { const numElements = elements.length; @@ -141919,7 +145194,7 @@ ${lanes.join("\n")} } function visitTaggedTemplateExpression(node) { return processTaggedTemplateExpression( - context, + context2, node, visitor, currentSourceFile, @@ -141990,7 +145265,7 @@ ${lanes.join("\n")} function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -141999,35 +145274,35 @@ ${lanes.join("\n")} function enableSubstitutionsForCapturedThis() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution( + context2.enableSubstitution( 110 /* ThisKeyword */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 177 /* Constructor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 175 /* MethodDeclaration */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 178 /* GetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 179 /* SetAccessor */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 220 /* ArrowFunction */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 219 /* FunctionExpression */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 263 /* FunctionDeclaration */ ); @@ -142038,14 +145313,14 @@ ${lanes.join("\n")} if (hint === 1) { return substituteExpression(node); } - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { return substituteIdentifier(node); } return node; } function substituteIdentifier(node) { if (enabledSubstitutions & 2 && !isInternalName(node)) { - const original = getParseTreeNode(node, isIdentifier26); + const original = getParseTreeNode(node, isIdentifier28); if (original && isNameOfDeclarationWithCollidingName(original)) { return setTextRange(factory2.getGeneratedNameForNode(original), node); } @@ -142130,7 +145405,7 @@ ${lanes.join("\n")} return false; } const expression = callArgument.expression; - return isIdentifier26(expression) && expression.escapedText === "arguments"; + return isIdentifier28(expression) && expression.escapedText === "arguments"; } } function getInstructionName(instruction) { @@ -142149,7 +145424,7 @@ ${lanes.join("\n")} return void 0; } } - function transformGenerators(context) { + function transformGenerators(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers, @@ -142157,12 +145432,12 @@ ${lanes.join("\n")} endLexicalEnvironment, hoistFunctionDeclaration, hoistVariableDeclaration - } = context; - const compilerOptions = context.getCompilerOptions(); + } = context2; + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - const resolver = context.getEmitResolver(); - const previousOnSubstituteNode = context.onSubstituteNode; - context.onSubstituteNode = onSubstituteNode; + const resolver = context2.getEmitResolver(); + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onSubstituteNode = onSubstituteNode; let renamedCatchVariables; let renamedCatchVariableDeclarations; let inGeneratorFunctionBody; @@ -142188,13 +145463,13 @@ ${lanes.join("\n")} let exceptionBlockStack; let currentExceptionBlock; let withBlockStack; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile || (node.transformFlags & 2048) === 0) { return node; } - const visited = visitEachChild(node, visitor, context); - addEmitHelpers(visited, context.readEmitHelpers()); + const visited = visitEachChild(node, visitor, context2); + addEmitHelpers(visited, context2.readEmitHelpers()); return visited; } function visitor(node) { @@ -142206,7 +145481,7 @@ ${lanes.join("\n")} } else if (isFunctionLikeDeclaration(node) && node.asteriskToken) { return visitGenerator(node); } else if (transformFlags & 2048) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } else { return node; } @@ -142250,7 +145525,7 @@ ${lanes.join("\n")} if (node.transformFlags & 1048576) { return visitJavaScriptContainingYield(node); } else if (node.transformFlags & (2048 | 4194304)) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } else { return node; } @@ -142277,7 +145552,7 @@ ${lanes.join("\n")} case 215: return visitNewExpression(node); default: - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitGenerator(node) { @@ -142301,7 +145576,7 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, transformGeneratorFunctionBody(node.body) @@ -142316,7 +145591,7 @@ ${lanes.join("\n")} const savedInStatementContainingYield = inStatementContainingYield; inGeneratorFunctionBody = false; inStatementContainingYield = false; - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); inGeneratorFunctionBody = savedInGeneratorFunctionBody; inStatementContainingYield = savedInStatementContainingYield; } @@ -142339,7 +145614,7 @@ ${lanes.join("\n")} node.name, /*typeParameters*/ void 0, - visitParameterList(node.parameters, visitor, context), + visitParameterList(node.parameters, visitor, context2), /*type*/ void 0, transformGeneratorFunctionBody(node.body) @@ -142354,7 +145629,7 @@ ${lanes.join("\n")} const savedInStatementContainingYield = inStatementContainingYield; inGeneratorFunctionBody = false; inStatementContainingYield = false; - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); inGeneratorFunctionBody = savedInGeneratorFunctionBody; inStatementContainingYield = savedInStatementContainingYield; } @@ -142365,7 +145640,7 @@ ${lanes.join("\n")} const savedInStatementContainingYield = inStatementContainingYield; inGeneratorFunctionBody = false; inStatementContainingYield = false; - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); inGeneratorFunctionBody = savedInGeneratorFunctionBody; inStatementContainingYield = savedInStatementContainingYield; return node; @@ -142503,7 +145778,7 @@ ${lanes.join("\n")} return factory2.updateBinaryExpression(node, target, node.operatorToken, Debug.checkDefined(visitNode(right, visitor, isExpression))); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitLeftAssociativeBinaryExpression(node) { if (containsYield(node.right)) { @@ -142514,7 +145789,7 @@ ${lanes.join("\n")} } return factory2.updateBinaryExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))), node.operatorToken, Debug.checkDefined(visitNode(node.right, visitor, isExpression))); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCommaExpression(node) { let pendingExpressions = []; @@ -142610,7 +145885,7 @@ ${lanes.join("\n")} markLabel(resultLabel); return resultLocal; } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitYieldExpression(node) { const resumeLabel = defineLabel(); @@ -142722,7 +145997,7 @@ ${lanes.join("\n")} if (containsYield(node.argumentExpression)) { return factory2.updateElementAccessExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))), Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitCallExpression(node) { if (!isImportCall(node) && forEach(node.arguments, containsYield)) { @@ -142745,7 +146020,7 @@ ${lanes.join("\n")} node ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitNewExpression(node) { if (forEach(node.arguments, containsYield)) { @@ -142771,7 +146046,7 @@ ${lanes.join("\n")} node ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformAndEmitStatements(statements2, start = 0) { const numStatements = statements2.length; @@ -142920,11 +146195,11 @@ ${lanes.join("\n")} function visitDoStatement(node) { if (inStatementContainingYield) { beginScriptLoopBlock(); - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); endLoopBlock(); return node; } else { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function transformAndEmitWhileStatement(node) { @@ -142943,11 +146218,11 @@ ${lanes.join("\n")} function visitWhileStatement(node) { if (inStatementContainingYield) { beginScriptLoopBlock(); - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); endLoopBlock(); return node; } else { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function transformAndEmitForStatement(node) { @@ -143007,10 +146282,10 @@ ${lanes.join("\n")} variables.length > 0 ? factory2.inlineExpressions(map2(variables, transformInitializedVariable)) : void 0, visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, visitor, isExpression), - visitIterationBody(node.statement, visitor, context) + visitIterationBody(node.statement, visitor, context2) ); } else { - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); } if (inStatementContainingYield) { endLoopBlock(); @@ -143080,7 +146355,7 @@ ${lanes.join("\n")} } node = factory2.updateForInStatement(node, initializer3.declarations[0].name, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))); } else { - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); } if (inStatementContainingYield) { endLoopBlock(); @@ -143110,7 +146385,7 @@ ${lanes.join("\n")} ); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformAndEmitBreakStatement(node) { const label = findBreakTarget(node.label ? idText(node.label) : void 0); @@ -143135,7 +146410,7 @@ ${lanes.join("\n")} ); } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function transformAndEmitReturnStatement(node) { emitReturn( @@ -143229,7 +146504,7 @@ ${lanes.join("\n")} if (inStatementContainingYield) { beginScriptSwitchBlock(); } - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); if (inStatementContainingYield) { endSwitchBlock(); } @@ -143248,7 +146523,7 @@ ${lanes.join("\n")} if (inStatementContainingYield) { beginScriptLabeledBlock(idText(node.label)); } - node = visitEachChild(node, visitor, context); + node = visitEachChild(node, visitor, context2); if (inStatementContainingYield) { endLabeledBlock(); } @@ -143275,7 +146550,7 @@ ${lanes.join("\n")} } endExceptionBlock(); } else { - emitStatement(visitEachChild(node, visitor, context)); + emitStatement(visitEachChild(node, visitor, context2)); } } function containsYield(node) { @@ -143298,7 +146573,7 @@ ${lanes.join("\n")} return node; } function substituteExpression(node) { - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { return substituteExpressionIdentifier(node); } return node; @@ -143306,7 +146581,7 @@ ${lanes.join("\n")} function substituteExpressionIdentifier(node) { if (!isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(idText(node))) { const original = getOriginalNode(node); - if (isIdentifier26(original) && original.parent) { + if (isIdentifier28(original) && original.parent) { const declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { const name = renamedCatchVariableDeclarations[getOriginalNodeId(declaration)]; @@ -143433,7 +146708,7 @@ ${lanes.join("\n")} if (!renamedCatchVariables) { renamedCatchVariables = /* @__PURE__ */ new Map(); renamedCatchVariableDeclarations = []; - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -144199,7 +147474,7 @@ ${lanes.join("\n")} ); } } - function transformModule(context) { + function transformModule(context2) { function getTransformModuleDelegate(moduleKind2) { switch (moduleKind2) { case 2: @@ -144216,37 +147491,37 @@ ${lanes.join("\n")} startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const compilerOptions = context.getCompilerOptions(); - const resolver = context.getEmitResolver(); - const host = context.getEmitHost(); + } = context2; + const compilerOptions = context2.getCompilerOptions(); + const resolver = context2.getEmitResolver(); + const host = context2.getEmitHost(); const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); - const previousOnSubstituteNode = context.onSubstituteNode; - const previousOnEmitNode = context.onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.onEmitNode = onEmitNode; - context.enableSubstitution( + const previousOnSubstituteNode = context2.onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + context2.onSubstituteNode = onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.enableSubstitution( 214 /* CallExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 216 /* TaggedTemplateExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); - context.enableSubstitution( + context2.enableSubstitution( 227 /* BinaryExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 305 /* ShorthandPropertyAssignment */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 308 /* SourceFile */ ); @@ -144256,13 +147531,13 @@ ${lanes.join("\n")} let importsAndRequiresToRewriteOrShim; const noSubstitution = []; let needUMDDynamicImportHelper; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile || !(isEffectiveExternalModule(node, compilerOptions) || node.transformFlags & 8388608 || isJsonSourceFile(node) && hasJsonModuleEmitEnabled(compilerOptions) && compilerOptions.outFile)) { return node; } currentSourceFile = node; - currentModuleInfo = collectExternalModuleInfo(context, node); + currentModuleInfo = collectExternalModuleInfo(context2, node); moduleInfoMap[getOriginalNodeId(node)] = currentModuleInfo; if (compilerOptions.rewriteRelativeImportExtensions) { forEachDynamicImportOrRequireCall( @@ -144329,7 +147604,7 @@ ${lanes.join("\n")} ); insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); const updated = factory2.updateSourceFile(node, setTextRange(factory2.createNodeArray(statements), node.statements)); - addEmitHelpers(updated, context.readEmitHelpers()); + addEmitHelpers(updated, context2.readEmitHelpers()); return updated; } function transformAMDModule(node) { @@ -144405,7 +147680,7 @@ ${lanes.join("\n")} node.statements ) ); - addEmitHelpers(updated, context.readEmitHelpers()); + addEmitHelpers(updated, context2.readEmitHelpers()); return updated; } function transformUMDModule(node) { @@ -144567,7 +147842,7 @@ ${lanes.join("\n")} node.statements ) ); - addEmitHelpers(updated, context.readEmitHelpers()); + addEmitHelpers(updated, context2.readEmitHelpers()); return updated; } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { @@ -144614,7 +147889,7 @@ ${lanes.join("\n")} return { aliasedModuleNames, unaliasedModuleNames, importAliasNames }; } function getAMDImportExpressionForImport(node) { - if (isImportEqualsDeclaration(node) || isExportDeclaration2(node) || !getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions)) { + if (isImportEqualsDeclaration(node) || isExportDeclaration3(node) || !getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions)) { return void 0; } const name = getLocalNameForExternalImport(factory2, node, currentSourceFile); @@ -144798,7 +148073,7 @@ ${lanes.join("\n")} case 226: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { return visitorWorker( @@ -144815,7 +148090,7 @@ ${lanes.join("\n")} ); } function destructuringNeedsFlattening(node) { - if (isObjectLiteralExpression12(node)) { + if (isObjectLiteralExpression13(node)) { for (const elem of node.properties) { switch (elem.kind) { case 304: @@ -144851,16 +148126,16 @@ ${lanes.join("\n")} return true; } } - } else if (isIdentifier26(node)) { + } else if (isIdentifier28(node)) { return length(getExports(node)) > (isExportName(node) ? 1 : 0); } return false; } function visitDestructuringAssignment(node, valueIsDiscarded) { if (destructuringNeedsFlattening(node.left)) { - return flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded, createAllExportExpressions); + return flattenDestructuringAssignment(node, visitor, context2, 0, !valueIsDiscarded, createAllExportExpressions); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitForStatement(node, isTopLevel) { if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 7)) { @@ -144883,7 +148158,7 @@ ${lanes.join("\n")} addRange(statements, exportStatements); const condition = visitNode(node.condition, visitor, isExpression); const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression); - const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context); + const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context2); statements.push(factory2.updateForStatement( node, /*initializer*/ @@ -144900,7 +148175,7 @@ ${lanes.join("\n")} visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, discardedValueVisitor, isExpression), - visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context) + visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context2) ); } function visitForInStatement(node) { @@ -144915,7 +148190,7 @@ ${lanes.join("\n")} if (some(exportStatements)) { const initializer3 = visitNode(node.initializer, discardedValueVisitor, isForInitializer); const expression = visitNode(node.expression, visitor, isExpression); - const body = visitIterationBody(node.statement, topLevelNestedVisitor, context); + const body = visitIterationBody(node.statement, topLevelNestedVisitor, context2); const mergedBody = isBlock6(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock( [...exportStatements, body], /*multiLine*/ @@ -144928,7 +148203,7 @@ ${lanes.join("\n")} node, visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); } function visitForOfStatement(node) { @@ -144942,7 +148217,7 @@ ${lanes.join("\n")} ); const initializer3 = visitNode(node.initializer, discardedValueVisitor, isForInitializer); const expression = visitNode(node.expression, visitor, isExpression); - let body = visitIterationBody(node.statement, topLevelNestedVisitor, context); + let body = visitIterationBody(node.statement, topLevelNestedVisitor, context2); if (some(exportStatements)) { body = isBlock6(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock( [...exportStatements, body], @@ -144957,13 +148232,13 @@ ${lanes.join("\n")} node.awaitModifier, visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); } function visitDoStatement(node) { return factory2.updateDoStatement( node, - visitIterationBody(node.statement, topLevelNestedVisitor, context), + visitIterationBody(node.statement, topLevelNestedVisitor, context2), visitNode(node.expression, visitor, isExpression) ); } @@ -144971,7 +148246,7 @@ ${lanes.join("\n")} return factory2.updateWhileStatement( node, visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); } function visitLabeledStatement(node) { @@ -145017,10 +148292,10 @@ ${lanes.join("\n")} ); } function visitDefaultClause(node) { - return visitEachChild(node, topLevelNestedVisitor, context); + return visitEachChild(node, topLevelNestedVisitor, context2); } function visitTryStatement(node) { - return visitEachChild(node, topLevelNestedVisitor, context); + return visitEachChild(node, topLevelNestedVisitor, context2); } function visitCatchClause(node) { return factory2.updateCatchClause( @@ -145030,7 +148305,7 @@ ${lanes.join("\n")} ); } function visitBlock(node) { - node = visitEachChild(node, topLevelNestedVisitor, context); + node = visitEachChild(node, topLevelNestedVisitor, context2); return node; } function visitExpressionStatement(node) { @@ -145046,7 +148321,7 @@ ${lanes.join("\n")} return factory2.updatePartiallyEmittedExpression(node, visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, isExpression)); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if ((node.operator === 46 || node.operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 || node.operator === 47) && isIdentifier28(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -145076,7 +148351,7 @@ ${lanes.join("\n")} return expression; } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function shimOrRewriteImportOrRequireCall(node) { return factory2.updateCallExpression( @@ -145094,7 +148369,7 @@ ${lanes.join("\n")} } function visitImportCallExpression(node, rewriteOrShim) { if (moduleKind === 0 && languageVersion >= 7) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions); const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression); @@ -145154,7 +148429,7 @@ ${lanes.join("\n")} } } function createImportCallExpressionAMD(arg, containsLexicalThis) { - const resolve9 = factory2.createUniqueName("resolve"); + const resolve12 = factory2.createUniqueName("resolve"); const reject = factory2.createUniqueName("reject"); const parameters = [ factory2.createParameterDeclaration( @@ -145163,7 +148438,7 @@ ${lanes.join("\n")} /*dotDotDotToken*/ void 0, /*name*/ - resolve9 + resolve12 ), factory2.createParameterDeclaration( /*modifiers*/ @@ -145180,7 +148455,7 @@ ${lanes.join("\n")} factory2.createIdentifier("require"), /*typeArguments*/ void 0, - [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve9, reject] + [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve12, reject] ) ) ]); @@ -145654,7 +148929,7 @@ ${lanes.join("\n")} visitNodes2(node.parameters, visitor, isParameter), /*type*/ void 0, - visitEachChild(node.body, visitor, context) + visitEachChild(node.body, visitor, context2) ), /*location*/ node @@ -145664,7 +148939,7 @@ ${lanes.join("\n")} ) ); } else { - statements = append(statements, visitEachChild(node, visitor, context)); + statements = append(statements, visitEachChild(node, visitor, context2)); } return singleOrMany(statements); } @@ -145699,7 +148974,7 @@ ${lanes.join("\n")} ) ); } else { - statements = append(statements, visitEachChild(node, visitor, context)); + statements = append(statements, visitEachChild(node, visitor, context2)); } statements = appendExportsOfHoistedDeclaration(statements, node); return singleOrMany(statements); @@ -145716,7 +148991,7 @@ ${lanes.join("\n")} let modifiers; let removeCommentsOnExpressions = false; for (const variable of node.declarationList.declarations) { - if (isIdentifier26(variable.name) && isLocalName(variable.name)) { + if (isIdentifier28(variable.name) && isLocalName(variable.name)) { if (!modifiers) { modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); } @@ -145775,7 +149050,7 @@ ${lanes.join("\n")} statements = append(statements, statement); } } else { - statements = append(statements, visitEachChild(node, visitor, context)); + statements = append(statements, visitEachChild(node, visitor, context2)); } statements = appendExportsOfVariableStatement(statements, node); return singleOrMany(statements); @@ -145806,7 +149081,7 @@ ${lanes.join("\n")} return flattenDestructuringAssignment( visitNode(node, visitor, isInitializedVariable), visitor, - context, + context2, 0, /*needsValue*/ false, @@ -146069,7 +149344,7 @@ ${lanes.join("\n")} } if (hint === 1) { return substituteExpression(node); - } else if (isShorthandPropertyAssignment6(node)) { + } else if (isShorthandPropertyAssignment7(node)) { return substituteShorthandPropertyAssignment(node); } return node; @@ -146100,10 +149375,10 @@ ${lanes.join("\n")} return node; } function substituteCallExpression(node) { - if (isIdentifier26(node.expression)) { + if (isIdentifier28(node.expression)) { const expression = substituteExpressionIdentifier(node.expression); noSubstitution[getNodeId(expression)] = true; - if (!isIdentifier26(expression) && !(getEmitFlags(node.expression) & 8192)) { + if (!isIdentifier28(expression) && !(getEmitFlags(node.expression) & 8192)) { return addInternalEmitFlags( factory2.updateCallExpression( node, @@ -146120,10 +149395,10 @@ ${lanes.join("\n")} return node; } function substituteTaggedTemplateExpression(node) { - if (isIdentifier26(node.tag)) { + if (isIdentifier28(node.tag)) { const tag = substituteExpressionIdentifier(node.tag); noSubstitution[getNodeId(tag)] = true; - if (!isIdentifier26(tag) && !(getEmitFlags(node.tag) & 8192)) { + if (!isIdentifier28(tag) && !(getEmitFlags(node.tag) & 8192)) { return addInternalEmitFlags( factory2.updateTaggedTemplateExpression( node, @@ -146184,7 +149459,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier26(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier28(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -146241,37 +149516,37 @@ ${lanes.join("\n")} text: ` var __syncRequire = typeof module === "object" && typeof module.exports === "object";` }; - function transformSystemModule(context) { + function transformSystemModule(context2) { const { factory: factory2, startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration - } = context; - const compilerOptions = context.getCompilerOptions(); - const resolver = context.getEmitResolver(); - const host = context.getEmitHost(); - const previousOnSubstituteNode = context.onSubstituteNode; - const previousOnEmitNode = context.onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.onEmitNode = onEmitNode; - context.enableSubstitution( + } = context2; + const compilerOptions = context2.getCompilerOptions(); + const resolver = context2.getEmitResolver(); + const host = context2.getEmitHost(); + const previousOnSubstituteNode = context2.onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + context2.onSubstituteNode = onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.enableSubstitution( 80 /* Identifier */ ); - context.enableSubstitution( + context2.enableSubstitution( 305 /* ShorthandPropertyAssignment */ ); - context.enableSubstitution( + context2.enableSubstitution( 227 /* BinaryExpression */ ); - context.enableSubstitution( + context2.enableSubstitution( 237 /* MetaProperty */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 308 /* SourceFile */ ); @@ -146286,7 +149561,7 @@ ${lanes.join("\n")} let hoistedStatements; let enclosingBlockScopedContainer; let noSubstitution; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile || !(isEffectiveExternalModule(node, compilerOptions) || node.transformFlags & 8388608)) { return node; @@ -146294,7 +149569,7 @@ ${lanes.join("\n")} const id = getOriginalNodeId(node); currentSourceFile = node; enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(context, node); + moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(context2, node); exportFunction = factory2.createUniqueName("exports"); exportFunctionsMap[id] = exportFunction; contextObject = contextObjectMap[id] = factory2.createUniqueName("context"); @@ -146823,7 +150098,7 @@ ${lanes.join("\n")} ) ); } else { - hoistedStatements = append(hoistedStatements, visitEachChild(node, visitor, context)); + hoistedStatements = append(hoistedStatements, visitEachChild(node, visitor, context2)); } hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); return void 0; @@ -146930,7 +150205,7 @@ ${lanes.join("\n")} return isBindingPattern(node.name) ? flattenDestructuringAssignment( node, visitor, - context, + context2, 0, /*needsValue*/ false, @@ -147077,7 +150352,7 @@ ${lanes.join("\n")} return statement; } function createExportExpression(name, value) { - const exportName = isIdentifier26(name) ? factory2.createStringLiteralFromNode(name) : name; + const exportName = isIdentifier28(name) ? factory2.createStringLiteralFromNode(name) : name; setEmitFlags( value, getEmitFlags(value) | 3072 @@ -147144,7 +150419,7 @@ ${lanes.join("\n")} visitNode(node.initializer, isTopLevel ? visitForInitializer : discardedValueVisitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, discardedValueVisitor, isExpression), - visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context) + visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context2) ); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; @@ -147156,7 +150431,7 @@ ${lanes.join("\n")} node, visitForInitializer(node.initializer), visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; @@ -147169,7 +150444,7 @@ ${lanes.join("\n")} node.awaitModifier, visitForInitializer(node.initializer), visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; @@ -147198,7 +150473,7 @@ ${lanes.join("\n")} function visitDoStatement(node) { return factory2.updateDoStatement( node, - visitIterationBody(node.statement, topLevelNestedVisitor, context), + visitIterationBody(node.statement, topLevelNestedVisitor, context2), visitNode(node.expression, visitor, isExpression) ); } @@ -147206,7 +150481,7 @@ ${lanes.join("\n")} return factory2.updateWhileStatement( node, visitNode(node.expression, visitor, isExpression), - visitIterationBody(node.statement, topLevelNestedVisitor, context) + visitIterationBody(node.statement, topLevelNestedVisitor, context2) ); } function visitLabeledStatement(node) { @@ -147256,10 +150531,10 @@ ${lanes.join("\n")} ); } function visitDefaultClause(node) { - return visitEachChild(node, topLevelNestedVisitor, context); + return visitEachChild(node, topLevelNestedVisitor, context2); } function visitTryStatement(node) { - return visitEachChild(node, topLevelNestedVisitor, context); + return visitEachChild(node, topLevelNestedVisitor, context2); } function visitCatchClause(node) { const savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; @@ -147275,7 +150550,7 @@ ${lanes.join("\n")} function visitBlock(node) { const savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = visitEachChild(node, topLevelNestedVisitor, context); + node = visitEachChild(node, topLevelNestedVisitor, context2); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } @@ -147310,7 +150585,7 @@ ${lanes.join("\n")} case 226: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function visitor(node) { return visitorWorker( @@ -147354,12 +150629,12 @@ ${lanes.join("\n")} return flattenDestructuringAssignment( node, visitor, - context, + context2, 0, !valueIsDiscarded ); } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function hasExportedReferenceInDestructuringTarget(node) { if (isAssignmentExpression( @@ -147370,15 +150645,15 @@ ${lanes.join("\n")} return hasExportedReferenceInDestructuringTarget(node.left); } else if (isSpreadElement5(node)) { return hasExportedReferenceInDestructuringTarget(node.expression); - } else if (isObjectLiteralExpression12(node)) { + } else if (isObjectLiteralExpression13(node)) { return some(node.properties, hasExportedReferenceInDestructuringTarget); } else if (isArrayLiteralExpression7(node)) { return some(node.elements, hasExportedReferenceInDestructuringTarget); - } else if (isShorthandPropertyAssignment6(node)) { + } else if (isShorthandPropertyAssignment7(node)) { return hasExportedReferenceInDestructuringTarget(node.name); - } else if (isPropertyAssignment11(node)) { + } else if (isPropertyAssignment12(node)) { return hasExportedReferenceInDestructuringTarget(node.initializer); - } else if (isIdentifier26(node)) { + } else if (isIdentifier28(node)) { const container = resolver.getReferencedExportContainer(node); return container !== void 0 && container.kind === 308; } else { @@ -147386,7 +150661,7 @@ ${lanes.join("\n")} } } function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) { - if ((node.operator === 46 || node.operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 || node.operator === 47) && isIdentifier28(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -147413,7 +150688,7 @@ ${lanes.join("\n")} return expression; } } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } function modifierVisitor(node) { switch (node.kind) { @@ -147543,7 +150818,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier26(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier28(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -147610,24 +150885,24 @@ ${lanes.join("\n")} return noSubstitution && node.id && noSubstitution[node.id]; } } - function transformECMAScriptModule(context) { + function transformECMAScriptModule(context2) { const { factory: factory2, getEmitHelperFactory: emitHelpers - } = context; - const host = context.getEmitHost(); - const resolver = context.getEmitResolver(); - const compilerOptions = context.getCompilerOptions(); + } = context2; + const host = context2.getEmitHost(); + const resolver = context2.getEmitResolver(); + const compilerOptions = context2.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - const previousOnEmitNode = context.onEmitNode; - const previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification( + const previousOnEmitNode = context2.onEmitNode; + const previousOnSubstituteNode = context2.onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.onSubstituteNode = onSubstituteNode; + context2.enableEmitNotification( 308 /* SourceFile */ ); - context.enableSubstitution( + context2.enableSubstitution( 80 /* Identifier */ ); @@ -147636,7 +150911,7 @@ ${lanes.join("\n")} let helperNameSubstitutions; let currentSourceFile; let importRequireStatements; - return chainBundle(context, transformSourceFile); + return chainBundle(context2, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; @@ -147659,7 +150934,7 @@ ${lanes.join("\n")} ); } let result = updateExternalModule(node); - addEmitHelpers(result, context.readEmitHelpers()); + addEmitHelpers(result, context2.readEmitHelpers()); currentSourceFile = void 0; if (importRequireStatements) { result = factory2.updateSourceFile( @@ -147689,7 +150964,7 @@ ${lanes.join("\n")} setTextRange(factory2.createNodeArray(statements), node.statements) ); } else { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } function visitor(node) { @@ -147710,7 +150985,7 @@ ${lanes.join("\n")} // fallthrough default: if ((importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length) && rangeContainsRange(node, importsAndRequiresToRewriteOrShim[0])) { - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitor, context2); } } return node; @@ -147817,7 +151092,7 @@ ${lanes.join("\n")} importRequireStatements = [importStatement, requireStatement]; } const name = importRequireStatements[1].declarationList.declarations[0].name; - Debug.assertNode(name, isIdentifier26); + Debug.assertNode(name, isIdentifier28); return factory2.createCallExpression( factory2.cloneNode(name), /*typeArguments*/ @@ -147967,7 +151242,7 @@ ${lanes.join("\n")} if (node.id && noSubstitution.has(node.id)) { return node; } - if (isIdentifier26(node) && getEmitFlags(node) & 8192) { + if (isIdentifier28(node) && getEmitFlags(node) & 8192) { return substituteHelperName(node); } return node; @@ -147993,25 +151268,25 @@ ${lanes.join("\n")} return node; } } - function transformImpliedNodeFormatDependentModule(context) { - const previousOnSubstituteNode = context.onSubstituteNode; - const previousOnEmitNode = context.onEmitNode; - const esmTransform = transformECMAScriptModule(context); - const esmOnSubstituteNode = context.onSubstituteNode; - const esmOnEmitNode = context.onEmitNode; - context.onSubstituteNode = previousOnSubstituteNode; - context.onEmitNode = previousOnEmitNode; - const cjsTransform = transformModule(context); - const cjsOnSubstituteNode = context.onSubstituteNode; - const cjsOnEmitNode = context.onEmitNode; - const getEmitModuleFormatOfFile2 = (file2) => context.getEmitHost().getEmitModuleFormatOfFile(file2); - context.onSubstituteNode = onSubstituteNode; - context.onEmitNode = onEmitNode; - context.enableSubstitution( + function transformImpliedNodeFormatDependentModule(context2) { + const previousOnSubstituteNode = context2.onSubstituteNode; + const previousOnEmitNode = context2.onEmitNode; + const esmTransform = transformECMAScriptModule(context2); + const esmOnSubstituteNode = context2.onSubstituteNode; + const esmOnEmitNode = context2.onEmitNode; + context2.onSubstituteNode = previousOnSubstituteNode; + context2.onEmitNode = previousOnEmitNode; + const cjsTransform = transformModule(context2); + const cjsOnSubstituteNode = context2.onSubstituteNode; + const cjsOnEmitNode = context2.onEmitNode; + const getEmitModuleFormatOfFile2 = (file2) => context2.getEmitHost().getEmitModuleFormatOfFile(file2); + context2.onSubstituteNode = onSubstituteNode; + context2.onEmitNode = onEmitNode; + context2.enableSubstitution( 308 /* SourceFile */ ); - context.enableEmitNotification( + context2.enableEmitNotification( 308 /* SourceFile */ ); @@ -148060,11 +151335,11 @@ ${lanes.join("\n")} return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { - return context.factory.createBundle(map2(node.sourceFiles, transformSourceFile)); + return context2.factory.createBundle(map2(node.sourceFiles, transformSourceFile)); } } function canProduceDiagnostics(node) { - return isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration5(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration2(node) || isConstructorDeclaration2(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isJSDocTypeAlias(node); + return isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration5(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration2(node) || isConstructorDeclaration2(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression17(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isJSDocTypeAlias(node); } function createGetSymbolAccessibilityDiagnosticForNodeName(node) { if (isSetAccessor(node) || isGetAccessor(node)) { @@ -148110,7 +151385,7 @@ ${lanes.join("\n")} } } function createGetSymbolAccessibilityDiagnosticForNode(node) { - if (isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isBindingElement(node) || isConstructorDeclaration2(node)) { + if (isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isPropertyAccessExpression17(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isBindingElement(node) || isConstructorDeclaration2(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { return getAccessorDeclarationTypeVisibilityError; @@ -148494,9 +151769,9 @@ ${lanes.join("\n")} } } function findNearestDeclaration(node) { - const result = findAncestor(node, (n) => isExportAssignment3(n) || isStatement(n) || isVariableDeclaration7(n) || isPropertyDeclaration(n) || isParameter(n)); + const result = findAncestor(node, (n) => isExportAssignment4(n) || isStatement(n) || isVariableDeclaration7(n) || isPropertyDeclaration(n) || isParameter(n)); if (!result) return void 0; - if (isExportAssignment3(result)) return result; + if (isExportAssignment4(result)) return result; if (isReturnStatement4(result)) { return findAncestor(result, (n) => isFunctionLikeDeclaration(n) && !isConstructorDeclaration2(n)); } @@ -148517,7 +151792,7 @@ ${lanes.join("\n")} function addParentDeclarationRelatedInfo(node, diag2) { const parentDeclaration = findNearestDeclaration(node); if (parentDeclaration) { - const targetStr = isExportAssignment3(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode( + const targetStr = isExportAssignment4(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode( parentDeclaration.name, /*includeTrivia*/ false @@ -148589,12 +151864,12 @@ ${lanes.join("\n")} const parentDeclaration = findNearestDeclaration(node); let diag2; if (parentDeclaration) { - const targetStr = isExportAssignment3(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode( + const targetStr = isExportAssignment4(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode( parentDeclaration.name, /*includeTrivia*/ false ); - const parent2 = findAncestor(node.parent, (n) => isExportAssignment3(n) || (isStatement(n) ? "quit" : !isParenthesizedExpression7(n) && !isTypeAssertionExpression2(n) && !isAsExpression7(n))); + const parent2 = findAncestor(node.parent, (n) => isExportAssignment4(n) || (isStatement(n) ? "quit" : !isParenthesizedExpression8(n) && !isTypeAssertionExpression3(n) && !isAsExpression8(n))); if (parentDeclaration === parent2) { diag2 = createDiagnosticForNode(node, diagnosticMessage ?? errorByDeclarationKind[parentDeclaration.kind]); addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr)); @@ -148625,7 +151900,7 @@ ${lanes.join("\n")} } var declarationEmitNodeBuilderFlags = 1024 | 2048 | 4096 | 8 | 524288 | 4 | 1; var declarationEmitInternalNodeBuilderFlags = 8; - function transformDeclarations(context) { + function transformDeclarations(context2) { const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context"); let getSymbolAccessibilityDiagnostic = throwDiagnostic; let needsDeclare = true; @@ -148637,8 +151912,8 @@ ${lanes.join("\n")} let lateMarkedStatements; let lateStatementReplacementMap; let suppressNewDiagnosticContexts; - const { factory: factory2 } = context; - const host = context.getEmitHost(); + const { factory: factory2 } = context2; + const host = context2.getEmitHost(); let restoreFallbackNode = () => void 0; const symbolTracker = { trackSymbol, @@ -148671,8 +151946,8 @@ ${lanes.join("\n")} let rawReferencedFiles; let rawTypeReferenceDirectives; let rawLibReferenceDirectives; - const resolver = context.getEmitResolver(); - const options = context.getCompilerOptions(); + const resolver = context2.getEmitResolver(); + const options = context2.getCompilerOptions(); const getIsolatedDeclarationError = createGetIsolatedDeclarationErrors(resolver); const { stripInternal, isolatedDeclarations } = options; return transformRoot; @@ -148680,7 +151955,7 @@ ${lanes.join("\n")} resolver.getPropertiesOfContainerFunction(node).forEach((p) => { if (isExpandoPropertyDeclaration(p.valueDeclaration)) { const errorTarget = isBinaryExpression4(p.valueDeclaration) ? p.valueDeclaration.left : p.valueDeclaration; - context.addDiagnostic(createDiagnosticForNode( + context2.addDiagnostic(createDiagnosticForNode( errorTarget, Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function )); @@ -148693,7 +151968,7 @@ ${lanes.join("\n")} if (isVariableDeclaration7(node) && resolver.isExpandoFunctionDeclaration(node)) { reportExpandoFunctionErrors(node); } else { - context.addDiagnostic(getIsolatedDeclarationError(node)); + context2.addDiagnostic(getIsolatedDeclarationError(node)); } } function handleSymbolAccessibilityError(symbolAccessibilityResult) { @@ -148711,9 +151986,9 @@ ${lanes.join("\n")} const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + context2.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } else { - context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + context2.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } return true; } @@ -148733,7 +152008,7 @@ ${lanes.join("\n")} } function reportPrivateInBaseOfClassExpression(propertyName) { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic( + context2.addDiagnostic( addRelatedInfo( createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName), ...isVariableDeclaration7((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : [] @@ -148742,31 +152017,31 @@ ${lanes.join("\n")} } } function errorDeclarationNameWithFallback() { - return errorNameNode ? declarationNameToString(errorNameNode) : errorFallbackNode && getNameOfDeclaration(errorFallbackNode) ? declarationNameToString(getNameOfDeclaration(errorFallbackNode)) : errorFallbackNode && isExportAssignment3(errorFallbackNode) ? errorFallbackNode.isExportEquals ? "export=" : "default" : "(Missing)"; + return errorNameNode ? declarationNameToString(errorNameNode) : errorFallbackNode && getNameOfDeclaration(errorFallbackNode) ? declarationNameToString(getNameOfDeclaration(errorFallbackNode)) : errorFallbackNode && isExportAssignment4(errorFallbackNode) ? errorFallbackNode.isExportEquals ? "export=" : "default" : "(Missing)"; } function reportInaccessibleUniqueSymbolError() { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol")); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol")); } } function reportCyclicStructureError() { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback())); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback())); } } function reportInaccessibleThisError() { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this")); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this")); } } function reportLikelyUnsafeImportRequiredError(specifier) { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier)); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier)); } } function reportTruncationError() { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed)); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed)); } } function reportNonlocalAugmentation(containingFile, parentSymbol, symbol2) { @@ -148775,7 +152050,7 @@ ${lanes.join("\n")} const augmentingDeclarations = filter(symbol2.declarations, (d) => getSourceFileOfNode(d) !== containingFile); if (primaryDeclaration && augmentingDeclarations) { for (const augmentations of augmentingDeclarations) { - context.addDiagnostic(addRelatedInfo( + context2.addDiagnostic(addRelatedInfo( createDiagnosticForNode(augmentations, Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), createDiagnosticForNode(primaryDeclaration, Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file) )); @@ -148784,7 +152059,7 @@ ${lanes.join("\n")} } function reportNonSerializableProperty(propertyName) { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName)); + context2.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName)); } } function transformDeclarationsForJS(sourceFile) { @@ -148831,7 +152106,7 @@ ${lanes.join("\n")} 138 /* DeclareKeyword */ )], - factory2.createStringLiteral(getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), + factory2.createStringLiteral(getResolvedExternalModuleName(context2.getEmitHost(), sourceFile)), factory2.createModuleBlock(setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)) )], /*isDeclarationFile*/ @@ -149055,7 +152330,7 @@ ${lanes.join("\n")} if (shouldPrintWithInitializer(node)) { return; } - if (!isExportAssignment3(node) && !isBindingElement(node) && node.type && (!isParameter(node) || !resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration))) { + if (!isExportAssignment4(node) && !isBindingElement(node) && node.type && (!isParameter(node) || !resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration))) { return visitNode(node.type, visitDeclarationSubtree, isTypeNode); } const oldErrorNameNode = errorNameNode; @@ -149193,7 +152468,7 @@ ${lanes.join("\n")} resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 268 && parent2.kind !== 206; if (isStringLiteralLike4(input)) { if (isBundledEmit) { - const newName = getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent2); + const newName = getExternalModuleNameFromDeclaration(context2.getEmitHost(), resolver, parent2); if (newName) { return factory2.createStringLiteral(newName); } @@ -149282,7 +152557,7 @@ ${lanes.join("\n")} } if (resolver.isImportRequiredByAugmentation(decl)) { if (isolatedDeclarations) { - context.addDiagnostic(createDiagnosticForNode(decl, Diagnostics.Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations)); + context2.addDiagnostic(createDiagnosticForNode(decl, Diagnostics.Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations)); } return factory2.updateImportDeclaration( decl, @@ -149338,14 +152613,14 @@ ${lanes.join("\n")} if (hasDynamicName(input)) { if (isolatedDeclarations) { if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) { - if (isClassDeclaration5(input.parent) || isObjectLiteralExpression12(input.parent)) { - context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations)); + if (isClassDeclaration5(input.parent) || isObjectLiteralExpression13(input.parent)) { + context2.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations)); return; } else if ( // Type declarations just need to double-check that the input computed name is an entity name expression (isInterfaceDeclaration2(input.parent) || isTypeLiteralNode2(input.parent)) && !isEntityNameExpression(input.name.expression) ) { - context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations)); + context2.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations)); return; } } @@ -149399,12 +152674,12 @@ ${lanes.join("\n")} if (isEntityName(input.expression) || isEntityNameExpression(input.expression)) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } - const node = visitEachChild(input, visitDeclarationSubtree, context); + const node = visitEachChild(input, visitDeclarationSubtree, context2); return cleanup(factory2.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } case 184: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); - const node = visitEachChild(input, visitDeclarationSubtree, context); + const node = visitEachChild(input, visitDeclarationSubtree, context2); return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } case 181: @@ -149585,7 +152860,7 @@ ${lanes.join("\n")} void 0 )); } - return cleanup(visitEachChild(input, visitDeclarationSubtree, context)); + return cleanup(visitEachChild(input, visitDeclarationSubtree, context2)); } case 195: { const checkType = visitNode(input.checkType, visitDeclarationSubtree, isTypeNode); @@ -149640,7 +152915,7 @@ ${lanes.join("\n")} /* SingleLine */ ); } - return cleanup(visitEachChild(input, visitDeclarationSubtree, context)); + return cleanup(visitEachChild(input, visitDeclarationSubtree, context2)); function cleanup(returnValue) { if (returnValue && canProduceDiagnostic && hasDynamicName(input)) { checkName(input); @@ -149738,7 +153013,7 @@ ${lanes.join("\n")} statement, 2048 /* Default */ - ) || !canHaveModifiers(statement)) { + ) || !canHaveModifiers2(statement)) { return statement; } const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (131071 ^ 32)); @@ -150024,9 +153299,9 @@ ${lanes.join("\n")} } else { return walkBindingPattern(param.name); } - function walkBindingPattern(pattern) { + function walkBindingPattern(pattern2) { let elems; - for (const elem of pattern.elements) { + for (const elem of pattern2.elements) { if (isOmittedExpression(elem)) continue; if (isBindingPattern(elem.name)) { elems = concatenate(elems, walkBindingPattern(elem.name)); @@ -150144,7 +153419,7 @@ ${lanes.join("\n")} const constValue = enumValue == null ? void 0 : enumValue.value; if (isolatedDeclarations && m.initializer && (enumValue == null ? void 0 : enumValue.hasExternalReferences) && // This will be its own compiler error instead, so don't report. !isComputedPropertyName(m.name)) { - context.addDiagnostic(createDiagnosticForNode(m, Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations)); + context2.addDiagnostic(createDiagnosticForNode(m, Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations)); } const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41, factory2.createNumericLiteral(-constValue)) : factory2.createNumericLiteral(constValue); return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m); @@ -150234,7 +153509,7 @@ ${lanes.join("\n")} return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile); } function isScopeMarker2(node) { - return isExportAssignment3(node) || isExportDeclaration2(node); + return isExportAssignment4(node) || isExportDeclaration3(node); } function hasScopeMarker2(statements) { return some(statements, isScopeMarker2); @@ -150432,9 +153707,9 @@ ${lanes.join("\n")} return (node) => isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); } function wrapCustomTransformerFactory(transformer, handleDefault) { - return (context) => { - const customTransformer = transformer(context); - return typeof customTransformer === "function" ? handleDefault(context, customTransformer) : wrapCustomTransformer(customTransformer); + return (context2) => { + const customTransformer = transformer(context2); + return typeof customTransformer === "function" ? handleDefault(context2, customTransformer) : wrapCustomTransformer(customTransformer); }; } function wrapScriptTransformerFactory(transformer) { @@ -150473,14 +153748,14 @@ ${lanes.join("\n")} let onEmitNode = noEmitNotification; let state = 0; const diagnostics = []; - const context = { + const context2 = { factory: factory2, getCompilerOptions: () => options, getEmitResolver: () => resolver, // TODO: GH#18217 getEmitHost: () => host, // TODO: GH#18217 - getEmitHelperFactory: memoize(() => createEmitHelperFactory(context)), + getEmitHelperFactory: memoize(() => createEmitHelperFactory(context2)), startLexicalEnvironment, suspendLexicalEnvironment, resumeLexicalEnvironment, @@ -150523,7 +153798,7 @@ ${lanes.join("\n")} disposeEmitNodes(getSourceFileOfNode(getParseTreeNode(node))); } mark("beforeTransform"); - const transformersWithContext = transformers.map((t) => t(context)); + const transformersWithContext = transformers.map((t) => t(context2)); const transformation = (node) => { for (const transform22 of transformersWithContext) { node = transform22(node); @@ -151243,7 +154518,7 @@ ${lanes.join("\n")} declarationTransform.dispose(); } function collectLinkedAliases(node) { - if (isExportAssignment3(node)) { + if (isExportAssignment4(node)) { if (node.expression.kind === 80) { resolver.collectLinkedAliases( node.expression, @@ -151266,7 +154541,7 @@ ${lanes.join("\n")} if (isSourceFileJS(file2)) return; forEachChildRecursively(file2, (n) => { if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32)) return "skip"; - if (isImportDeclaration7(n)) return "skip"; + if (isImportDeclaration8(n)) return "skip"; resolver.markLinkedReferences(n); }); } @@ -151521,7 +154796,7 @@ ${lanes.join("\n")} Debug.assert(isSourceFile(node), "Expected a SourceFile node."); break; case 2: - Debug.assert(isIdentifier26(node), "Expected an Identifier node."); + Debug.assert(isIdentifier28(node), "Expected an Identifier node."); break; case 1: Debug.assert(isExpression(node), "Expected an Expression node."); @@ -151774,7 +155049,7 @@ ${lanes.join("\n")} } } if (hint === 0) return emitSourceFile(cast(node, isSourceFile)); - if (hint === 2) return emitIdentifier(cast(node, isIdentifier26)); + if (hint === 2) return emitIdentifier(cast(node, isIdentifier28)); if (hint === 6) return emitLiteral( cast(node, isStringLiteral15), /*jsxAttributeEscape*/ @@ -153349,8 +156624,8 @@ ${lanes.join("\n")} if (!currentSourceFile) return false; const leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); if (leadingCommentRanges) { - const parseNode = getParseTreeNode(node); - if (parseNode && isParenthesizedExpression7(parseNode.parent)) { + const parseNode2 = getParseTreeNode(node); + if (parseNode2 && isParenthesizedExpression8(parseNode2.parent)) { return true; } } @@ -153369,11 +156644,11 @@ ${lanes.join("\n")} switch (node.kind) { case 356: if (willEmitLeadingNewLine(node)) { - const parseNode = getParseTreeNode(node); - if (parseNode && isParenthesizedExpression7(parseNode)) { + const parseNode2 = getParseTreeNode(node); + if (parseNode2 && isParenthesizedExpression8(parseNode2)) { const parens = factory.createParenthesizedExpression(node.expression); setOriginalNode(parens, node); - setTextRange(parens, parseNode); + setTextRange(parens, parseNode2); return parens; } return factory.createParenthesizedExpression(node); @@ -154695,7 +157970,7 @@ ${lanes.join("\n")} } function canEmitSimpleArrowHead(parentNode, parameters) { const parameter = singleOrUndefined(parameters); - return parameter && parameter.pos === parentNode.pos && isArrowFunction8(parentNode) && !parentNode.type && !some(parentNode.modifiers) && !some(parentNode.typeParameters) && !some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && isIdentifier26(parameter.name); + return parameter && parameter.pos === parentNode.pos && isArrowFunction8(parentNode) && !parentNode.type && !some(parentNode.modifiers) && !some(parentNode.typeParameters) && !some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && isIdentifier28(parameter.name); } function emitParametersForArrow(parentNode, parameters) { if (canEmitSimpleArrowHead(parentNode, parameters)) { @@ -155199,7 +158474,7 @@ ${lanes.join("\n")} function getLiteralTextOfNode(node, sourceFile = currentSourceFile, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 11 && node.textSourceNode) { const textSourceNode = node.textSourceNode; - if (isIdentifier26(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral5(textSourceNode) || isJsxNamespacedName(textSourceNode)) { + if (isIdentifier28(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral5(textSourceNode) || isJsxNamespacedName(textSourceNode)) { const text = isNumericLiteral5(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode); return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`; } else { @@ -155593,7 +158868,7 @@ ${lanes.join("\n")} ); } function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { - if (isIdentifier26(node.name)) { + if (isIdentifier28(node.name)) { return generateNameCached(node.name, privateName); } return makeTempVariableName( @@ -155680,7 +158955,7 @@ ${lanes.join("\n")} case 1: return makeTempVariableName(0, !!(autoGenerate.flags & 8), isPrivateIdentifier(name), prefix, suffix); case 2: - Debug.assertNode(name, isIdentifier26); + Debug.assertNode(name, isIdentifier28); return makeTempVariableName( 268435456, !!(autoGenerate.flags & 8), @@ -156729,7 +160004,7 @@ ${lanes.join("\n")} } text = ""; } - return text !== void 0 ? createSourceFile5(fileName, text, languageVersionOrOptions, setParentNodes) : void 0; + return text !== void 0 ? createSourceFile6(fileName, text, languageVersionOrOptions, setParentNodes) : void 0; }; } function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) { @@ -156968,11 +160243,11 @@ ${lanes.join("\n")} if (hasMoreThanFiveLines) { gutterWidth = Math.max(ellipsis.length, gutterWidth); } - let context = ""; + let context2 = ""; for (let i = firstLine3; i <= lastLine; i++) { - context += host.getNewLine(); + context2 += host.getNewLine(); if (hasMoreThanFiveLines && firstLine3 + 1 < i && i < lastLine - 1) { - context += indent3 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine(); + context2 += indent3 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine(); i = lastLine - 1; } const lineStart = getPositionOfLineAndCharacter(file2, i, 0); @@ -156980,22 +160255,22 @@ ${lanes.join("\n")} let lineContent = file2.text.slice(lineStart, lineEnd); lineContent = lineContent.trimEnd(); lineContent = lineContent.replace(/\t/g, " "); - context += indent3 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator; - context += lineContent + host.getNewLine(); - context += indent3 + formatColorAndReset("".padStart(gutterWidth), gutterStyleSequence) + gutterSeparator; - context += squiggleColor; + context2 += indent3 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator; + context2 += lineContent + host.getNewLine(); + context2 += indent3 + formatColorAndReset("".padStart(gutterWidth), gutterStyleSequence) + gutterSeparator; + context2 += squiggleColor; if (i === firstLine3) { const lastCharForLine = i === lastLine ? lastLineChar : void 0; - context += lineContent.slice(0, firstLineChar).replace(/\S/g, " "); - context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~"); + context2 += lineContent.slice(0, firstLineChar).replace(/\S/g, " "); + context2 += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~"); } else if (i === lastLine) { - context += lineContent.slice(0, lastLineChar).replace(/./g, "~"); + context2 += lineContent.slice(0, lastLineChar).replace(/./g, "~"); } else { - context += lineContent.replace(/./g, "~"); + context2 += lineContent.replace(/./g, "~"); } - context += resetEscapeSequence; + context2 += resetEscapeSequence; } - return context; + return context2; } function formatLocation(file2, start, host, color = formatColorAndReset) { const { line: firstLine3, character: firstLineChar } = getLineAndCharacterOfPosition(file2, start); @@ -157085,7 +160360,7 @@ ${lanes.join("\n")} } function isExclusivelyTypeOnlyImportOrExport(decl) { var _a3; - if (isExportDeclaration2(decl)) { + if (isExportDeclaration3(decl)) { return decl.isTypeOnly; } if ((_a3 = decl.importClause) == null ? void 0 : _a3.isTypeOnly) { @@ -157097,7 +160372,7 @@ ${lanes.join("\n")} return getModeForUsageLocationWorker(file2, usage, compilerOptions); } function getModeForUsageLocationWorker(file2, usage, compilerOptions) { - if (isImportDeclaration7(usage.parent) || isExportDeclaration2(usage.parent) || isJSDocImportTag(usage.parent)) { + if (isImportDeclaration8(usage.parent) || isExportDeclaration3(usage.parent) || isJSDocImportTag(usage.parent)) { const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); if (isTypeOnly) { const override = getResolutionModeOverride(usage.parent.attributes); @@ -160112,7 +163387,7 @@ ${lanes.join("\n")} function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) { let needCompilerDiagnostic = true; forEachOptionPathsSyntax((pathProp) => { - if (isObjectLiteralExpression12(pathProp.initializer)) { + if (isObjectLiteralExpression13(pathProp.initializer)) { forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => { const initializer3 = keyProps.initializer; if (isArrayLiteralExpression7(initializer3) && initializer3.elements.length > valueIndex) { @@ -160129,7 +163404,7 @@ ${lanes.join("\n")} function createDiagnosticForOptionPaths(onKey, key, message, ...args) { let needCompilerDiagnostic = true; forEachOptionPathsSyntax((pathProp) => { - if (isObjectLiteralExpression12(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax( + if (isObjectLiteralExpression13(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax( pathProp.initializer, onKey, key, @@ -160203,7 +163478,7 @@ ${lanes.join("\n")} function getCompilerOptionsObjectLiteralSyntax() { if (_compilerOptionsObjectLiteralSyntax === void 0) { const compilerOptionsProperty = getCompilerOptionsPropertySyntax(); - _compilerOptionsObjectLiteralSyntax = compilerOptionsProperty ? tryCast(compilerOptionsProperty.initializer, isObjectLiteralExpression12) || false : false; + _compilerOptionsObjectLiteralSyntax = compilerOptionsProperty ? tryCast(compilerOptionsProperty.initializer, isObjectLiteralExpression13) || false : false; } return _compilerOptionsObjectLiteralSyntax || void 0; } @@ -164217,8 +167492,8 @@ ${lanes.join("\n")} ".json" /* Json */ )) return false; - const pattern = getPatternFromSpec(includeSpec, basePath, "files"); - return !!pattern && getRegexFromPattern(`(?:${pattern})$`, useCaseSensitiveFileNames2).test(fileName); + const pattern2 = getPatternFromSpec(includeSpec, basePath, "files"); + return !!pattern2 && getRegexFromPattern(`(?:${pattern2})$`, useCaseSensitiveFileNames2).test(fileName); }); return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0; } @@ -168393,38 +171668,38 @@ ${lanes.join("\n")} serializeReturnTypeForSignature, serializeTypeOfExpression, serializeTypeOfAccessor, - tryReuseExistingTypeNode(context, existing) { - if (!resolver.canReuseTypeNode(context, existing)) { + tryReuseExistingTypeNode(context2, existing) { + if (!resolver.canReuseTypeNode(context2, existing)) { return void 0; } - return tryReuseExistingTypeNode(context, existing); + return tryReuseExistingTypeNode(context2, existing); } }; - function reuseNode(context, node, range = node) { - return node === void 0 ? void 0 : resolver.markNodeReuse(context, node.flags & 16 ? node : factory.cloneNode(node), range ?? node); + function reuseNode(context2, node, range = node) { + return node === void 0 ? void 0 : resolver.markNodeReuse(context2, node.flags & 16 ? node : factory.cloneNode(node), range ?? node); } - function tryReuseExistingTypeNode(context, existing) { - const { finalizeBoundary, startRecoveryScope, hadError, markError } = resolver.createRecoveryBoundary(context); + function tryReuseExistingTypeNode(context2, existing) { + const { finalizeBoundary, startRecoveryScope, hadError, markError } = resolver.createRecoveryBoundary(context2); const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode); if (!finalizeBoundary()) { return void 0; } - context.approximateLength += existing.end - existing.pos; + context2.approximateLength += existing.end - existing.pos; return transformed; function visitExistingNodeTreeSymbols(node) { if (hadError()) return node; const recover = startRecoveryScope(); - const onExitNewScope = isNewScopeNode(node) ? resolver.enterNewScope(context, node) : void 0; + const onExitNewScope = isNewScopeNode(node) ? resolver.enterNewScope(context2, node) : void 0; const result = visitExistingNodeTreeSymbolsWorker(node); onExitNewScope == null ? void 0 : onExitNewScope(); if (hadError()) { if (isTypeNode(node) && !isTypePredicateNode(node)) { recover(); - return resolver.serializeExistingTypeNode(context, node); + return resolver.serializeExistingTypeNode(context2, node); } return node; } - return result ? resolver.markNodeReuse(context, result, node) : void 0; + return result ? resolver.markNodeReuse(context2, result, node) : void 0; } function tryVisitSimpleTypeNode(node) { const innerNode = skipTypeParentheses(node); @@ -168463,7 +171738,7 @@ ${lanes.join("\n")} return factory.updateTypeOperatorNode(node, type); } function tryVisitTypeQuery(node) { - const { introducesError, node: exprName } = resolver.trackExistingEntityName(context, node.exprName); + const { introducesError, node: exprName } = resolver.trackExistingEntityName(context2, node.exprName); if (!introducesError) { return factory.updateTypeQueryNode( node, @@ -168472,18 +171747,18 @@ ${lanes.join("\n")} ); } const serializedName = resolver.serializeTypeName( - context, + context2, node.exprName, /*isTypeOf*/ true ); if (serializedName) { - return resolver.markNodeReuse(context, serializedName, node.exprName); + return resolver.markNodeReuse(context2, serializedName, node.exprName); } } function tryVisitTypeReference(node) { - if (resolver.canReuseTypeNode(context, node)) { - const { introducesError, node: newName } = resolver.trackExistingEntityName(context, node.typeName); + if (resolver.canReuseTypeNode(context2, node)) { + const { introducesError, node: newName } = resolver.trackExistingEntityName(context2, node.typeName); const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode); if (!introducesError) { const updated = factory.updateTypeReferenceNode( @@ -168491,17 +171766,17 @@ ${lanes.join("\n")} newName, typeArguments ); - return resolver.markNodeReuse(context, updated, node); + return resolver.markNodeReuse(context2, updated, node); } else { const serializedName = resolver.serializeTypeName( - context, + context2, node.typeName, /*isTypeOf*/ false, typeArguments ); if (serializedName) { - return resolver.markNodeReuse(context, serializedName, node.typeName); + return resolver.markNodeReuse(context2, serializedName, node.typeName); } } } @@ -168540,8 +171815,8 @@ ${lanes.join("\n")} } if (isJSDocTypeLiteral(node)) { return factory.createTypeLiteralNode(map2(node.jsDocPropertyTags, (t) => { - const name = visitNode(isIdentifier26(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier26); - const overrideTypeNode = resolver.getJsDocPropertyOverride(context, node, t); + const name = visitNode(isIdentifier28(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier28); + const overrideTypeNode = resolver.getJsDocPropertyOverride(context2, node, t); return factory.createPropertySignature( /*modifiers*/ void 0, @@ -168557,7 +171832,7 @@ ${lanes.join("\n")} ); })); } - if (isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "") { + if (isTypeReferenceNode3(node) && isIdentifier28(node.typeName) && node.typeName.escapedText === "") { return setOriginalNode(factory.createKeywordTypeNode( 133 /* AnyKeyword */ @@ -168587,11 +171862,11 @@ ${lanes.join("\n")} /*modifiers*/ void 0, visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols, isTypeParameterDeclaration), - mapDefined(node.parameters, (p, i) => p.name && isIdentifier26(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, void 0) : factory.createParameterDeclaration( + mapDefined(node.parameters, (p, i) => p.name && isIdentifier28(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, void 0) : factory.createParameterDeclaration( /*modifiers*/ void 0, getEffectiveDotDotDotForParameter(p), - resolver.markNodeReuse(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p), + resolver.markNodeReuse(context2, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p), factory.cloneNode(p.questionToken), visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode), /*initializer*/ @@ -168609,7 +171884,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, getEffectiveDotDotDotForParameter(p), - resolver.markNodeReuse(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p), + resolver.markNodeReuse(context2, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p), factory.cloneNode(p.questionToken), visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode), /*initializer*/ @@ -168623,14 +171898,14 @@ ${lanes.join("\n")} } } if (isThisTypeNode(node)) { - if (resolver.canReuseTypeNode(context, node)) { + if (resolver.canReuseTypeNode(context2, node)) { return node; } markError(); return node; } if (isTypeParameterDeclaration(node)) { - const { node: newName } = resolver.trackExistingEntityName(context, node.name); + const { node: newName } = resolver.trackExistingEntityName(context2, node.name); return factory.updateTypeParameterDeclaration( node, visitNodes2(node.modifiers, visitExistingNodeTreeSymbols, isModifier), @@ -168661,14 +171936,14 @@ ${lanes.join("\n")} markError(); return node; } - if (!resolver.canReuseTypeNode(context, node)) { - return resolver.serializeExistingTypeNode(context, node); + if (!resolver.canReuseTypeNode(context2, node)) { + return resolver.serializeExistingTypeNode(context2, node); } const specifier = rewriteModuleSpecifier2(node, node.argument.literal); - const literal2 = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier; + const literal2 = specifier === node.argument.literal ? reuseNode(context2, node.argument.literal) : specifier; return factory.updateImportTypeNode( node, - literal2 === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal2), + literal2 === node.argument.literal ? reuseNode(context2, node.argument) : factory.createLiteralTypeNode(literal2), visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes), visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName), visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode), @@ -168679,14 +171954,14 @@ ${lanes.join("\n")} if (!hasDynamicName(node)) { return visitEachChild2(node, visitExistingNodeTreeSymbols); } - if (resolver.shouldRemoveDeclaration(context, node)) { + if (resolver.shouldRemoveDeclaration(context2, node)) { return void 0; } } if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature3(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) { let visited = visitEachChild2(node, visitExistingNodeTreeSymbols); if (visited === node) { - visited = resolver.markNodeReuse(context, factory.cloneNode(node), node); + visited = resolver.markNodeReuse(context2, factory.cloneNode(node), node); } visited.type = factory.createKeywordTypeNode( 133 @@ -168706,11 +171981,11 @@ ${lanes.join("\n")} return result; } if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) { - const { node: result, introducesError } = resolver.trackExistingEntityName(context, node.expression); + const { node: result, introducesError } = resolver.trackExistingEntityName(context2, node.expression); if (!introducesError) { return factory.updateComputedPropertyName(node, result); } else { - const computedPropertyNameType = resolver.serializeTypeOfExpression(context, node.expression); + const computedPropertyNameType = resolver.serializeTypeOfExpression(context2, node.expression); let literal2; if (isLiteralTypeNode(computedPropertyNameType)) { literal2 = computedPropertyNameType.literal; @@ -168727,7 +172002,7 @@ ${lanes.join("\n")} ) : void 0; if (!literalNode) { if (isImportTypeNode(computedPropertyNameType)) { - resolver.trackComputedName(context, node.expression); + resolver.trackComputedName(context2, node.expression); } return node; } @@ -168744,8 +172019,8 @@ ${lanes.join("\n")} } if (isTypePredicateNode(node)) { let parameterName; - if (isIdentifier26(node.parameterName)) { - const { node: result, introducesError } = resolver.trackExistingEntityName(context, node.parameterName); + if (isIdentifier28(node.parameterName)) { + const { node: result, introducesError } = resolver.trackExistingEntityName(context2, node.parameterName); if (introducesError) markError(); parameterName = result; } else { @@ -168755,19 +172030,19 @@ ${lanes.join("\n")} } if (isTupleTypeNode(node) || isTypeLiteralNode2(node) || isMappedTypeNode(node)) { const visited = visitEachChild2(node, visitExistingNodeTreeSymbols); - const clone22 = resolver.markNodeReuse(context, visited === node ? factory.cloneNode(node) : visited, node); + const clone22 = resolver.markNodeReuse(context2, visited === node ? factory.cloneNode(node) : visited, node); const flags = getEmitFlags(clone22); - setEmitFlags(clone22, flags | (context.flags & 1024 && isTypeLiteralNode2(node) ? 0 : 1)); + setEmitFlags(clone22, flags | (context2.flags & 1024 && isTypeLiteralNode2(node) ? 0 : 1)); return clone22; } - if (isStringLiteral15(node) && !!(context.flags & 268435456) && !node.singleQuote) { + if (isStringLiteral15(node) && !!(context2.flags & 268435456) && !node.singleQuote) { const clone22 = factory.cloneNode(node); clone22.singleQuote = true; return clone22; } if (isConditionalTypeNode(node)) { const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode); - const disposeScope = resolver.enterNewScope(context, node); + const disposeScope = resolver.enterNewScope(context2, node); const extendType = visitNode(node.extendsType, visitExistingNodeTreeSymbols, isTypeNode); const trueType = visitNode(node.trueType, visitExistingNodeTreeSymbols, isTypeNode); disposeScope(); @@ -168782,7 +172057,7 @@ ${lanes.join("\n")} } if (isTypeOperatorNode(node)) { if (node.operator === 158 && node.type.kind === 155) { - if (!resolver.canReuseTypeNode(context, node)) { + if (!resolver.canReuseTypeNode(context2, node)) { markError(); return node; } @@ -168797,7 +172072,7 @@ ${lanes.join("\n")} } return visitEachChild2(node, visitExistingNodeTreeSymbols); function visitEachChild2(node2, visitor) { - const nonlocalNode = !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(node2); + const nonlocalNode = !context2.enclosingFile || context2.enclosingFile !== getSourceFileOfNode(node2); return visitEachChild( node2, visitor, @@ -168825,36 +172100,36 @@ ${lanes.join("\n")} ) : void 0); } function getNameForJSDocFunctionParameter(p, index) { - return p.name && isIdentifier26(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`; + return p.name && isIdentifier28(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`; } function rewriteModuleSpecifier2(parent2, lit2) { - const newName = resolver.getModuleSpecifierOverride(context, parent2, lit2); + const newName = resolver.getModuleSpecifierOverride(context2, parent2, lit2); return newName ? setOriginalNode(factory.createStringLiteral(newName), lit2) : lit2; } } } - function serializeExistingTypeNode(typeNode, context, addUndefined) { + function serializeExistingTypeNode(typeNode, context2, addUndefined) { if (!typeNode) return void 0; let result; - if ((!addUndefined || canAddUndefined(typeNode)) && resolver.canReuseTypeNode(context, typeNode)) { - result = tryReuseExistingTypeNode(context, typeNode); + if ((!addUndefined || canAddUndefined(typeNode)) && resolver.canReuseTypeNode(context2, typeNode)) { + result = tryReuseExistingTypeNode(context2, typeNode); if (result !== void 0) { result = addUndefinedIfNeeded( result, addUndefined, /*owner*/ void 0, - context + context2 ); } } return result; } - function serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2, requiresAddingUndefined, useFallback = requiresAddingUndefined !== void 0) { + function serializeTypeAnnotationOfDeclaration(declaredType, context2, node, symbol2, requiresAddingUndefined, useFallback = requiresAddingUndefined !== void 0) { if (!declaredType) return void 0; - if (!resolver.canReuseTypeNodeAnnotation(context, node, declaredType, symbol2, requiresAddingUndefined)) { + if (!resolver.canReuseTypeNodeAnnotation(context2, node, declaredType, symbol2, requiresAddingUndefined)) { if (!requiresAddingUndefined || !resolver.canReuseTypeNodeAnnotation( - context, + context2, node, declaredType, symbol2, @@ -168866,60 +172141,60 @@ ${lanes.join("\n")} } let result; if (!requiresAddingUndefined || canAddUndefined(declaredType)) { - result = serializeExistingTypeNode(declaredType, context, requiresAddingUndefined); + result = serializeExistingTypeNode(declaredType, context2, requiresAddingUndefined); } if (result !== void 0 || !useFallback) { return result; } - context.tracker.reportInferenceFallback(node); - return resolver.serializeExistingTypeNode(context, declaredType, requiresAddingUndefined) ?? factory.createKeywordTypeNode( + context2.tracker.reportInferenceFallback(node); + return resolver.serializeExistingTypeNode(context2, declaredType, requiresAddingUndefined) ?? factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - function serializeExistingTypeNodeWithFallback(typeNode, context, addUndefined, targetNode) { + function serializeExistingTypeNodeWithFallback(typeNode, context2, addUndefined, targetNode) { if (!typeNode) return void 0; - const result = serializeExistingTypeNode(typeNode, context, addUndefined); + const result = serializeExistingTypeNode(typeNode, context2, addUndefined); if (result !== void 0) { return result; } - context.tracker.reportInferenceFallback(targetNode ?? typeNode); - return resolver.serializeExistingTypeNode(context, typeNode, addUndefined) ?? factory.createKeywordTypeNode( + context2.tracker.reportInferenceFallback(targetNode ?? typeNode); + return resolver.serializeExistingTypeNode(context2, typeNode, addUndefined) ?? factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - function serializeTypeOfAccessor(accessor, symbol2, context) { - return typeFromAccessor(accessor, symbol2, context) ?? inferAccessorType(accessor, resolver.getAllAccessorDeclarations(accessor), context, symbol2); + function serializeTypeOfAccessor(accessor, symbol2, context2) { + return typeFromAccessor(accessor, symbol2, context2) ?? inferAccessorType(accessor, resolver.getAllAccessorDeclarations(accessor), context2, symbol2); } - function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) { + function serializeTypeOfExpression(expr, context2, addUndefined, preserveLiterals) { const result = typeFromExpression( expr, - context, + context2, /*isConstContext*/ false, addUndefined, preserveLiterals ); - return result.type !== void 0 ? result.type : inferExpressionType(expr, context, result.reportFallback); + return result.type !== void 0 ? result.type : inferExpressionType(expr, context2, result.reportFallback); } - function serializeTypeOfDeclaration(node, symbol2, context) { + function serializeTypeOfDeclaration(node, symbol2, context2) { switch (node.kind) { case 170: case 342: - return typeFromParameter(node, symbol2, context); + return typeFromParameter(node, symbol2, context2); case 261: - return typeFromVariable(node, symbol2, context); + return typeFromVariable(node, symbol2, context2); case 172: case 349: case 173: - return typeFromProperty(node, symbol2, context); + return typeFromProperty(node, symbol2, context2); case 209: - return inferTypeOfDeclaration(node, symbol2, context); + return inferTypeOfDeclaration(node, symbol2, context2); case 278: return serializeTypeOfExpression( node.expression, - context, + context2, /*addUndefined*/ void 0, /*preserveLiterals*/ @@ -168928,39 +172203,39 @@ ${lanes.join("\n")} case 212: case 213: case 227: - return typeFromExpandoProperty(node, symbol2, context); + return typeFromExpandoProperty(node, symbol2, context2); case 304: case 305: - return typeFromPropertyAssignment(node, symbol2, context); + return typeFromPropertyAssignment(node, symbol2, context2); default: Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`); } } - function typeFromPropertyAssignment(node, symbol2, context) { + function typeFromPropertyAssignment(node, symbol2, context2) { const typeAnnotation = getEffectiveTypeAnnotationNode(node); let result; - if (typeAnnotation && resolver.canReuseTypeNodeAnnotation(context, node, typeAnnotation, symbol2)) { - result = serializeExistingTypeNode(typeAnnotation, context); + if (typeAnnotation && resolver.canReuseTypeNodeAnnotation(context2, node, typeAnnotation, symbol2)) { + result = serializeExistingTypeNode(typeAnnotation, context2); } if (!result && node.kind === 304) { const initializer3 = node.initializer; const assertionNode = isJSDocTypeAssertion(initializer3) ? getJSDocTypeAssertionType(initializer3) : initializer3.kind === 235 || initializer3.kind === 217 ? initializer3.type : void 0; - if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context, node, assertionNode, symbol2)) { - result = serializeExistingTypeNode(assertionNode, context); + if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context2, node, assertionNode, symbol2)) { + result = serializeExistingTypeNode(assertionNode, context2); } } return result ?? inferTypeOfDeclaration( node, symbol2, - context, + context2, /*reportFallback*/ false ); } - function serializeReturnTypeForSignature(node, symbol2, context) { + function serializeReturnTypeForSignature(node, symbol2, context2) { switch (node.kind) { case 178: - return serializeTypeOfAccessor(node, symbol2, context); + return serializeTypeOfAccessor(node, symbol2, context2); case 175: case 263: case 181: @@ -168975,7 +172250,7 @@ ${lanes.join("\n")} case 220: case 318: case 324: - return createReturnFromSignature(node, symbol2, context); + return createReturnFromSignature(node, symbol2, context2); default: Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`); } @@ -168995,28 +172270,28 @@ ${lanes.join("\n")} } return accessorType; } - function typeFromAccessor(node, symbol2, context) { + function typeFromAccessor(node, symbol2, context2) { const accessorDeclarations = resolver.getAllAccessorDeclarations(node); const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations); if (accessorType && !isTypePredicateNode(accessorType)) { - return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol2) ?? inferTypeOfDeclaration(node, symbol2, context)); + return withNewScope(context2, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context2, node, symbol2) ?? inferTypeOfDeclaration(node, symbol2, context2)); } if (accessorDeclarations.getAccessor) { - return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol2, context)); + return withNewScope(context2, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol2, context2)); } return void 0; } - function typeFromVariable(node, symbol2, context) { + function typeFromVariable(node, symbol2, context2) { var _a3; const declaredType = getEffectiveTypeAnnotationNode(node); let resultType = failed; if (declaredType) { - resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2)); + resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context2, node, symbol2)); } else if (node.initializer && (((_a3 = symbol2.declarations) == null ? void 0 : _a3.length) === 1 || countWhere(symbol2.declarations, isVariableDeclaration7) === 1)) { if (!resolver.isExpandoFunctionDeclaration(node) && !isContextuallyTyped(node)) { resultType = typeFromExpression( node.initializer, - context, + context2, /*isConstContext*/ void 0, /*requiresAddingUndefined*/ @@ -169025,65 +172300,65 @@ ${lanes.join("\n")} ); } } - return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context, resultType.reportFallback); + return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context2, resultType.reportFallback); } - function typeFromParameter(node, symbol2, context) { + function typeFromParameter(node, symbol2, context2) { const parent2 = node.parent; if (parent2.kind === 179) { return serializeTypeOfAccessor( parent2, /*symbol*/ void 0, - context + context2 ); } const declaredType = getEffectiveTypeAnnotationNode(node); - const addUndefined = resolver.requiresAddingImplicitUndefined(node, symbol2, context.enclosingDeclaration); + const addUndefined = resolver.requiresAddingImplicitUndefined(node, symbol2, context2.enclosingDeclaration); let resultType = failed; if (declaredType) { - resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2, addUndefined)); - } else if (isParameter(node) && node.initializer && isIdentifier26(node.name) && !isContextuallyTyped(node)) { + resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context2, node, symbol2, addUndefined)); + } else if (isParameter(node) && node.initializer && isIdentifier28(node.name) && !isContextuallyTyped(node)) { resultType = typeFromExpression( node.initializer, - context, + context2, /*isConstContext*/ void 0, addUndefined ); } - return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context, resultType.reportFallback); + return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context2, resultType.reportFallback); } - function typeFromExpandoProperty(node, symbol2, context) { + function typeFromExpandoProperty(node, symbol2, context2) { const declaredType = getEffectiveTypeAnnotationNode(node); let result; if (declaredType) { - result = serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2); + result = serializeTypeAnnotationOfDeclaration(declaredType, context2, node, symbol2); } - const oldSuppressReportInferenceFallback = context.suppressReportInferenceFallback; - context.suppressReportInferenceFallback = true; + const oldSuppressReportInferenceFallback = context2.suppressReportInferenceFallback; + context2.suppressReportInferenceFallback = true; const resultType = result ?? inferTypeOfDeclaration( node, symbol2, - context, + context2, /*reportFallback*/ false ); - context.suppressReportInferenceFallback = oldSuppressReportInferenceFallback; + context2.suppressReportInferenceFallback = oldSuppressReportInferenceFallback; return resultType; } - function typeFromProperty(node, symbol2, context) { + function typeFromProperty(node, symbol2, context2) { const declaredType = getEffectiveTypeAnnotationNode(node); - const requiresAddingUndefined = resolver.requiresAddingImplicitUndefined(node, symbol2, context.enclosingDeclaration); + const requiresAddingUndefined = resolver.requiresAddingImplicitUndefined(node, symbol2, context2.enclosingDeclaration); let resultType = failed; if (declaredType) { - resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2, requiresAddingUndefined)); + resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context2, node, symbol2, requiresAddingUndefined)); } else { const initializer3 = isPropertyDeclaration(node) ? node.initializer : void 0; if (initializer3 && !isContextuallyTyped(node)) { const isReadonly = isDeclarationReadonly(node); resultType = typeFromExpression( initializer3, - context, + context2, /*isConstContext*/ void 0, requiresAddingUndefined, @@ -169091,90 +172366,90 @@ ${lanes.join("\n")} ); } } - return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context, resultType.reportFallback); + return resultType.type !== void 0 ? resultType.type : inferTypeOfDeclaration(node, symbol2, context2, resultType.reportFallback); } - function inferTypeOfDeclaration(node, symbol2, context, reportFallback = true) { + function inferTypeOfDeclaration(node, symbol2, context2, reportFallback = true) { if (reportFallback) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } - if (context.noInferenceFallback === true) { + if (context2.noInferenceFallback === true) { return factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - return resolver.serializeTypeOfDeclaration(context, node, symbol2); + return resolver.serializeTypeOfDeclaration(context2, node, symbol2); } - function inferExpressionType(node, context, reportFallback = true, requiresAddingUndefined) { + function inferExpressionType(node, context2, reportFallback = true, requiresAddingUndefined) { Debug.assert(!requiresAddingUndefined); if (reportFallback) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } - if (context.noInferenceFallback === true) { + if (context2.noInferenceFallback === true) { return factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode( + return resolver.serializeTypeOfExpression(context2, node) ?? factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - function inferReturnTypeOfSignatureSignature(node, context, symbol2, reportFallback) { + function inferReturnTypeOfSignatureSignature(node, context2, symbol2, reportFallback) { if (reportFallback) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } - if (context.noInferenceFallback === true) { + if (context2.noInferenceFallback === true) { return factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - return resolver.serializeReturnTypeForSignature(context, node, symbol2) ?? factory.createKeywordTypeNode( + return resolver.serializeReturnTypeForSignature(context2, node, symbol2) ?? factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } - function inferAccessorType(node, allAccessors, context, symbol2, reportFallback = true) { + function inferAccessorType(node, allAccessors, context2, symbol2, reportFallback = true) { if (node.kind === 178) { - return createReturnFromSignature(node, symbol2, context, reportFallback); + return createReturnFromSignature(node, symbol2, context2, reportFallback); } else { if (reportFallback) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } - const result = allAccessors.getAccessor && createReturnFromSignature(allAccessors.getAccessor, symbol2, context, reportFallback); - return result ?? resolver.serializeTypeOfDeclaration(context, node, symbol2) ?? factory.createKeywordTypeNode( + const result = allAccessors.getAccessor && createReturnFromSignature(allAccessors.getAccessor, symbol2, context2, reportFallback); + return result ?? resolver.serializeTypeOfDeclaration(context2, node, symbol2) ?? factory.createKeywordTypeNode( 133 /* AnyKeyword */ ); } } - function withNewScope(context, node, fn) { - const cleanup = resolver.enterNewScope(context, node); + function withNewScope(context2, node, fn) { + const cleanup = resolver.enterNewScope(context2, node); const result = fn(); cleanup(); return result; } - function typeFromTypeAssertion(expression, type, context, requiresAddingUndefined) { + function typeFromTypeAssertion(expression, type, context2, requiresAddingUndefined) { if (isConstTypeReference(type)) { return typeFromExpression( expression, - context, + context2, /*isConstContext*/ true, requiresAddingUndefined ); } - return syntacticResult(serializeExistingTypeNodeWithFallback(type, context, requiresAddingUndefined)); + return syntacticResult(serializeExistingTypeNodeWithFallback(type, context2, requiresAddingUndefined)); } - function typeFromExpression(node, context, isConstContext = false, requiresAddingUndefined = false, preserveLiterals = false) { + function typeFromExpression(node, context2, isConstContext = false, requiresAddingUndefined = false, preserveLiterals = false) { switch (node.kind) { case 218: if (isJSDocTypeAssertion(node)) { - return typeFromTypeAssertion(node.expression, getJSDocTypeAssertionType(node), context, requiresAddingUndefined); + return typeFromTypeAssertion(node.expression, getJSDocTypeAssertionType(node), context2, requiresAddingUndefined); } - return typeFromExpression(node.expression, context, isConstContext, requiresAddingUndefined); + return typeFromExpression(node.expression, context2, isConstContext, requiresAddingUndefined); case 80: if (resolver.isUndefinedIdentifierExpression(node)) { return syntacticResult(createUndefinedTypeNode()); @@ -169182,7 +172457,7 @@ ${lanes.join("\n")} break; case 106: if (strictNullChecks) { - return syntacticResult(addUndefinedIfNeeded(factory.createLiteralTypeNode(factory.createNull()), requiresAddingUndefined, node, context)); + return syntacticResult(addUndefinedIfNeeded(factory.createLiteralTypeNode(factory.createNull()), requiresAddingUndefined, node, context2)); } else { return syntacticResult(factory.createKeywordTypeNode( 133 @@ -169192,31 +172467,31 @@ ${lanes.join("\n")} case 220: case 219: Debug.type(node); - return withNewScope(context, node, () => typeFromFunctionLikeExpression(node, context)); + return withNewScope(context2, node, () => typeFromFunctionLikeExpression(node, context2)); case 217: case 235: const asExpression = node; - return typeFromTypeAssertion(asExpression.expression, asExpression.type, context, requiresAddingUndefined); + return typeFromTypeAssertion(asExpression.expression, asExpression.type, context2, requiresAddingUndefined); case 225: const unaryExpression = node; if (isPrimitiveLiteralValue(unaryExpression)) { return typeFromPrimitiveLiteral( unaryExpression.operator === 40 ? unaryExpression.operand : unaryExpression, unaryExpression.operand.kind === 10 ? 163 : 150, - context, + context2, isConstContext || preserveLiterals, requiresAddingUndefined ); } break; case 210: - return typeFromArrayLiteral(node, context, isConstContext, requiresAddingUndefined); + return typeFromArrayLiteral(node, context2, isConstContext, requiresAddingUndefined); case 211: - return typeFromObjectLiteral(node, context, isConstContext, requiresAddingUndefined); + return typeFromObjectLiteral(node, context2, isConstContext, requiresAddingUndefined); case 232: return syntacticResult(inferExpressionType( node, - context, + context2, /*reportFallback*/ true, requiresAddingUndefined @@ -169252,20 +172527,20 @@ ${lanes.join("\n")} break; } if (typeKind) { - return typeFromPrimitiveLiteral(primitiveNode, typeKind, context, isConstContext || preserveLiterals, requiresAddingUndefined); + return typeFromPrimitiveLiteral(primitiveNode, typeKind, context2, isConstContext || preserveLiterals, requiresAddingUndefined); } } return failed; } - function typeFromFunctionLikeExpression(fnNode, context) { + function typeFromFunctionLikeExpression(fnNode, context2) { const returnType = createReturnFromSignature( fnNode, /*symbol*/ void 0, - context + context2 ); - const typeParameters = reuseTypeParameters(fnNode.typeParameters, context); - const parameters = fnNode.parameters.map((p) => ensureParameter(p, context)); + const typeParameters = reuseTypeParameters(fnNode.typeParameters, context2); + const parameters = fnNode.parameters.map((p) => ensureParameter(p, context2)); return syntacticResult( factory.createFunctionTypeNode( typeParameters, @@ -169274,34 +172549,34 @@ ${lanes.join("\n")} ) ); } - function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) { + function canGetTypeFromArrayLiteral(arrayLiteral, context2, isConstContext) { if (!isConstContext) { - context.tracker.reportInferenceFallback(arrayLiteral); + context2.tracker.reportInferenceFallback(arrayLiteral); return false; } for (const element of arrayLiteral.elements) { if (element.kind === 231) { - context.tracker.reportInferenceFallback(element); + context2.tracker.reportInferenceFallback(element); return false; } } return true; } - function typeFromArrayLiteral(arrayLiteral, context, isConstContext, requiresAddingUndefined) { - if (!canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext)) { + function typeFromArrayLiteral(arrayLiteral, context2, isConstContext, requiresAddingUndefined) { + if (!canGetTypeFromArrayLiteral(arrayLiteral, context2, isConstContext)) { if (requiresAddingUndefined || isDeclaration(walkUpParenthesizedExpressions(arrayLiteral).parent)) { return alreadyReported; } return syntacticResult(inferExpressionType( arrayLiteral, - context, + context2, /*reportFallback*/ false, requiresAddingUndefined )); } - const oldNoInferenceFallback = context.noInferenceFallback; - context.noInferenceFallback = true; + const oldNoInferenceFallback = context2.noInferenceFallback; + context2.noInferenceFallback = true; const elementTypesInfo = []; for (const element of arrayLiteral.elements) { Debug.assert( @@ -169313,17 +172588,17 @@ ${lanes.join("\n")} createUndefinedTypeNode() ); } else { - const expressionType = typeFromExpression(element, context, isConstContext); - const elementType = expressionType.type !== void 0 ? expressionType.type : inferExpressionType(element, context, expressionType.reportFallback); + const expressionType = typeFromExpression(element, context2, isConstContext); + const elementType = expressionType.type !== void 0 ? expressionType.type : inferExpressionType(element, context2, expressionType.reportFallback); elementTypesInfo.push(elementType); } } const tupleType = factory.createTupleTypeNode(elementTypesInfo); tupleType.emitNode = { flags: 1, autoGenerate: void 0, internalFlags: 0 }; - context.noInferenceFallback = oldNoInferenceFallback; + context2.noInferenceFallback = oldNoInferenceFallback; return notImplemented2; } - function canGetTypeFromObjectLiteral(objectLiteral, context) { + function canGetTypeFromObjectLiteral(objectLiteral, context2) { let result = true; for (const prop of objectLiteral.properties) { if (prop.flags & 262144) { @@ -169331,7 +172606,7 @@ ${lanes.join("\n")} break; } if (prop.kind === 305 || prop.kind === 306) { - context.tracker.reportInferenceFallback(prop); + context2.tracker.reportInferenceFallback(prop); result = false; } else if (prop.name.flags & 262144) { result = false; @@ -169345,45 +172620,45 @@ ${lanes.join("\n")} /*includeBigInt*/ false ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) { - context.tracker.reportInferenceFallback(prop.name); + context2.tracker.reportInferenceFallback(prop.name); result = false; } } } return result; } - function typeFromObjectLiteral(objectLiteral, context, isConstContext, requiresAddingUndefined) { - if (!canGetTypeFromObjectLiteral(objectLiteral, context)) { + function typeFromObjectLiteral(objectLiteral, context2, isConstContext, requiresAddingUndefined) { + if (!canGetTypeFromObjectLiteral(objectLiteral, context2)) { if (requiresAddingUndefined || isDeclaration(walkUpParenthesizedExpressions(objectLiteral).parent)) { return alreadyReported; } return syntacticResult(inferExpressionType( objectLiteral, - context, + context2, /*reportFallback*/ false, requiresAddingUndefined )); } - const oldNoInferenceFallback = context.noInferenceFallback; - context.noInferenceFallback = true; + const oldNoInferenceFallback = context2.noInferenceFallback; + context2.noInferenceFallback = true; const properties = []; - const oldFlags = context.flags; - context.flags |= 4194304; + const oldFlags = context2.flags; + context2.flags |= 4194304; for (const prop of objectLiteral.properties) { - Debug.assert(!isShorthandPropertyAssignment6(prop) && !isSpreadAssignment6(prop)); + Debug.assert(!isShorthandPropertyAssignment7(prop) && !isSpreadAssignment7(prop)); const name = prop.name; let newProp; switch (prop.kind) { case 175: - newProp = withNewScope(context, prop, () => typeFromObjectLiteralMethod(prop, name, context, isConstContext)); + newProp = withNewScope(context2, prop, () => typeFromObjectLiteralMethod(prop, name, context2, isConstContext)); break; case 304: - newProp = typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext); + newProp = typeFromObjectLiteralPropertyAssignment(prop, name, context2, isConstContext); break; case 179: case 178: - newProp = typeFromObjectLiteralAccessor(prop, name, context); + newProp = typeFromObjectLiteralAccessor(prop, name, context2); break; } if (newProp) { @@ -169391,46 +172666,46 @@ ${lanes.join("\n")} properties.push(newProp); } } - context.flags = oldFlags; + context2.flags = oldFlags; const typeNode = factory.createTypeLiteralNode(properties); - if (!(context.flags & 1024)) { + if (!(context2.flags & 1024)) { setEmitFlags( typeNode, 1 /* SingleLine */ ); } - context.noInferenceFallback = oldNoInferenceFallback; + context2.noInferenceFallback = oldNoInferenceFallback; return notImplemented2; } - function typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) { + function typeFromObjectLiteralPropertyAssignment(prop, name, context2, isConstContext) { const modifiers = isConstContext ? [factory.createModifier( 148 /* ReadonlyKeyword */ )] : []; - const expressionResult = typeFromExpression(prop.initializer, context, isConstContext); + const expressionResult = typeFromExpression(prop.initializer, context2, isConstContext); const typeNode = expressionResult.type !== void 0 ? expressionResult.type : inferTypeOfDeclaration( prop, /*symbol*/ void 0, - context, + context2, expressionResult.reportFallback ); return factory.createPropertySignature( modifiers, - reuseNode(context, name), + reuseNode(context2, name), /*questionToken*/ void 0, typeNode ); } - function ensureParameter(p, context) { + function ensureParameter(p, context2) { return factory.updateParameterDeclaration( p, /*modifiers*/ void 0, - reuseNode(context, p.dotDotDotToken), - resolver.serializeNameOfParameter(context, p), + reuseNode(context2, p.dotDotDotToken), + resolver.serializeNameOfParameter(context2, p), resolver.isOptionalParameter(p) ? factory.createToken( 58 /* QuestionToken */ @@ -169439,43 +172714,43 @@ ${lanes.join("\n")} p, /*symbol*/ void 0, - context + context2 ), // Ignore private param props, since this type is going straight back into a param /*initializer*/ void 0 ); } - function reuseTypeParameters(typeParameters, context) { + function reuseTypeParameters(typeParameters, context2) { return typeParameters == null ? void 0 : typeParameters.map((tp) => { var _a3; - const { node: tpName } = resolver.trackExistingEntityName(context, tp.name); + const { node: tpName } = resolver.trackExistingEntityName(context2, tp.name); return factory.updateTypeParameterDeclaration( tp, - (_a3 = tp.modifiers) == null ? void 0 : _a3.map((m) => reuseNode(context, m)), + (_a3 = tp.modifiers) == null ? void 0 : _a3.map((m) => reuseNode(context2, m)), tpName, - serializeExistingTypeNodeWithFallback(tp.constraint, context), - serializeExistingTypeNodeWithFallback(tp.default, context) + serializeExistingTypeNodeWithFallback(tp.constraint, context2), + serializeExistingTypeNodeWithFallback(tp.default, context2) ); }); } - function typeFromObjectLiteralMethod(method, name, context, isConstContext) { + function typeFromObjectLiteralMethod(method, name, context2, isConstContext) { const returnType = createReturnFromSignature( method, /*symbol*/ void 0, - context + context2 ); - const typeParameters = reuseTypeParameters(method.typeParameters, context); - const parameters = method.parameters.map((p) => ensureParameter(p, context)); + const typeParameters = reuseTypeParameters(method.typeParameters, context2); + const parameters = method.parameters.map((p) => ensureParameter(p, context2)); if (isConstContext) { return factory.createPropertySignature( [factory.createModifier( 148 /* ReadonlyKeyword */ )], - reuseNode(context, name), - reuseNode(context, method.questionToken), + reuseNode(context2, name), + reuseNode(context2, method.questionToken), factory.createFunctionTypeNode( typeParameters, parameters, @@ -169483,33 +172758,33 @@ ${lanes.join("\n")} ) ); } else { - if (isIdentifier26(name) && name.escapedText === "new") { + if (isIdentifier28(name) && name.escapedText === "new") { name = factory.createStringLiteral("new"); } return factory.createMethodSignature( [], - reuseNode(context, name), - reuseNode(context, method.questionToken), + reuseNode(context2, name), + reuseNode(context2, method.questionToken), typeParameters, parameters, returnType ); } } - function typeFromObjectLiteralAccessor(accessor, name, context) { + function typeFromObjectLiteralAccessor(accessor, name, context2) { const allAccessors = resolver.getAllAccessorDeclarations(accessor); const getAccessorType = allAccessors.getAccessor && getTypeAnnotationFromAccessor(allAccessors.getAccessor); const setAccessorType = allAccessors.setAccessor && getTypeAnnotationFromAccessor(allAccessors.setAccessor); if (getAccessorType !== void 0 && setAccessorType !== void 0) { - return withNewScope(context, accessor, () => { - const parameters = accessor.parameters.map((p) => ensureParameter(p, context)); + return withNewScope(context2, accessor, () => { + const parameters = accessor.parameters.map((p) => ensureParameter(p, context2)); if (isGetAccessor(accessor)) { return factory.updateGetAccessorDeclaration( accessor, [], - reuseNode(context, name), + reuseNode(context2, name), parameters, - serializeExistingTypeNodeWithFallback(getAccessorType, context), + serializeExistingTypeNodeWithFallback(getAccessorType, context2), /*body*/ void 0 ); @@ -169517,7 +172792,7 @@ ${lanes.join("\n")} return factory.updateSetAccessorDeclaration( accessor, [], - reuseNode(context, name), + reuseNode(context2, name), parameters, /*body*/ void 0 @@ -169525,11 +172800,11 @@ ${lanes.join("\n")} } }); } else if (allAccessors.firstAccessor === accessor) { - const foundType = getAccessorType ? withNewScope(context, allAccessors.getAccessor, () => serializeExistingTypeNodeWithFallback(getAccessorType, context)) : setAccessorType ? withNewScope(context, allAccessors.setAccessor, () => serializeExistingTypeNodeWithFallback(setAccessorType, context)) : void 0; + const foundType = getAccessorType ? withNewScope(context2, allAccessors.getAccessor, () => serializeExistingTypeNodeWithFallback(getAccessorType, context2)) : setAccessorType ? withNewScope(context2, allAccessors.setAccessor, () => serializeExistingTypeNodeWithFallback(setAccessorType, context2)) : void 0; const propertyType = foundType ?? inferAccessorType( accessor, allAccessors, - context, + context2, /*symbol*/ void 0 ); @@ -169538,7 +172813,7 @@ ${lanes.join("\n")} 148 /* ReadonlyKeyword */ )] : [], - reuseNode(context, name), + reuseNode(context2, name), /*questionToken*/ void 0, propertyType @@ -169559,24 +172834,24 @@ ${lanes.join("\n")} ); } } - function typeFromPrimitiveLiteral(node, baseType, context, preserveLiterals, requiresAddingUndefined) { + function typeFromPrimitiveLiteral(node, baseType, context2, preserveLiterals, requiresAddingUndefined) { let result; if (preserveLiterals) { if (node.kind === 225 && node.operator === 40) { - result = factory.createLiteralTypeNode(reuseNode(context, node.operand)); + result = factory.createLiteralTypeNode(reuseNode(context2, node.operand)); } - result = factory.createLiteralTypeNode(reuseNode(context, node)); + result = factory.createLiteralTypeNode(reuseNode(context2, node)); } else { result = factory.createKeywordTypeNode(baseType); } - return syntacticResult(addUndefinedIfNeeded(result, requiresAddingUndefined, node, context)); + return syntacticResult(addUndefinedIfNeeded(result, requiresAddingUndefined, node, context2)); } - function addUndefinedIfNeeded(node, addUndefined, owner, context) { + function addUndefinedIfNeeded(node, addUndefined, owner, context2) { const parentDeclaration = owner && walkUpParenthesizedExpressions(owner).parent; const optionalDeclaration = parentDeclaration && isDeclaration(parentDeclaration) && isOptionalDeclaration(parentDeclaration); if (!strictNullChecks || !(addUndefined || optionalDeclaration)) return node; if (!canAddUndefined(node)) { - context.tracker.reportInferenceFallback(node); + context2.tracker.reportInferenceFallback(node); } if (isUnionTypeNode2(node)) { return factory.createUnionTypeNode([...node.types, factory.createKeywordTypeNode( @@ -169602,17 +172877,17 @@ ${lanes.join("\n")} } return false; } - function createReturnFromSignature(fn, symbol2, context, reportFallback = true) { + function createReturnFromSignature(fn, symbol2, context2, reportFallback = true) { let returnType = failed; const returnTypeNode = isJSDocConstructSignature(fn) ? getEffectiveTypeAnnotationNode(fn.parameters[0]) : getEffectiveReturnTypeNode(fn); if (returnTypeNode) { - returnType = syntacticResult(serializeTypeAnnotationOfDeclaration(returnTypeNode, context, fn, symbol2)); + returnType = syntacticResult(serializeTypeAnnotationOfDeclaration(returnTypeNode, context2, fn, symbol2)); } else if (isValueSignatureDeclaration(fn)) { - returnType = typeFromSingleReturnExpression(fn, context); + returnType = typeFromSingleReturnExpression(fn, context2); } - return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol2, reportFallback && returnType.reportFallback && !returnTypeNode); + return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context2, symbol2, reportFallback && returnType.reportFallback && !returnTypeNode); } - function typeFromSingleReturnExpression(declaration, context) { + function typeFromSingleReturnExpression(declaration, context2) { let candidateExpr; if (declaration && !nodeIsMissing(declaration.body)) { const flags = getFunctionFlags(declaration); @@ -169637,12 +172912,12 @@ ${lanes.join("\n")} } if (candidateExpr) { if (isContextuallyTyped(candidateExpr)) { - const type = isJSDocTypeAssertion(candidateExpr) ? getJSDocTypeAssertionType(candidateExpr) : isAsExpression7(candidateExpr) || isTypeAssertionExpression2(candidateExpr) ? candidateExpr.type : void 0; + const type = isJSDocTypeAssertion(candidateExpr) ? getJSDocTypeAssertionType(candidateExpr) : isAsExpression8(candidateExpr) || isTypeAssertionExpression3(candidateExpr) ? candidateExpr.type : void 0; if (type && !isConstTypeReference(type)) { - return syntacticResult(serializeExistingTypeNode(type, context)); + return syntacticResult(serializeExistingTypeNode(type, context2)); } } else { - return typeFromExpression(candidateExpr, context); + return typeFromExpression(candidateExpr, context2); } } return failed; @@ -170329,7 +173604,7 @@ ${lanes.join("\n")} const parent2 = node.parent; if (node.kind === 308) { return 1; - } else if (isExportAssignment3(parent2) || isExportSpecifier(parent2) || isExternalModuleReference(parent2) || isImportSpecifier(parent2) || isImportClause(parent2) || isImportEqualsDeclaration(parent2) && node === parent2.name) { + } else if (isExportAssignment4(parent2) || isExportSpecifier(parent2) || isExternalModuleReference(parent2) || isImportSpecifier(parent2) || isImportClause(parent2) || isImportEqualsDeclaration(parent2) && node === parent2.name) { return 7; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { return getMeaningFromRightHandSideOfImportEquals(node); @@ -170462,18 +173737,18 @@ ${lanes.join("\n")} return void 0; } function hasPropertyAccessExpressionWithName(node, funcName) { - if (!isPropertyAccessExpression16(node.expression)) { + if (!isPropertyAccessExpression17(node.expression)) { return false; } return node.expression.name.text === funcName; } function isJumpStatementTarget(node) { var _a3; - return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a3.label) === node; + return isIdentifier28(node) && ((_a3 = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a3.label) === node; } function isLabelOfLabeledStatement(node) { var _a3; - return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a3.label) === node; + return isIdentifier28(node) && ((_a3 = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a3.label) === node; } function isLabelName(node) { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); @@ -170488,7 +173763,7 @@ ${lanes.join("\n")} } function isRightSideOfPropertyAccess(node) { var _a3; - return ((_a3 = tryCast(node.parent, isPropertyAccessExpression16)) == null ? void 0 : _a3.name) === node; + return ((_a3 = tryCast(node.parent, isPropertyAccessExpression17)) == null ? void 0 : _a3.name) === node; } function isArgumentExpressionOfElementAccess(node) { var _a3; @@ -170500,7 +173775,7 @@ ${lanes.join("\n")} } function isNameOfFunctionDeclaration(node) { var _a3; - return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a3.name) === node; + return isIdentifier28(node) && ((_a3 = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a3.name) === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { @@ -170919,7 +174194,7 @@ ${lanes.join("\n")} return node.importClause.name; } if (node.importClause.namedBindings) { - if (isNamedImports5(node.importClause.namedBindings)) { + if (isNamedImports6(node.importClause.namedBindings)) { const onlyBinding = singleOrUndefined(node.importClause.namedBindings.elements); if (!onlyBinding) { return; @@ -170957,7 +174232,7 @@ ${lanes.join("\n")} } function getAdjustedLocation(node, forRename) { const { parent: parent2 } = node; - if (isModifier(node) && (forRename || node.kind !== 90) ? canHaveModifiers(parent2) && contains(parent2.modifiers, node) : node.kind === 86 ? isClassDeclaration5(parent2) || isClassExpression(node) : node.kind === 100 ? isFunctionDeclaration5(parent2) || isFunctionExpression7(node) : node.kind === 120 ? isInterfaceDeclaration2(parent2) : node.kind === 94 ? isEnumDeclaration(parent2) : node.kind === 156 ? isTypeAliasDeclaration2(parent2) : node.kind === 145 || node.kind === 144 ? isModuleDeclaration(parent2) : node.kind === 102 ? isImportEqualsDeclaration(parent2) : node.kind === 139 ? isGetAccessorDeclaration(parent2) : node.kind === 153 && isSetAccessorDeclaration(parent2)) { + if (isModifier(node) && (forRename || node.kind !== 90) ? canHaveModifiers2(parent2) && contains(parent2.modifiers, node) : node.kind === 86 ? isClassDeclaration5(parent2) || isClassExpression(node) : node.kind === 100 ? isFunctionDeclaration5(parent2) || isFunctionExpression7(node) : node.kind === 120 ? isInterfaceDeclaration2(parent2) : node.kind === 94 ? isEnumDeclaration(parent2) : node.kind === 156 ? isTypeAliasDeclaration2(parent2) : node.kind === 145 || node.kind === 144 ? isModuleDeclaration(parent2) : node.kind === 102 ? isImportEqualsDeclaration(parent2) : node.kind === 139 ? isGetAccessorDeclaration(parent2) : node.kind === 153 && isSetAccessorDeclaration(parent2)) { const location = getAdjustedLocationForDeclaration(parent2, forRename); if (location) { return location; @@ -170965,7 +174240,7 @@ ${lanes.join("\n")} } if ((node.kind === 115 || node.kind === 87 || node.kind === 121) && isVariableDeclarationList(parent2) && parent2.declarations.length === 1) { const decl = parent2.declarations[0]; - if (isIdentifier26(decl.name)) { + if (isIdentifier28(decl.name)) { return decl.name; } } @@ -170976,7 +174251,7 @@ ${lanes.join("\n")} return location; } } - if (isExportDeclaration2(parent2) && parent2.isTypeOnly) { + if (isExportDeclaration3(parent2) && parent2.isTypeOnly) { const location = getAdjustedLocationForExportDeclaration(parent2, forRename); if (location) { return location; @@ -170987,31 +174262,31 @@ ${lanes.join("\n")} if (isImportSpecifier(parent2) && parent2.propertyName || isExportSpecifier(parent2) && parent2.propertyName || isNamespaceImport5(parent2) || isNamespaceExport(parent2)) { return parent2.name; } - if (isExportDeclaration2(parent2) && parent2.exportClause && isNamespaceExport(parent2.exportClause)) { + if (isExportDeclaration3(parent2) && parent2.exportClause && isNamespaceExport(parent2.exportClause)) { return parent2.exportClause.name; } } - if (node.kind === 102 && isImportDeclaration7(parent2)) { + if (node.kind === 102 && isImportDeclaration8(parent2)) { const location = getAdjustedLocationForImportDeclaration(parent2, forRename); if (location) { return location; } } if (node.kind === 95) { - if (isExportDeclaration2(parent2)) { + if (isExportDeclaration3(parent2)) { const location = getAdjustedLocationForExportDeclaration(parent2, forRename); if (location) { return location; } } - if (isExportAssignment3(parent2)) { + if (isExportAssignment4(parent2)) { return skipOuterExpressions(parent2.expression); } } if (node.kind === 149 && isExternalModuleReference(parent2)) { return parent2.expression; } - if (node.kind === 161 && (isImportDeclaration7(parent2) || isExportDeclaration2(parent2)) && parent2.moduleSpecifier) { + if (node.kind === 161 && (isImportDeclaration8(parent2) || isExportDeclaration3(parent2)) && parent2.moduleSpecifier) { return parent2.moduleSpecifier; } if ((node.kind === 96 || node.kind === 119) && isHeritageClause(parent2) && parent2.token === node.kind) { @@ -171049,7 +174324,7 @@ ${lanes.join("\n")} if ((node.kind === 103 || node.kind === 104) && isBinaryExpression4(parent2) && parent2.operatorToken === node) { return skipOuterExpressions(parent2.right); } - if (node.kind === 130 && isAsExpression7(parent2) && isTypeReferenceNode3(parent2.type)) { + if (node.kind === 130 && isAsExpression8(parent2) && isTypeReferenceNode3(parent2.type)) { return parent2.type.typeName; } if (node.kind === 103 && isForInStatement(parent2) || node.kind === 165 && isForOfStatement(parent2)) { @@ -171424,7 +174699,7 @@ ${lanes.join("\n")} if (token && token.kind === 29) { token = findPrecedingToken(token.getFullStart(), sourceFile); } - if (!token || !isIdentifier26(token)) return void 0; + if (!token || !isIdentifier28(token)) return void 0; if (!remainingLessThanTokens) { return isDeclarationName(token) ? void 0 : { called: token, nTypeArguments }; } @@ -171689,7 +174964,7 @@ ${lanes.join("\n")} return node.kind === 156; } function isTypeKeywordTokenOrIdentifier(node) { - return isTypeKeywordToken(node) || isIdentifier26(node) && node.text === "type"; + return isTypeKeywordToken(node) || isIdentifier28(node) && node.text === "type"; } function nodeSeenTracker() { const seen = []; @@ -171812,14 +175087,14 @@ ${lanes.join("\n")} }); } function isModuleSpecifierLike(node) { - return isStringLiteralLike4(node) && (isExternalModuleReference(node.parent) || isImportDeclaration7(node.parent) || isJSDocImportTag(node.parent) || isRequireCall( + return isStringLiteralLike4(node) && (isExternalModuleReference(node.parent) || isImportDeclaration8(node.parent) || isJSDocImportTag(node.parent) || isRequireCall( node.parent, /*requireStringLiteralLikeArgument*/ false ) && node.parent.arguments[0] === node || isImportCall(node.parent) && node.parent.arguments[0] === node); } function isObjectBindingElementWithoutPropertyName(bindingElement) { - return isBindingElement(bindingElement) && isObjectBindingPattern3(bindingElement.parent) && isIdentifier26(bindingElement.name) && !bindingElement.propertyName; + return isBindingElement(bindingElement) && isObjectBindingPattern3(bindingElement.parent) && isIdentifier28(bindingElement.name) && !bindingElement.propertyName; } function getPropertySymbolFromBindingElement(checker, bindingElement) { const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); @@ -171838,7 +175113,7 @@ ${lanes.join("\n")} return textSpanContainsPosition(span, node.getStart(file2)) && node.getEnd() <= textSpanEnd(span); } function findModifier(node, kind) { - return canHaveModifiers(node) ? find(node.modifiers, (m) => m.kind === kind) : void 0; + return canHaveModifiers2(node) ? find(node.modifiers, (m) => m.kind === kind) : void 0; } function insertImports(changes, sourceFile, imports, blankLineBetween, preferences) { var _a3; @@ -172432,7 +175707,7 @@ ${lanes.join("\n")} return idx === -1 ? -1 : idx + 1; } function needsParentheses(expression) { - return isBinaryExpression4(expression) && expression.operatorToken.kind === 28 || isObjectLiteralExpression12(expression) || (isAsExpression7(expression) || isSatisfiesExpression5(expression)) && isObjectLiteralExpression12(expression.expression); + return isBinaryExpression4(expression) && expression.operatorToken.kind === 28 || isObjectLiteralExpression13(expression) || (isAsExpression8(expression) || isSatisfiesExpression6(expression)) && isObjectLiteralExpression13(expression.expression); } function getContextualTypeFromParent(node, checker, contextFlags) { const parent2 = walkUpParenthesizedExpressions(node.parent); @@ -172557,8 +175832,8 @@ ${lanes.join("\n")} const endLine = sourceFile.getLineAndCharacterOfPosition(nextToken.getStart(sourceFile)).line; return startLine !== endLine; } - function positionIsASICandidate(pos, context, sourceFile) { - const contextAncestor = findAncestor(context, (ancestor) => { + function positionIsASICandidate(pos, context2, sourceFile) { + const contextAncestor = findAncestor(context2, (ancestor) => { if (ancestor.end !== pos) { return "quit"; } @@ -172902,13 +176177,13 @@ ${lanes.join("\n")} function getDefaultLikeExportNameFromDeclaration(symbol2) { return firstDefined(symbol2.declarations, (d) => { var _a3, _b, _c; - if (isExportAssignment3(d)) { - return (_a3 = tryCast(skipOuterExpressions(d.expression), isIdentifier26)) == null ? void 0 : _a3.text; + if (isExportAssignment4(d)) { + return (_a3 = tryCast(skipOuterExpressions(d.expression), isIdentifier28)) == null ? void 0 : _a3.text; } if (isExportSpecifier(d) && d.symbol.flags === 2097152) { - return (_b = tryCast(d.propertyName, isIdentifier26)) == null ? void 0 : _b.text; + return (_b = tryCast(d.propertyName, isIdentifier28)) == null ? void 0 : _b.text; } - const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier26)) == null ? void 0 : _c.text; + const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier28)) == null ? void 0 : _c.text; if (name) { return name; } @@ -173427,8 +176702,8 @@ ${lanes.join("\n")} } function getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2) { return mapDefined(preferences.autoImportFileExcludePatterns, (spec) => { - const pattern = getSubPatternFromSpec(spec, "", "exclude"); - return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0; + const pattern2 = getSubPatternFromSpec(spec, "", "exclude"); + return pattern2 ? getRegexFromPattern(pattern2, useCaseSensitiveFileNames2) : void 0; }); } function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) { @@ -174003,7 +177278,7 @@ ${lanes.join("\n")} return; } checkForClassificationCancellation(cancellationToken, node.kind); - if (isIdentifier26(node) && !nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { + if (isIdentifier28(node) && !nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { const symbol2 = typeChecker.getSymbolAtLocation(node); const type = symbol2 && classifySymbol(symbol2, getMeaningFromLocation(node), typeChecker); if (type) { @@ -174695,7 +177970,7 @@ ${lanes.join("\n")} case 147: return void 0; default: - return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement11(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0; + return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement12(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0; } function getFromAllDeclarations(nodeTest, keywords) { return useParent(node.parent, nodeTest, (decl) => { @@ -175455,9 +178730,9 @@ ${lanes.join("\n")} return createRange(node.getStart(sourceFile) + 1, node.end - 1); } function forEachProperty(objectLiteral, cb) { - if (!isObjectLiteralExpression12(objectLiteral)) return; + if (!isObjectLiteralExpression13(objectLiteral)) return; for (const property of objectLiteral.properties) { - if (isPropertyAssignment11(property) && isStringLiteral15(property.name)) { + if (isPropertyAssignment12(property) && isStringLiteral15(property.name)) { cb(property, property.name.text); } } @@ -175475,9 +178750,9 @@ ${lanes.join("\n")} isCaseSensitive }; } - function createPatternMatcher(pattern) { + function createPatternMatcher(pattern2) { const stringToWordSpans = /* @__PURE__ */ new Map(); - const dotSeparatedSegments = pattern.trim().split(".").map((p) => createSegment(p.trim())); + const dotSeparatedSegments = pattern2.trim().split(".").map((p) => createSegment(p.trim())); if (dotSeparatedSegments.length === 1 && dotSeparatedSegments[0].totalTextChunk.text === "") { return { getMatchForLastSegmentOfPattern: () => createPatternMatch( @@ -175612,8 +178887,8 @@ ${lanes.join("\n")} function compareMatches(a, b) { return a === void 0 ? 1 : b === void 0 ? -1 : compareValues(a.kind, b.kind) || compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } - function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan = { start: 0, length: pattern.length }) { - return patternSpan.length <= candidateSpan.length && everyInRange(0, patternSpan.length, (i) => equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase)); + function partStartsWith(candidate, candidateSpan, pattern2, ignoreCase, patternSpan = { start: 0, length: pattern2.length }) { + return patternSpan.length <= candidateSpan.length && everyInRange(0, patternSpan.length, (i) => equalChars(pattern2.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase)); } function equalChars(ch1, ch2, ignoreCase) { return ignoreCase ? toLowerCase2(ch1) === toLowerCase2(ch2) : ch1 === ch2; @@ -175711,12 +178986,12 @@ ${lanes.join("\n")} function isWordChar(ch) { return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit2(ch) || ch === 95 || ch === 36; } - function breakPatternIntoTextChunks(pattern) { + function breakPatternIntoTextChunks(pattern2) { const result = []; let wordStart = 0; let wordLength = 0; - for (let i = 0; i < pattern.length; i++) { - const ch = pattern.charCodeAt(i); + for (let i = 0; i < pattern2.length; i++) { + const ch = pattern2.charCodeAt(i); if (isWordChar(ch)) { if (wordLength === 0) { wordStart = i; @@ -175724,13 +178999,13 @@ ${lanes.join("\n")} wordLength++; } else { if (wordLength > 0) { - result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + result.push(createTextChunk(pattern2.substr(wordStart, wordLength))); wordLength = 0; } } } if (wordLength > 0) { - result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + result.push(createTextChunk(pattern2.substr(wordStart, wordLength))); } return result; } @@ -176330,7 +179605,7 @@ ${lanes.join("\n")} if (!name) continue; const module22 = (_a3 = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier, sourceFile)) == null ? void 0 : _a3.resolvedModule; const resolvedFile = module22 && program.getSourceFile(module22.resolvedFileName); - if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment3(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) { + if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment4(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) { diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import)); } } @@ -176345,7 +179620,7 @@ ${lanes.join("\n")} diags.push(createDiagnosticForNode(isVariableDeclaration7(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); } } else { - if (isVariableStatement11(node) && node.parent === sourceFile && node.declarationList.flags & 2 && node.declarationList.declarations.length === 1) { + if (isVariableStatement12(node) && node.parent === sourceFile && node.declarationList.flags & 2 && node.declarationList.declarations.length === 1) { const init = node.declarationList.declarations[0].initializer; if (init && isRequireCall( init, @@ -176394,7 +179669,7 @@ ${lanes.join("\n")} }); } function propertyAccessLeftHandSide(node) { - return isPropertyAccessExpression16(node) ? propertyAccessLeftHandSide(node.expression) : node; + return isPropertyAccessExpression17(node) ? propertyAccessLeftHandSide(node.expression) : node; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { @@ -176410,7 +179685,7 @@ ${lanes.join("\n")} function addConvertToAsyncFunctionDiagnostics(node, checker, diags) { if (isConvertibleFunction(node, checker) && !visitedNestedConvertibleFunctions.has(getKeyFromNode(node))) { diags.push(createDiagnosticForNode( - !node.name && isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name) ? node.parent.name : node, + !node.name && isVariableDeclaration7(node.parent) && isIdentifier28(node.parent.name) ? node.parent.name : node, Diagnostics.This_may_be_converted_to_an_async_function )); } @@ -176437,7 +179712,7 @@ ${lanes.join("\n")} return false; } let currentNode = node.expression.expression; - while (isPromiseHandler(currentNode) || isPropertyAccessExpression16(currentNode)) { + while (isPromiseHandler(currentNode) || isPropertyAccessExpression17(currentNode)) { if (isCallExpression16(currentNode)) { if (!hasSupportedNumberOfArguments(currentNode) || !currentNode.arguments.every((arg) => isFixablePromiseArgument(arg, checker))) { return false; @@ -176458,7 +179733,7 @@ ${lanes.join("\n")} if (node.arguments.length > maxArguments) return false; if (node.arguments.length < maxArguments) return true; return maxArguments === 1 || some(node.arguments, (arg) => { - return arg.kind === 106 || isIdentifier26(arg) && arg.text === "undefined"; + return arg.kind === 106 || isIdentifier28(arg) && arg.text === "undefined"; }); } function isFixablePromiseArgument(arg, checker) { @@ -176561,7 +179836,7 @@ interface Symbol { var barebonesLibName = "lib.d.ts"; var barebonesLibSourceFile; function transpileWorker(input, transpileOptions, declaration) { - barebonesLibSourceFile ?? (barebonesLibSourceFile = createSourceFile5(barebonesLibName, barebonesLibContent, { + barebonesLibSourceFile ?? (barebonesLibSourceFile = createSourceFile6(barebonesLibName, barebonesLibContent, { languageVersion: 99 /* Latest */ })); @@ -176612,7 +179887,7 @@ interface Symbol { getDirectories: () => [] }; const inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); - const sourceFile = createSourceFile5( + const sourceFile = createSourceFile6( inputFileName, input, { @@ -176761,7 +180036,7 @@ interface Symbol { return !!name && (pushLiteral(name, containers) || name.kind === 168 && tryAddComputedPropertyName(name.expression, containers)); } function tryAddComputedPropertyName(expression, containers) { - return pushLiteral(expression, containers) || isPropertyAccessExpression16(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); + return pushLiteral(expression, containers) || isPropertyAccessExpression17(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); } function pushLiteral(node, containers) { return isPropertyNameLiteral(node) && (containers.push(getTextOfIdentifierOrLiteral(node)), true); @@ -176998,7 +180273,7 @@ interface Symbol { break; case 306: const { expression } = node; - isIdentifier26(expression) ? addLeafNode(node, expression) : addLeafNode(node); + isIdentifier28(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; case 209: case 304: @@ -177013,7 +180288,7 @@ interface Symbol { } case 263: const nameNode = node.name; - if (nameNode && isIdentifier26(nameNode)) { + if (nameNode && isIdentifier28(nameNode)) { addTrackedEs5Class(nameNode.text); } addNodeWithRecursiveChild(node, node.body); @@ -177045,7 +180320,7 @@ interface Symbol { break; case 278: { const expression2 = node.expression; - const child = isObjectLiteralExpression12(expression2) || isCallExpression16(expression2) ? expression2 : isArrowFunction8(expression2) || isFunctionExpression7(expression2) ? expression2.body : void 0; + const child = isObjectLiteralExpression13(expression2) || isCallExpression16(expression2) ? expression2 : isArrowFunction8(expression2) || isFunctionExpression7(expression2) ? expression2.body : void 0; if (child) { startNode(node); addChildrenRecursively(child); @@ -177078,14 +180353,14 @@ interface Symbol { const prototypeAccess = special === 3 ? assignmentTarget.expression : assignmentTarget; let depth = 0; let className; - if (isIdentifier26(prototypeAccess.expression)) { + if (isIdentifier28(prototypeAccess.expression)) { addTrackedEs5Class(prototypeAccess.expression.text); className = prototypeAccess.expression; } else { [depth, className] = startNestedNodes(binaryExpression, prototypeAccess.expression); } if (special === 6) { - if (isObjectLiteralExpression12(binaryExpression.right)) { + if (isObjectLiteralExpression13(binaryExpression.right)) { if (binaryExpression.right.properties.length > 0) { startNode(binaryExpression, className); forEachChild27(binaryExpression.right, addChildrenRecursively); @@ -177120,7 +180395,7 @@ interface Symbol { const binaryExpression = node; const assignmentTarget = binaryExpression.left; const targetFunction = assignmentTarget.expression; - if (isIdentifier26(targetFunction) && getElementOrPropertyAccessName(assignmentTarget) !== "prototype" && trackedEs5Classes && trackedEs5Classes.has(targetFunction.text)) { + if (isIdentifier28(targetFunction) && getElementOrPropertyAccessName(assignmentTarget) !== "prototype" && trackedEs5Classes && trackedEs5Classes.has(targetFunction.text)) { if (isFunctionExpression7(binaryExpression.right) || isArrowFunction8(binaryExpression.right)) { addNodeWithRecursiveChild(node, binaryExpression.right, targetFunction); } else if (isBindableStaticAccessExpression(assignmentTarget)) { @@ -177384,7 +180659,7 @@ interface Symbol { return cleanText(getModuleName(node)); } if (name) { - const text = isIdentifier26(name) ? name.text : isElementAccessExpression8(name) ? `[${nodeText(name.argumentExpression)}]` : nodeText(name); + const text = isIdentifier28(name) ? name.text : isElementAccessExpression8(name) ? `[${nodeText(name.argumentExpression)}]` : nodeText(name); if (text.length > 0) { return cleanText(text); } @@ -177394,7 +180669,7 @@ interface Symbol { const sourceFile = node; return isExternalModule(sourceFile) ? `"${escapeString(getBaseFileName(removeFileExtension(normalizePath(sourceFile.fileName))))}"` : ""; case 278: - return isExportAssignment3(node) && node.isExportEquals ? "export=" : "default"; + return isExportAssignment4(node) && node.isExportEquals ? "export=" : "default"; case 220: case 263: case 219: @@ -177472,7 +180747,7 @@ interface Symbol { return { text: getItemName(n.node, n.name), kind: getNodeKind(n.node), - kindModifiers: getModifiers2(n.node), + kindModifiers: getModifiers22(n.node), spans: getSpans(n), nameSpan: n.name && getNodeSpan(n.name), childItems: map2(n.children, convertToTree) @@ -177482,7 +180757,7 @@ interface Symbol { return { text: getItemName(n.node, n.name), kind: getNodeKind(n.node), - kindModifiers: getModifiers2(n.node), + kindModifiers: getModifiers22(n.node), spans: getSpans(n), childItems: map2(n.children, convertToSecondaryNavBarMenuItem) || emptyChildItemArray, indent: n.indent, @@ -177534,7 +180809,7 @@ interface Symbol { function getNodeSpan(node) { return node.kind === 308 ? createTextSpanFromRange(node) : createTextSpanFromNode(node, curSourceFile); } - function getModifiers2(node) { + function getModifiers22(node) { if (node.parent && node.parent.kind === 261) { node = node.parent; } @@ -177548,7 +180823,7 @@ interface Symbol { return cleanText(declarationNameToString(parent2.name)); } else if (isBinaryExpression4(parent2) && parent2.operatorToken.kind === 64) { return nodeText(parent2.left).replace(whiteSpaceRegex, ""); - } else if (isPropertyAssignment11(parent2)) { + } else if (isPropertyAssignment12(parent2)) { return nodeText(parent2.name); } else if (getSyntacticModifierFlags(node) & 2048) { return "default"; @@ -177568,9 +180843,9 @@ interface Symbol { return ""; } function getCalledExpressionName(expr) { - if (isIdentifier26(expr)) { + if (isIdentifier28(expr)) { return expr.text; - } else if (isPropertyAccessExpression16(expr)) { + } else if (isPropertyAccessExpression17(expr)) { const left = getCalledExpressionName(expr.expression); const right = expr.name.text; return left === void 0 ? right : `${left}.${right}`; @@ -177625,15 +180900,15 @@ interface Symbol { function registerRefactor(name, refactor2) { refactors.set(name, refactor2); } - function getApplicableRefactors(context, includeInteractiveActions) { + function getApplicableRefactors(context2, includeInteractiveActions) { return arrayFrom(flatMapIterator(refactors.values(), (refactor2) => { var _a3; - return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a3 = refactor2.kinds) == null ? void 0 : _a3.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor2.getAvailableActions(context, includeInteractiveActions); + return context2.cancellationToken && context2.cancellationToken.isCancellationRequested() || !((_a3 = refactor2.kinds) == null ? void 0 : _a3.some((kind) => refactorKindBeginsWith(kind, context2.kind))) ? void 0 : refactor2.getAvailableActions(context2, includeInteractiveActions); })); } - function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) { + function getEditsForRefactor(context2, refactorName14, actionName2, interactiveRefactorArguments) { const refactor2 = refactors.get(refactorName14); - return refactor2 && refactor2.getEditsForAction(context, actionName2, interactiveRefactorArguments); + return refactor2 && refactor2.getEditsForAction(context2, actionName2, interactiveRefactorArguments); } var refactorName = "Convert export"; var defaultToNamedAction = { @@ -177651,14 +180926,14 @@ interface Symbol { defaultToNamedAction.kind, namedToDefaultAction.kind ], - getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context) { - const info = getInfo2(context, context.triggerReason === "invoked"); + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context2) { + const info = getInfo2(context2, context2.triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { const action = info.wasDefault ? defaultToNamedAction : namedToDefaultAction; return [{ name: refactorName, description: action.description, actions: [action] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [ { name: refactorName, @@ -177672,17 +180947,17 @@ interface Symbol { } return emptyArray; }, - getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndDefaultExports(context, actionName2) { + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndDefaultExports(context2, actionName2) { Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); - const info = getInfo2(context); + const info = getInfo2(context2); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange(context.file, context.program, info, t, context.cancellationToken)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange(context2.file, context2.program, info, t, context2.cancellationToken)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); - function getInfo2(context, considerPartialSpans = true) { - const { file: file2, program } = context; - const span = getRefactorContextSpan(context); + function getInfo2(context2, considerPartialSpans = true) { + const { file: file2, program } = context2; + const span = getRefactorContextSpan(context2); const token = getTokenAtPosition(file2, span.start); const exportNode = !!(token.parent && getSyntacticModifierFlags(token.parent) & 32) && considerPartialSpans ? token.parent : getParentNodeInSpan(token, file2, span); if (!exportNode || !isSourceFile(exportNode.parent) && !(isModuleBlock(exportNode.parent) && isAmbientModule(exportNode.parent.parent))) { @@ -177690,7 +180965,7 @@ interface Symbol { } const checker = program.getTypeChecker(); const exportingModuleSymbol = getExportingModuleSymbol(exportNode.parent, checker); - const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment3(exportNode) && !exportNode.isExportEquals ? 2080 : 0); + const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment4(exportNode) && !exportNode.isExportEquals ? 2080 : 0); const wasDefault = !!(flags & 2048); if (!(flags & 32) || !wasDefault && exportingModuleSymbol.exports.has( "default" @@ -177698,7 +180973,7 @@ interface Symbol { )) { return { error: getLocaleSpecificMessage(Diagnostics.This_file_already_has_a_default_export) }; } - const noSymbolError = (id) => isIdentifier26(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; + const noSymbolError = (id) => isIdentifier28(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; switch (exportNode.kind) { case 263: case 264: @@ -177735,7 +181010,7 @@ interface Symbol { } function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName }, changes, checker) { if (wasDefault) { - if (isExportAssignment3(exportNode) && !exportNode.isExportEquals) { + if (isExportAssignment4(exportNode) && !exportNode.isExportEquals) { const exp = exportNode.expression; const spec = makeExportSpecifier(exp.text, exp.text); changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDeclaration( @@ -177921,14 +181196,14 @@ interface Symbol { }; registerRefactor(refactorName2, { kinds: getOwnValues(actions).map((a) => a.kind), - getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndNamespacedImports(context) { - const info = getImportConversionInfo(context, context.triggerReason === "invoked"); + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndNamespacedImports(context2) { + const info = getImportConversionInfo(context2, context2.triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { const action = actions[info.convertTo]; return [{ name: refactorName2, description: action.description, actions: [action] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return getOwnValues(actions).map((action) => ({ name: refactorName2, description: action.description, @@ -177937,20 +181212,20 @@ interface Symbol { } return emptyArray; }, - getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndNamespacedImports(context, actionName2) { + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndNamespacedImports(context2, actionName2) { Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); - const info = getImportConversionInfo(context); + const info = getImportConversionInfo(context2); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange2(context.file, context.program, t, info)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange2(context2.file, context2.program, t, info)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); - function getImportConversionInfo(context, considerPartialSpans = true) { - const { file: file2 } = context; - const span = getRefactorContextSpan(context); + function getImportConversionInfo(context2, considerPartialSpans = true) { + const { file: file2 } = context2; + const span = getRefactorContextSpan(context2); const token = getTokenAtPosition(file2, span.start); - const importDecl = considerPartialSpans ? findAncestor(token, or(isImportDeclaration7, isJSDocImportTag)) : getParentNodeInSpan(token, file2, span); - if (importDecl === void 0 || !(isImportDeclaration7(importDecl) || isJSDocImportTag(importDecl))) return { error: "Selection is not an import declaration." }; + const importDecl = considerPartialSpans ? findAncestor(token, or(isImportDeclaration8, isJSDocImportTag)) : getParentNodeInSpan(token, file2, span); + if (importDecl === void 0 || !(isImportDeclaration8(importDecl) || isJSDocImportTag(importDecl))) return { error: "Selection is not an import declaration." }; const end = span.start + span.length; const nextToken = findNextToken(importDecl, importDecl.parent, file2); if (nextToken && end > nextToken.getStart()) return void 0; @@ -177964,7 +181239,7 @@ interface Symbol { if (importClause.namedBindings.kind === 275) { return { convertTo: 0, import: importClause.namedBindings }; } - const shouldUseDefault = getShouldUseDefault(context.program, importClause); + const shouldUseDefault = getShouldUseDefault(context2.program, importClause); return shouldUseDefault ? { convertTo: 1, import: importClause.namedBindings } : { convertTo: 2, import: importClause.namedBindings }; } function getShouldUseDefault(program, importClause) { @@ -178026,7 +181301,7 @@ interface Symbol { )); }); const importDecl = toConvert.parent.parent; - if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports && isImportDeclaration7(importDecl)) { + if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports && isImportDeclaration8(importDecl)) { changes.insertNodeAfter(sourceFile, importDecl, createImport( importDecl, /*defaultImportName*/ @@ -178039,10 +181314,10 @@ interface Symbol { } } function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression16(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; + return isPropertyAccessExpression17(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; } function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression16(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; + return isPropertyAccessExpression17(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; } function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault = getShouldUseDefault(program, toConvert.parent)) { const checker = program.getTypeChecker(); @@ -178085,7 +181360,7 @@ interface Symbol { const propertyName = element.propertyName || element.name; ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => { const access = propertyName.kind === 11 ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)); - if (isShorthandPropertyAssignment6(id.parent)) { + if (isShorthandPropertyAssignment7(id.parent)) { changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access)); } else if (isExportSpecifier(id.parent)) { neededNamedImports.add(element); @@ -178099,7 +181374,7 @@ interface Symbol { toConvert, shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName)) ); - if (neededNamedImports.size && isImportDeclaration7(importDecl)) { + if (neededNamedImports.size && isImportDeclaration8(importDecl)) { const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name))); changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport( importDecl, @@ -178155,8 +181430,8 @@ interface Symbol { extractToInterfaceAction.kind, extractToTypeDefAction.kind ], - getAvailableActions: function getRefactorActionsToExtractType(context) { - const { info, affectedTextRange } = getRangeToExtract(context, context.triggerReason === "invoked"); + getAvailableActions: function getRefactorActionsToExtractType(context2) { + const { info, affectedTextRange } = getRangeToExtract(context2, context2.triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { const refactorInfo = [{ @@ -178169,13 +181444,13 @@ interface Symbol { actions: info2.actions.map((action) => ({ ...action, range: affectedTextRange ? { - start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character }, - end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character } + start: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).character }, + end: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).character } } : void 0 })) })); } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName3, description: getLocaleSpecificMessage(Diagnostics.Extract_type), @@ -178188,19 +181463,19 @@ interface Symbol { } return emptyArray; }, - getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) { - const { file: file2 } = context; - const { info } = getRangeToExtract(context); + getEditsForAction: function getRefactorEditsToExtractType(context2, actionName2) { + const { file: file2 } = context2; + const { info } = getRangeToExtract(context2); Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract"); const name = getUniqueName("NewType", file2); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (changes) => { + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { switch (actionName2) { case extractToTypeAliasAction.name: Debug.assert(!info.isJS, "Invalid actionName/JS combo"); return doTypeAliasChange(changes, file2, name, info); case extractToTypeDefAction.name: Debug.assert(info.isJS, "Invalid actionName/JS combo"); - return doTypedefChange(changes, context, file2, name, info); + return doTypedefChange(changes, context2, file2, name, info); case extractToInterfaceAction.name: Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo"); return doInterfaceChange(changes, file2, name, info); @@ -178219,14 +181494,14 @@ interface Symbol { return { edits, renameFilename, renameLocation }; } }); - function getRangeToExtract(context, considerEmptySpans = true) { - const { file: file2, startPosition } = context; + function getRangeToExtract(context2, considerEmptySpans = true) { + const { file: file2, startPosition } = context2; const isJS = isSourceFileJS(file2); - const range = createTextRangeFromSpan(getRefactorContextSpan(context)); + const range = createTextRangeFromSpan(getRefactorContextSpan(context2)); const isCursorRequest = range.pos === range.end && considerEmptySpans; const firstType = getFirstTypeAt(file2, startPosition, range, isCursorRequest); if (!firstType || !isTypeNode(firstType)) return { info: { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }, affectedTextRange: void 0 }; - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); const enclosingNode = getEnclosingNode(firstType, isJS); if (enclosingNode === void 0) return { info: { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }, affectedTextRange: void 0 }; const expandedFirstType = getExpandedSelectionNode(firstType, enclosingNode); @@ -178303,7 +181578,7 @@ interface Symbol { return { typeParameters: result, affectedTextRange: selectionRange }; function visitor(node) { if (isTypeReferenceNode3(node)) { - if (isIdentifier26(node.typeName)) { + if (isIdentifier28(node.typeName)) { const typeName = node.typeName; const symbol2 = checker.resolveName( typeName.text, @@ -178335,7 +181610,7 @@ interface Symbol { return true; } } else if (isTypeQueryNode(node)) { - if (isIdentifier26(node.exprName)) { + if (isIdentifier28(node.exprName)) { const symbol2 = checker.resolveName( node.exprName.text, node.exprName, @@ -178419,7 +181694,7 @@ interface Symbol { void 0 ))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace }); } - function doTypedefChange(changes, context, file2, name, info) { + function doTypedefChange(changes, context2, file2, name, info) { var _a3; toArray(info.selection).forEach((typeNode) => { setEmitFlags( @@ -178457,7 +181732,7 @@ interface Symbol { ); if (isJSDoc(enclosingNode)) { const pos = enclosingNode.getStart(file2); - const newLineCharacter = getNewLineOrDefaultFromHost(context.host, (_a3 = context.formatContext) == null ? void 0 : _a3.options); + const newLineCharacter = getNewLineOrDefaultFromHost(context2.host, (_a3 = context2.formatContext) == null ? void 0 : _a3.options); changes.insertNodeAt(file2, enclosingNode.getStart(file2), jsDoc, { suffix: newLineCharacter + newLineCharacter + file2.text.slice(getPrecedingNonSpaceCharacterPosition(file2.text, pos - 1), pos) }); @@ -178511,42 +181786,42 @@ interface Symbol { }; registerRefactor(refactorNameForMoveToFile, { kinds: [moveToFileAction.kind], - getAvailableActions: function getRefactorActionsToMoveToFile(context, interactiveRefactorArguments) { - const file2 = context.file; - const statements = getStatementsToMove(context); + getAvailableActions: function getRefactorActionsToMoveToFile(context2, interactiveRefactorArguments) { + const file2 = context2.file; + const statements = getStatementsToMove(context2); if (!interactiveRefactorArguments) { return emptyArray; } - if (context.triggerReason === "implicit" && context.endPosition !== void 0) { - const startNodeAncestor = findAncestor(getTokenAtPosition(file2, context.startPosition), isBlockLike); - const endNodeAncestor = findAncestor(getTokenAtPosition(file2, context.endPosition), isBlockLike); + if (context2.triggerReason === "implicit" && context2.endPosition !== void 0) { + const startNodeAncestor = findAncestor(getTokenAtPosition(file2, context2.startPosition), isBlockLike); + const endNodeAncestor = findAncestor(getTokenAtPosition(file2, context2.endPosition), isBlockLike); if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) { return emptyArray; } } - if (context.preferences.allowTextChangesInNewFiles && statements) { + if (context2.preferences.allowTextChangesInNewFiles && statements) { const affectedTextRange = { start: { line: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).line, offset: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).character }, end: { line: getLineAndCharacterOfPosition(file2, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file2, last(statements.all).end).character } }; return [{ name: refactorNameForMoveToFile, description, actions: [{ ...moveToFileAction, range: affectedTextRange }] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorNameForMoveToFile, description, actions: [{ ...moveToFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] }]; } return emptyArray; }, - getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) { + getEditsForAction: function getRefactorEditsToMoveToFile(context2, actionName2, interactiveRefactorArguments) { Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked"); - const statements = Debug.checkDefined(getStatementsToMove(context)); - const { host, program } = context; + const statements = Debug.checkDefined(getStatementsToMove(context2)); + const { host, program } = context2; Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available"); const targetFile = interactiveRefactorArguments.targetFile; if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) { if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) { return error51(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file)); } - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange3(context2, context2.file, interactiveRefactorArguments.targetFile, context2.program, statements, t, context2.host, context2.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } return error51(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid)); @@ -178555,12 +181830,12 @@ interface Symbol { function error51(notApplicableReason) { return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason }; } - function doChange3(context, oldFile, targetFile, program, toMove, changes, host, preferences) { + function doChange3(context2, oldFile, targetFile, program, toMove, changes, host, preferences) { const checker = program.getTypeChecker(); const isForNewFile = !host.fileExists(targetFile); const targetSourceFile = isForNewFile ? createFutureSourceFile(targetFile, oldFile.externalModuleIndicator ? 99 : oldFile.commonJsModuleIndicator ? 1 : void 0, program, host) : Debug.checkDefined(program.getSourceFile(targetFile)); - const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context.program, context.preferences, context.host); - const importAdderForNewFile = ts_codefix_exports.createImportAdder(targetSourceFile, context.program, context.preferences, context.host); + const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context2.program, context2.preferences, context2.host); + const importAdderForNewFile = ts_codefix_exports.createImportAdder(targetSourceFile, context2.program, context2.preferences, context2.host); getNewStatementsAndRemoveFromOldFile(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, isForNewFile ? void 0 : getExistingLocals(targetSourceFile, toMove.all, checker)), changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile); if (isForNewFile) { addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host)); @@ -178601,8 +181876,8 @@ interface Symbol { if (!cfg) return; const newFileAbsolutePath = normalizePath(combinePaths(oldFileName, "..", newFileNameWithExtension)); const newFilePath = getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName); - const cfgObject = cfg.statements[0] && tryCast(cfg.statements[0].expression, isObjectLiteralExpression12); - const filesProp = cfgObject && find(cfgObject.properties, (prop) => isPropertyAssignment11(prop) && isStringLiteral15(prop.name) && prop.name.text === "files"); + const cfgObject = cfg.statements[0] && tryCast(cfg.statements[0].expression, isObjectLiteralExpression13); + const filesProp = cfgObject && find(cfgObject.properties, (prop) => isPropertyAssignment12(prop) && isStringLiteral15(prop.name) && prop.name.text === "files"); if (filesProp && isArrayLiteralExpression7(filesProp.initializer)) { changes.insertNodeInListAfter(cfg, last(filesProp.initializer.elements), factory.createStringLiteral(newFilePath), filesProp.initializer.elements); } @@ -178671,7 +181946,7 @@ interface Symbol { case 272: return node.name; case 261: - return tryCast(node.name, isIdentifier26); + return tryCast(node.name, isIdentifier28); default: return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); } @@ -178685,7 +181960,7 @@ interface Symbol { let needUniqueName = false; const toChange = []; ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => { - if (!isPropertyAccessExpression16(ref.parent)) return; + if (!isPropertyAccessExpression17(ref.parent)) return; needUniqueName = needUniqueName || !!checker.resolveName( preferredNewNamespaceName, ref, @@ -178758,13 +182033,13 @@ interface Symbol { return i.kind === 273 ? i.moduleSpecifier : i.kind === 272 ? i.moduleReference.expression : i.initializer.arguments[0]; } function forEachImportInStatement(statement, cb) { - if (isImportDeclaration7(statement)) { + if (isImportDeclaration8(statement)) { if (isStringLiteral15(statement.moduleSpecifier)) cb(statement); } else if (isImportEqualsDeclaration(statement)) { if (isExternalModuleReference(statement.moduleReference) && isStringLiteralLike4(statement.moduleReference.expression)) { cb(statement); } - } else if (isVariableStatement11(statement)) { + } else if (isVariableStatement12(statement)) { for (const decl of statement.declarationList.declarations) { if (decl.initializer && isRequireCall( decl.initializer, @@ -178797,7 +182072,7 @@ interface Symbol { cb(importOrRequire); } else if (importOrRequire.name.kind === 207) { for (const element of importOrRequire.name.elements) { - if (isIdentifier26(element.name)) { + if (isIdentifier28(element.name)) { cb(element); } } @@ -178855,23 +182130,23 @@ interface Symbol { } } forEachAliasDeclarationInImportOrRequire(importDecl, (i) => { - if (i.name && isIdentifier26(i.name) && isUnused(i.name)) { + if (i.name && isIdentifier28(i.name) && isUnused(i.name)) { changes.delete(sourceFile, i); } }); } function isTopLevelDeclarationStatement(node) { Debug.assert(isSourceFile(node.parent), "Node parent should be a SourceFile"); - return isNonVariableTopLevelDeclaration(node) || isVariableStatement11(node); + return isNonVariableTopLevelDeclaration(node) || isVariableStatement12(node); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); } function addEs6Export(d) { - const modifiers = canHaveModifiers(d) ? concatenate([factory.createModifier( + const modifiers = canHaveModifiers2(d) ? concatenate([factory.createModifier( 95 /* ExportKeyword */ - )], getModifiers(d)) : void 0; + )], getModifiers2(d)) : void 0; switch (d.kind) { case 263: return factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); @@ -178915,7 +182190,7 @@ interface Symbol { return [decl.name.text]; // TODO: GH#18217 case 244: - return mapDefined(decl.declarationList.declarations, (d) => isIdentifier26(d.name) ? d.name.text : void 0); + return mapDefined(decl.declarationList.declarations, (d) => isIdentifier28(d.name) ? d.name.text : void 0); case 268: case 267: case 266: @@ -178969,13 +182244,13 @@ interface Symbol { case 208: return name; case 207: { - const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier26(prop.name) || keep(prop.name)); + const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier28(prop.name) || keep(prop.name)); return newElements.length ? factory.createObjectBindingPattern(newElements) : void 0; } } } function nameOfTopLevelDeclaration(d) { - return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier26) : tryCast(d.name, isIdentifier26); + return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier28) : tryCast(d.name, isIdentifier28); } function getTopLevelDeclarationStatement(d) { switch (d.kind) { @@ -179020,9 +182295,9 @@ interface Symbol { } return ""; } - function getRangeToMove(context) { - const { file: file2 } = context; - const range = createTextRangeFromSpan(getRefactorContextSpan(context)); + function getRangeToMove(context2) { + const { file: file2 } = context2; + const range = createTextRangeFromSpan(getRefactorContextSpan(context2)); const { statements } = file2; let startNodeIndex = findIndex(statements, (s) => s.end > range.pos); if (startNodeIndex === -1) return void 0; @@ -179044,8 +182319,8 @@ interface Symbol { afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1] }; } - function getStatementsToMove(context) { - const rangeToMove = getRangeToMove(context); + function getStatementsToMove(context2) { + const rangeToMove = getRangeToMove(context2); if (rangeToMove === void 0) return void 0; const all = []; const ranges = []; @@ -179161,7 +182436,7 @@ interface Symbol { } function forEachReference(node, checker, enclosingRange, onReference) { node.forEachChild(function cb(node2) { - if (isIdentifier26(node2) && !isDeclarationName(node2)) { + if (isIdentifier28(node2) && !isDeclarationName(node2)) { if (enclosingRange && !rangeContainsRange(enclosingRange, node2)) { return; } @@ -179259,7 +182534,7 @@ interface Symbol { forEachTopLevelDeclaration(node, (declaration) => { var _a22; const targetDeclarations = canHaveSymbol(declaration) ? (_a22 = targetExports.get(declaration.symbol.escapedName)) == null ? void 0 : _a22.declarations : void 0; - const exportDeclaration = firstDefined(targetDeclarations, (d) => isExportDeclaration2(d) ? d : isExportSpecifier(d) ? tryCast(d.parent.parent, isExportDeclaration2) : void 0); + const exportDeclaration = firstDefined(targetDeclarations, (d) => isExportDeclaration3(d) ? d : isExportSpecifier(d) ? tryCast(d.parent.parent, isExportDeclaration3) : void 0); if (exportDeclaration && exportDeclaration.moduleSpecifier) { targetToSourceExports.set(exportDeclaration, (targetToSourceExports.get(exportDeclaration) || /* @__PURE__ */ new Set()).add(declaration)); } @@ -179281,7 +182556,7 @@ interface Symbol { } } } - const lastReExport = findLast(targetFile.statements, (n) => isExportDeclaration2(n) && !!n.moduleSpecifier && !removedExports.has(n)); + const lastReExport = findLast(targetFile.statements, (n) => isExportDeclaration3(n) && !!n.moduleSpecifier && !removedExports.has(n)); if (lastReExport) { changes.insertNodesBefore( targetFile, @@ -179313,7 +182588,7 @@ interface Symbol { const existingLocals = /* @__PURE__ */ new Set(); for (const moduleSpecifier of sourceFile.imports) { const declaration = importFromModuleSpecifier(moduleSpecifier); - if (isImportDeclaration7(declaration) && declaration.importClause && declaration.importClause.namedBindings && isNamedImports5(declaration.importClause.namedBindings)) { + if (isImportDeclaration8(declaration) && declaration.importClause && declaration.importClause.namedBindings && isNamedImports6(declaration.importClause.namedBindings)) { for (const e of declaration.importClause.namedBindings.elements) { const symbol2 = checker.getSymbolAtLocation(e.propertyName || e.name); if (symbol2) { @@ -179354,7 +182629,7 @@ interface Symbol { return known.substr(0, requested.length) === requested; } function getIdentifierForNode(node, scope, checker, file2) { - return isPropertyAccessExpression16(node) && !isClassLike(scope) && !checker.resolveName( + return isPropertyAccessExpression17(node) && !isClassLike(scope) && !checker.resolveName( node.name.text, node, 111551, @@ -179386,14 +182661,14 @@ interface Symbol { }; registerRefactor(refactorName4, { kinds: [inlineVariableAction.kind], - getAvailableActions(context) { + getAvailableActions(context2) { const { file: file2, program, preferences, startPosition, triggerReason - } = context; + } = context2; const info = getInliningInfo(file2, startPosition, triggerReason === "invoked", program); if (!info) { return emptyArray; @@ -179417,9 +182692,9 @@ interface Symbol { } return emptyArray; }, - getEditsForAction(context, actionName2) { + getEditsForAction(context2, actionName2) { Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked"); - const { file: file2, program, startPosition } = context; + const { file: file2, program, startPosition } = context2; const info = getInliningInfo( file2, startPosition, @@ -179431,9 +182706,9 @@ interface Symbol { return void 0; } const { references, declaration, replacement } = info; - const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => { + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (tracker) => { for (const node of references) { - const closestStringIdentifierParent = isStringLiteral15(replacement) && isIdentifier26(node) && walkUpParenthesizedExpressions(node.parent); + const closestStringIdentifierParent = isStringLiteral15(replacement) && isIdentifier28(node) && walkUpParenthesizedExpressions(node.parent); if (closestStringIdentifierParent && isTemplateSpan(closestStringIdentifierParent) && !isTaggedTemplateExpression5(closestStringIdentifierParent.parent.parent)) { replaceTemplateStringVariableWithLiteral(tracker, file2, closestStringIdentifierParent, replacement); } else { @@ -179450,10 +182725,10 @@ interface Symbol { const checker = program.getTypeChecker(); const token = getTouchingPropertyName(file2, startPosition); const parent2 = token.parent; - if (!isIdentifier26(token)) { + if (!isIdentifier28(token)) { return void 0; } - if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier26(parent2.name)) { + if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier28(parent2.name)) { if (((_a3 = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a3.length) !== 1) { return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) }; } @@ -179476,7 +182751,7 @@ interface Symbol { return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) }; } const declaration = definition.declarations[0]; - if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier26(declaration.name)) { + if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier28(declaration.name)) { return void 0; } if (isDeclarationExported(declaration)) { @@ -179488,16 +182763,16 @@ interface Symbol { return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) }; } function isDeclarationExported(declaration) { - const variableStatement = cast(declaration.parent.parent, isVariableStatement11); + const variableStatement = cast(declaration.parent.parent, isVariableStatement12); return some(variableStatement.modifiers, isExportModifier); } function getReferenceNodes(declaration, checker, file2) { const references = []; const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file2, (ref) => { - if (ts_FindAllReferences_exports.isWriteAccessForReference(ref) && !isShorthandPropertyAssignment6(ref.parent)) { + if (ts_FindAllReferences_exports.isWriteAccessForReference(ref) && !isShorthandPropertyAssignment7(ref.parent)) { return true; } - if (isExportSpecifier(ref.parent) || isExportAssignment3(ref.parent)) { + if (isExportSpecifier(ref.parent) || isExportAssignment4(ref.parent)) { return true; } if (isTypeQueryNode(ref.parent)) { @@ -179516,13 +182791,13 @@ interface Symbol { if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) { return factory.createParenthesizedExpression(replacement); } - if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression16(parent2))) { + if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression17(parent2))) { return factory.createParenthesizedExpression(replacement); } - if (isPropertyAccessExpression16(parent2) && (isNumericLiteral5(replacement) || isObjectLiteralExpression12(replacement))) { + if (isPropertyAccessExpression17(parent2) && (isNumericLiteral5(replacement) || isObjectLiteralExpression13(replacement))) { return factory.createParenthesizedExpression(replacement); } - if (isIdentifier26(reference) && isShorthandPropertyAssignment6(parent2)) { + if (isIdentifier28(reference) && isShorthandPropertyAssignment7(parent2)) { return factory.createPropertyAssignment(reference, replacement); } return replacement; @@ -179549,43 +182824,43 @@ interface Symbol { }; registerRefactor(refactorName5, { kinds: [moveToNewFileAction.kind], - getAvailableActions: function getRefactorActionsToMoveToNewFile(context) { - const statements = getStatementsToMove(context); - const file2 = context.file; - if (context.triggerReason === "implicit" && context.endPosition !== void 0) { - const startNodeAncestor = findAncestor(getTokenAtPosition(file2, context.startPosition), isBlockLike); - const endNodeAncestor = findAncestor(getTokenAtPosition(file2, context.endPosition), isBlockLike); + getAvailableActions: function getRefactorActionsToMoveToNewFile(context2) { + const statements = getStatementsToMove(context2); + const file2 = context2.file; + if (context2.triggerReason === "implicit" && context2.endPosition !== void 0) { + const startNodeAncestor = findAncestor(getTokenAtPosition(file2, context2.startPosition), isBlockLike); + const endNodeAncestor = findAncestor(getTokenAtPosition(file2, context2.endPosition), isBlockLike); if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) { return emptyArray; } } - if (context.preferences.allowTextChangesInNewFiles && statements) { - const file22 = context.file; + if (context2.preferences.allowTextChangesInNewFiles && statements) { + const file22 = context2.file; const affectedTextRange = { start: { line: getLineAndCharacterOfPosition(file22, statements.all[0].getStart(file22)).line, offset: getLineAndCharacterOfPosition(file22, statements.all[0].getStart(file22)).character }, end: { line: getLineAndCharacterOfPosition(file22, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file22, last(statements.all).end).character } }; return [{ name: refactorName5, description: description2, actions: [{ ...moveToNewFileAction, range: affectedTextRange }] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName5, description: description2, actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] }]; } return emptyArray; }, - getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { + getEditsForAction: function getRefactorEditsToMoveToNewFile(context2, actionName2) { Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked"); - const statements = Debug.checkDefined(getStatementsToMove(context)); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context.file, context.program, statements, t, context.host, context, context.preferences)); + const statements = Debug.checkDefined(getStatementsToMove(context2)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange4(context2.file, context2.program, statements, t, context2.host, context2, context2.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); - function doChange4(oldFile, program, toMove, changes, host, context, preferences) { + function doChange4(oldFile, program, toMove, changes, host, context2, preferences) { const checker = program.getTypeChecker(); const usage = getUsageInfo(oldFile, toMove.all, checker); const newFilename = createNewFileName(oldFile, program, host, toMove); const newSourceFile = createFutureSourceFile(newFilename, oldFile.externalModuleIndicator ? 99 : oldFile.commonJsModuleIndicator ? 1 : void 0, program, host); - const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context.program, context.preferences, context.host); - const importAdderForNewFile = ts_codefix_exports.createImportAdder(newSourceFile, context.program, context.preferences, context.host); + const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context2.program, context2.preferences, context2.host); + const importAdderForNewFile = ts_codefix_exports.createImportAdder(newSourceFile, context2.program, context2.preferences, context2.host); getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile, usage, changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile); addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host)); } @@ -179602,8 +182877,8 @@ interface Symbol { getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature }); - function getRefactorActionsToConvertOverloadsToOneSignature(context) { - const { file: file2, startPosition, program } = context; + function getRefactorActionsToConvertOverloadsToOneSignature(context2) { + const { file: file2, startPosition, program } = context2; const info = getConvertableOverloadListAtPosition(file2, startPosition, program); if (!info) return emptyArray; return [{ @@ -179612,8 +182887,8 @@ interface Symbol { actions: [functionOverloadAction] }]; } - function getRefactorEditsToConvertOverloadsToOneSignature(context) { - const { file: file2, startPosition, program } = context; + function getRefactorEditsToConvertOverloadsToOneSignature(context2) { + const { file: file2, startPosition, program } = context2; const signatureDecls = getConvertableOverloadListAtPosition(file2, startPosition, program); if (!signatureDecls) return void 0; const checker = program.getTypeChecker(); @@ -179692,7 +182967,7 @@ interface Symbol { if (updated === lastDeclaration) { return; } - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => { t.replaceNodeRange(file2, signatureDecls[0], signatureDecls[signatureDecls.length - 1], updated); }); return { renameFilename: void 0, renameLocation: void 0, edits }; @@ -179725,7 +183000,7 @@ interface Symbol { ); } function convertParameterToNamedTupleMember(p) { - Debug.assert(isIdentifier26(p.name)); + Debug.assert(isIdentifier28(p.name)); const result = setTextRange( factory.createNamedTupleMember( p.dotDotDotToken, @@ -179798,7 +183073,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } const signatureDecls = decls; - if (some(signatureDecls, (d) => !!d.typeParameters || some(d.parameters, (p) => !!p.modifiers || !isIdentifier26(p.name)))) { + if (some(signatureDecls, (d) => !!d.typeParameters || some(d.parameters, (p) => !!p.modifiers || !isIdentifier28(p.name)))) { return; } const signatures = mapDefined(signatureDecls, (d) => checker.getSignatureFromDeclaration(d)); @@ -179828,8 +183103,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToRemoveFunctionBraces, getAvailableActions: getRefactorActionsToRemoveFunctionBraces }); - function getRefactorActionsToRemoveFunctionBraces(context) { - const { file: file2, startPosition, triggerReason } = context; + function getRefactorActionsToRemoveFunctionBraces(context2) { + const { file: file2, startPosition, triggerReason } = context2; const info = getConvertibleArrowFunctionAtPosition(file2, startPosition, triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { @@ -179841,7 +183116,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName7, description: refactorDescription3, @@ -179853,8 +183128,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return emptyArray; } - function getRefactorEditsToRemoveFunctionBraces(context, actionName2) { - const { file: file2, startPosition } = context; + function getRefactorEditsToRemoveFunctionBraces(context2, actionName2) { + const { file: file2, startPosition } = context2; const info = getConvertibleArrowFunctionAtPosition(file2, startPosition); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); const { expression, returnStatement, func } = info; @@ -179904,7 +183179,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { Debug.fail("invalid action"); } - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => { t.replaceNode(file2, func.body, body); }); return { renameFilename: void 0, renameLocation: void 0, edits }; @@ -179930,7 +183205,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock6(func.body) && func.body.statements.length === 1) { const firstStatement = first(func.body.statements); if (isReturnStatement4(firstStatement)) { - const expression = firstStatement.expression && isObjectLiteralExpression12(getLeftmostExpression( + const expression = firstStatement.expression && isObjectLiteralExpression13(getLeftmostExpression( firstStatement.expression, /*stopAtCallExpressions*/ false @@ -179967,8 +183242,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToConvertFunctionExpressions, getAvailableActions: getRefactorActionsToConvertFunctionExpressions }); - function getRefactorActionsToConvertFunctionExpressions(context) { - const { file: file2, startPosition, program, kind } = context; + function getRefactorActionsToConvertFunctionExpressions(context2) { + const { file: file2, startPosition, program, kind } = context2; const info = getFunctionInfo(file2, startPosition, program); if (!info) return emptyArray; const { selectedVariableDeclaration, func } = info; @@ -180001,27 +183276,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return [{ name: refactorName8, description: refactorDescription4, - actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions + actions: possibleActions.length === 0 && context2.preferences.provideRefactorNotApplicableReason ? errors : possibleActions }]; } - function getRefactorEditsToConvertFunctionExpressions(context, actionName2) { - const { file: file2, startPosition, program } = context; + function getRefactorEditsToConvertFunctionExpressions(context2, actionName2) { + const { file: file2, startPosition, program } = context2; const info = getFunctionInfo(file2, startPosition, program); if (!info) return void 0; const { func } = info; const edits = []; switch (actionName2) { case toAnonymousFunctionAction.name: - edits.push(...getEditInfoForConvertToAnonymousFunction(context, func)); + edits.push(...getEditInfoForConvertToAnonymousFunction(context2, func)); break; case toNamedFunctionAction.name: const variableInfo = getVariableInfo(func); if (!variableInfo) return void 0; - edits.push(...getEditInfoForConvertToNamedFunction(context, func, variableInfo)); + edits.push(...getEditInfoForConvertToNamedFunction(context2, func, variableInfo)); break; case toArrowFunctionAction.name: if (!isFunctionExpression7(func)) return void 0; - edits.push(...getEditInfoForConvertToArrowFunction(context, func)); + edits.push(...getEditInfoForConvertToArrowFunction(context2, func)); break; default: return Debug.fail("invalid action"); @@ -180098,11 +183373,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!isVariableDeclaration7(variableDeclaration) || !isVariableDeclarationInVariableStatement(variableDeclaration)) return void 0; const variableDeclarationList = variableDeclaration.parent; const statement = variableDeclarationList.parent; - if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement11(statement) || !isIdentifier26(variableDeclaration.name)) return void 0; + if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement12(statement) || !isIdentifier28(variableDeclaration.name)) return void 0; return { variableDeclaration, variableDeclarationList, statement, name: variableDeclaration.name }; } - function getEditInfoForConvertToAnonymousFunction(context, func) { - const { file: file2 } = context; + function getEditInfoForConvertToAnonymousFunction(context2, func) { + const { file: file2 } = context2; const body = convertToBlock(func.body); const newNode = factory.createFunctionExpression( func.modifiers, @@ -180114,10 +183389,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} func.type, body ); - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file2, func, newNode)); + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(file2, func, newNode)); } - function getEditInfoForConvertToNamedFunction(context, func, variableInfo) { - const { file: file2 } = context; + function getEditInfoForConvertToNamedFunction(context2, func, variableInfo) { + const { file: file2 } = context2; const body = convertToBlock(func.body); const { variableDeclaration, variableDeclarationList, statement, name } = variableInfo; suppressLeadingTrivia(statement); @@ -180125,16 +183400,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const modifiers = factory.createModifiersFromModifierFlags(modifiersFlags); const newNode = factory.createFunctionDeclaration(length(modifiers) ? modifiers : void 0, func.asteriskToken, name, func.typeParameters, func.parameters, func.type, body); if (variableDeclarationList.declarations.length === 1) { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file2, statement, newNode)); + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(file2, statement, newNode)); } else { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => { + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => { t.delete(file2, variableDeclaration); t.insertNodeAfter(file2, statement, newNode); }); } } - function getEditInfoForConvertToArrowFunction(context, func) { - const { file: file2 } = context; + function getEditInfoForConvertToArrowFunction(context2, func) { + const { file: file2 } = context2; const statements = func.body.statements; const head = statements[0]; let body; @@ -180149,7 +183424,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 39 /* EqualsGreaterThanToken */ ), body); - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file2, func, newNode)); + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(file2, func, newNode)); } function canBeConvertedToExpression(body, head) { return body.statements.length === 1 && (isReturnStatement4(head) && !!head.expression); @@ -180171,11 +183446,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject }); - function getRefactorActionsToConvertParametersToDestructuredObject(context) { - const { file: file2, startPosition } = context; + function getRefactorActionsToConvertParametersToDestructuredObject(context2) { + const { file: file2, startPosition } = context2; const isJSFile = isSourceFileJS(file2); if (isJSFile) return emptyArray; - const functionDeclaration = getFunctionDeclarationAtPosition(file2, startPosition, context.program.getTypeChecker()); + const functionDeclaration = getFunctionDeclarationAtPosition(file2, startPosition, context2.program.getTypeChecker()); if (!functionDeclaration) return emptyArray; return [{ name: refactorName9, @@ -180183,14 +183458,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions: [toDestructuredAction] }]; } - function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) { + function getRefactorEditsToConvertParametersToDestructuredObject(context2, actionName2) { Debug.assert(actionName2 === refactorName9, "Unexpected action name"); - const { file: file2, startPosition, program, cancellationToken, host } = context; + const { file: file2, startPosition, program, cancellationToken, host } = context2; const functionDeclaration = getFunctionDeclarationAtPosition(file2, startPosition, program.getTypeChecker()); if (!functionDeclaration || !cancellationToken) return void 0; const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); if (groupedReferences.valid) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(file2, program, host, t, functionDeclaration, groupedReferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange5(file2, program, host, t, functionDeclaration, groupedReferences)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return { edits: [] }; @@ -180353,7 +183628,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isImportSpecifier(node.parent) || isImportClause(node.parent) || isImportEqualsDeclaration(node.parent) || isNamespaceImport5(node.parent)) { return node; } - if (isExportSpecifier(node.parent) || isExportAssignment3(node.parent)) { + if (isExportSpecifier(node.parent) || isExportAssignment4(node.parent)) { return node; } return void 0; @@ -180379,7 +183654,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; // x.foo(...) case 212: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression16); + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression17); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { const callOrNewExpression2 = tryCast(propertyAccessExpression.parent, isCallOrNewExpression); if (callOrNewExpression2 && callOrNewExpression2.expression === propertyAccessExpression) { @@ -180408,7 +183683,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (parent2.kind) { // `C.foo` case 212: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression16); + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression17); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } @@ -180456,7 +183731,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 263: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); case 175: - if (isObjectLiteralExpression12(functionDeclaration.parent)) { + if (isObjectLiteralExpression13(functionDeclaration.parent)) { const contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); return ((_a3 = contextualSymbol == null ? void 0 : contextualSymbol.declarations) == null ? void 0 : _a3.length) === 1 && isSingleImplementation(functionDeclaration, checker); } @@ -180499,10 +183774,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const type = checker.getTypeAtLocation(parameterDeclaration); if (!checker.isArrayType(type) && !checker.isTupleType(type)) return false; } - return !parameterDeclaration.modifiers && isIdentifier26(parameterDeclaration.name); + return !parameterDeclaration.modifiers && isIdentifier28(parameterDeclaration.name); } function isValidVariableDeclaration(node) { - return isVariableDeclaration7(node) && isVarConst(node) && isIdentifier26(node.name) && !node.type; + return isVariableDeclaration7(node) && isVarConst(node) && isIdentifier28(node.name) && !node.type; } function hasThisParameter(parameters) { return parameters.length > 0 && isThis(parameters[0].name); @@ -180520,7 +183795,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return parameters; } function createPropertyOrShorthandAssignment(name, initializer3) { - if (isIdentifier26(initializer3) && getTextOfIdentifierOrLiteral(initializer3) === name) { + if (isIdentifier28(initializer3) && getTextOfIdentifierOrLiteral(initializer3) === name) { return factory.createShorthandPropertyAssignment(name); } return factory.createPropertyAssignment(name, initializer3); @@ -180533,7 +183808,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parameterName = getParameterName(parameters[i]); const property = createPropertyOrShorthandAssignment(parameterName, arg); suppressLeadingAndTrailingTrivia(property.name); - if (isPropertyAssignment11(property)) suppressLeadingAndTrailingTrivia(property.initializer); + if (isPropertyAssignment12(property)) suppressLeadingAndTrailingTrivia(property.initializer); copyComments(arg, property); return property; }); @@ -180721,19 +183996,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToConvertToTemplateString, getAvailableActions: getRefactorActionsToConvertToTemplateString }); - function getRefactorActionsToConvertToTemplateString(context) { - const { file: file2, startPosition } = context; + function getRefactorActionsToConvertToTemplateString(context2) { + const { file: file2, startPosition } = context2; const node = getNodeOrParentOfParentheses(file2, startPosition); const maybeBinary = getParentBinaryExpression(node); const nodeIsStringLiteral = isStringLiteral15(maybeBinary); const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] }; - if (nodeIsStringLiteral && context.triggerReason !== "invoked") { + if (nodeIsStringLiteral && context2.triggerReason !== "invoked") { return emptyArray; } if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression4(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) { refactorInfo.actions.push(convertStringAction); return [refactorInfo]; - } else if (context.preferences.provideRefactorNotApplicableReason) { + } else if (context2.preferences.provideRefactorNotApplicableReason) { refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) }); return [refactorInfo]; } @@ -180743,35 +184018,35 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const node = getTokenAtPosition(file2, startPosition); const nestedBinary = getParentBinaryExpression(node); const isNonStringBinary = !treeToArray(nestedBinary).isValidConcatenation; - if (isNonStringBinary && isParenthesizedExpression7(nestedBinary.parent) && isBinaryExpression4(nestedBinary.parent.parent)) { + if (isNonStringBinary && isParenthesizedExpression8(nestedBinary.parent) && isBinaryExpression4(nestedBinary.parent.parent)) { return nestedBinary.parent.parent; } return node; } - function getRefactorEditsToConvertToTemplateString(context, actionName2) { - const { file: file2, startPosition } = context; + function getRefactorEditsToConvertToTemplateString(context2, actionName2) { + const { file: file2, startPosition } = context2; const node = getNodeOrParentOfParentheses(file2, startPosition); switch (actionName2) { case refactorDescription6: - return { edits: getEditsForToTemplateLiteral(context, node) }; + return { edits: getEditsForToTemplateLiteral(context2, node) }; default: return Debug.fail("invalid action"); } } - function getEditsForToTemplateLiteral(context, node) { + function getEditsForToTemplateLiteral(context2, node) { const maybeBinary = getParentBinaryExpression(node); - const file2 = context.file; + const file2 = context2.file; const templateLiteral2 = nodesToTemplate(treeToArray(maybeBinary), file2); const trailingCommentRanges = getTrailingCommentRanges(file2.text, maybeBinary.end); if (trailingCommentRanges) { const lastComment = trailingCommentRanges[trailingCommentRanges.length - 1]; const trailingRange = { pos: trailingCommentRanges[0].pos, end: lastComment.end }; - return ts_textChanges_exports.ChangeTracker.with(context, (t) => { + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => { t.deleteRange(file2, trailingRange); t.replaceNode(file2, maybeBinary, templateLiteral2); }); } else { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file2, maybeBinary, templateLiteral2)); + return ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(file2, maybeBinary, templateLiteral2)); } } function isNotEqualsOperator(node) { @@ -180921,7 +184196,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } function getExpressionFromParenthesesOrExpression(node) { - if (isParenthesizedExpression7(node)) { + if (isParenthesizedExpression8(node)) { copyExpressionComments(node); node = node.expression; } @@ -180940,8 +184215,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToConvertToOptionalChain, getAvailableActions: getRefactorActionsToConvertToOptionalChain }); - function getRefactorActionsToConvertToOptionalChain(context) { - const info = getInfo3(context, context.triggerReason === "invoked"); + function getRefactorActionsToConvertToOptionalChain(context2) { + const info = getInfo3(context2, context2.triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ @@ -180950,7 +184225,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions: [toOptionalChainAction] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName11, description: convertToOptionalChainExpressionMessage, @@ -180959,24 +184234,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return emptyArray; } - function getRefactorEditsToConvertToOptionalChain(context, actionName2) { - const info = getInfo3(context); + function getRefactorEditsToConvertToOptionalChain(context2, actionName2) { + const info = getInfo3(context2); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(context.file, context.program.getTypeChecker(), t, info, actionName2)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange6(context2.file, context2.program.getTypeChecker(), t, info, actionName2)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } function isValidExpression(node) { return isBinaryExpression4(node) || isConditionalExpression4(node); } function isValidStatement(node) { - return isExpressionStatement(node) || isReturnStatement4(node) || isVariableStatement11(node); + return isExpressionStatement(node) || isReturnStatement4(node) || isVariableStatement12(node); } function isValidExpressionOrStatement(node) { return isValidExpression(node) || isValidStatement(node); } - function getInfo3(context, considerEmptySpans = true) { - const { file: file2, program } = context; - const span = getRefactorContextSpan(context); + function getInfo3(context2, considerEmptySpans = true) { + const { file: file2, program } = context2; + const span = getRefactorContextSpan(context2); const forEmptySpan = span.length === 0; if (forEmptySpan && !considerEmptySpans) return void 0; const startToken = getTokenAtPosition(file2, span.start); @@ -180994,7 +184269,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!finalExpression || checker.isNullableType(checker.getTypeAtLocation(finalExpression))) { return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; } - if ((isPropertyAccessExpression16(condition) || isIdentifier26(condition)) && getMatchingStart(condition, finalExpression.expression)) { + if ((isPropertyAccessExpression17(condition) || isIdentifier28(condition)) && getMatchingStart(condition, finalExpression.expression)) { return { finalExpression, occurrences: [condition], expression }; } else if (isBinaryExpression4(condition)) { const occurrences = getOccurrencesInExpression(finalExpression.expression, condition); @@ -181028,28 +184303,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return occurrences.length > 0 ? occurrences : void 0; } function getMatchingStart(chain, subchain) { - if (!isIdentifier26(subchain) && !isPropertyAccessExpression16(subchain) && !isElementAccessExpression8(subchain)) { + if (!isIdentifier28(subchain) && !isPropertyAccessExpression17(subchain) && !isElementAccessExpression8(subchain)) { return void 0; } return chainStartsWith(chain, subchain) ? subchain : void 0; } function chainStartsWith(chain, subchain) { - while (isCallExpression16(chain) || isPropertyAccessExpression16(chain) || isElementAccessExpression8(chain)) { + while (isCallExpression16(chain) || isPropertyAccessExpression17(chain) || isElementAccessExpression8(chain)) { if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) break; chain = chain.expression; } - while (isPropertyAccessExpression16(chain) && isPropertyAccessExpression16(subchain) || isElementAccessExpression8(chain) && isElementAccessExpression8(subchain)) { + while (isPropertyAccessExpression17(chain) && isPropertyAccessExpression17(subchain) || isElementAccessExpression8(chain) && isElementAccessExpression8(subchain)) { if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) return false; chain = chain.expression; subchain = subchain.expression; } - return isIdentifier26(chain) && isIdentifier26(subchain) && chain.getText() === subchain.getText(); + return isIdentifier28(chain) && isIdentifier28(subchain) && chain.getText() === subchain.getText(); } function getTextOfChainNode(node) { - if (isIdentifier26(node) || isStringOrNumericLiteralLike(node)) { + if (isIdentifier28(node) || isStringOrNumericLiteralLike(node)) { return node.getText(); } - if (isPropertyAccessExpression16(node)) { + if (isPropertyAccessExpression17(node)) { return getTextOfChainNode(node.name); } if (isElementAccessExpression8(node)) { @@ -181079,7 +184354,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isValidExpression(node)) { return node; } - if (isVariableStatement11(node)) { + if (isVariableStatement12(node)) { const variable = getSingleVariableOfVariableStatement(node); const initializer3 = variable == null ? void 0 : variable.initializer; return initializer3 && isValidExpression(initializer3) ? initializer3 : void 0; @@ -181090,13 +184365,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} node = skipParentheses(node); if (isBinaryExpression4(node)) { return getFinalExpressionInChain(node.left); - } else if ((isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isCallExpression16(node)) && !isOptionalChain2(node)) { + } else if ((isPropertyAccessExpression17(node) || isElementAccessExpression8(node) || isCallExpression16(node)) && !isOptionalChain2(node)) { return node; } return void 0; } function convertOccurrences(checker, toConvert, occurrences) { - if (isPropertyAccessExpression16(toConvert) || isElementAccessExpression8(toConvert) || isCallExpression16(toConvert)) { + if (isPropertyAccessExpression17(toConvert) || isElementAccessExpression8(toConvert) || isCallExpression16(toConvert)) { const chain = convertOccurrences(checker, toConvert.expression, occurrences); const lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : void 0; const isOccurrence = (lastOccurrence == null ? void 0 : lastOccurrence.getText()) === toConvert.expression.getText(); @@ -181106,7 +184381,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 29 /* QuestionDotToken */ ), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments); - } else if (isPropertyAccessExpression16(toConvert)) { + } else if (isPropertyAccessExpression17(toConvert)) { return isOccurrence ? factory.createPropertyAccessChain(chain, factory.createToken( 29 /* QuestionDotToken */ @@ -181124,7 +184399,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { finalExpression, occurrences, expression } = info; const firstOccurrence = occurrences[occurrences.length - 1]; const convertedChain = convertOccurrences(checker, finalExpression, occurrences); - if (convertedChain && (isPropertyAccessExpression16(convertedChain) || isElementAccessExpression8(convertedChain) || isCallExpression16(convertedChain))) { + if (convertedChain && (isPropertyAccessExpression17(convertedChain) || isElementAccessExpression8(convertedChain) || isCallExpression16(convertedChain))) { if (isBinaryExpression4(expression)) { changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); } else if (isConditionalExpression4(expression)) { @@ -181162,12 +184437,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToExtractSymbol, getAvailableActions: getRefactorActionsToExtractSymbol }); - function getRefactorActionsToExtractSymbol(context) { - const requestedRefactor = context.kind; - const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context), context.triggerReason === "invoked"); + function getRefactorActionsToExtractSymbol(context2) { + const requestedRefactor = context2.kind; + const rangeToExtract = getRangeToExtract2(context2.file, getRefactorContextSpan(context2), context2.triggerReason === "invoked"); const targetRange = rangeToExtract.targetRange; if (targetRange === void 0) { - if (!rangeToExtract.errors || rangeToExtract.errors.length === 0 || !context.preferences.provideRefactorNotApplicableReason) { + if (!rangeToExtract.errors || rangeToExtract.errors.length === 0 || !context2.preferences.provideRefactorNotApplicableReason) { return emptyArray; } const errors = []; @@ -181187,7 +184462,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return errors; } - const { affectedTextRange, extractions } = getPossibleExtractions(targetRange, context); + const { affectedTextRange, extractions } = getPossibleExtractions(targetRange, context2); if (extractions === void 0) { return emptyArray; } @@ -181209,8 +184484,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} name: `function_scope_${i}`, kind: extractFunctionAction.kind, range: { - start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character }, - end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character } + start: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).character }, + end: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).character } } }); } @@ -181233,8 +184508,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} name: `constant_scope_${i}`, kind: extractConstantAction.kind, range: { - start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character }, - end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character } + start: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.pos).character }, + end: { line: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context2.file, affectedTextRange.end).character } } }); } @@ -181256,7 +184531,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} description: getLocaleSpecificMessage(Diagnostics.Extract_function), actions: functionActions }); - } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { + } else if (context2.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { infos.push({ name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_function), @@ -181269,7 +184544,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} description: getLocaleSpecificMessage(Diagnostics.Extract_constant), actions: constantActions }); - } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { + } else if (context2.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { infos.push({ name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_constant), @@ -181285,20 +184560,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return error210; } } - function getRefactorEditsToExtractSymbol(context, actionName2) { - const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context)); + function getRefactorEditsToExtractSymbol(context2, actionName2) { + const rangeToExtract = getRangeToExtract2(context2.file, getRefactorContextSpan(context2)); const targetRange = rangeToExtract.targetRange; const parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName2); if (parsedFunctionIndexMatch) { const index = +parsedFunctionIndexMatch[1]; Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index"); - return getFunctionExtractionAtIndex(targetRange, context, index); + return getFunctionExtractionAtIndex(targetRange, context2, index); } const parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName2); if (parsedConstantIndexMatch) { const index = +parsedConstantIndexMatch[1]; Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index"); - return getConstantExtractionAtIndex(targetRange, context, index); + return getConstantExtractionAtIndex(targetRange, context2, index); } Debug.fail("Unrecognized action name"); } @@ -181399,8 +184674,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (node2.expression) { return node2.expression; } - } else if (isVariableStatement11(node2) || isVariableDeclarationList(node2)) { - const declarations = isVariableStatement11(node2) ? node2.declarationList.declarations : node2.declarations; + } else if (isVariableStatement12(node2) || isVariableDeclarationList(node2)) { + const declarations = isVariableStatement12(node2) ? node2.declarationList.declarations : node2.declarations; let numInitializers = 0; let lastInitializer; for (const declaration of declarations) { @@ -181420,7 +184695,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return node2; } function checkRootNode(node2) { - if (isIdentifier26(isExpressionStatement(node2) ? node2.expression : node2)) { + if (isIdentifier28(isExpressionStatement(node2) ? node2.expression : node2)) { return [createDiagnosticForNode(node2, Messages.cannotExtractIdentifier)]; } return void 0; @@ -181665,22 +184940,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) { - const { scopes, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); + function getFunctionExtractionAtIndex(targetRange, context2, requestedChangesIndex) { + const { scopes, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context2); Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); - context.cancellationToken.throwIfCancellationRequested(); - return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context); + context2.cancellationToken.throwIfCancellationRequested(); + return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context2); } - function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) { - const { scopes, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); + function getConstantExtractionAtIndex(targetRange, context2, requestedChangesIndex) { + const { scopes, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context2); Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?"); - context.cancellationToken.throwIfCancellationRequested(); + context2.cancellationToken.throwIfCancellationRequested(); const expression = isExpression(target) ? target : target.statements[0].expression; - return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context); + return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context2); } - function getPossibleExtractions(targetRange, context) { - const { scopes, affectedTextRange, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context); + function getPossibleExtractions(targetRange, context2) { + const { scopes, affectedTextRange, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context2); const extractions = scopes.map((scope, i) => { const functionDescriptionPart = getDescriptionForFunctionInScope(scope); const constantDescriptionPart = getDescriptionForConstantInScope(scope); @@ -181713,8 +184988,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); return { affectedTextRange, extractions }; } - function getPossibleExtractionsWorker(targetRange, context) { - const { file: sourceFile } = context; + function getPossibleExtractionsWorker(targetRange, context2) { + const { file: sourceFile } = context2; const scopes = collectEnclosingScopes(targetRange); const enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); const readsAndWrites = collectReadsAndWrites( @@ -181722,8 +184997,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} scopes, enclosingTextRange, sourceFile, - context.program.getTypeChecker(), - context.cancellationToken + context2.program.getTypeChecker(), + context2.cancellationToken ); return { scopes, affectedTextRange: enclosingTextRange, readsAndWrites }; } @@ -181758,10 +185033,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getDescriptionForModuleLikeDeclaration(scope) { return scope.kind === 269 ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 : 1; } - function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) { - const checker = context.program.getTypeChecker(); - const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const importAdder = ts_codefix_exports.createImportAdder(context.file, context.program, context.preferences, context.host); + function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context2) { + const checker = context2.program.getTypeChecker(); + const scriptTarget = getEmitScriptTarget(context2.program.getCompilerOptions()); + const importAdder = ts_codefix_exports.createImportAdder(context2.file, context2.program, context2.preferences, context2.host); const file2 = scope.getSourceFile(); const functionNameText = getUniqueName(isClassLike(scope) ? "newMethod" : "newFunction", file2); const isJS = isInJSFile(scope); @@ -181803,7 +185078,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } callArguments.push(factory.createIdentifier(name)); }); - const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) })); + const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context2.startPosition) })); typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder); const typeParameters = typeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(typeParametersAndDeclarations, ({ declaration }) => declaration); const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode( @@ -181896,19 +185171,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} body ); } - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context2); const minInsertionPos = (isReadonlyArray(range.range) ? last(range.range) : range.range).end; const nodeToInsertBefore = getNodeToInsertFunctionBefore(minInsertionPos, scope); if (nodeToInsertBefore) { changeTracker.insertNodeBefore( - context.file, + context2.file, nodeToInsertBefore, newFunction, /*blankLineBetween*/ true ); } else { - changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction); + changeTracker.insertNodeAtEndOfScope(context2.file, scope, newFunction); } importAdder.writeFixes(changeTracker); const newNodes = []; @@ -182085,9 +185360,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (isReadonlyArray(range.range)) { - changeTracker.replaceNodeRangeWithNodes(context.file, first(range.range), last(range.range), newNodes); + changeTracker.replaceNodeRangeWithNodes(context2.file, first(range.range), last(range.range), newNodes); } else { - changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes); + changeTracker.replaceNodeWithNodes(context2.file, range.range, newNodes); } const edits = changeTracker.getChanges(); const renameRange = isReadonlyArray(range.range) ? first(range.range) : range.range; @@ -182119,8 +185394,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )]); } } - function extractConstantInScope(node, scope, { substitutions }, rangeFacts, context) { - const checker = context.program.getTypeChecker(); + function extractConstantInScope(node, scope, { substitutions }, rangeFacts, context2) { + const checker = context2.program.getTypeChecker(); const file2 = scope.getSourceFile(); const localNameText = getIdentifierForNode(node, scope, checker, file2); const isJS = isInJSFile(scope); @@ -182134,7 +185409,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let initializer3 = transformConstantInitializer(skipParentheses(node), substitutions); ({ variableType, initializer: initializer3 } = transformFunctionInitializerAndType(variableType, initializer3)); suppressLeadingAndTrailingTrivia(initializer3); - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context2); if (isClassLike(scope)) { Debug.assert(!isJS, "Cannot extract to a JS class"); const modifiers = []; @@ -182174,13 +185449,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const maxInsertionPos = node.pos; const nodeToInsertBefore = getNodeToInsertPropertyBefore(maxInsertionPos, scope); changeTracker.insertNodeBefore( - context.file, + context2.file, nodeToInsertBefore, newVariable, /*blankLineBetween*/ true ); - changeTracker.replaceNode(context.file, node, localReference); + changeTracker.replaceNode(context2.file, node, localReference); } else { const newVariableDeclaration = factory.createVariableDeclaration( localNameText, @@ -182191,9 +185466,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); const oldVariableDeclaration = getContainingVariableDeclarationIfInList(node, scope); if (oldVariableDeclaration) { - changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); + changeTracker.insertNodeBefore(context2.file, oldVariableDeclaration, newVariableDeclaration); const localReference = factory.createIdentifier(localNameText); - changeTracker.replaceNode(context.file, node, localReference); + changeTracker.replaceNode(context2.file, node, localReference); } else if (node.parent.kind === 245 && scope === findAncestor(node, isScope)) { const newVariableStatement = factory.createVariableStatement( /*modifiers*/ @@ -182204,7 +185479,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /* Const */ ) ); - changeTracker.replaceNode(context.file, node.parent, newVariableStatement); + changeTracker.replaceNode(context2.file, node.parent, newVariableStatement); } else { const newVariableStatement = factory.createVariableStatement( /*modifiers*/ @@ -182218,14 +185493,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const nodeToInsertBefore = getNodeToInsertConstantBefore(node, scope); if (nodeToInsertBefore.pos === 0) { changeTracker.insertNodeAtTopOfFile( - context.file, + context2.file, newVariableStatement, /*blankLineBetween*/ false ); } else { changeTracker.insertNodeBefore( - context.file, + context2.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ @@ -182233,7 +185508,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } if (node.parent.kind === 245) { - changeTracker.delete(context.file, node.parent); + changeTracker.delete(context2.file, node.parent); } else { let localReference = factory.createIdentifier(localNameText); if (isInJSXContent(node)) { @@ -182243,7 +185518,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} localReference ); } - changeTracker.replaceNode(context.file, node, localReference); + changeTracker.replaceNode(context2.file, node, localReference); } } } @@ -182288,7 +185563,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (hasAny) return { variableType: variableType2, initializer: initializer22 }; variableType2 = void 0; if (isArrowFunction8(initializer22)) { - initializer22 = factory.updateArrowFunction(initializer22, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer22.typeParameters, parameters, initializer22.type || checker.typeToTypeNode( + initializer22 = factory.updateArrowFunction(initializer22, canHaveModifiers2(node) ? getModifiers2(node) : void 0, initializer22.typeParameters, parameters, initializer22.type || checker.typeToTypeNode( functionSignature.getReturnType(), scope, 1, @@ -182298,7 +185573,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { if (functionSignature && !!functionSignature.thisParameter) { const firstParameter = firstOrUndefined(parameters); - if (!firstParameter || isIdentifier26(firstParameter.name) && firstParameter.name.escapedText !== "this") { + if (!firstParameter || isIdentifier28(firstParameter.name) && firstParameter.name.escapedText !== "this") { const thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); parameters.splice( 0, @@ -182322,7 +185597,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } } - initializer22 = factory.updateFunctionExpression(initializer22, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer22.asteriskToken, initializer22.name, initializer22.typeParameters, parameters, initializer22.type || checker.typeToTypeNode( + initializer22 = factory.updateFunctionExpression(initializer22, canHaveModifiers2(node) ? getModifiers2(node) : void 0, initializer22.asteriskToken, initializer22.name, initializer22.typeParameters, parameters, initializer22.type || checker.typeToTypeNode( functionSignature.getReturnType(), scope, 1 @@ -182661,16 +185936,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 2 /* Write */ ); - } else if (isPropertyAccessExpression16(node) || isElementAccessExpression8(node)) { + } else if (isPropertyAccessExpression17(node) || isElementAccessExpression8(node)) { forEachChild27(node, collectUsages); - } else if (isIdentifier26(node)) { + } else if (isIdentifier28(node)) { if (!node.parent) { return; } if (isQualifiedName2(node.parent) && node !== node.parent.left) { return; } - if (isPropertyAccessExpression16(node.parent) && node !== node.parent.expression) { + if (isPropertyAccessExpression17(node.parent) && node !== node.parent.expression) { return; } recordUsage( @@ -182764,7 +186039,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.includes(node)) { return; } - const sym = isIdentifier26(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); + const sym = isIdentifier28(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); if (sym) { const decl = find(visibleDeclarationsInExtractedRange, (d) => d.symbol === sym); if (decl) { @@ -182782,7 +186057,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} forEachChild27(node, checkForUsedDeclarations); } function getSymbolReferencedByIdentifier(identifier) { - return identifier.parent && isShorthandPropertyAssignment6(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); + return identifier.parent && isShorthandPropertyAssignment7(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); } function tryReplaceWithQualifiedNameOrPropertyAccess(symbol2, scopeDecl, isTypeNode2) { if (!symbol2) { @@ -182836,15 +186111,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; registerRefactor(actionName, { kinds: [generateGetSetAction.kind], - getEditsForAction: function getRefactorActionsToGenerateGetAndSetAccessors(context, actionName2) { - if (!context.endPosition) return void 0; - const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition); + getEditsForAction: function getRefactorActionsToGenerateGetAndSetAccessors(context2, actionName2) { + if (!context2.endPosition) return void 0; + const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context2.file, context2.program, context2.startPosition, context2.endPosition); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_codefix_exports.generateAccessorFromProperty(context.file, context.program, context.startPosition, context.endPosition, context, actionName2); + const edits = ts_codefix_exports.generateAccessorFromProperty(context2.file, context2.program, context2.startPosition, context2.endPosition, context2, actionName2); if (!edits) return void 0; - const renameFilename = context.file.fileName; + const renameFilename = context2.file.fileName; const nameNeedRename = info.renameAccessor ? info.accessorName : info.fieldName; - const renameLocationOffset = isIdentifier26(nameNeedRename) ? 0 : -1; + const renameLocationOffset = isIdentifier28(nameNeedRename) ? 0 : -1; const renameLocation = renameLocationOffset + getRenameLocation( edits, renameFilename, @@ -182854,9 +186129,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); return { renameFilename, renameLocation, edits }; }, - getAvailableActions(context) { - if (!context.endPosition) return emptyArray; - const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition, context.triggerReason === "invoked"); + getAvailableActions(context2) { + if (!context2.endPosition) return emptyArray; + const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context2.file, context2.program, context2.startPosition, context2.endPosition, context2.triggerReason === "invoked"); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ @@ -182865,7 +186140,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions: [generateGetSetAction] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: actionName, description: actionDescription, @@ -182888,16 +186163,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getEditsForAction: getRefactorEditsToInferReturnType, getAvailableActions: getRefactorActionsToInferReturnType }); - function getRefactorEditsToInferReturnType(context) { - const info = getInfo4(context); + function getRefactorEditsToInferReturnType(context2) { + const info = getInfo4(context2); if (info && !isRefactorErrorInfo(info)) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(context.file, t, info.declaration, info.returnTypeNode)); + const edits = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange7(context2.file, t, info.declaration, info.returnTypeNode)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return void 0; } - function getRefactorActionsToInferReturnType(context) { - const info = getInfo4(context); + function getRefactorActionsToInferReturnType(context2) { + const info = getInfo4(context2); if (!info) return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ @@ -182906,7 +186181,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions: [inferReturnTypeAction] }]; } - if (context.preferences.provideRefactorNotApplicableReason) { + if (context2.preferences.provideRefactorNotApplicableReason) { return [{ name: refactorName13, description: refactorDescription7, @@ -182933,14 +186208,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changes.insertNodeAt(sourceFile, endNode2.end, typeNode, { prefix: ": " }); } } - function getInfo4(context) { - if (isInJSFile(context.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind)) return; - const token = getTouchingPropertyName(context.file, context.startPosition); + function getInfo4(context2) { + if (isInJSFile(context2.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context2.kind)) return; + const token = getTouchingPropertyName(context2.file, context2.startPosition); const declaration = findAncestor(token, (n) => isBlock6(n) || n.parent && isArrowFunction8(n.parent) && (n.kind === 39 || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n)); if (!declaration || !declaration.body || declaration.type) { return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) }; } - const typeChecker = context.program.getTypeChecker(); + const typeChecker = context2.program.getTypeChecker(); let returnType; if (typeChecker.isImplementationOfOverload(declaration)) { const signatures = typeChecker.getTypeAtLocation(declaration).getCallSignatures(); @@ -183076,7 +186351,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isJsxExpression(node)) { inJSXElement = false; } - if (isIdentifier26(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { + if (isIdentifier28(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { let symbol2 = typeChecker.getSymbolAtLocation(node); if (symbol2) { if (symbol2.flags & 2097152) { @@ -183197,7 +186472,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return isCallExpression16(node.parent) && node.parent.expression === node; } function isRightSideOfQualifiedNameOrPropertyAccess2(node) { - return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression16(node.parent) && node.parent.name === node; + return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression17(node.parent) && node.parent.name === node; } var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([ [ @@ -183557,9 +186832,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return this.documentationComment; } - getContextualDocumentationComment(context, checker) { - if (context) { - if (isGetAccessor(context)) { + getContextualDocumentationComment(context2, checker) { + if (context2) { + if (isGetAccessor(context2)) { if (!this.contextualGetAccessorDocumentationComment) { this.contextualGetAccessorDocumentationComment = emptyArray; this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker); @@ -183568,7 +186843,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return this.contextualGetAccessorDocumentationComment; } } - if (isSetAccessor(context)) { + if (isSetAccessor(context2)) { if (!this.contextualSetAccessorDocumentationComment) { this.contextualSetAccessorDocumentationComment = emptyArray; this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker); @@ -183587,9 +186862,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return this.tags; } - getContextualJsDocTags(context, checker) { - if (context) { - if (isGetAccessor(context)) { + getContextualJsDocTags(context2, checker) { + if (context2) { + if (isGetAccessor(context2)) { if (!this.contextualGetAccessorTags) { this.contextualGetAccessorTags = emptyArray; this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); @@ -183598,7 +186873,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return this.contextualGetAccessorTags; } } - if (isSetAccessor(context)) { + if (isSetAccessor(context2)) { if (!this.contextualSetAccessorTags) { this.contextualSetAccessorTags = emptyArray; this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); @@ -183885,7 +187160,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getDeclarationName(declaration) { const name = getNonAssignedNameOfDeclaration(declaration); - return name && (isComputedPropertyName(name) && isPropertyAccessExpression16(name.expression) ? name.expression.name.text : isPropertyName(name) ? getNameFromPropertyName(name) : void 0); + return name && (isComputedPropertyName(name) && isPropertyAccessExpression17(name.expression) ? name.expression.name.text : isPropertyName(name) ? getNameFromPropertyName(name) : void 0); } function visit(node) { switch (node.kind) { @@ -184103,7 +187378,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} sourceFile.scriptSnapshot = scriptSnapshot; } function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTargetOrOptions, version22, setNodeParents, scriptKind) { - const sourceFile = createSourceFile5(fileName, getSnapshotText(scriptSnapshot), scriptTargetOrOptions, setNodeParents, scriptKind); + const sourceFile = createSourceFile6(fileName, getSnapshotText(scriptSnapshot), scriptTargetOrOptions, setNodeParents, scriptKind); setSourceFileFields(sourceFile, scriptSnapshot, version22); return sourceFile; } @@ -184841,7 +188116,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const sourceFile = getValidSourceFile(fileName); const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position)); if (!ts_Rename_exports.nodeIsEligibleForRename(node)) return void 0; - if (isIdentifier26(node) && (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) && isIntrinsicJsxName(node.escapedText)) { + if (isIdentifier28(node) && (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) && isIntrinsicJsxName(node.escapedText)) { const { openingElement, closingElement } = node.parent.parent; return [openingElement, closingElement].map((node2) => { const textSpan = createTextSpanFromNode(node2.tagName, sourceFile); @@ -185613,7 +188888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function initializeNameTable(sourceFile) { const nameTable = sourceFile.nameTable = /* @__PURE__ */ new Map(); sourceFile.forEachChild(function walk(node) { - if (isIdentifier26(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) { + if (isIdentifier28(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) { const text = getEscapedTextOfIdentifierOrLiteral(node); nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1); } else if (isPrivateIdentifier(node)) { @@ -185633,7 +188908,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getContainingObjectLiteralElement(node) { const element = getContainingObjectLiteralElementWorker(node); - return element && (isObjectLiteralExpression12(element.parent) || isJsxAttributes(element.parent)) ? element : void 0; + return element && (isObjectLiteralExpression13(element.parent) || isJsxAttributes(element.parent)) ? element : void 0; } function getContainingObjectLiteralElementWorker(node) { switch (node.kind) { @@ -185674,7 +188949,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const symbol2 = contextualType.getProperty(name); return symbol2 ? [symbol2] : emptyArray; } - const filteredTypes = isObjectLiteralExpression12(node.parent) || isJsxAttributes(node.parent) ? filter(contextualType.types, (t) => !checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent)) : contextualType.types; + const filteredTypes = isObjectLiteralExpression13(node.parent) || isJsxAttributes(node.parent) ? filter(contextualType.types, (t) => !checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent)) : contextualType.types; const discriminatedPropertySymbols = mapDefined(filteredTypes, (t) => t.getProperty(name)); if (unionSymbolOk && (discriminatedPropertySymbols.length === 0 || discriminatedPropertySymbols.length === contextualType.types.length)) { const symbol2 = contextualType.getProperty(name); @@ -186234,13 +189509,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return isPropertyDeclaration(node) || isVariableDeclaration7(node); } function isAssignedExpression(node) { - return (isFunctionExpression7(node) || isArrowFunction8(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier26(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2) || isPropertyDeclaration(node.parent)); + return (isFunctionExpression7(node) || isArrowFunction8(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier28(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2) || isPropertyDeclaration(node.parent)); } function isPossibleCallHierarchyDeclaration(node) { return isSourceFile(node) || isModuleDeclaration(node) || isFunctionDeclaration5(node) || isFunctionExpression7(node) || isClassDeclaration5(node) || isClassExpression(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node); } function isValidCallHierarchyDeclaration(node) { - return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier26(node.name) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isAssignedExpression(node); + return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier28(node.name) || isFunctionDeclaration5(node) || isClassDeclaration5(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isAssignedExpression(node); } function getCallHierarchyDeclarationReferenceNode(node) { if (isSourceFile(node)) return node; @@ -186275,7 +189550,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { text: `${prefix}static {}`, pos, end }; } const declName = isAssignedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name"); - let text = isIdentifier26(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0; + let text = isIdentifier28(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0; if (text === void 0) { const typeChecker = program.getTypeChecker(); const symbol2 = typeChecker.getSymbolAtLocation(declName); @@ -186295,7 +189570,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isPropertyDeclaration(node.parent) && isClassLike(node.parent.parent)) { return isClassExpression(node.parent.parent) ? (_a3 = getAssignedName(node.parent.parent)) == null ? void 0 : _a3.getText() : (_b = node.parent.parent.name) == null ? void 0 : _b.getText(); } - if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier26(node.parent.parent.parent.parent.parent.name)) { + if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier28(node.parent.parent.parent.parent.parent.name)) { return node.parent.parent.parent.parent.parent.name.getText(); } return; @@ -186311,7 +189586,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 263: case 264: case 268: - if (isModuleBlock(node.parent) && isIdentifier26(node.parent.parent.name)) { + if (isModuleBlock(node.parent) && isIdentifier28(node.parent.parent.name)) { return node.parent.parent.name.getText(); } } @@ -186614,7 +189889,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} collect(heritage.expression); } for (const member of node.members) { - if (canHaveModifiers(member)) { + if (canHaveModifiers2(member)) { forEach(member.modifiers, collect); } if (isPropertyDeclaration(member)) { @@ -186771,13 +190046,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return fixAllUnavailable ? action : { ...action, fixId: fixId56, fixAllDescription }; }; } - function getFixes(context) { - const diagnostics = getDiagnostics(context); - const registrations = errorCodeToFixes.get(String(context.errorCode)); - return flatMap(registrations, (f) => map2(f.getCodeActions(context), removeFixIdIfFixAllUnavailable(f, diagnostics))); + function getFixes(context2) { + const diagnostics = getDiagnostics(context2); + const registrations = errorCodeToFixes.get(String(context2.errorCode)); + return flatMap(registrations, (f) => map2(f.getCodeActions(context2), removeFixIdIfFixAllUnavailable(f, diagnostics))); } - function getAllFixes(context) { - return fixIdToRegistration.get(cast(context.fixId, isString)).getAllCodeActions(context); + function getAllFixes(context2) { + return fixIdToRegistration.get(cast(context2.fixId, isString)).getAllCodeActions(context2); } function createCombinedCodeActions(changes, commands) { return { changes, commands }; @@ -186785,13 +190060,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function createFileTextChanges(fileName, textChanges2) { return { fileName, textChanges: textChanges2 }; } - function codeFixAll(context, errorCodes68, use) { + function codeFixAll(context2, errorCodes68, use) { const commands = []; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes68, (diag2) => use(t, diag2, commands))); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => eachDiagnostic(context2, errorCodes68, (diag2) => use(t, diag2, commands))); return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands); } - function eachDiagnostic(context, errorCodes68, cb) { - for (const diag2 of getDiagnostics(context)) { + function eachDiagnostic(context2, errorCodes68, cb) { + for (const diag2 of getDiagnostics(context2)) { if (contains(errorCodes68, diag2.code)) { cb(diag2); } @@ -186814,14 +190089,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes = [Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code]; registerCodeFix({ errorCodes, - getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) { - const assertion = getAssertion(context.sourceFile, context.span.start); + getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context2) { + const assertion = getAssertion(context2.sourceFile, context2.span.start); if (assertion === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange(t, context.sourceFile, assertion)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange(t, context2.sourceFile, assertion)); return [createCodeFixAction(fixId, changes, Diagnostics.Add_unknown_conversion_for_non_overlapping_types, fixId, Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)]; }, fixIds: [fixId], - getAllCodeActions: (context) => codeFixAll(context, errorCodes, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes, (changes, diag2) => { const assertion = getAssertion(diag2.file, diag2.start); if (assertion) { makeChange(changes, diag2.file, assertion); @@ -186829,7 +190104,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }) }); function makeChange(changeTracker, sourceFile, assertion) { - const replacement = isAsExpression7(assertion) ? factory.createAsExpression(assertion.expression, factory.createKeywordTypeNode( + const replacement = isAsExpression8(assertion) ? factory.createAsExpression(assertion.expression, factory.createKeywordTypeNode( 159 /* UnknownKeyword */ )) : factory.createTypeAssertion(factory.createKeywordTypeNode( @@ -186840,7 +190115,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getAssertion(sourceFile, pos) { if (isInJSFile(sourceFile)) return void 0; - return findAncestor(getTokenAtPosition(sourceFile, pos), (n) => isAsExpression7(n) || isTypeAssertionExpression2(n)); + return findAncestor(getTokenAtPosition(sourceFile, pos), (n) => isAsExpression8(n) || isTypeAssertionExpression3(n)); } registerCodeFix({ errorCodes: [ @@ -186848,9 +190123,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Diagnostics.await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code, Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code ], - getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) { - const { sourceFile } = context; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { + getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context2) { + const { sourceFile } = context2; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changes2) => { const exportDeclaration = factory.createExportDeclaration( /*modifiers*/ void 0, @@ -186874,33 +190149,33 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ fixIds: [fixId2], errorCodes: errorCodes2, - getCodeActions: function getCodeActionsToAddMissingAsync(context) { - const { sourceFile, errorCode, cancellationToken, program, span } = context; + getCodeActions: function getCodeActionsToAddMissingAsync(context2) { + const { sourceFile, errorCode, cancellationToken, program, span } = context2; const diagnostic = find(program.getTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode)); const directSpan = diagnostic && diagnostic.relatedInformation && find(diagnostic.relatedInformation, (r) => r.code === Diagnostics.Did_you_mean_to_mark_this_function_as_async.code); const decl = getFixableErrorSpanDeclaration(sourceFile, directSpan); if (!decl) { return; } - const trackChanges = (cb) => ts_textChanges_exports.ChangeTracker.with(context, cb); - return [getFix(context, decl, trackChanges)]; + const trackChanges = (cb) => ts_textChanges_exports.ChangeTracker.with(context2, cb); + return [getFix(context2, decl, trackChanges)]; }, - getAllCodeActions: (context) => { - const { sourceFile } = context; + getAllCodeActions: (context2) => { + const { sourceFile } = context2; const fixedDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes2, (t, diagnostic) => { + return codeFixAll(context2, errorCodes2, (t, diagnostic) => { const span = diagnostic.relatedInformation && find(diagnostic.relatedInformation, (r) => r.code === Diagnostics.Did_you_mean_to_mark_this_function_as_async.code); const decl = getFixableErrorSpanDeclaration(sourceFile, span); if (!decl) { return; } const trackChanges = (cb) => (cb(t), []); - return getFix(context, decl, trackChanges, fixedDeclarations); + return getFix(context2, decl, trackChanges, fixedDeclarations); }); } }); - function getFix(context, decl, trackChanges, fixedDeclarations) { - const changes = trackChanges((t) => makeChange2(t, context.sourceFile, decl, fixedDeclarations)); + function getFix(context2, decl, trackChanges, fixedDeclarations) { + const changes = trackChanges((t) => makeChange2(t, context2.sourceFile, decl, fixedDeclarations)); return createCodeFixAction(fixId2, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId2, Diagnostics.Add_all_missing_async_modifiers); } function makeChange2(changeTracker, sourceFile, insertionSite, fixedDeclarations) { @@ -186969,30 +190244,30 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ fixIds: [fixId3], errorCodes: errorCodes3, - getCodeActions: function getCodeActionsToAddMissingAwait(context) { - const { sourceFile, errorCode, span, cancellationToken, program } = context; + getCodeActions: function getCodeActionsToAddMissingAwait(context2) { + const { sourceFile, errorCode, span, cancellationToken, program } = context2; const expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program); if (!expression) { return; } - const checker = context.program.getTypeChecker(); - const trackChanges = (cb) => ts_textChanges_exports.ChangeTracker.with(context, cb); + const checker = context2.program.getTypeChecker(); + const trackChanges = (cb) => ts_textChanges_exports.ChangeTracker.with(context2, cb); return compact([ - getDeclarationSiteFix(context, expression, errorCode, checker, trackChanges), - getUseSiteFix(context, expression, errorCode, checker, trackChanges) + getDeclarationSiteFix(context2, expression, errorCode, checker, trackChanges), + getUseSiteFix(context2, expression, errorCode, checker, trackChanges) ]); }, - getAllCodeActions: (context) => { - const { sourceFile, program, cancellationToken } = context; - const checker = context.program.getTypeChecker(); + getAllCodeActions: (context2) => { + const { sourceFile, program, cancellationToken } = context2; + const checker = context2.program.getTypeChecker(); const fixedDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes3, (t, diagnostic) => { + return codeFixAll(context2, errorCodes3, (t, diagnostic) => { const expression = getAwaitErrorSpanExpression(sourceFile, diagnostic.code, diagnostic, cancellationToken, program); if (!expression) { return; } const trackChanges = (cb) => (cb(t), []); - return getDeclarationSiteFix(context, expression, diagnostic.code, checker, trackChanges, fixedDeclarations) || getUseSiteFix(context, expression, diagnostic.code, checker, trackChanges, fixedDeclarations); + return getDeclarationSiteFix(context2, expression, diagnostic.code, checker, trackChanges, fixedDeclarations) || getUseSiteFix(context2, expression, diagnostic.code, checker, trackChanges, fixedDeclarations); }); } }); @@ -187000,8 +190275,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const expression = getFixableErrorSpanExpression(sourceFile, span); return expression && isMissingAwaitError(sourceFile, errorCode, span, cancellationToken, program) && isInsideAwaitableBody(expression) ? expression : void 0; } - function getDeclarationSiteFix(context, expression, errorCode, checker, trackChanges, fixedDeclarations) { - const { sourceFile, program, cancellationToken } = context; + function getDeclarationSiteFix(context2, expression, errorCode, checker, trackChanges, fixedDeclarations) { + const { sourceFile, program, cancellationToken } = context2; const awaitableInitializers = findAwaitableInitializers(expression, sourceFile, cancellationToken, program, checker); if (awaitableInitializers) { const initializerChanges = trackChanges((t) => { @@ -187017,8 +190292,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } } - function getUseSiteFix(context, expression, errorCode, checker, trackChanges, fixedDeclarations) { - const changes = trackChanges((t) => makeChange3(t, errorCode, context.sourceFile, checker, expression, fixedDeclarations)); + function getUseSiteFix(context2, expression, errorCode, checker, trackChanges, fixedDeclarations) { + const changes = trackChanges((t) => makeChange3(t, errorCode, context2.sourceFile, checker, expression, fixedDeclarations)); return createCodeFixAction(fixId3, changes, Diagnostics.Add_await, fixId3, Diagnostics.Fix_all_expressions_possibly_missing_await); } function isMissingAwaitError(sourceFile, errorCode, span, cancellationToken, program) { @@ -187039,7 +190314,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} continue; } const declaration = tryCast(symbol2.valueDeclaration, isVariableDeclaration7); - const variableName = declaration && tryCast(declaration.name, isIdentifier26); + const variableName = declaration && tryCast(declaration.name, isIdentifier28); const variableStatement = getAncestor( declaration, 244 @@ -187072,10 +190347,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; } function getIdentifiersFromErrorSpanExpression(expression, checker) { - if (isPropertyAccessExpression16(expression.parent) && isIdentifier26(expression.parent.expression)) { + if (isPropertyAccessExpression17(expression.parent) && isIdentifier28(expression.parent.expression)) { return { identifiers: [expression.parent.expression], isCompleteFix: true }; } - if (isIdentifier26(expression)) { + if (isIdentifier28(expression)) { return { identifiers: [expression], isCompleteFix: true }; } if (isBinaryExpression4(expression)) { @@ -187084,7 +190359,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} for (const side of [expression.left, expression.right]) { const type = checker.getTypeAtLocation(side); if (checker.getPromisedTypeOfPromise(type)) { - if (!isIdentifier26(side)) { + if (!isIdentifier28(side)) { isCompleteFix = false; continue; } @@ -187095,7 +190370,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker) { - const errorNode = isPropertyAccessExpression16(reference.parent) ? reference.parent.name : isBinaryExpression4(reference.parent) ? reference.parent : reference; + const errorNode = isPropertyAccessExpression17(reference.parent) ? reference.parent.name : isBinaryExpression4(reference.parent) ? reference.parent : reference; const diagnostic = find(diagnostics, (diagnostic2) => diagnostic2.start === errorNode.getStart(sourceFile) && diagnostic2.start + diagnostic2.length === errorNode.getEnd()); return diagnostic && contains(errorCodes3, diagnostic.code) || // A Promise is usually not correct in a binary expression (it's not valid // in an arithmetic expression and an equality comparison seems unusual), @@ -187124,7 +190399,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isBinaryExpression4(insertionSite)) { for (const side of [insertionSite.left, insertionSite.right]) { - if (fixedDeclarations && isIdentifier26(side)) { + if (fixedDeclarations && isIdentifier28(side)) { const symbol2 = checker.getSymbolAtLocation(side); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { continue; @@ -187134,8 +190409,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const newNode = checker.getPromisedTypeOfPromise(type) ? factory.createAwaitExpression(side) : side; changeTracker.replaceNode(sourceFile, side, newNode); } - } else if (errorCode === propertyAccessCode && isPropertyAccessExpression16(insertionSite.parent)) { - if (fixedDeclarations && isIdentifier26(insertionSite.parent.expression)) { + } else if (errorCode === propertyAccessCode && isPropertyAccessExpression17(insertionSite.parent)) { + if (fixedDeclarations && isIdentifier28(insertionSite.parent.expression)) { const symbol2 = checker.getSymbolAtLocation(insertionSite.parent.expression); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { return; @@ -187148,7 +190423,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile); } else if (contains(callableConstructableErrorCodes, errorCode) && isCallOrNewExpression(insertionSite.parent)) { - if (fixedDeclarations && isIdentifier26(insertionSite)) { + if (fixedDeclarations && isIdentifier28(insertionSite)) { const symbol2 = checker.getSymbolAtLocation(insertionSite); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { return; @@ -187157,7 +190432,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changeTracker.replaceNode(sourceFile, insertionSite, factory.createParenthesizedExpression(factory.createAwaitExpression(insertionSite))); insertLeadingSemicolonIfNeeded(changeTracker, insertionSite, sourceFile); } else { - if (fixedDeclarations && isVariableDeclaration7(insertionSite.parent) && isIdentifier26(insertionSite.parent.name)) { + if (fixedDeclarations && isVariableDeclaration7(insertionSite.parent) && isIdentifier28(insertionSite.parent.name)) { const symbol2 = checker.getSymbolAtLocation(insertionSite.parent.name); if (symbol2 && !tryAddToSet(fixedDeclarations, getSymbolId(symbol2))) { return; @@ -187179,16 +190454,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes4, - getCodeActions: function getCodeActionsToAddMissingConst(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange4(t, context.sourceFile, context.span.start, context.program)); + getCodeActions: function getCodeActionsToAddMissingConst(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange4(t, context2.sourceFile, context2.span.start, context2.program)); if (changes.length > 0) { return [createCodeFixAction(fixId4, changes, Diagnostics.Add_const_to_unresolved_variable, fixId4, Diagnostics.Add_const_to_all_unresolved_variables)]; } }, fixIds: [fixId4], - getAllCodeActions: (context) => { + getAllCodeActions: (context2) => { const fixedNodes = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes4, (changes, diag2) => makeChange4(changes, diag2.file, diag2.start, context.program, fixedNodes)); + return codeFixAll(context2, errorCodes4, (changes, diag2) => makeChange4(changes, diag2.file, diag2.start, context2.program, fixedNodes)); } }); function makeChange4(changeTracker, sourceFile, pos, program, fixedNodes) { @@ -187233,11 +190508,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function arrayElementCouldBeVariableDeclaration(expression, checker) { - const identifier = isIdentifier26(expression) ? expression : isAssignmentExpression( + const identifier = isIdentifier28(expression) ? expression : isAssignmentExpression( expression, /*excludeCompoundAssignment*/ true - ) && isIdentifier26(expression.left) ? expression.left : void 0; + ) && isIdentifier28(expression.left) ? expression.left : void 0; return !!identifier && !checker.getSymbolAtLocation(identifier); } function isPossiblyPartOfCommaSeperatedInitializer(node) { @@ -187257,7 +190532,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (expression.operatorToken.kind === 28) { return every([expression.left, expression.right], (expression2) => expressionCouldBeVariableDeclaration(expression2, checker)); } - return expression.operatorToken.kind === 64 && isIdentifier26(expression.left) && !checker.getSymbolAtLocation(expression.left); + return expression.operatorToken.kind === 64 && isIdentifier28(expression.left) && !checker.getSymbolAtLocation(expression.left); } var fixId5 = "addMissingDeclareProperty"; var errorCodes5 = [ @@ -187265,21 +190540,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes5, - getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange5(t, context.sourceFile, context.span.start)); + getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange5(t, context2.sourceFile, context2.span.start)); if (changes.length > 0) { return [createCodeFixAction(fixId5, changes, Diagnostics.Prefix_with_declare, fixId5, Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)]; } }, fixIds: [fixId5], - getAllCodeActions: (context) => { + getAllCodeActions: (context2) => { const fixedNodes = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes5, (changes, diag2) => makeChange5(changes, diag2.file, diag2.start, fixedNodes)); + return codeFixAll(context2, errorCodes5, (changes, diag2) => makeChange5(changes, diag2.file, diag2.start, fixedNodes)); } }); function makeChange5(changeTracker, sourceFile, pos, fixedNodes) { const token = getTokenAtPosition(sourceFile, pos); - if (!isIdentifier26(token)) { + if (!isIdentifier28(token)) { return; } const declaration = token.parent; @@ -187291,12 +190566,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes6 = [Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code]; registerCodeFix({ errorCodes: errorCodes6, - getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange6(t, context.sourceFile, context.span.start)); + getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange6(t, context2.sourceFile, context2.span.start)); return [createCodeFixAction(fixId6, changes, Diagnostics.Call_decorator_expression, fixId6, Diagnostics.Add_to_all_uncalled_decorators)]; }, fixIds: [fixId6], - getAllCodeActions: (context) => codeFixAll(context, errorCodes6, (changes, diag2) => makeChange6(changes, diag2.file, diag2.start)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes6, (changes, diag2) => makeChange6(changes, diag2.file, diag2.start)) }); function makeChange6(changeTracker, sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); @@ -187318,17 +190593,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes7, - getCodeActions: function getCodeActionsToAddMissingResolutionModeImportAttribute(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange7(t, context.sourceFile, context.span.start, context.program, context.host, context.preferences)); + getCodeActions: function getCodeActionsToAddMissingResolutionModeImportAttribute(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange7(t, context2.sourceFile, context2.span.start, context2.program, context2.host, context2.preferences)); return [createCodeFixAction(fixId7, changes, Diagnostics.Add_resolution_mode_import_attribute, fixId7, Diagnostics.Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it)]; }, fixIds: [fixId7], - getAllCodeActions: (context) => codeFixAll(context, errorCodes7, (changes, diag2) => makeChange7(changes, diag2.file, diag2.start, context.program, context.host, context.preferences)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes7, (changes, diag2) => makeChange7(changes, diag2.file, diag2.start, context2.program, context2.host, context2.preferences)) }); function makeChange7(changeTracker, sourceFile, pos, program, host, preferences) { var _a3, _b, _c; const token = getTokenAtPosition(sourceFile, pos); - const importNode = findAncestor(token, or(isImportDeclaration7, isImportTypeNode)); + const importNode = findAncestor(token, or(isImportDeclaration8, isImportTypeNode)); Debug.assert(!!importNode, "Expected position to be owned by an ImportDeclaration or ImportType."); const useSingleQuotes = getQuotePreference(sourceFile, preferences) === 0; const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importNode); @@ -187394,12 +190669,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes8 = [Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code]; registerCodeFix({ errorCodes: errorCodes8, - getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, context.sourceFile, context.span.start)); + getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange8(t, context2.sourceFile, context2.span.start)); return [createCodeFixAction(fixId8, changes, Diagnostics.Add_parameter_name, fixId8, Diagnostics.Add_names_to_all_parameters_without_names)]; }, fixIds: [fixId8], - getAllCodeActions: (context) => codeFixAll(context, errorCodes8, (changes, diag2) => makeChange8(changes, diag2.file, diag2.start)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes8, (changes, diag2) => makeChange8(changes, diag2.file, diag2.start)) }); function makeChange8(changeTracker, sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); @@ -187447,13 +190722,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes9, - getCodeActions(context) { - const typeChecker = context.program.getTypeChecker(); - const toAdd = getPropertiesToAdd(context.sourceFile, context.span, typeChecker); + getCodeActions(context2) { + const typeChecker = context2.program.getTypeChecker(); + const toAdd = getPropertiesToAdd(context2.sourceFile, context2.span, typeChecker); if (!toAdd.length) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addUndefinedToOptionalProperty(t, toAdd)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addUndefinedToOptionalProperty(t, toAdd)); return [createCodeFixActionWithoutFixAll(addOptionalPropertyUndefined, changes, Diagnostics.Add_undefined_to_optional_property_type)]; }, fixIds: [addOptionalPropertyUndefined] @@ -187472,7 +190747,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return checker.getExactOptionalProperties(target); } function shouldUseParentTypeOfProperty(sourceNode, targetNode, checker) { - return isPropertyAccessExpression16(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); + return isPropertyAccessExpression17(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); } function getSourceTarget(errorNode, checker) { var _a3; @@ -187489,15 +190764,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const i = errorNode.parent.arguments.indexOf(errorNode); if (i === -1) return void 0; const name = n.valueDeclaration.parameters[i].name; - if (isIdentifier26(name)) return { source: errorNode, target: name }; - } else if (isPropertyAssignment11(errorNode.parent) && isIdentifier26(errorNode.parent.name) || isShorthandPropertyAssignment6(errorNode.parent)) { + if (isIdentifier28(name)) return { source: errorNode, target: name }; + } else if (isPropertyAssignment12(errorNode.parent) && isIdentifier28(errorNode.parent.name) || isShorthandPropertyAssignment7(errorNode.parent)) { const parentTarget = getSourceTarget(errorNode.parent.parent, checker); if (!parentTarget) return void 0; const prop = checker.getPropertyOfType(checker.getTypeAtLocation(parentTarget.target), errorNode.parent.name.text); const declaration = (_a3 = prop == null ? void 0 : prop.declarations) == null ? void 0 : _a3[0]; if (!declaration) return void 0; return { - source: isPropertyAssignment11(errorNode.parent) ? errorNode.parent.initializer : errorNode.parent.name, + source: isPropertyAssignment12(errorNode.parent) ? errorNode.parent.initializer : errorNode.parent.name, target: declaration }; } @@ -187519,14 +190794,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes10 = [Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code]; registerCodeFix({ errorCodes: errorCodes10, - getCodeActions(context) { - const decl = getDeclaration(context.sourceFile, context.span.start); + getCodeActions(context2) { + const decl = getDeclaration(context2.sourceFile, context2.span.start); if (!decl) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, context.sourceFile, decl)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange8(t, context2.sourceFile, decl)); return [createCodeFixAction(fixId9, changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId9, Diagnostics.Annotate_everything_with_types_from_JSDoc)]; }, fixIds: [fixId9], - getAllCodeActions: (context) => codeFixAll(context, errorCodes10, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes10, (changes, diag2) => { const decl = getDeclaration(diag2.file, diag2.start); if (decl) doChange8(changes, diag2.file, decl); }) @@ -187613,7 +190888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeNode = factory.createTypeLiteralNode(map2(node.jsDocPropertyTags, (tag) => factory.createPropertySignature( /*modifiers*/ void 0, - isIdentifier26(tag.name) ? tag.name : tag.name.right, + isIdentifier28(tag.name) ? tag.name : tag.name.right, isOptionalJSDocPropertyLikeTag(tag) ? factory.createToken( 58 /* QuestionToken */ @@ -187658,7 +190933,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function transformJSDocTypeReference(node) { let name = node.typeName; let args = node.typeArguments; - if (isIdentifier26(node.typeName)) { + if (isIdentifier28(node.typeName)) { if (isJSDocIndexSignature(node)) { return transformJSDocIndexSignature(node); } @@ -187715,12 +190990,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes11 = [Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code]; registerCodeFix({ errorCodes: errorCodes11, - getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())); + getCodeActions(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange9(t, context2.sourceFile, context2.span.start, context2.program.getTypeChecker(), context2.preferences, context2.program.getCompilerOptions())); return [createCodeFixAction(fixId10, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId10, Diagnostics.Convert_all_constructor_functions_to_classes)]; }, fixIds: [fixId10], - getAllCodeActions: (context) => codeFixAll(context, errorCodes11, (changes, err) => doChange9(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes11, (changes, err) => doChange9(changes, err.file, err.start, context2.program.getTypeChecker(), context2.preferences, context2.program.getCompilerOptions())) }); function doChange9(changes, sourceFile, position, checker, preferences, compilerOptions) { const ctorSymbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, position)); @@ -187749,7 +191024,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} symbol2.exports.forEach((member) => { if (member.name === "prototype" && member.declarations) { const firstDeclaration = member.declarations[0]; - if (member.declarations.length === 1 && isPropertyAccessExpression16(firstDeclaration) && isBinaryExpression4(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 64 && isObjectLiteralExpression12(firstDeclaration.parent.right)) { + if (member.declarations.length === 1 && isPropertyAccessExpression17(firstDeclaration) && isBinaryExpression4(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 64 && isObjectLiteralExpression13(firstDeclaration.parent.right)) { const prototypes = firstDeclaration.parent.right; createClassElement( prototypes.symbol, @@ -187771,7 +191046,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var _a3, _b, _c, _d; if (key === "constructor" && member.valueDeclaration) { const prototypeAssignment = (_d = (_c = (_b = (_a3 = symbol2.exports) == null ? void 0 : _a3.get("prototype")) == null ? void 0 : _b.declarations) == null ? void 0 : _c[0]) == null ? void 0 : _d.parent; - if (prototypeAssignment && isBinaryExpression4(prototypeAssignment) && isObjectLiteralExpression12(prototypeAssignment.right) && some(prototypeAssignment.right.properties, isConstructorAssignment)) { + if (prototypeAssignment && isBinaryExpression4(prototypeAssignment) && isObjectLiteralExpression13(prototypeAssignment.right) && some(prototypeAssignment.right.properties, isConstructorAssignment)) { } else { changes.delete(sourceFile, member.valueDeclaration.parent); } @@ -187788,12 +191063,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return memberElements; function shouldConvertDeclaration(_target, source) { if (isAccessExpression(_target)) { - if (isPropertyAccessExpression16(_target) && isConstructorAssignment(_target)) return true; + if (isPropertyAccessExpression17(_target) && isConstructorAssignment(_target)) return true; return isFunctionLike(source); } else { return every(_target.properties, (property) => { if (isMethodDeclaration(property) || isGetOrSetAccessorDeclaration(property)) return true; - if (isPropertyAssignment11(property) && isFunctionExpression7(property.initializer) && !!property.name) return true; + if (isPropertyAssignment12(property) && isFunctionExpression7(property.initializer) && !!property.name) return true; if (isConstructorAssignment(property)) return true; return false; }); @@ -187811,7 +191086,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (some(members, (m) => { const name = getNameOfDeclaration(m); - if (name && isIdentifier26(name) && idText(name) === symbolName(symbol22)) { + if (name && isIdentifier28(name) && idText(name) === symbolName(symbol22)) { return true; } return false; @@ -187840,14 +191115,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} createFunctionLikeExpressionMember(members, assignmentExpr, name); } return; - } else if (isObjectLiteralExpression12(assignmentExpr)) { + } else if (isObjectLiteralExpression13(assignmentExpr)) { forEach( assignmentExpr.properties, (property) => { if (isMethodDeclaration(property) || isGetOrSetAccessorDeclaration(property)) { members.push(property); } - if (isPropertyAssignment11(property) && isFunctionExpression7(property.initializer)) { + if (isPropertyAssignment12(property) && isFunctionExpression7(property.initializer)) { createFunctionLikeExpressionMember(members, property.initializer, property.name); } if (isConstructorAssignment(property)) return; @@ -187857,7 +191132,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } else { if (isSourceFileJS(sourceFile)) return; - if (!isPropertyAccessExpression16(memberDeclaration)) return; + if (!isPropertyAccessExpression17(memberDeclaration)) return; const prop = factory.createPropertyDeclaration( modifiers, memberDeclaration.name, @@ -187933,7 +191208,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function createClassFromVariableDeclaration(node) { const initializer3 = node.initializer; - if (!initializer3 || !isFunctionExpression7(initializer3) || !isIdentifier26(node.name)) { + if (!initializer3 || !isFunctionExpression7(initializer3) || !isIdentifier28(node.name)) { return void 0; } const memberElements = createClassElementsFromSymbol(node.symbol); @@ -187989,15 +191264,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getModifierKindFromSource(source, kind) { - return canHaveModifiers(source) ? filter(source.modifiers, (modifier) => modifier.kind === kind) : void 0; + return canHaveModifiers2(source) ? filter(source.modifiers, (modifier) => modifier.kind === kind) : void 0; } function isConstructorAssignment(x) { if (!x.name) return false; - if (isIdentifier26(x.name) && x.name.text === "constructor") return true; + if (isIdentifier28(x.name) && x.name.text === "constructor") return true; return false; } function tryGetPropertyName(node, compilerOptions, quotePreference) { - if (isPropertyAccessExpression16(node)) { + if (isPropertyAccessExpression17(node)) { return node.name; } const propName2 = node.argumentExpression; @@ -188018,18 +191293,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var codeActionSucceeded = true; registerCodeFix({ errorCodes: errorCodes12, - getCodeActions(context) { + getCodeActions(context2) { codeActionSucceeded = true; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => convertToAsyncFunction(t, context.sourceFile, context.span.start, context.program.getTypeChecker())); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => convertToAsyncFunction(t, context2.sourceFile, context2.span.start, context2.program.getTypeChecker())); return codeActionSucceeded ? [createCodeFixAction(fixId11, changes, Diagnostics.Convert_to_async_function, fixId11, Diagnostics.Convert_all_to_async_functions)] : []; }, fixIds: [fixId11], - getAllCodeActions: (context) => codeFixAll(context, errorCodes12, (changes, err) => convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker())) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes12, (changes, err) => convertToAsyncFunction(changes, err.file, err.start, context2.program.getTypeChecker())) }); function convertToAsyncFunction(changes, sourceFile, position, checker) { const tokenAtPosition = getTokenAtPosition(sourceFile, position); let functionToConvert; - if (isIdentifier26(tokenAtPosition) && isVariableDeclaration7(tokenAtPosition.parent) && tokenAtPosition.parent.initializer && isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) { + if (isIdentifier28(tokenAtPosition) && isVariableDeclaration7(tokenAtPosition.parent) && tokenAtPosition.parent.initializer && isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) { functionToConvert = tokenAtPosition.parent.initializer; } else { functionToConvert = tryCast(getContainingFunction(getTokenAtPosition(sourceFile, position)), canBeConvertedToAsync); @@ -188138,7 +191413,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const identsToRenameMap = /* @__PURE__ */ new Map(); const collidingSymbolMap = createMultiMap(); forEachChild27(nodeToRename, function visit(node) { - if (!isIdentifier26(node)) { + if (!isIdentifier28(node)) { forEachChild27(node, visit); return; } @@ -188149,7 +191424,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const symbolIdString = getSymbolId(symbol2).toString(); if (lastCallSignature && !isParameter(node.parent) && !isFunctionLikeDeclaration(node.parent) && !synthNamesMap.has(symbolIdString)) { const firstParameter = firstOrUndefined(lastCallSignature.parameters); - const ident = (firstParameter == null ? void 0 : firstParameter.valueDeclaration) && isParameter(firstParameter.valueDeclaration) && tryCast(firstParameter.valueDeclaration.name, isIdentifier26) || factory.createUniqueName( + const ident = (firstParameter == null ? void 0 : firstParameter.valueDeclaration) && isParameter(firstParameter.valueDeclaration) && tryCast(firstParameter.valueDeclaration.name, isIdentifier28) || factory.createUniqueName( "result", 16 /* Optimistic */ @@ -188178,7 +191453,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*includeTrivia*/ true, (original) => { - if (isBindingElement(original) && isIdentifier26(original.name) && isObjectBindingPattern3(original.parent)) { + if (isBindingElement(original) && isIdentifier28(original.name) && isObjectBindingPattern3(original.parent)) { const symbol2 = checker.getSymbolAtLocation(original.name); const renameInfo = symbol2 && identsToRenameMap.get(String(getSymbolId(symbol2))); if (renameInfo && renameInfo.text !== (original.name || original.propertyName).getText()) { @@ -188189,7 +191464,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} original.initializer ); } - } else if (isIdentifier26(original)) { + } else if (isIdentifier28(original)) { const symbol2 = checker.getSymbolAtLocation(original); const renameInfo = symbol2 && identsToRenameMap.get(String(getSymbolId(symbol2))); if (renameInfo) { @@ -188221,19 +191496,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isPromiseReturningCallExpression(node, transformer.checker, "finally")) { return transformFinally(node, elementAt(node.arguments, 0), transformer, hasContinuation, continuationArgName); } - if (isPropertyAccessExpression16(node)) { + if (isPropertyAccessExpression17(node)) { return transformExpression(returnContextNode, node.expression, transformer, hasContinuation, continuationArgName); } const nodeType = transformer.checker.getTypeAtLocation(node); if (nodeType && transformer.checker.getPromisedTypeOfPromise(nodeType)) { - Debug.assertNode(getOriginalNode(node).parent, isPropertyAccessExpression16); + Debug.assertNode(getOriginalNode(node).parent, isPropertyAccessExpression17); return transformPromiseExpressionOfPropertyAccess(returnContextNode, node, transformer, hasContinuation, continuationArgName); } return silentFail(); } function isNullOrUndefined2({ checker }, node) { if (node.kind === 106) return true; - if (isIdentifier26(node) && !isGeneratedIdentifier(node) && idText(node) === "undefined") { + if (isIdentifier28(node) && !isGeneratedIdentifier(node) && idText(node) === "undefined") { const symbol2 = checker.getSymbolAtLocation(node); return !symbol2 || checker.isUndefinedSymbol(symbol2); } @@ -188663,9 +191938,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const param = funcNode.parameters[0].name; name = getMappedBindingNameOrDefault(param); } - } else if (isIdentifier26(funcNode)) { + } else if (isIdentifier28(funcNode)) { name = getMapEntryOrDefault(funcNode); - } else if (isPropertyAccessExpression16(funcNode) && isIdentifier26(funcNode.name)) { + } else if (isPropertyAccessExpression17(funcNode) && isIdentifier28(funcNode.name)) { name = getMapEntryOrDefault(funcNode.name); } if (!name || "identifier" in name && name.identifier.text === "undefined") { @@ -188673,7 +191948,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return name; function getMappedBindingNameOrDefault(bindingName) { - if (isIdentifier26(bindingName)) return getMapEntryOrDefault(bindingName); + if (isIdentifier28(bindingName)) return getMapEntryOrDefault(bindingName); const elements = flatMap(bindingName.elements, (element) => { if (isOmittedExpression(element)) return []; return [getMappedBindingNameOrDefault(element.name)]; @@ -188740,9 +192015,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } registerCodeFix({ errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code], - getCodeActions(context) { - const { sourceFile, program, preferences } = context; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { + getCodeActions(context2) { + const { sourceFile, program, preferences } = context2; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changes2) => { const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences)); if (moduleExportsChangedToDefault) { for (const importingFile of program.getSourceFiles()) { @@ -188789,13 +192064,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} convertExportsAccesses(sourceFile, exports2, changes); let moduleExportsChangedToDefault = false; let useSitesToUnqualify; - for (const statement of filter(sourceFile.statements, isVariableStatement11)) { + for (const statement of filter(sourceFile.statements, isVariableStatement12)) { const newUseSites = convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); if (newUseSites) { copyEntries(newUseSites, useSitesToUnqualify ?? (useSitesToUnqualify = /* @__PURE__ */ new Map())); } } - for (const statement of filter(sourceFile.statements, (s) => !isVariableStatement11(s))) { + for (const statement of filter(sourceFile.statements, (s) => !isVariableStatement12(s))) { const moduleExportsChanged = convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports2, useSitesToUnqualify, quotePreference); moduleExportsChangedToDefault = moduleExportsChangedToDefault || moduleExportsChanged; } @@ -188831,7 +192106,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function forEachExportReference(sourceFile, cb) { sourceFile.forEachChild(function recur(node) { - if (isPropertyAccessExpression16(node) && isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && isIdentifier26(node.name)) { + if (isPropertyAccessExpression17(node) && isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && isIdentifier28(node.name)) { const { parent: parent2 } = node; cb( node, @@ -188894,7 +192169,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )) { foundImport = true; return convertSingleImport(name, initializer3.arguments[0], checker, identifiers, target, quotePreference); - } else if (isPropertyAccessExpression16(initializer3) && isRequireCall( + } else if (isPropertyAccessExpression17(initializer3) && isRequireCall( initializer3.expression, /*requireStringLiteralLikeArgument*/ true @@ -188943,14 +192218,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function convertAssignment(sourceFile, checker, assignment, changes, exports2, useSitesToUnqualify) { const { left, right } = assignment; - if (!isPropertyAccessExpression16(left)) { + if (!isPropertyAccessExpression17(left)) { return false; } if (isExportsOrModuleExportsOrAlias(sourceFile, left)) { if (isExportsOrModuleExportsOrAlias(sourceFile, right)) { changes.delete(sourceFile, assignment.parent); } else { - const replacement = isObjectLiteralExpression12(right) ? tryChangeModuleExportsObject(right, useSitesToUnqualify) : isRequireCall( + const replacement = isObjectLiteralExpression13(right) ? tryChangeModuleExportsObject(right, useSitesToUnqualify) : isRequireCall( right, /*requireStringLiteralLikeArgument*/ true @@ -188979,9 +192254,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 306: return void 0; case 304: - return !isIdentifier26(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); + return !isIdentifier28(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); case 175: - return !isIdentifier26(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken( + return !isIdentifier28(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken( 95 /* ExportKeyword */ )], prop, useSitesToUnqualify); @@ -189115,7 +192390,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { case 207: { - const importSpecifiers = mapAllOrFail(name.elements, (e) => e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier26(e.propertyName) || !isIdentifier26(e.name) ? void 0 : makeImportSpecifier2(e.propertyName && e.propertyName.text, e.name.text)); + const importSpecifiers = mapAllOrFail(name.elements, (e) => e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier28(e.propertyName) || !isIdentifier28(e.name) ? void 0 : makeImportSpecifier2(e.propertyName && e.propertyName.text, e.name.text)); if (importSpecifiers) { return convertedImports([makeImport( /*defaultImport*/ @@ -189161,7 +192436,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} continue; } const { parent: parent2 } = use; - if (isPropertyAccessExpression16(parent2)) { + if (isPropertyAccessExpression17(parent2)) { const { name: { text: propertyName } } = parent2; if (propertyName === "default") { needDefaultImport = true; @@ -189207,7 +192482,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return map22; } function forEachFreeIdentifier(node, cb) { - if (isIdentifier26(node) && isFreeIdentifier(node)) cb(node); + if (isIdentifier28(node) && isFreeIdentifier(node)) cb(node); node.forEachChild((child) => forEachFreeIdentifier(child, cb)); } function isFreeIdentifier(node) { @@ -189303,15 +192578,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes13 = [Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code]; registerCodeFix({ errorCodes: errorCodes13, - getCodeActions(context) { - const qualifiedName = getQualifiedName(context.sourceFile, context.span.start); + getCodeActions(context2) { + const qualifiedName = getQualifiedName(context2.sourceFile, context2.span.start); if (!qualifiedName) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, context.sourceFile, qualifiedName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange10(t, context2.sourceFile, qualifiedName)); const newText = `${qualifiedName.left.text}["${qualifiedName.right.text}"]`; return [createCodeFixAction(fixId12, changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId12, Diagnostics.Rewrite_all_as_indexed_access_types)]; }, fixIds: [fixId12], - getAllCodeActions: (context) => codeFixAll(context, errorCodes13, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes13, (changes, diag2) => { const q3 = getQualifiedName(diag2.file, diag2.start); if (q3) { doChange10(changes, diag2.file, q3); @@ -189321,7 +192596,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getQualifiedName(sourceFile, pos) { const qualifiedName = findAncestor(getTokenAtPosition(sourceFile, pos), isQualifiedName2); Debug.assert(!!qualifiedName, "Expected position to be owned by a qualified name."); - return isIdentifier26(qualifiedName.left) ? qualifiedName : void 0; + return isIdentifier28(qualifiedName.left) ? qualifiedName : void 0; } function doChange10(changeTracker, sourceFile, qualifiedName) { const rightText = qualifiedName.right.text; @@ -189339,19 +192614,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var fixId13 = "convertToTypeOnlyExport"; registerCodeFix({ errorCodes: errorCodes14, - getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context)); + getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context2.span, context2.sourceFile), context2)); if (changes.length) { return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_export, fixId13, Diagnostics.Convert_all_re_exported_types_to_type_only_exports)]; } }, fixIds: [fixId13], - getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) { + getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context2) { const fixedExportDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes14, (changes, diag2) => { - const exportSpecifier = getExportSpecifierForDiagnosticSpan(diag2, context.sourceFile); + return codeFixAll(context2, errorCodes14, (changes, diag2) => { + const exportSpecifier = getExportSpecifierForDiagnosticSpan(diag2, context2.sourceFile); if (exportSpecifier && addToSeen(fixedExportDeclarations, getNodeId(exportSpecifier.parent.parent))) { - fixSingleExportDeclaration(changes, exportSpecifier, context); + fixSingleExportDeclaration(changes, exportSpecifier, context2); } }); } @@ -189359,15 +192634,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getExportSpecifierForDiagnosticSpan(span, sourceFile) { return tryCast(getTokenAtPosition(sourceFile, span.start).parent, isExportSpecifier); } - function fixSingleExportDeclaration(changes, exportSpecifier, context) { + function fixSingleExportDeclaration(changes, exportSpecifier, context2) { if (!exportSpecifier) { return; } const exportClause = exportSpecifier.parent; const exportDeclaration = exportClause.parent; - const typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); + const typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context2); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 156, exportClause); + changes.insertModifierBefore(context2.sourceFile, 156, exportClause); } else { const valueExportDeclaration = factory.updateExportDeclaration( exportDeclaration, @@ -189389,21 +192664,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*attributes*/ void 0 ); - changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, { + changes.replaceNode(context2.sourceFile, exportDeclaration, valueExportDeclaration, { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Exclude }); - changes.insertNodeAfter(context.sourceFile, exportDeclaration, typeExportDeclaration); + changes.insertNodeAfter(context2.sourceFile, exportDeclaration, typeExportDeclaration); } } - function getTypeExportSpecifiers(originExportSpecifier, context) { + function getTypeExportSpecifiers(originExportSpecifier, context2) { const exportClause = originExportSpecifier.parent; if (exportClause.elements.length === 1) { return exportClause.elements; } const diagnostics = getDiagnosticsWithinSpan( createTextSpanFromNode(exportClause), - context.program.getSemanticDiagnostics(context.sourceFile, context.cancellationToken) + context2.program.getSemanticDiagnostics(context2.sourceFile, context2.cancellationToken) ); return filter(exportClause.elements, (element) => { var _a3; @@ -189417,12 +192692,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var fixId14 = "convertToTypeOnlyImport"; registerCodeFix({ errorCodes: errorCodes15, - getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { + getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context2) { var _a3; - const declaration = getDeclaration2(context.sourceFile, context.span.start); + const declaration = getDeclaration2(context2.sourceFile, context2.span.start); if (declaration) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration)); - const importDeclarationChanges = declaration.kind === 277 && isImportDeclaration7(declaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange11(t, context2.sourceFile, declaration)); + const importDeclarationChanges = declaration.kind === 277 && isImportDeclaration8(declaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(declaration, context2.sourceFile, context2.program) ? ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange11(t, context2.sourceFile, declaration.parent.parent.parent)) : void 0; const mainAction = createCodeFixAction( fixId14, changes, @@ -189441,14 +192716,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; }, fixIds: [fixId14], - getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { + getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context2) { const fixedImportDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes15, (changes, diag2) => { + return codeFixAll(context2, errorCodes15, (changes, diag2) => { const errorDeclaration = getDeclaration2(diag2.file, diag2.start); if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 273 && !fixedImportDeclarations.has(errorDeclaration)) { doChange11(changes, diag2.file, errorDeclaration); fixedImportDeclarations.add(errorDeclaration); - } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 277 && isImportDeclaration7(errorDeclaration.parent.parent.parent) && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) { + } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 277 && isImportDeclaration8(errorDeclaration.parent.parent.parent) && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context2.program)) { doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent); fixedImportDeclarations.add(errorDeclaration.parent.parent.parent); } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 277) { @@ -189459,7 +192734,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getDeclaration2(sourceFile, pos) { const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); - return isImportSpecifier(parent2) || isImportDeclaration7(parent2) && parent2.importClause ? parent2 : void 0; + return isImportSpecifier(parent2) || isImportDeclaration8(parent2) && parent2.importClause ? parent2 : void 0; } function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) { if (specifier.parent.parent.name) { @@ -189571,14 +192846,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ fixIds: [fixId15], errorCodes: errorCodes16, - getCodeActions(context) { - const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options); + getCodeActions(context2) { + const newLineCharacter = getNewLineOrDefaultFromHost(context2.host, context2.formatContext.options); const node = getTokenAtPosition( - context.sourceFile, - context.span.start + context2.sourceFile, + context2.span.start ); if (!node) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange12(t, node, context2.sourceFile, newLineCharacter)); if (changes.length > 0) { return [ createCodeFixAction( @@ -189591,11 +192866,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; } }, - getAllCodeActions: (context) => codeFixAll( - context, + getAllCodeActions: (context2) => codeFixAll( + context2, errorCodes16, (changes, diag2) => { - const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options); + const newLineCharacter = getNewLineOrDefaultFromHost(context2.host, context2.formatContext.options); const node = getTokenAtPosition(diag2.file, diag2.start); const fixAll = true; if (node) doChange12(changes, node, diag2.file, newLineCharacter, fixAll); @@ -189741,18 +193016,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes17 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; registerCodeFix({ errorCodes: errorCodes17, - getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context2) { + const { sourceFile, span } = context2; const info = getInfo5(sourceFile, span.start); if (!info) { return void 0; } const { name, constraint } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange13(t, sourceFile, info)); return [createCodeFixAction(fixId16, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId16, Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId16], - getAllCodeActions: (context) => codeFixAll(context, errorCodes17, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes17, (changes, diag2) => { const info = getInfo5(diag2.file, diag2.start); if (info) { doChange13(changes, diag2.file, info); @@ -189761,7 +193036,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo5(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier26(token)) { + if (isIdentifier28(token)) { const propertySignature = cast(token.parent.parent, isPropertySignature3); const propertyName = token.getText(sourceFile); return { @@ -189803,22 +193078,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var fixId17 = "fixClassIncorrectlyImplementsInterface"; registerCodeFix({ errorCodes: errorCodes18, - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const classDeclaration = getClass(sourceFile, span.start); return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMissingDeclarations(context2, implementedTypeNode, sourceFile, classDeclaration, t, context2.preferences)); return changes.length === 0 ? void 0 : createCodeFixAction(fixId17, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId17, Diagnostics.Implement_all_unimplemented_interfaces); }); }, fixIds: [fixId17], - getAllCodeActions(context) { + getAllCodeActions(context2) { const seenClassDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes18, (changes, diag2) => { + return codeFixAll(context2, errorCodes18, (changes, diag2) => { const classDeclaration = getClass(diag2.file, diag2.start); if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) { for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) { - addMissingDeclarations(context, implementedTypeNode, diag2.file, classDeclaration, changes, context.preferences); + addMissingDeclarations(context2, implementedTypeNode, diag2.file, classDeclaration, changes, context2.preferences); } } }); @@ -189830,8 +193105,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function symbolPointsToNonPrivateMember(symbol2) { return !symbol2.valueDeclaration || !(getEffectiveModifierFlags(symbol2.valueDeclaration) & 2); } - function addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, changeTracker, preferences) { - const checker = context.program.getTypeChecker(); + function addMissingDeclarations(context2, implementedTypeNode, sourceFile, classDeclaration, changeTracker, preferences) { + const checker = context2.program.getTypeChecker(); const maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker); const implementedType = checker.getTypeAtLocation(implementedTypeNode); const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); @@ -189852,8 +193127,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /* String */ ); } - const importAdder = createImportAdder(sourceFile, context.program, preferences, context.host); - createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, sourceFile, context, preferences, importAdder, (member) => insertInterfaceMemberNode(sourceFile, classDeclaration, member)); + const importAdder = createImportAdder(sourceFile, context2.program, preferences, context2.host); + createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, sourceFile, context2, preferences, importAdder, (member) => insertInterfaceMemberNode(sourceFile, classDeclaration, member)); importAdder.writeFixes(changeTracker); function createMissingIndexSignatureDeclaration(type, kind) { const indexInfoOfKind = checker.getIndexInfoOfType(type, kind); @@ -189865,7 +193140,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} void 0, /*internalFlags*/ void 0, - getNoopSymbolTrackerWithResolver(context) + getNoopSymbolTrackerWithResolver(context2) )); } } @@ -189911,10 +193186,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes19, - getCodeActions(context) { - const { errorCode, preferences, sourceFile, span, program } = context; + getCodeActions(context2) { + const { errorCode, preferences, sourceFile, span, program } = context2; const info = getFixInfos( - context, + context2, errorCode, span.start, /*useAutoImportProvider*/ @@ -189923,7 +193198,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!info) return void 0; return info.map( ({ fix, symbolName: symbolName2, errorIdentifierText }) => codeActionForFix( - context, + context2, sourceFile, symbolName2, fix, @@ -189935,8 +193210,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); }, fixIds: [importFixId], - getAllCodeActions: (context) => { - const { sourceFile, program, preferences, host, cancellationToken } = context; + getAllCodeActions: (context2) => { + const { sourceFile, program, preferences, host, cancellationToken } = context2; const importAdder = createImportAdderWorker( sourceFile, program, @@ -189946,8 +193221,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} host, cancellationToken ); - eachDiagnostic(context, errorCodes19, (diag2) => importAdder.addImportFromDiagnostic(diag2, context)); - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes)); + eachDiagnostic(context2, errorCodes19, (diag2) => importAdder.addImportFromDiagnostic(diag2, context2)); + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, importAdder.writeFixes)); } }); function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { @@ -189973,13 +193248,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function addVerbatimImport(declaration) { verbatimImports.add(declaration); } - function addImportForUnresolvedIdentifier(context, symbolToken, useAutoImportProvider2) { - const info = getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider2); + function addImportForUnresolvedIdentifier(context2, symbolToken, useAutoImportProvider2) { + const info = getFixInfosWithoutDiagnostic(context2, symbolToken, useAutoImportProvider2); if (!info || !info.length) return; addImport(first(info)); } - function addImportFromDiagnostic(diagnostic, context) { - const info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + function addImportFromDiagnostic(diagnostic, context2) { + const info = getFixInfos(context2, diagnostic.code, diagnostic.start, useAutoImportProvider); if (!info || !info.length) return; addImport(first(info)); } @@ -190018,7 +193293,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} preferences ); if (fix) { - const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier26)) == null ? void 0 : _b.text) ?? symbolName2; + const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier28)) == null ? void 0 : _b.text) ?? symbolName2; let addAsTypeOnly; let propertyName; if (referenceImport && isTypeOnlyImportDeclaration(referenceImport) && (fix.kind === 3 || fix.kind === 2) && fix.addAsTypeOnly === 1) { @@ -190065,7 +193340,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} compilerOptions ); addAsTypeOnly = addAsTypeOnly === 1 && isTypeOnlyImportDeclaration(referenceImport) ? 2 : 1; - const importKind = isImportDeclaration7(referenceImport) ? isDefaultImport(referenceImport) ? 1 : 2 : isImportSpecifier(referenceImport) ? 0 : isImportClause(referenceImport) && !!referenceImport.name ? 1 : 2; + const importKind = isImportDeclaration8(referenceImport) ? isDefaultImport(referenceImport) ? 1 : 2 : isImportSpecifier(referenceImport) ? 0 : isImportClause(referenceImport) && !!referenceImport.name ? 1 : 2; const exportInfo = [{ symbol: symbolAlias, moduleSymbol, @@ -190284,7 +193559,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let importSpecifiersToRemoveWhileAdding; if (removeExisting.size) { Debug.assert(isFullSourceFile(sourceFile), "Cannot remove imports from a future source file"); - const importDeclarationsWithRemovals = new Set(mapDefined([...removeExisting], (d) => findAncestor(d, isImportDeclaration7))); + const importDeclarationsWithRemovals = new Set(mapDefined([...removeExisting], (d) => findAncestor(d, isImportDeclaration8))); const variableDeclarationsWithRemovals = new Set(mapDefined([...removeExisting], (d) => findAncestor(d, isVariableDeclarationInitializedToRequire))); const emptyImportDeclarations = [...importDeclarationsWithRemovals].filter( (d) => { @@ -190294,7 +193569,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} !addToExisting.has(d.importClause) && // no default, or default is being removed (!((_a22 = d.importClause) == null ? void 0 : _a22.name) || removeExisting.has(d.importClause)) && // no namespace import, or namespace import is being removed (!tryCast((_b2 = d.importClause) == null ? void 0 : _b2.namedBindings, isNamespaceImport5) || removeExisting.has(d.importClause.namedBindings)) && // no named imports, or all named imports are being removed - (!tryCast((_c = d.importClause) == null ? void 0 : _c.namedBindings, isNamedImports5) || every(d.importClause.namedBindings.elements, (e) => removeExisting.has(e))) + (!tryCast((_c = d.importClause) == null ? void 0 : _c.namedBindings, isNamedImports6) || every(d.importClause.namedBindings.elements, (e) => removeExisting.has(e))) ); } ); @@ -190334,7 +193609,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } for (const declaration of removeExisting) { - const importDeclaration = findAncestor(declaration, isImportDeclaration7); + const importDeclaration = findAncestor(declaration, isImportDeclaration8); if (importDeclaration && emptyImportDeclarations.indexOf(importDeclaration) === -1 && namedBindingsToDelete.indexOf(importDeclaration) === -1) { if (declaration.kind === 274) { changeTracker.delete(sourceFile, declaration.name); @@ -190397,7 +193672,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCombinedVerbatimImports() { if (!verbatimImports.size) return void 0; - const importDeclarations = new Set(mapDefined([...verbatimImports], (d) => findAncestor(d, isImportDeclaration7))); + const importDeclarations = new Set(mapDefined([...verbatimImports], (d) => findAncestor(d, isImportDeclaration8))); const requireStatements = new Set(mapDefined([...verbatimImports], (d) => findAncestor(d, isRequireVariableStatement))); return [ ...mapDefined([...verbatimImports], (d) => d.kind === 272 ? getSynthesizedDeepClone( @@ -190422,7 +193697,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} d.importClause, d.importClause.phaseModifier, verbatimImports.has(d.importClause) ? d.importClause.name : void 0, - verbatimImports.has(d.importClause.namedBindings) ? d.importClause.namedBindings : ((_a3 = tryCast(d.importClause.namedBindings, isNamedImports5)) == null ? void 0 : _a3.elements.some((e) => verbatimImports.has(e))) ? factory.updateNamedImports( + verbatimImports.has(d.importClause.namedBindings) ? d.importClause.namedBindings : ((_a3 = tryCast(d.importClause.namedBindings, isNamedImports6)) == null ? void 0 : _a3.elements.some((e) => verbatimImports.has(e))) ? factory.updateNamedImports( d.importClause.namedBindings, d.importClause.namedBindings.elements.filter((e) => verbatimImports.has(e)) ) : void 0 @@ -190632,7 +193907,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var _a3, _b, _c; switch (declaration.kind) { case 261: - return (_a3 = tryCast(declaration.name, isIdentifier26)) == null ? void 0 : _a3.text; + return (_a3 = tryCast(declaration.name, isIdentifier28)) == null ? void 0 : _a3.text; case 272: return declaration.name.text; case 352: @@ -190853,31 +194128,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { kind: 3, moduleSpecifierKind: void 0, moduleSpecifier, importKind, addAsTypeOnly, useRequire }; } } - function getFixInfos(context, errorCode, pos, useAutoImportProvider) { - const symbolToken = getTokenAtPosition(context.sourceFile, pos); + function getFixInfos(context2, errorCode, pos, useAutoImportProvider) { + const symbolToken = getTokenAtPosition(context2.sourceFile, pos); let info; if (errorCode === Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { - info = getFixesInfoForUMDImport(context, symbolToken); - } else if (!isIdentifier26(symbolToken)) { + info = getFixesInfoForUMDImport(context2, symbolToken); + } else if (!isIdentifier28(symbolToken)) { return void 0; } else if (errorCode === Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - const symbolName2 = single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); - const fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName2, context.program); + const symbolName2 = single(getSymbolNamesToImport(context2.sourceFile, context2.program.getTypeChecker(), symbolToken, context2.program.getCompilerOptions())); + const fix = getTypeOnlyPromotionFix(context2.sourceFile, symbolToken, symbolName2, context2.program); return fix && [{ fix, symbolName: symbolName2, errorIdentifierText: symbolToken.text }]; } else { - info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); + info = getFixesInfoForNonUMDImport(context2, symbolToken, useAutoImportProvider); } - const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences); + const packageJsonImportFilter = createPackageJsonImportFilter(context2.sourceFile, context2.preferences, context2.host); + return info && sortFixInfo(info, context2.sourceFile, context2.program, packageJsonImportFilter, context2.host, context2.preferences); } function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) { const _toPath = (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host)); return toSorted(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath)); } - function getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider) { - const info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); - const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences); + function getFixInfosWithoutDiagnostic(context2, symbolToken, useAutoImportProvider) { + const info = getFixesInfoForNonUMDImport(context2, symbolToken, useAutoImportProvider); + const packageJsonImportFilter = createPackageJsonImportFilter(context2.sourceFile, context2.preferences, context2.host); + return info && sortFixInfo(info, context2.sourceFile, context2.program, packageJsonImportFilter, context2.host, context2.preferences); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) { if (!some(fixes)) return; @@ -190960,11 +194235,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ).fixes; return fixes.map((fix) => { var _a3; - return { fix, symbolName: symbolName2, errorIdentifierText: (_a3 = tryCast(token, isIdentifier26)) == null ? void 0 : _a3.text }; + return { fix, symbolName: symbolName2, errorIdentifierText: (_a3 = tryCast(token, isIdentifier28)) == null ? void 0 : _a3.text }; }); } function getUmdSymbol(token, checker) { - const umdSymbol = isIdentifier26(token) ? checker.getSymbolAtLocation(token) : void 0; + const umdSymbol = isIdentifier28(token) ? checker.getSymbolAtLocation(token) : void 0; if (isUMDExportSymbol(umdSymbol)) return umdSymbol; const { parent: parent2 } = token; if (isJsxOpeningLikeElement(parent2) && parent2.tagName === token || isJsxOpeningFragment(parent2)) { @@ -191134,9 +194409,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return allowSyntheticDefaults ? 1 : 3; } - function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) { + function codeActionForFix(context2, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) { let diag2; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (tracker) => { diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences); }); return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports); @@ -191258,7 +194533,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (convertExistingToTypeOnly) { - const namedImports = tryCast(importClause.namedBindings, isNamedImports5); + const namedImports = tryCast(importClause.namedBindings, isNamedImports6); if (namedImports && namedImports.elements.length > 1) { const sortState = ts_OrganizeImports_exports.getNamedImportSpecifierComparerWithDetection(importClause.parent, preferences, sourceFile); if (sortState.isSorted !== false && aliasDeclaration.kind === 277 && namedImports.elements.indexOf(aliasDeclaration) !== 0) { @@ -191313,7 +194588,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */ ); - const existingSpecifiers = clause.namedBindings && ((_a3 = tryCast(clause.namedBindings, isNamedImports5)) == null ? void 0 : _a3.elements); + const existingSpecifiers = clause.namedBindings && ((_a3 = tryCast(clause.namedBindings, isNamedImports6)) == null ? void 0 : _a3.elements); if (defaultImport) { Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one"); changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " }); @@ -191533,19 +194808,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes20, - getCodeActions(context) { - const { sourceFile, span, program, preferences, host } = context; + getCodeActions(context2) { + const { sourceFile, span, program, preferences, host } = context2; const info = getInfo6(program, sourceFile, span); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info)); return [createCodeFixAction(fixId18, changes, Diagnostics.Add_extends_constraint, fixId18, Diagnostics.Add_extends_constraint_to_all_type_parameters)]; }, fixIds: [fixId18], - getAllCodeActions: (context) => { - const { program, preferences, host } = context; + getAllCodeActions: (context2) => { + const { program, preferences, host } = context2; const seen = /* @__PURE__ */ new Set(); - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes20, (diag2) => { + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { + eachDiagnostic(context2, errorCodes20, (diag2) => { const info = getInfo6(program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { if (addToSeen(seen, getNodeId(info.declaration))) { @@ -191564,7 +194839,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (related === void 0 || related.file === void 0 || related.start === void 0 || related.length === void 0) return; let declaration = findAncestorMatchingSpan(related.file, createTextSpan(related.start, related.length)); if (declaration === void 0) return; - if (isIdentifier26(declaration) && isTypeParameterDeclaration(declaration.parent)) { + if (isIdentifier28(declaration) && isTypeParameterDeclaration(declaration.parent)) { declaration = declaration.parent; } if (isTypeParameterDeclaration(declaration)) { @@ -191690,39 +194965,39 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; registerCodeFix({ errorCodes: errorCodes21, - getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) { - const { errorCode, span } = context; + getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context2) { + const { errorCode, span } = context2; const info = errorCodeFixIdMap[errorCode]; if (!info) return emptyArray; const { descriptions, fixId: fixId56, fixAllDescriptions } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changes2) => dispatchChanges(changes2, context2, errorCode, span.start)); return [ createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId56, fixAllDescriptions) ]; }, fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], - getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes21, (changes, diag2) => { const { code, start } = diag2; const info = errorCodeFixIdMap[code]; - if (!info || info.fixId !== context.fixId) { + if (!info || info.fixId !== context2.fixId) { return; } - dispatchChanges(changes, context, code, start); + dispatchChanges(changes, context2, code, start); }) }); - function dispatchChanges(changeTracker, context, errorCode, pos) { + function dispatchChanges(changeTracker, context2, errorCode, pos) { switch (errorCode) { case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code: case Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code: case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code: case Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code: case Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code: - return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); + return doAddOverrideModifierChange(changeTracker, context2.sourceFile, pos); case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: case Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code: - return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); + return doRemoveOverrideModifierChange(changeTracker, context2.sourceFile, pos); default: Debug.fail("Unexpected error code: " + errorCode); } @@ -191782,13 +195057,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes22, fixIds: [fixId19], - getCodeActions(context) { - const { sourceFile, span, preferences } = context; + getCodeActions(context2) { + const { sourceFile, span, preferences } = context2; const property = getPropertyAccessExpression(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property, preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange14(t, context2.sourceFile, property, preferences)); return [createCodeFixAction(fixId19, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId19, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => doChange14(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes22, (changes, diag2) => doChange14(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context2.preferences)) }); function doChange14(changes, sourceFile, node, preferences) { const quotePreference = getQuotePreference(sourceFile, preferences); @@ -191804,23 +195079,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } function getPropertyAccessExpression(sourceFile, pos) { - return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression16); + return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression17); } var fixId20 = "fixImplicitThis"; var errorCodes23 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; registerCodeFix({ errorCodes: errorCodes23, - getCodeActions: function getCodeActionsToFixImplicitThis(context) { - const { sourceFile, program, span } = context; + getCodeActions: function getCodeActionsToFixImplicitThis(context2) { + const { sourceFile, program, span } = context2; let diagnostic; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => { diagnostic = doChange15(t, sourceFile, span.start, program.getTypeChecker()); }); return diagnostic ? [createCodeFixAction(fixId20, changes, diagnostic, fixId20, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; }, fixIds: [fixId20], - getAllCodeActions: (context) => codeFixAll(context, errorCodes23, (changes, diag2) => { - doChange15(changes, diag2.file, diag2.start, context.program.getTypeChecker()); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes23, (changes, diag2) => { + doChange15(changes, diag2.file, diag2.start, context2.program.getTypeChecker()); }) }); function doChange15(changes, sourceFile, pos, checker) { @@ -191872,18 +195147,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes24, fixIds: [fixId21], - getCodeActions(context) { - const { sourceFile, span, program } = context; + getCodeActions(context2) { + const { sourceFile, span, program } = context2; const info = getInfo7(sourceFile, span.start, program); if (info === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, program, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange16(t, program, info)); return [createCodeFixAction(fixId21, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId21, Diagnostics.Export_all_referenced_locals)]; }, - getAllCodeActions(context) { - const { program } = context; - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { + getAllCodeActions(context2) { + const { program } = context2; + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { const exports2 = /* @__PURE__ */ new Map(); - eachDiagnostic(context, errorCodes24, (diag2) => { + eachDiagnostic(context2, errorCodes24, (diag2) => { const info = getInfo7(diag2.file, diag2.start, program); if (info === void 0) return void 0; const { exportName, node, moduleSourceFile } = info; @@ -191922,8 +195197,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getInfo7(sourceFile, pos, program) { var _a3, _b; const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier26(token)) { - const importDeclaration = findAncestor(token, isImportDeclaration7); + if (isIdentifier28(token)) { + const importDeclaration = findAncestor(token, isImportDeclaration8); if (importDeclaration === void 0) return void 0; const moduleSpecifier = isStringLiteral15(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : void 0; if (moduleSpecifier === void 0) return void 0; @@ -191963,7 +195238,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function tryGetExportDeclaration(sourceFile, isTypeOnly) { - const predicate = (node) => isExportDeclaration2(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + const predicate = (node) => isExportDeclaration3(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); return findLast(sourceFile.statements, predicate); } function updateExport(changes, program, sourceFile, node, names) { @@ -192018,7 +195293,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return firstOrUndefined(symbol2.declarations); } const declaration = symbol2.valueDeclaration; - const variableStatement = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement11) : void 0; + const variableStatement = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement12) : void 0; return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; } var fixId22 = "fixIncorrectNamedTupleSyntax"; @@ -192028,10 +195303,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes25, - getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context2) { + const { sourceFile, span } = context2; const namedTupleMember = getNamedTupleMember(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, namedTupleMember)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange17(t, sourceFile, namedTupleMember)); return [createCodeFixAction(fixId22, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId22, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, fixIds: [fixId22] @@ -192096,29 +195371,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes26, - getCodeActions(context) { - const { sourceFile, errorCode } = context; - const info = getInfo8(sourceFile, context.span.start, context, errorCode); + getCodeActions(context2) { + const { sourceFile, errorCode } = context2; + const info = getInfo8(sourceFile, context2.span.start, context2, errorCode); if (!info) return void 0; const { node, suggestedSymbol } = info; - const target = getEmitScriptTarget(context.host.getCompilationSettings()); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, sourceFile, node, suggestedSymbol, target)); + const target = getEmitScriptTarget(context2.host.getCompilationSettings()); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange18(t, sourceFile, node, suggestedSymbol, target)); return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId23, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId23], - getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => { - const info = getInfo8(diag2.file, diag2.start, context, diag2.code); - const target = getEmitScriptTarget(context.host.getCompilationSettings()); - if (info) doChange18(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes26, (changes, diag2) => { + const info = getInfo8(diag2.file, diag2.start, context2, diag2.code); + const target = getEmitScriptTarget(context2.host.getCompilationSettings()); + if (info) doChange18(changes, context2.sourceFile, info.node, info.suggestedSymbol, target); }) }); - function getInfo8(sourceFile, pos, context, errorCode) { + function getInfo8(sourceFile, pos, context2, errorCode) { const node = getTokenAtPosition(sourceFile, pos); const parent2 = node.parent; if ((errorCode === Diagnostics.No_overload_matches_this_call.code || errorCode === Diagnostics.Type_0_is_not_assignable_to_type_1.code) && !isJsxAttribute(parent2)) return void 0; - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); let suggestedSymbol; - if (isPropertyAccessExpression16(parent2) && parent2.name === node) { + if (isPropertyAccessExpression17(parent2) && parent2.name === node) { Debug.assert(isMemberName(node), "Expected an identifier for spelling (property access)"); let containingType = checker.getTypeAtLocation(parent2.expression); if (parent2.flags & 64) { @@ -192134,14 +195409,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(parent2.right, symbol2); } } else if (isImportSpecifier(parent2) && parent2.name === node) { - Debug.assertNode(node, isIdentifier26, "Expected an identifier for spelling (import)"); - const importDeclaration = findAncestor(node, isImportDeclaration7); - const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration, sourceFile); + Debug.assertNode(node, isIdentifier28, "Expected an identifier for spelling (import)"); + const importDeclaration = findAncestor(node, isImportDeclaration8); + const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context2, importDeclaration, sourceFile); if (resolvedSourceFile && resolvedSourceFile.symbol) { suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol); } } else if (isJsxAttribute(parent2) && parent2.name === node) { - Debug.assertNode(node, isIdentifier26, "Expected an identifier for JSX attribute"); + Debug.assertNode(node, isIdentifier28, "Expected an identifier for JSX attribute"); const tag = findAncestor(node, isJsxOpeningLikeElement); const props = checker.getContextualTypeForArgumentAtIndex(tag, 0); suggestedSymbol = checker.getSuggestedSymbolForNonexistentJSXAttribute(node, props); @@ -192162,7 +195437,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function doChange18(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); - if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression16(node.parent)) { + if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression17(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; if (valDecl && isNamedDeclaration(valDecl) && isPrivateIdentifier(valDecl.name)) { changes.replaceNode(sourceFile, node, factory.createIdentifier(suggestion)); @@ -192186,12 +195461,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return flags; } - function getResolvedSourceFileFromImportDeclaration(context, importDeclaration, importingFile) { + function getResolvedSourceFileFromImportDeclaration(context2, importDeclaration, importingFile) { var _a3; if (!importDeclaration || !isStringLiteralLike4(importDeclaration.moduleSpecifier)) return void 0; - const resolvedModule = (_a3 = context.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier, importingFile)) == null ? void 0 : _a3.resolvedModule; + const resolvedModule = (_a3 = context2.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier, importingFile)) == null ? void 0 : _a3.resolvedModule; if (!resolvedModule) return void 0; - return context.program.getSourceFile(resolvedModule.resolvedFileName); + return context2.program.getSourceFile(resolvedModule.resolvedFileName); } var fixId24 = "returnValueCorrect"; var fixIdAddReturnStatement = "fixAddReturnStatement"; @@ -192205,23 +195480,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes27, fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen], - getCodeActions: function getCodeActionsToCorrectReturnValue(context) { - const { program, sourceFile, span: { start }, errorCode } = context; + getCodeActions: function getCodeActionsToCorrectReturnValue(context2) { + const { program, sourceFile, span: { start }, errorCode } = context2; const info = getInfo9(program.getTypeChecker(), sourceFile, start, errorCode); if (!info) return void 0; if (info.kind === 0) { return append( - [getActionForfixAddReturnStatement(context, info.expression, info.statement)], - isArrowFunction8(info.declaration) ? getActionForFixRemoveBracesFromArrowFunctionBody(context, info.declaration, info.expression, info.commentSource) : void 0 + [getActionForfixAddReturnStatement(context2, info.expression, info.statement)], + isArrowFunction8(info.declaration) ? getActionForFixRemoveBracesFromArrowFunctionBody(context2, info.declaration, info.expression, info.commentSource) : void 0 ); } else { - return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; + return [getActionForfixWrapTheBlockWithParen(context2, info.declaration, info.expression)]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes27, (changes, diag2) => { - const info = getInfo9(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes27, (changes, diag2) => { + const info = getInfo9(context2.program.getTypeChecker(), diag2.file, diag2.start, diag2.code); if (!info) return void 0; - switch (context.fixId) { + switch (context2.fixId) { case fixIdAddReturnStatement: addReturnStatement(changes, diag2.file, info.expression, info.statement); break; @@ -192242,7 +195517,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} wrapBlockWithParen(changes, diag2.file, info.declaration, info.expression); break; default: - Debug.fail(JSON.stringify(context.fixId)); + Debug.fail(JSON.stringify(context2.fixId)); } }) }); @@ -192419,14 +195694,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function wrapBlockWithParen(changes, sourceFile, declaration, expression) { changes.replaceNode(sourceFile, declaration.body, factory.createParenthesizedExpression(expression)); } - function getActionForfixAddReturnStatement(context, expression, statement) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement)); + function getActionForfixAddReturnStatement(context2, expression, statement) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addReturnStatement(t, context2.sourceFile, expression, statement)); return createCodeFixAction(fixId24, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement); } - function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace( + function getActionForFixRemoveBracesFromArrowFunctionBody(context2, declaration, expression, commentSource) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => removeBlockBodyBrace( t, - context.sourceFile, + context2.sourceFile, declaration, expression, commentSource, @@ -192435,8 +195710,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )); return createCodeFixAction(fixId24, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues); } - function getActionForfixWrapTheBlockWithParen(context, declaration, expression) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression)); + function getActionForfixWrapTheBlockWithParen(context2, declaration, expression) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => wrapBlockWithParen(t, context2.sourceFile, declaration, expression)); return createCodeFixAction(fixId24, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses); } var fixMissingMember = "fixMissingMember"; @@ -192455,48 +195730,48 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes28, - getCodeActions(context) { - const typeChecker = context.program.getTypeChecker(); - const info = getInfo10(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program); + getCodeActions(context2) { + const typeChecker = context2.program.getTypeChecker(); + const info = getInfo10(context2.sourceFile, context2.span.start, context2.errorCode, typeChecker, context2.program); if (!info) { return void 0; } if (info.kind === 3) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addObjectLiteralProperties(t, context, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addObjectLiteralProperties(t, context2, info)); return [createCodeFixAction(fixMissingProperties, changes, Diagnostics.Add_missing_properties, fixMissingProperties, Diagnostics.Add_all_missing_properties)]; } if (info.kind === 4) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addJsxAttributes(t, context, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addJsxAttributes(t, context2, info)); return [createCodeFixAction(fixMissingAttributes, changes, Diagnostics.Add_missing_attributes, fixMissingAttributes, Diagnostics.Add_all_missing_attributes)]; } if (info.kind === 2 || info.kind === 5) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addFunctionDeclaration(t, context, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addFunctionDeclaration(t, context2, info)); return [createCodeFixAction(fixMissingFunctionDeclaration, changes, [Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, Diagnostics.Add_all_missing_function_declarations)]; } if (info.kind === 1) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addEnumMemberDeclaration(t, context.program.getTypeChecker(), info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addEnumMemberDeclaration(t, context2.program.getTypeChecker(), info)); return [createCodeFixAction(fixMissingMember, changes, [Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, Diagnostics.Add_all_missing_members)]; } - return concatenate(getActionsForMissingMethodDeclaration(context, info), getActionsForMissingMemberDeclaration(context, info)); + return concatenate(getActionsForMissingMethodDeclaration(context2, info), getActionsForMissingMemberDeclaration(context2, info)); }, fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes], - getAllCodeActions: (context) => { - const { program, fixId: fixId56 } = context; + getAllCodeActions: (context2) => { + const { program, fixId: fixId56 } = context2; const checker = program.getTypeChecker(); const seen = /* @__PURE__ */ new Set(); const typeDeclToMembers = /* @__PURE__ */ new Map(); - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes28, (diag2) => { - const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context.program); + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { + eachDiagnostic(context2, errorCodes28, (diag2) => { + const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context2.program); if (info === void 0) return; const nodeId = getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 ? info.identifier || getNodeId(info.token) : info.token.text); if (!addToSeen(seen, nodeId)) return; if (fixId56 === fixMissingFunctionDeclaration && (info.kind === 2 || info.kind === 5)) { - addFunctionDeclaration(changes, context, info); + addFunctionDeclaration(changes, context2, info); } else if (fixId56 === fixMissingProperties && info.kind === 3) { - addObjectLiteralProperties(changes, context, info); + addObjectLiteralProperties(changes, context2, info); } else if (fixId56 === fixMissingAttributes && info.kind === 4) { - addJsxAttributes(changes, context, info); + addJsxAttributes(changes, context2, info); } else { if (info.kind === 1) { addEnumMemberDeclaration(changes, checker, info); @@ -192519,7 +195794,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} })) continue; const { parentDeclaration, declSourceFile, modifierFlags, token, call, isJSFile } = info; if (call && !isPrivateIdentifier(token)) { - addMethodDeclaration(context, changes, call, token, modifierFlags & 256, parentDeclaration, declSourceFile); + addMethodDeclaration(context2, changes, call, token, modifierFlags & 256, parentDeclaration, declSourceFile); } else { if (isJSFile && !isInterfaceDeclaration2(parentDeclaration) && !isTypeLiteralNode2(parentDeclaration)) { addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags & 256)); @@ -192546,13 +195821,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const token = getTokenAtPosition(sourceFile, tokenPos); const parent2 = token.parent; if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) { - if (!(token.kind === 19 && isObjectLiteralExpression12(parent2) && isCallExpression16(parent2.parent))) return void 0; + if (!(token.kind === 19 && isObjectLiteralExpression13(parent2) && isCallExpression16(parent2.parent))) return void 0; const argIndex = findIndex(parent2.parent.arguments, (arg) => arg === parent2); if (argIndex < 0) return void 0; const signature = checker.getResolvedSignature(parent2.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return void 0; const param = signature.parameters[argIndex].valueDeclaration; - if (!(param && isParameter(param) && isIdentifier26(param.name))) return void 0; + if (!(param && isParameter(param) && isIdentifier28(param.name))) return void 0; const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2), checker.getParameterType(signature, argIndex).getNonNullableType(), @@ -192564,10 +195839,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!length(properties)) return void 0; return { kind: 3, token: param.name, identifier: param.name.text, properties, parentDeclaration: parent2 }; } - if (token.kind === 19 || isSatisfiesExpression5(parent2) || isReturnStatement4(parent2)) { - const expression = (isSatisfiesExpression5(parent2) || isReturnStatement4(parent2)) && parent2.expression ? parent2.expression : parent2; - if (isObjectLiteralExpression12(expression)) { - const targetType = isSatisfiesExpression5(parent2) ? checker.getTypeFromTypeNode(parent2.type) : checker.getContextualType(expression) || checker.getTypeAtLocation(expression); + if (token.kind === 19 || isSatisfiesExpression6(parent2) || isReturnStatement4(parent2)) { + const expression = (isSatisfiesExpression6(parent2) || isReturnStatement4(parent2)) && parent2.expression ? parent2.expression : parent2; + if (isObjectLiteralExpression13(expression)) { + const targetType = isSatisfiesExpression6(parent2) ? checker.getTypeFromTypeNode(parent2.type) : checker.getContextualType(expression) || checker.getTypeAtLocation(expression); const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2), targetType.getNonNullableType(), @@ -192581,7 +195856,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (!isMemberName(token)) return void 0; - if (isIdentifier26(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression12(parent2.initializer)) { + if (isIdentifier28(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression13(parent2.initializer)) { const targetType = (_a3 = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _a3.getNonNullableType(); const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2.initializer), @@ -192594,13 +195869,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!length(properties)) return void 0; return { kind: 3, token, identifier: token.text, properties, parentDeclaration: parent2.initializer }; } - if (isIdentifier26(token) && isJsxOpeningLikeElement(token.parent)) { + if (isIdentifier28(token) && isJsxOpeningLikeElement(token.parent)) { const target = getEmitScriptTarget(program.getCompilerOptions()); const attributes = getUnmatchedAttributes(checker, target, token.parent); if (!length(attributes)) return void 0; return { kind: 4, token, attributes, parentDeclaration: token.parent }; } - if (isIdentifier26(token)) { + if (isIdentifier28(token)) { const type = (_b = checker.getContextualType(token)) == null ? void 0 : _b.getNonNullableType(); if (type && getObjectFlags(type) & 16) { const signature = firstOrUndefined(checker.getSignaturesOfType( @@ -192615,11 +195890,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { kind: 2, token, call: parent2, sourceFile, modifierFlags: 0, parentDeclaration: findScope(token) }; } } - if (!isPropertyAccessExpression16(parent2)) return void 0; + if (!isPropertyAccessExpression17(parent2)) return void 0; const leftExpressionType = skipConstraint(checker.getTypeAtLocation(parent2.expression)); const symbol2 = leftExpressionType.symbol; if (!symbol2 || !symbol2.declarations) return void 0; - if (isIdentifier26(token) && isCallExpression16(parent2.parent)) { + if (isIdentifier28(token) && isCallExpression16(parent2.parent)) { const moduleDeclaration = find(symbol2.declarations, isModuleDeclaration); const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { @@ -192649,14 +195924,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } - function getActionsForMissingMemberDeclaration(context, info) { - return info.isJSFile ? singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); + function getActionsForMissingMemberDeclaration(context2, info) { + return info.isJSFile ? singleElementArray(createActionForAddMissingMemberInJavascriptFile(context2, info)) : createActionsForAddMissingMemberInTypeScriptFile(context2, info); } - function createActionForAddMissingMemberInJavascriptFile(context, { parentDeclaration, declSourceFile, modifierFlags, token }) { + function createActionForAddMissingMemberInJavascriptFile(context2, { parentDeclaration, declSourceFile, modifierFlags, token }) { if (isInterfaceDeclaration2(parentDeclaration) || isTypeLiteralNode2(parentDeclaration)) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 256))); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 256))); if (changes.length === 0) { return void 0; } @@ -192702,11 +195977,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function initializePropertyToUndefined(obj, propertyName) { return factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(obj, propertyName), createUndefined())); } - function createActionsForAddMissingMemberInTypeScriptFile(context, { parentDeclaration, declSourceFile, modifierFlags, token }) { + function createActionsForAddMissingMemberInTypeScriptFile(context2, { parentDeclaration, declSourceFile, modifierFlags, token }) { const memberName = token.text; const isStatic2 = modifierFlags & 256; - const typeNode = getTypeNode2(context.program.getTypeChecker(), parentDeclaration, token); - const addPropertyDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addPropertyDeclaration(t, declSourceFile, parentDeclaration, memberName, typeNode, modifierFlags2)); + const typeNode = getTypeNode2(context2.program.getTypeChecker(), parentDeclaration, token); + const addPropertyDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context2, (t) => addPropertyDeclaration(t, declSourceFile, parentDeclaration, memberName, typeNode, modifierFlags2)); const actions2 = [createCodeFixAction(fixMissingMember, addPropertyDeclarationChanges( modifierFlags & 256 /* Static */ @@ -192720,7 +195995,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /* Private */ ), [Diagnostics.Declare_private_property_0, memberName])); } - actions2.push(createAddIndexSignatureAction(context, declSourceFile, parentDeclaration, token.text, typeNode)); + actions2.push(createAddIndexSignatureAction(context2, declSourceFile, parentDeclaration, token.text, typeNode)); return actions2; } function getTypeNode2(checker, node, token) { @@ -192785,7 +196060,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return res; } - function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { + function createAddIndexSignatureAction(context2, sourceFile, node, tokenName, typeNode) { const stringTypeNode = factory.createKeywordTypeNode( 154 /* StringKeyword */ @@ -192808,16 +196083,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} [indexingParameter], typeNode ); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => t.insertMemberAtStart(sourceFile, node, indexSignature)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.insertMemberAtStart(sourceFile, node, indexSignature)); return createCodeFixActionWithoutFixAll(fixMissingMember, changes, [Diagnostics.Add_index_signature_for_property_0, tokenName]); } - function getActionsForMissingMethodDeclaration(context, info) { + function getActionsForMissingMethodDeclaration(context2, info) { const { parentDeclaration, declSourceFile, modifierFlags, token, call } = info; if (call === void 0) { return void 0; } const methodName = token.text; - const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile)); + const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMethodDeclaration(context2, t, call, token, modifierFlags2, parentDeclaration, declSourceFile)); const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges( modifierFlags & 256 /* Static */ @@ -192830,10 +196105,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return actions2; } - function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { - const importAdder = createImportAdder(sourceFile, context.program, context.preferences, context.host); + function addMethodDeclaration(context2, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { + const importAdder = createImportAdder(sourceFile, context2.program, context2.preferences, context2.host); const kind = isClassLike(parentDeclaration) ? 175 : 174; - const signatureDeclaration = createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); + const signatureDeclaration = createSignatureDeclarationFromCallExpression(kind, context2, importAdder, callExpression, name, modifierFlags, parentDeclaration); const containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { changes.insertNodeAfter(sourceFile, containingMethodDeclaration, signatureDeclaration); @@ -192856,12 +196131,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changes.insertMemberAtStart(sourceFile, parentDeclaration, enumMember); } } - function addFunctionDeclaration(changes, context, info) { - const quotePreference = getQuotePreference(context.sourceFile, context.preferences); - const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - const functionDeclaration = info.kind === 2 ? createSignatureDeclarationFromCallExpression(263, context, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( + function addFunctionDeclaration(changes, context2, info) { + const quotePreference = getQuotePreference(context2.sourceFile, context2.preferences); + const importAdder = createImportAdder(context2.sourceFile, context2.program, context2.preferences, context2.host); + const functionDeclaration = info.kind === 2 ? createSignatureDeclarationFromCallExpression(263, context2, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( 263, - context, + context2, quotePreference, info.signature, createStubbedBody(Diagnostics.Function_not_implemented.message, quotePreference), @@ -192886,14 +196161,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } - function addJsxAttributes(changes, context, info) { - const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - const quotePreference = getQuotePreference(context.sourceFile, context.preferences); - const checker = context.program.getTypeChecker(); + function addJsxAttributes(changes, context2, info) { + const importAdder = createImportAdder(context2.sourceFile, context2.program, context2.preferences, context2.host); + const quotePreference = getQuotePreference(context2.sourceFile, context2.preferences); + const checker = context2.program.getTypeChecker(); const jsxAttributesNode = info.parentDeclaration.attributes; const hasSpreadAttribute = some(jsxAttributesNode.properties, isJsxSpreadAttribute); const attrs = map2(info.attributes, (attr) => { - const value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration); + const value = tryGetValueFromType(context2, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration); const name = factory.createIdentifier(attr.name); const jsxAttribute = factory.createJsxAttribute(name, factory.createJsxExpression( /*dotDotDotToken*/ @@ -192905,16 +196180,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); const jsxAttributes = factory.createJsxAttributes(hasSpreadAttribute ? [...attrs, ...jsxAttributesNode.properties] : [...jsxAttributesNode.properties, ...attrs]); const options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : void 0 }; - changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options); + changes.replaceNode(context2.sourceFile, jsxAttributesNode, jsxAttributes, options); importAdder.writeFixes(changes); } - function addObjectLiteralProperties(changes, context, info) { - const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - const quotePreference = getQuotePreference(context.sourceFile, context.preferences); - const target = getEmitScriptTarget(context.program.getCompilerOptions()); - const checker = context.program.getTypeChecker(); + function addObjectLiteralProperties(changes, context2, info) { + const importAdder = createImportAdder(context2.sourceFile, context2.program, context2.preferences, context2.host); + const quotePreference = getQuotePreference(context2.sourceFile, context2.preferences); + const target = getEmitScriptTarget(context2.program.getCompilerOptions()); + const checker = context2.program.getTypeChecker(); const props = map2(info.properties, (prop) => { - const initializer3 = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration); + const initializer3 = tryGetValueFromType(context2, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration); return factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer3); }); const options = { @@ -192922,14 +196197,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Exclude, indentation: info.indentation }; - changes.replaceNode(context.sourceFile, info.parentDeclaration, factory.createObjectLiteralExpression( + changes.replaceNode(context2.sourceFile, info.parentDeclaration, factory.createObjectLiteralExpression( [...info.parentDeclaration.properties, ...props], /*multiLine*/ true ), options); importAdder.writeFixes(changes); } - function tryGetValueFromType(context, checker, importAdder, quotePreference, type, enclosingDeclaration) { + function tryGetValueFromType(context2, checker, importAdder, quotePreference, type, enclosingDeclaration) { if (type.flags & 3) { return createUndefined(); } @@ -192988,7 +196263,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.createNull(); } if (type.flags & 1048576) { - const expression = firstDefined(type.types, (t) => tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration)); + const expression = firstDefined(type.types, (t) => tryGetValueFromType(context2, checker, importAdder, quotePreference, t, enclosingDeclaration)); return expression ?? createUndefined(); } if (checker.isArrayLikeType(type)) { @@ -192996,7 +196271,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isObjectLiteralType(type)) { const props = map2(checker.getPropertiesOfType(type), (prop) => { - const initializer3 = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), enclosingDeclaration); + const initializer3 = tryGetValueFromType(context2, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), enclosingDeclaration); return factory.createPropertyAssignment(prop.name, initializer3); }); return factory.createObjectLiteralExpression( @@ -193016,7 +196291,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (signature === void 0) return createUndefined(); const func = createSignatureDeclarationFromSignature( 219, - context, + context2, quotePreference, signature[0], createStubbedBody(Diagnostics.Function_not_implemented.message, quotePreference), @@ -193133,13 +196408,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes29 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; registerCodeFix({ errorCodes: errorCodes29, - getCodeActions(context) { - const { sourceFile, span } = context; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span)); + getCodeActions(context2) { + const { sourceFile, span } = context2; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMissingNewOperator(t, sourceFile, span)); return [createCodeFixAction(fixId25, changes, Diagnostics.Add_missing_new_operator_to_call, fixId25, Diagnostics.Add_missing_new_operator_to_all_calls)]; }, fixIds: [fixId25], - getAllCodeActions: (context) => codeFixAll(context, errorCodes29, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes29, (changes, diag2) => addMissingNewOperator(changes, context2.sourceFile, diag2)) }); function addMissingNewOperator(changes, sourceFile, span) { const call = cast(findAncestorMatchingSpan2(sourceFile, span), isCallExpression16); @@ -193160,8 +196435,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes30, fixIds: [addMissingParamFixId, addOptionalParamFixId], - getCodeActions(context) { - const info = getInfo11(context.sourceFile, context.program, context.span.start); + getCodeActions(context2) { + const info = getInfo11(context2.sourceFile, context2.program, context2.span.start); if (info === void 0) return void 0; const { name, declarations, newParameters, newOptionalParameters } = info; const actions2 = []; @@ -193170,7 +196445,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions2, createCodeFixAction( addMissingParamFixId, - ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newParameters)), + ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange19(t, context2.program, context2.preferences, context2.host, declarations, newParameters)), [length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name], addMissingParamFixId, Diagnostics.Add_all_missing_parameters @@ -193182,7 +196457,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} actions2, createCodeFixAction( addOptionalParamFixId, - ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.program, context.preferences, context.host, declarations, newOptionalParameters)), + ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange19(t, context2.program, context2.preferences, context2.host, declarations, newOptionalParameters)), [length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name], addOptionalParamFixId, Diagnostics.Add_all_optional_parameters @@ -193191,15 +196466,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return actions2; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes30, (changes, diag2) => { - const info = getInfo11(context.sourceFile, context.program, diag2.start); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes30, (changes, diag2) => { + const info = getInfo11(context2.sourceFile, context2.program, diag2.start); if (info) { const { declarations, newParameters, newOptionalParameters } = info; - if (context.fixId === addMissingParamFixId) { - doChange19(changes, context.program, context.preferences, context.host, declarations, newParameters); + if (context2.fixId === addMissingParamFixId) { + doChange19(changes, context2.program, context2.preferences, context2.host, declarations, newParameters); } - if (context.fixId === addOptionalParamFixId) { - doChange19(changes, context.program, context.preferences, context.host, declarations, newOptionalParameters); + if (context2.fixId === addOptionalParamFixId) { + doChange19(changes, context2.program, context2.preferences, context2.host, declarations, newOptionalParameters); } } }) @@ -193241,7 +196516,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} pos2++; continue; } - const name2 = expr && isIdentifier26(expr) ? expr.text : `p${paramIndex++}`; + const name2 = expr && isIdentifier28(expr) ? expr.text : `p${paramIndex++}`; const typeNode = typeToTypeNode(checker, type2, nonOverloadDeclaration); append(newParameters, { pos: i, @@ -193275,7 +196550,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (name) { return name; } - if (isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) { + if (isVariableDeclaration7(node.parent) && isIdentifier28(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) { return node.parent.name; } } @@ -193415,9 +196690,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes31, - getCodeActions: function getCodeActionsToFixNotFoundModule(context) { - const { host, sourceFile, span: { start }, errorCode } = context; - const packageName = errorCode === errorCannotFindImplicitJsxImport ? getJSXImplicitImportBase(context.program.getCompilerOptions(), sourceFile) : tryGetImportedPackageName(sourceFile, start); + getCodeActions: function getCodeActionsToFixNotFoundModule(context2) { + const { host, sourceFile, span: { start }, errorCode } = context2; + const packageName = errorCode === errorCannotFindImplicitJsxImport ? getJSXImplicitImportBase(context2.program.getCompilerOptions(), sourceFile) : tryGetImportedPackageName(sourceFile, start); if (packageName === void 0) return void 0; const typesPackageName = getTypesPackageNameToInstall(packageName, host, errorCode); return typesPackageName === void 0 ? [] : [createCodeFixAction( @@ -193431,20 +196706,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )]; }, fixIds: [fixIdInstallTypesPackage], - getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes31, (_changes, diag2, commands) => { + getAllCodeActions: (context2) => { + return codeFixAll(context2, errorCodes31, (_changes, diag2, commands) => { const packageName = tryGetImportedPackageName(diag2.file, diag2.start); if (packageName === void 0) return void 0; - switch (context.fixId) { + switch (context2.fixId) { case fixIdInstallTypesPackage: { - const pkg = getTypesPackageNameToInstall(packageName, context.host, diag2.code); + const pkg = getTypesPackageNameToInstall(packageName, context2.host, diag2.code); if (pkg) { commands.push(getInstallCommand(diag2.file.fileName, pkg)); } break; } default: - Debug.fail(`Bad fixId: ${context.fixId}`); + Debug.fail(`Bad fixId: ${context2.fixId}`); } }); } @@ -193474,18 +196749,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var fixId26 = "fixClassDoesntImplementInheritedAbstractMember"; registerCodeFix({ errorCodes: errorCodes32, - getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) { - const { sourceFile, span } = context; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences)); + getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context2) { + const { sourceFile, span } = context2; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context2, t, context2.preferences)); return changes.length === 0 ? void 0 : [createCodeFixAction(fixId26, changes, Diagnostics.Implement_inherited_abstract_class, fixId26, Diagnostics.Implement_all_inherited_abstract_classes)]; }, fixIds: [fixId26], - getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) { + getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context2) { const seenClassDeclarations = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes32, (changes, diag2) => { + return codeFixAll(context2, errorCodes32, (changes, diag2) => { const classDeclaration = getClass2(diag2.file, diag2.start); if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) { - addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences); + addMissingMembers(classDeclaration, context2.sourceFile, context2, changes, context2.preferences); } }); } @@ -193494,13 +196769,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const token = getTokenAtPosition(sourceFile, pos); return cast(token.parent, isClassLike); } - function addMissingMembers(classDeclaration, sourceFile, context, changeTracker, preferences) { + function addMissingMembers(classDeclaration, sourceFile, context2, changeTracker, preferences) { const extendsNode = getEffectiveBaseTypeNode(classDeclaration); - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); const instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); const abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember); - const importAdder = createImportAdder(sourceFile, context.program, preferences, context.host); - createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, (member) => changeTracker.insertMemberAtStart(sourceFile, classDeclaration, member)); + const importAdder = createImportAdder(sourceFile, context2.program, preferences, context2.host); + createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context2, preferences, importAdder, (member) => changeTracker.insertMemberAtStart(sourceFile, classDeclaration, member)); importAdder.writeFixes(changeTracker); } function symbolPointsToNonPrivateAndAbstractMember(symbol2) { @@ -193511,19 +196786,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes33 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; registerCodeFix({ errorCodes: errorCodes33, - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const nodes = getNodes(sourceFile, span.start); if (!nodes) return void 0; const { constructor, superCall } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, constructor, superCall)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange20(t, sourceFile, constructor, superCall)); return [createCodeFixAction(fixId27, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId27, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, fixIds: [fixId27], - getAllCodeActions(context) { - const { sourceFile } = context; + getAllCodeActions(context2) { + const { sourceFile } = context2; const seenClasses = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes33, (changes, diag2) => { + return codeFixAll(context2, errorCodes33, (changes, diag2) => { const nodes = getNodes(diag2.file, diag2.start); if (!nodes) return; const { constructor, superCall } = nodes; @@ -193542,7 +196817,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (token.kind !== 110) return void 0; const constructor = getContainingFunction(token); const superCall = findSuperCall(constructor.body); - return superCall && !superCall.expression.arguments.some((arg) => isPropertyAccessExpression16(arg) && arg.expression === token) ? { constructor, superCall } : void 0; + return superCall && !superCall.expression.arguments.some((arg) => isPropertyAccessExpression17(arg) && arg.expression === token) ? { constructor, superCall } : void 0; } function findSuperCall(n) { return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild27(n, findSuperCall); @@ -193551,14 +196826,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes34 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; registerCodeFix({ errorCodes: errorCodes34, - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const ctr = getNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, ctr)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange21(t, sourceFile, ctr)); return [createCodeFixAction(fixId28, changes, Diagnostics.Add_missing_super_call, fixId28, Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId28], - getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange21(changes, context.sourceFile, getNode(diag2.file, diag2.start))) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes34, (changes, diag2) => doChange21(changes, context2.sourceFile, getNode(diag2.file, diag2.start))) }); function getNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); @@ -193579,19 +196854,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes35 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code]; registerCodeFix({ errorCodes: errorCodes35, - getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) { - const { configFile } = context.program.getCompilerOptions(); + getCodeActions: function getCodeActionsToFixEnableJsxFlag(context2) { + const { configFile } = context2.program.getCompilerOptions(); if (configFile === void 0) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => doChange22(changeTracker, configFile)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changeTracker) => doChange22(changeTracker, configFile)); return [ createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) ]; }, fixIds: [fixID], - getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes) => { - const { configFile } = context.program.getCompilerOptions(); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes35, (changes) => { + const { configFile } = context2.program.getCompilerOptions(); if (configFile === void 0) { return void 0; } @@ -193607,18 +196882,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes36, - getCodeActions(context) { - const { sourceFile, span, program } = context; + getCodeActions(context2) { + const { sourceFile, span, program } = context2; const info = getInfo12(program, sourceFile, span); if (info === void 0) return; const { suggestion, expression, arg } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, arg, expression)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange23(t, sourceFile, arg, expression)); return [createCodeFixAction(fixId29, changes, [Diagnostics.Use_0, suggestion], fixId29, Diagnostics.Use_Number_isNaN_in_all_conditions)]; }, fixIds: [fixId29], - getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes36, (changes, diag2) => { - const info = getInfo12(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); + getAllCodeActions: (context2) => { + return codeFixAll(context2, errorCodes36, (changes, diag2) => { + const info = getInfo12(context2.program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { doChange23(changes, diag2.file, info.arg, info.expression); } @@ -193661,8 +196936,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code ], - getCodeActions: function getCodeActionsToFixModuleAndTarget(context) { - const compilerOptions = context.program.getCompilerOptions(); + getCodeActions: function getCodeActionsToFixModuleAndTarget(context2) { + const compilerOptions = context2.program.getCompilerOptions(); const { configFile } = compilerOptions; if (configFile === void 0) { return void 0; @@ -193671,7 +196946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const moduleKind = getEmitModuleKind(compilerOptions); const moduleOutOfRange = moduleKind >= 5 && moduleKind < 99; if (moduleOutOfRange) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changes2) => { setJsonCompilerOptionValue(changes2, configFile, "module", factory.createStringLiteral("esnext")); }); codeFixes.push(createCodeFixActionWithoutFixAll("fixModuleOption", changes, [Diagnostics.Set_the_module_option_in_your_configuration_file_to_0, "esnext"])); @@ -193679,9 +196954,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const target = getEmitScriptTarget(compilerOptions); const targetOutOfRange = target < 4 || target > 99; if (targetOutOfRange) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => { - const configObject = getTsConfigObjectLiteralExpression(configFile); - if (!configObject) return; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (tracker) => { + const configObject2 = getTsConfigObjectLiteralExpression(configFile); + if (!configObject2) return; const options = [["target", factory.createStringLiteral("es2017")]]; if (moduleKind === 1) { options.push(["module", factory.createStringLiteral("commonjs")]); @@ -193700,34 +196975,34 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes37, fixIds: [fixId30], - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const property = getProperty2(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, context.sourceFile, property)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange24(t, context2.sourceFile, property)); return [createCodeFixAction(fixId30, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId30, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start))) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes37, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start))) }); function doChange24(changes, sourceFile, node) { changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); } function getProperty2(sourceFile, pos) { - return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment6); + return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment7); } var fixId31 = "extendsInterfaceBecomesImplements"; var errorCodes38 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; registerCodeFix({ errorCodes: errorCodes38, - getCodeActions(context) { - const { sourceFile } = context; - const nodes = getNodes2(sourceFile, context.span.start); + getCodeActions(context2) { + const { sourceFile } = context2; + const nodes = getNodes2(sourceFile, context2.span.start); if (!nodes) return void 0; const { extendsToken, heritageClauses } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses)); return [createCodeFixAction(fixId31, changes, Diagnostics.Change_extends_to_implements, fixId31, Diagnostics.Change_all_extended_interfaces_to_implements)]; }, fixIds: [fixId31], - getAllCodeActions: (context) => codeFixAll(context, errorCodes38, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes38, (changes, diag2) => { const nodes = getNodes2(diag2.file, diag2.start); if (nodes) doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses); }) @@ -193767,24 +197042,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes39, - getCodeActions(context) { - const { sourceFile } = context; - const info = getInfo13(sourceFile, context.span.start, context.errorCode); + getCodeActions(context2) { + const { sourceFile } = context2; + const info = getInfo13(sourceFile, context2.span.start, context2.errorCode); if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange25(t, sourceFile, info)); return [createCodeFixAction(fixId32, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId32, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId32], - getAllCodeActions: (context) => codeFixAll(context, errorCodes39, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes39, (changes, diag2) => { const info = getInfo13(diag2.file, diag2.start, diag2.code); - if (info) doChange25(changes, context.sourceFile, info); + if (info) doChange25(changes, context2.sourceFile, info); }) }); function getInfo13(sourceFile, pos, diagCode) { const node = getTokenAtPosition(sourceFile, pos); - if (isIdentifier26(node) || isPrivateIdentifier(node)) { + if (isIdentifier28(node) || isPrivateIdentifier(node)) { return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } @@ -193801,9 +197076,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes40, fixIds: [fixIdExpression, fixIdHtmlEntity], - getCodeActions(context) { - const { sourceFile, preferences, span } = context; - const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26( + getCodeActions(context2) { + const { sourceFile, preferences, span } = context2; + const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange26( t, preferences, sourceFile, @@ -193811,7 +197086,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*useHtmlEntity*/ false )); - const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26( + const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange26( t, preferences, sourceFile, @@ -193824,8 +197099,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} createCodeFixAction(fixIdHtmlEntity, changeToHtmlEntity, Diagnostics.Convert_invalid_character_to_its_html_entity_code, fixIdHtmlEntity, Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code) ]; }, - getAllCodeActions(context) { - return codeFixAll(context, errorCodes40, (changes, diagnostic) => doChange26(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); + getAllCodeActions(context2) { + return codeFixAll(context2, errorCodes40, (changes, diagnostic) => doChange26(changes, context2.preferences, diagnostic.file, diagnostic.start, context2.fixId === fixIdHtmlEntity)); } }); var htmlEntity = { @@ -193851,28 +197126,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter], errorCodes: errorCodes41, - getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToFixUnmatchedParameter(context2) { + const { sourceFile, span } = context2; const actions2 = []; const info = getInfo14(sourceFile, span.start); if (info) { - append(actions2, getDeleteAction(context, info)); - append(actions2, getRenameAction(context, info)); + append(actions2, getDeleteAction(context2, info)); + append(actions2, getRenameAction(context2, info)); return actions2; } return void 0; }, - getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) { + getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context2) { const tagsToSignature = /* @__PURE__ */ new Map(); - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes41, ({ file: file2, start }) => { + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { + eachDiagnostic(context2, errorCodes41, ({ file: file2, start }) => { const info = getInfo14(file2, start); if (info) { tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag)); } }); tagsToSignature.forEach((tags, signature) => { - if (context.fixId === deleteUnmatchedParameter) { + if (context2.fixId === deleteUnmatchedParameter) { const tagsSet = new Set(tags); changes.filterJSDocTags(signature.getSourceFile(), signature, (t) => !tagsSet.has(t)); } @@ -193880,27 +197155,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} })); } }); - function getDeleteAction(context, { name, jsDocHost, jsDocParameterTag }) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.filterJSDocTags(context.sourceFile, jsDocHost, (t) => t !== jsDocParameterTag)); + function getDeleteAction(context2, { name, jsDocHost, jsDocParameterTag }) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changeTracker) => changeTracker.filterJSDocTags(context2.sourceFile, jsDocHost, (t) => t !== jsDocParameterTag)); return createCodeFixAction( deleteUnmatchedParameter, changes, - [Diagnostics.Delete_unused_param_tag_0, name.getText(context.sourceFile)], + [Diagnostics.Delete_unused_param_tag_0, name.getText(context2.sourceFile)], deleteUnmatchedParameter, Diagnostics.Delete_all_unused_param_tags ); } - function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) { + function getRenameAction(context2, { name, jsDocHost, signature, jsDocParameterTag }) { if (!length(signature.parameters)) return void 0; - const sourceFile = context.sourceFile; + const sourceFile = context2.sourceFile; const tags = getJSDocTags(signature); const names = /* @__PURE__ */ new Set(); for (const tag of tags) { - if (isJSDocParameterTag(tag) && isIdentifier26(tag.name)) { + if (isJSDocParameterTag(tag) && isIdentifier28(tag.name)) { names.add(tag.name.escapedText); } } - const parameterName = firstDefined(signature.parameters, (p) => isIdentifier26(p.name) && !names.has(p.name.escapedText) ? p.name.getText(sourceFile) : void 0); + const parameterName = firstDefined(signature.parameters, (p) => isIdentifier28(p.name) && !names.has(p.name.escapedText) ? p.name.getText(sourceFile) : void 0); if (parameterName === void 0) return void 0; const newJSDocParameterTag = factory.updateJSDocParameterTag( jsDocParameterTag, @@ -193911,12 +197186,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} jsDocParameterTag.isNameFirst, jsDocParameterTag.comment ); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map2(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t))); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map2(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t))); return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]); } function getInfo14(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier26(token.parent.name)) { + if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier28(token.parent.name)) { const jsDocParameterTag = token.parent; const jsDocHost = getJSDocHost(jsDocParameterTag); const signature = getHostSignatureFromJSDoc(jsDocParameterTag); @@ -193930,11 +197205,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes42 = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; registerCodeFix({ errorCodes: errorCodes42, - getCodeActions: (context) => { - const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); + getCodeActions: (context2) => { + const importDeclaration = getImportDeclaration(context2.sourceFile, context2.program, context2.span.start); if (!importDeclaration) return; - const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => importDeclaration.kind === 277 && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program)); - const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program)); + const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context2, (t) => importDeclaration.kind === 277 && doNamespaceImportChange(t, context2.sourceFile, importDeclaration, context2.program)); + const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doTypeOnlyImportChange(t, context2.sourceFile, importDeclaration, context2.program)); let actions2; if (namespaceChanges.length) { actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId33, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import)); @@ -193947,7 +197222,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} fixIds: [fixId33] }); function getImportDeclaration(sourceFile, program, start) { - const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier26); + const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier28); if (!identifier || identifier.parent.kind !== 184) return; const checker = program.getTypeChecker(); const symbol2 = checker.getSymbolAtLocation(identifier); @@ -193990,24 +197265,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes43, - getCodeActions(context) { - const { errorCode, sourceFile, program, cancellationToken } = context; + getCodeActions(context2) { + const { errorCode, sourceFile, program, cancellationToken } = context2; const checker = program.getTypeChecker(); const sourceFiles = program.getSourceFiles(); - const token = getTokenAtPosition(sourceFile, context.span.start); + const token = getTokenAtPosition(sourceFile, context2.span.start); if (isJSDocTemplateTag(token)) { - return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => t.delete(sourceFile, token)), Diagnostics.Remove_template_tag)]; + return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.delete(sourceFile, token)), Diagnostics.Remove_template_tag)]; } if (token.kind === 30) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteTypeParameters(t, sourceFile, token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => deleteTypeParameters(t, sourceFile, token)); return [createDeleteFix(changes, Diagnostics.Remove_type_parameters)]; } const importDecl = tryGetFullImport(token); if (importDecl) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => t.delete(sourceFile, importDecl)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.delete(sourceFile, importDecl)); return [createCodeFixAction(fixName3, changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDeleteImports, Diagnostics.Delete_all_unused_imports)]; } else if (isImport(token)) { - const deletion = ts_textChanges_exports.ChangeTracker.with(context, (t) => tryDeleteDeclaration( + const deletion = ts_textChanges_exports.ChangeTracker.with(context2, (t) => tryDeleteDeclaration( sourceFile, token, t, @@ -194030,28 +197305,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} map2(elements, (e) => e.getText(sourceFile)).join(", ") ]; return [ - createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteDestructuringElements(t, sourceFile, token.parent)), diagnostic) + createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context2, (t) => deleteDestructuringElements(t, sourceFile, token.parent)), diagnostic) ]; } return [ - createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteDestructuring(context, t, sourceFile, token.parent)), Diagnostics.Remove_unused_destructuring_declaration) + createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context2, (t) => deleteDestructuring(context2, t, sourceFile, token.parent)), Diagnostics.Remove_unused_destructuring_declaration) ]; } if (canDeleteEntireVariableStatement(sourceFile, token)) { return [ - createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteEntireVariableStatement(t, sourceFile, token.parent)), Diagnostics.Remove_variable_statement) + createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context2, (t) => deleteEntireVariableStatement(t, sourceFile, token.parent)), Diagnostics.Remove_variable_statement) ]; } - if (isIdentifier26(token) && isFunctionDeclaration5(token.parent)) { - return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteFunctionLikeDeclaration(t, sourceFile, token.parent)), [Diagnostics.Remove_unused_declaration_for_Colon_0, token.getText(sourceFile)])]; + if (isIdentifier28(token) && isFunctionDeclaration5(token.parent)) { + return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context2, (t) => deleteFunctionLikeDeclaration(t, sourceFile, token.parent)), [Diagnostics.Remove_unused_declaration_for_Colon_0, token.getText(sourceFile)])]; } const result = []; if (token.kind === 140) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => changeInferToUnknown(t, sourceFile, token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => changeInferToUnknown(t, sourceFile, token)); const name = cast(token.parent, isInferTypeNode).typeParameter.name.text; result.push(createCodeFixAction(fixName3, changes, [Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, Diagnostics.Replace_all_unused_infer_with_unknown)); } else { - const deletion = ts_textChanges_exports.ChangeTracker.with(context, (t) => tryDeleteDeclaration( + const deletion = ts_textChanges_exports.ChangeTracker.with(context2, (t) => tryDeleteDeclaration( sourceFile, token, t, @@ -194067,20 +197342,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} result.push(createDeleteFix(deletion, [Diagnostics.Remove_unused_declaration_for_Colon_0, name.getText(sourceFile)])); } } - const prefix = ts_textChanges_exports.ChangeTracker.with(context, (t) => tryPrefixDeclaration(t, errorCode, sourceFile, token)); + const prefix = ts_textChanges_exports.ChangeTracker.with(context2, (t) => tryPrefixDeclaration(t, errorCode, sourceFile, token)); if (prefix.length) { result.push(createCodeFixAction(fixName3, prefix, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible)); } return result; }, fixIds: [fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer], - getAllCodeActions: (context) => { - const { sourceFile, program, cancellationToken } = context; + getAllCodeActions: (context2) => { + const { sourceFile, program, cancellationToken } = context2; const checker = program.getTypeChecker(); const sourceFiles = program.getSourceFiles(); - return codeFixAll(context, errorCodes43, (changes, diag2) => { + return codeFixAll(context2, errorCodes43, (changes, diag2) => { const token = getTokenAtPosition(sourceFile, diag2.start); - switch (context.fixId) { + switch (context2.fixId) { case fixIdPrefix: tryPrefixDeclaration(changes, diag2.code, sourceFile, token); break; @@ -194120,7 +197395,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; } else if (canDeleteEntireVariableStatement(sourceFile, token)) { deleteEntireVariableStatement(changes, sourceFile, token.parent); - } else if (isIdentifier26(token) && isFunctionDeclaration5(token.parent)) { + } else if (isIdentifier28(token) && isFunctionDeclaration5(token.parent)) { deleteFunctionLikeDeclaration(changes, sourceFile, token.parent); } else { tryDeleteDeclaration( @@ -194143,7 +197418,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } break; default: - Debug.fail(JSON.stringify(context.fixId)); + Debug.fail(JSON.stringify(context2.fixId)); } }); } @@ -194164,7 +197439,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return token.kind === 102 || token.kind === 80 && (token.parent.kind === 277 || token.parent.kind === 274); } function tryGetFullImport(token) { - return token.kind === 102 ? tryCast(token.parent, isImportDeclaration7) : void 0; + return token.kind === 102 ? tryCast(token.parent, isImportDeclaration8) : void 0; } function canDeleteEntireVariableStatement(sourceFile, token) { return isVariableDeclarationList(token.parent) && first(token.parent.getChildren(sourceFile)) === token; @@ -194175,7 +197450,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function deleteDestructuringElements(changes, sourceFile, node) { forEach(node.elements, (n) => changes.delete(sourceFile, n)); } - function deleteDestructuring(context, changes, sourceFile, { parent: parent2 }) { + function deleteDestructuring(context2, changes, sourceFile, { parent: parent2 }) { if (isVariableDeclaration7(parent2) && parent2.initializer && isCallLikeExpression(parent2.initializer)) { if (isVariableDeclarationList(parent2.parent) && length(parent2.parent.declarations) > 1) { const varStatement = parent2.parent.parent; @@ -194183,7 +197458,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const end = varStatement.end; changes.delete(sourceFile, parent2); changes.insertNodeAt(sourceFile, end, parent2.initializer, { - prefix: getNewLineOrDefaultFromHost(context.host, context.formatContext.options) + sourceFile.text.slice(getPrecedingNonSpaceCharacterPosition(sourceFile.text, pos - 1), pos), + prefix: getNewLineOrDefaultFromHost(context2.host, context2.formatContext.options) + sourceFile.text.slice(getPrecedingNonSpaceCharacterPosition(sourceFile.text, pos - 1), pos), suffix: probablyUsesSemicolons(sourceFile) ? ";" : "" }); } else { @@ -194198,11 +197473,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (token.kind === 140) { token = cast(token.parent, isInferTypeNode).typeParameter.name; } - if (isIdentifier26(token) && canPrefix(token)) { + if (isIdentifier28(token) && canPrefix(token)) { changes.replaceNode(sourceFile, token, factory.createIdentifier(`_${token.text}`)); if (isParameter(token.parent)) { getJSDocParameterTags(token.parent).forEach((tag) => { - if (isIdentifier26(tag.name)) { + if (isIdentifier28(tag.name)) { changes.replaceNode(sourceFile, tag.name, factory.createIdentifier(`_${tag.name.text}`)); } }); @@ -194227,9 +197502,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function tryDeleteDeclaration(sourceFile, token, changes, checker, sourceFiles, program, cancellationToken, isFixAll) { tryDeleteDeclarationWorker(token, changes, sourceFile, checker, sourceFiles, program, cancellationToken, isFixAll); - if (isIdentifier26(token)) { + if (isIdentifier28(token)) { ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(token, checker, sourceFile, (ref) => { - if (isPropertyAccessExpression16(ref.parent) && ref.parent.name === ref) ref = ref.parent; + if (isPropertyAccessExpression17(ref.parent) && ref.parent.name === ref) ref = ref.parent; if (!isFixAll && mayDeleteExpression(ref)) { changes.delete(sourceFile, ref.parent.parent); } @@ -194240,7 +197515,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { parent: parent2 } = token; if (isParameter(parent2)) { tryDeleteParameter(changes, sourceFile, parent2, checker, sourceFiles, program, cancellationToken, isFixAll); - } else if (!(isFixAll && isIdentifier26(token) && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(token, checker, sourceFile))) { + } else if (!(isFixAll && isIdentifier28(token) && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(token, checker, sourceFile))) { const node = isImportClause(parent2) ? token : isComputedPropertyName(parent2) ? parent2.parent : parent2; Debug.assert(node !== sourceFile, "should not delete whole source file"); changes.delete(sourceFile, node); @@ -194248,7 +197523,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function tryDeleteParameter(changes, sourceFile, parameter, checker, sourceFiles, program, cancellationToken, isFixAll = false) { if (mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll)) { - if (parameter.modifiers && parameter.modifiers.length > 0 && (!isIdentifier26(parameter.name) || ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { + if (parameter.modifiers && parameter.modifiers.length > 0 && (!isIdentifier28(parameter.name) || ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { for (const modifier of parameter.modifiers) { if (isModifier(modifier)) { changes.deleteModifier(sourceFile, modifier); @@ -194276,7 +197551,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} for (const reference of entry.references) { if (reference.kind === ts_FindAllReferences_exports.EntryKind.Node) { const isSuperCall2 = isSuperKeyword(reference.node) && isCallExpression16(reference.node.parent) && reference.node.parent.arguments.length > index; - const isSuperMethodCall = isPropertyAccessExpression16(reference.node.parent) && isSuperKeyword(reference.node.parent.expression) && isCallExpression16(reference.node.parent.parent) && reference.node.parent.parent.arguments.length > index; + const isSuperMethodCall = isPropertyAccessExpression17(reference.node.parent) && isSuperKeyword(reference.node.parent.expression) && isCallExpression16(reference.node.parent.parent) && reference.node.parent.parent.arguments.length > index; const isOverriddenMethod = (isMethodDeclaration(reference.node.parent) || isMethodSignature(reference.node.parent)) && reference.node.parent !== parameter.parent && reference.node.parent.parameters.length > index; if (isSuperCall2 || isSuperMethodCall || isOverriddenMethod) return false; } @@ -194302,13 +197577,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function isCallbackLike(checker, sourceFile, name) { - return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(name, checker, sourceFile, (reference) => isIdentifier26(reference) && isCallExpression16(reference.parent) && reference.parent.arguments.includes(reference)); + return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(name, checker, sourceFile, (reference) => isIdentifier28(reference) && isCallExpression16(reference.parent) && reference.parent.arguments.includes(reference)); } function isLastParameter(func, parameter, isFixAll) { const parameters = func.parameters; const index = parameters.indexOf(parameter); Debug.assert(index !== -1, "The parameter should already be in the list"); - return isFixAll ? parameters.slice(index + 1).every((p) => isIdentifier26(p.name) && !p.symbol.isReferenced) : index === parameters.length - 1; + return isFixAll ? parameters.slice(index + 1).every((p) => isIdentifier28(p.name) && !p.symbol.isReferenced) : index === parameters.length - 1; } function mayDeleteExpression(node) { return (isBinaryExpression4(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression4(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent); @@ -194325,14 +197600,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes44 = [Diagnostics.Unreachable_code_detected.code]; registerCodeFix({ errorCodes: errorCodes44, - getCodeActions(context) { - const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); + getCodeActions(context2) { + const syntacticDiagnostics = context2.program.getSyntacticDiagnostics(context2.sourceFile, context2.cancellationToken); if (syntacticDiagnostics.length) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange27(t, context2.sourceFile, context2.span.start, context2.span.length, context2.errorCode)); return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unreachable_code, fixId34, Diagnostics.Remove_all_unreachable_code)]; }, fixIds: [fixId34], - getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes44, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code)) }); function doChange27(changes, sourceFile, start, length2, errorCode) { const token = getTokenAtPosition(sourceFile, start); @@ -194386,12 +197661,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes45 = [Diagnostics.Unused_label.code]; registerCodeFix({ errorCodes: errorCodes45, - getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, context.sourceFile, context.span.start)); + getCodeActions(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange28(t, context2.sourceFile, context2.span.start)); return [createCodeFixAction(fixId35, changes, Diagnostics.Remove_unused_label, fixId35, Diagnostics.Remove_all_unused_labels)]; }, fixIds: [fixId35], - getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => doChange28(changes, diag2.file, diag2.start)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes45, (changes, diag2) => doChange28(changes, diag2.file, diag2.start)) }); function doChange28(changes, sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); @@ -194415,10 +197690,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes46, - getCodeActions(context) { - const { sourceFile } = context; - const checker = context.program.getTypeChecker(); - const info = getInfo15(sourceFile, context.span.start, checker); + getCodeActions(context2) { + const { sourceFile } = context2; + const checker = context2.program.getTypeChecker(); + const info = getInfo15(sourceFile, context2.span.start, checker); if (!info) return void 0; const { typeNode, type } = info; const original = typeNode.getText(sourceFile); @@ -194428,15 +197703,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return actions2; function fix(type2, fixId56, fixAllDescription) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange29(t, sourceFile, typeNode, type2, checker)); return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId56, fixAllDescription); } }, fixIds: [fixIdPlain, fixIdNullable], - getAllCodeActions(context) { - const { fixId: fixId56, program, sourceFile } = context; + getAllCodeActions(context2) { + const { fixId: fixId56, program, sourceFile } = context2; const checker = program.getTypeChecker(); - return codeFixAll(context, errorCodes46, (changes, err) => { + return codeFixAll(context2, errorCodes46, (changes, err) => { const info = getInfo15(err.file, err.start, checker); if (!info) return; const { typeNode, type } = info; @@ -194505,14 +197780,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes47, fixIds: [fixId36], - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const callName = getCallName(sourceFile, span.start); if (!callName) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, context.sourceFile, callName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange30(t, context2.sourceFile, callName)); return [createCodeFixAction(fixId36, changes, Diagnostics.Add_missing_call_parentheses, fixId36, Diagnostics.Add_all_missing_call_parentheses)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes47, (changes, diag2) => { const callName = getCallName(diag2.file, diag2.start); if (callName) doChange30(changes, diag2.file, callName); }) @@ -194522,14 +197797,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCallName(sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); - if (isPropertyAccessExpression16(token.parent)) { + if (isPropertyAccessExpression17(token.parent)) { let current = token.parent; - while (isPropertyAccessExpression16(current.parent)) { + while (isPropertyAccessExpression17(current.parent)) { current = current.parent; } return current.name; } - if (isIdentifier26(token)) { + if (isIdentifier28(token)) { return token; } return void 0; @@ -194581,28 +197856,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes48, fixIds: [fixId37], - getCodeActions(context) { + getCodeActions(context2) { const fixes = []; - addCodeAction(addAnnotationFix, fixes, context, 0, (f) => f.addTypeAnnotation(context.span)); - addCodeAction(addAnnotationFix, fixes, context, 1, (f) => f.addTypeAnnotation(context.span)); - addCodeAction(addAnnotationFix, fixes, context, 2, (f) => f.addTypeAnnotation(context.span)); - addCodeAction(addInlineTypeAssertion, fixes, context, 0, (f) => f.addInlineAssertion(context.span)); - addCodeAction(addInlineTypeAssertion, fixes, context, 1, (f) => f.addInlineAssertion(context.span)); - addCodeAction(addInlineTypeAssertion, fixes, context, 2, (f) => f.addInlineAssertion(context.span)); - addCodeAction(extractExpression, fixes, context, 0, (f) => f.extractAsVariable(context.span)); + addCodeAction(addAnnotationFix, fixes, context2, 0, (f) => f.addTypeAnnotation(context2.span)); + addCodeAction(addAnnotationFix, fixes, context2, 1, (f) => f.addTypeAnnotation(context2.span)); + addCodeAction(addAnnotationFix, fixes, context2, 2, (f) => f.addTypeAnnotation(context2.span)); + addCodeAction(addInlineTypeAssertion, fixes, context2, 0, (f) => f.addInlineAssertion(context2.span)); + addCodeAction(addInlineTypeAssertion, fixes, context2, 1, (f) => f.addInlineAssertion(context2.span)); + addCodeAction(addInlineTypeAssertion, fixes, context2, 2, (f) => f.addInlineAssertion(context2.span)); + addCodeAction(extractExpression, fixes, context2, 0, (f) => f.extractAsVariable(context2.span)); return fixes; }, - getAllCodeActions: (context) => { - const changes = withContext(context, 0, (f) => { - eachDiagnostic(context, errorCodes48, (diag2) => { + getAllCodeActions: (context2) => { + const changes = withContext(context2, 0, (f) => { + eachDiagnostic(context2, errorCodes48, (diag2) => { f.addTypeAnnotation(diag2); }); }); return createCombinedCodeActions(changes.textChanges); } }); - function addCodeAction(fixName8, fixes, context, typePrintMode, cb) { - const changes = withContext(context, typePrintMode, cb); + function addCodeAction(fixName8, fixes, context2, typePrintMode, cb) { + const changes = withContext(context2, typePrintMode, cb); if (changes.result && changes.textChanges.length) { fixes.push(createCodeFixAction( fixName8, @@ -194613,14 +197888,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )); } } - function withContext(context, typePrintMode, cb) { + function withContext(context2, typePrintMode, cb) { const emptyInferenceResult = { typeNode: void 0, mutatedTarget: false }; - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); - const sourceFile = context.sourceFile; - const program = context.program; + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context2); + const sourceFile = context2.sourceFile; + const program = context2.program; const typeChecker = program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(program.getCompilerOptions()); - const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); + const importAdder = createImportAdder(context2.sourceFile, context2.program, context2.preferences, context2.host); const fixedNodes = /* @__PURE__ */ new Set(); const expandoPropertiesAdded = /* @__PURE__ */ new Set(); const typePrinter = createPrinter({ @@ -194633,7 +197908,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} textChanges: changeTracker.getChanges() }; function addTypeAnnotation(span) { - context.cancellationToken.throwIfCancellationRequested(); + context2.cancellationToken.throwIfCancellationRequested(); const nodeWithDiag = getTokenAtPosition(sourceFile, span.start); const expandoFunction = findExpandoFunction(nodeWithDiag); if (expandoFunction) { @@ -194703,7 +197978,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return [Diagnostics.Annotate_types_of_properties_expando_function_in_a_namespace]; } function needsParenthesizedExpressionForAssertion(node) { - return !isEntityNameExpression(node) && !isCallExpression16(node) && !isObjectLiteralExpression12(node) && !isArrayLiteralExpression7(node); + return !isEntityNameExpression(node) && !isCallExpression16(node) && !isObjectLiteralExpression13(node) && !isArrayLiteralExpression7(node); } function createAsExpression(node, type) { if (needsParenthesizedExpressionForAssertion(node)) { @@ -194718,14 +197993,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.createAsExpression(factory.createSatisfiesExpression(node, getSynthesizedDeepClone(type)), type); } function addInlineAssertion(span) { - context.cancellationToken.throwIfCancellationRequested(); + context2.cancellationToken.throwIfCancellationRequested(); const nodeWithDiag = getTokenAtPosition(sourceFile, span.start); const expandoFunction = findExpandoFunction(nodeWithDiag); if (expandoFunction) return; const targetNode = findBestFittingNode(nodeWithDiag, span); if (!targetNode || isValueSignatureDeclaration(targetNode) || isValueSignatureDeclaration(targetNode.parent)) return; const isExpressionTarget = isExpression(targetNode); - const isShorthandPropertyAssignmentTarget = isShorthandPropertyAssignment6(targetNode); + const isShorthandPropertyAssignmentTarget = isShorthandPropertyAssignment7(targetNode); if (!isShorthandPropertyAssignmentTarget && isDeclaration(targetNode)) { return void 0; } @@ -194776,7 +198051,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return [Diagnostics.Add_satisfies_and_an_inline_type_assertion_with_0, typeToStringForDiag(typeNode)]; } function extractAsVariable(span) { - context.cancellationToken.throwIfCancellationRequested(); + context2.cancellationToken.throwIfCancellationRequested(); const nodeWithDiag = getTokenAtPosition(sourceFile, span.start); const targetNode = findBestFittingNode(nodeWithDiag, span); if (!targetNode || isValueSignatureDeclaration(targetNode) || isValueSignatureDeclaration(targetNode.parent)) return; @@ -194790,7 +198065,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); return [Diagnostics.Mark_array_literal_as_const]; } - const parentPropertyAssignment = findAncestor(targetNode, isPropertyAssignment11); + const parentPropertyAssignment = findAncestor(targetNode, isPropertyAssignment12); if (parentPropertyAssignment) { if (parentPropertyAssignment === targetNode.parent && isEntityNameExpression(targetNode)) return; const tempName = factory.createUniqueName( @@ -195002,7 +198277,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!enclosingVariableDeclaration.initializer) return void 0; let baseExpr; const newNodes = []; - if (!isIdentifier26(enclosingVariableDeclaration.initializer)) { + if (!isIdentifier28(enclosingVariableDeclaration.initializer)) { const tempHolderForReturn = factory.createUniqueName( "dest", 16 @@ -195071,7 +198346,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (bindingElement.element.initializer) { const propertyName = (_a3 = bindingElement.element) == null ? void 0 : _a3.propertyName; const tempName = factory.createUniqueName( - propertyName && isIdentifier26(propertyName) ? propertyName.text : "temp", + propertyName && isIdentifier28(propertyName) ? propertyName.text : "temp", 16 /* Optimistic */ ); @@ -195302,7 +198577,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} name, isConstContext, (n) => n.properties, - isSpreadAssignment6, + isSpreadAssignment7, factory.createSpreadAssignment, (props) => factory.createObjectLiteralExpression( props, @@ -195387,7 +198662,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isParameter(node)) { return emptyInferenceResult; } - if (isShorthandPropertyAssignment6(node)) { + if (isShorthandPropertyAssignment7(node)) { return { typeNode: createTypeOfFromEntityNameExpression(node.name), mutatedTarget: false @@ -195404,12 +198679,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isArrayLiteralExpression7(node)) { const variableDecl = findAncestor(node, isVariableDeclaration7); - const partName = variableDecl && isIdentifier26(variableDecl.name) ? variableDecl.name.text : void 0; + const partName = variableDecl && isIdentifier28(variableDecl.name) ? variableDecl.name.text : void 0; return typeFromArraySpreadElements(node, partName); } - if (isObjectLiteralExpression12(node)) { + if (isObjectLiteralExpression13(node)) { const variableDecl = findAncestor(node, isVariableDeclaration7); - const partName = variableDecl && isIdentifier26(variableDecl.name) ? variableDecl.name.text : void 0; + const partName = variableDecl && isIdentifier28(variableDecl.name) ? variableDecl.name.text : void 0; return typeFromObjectSpreadAssignment(node, partName); } if (isVariableDeclaration7(node) && node.initializer) { @@ -195503,7 +198778,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} while (node.parent.pos === node.pos && node.parent.end === node.end) { node = node.parent; } - if (isIdentifier26(node) && hasInitializer(node.parent) && node.parent.initializer) { + if (isIdentifier28(node) && hasInitializer(node.parent) && node.parent.initializer) { return node.parent.initializer; } return node; @@ -195518,20 +198793,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes49, - getCodeActions(context) { - const { sourceFile, span } = context; + getCodeActions(context2) { + const { sourceFile, span } = context2; const nodes = getNodes3(sourceFile, span.start); if (!nodes) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange31(t, sourceFile, nodes)); return [createCodeFixAction(fixId38, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId38, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId38], - getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) { + getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context2) { const seen = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes49, (changes, diag2) => { + return codeFixAll(context2, errorCodes49, (changes, diag2) => { const nodes = getNodes3(diag2.file, diag2.start); if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; - doChange31(changes, context.sourceFile, nodes); + doChange31(changes, context2.sourceFile, nodes); }); } }); @@ -195586,30 +198861,30 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var fixId39 = "fixPropertyOverrideAccessor"; registerCodeFix({ errorCodes: errorCodes50, - getCodeActions(context) { - const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + getCodeActions(context2) { + const edits = doChange32(context2.sourceFile, context2.span.start, context2.span.length, context2.errorCode, context2); if (edits) { return [createCodeFixAction(fixId39, edits, Diagnostics.Generate_get_and_set_accessors, fixId39, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; } }, fixIds: [fixId39], - getAllCodeActions: (context) => codeFixAll(context, errorCodes50, (changes, diag2) => { - const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes50, (changes, diag2) => { + const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context2); if (edits) { for (const edit of edits) { - changes.pushRaw(context.sourceFile, edit); + changes.pushRaw(context2.sourceFile, edit); } } }) }); - function doChange32(file2, start, length2, code, context) { + function doChange32(file2, start, length2, code, context2) { let startPosition; let endPosition; if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { startPosition = start; endPosition = start + length2; } else if (code === Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code) { - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); const node = getTokenAtPosition(file2, start).parent; if (isComputedPropertyName(node)) { return; @@ -195631,7 +198906,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { Debug.fail("fixPropertyOverrideAccessor codefix got unexpected error code " + code); } - return generateAccessorFromProperty(file2, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message); + return generateAccessorFromProperty(file2, context2.program, startPosition, endPosition, context2, Diagnostics.Generate_get_and_set_accessors.message); } var fixId40 = "inferFromUsage"; var errorCodes51 = [ @@ -195669,11 +198944,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes51, - getCodeActions(context) { - const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context; + getCodeActions(context2) { + const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context2; const token = getTokenAtPosition(sourceFile, start); let declaration; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (changes2) => { declaration = doChange33( changes2, sourceFile, @@ -195691,10 +198966,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId40, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId40, Diagnostics.Infer_all_types_from_usage)]; }, fixIds: [fixId40], - getAllCodeActions(context) { - const { sourceFile, program, cancellationToken, host, preferences } = context; + getAllCodeActions(context2) { + const { sourceFile, program, cancellationToken, host, preferences } = context2; const markSeen = nodeSeenTracker(); - return codeFixAll(context, errorCodes51, (changes, err) => { + return codeFixAll(context2, errorCodes51, (changes, err) => { doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); }); } @@ -195751,7 +199026,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} importAdder.writeFixes(changes); return parent2; } - if (isPropertyAccessExpression16(parent2)) { + if (isPropertyAccessExpression17(parent2)) { const type = inferTypeForVariableFromUsage(parent2.name, program, cancellationToken); const typeNode = getTypeNodeIfAccessible(type, parent2, program, host); if (typeNode) { @@ -195802,7 +199077,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} // Get Accessor declarations case Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code: case Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code: - if (isGetAccessorDeclaration(containingFunction) && isIdentifier26(containingFunction.name)) { + if (isGetAccessorDeclaration(containingFunction) && isIdentifier28(containingFunction.name)) { annotate(changes, importAdder, sourceFile, containingFunction, inferTypeForVariableFromUsage(containingFunction.name, program, cancellationToken), program, host); declaration = containingFunction; } @@ -195828,12 +199103,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return declaration; } function annotateVariableDeclaration(changes, importAdder, sourceFile, declaration, program, host, cancellationToken) { - if (isIdentifier26(declaration.name)) { + if (isIdentifier28(declaration.name)) { annotate(changes, importAdder, sourceFile, declaration, inferTypeForVariableFromUsage(declaration.name, program, cancellationToken), program, host); } } function annotateParameters(changes, importAdder, sourceFile, parameterDeclaration, containingFunction, program, host, cancellationToken) { - if (!isIdentifier26(parameterDeclaration.name)) { + if (!isIdentifier28(parameterDeclaration.name)) { return; } const parameterInferences = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken); @@ -195884,7 +199159,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function annotateSetAccessor(changes, importAdder, sourceFile, setAccessorDeclaration, program, host, cancellationToken) { const param = firstOrUndefined(setAccessorDeclaration.parameters); - if (param && isIdentifier26(setAccessorDeclaration.name) && isIdentifier26(param.name)) { + if (param && isIdentifier28(setAccessorDeclaration.name) && isIdentifier28(param.name)) { let type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken); if (type === program.getTypeChecker().getAnyType()) { type = inferTypeForVariableFromUsage(param.name, program, cancellationToken); @@ -195900,7 +199175,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeNode = getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { if (isInJSFile(sourceFile) && declaration.kind !== 172) { - const parent2 = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement11) : declaration; + const parent2 = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement12) : declaration; if (!parent2) { return; } @@ -195943,7 +199218,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const inferences = mapDefined(parameterInferences, (inference) => { const param = inference.declaration; - if (param.initializer || getJSDocType(param) || !isIdentifier26(param.name)) { + if (param.initializer || getJSDocType(param) || !isIdentifier28(param.name)) { return; } const typeNode = inference.type && getTypeNodeIfAccessible(inference.type, param, program, host); @@ -196004,7 +199279,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getReferences(token, program, cancellationToken) { - return mapDefined(ts_FindAllReferences_exports.getReferenceEntriesForNode(-1, token, program, program.getSourceFiles(), cancellationToken), (entry) => entry.kind !== ts_FindAllReferences_exports.EntryKind.Span ? tryCast(entry.node, isIdentifier26) : void 0); + return mapDefined(ts_FindAllReferences_exports.getReferenceEntriesForNode(-1, token, program, program.getSourceFiles(), cancellationToken), (entry) => entry.kind !== ts_FindAllReferences_exports.EntryKind.Span ? tryCast(entry.node, isIdentifier28) : void 0); } function inferTypeForVariableFromUsage(token, program, cancellationToken) { const references = getReferences(token, program, cancellationToken); @@ -196014,7 +199289,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const references = getFunctionReferences(func, sourceFile, program, cancellationToken); return references && inferTypeFromReferences(program, references, cancellationToken).parameters(func) || func.parameters.map((p) => ({ declaration: p, - type: isIdentifier26(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + type: isIdentifier28(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() })); } function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { @@ -196026,7 +199301,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 220: case 219: const parent2 = containingFunction.parent; - searchToken = (isVariableDeclaration7(parent2) || isPropertyDeclaration(parent2)) && isIdentifier26(parent2.name) ? parent2.name : containingFunction.name; + searchToken = (isVariableDeclaration7(parent2) || isPropertyDeclaration(parent2)) && isIdentifier28(parent2.name) ? parent2.name : containingFunction.name; break; case 263: case 175: @@ -196133,7 +199408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} types.push(checker.getBaseTypeOfLiteralType(call.argumentTypes[parameterIndex])); } } - if (isIdentifier26(parameter.name)) { + if (isIdentifier28(parameter.name)) { const inferred = inferTypesFromReferencesSingle(getReferences(parameter.name, program, cancellationToken)); types.push(...isRest ? mapDefined(inferred, checker.getElementTypeOfArrayType) : inferred); } @@ -196709,15 +199984,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes52, fixIds: [fixId41], - getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) { - const { sourceFile, program, span } = context; + getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context2) { + const { sourceFile, program, span } = context2; const checker = program.getTypeChecker(); const info = getInfo16(sourceFile, program.getTypeChecker(), span.start); if (!info) { return void 0; } const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode)); return [createCodeFixAction( fixId41, changes, @@ -196726,8 +200001,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions )]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { - const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes52, (changes, diag2) => { + const info = getInfo16(diag2.file, context2.program.getTypeChecker(), diag2.start); if (info) { doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); } @@ -196767,8 +200042,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); registerCodeFix({ errorCodes: errorCodes53, - getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) { - const { sourceFile, program, span, host, formatContext } = context; + getCodeActions: function getCodeActionsToDisableJsDiagnostics(context2) { + const { sourceFile, program, span, host, formatContext } = context2; if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { return void 0; } @@ -196787,14 +200062,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) ]; if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) { - fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId42, Diagnostics.Add_ts_ignore_to_all_error_messages)); + fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange9(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId42, Diagnostics.Add_ts_ignore_to_all_error_messages)); } return fixes; }, fixIds: [fixId42], - getAllCodeActions: (context) => { + getAllCodeActions: (context2) => { const seenLines = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes53, (changes, diag2) => { + return codeFixAll(context2, errorCodes53, (changes, diag2) => { if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) { makeChange9(changes, diag2.file, diag2.start, seenLines); } @@ -196807,7 +200082,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore"); } } - function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, sourceFile, context, preferences, importAdder, addClassElement) { + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, sourceFile, context2, preferences, importAdder, addClassElement) { const classMembers = classDeclaration.symbol.members; for (const symbol2 of possiblyMissingSymbols) { if (!classMembers.has(symbol2.escapedName)) { @@ -196815,7 +200090,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} symbol2, classDeclaration, sourceFile, - context, + context2, preferences, importAdder, addClassElement, @@ -196825,10 +200100,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - function getNoopSymbolTrackerWithResolver(context) { + function getNoopSymbolTrackerWithResolver(context2) { return { trackSymbol: () => false, - moduleResolverHost: getModuleSpecifierResolverHost(context.program, context.host) + moduleResolverHost: getModuleSpecifierResolverHost(context2.program, context2.host) }; } var PreserveOptionalFlags = /* @__PURE__ */ ((PreserveOptionalFlags2) => { @@ -196837,11 +200112,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} PreserveOptionalFlags2[PreserveOptionalFlags2["All"] = 3] = "All"; return PreserveOptionalFlags2; })(PreserveOptionalFlags || {}); - function addNewNodeForMemberSymbol(symbol2, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3, isAmbient = false) { + function addNewNodeForMemberSymbol(symbol2, enclosingDeclaration, sourceFile, context2, preferences, importAdder, addClassElement, body, preserveOptional = 3, isAmbient = false) { const declarations = symbol2.getDeclarations(); const declaration = firstOrUndefined(declarations); - const checker = context.program.getTypeChecker(); - const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); + const checker = context2.program.getTypeChecker(); + const scriptTarget = getEmitScriptTarget(context2.program.getCompilerOptions()); const kind = (declaration == null ? void 0 : declaration.kind) ?? 172; const declarationName = createDeclarationName(symbol2, declaration); const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0; @@ -196859,7 +200134,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (kind) { case 172: case 173: - let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8, getNoopSymbolTrackerWithResolver(context)); + let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8, getNoopSymbolTrackerWithResolver(context2)); if (importAdder) { const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget); if (importableReference) { @@ -196888,7 +200163,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} flags, /*internalFlags*/ void 0, - getNoopSymbolTrackerWithResolver(context) + getNoopSymbolTrackerWithResolver(context2) ); const allAccessors = getAllAccessorDeclarations(declarations, declaration); const orderedAccessors = allAccessors.secondAccessor ? [allAccessors.firstAccessor, allAccessors.secondAccessor] : [allAccessors.firstAccessor]; @@ -196911,7 +200186,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { Debug.assertNode(accessor, isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); const parameter = getSetAccessorValueParameter(accessor); - const parameterName = parameter && isIdentifier26(parameter.name) ? idText(parameter.name) : void 0; + const parameterName = parameter && isIdentifier28(parameter.name) ? idText(parameter.name) : void 0; addClassElement(factory.createSetAccessorDeclaration( modifiers, createName(declarationName), @@ -196954,13 +200229,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional2 && !!(preserveOptional & 1), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context2, enclosingDeclaration, signatures, createName(declarationName), optional2 && !!(preserveOptional & 1), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference2, signature, modifiers2, name, body2) { - const method = createSignatureDeclarationFromSignature(175, context, quotePreference2, signature, body2, name, modifiers2, optional2 && !!(preserveOptional & 1), enclosingDeclaration, importAdder); + const method = createSignatureDeclarationFromSignature(175, context2, quotePreference2, signature, body2, name, modifiers2, optional2 && !!(preserveOptional & 1), enclosingDeclaration, importAdder); if (method) addClassElement(method); } function createModifiers() { @@ -196977,10 +200252,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return modifiers2 && factory.createNodeArray(modifiers2); } function shouldAddOverrideKeyword() { - return !!(context.program.getCompilerOptions().noImplicitOverride && declaration && hasAbstractModifier(declaration)); + return !!(context2.program.getCompilerOptions().noImplicitOverride && declaration && hasAbstractModifier(declaration)); } function createName(node) { - if (isIdentifier26(node) && node.escapedText === "constructor") { + if (isIdentifier28(node) && node.escapedText === "constructor") { return factory.createComputedPropertyName(factory.createStringLiteral( idText(node), quotePreference === 0 @@ -197021,13 +200296,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } } - function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional2, enclosingDeclaration, importAdder) { - const program = context.program; + function createSignatureDeclarationFromSignature(kind, context2, quotePreference, signature, body, name, modifiers, optional2, enclosingDeclaration, importAdder) { + const program = context2.program; const checker = program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(program.getCompilerOptions()); const isJs = isInJSFile(enclosingDeclaration); const flags = 1 | 256 | 524288 | (quotePreference === 0 ? 268435456 : 0); - const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, 8, getNoopSymbolTrackerWithResolver(context)); + const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, 8, getNoopSymbolTrackerWithResolver(context2)); if (!signatureDeclaration) { return void 0; } @@ -197101,7 +200376,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) : void 0; const asteriskToken = signatureDeclaration.asteriskToken; if (isFunctionExpression7(signatureDeclaration)) { - return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier26), typeParameters, parameters, type, body ?? signatureDeclaration.body); + return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier28), typeParameters, parameters, type, body ?? signatureDeclaration.body); } if (isArrowFunction8(signatureDeclaration)) { return factory.updateArrowFunction(signatureDeclaration, modifiers, typeParameters, parameters, type, signatureDeclaration.equalsGreaterThanToken, body ?? signatureDeclaration.body); @@ -197110,19 +200385,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name ?? factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } if (isFunctionDeclaration5(signatureDeclaration)) { - return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier26), typeParameters, parameters, type, body ?? signatureDeclaration.body); + return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier28), typeParameters, parameters, type, body ?? signatureDeclaration.body); } return void 0; } - function createSignatureDeclarationFromCallExpression(kind, context, importAdder, call, name, modifierFlags, contextNode) { - const quotePreference = getQuotePreference(context.sourceFile, context.preferences); - const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const tracker = getNoopSymbolTrackerWithResolver(context); - const checker = context.program.getTypeChecker(); + function createSignatureDeclarationFromCallExpression(kind, context2, importAdder, call, name, modifierFlags, contextNode) { + const quotePreference = getQuotePreference(context2.sourceFile, context2.preferences); + const scriptTarget = getEmitScriptTarget(context2.program.getCompilerOptions()); + const tracker = getNoopSymbolTrackerWithResolver(context2); + const checker = context2.program.getTypeChecker(); const isJs = isInJSFile(contextNode); const { typeArguments, arguments: args, parent: parent2 } = call; const contextualType = isJs ? void 0 : checker.getContextualType(call); - const names = map2(args, (arg) => isIdentifier26(arg) ? arg.text : isPropertyAccessExpression16(arg) && isIdentifier26(arg.name) ? arg.name.text : void 0); + const names = map2(args, (arg) => isIdentifier28(arg) ? arg.text : isPropertyAccessExpression17(arg) && isIdentifier28(arg.name) ? arg.name.text : void 0); const instanceTypes = isJs ? [] : map2(args, (arg) => checker.getTypeAtLocation(arg)); const { argumentTypeNodes, argumentTypeParameters } = getArgumentTypesAndTypeParameters( checker, @@ -197184,7 +200459,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) : type ); case 263: - Debug.assert(typeof name === "string" || isIdentifier26(name), "Unexpected name"); + Debug.assert(typeof name === "string" || isIdentifier28(name), "Unexpected name"); return factory.createFunctionDeclaration( modifiers, asteriskToken, @@ -197370,7 +200645,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return parameters; } - function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional2, modifiers, quotePreference, body) { + function createMethodImplementingSignatures(checker, context2, enclosingDeclaration, signatures, name, optional2, modifiers, quotePreference, body) { let maxArgsSignature = signatures[0]; let minArgumentCount = signatures[0].minArgumentCount; let someSigHasRestParameter = false; @@ -197424,15 +200699,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*typeParameters*/ void 0, parameters, - getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), + getReturnTypeFromSignatures(signatures, checker, context2, enclosingDeclaration), quotePreference, body ); } - function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) { + function getReturnTypeFromSignatures(signatures, checker, context2, enclosingDeclaration) { if (length(signatures)) { const type = checker.getUnionType(map2(signatures, checker.getReturnTypeOfSignature)); - return checker.typeToTypeNode(type, enclosingDeclaration, 1, 8, getNoopSymbolTrackerWithResolver(context)); + return checker.typeToTypeNode(type, enclosingDeclaration, 1, 8, getNoopSymbolTrackerWithResolver(context2)); } } function createStubbedMethod(modifiers, name, optional2, typeParameters, parameters, returnType, quotePreference, body) { @@ -197494,7 +200769,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } const compilerOptions = compilerOptionsProperty.initializer; - if (!isObjectLiteralExpression12(compilerOptions)) { + if (!isObjectLiteralExpression13(compilerOptions)) { return; } for (const [optionName, optionValue] of options) { @@ -197513,7 +200788,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.createPropertyAssignment(factory.createStringLiteral(name), initializer3); } function findJsonProperty(obj, name) { - return find(obj.properties, (p) => isPropertyAssignment11(p) && !!p.name && isStringLiteral15(p.name) && p.name.text === name); + return find(obj.properties, (p) => isPropertyAssignment12(p) && !!p.name && isStringLiteral15(p.name) && p.name.text === name); } function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget) { let symbols; @@ -197567,10 +200842,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return token; } - function generateAccessorFromProperty(file2, program, start, end, context, _actionName) { + function generateAccessorFromProperty(file2, program, start, end, context2, _actionName) { const fieldInfo = getAccessorConvertiblePropertyAtPosition(file2, program, start, end); if (!fieldInfo || ts_refactor_exports.isRefactorErrorInfo(fieldInfo)) return void 0; - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context2); const { isStatic: isStatic2, isReadonly, fieldName, accessorName, originalName, type, container, declaration } = fieldInfo; suppressLeadingAndTrailingTrivia(fieldName); suppressLeadingAndTrailingTrivia(accessorName); @@ -197609,17 +200884,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return changeTracker.getChanges(); } function isConvertibleName(name) { - return isIdentifier26(name) || isStringLiteral15(name); + return isIdentifier28(name) || isStringLiteral15(name); } function isAcceptedDeclaration(node) { - return isParameterPropertyDeclaration(node, node.parent) || isPropertyDeclaration(node) || isPropertyAssignment11(node); + return isParameterPropertyDeclaration(node, node.parent) || isPropertyDeclaration(node) || isPropertyAssignment12(node); } function createPropertyName(name, originalName) { - return isIdentifier26(originalName) ? factory.createIdentifier(name) : factory.createStringLiteral(name); + return isIdentifier28(originalName) ? factory.createIdentifier(name) : factory.createStringLiteral(name); } function createAccessorAccessExpression(fieldName, isStatic2, container) { const leftHead = isStatic2 ? container.name : factory.createThis(); - return isIdentifier26(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName)); + return isIdentifier28(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName)); } function prepareModifierFlagsForAccessor(modifierFlags) { modifierFlags &= ~8; @@ -197740,14 +201015,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function updateFieldDeclaration(changeTracker, file2, declaration, type, fieldName, modifiers) { if (isPropertyDeclaration(declaration)) { updatePropertyDeclaration(changeTracker, file2, declaration, type, fieldName, modifiers); - } else if (isPropertyAssignment11(declaration)) { + } else if (isPropertyAssignment12(declaration)) { updatePropertyAssignmentDeclaration(changeTracker, file2, declaration, fieldName); } else { - changeTracker.replaceNode(file2, declaration, factory.updateParameterDeclaration(declaration, modifiers, declaration.dotDotDotToken, cast(fieldName, isIdentifier26), declaration.questionToken, declaration.type, declaration.initializer)); + changeTracker.replaceNode(file2, declaration, factory.updateParameterDeclaration(declaration, modifiers, declaration.dotDotDotToken, cast(fieldName, isIdentifier28), declaration.questionToken, declaration.type, declaration.initializer)); } } function insertAccessor(changeTracker, file2, accessor, declaration, container) { - isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertMemberAtStart(file2, container, accessor) : isPropertyAssignment11(declaration) ? changeTracker.insertNodeAfterComma(file2, declaration, accessor) : changeTracker.insertNodeAfter(file2, declaration, accessor); + isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertMemberAtStart(file2, container, accessor) : isPropertyAssignment12(declaration) ? changeTracker.insertNodeAfterComma(file2, declaration, accessor) : changeTracker.insertNodeAfter(file2, declaration, accessor); } function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, file2, constructor, fieldName, originalName) { if (!constructor.body) return; @@ -197755,7 +201030,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isElementAccessExpression8(node) && node.expression.kind === 110 && isStringLiteral15(node.argumentExpression) && node.argumentExpression.text === originalName && isWriteAccess(node)) { changeTracker.replaceNode(file2, node.argumentExpression, factory.createStringLiteral(fieldName)); } - if (isPropertyAccessExpression16(node) && node.expression.kind === 110 && node.name.text === originalName && isWriteAccess(node)) { + if (isPropertyAccessExpression17(node) && node.expression.kind === 110 && node.name.text === originalName && isWriteAccess(node)) { changeTracker.replaceNode(file2, node.name, factory.createIdentifier(fieldName)); } if (!isFunctionLike(node) && !isClassLike(node)) { @@ -197779,21 +201054,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return typeNode; } var fixName5 = "invalidImportSyntax"; - function getCodeFixesForImportDeclaration(context, node) { + function getCodeFixesForImportDeclaration(context2, node) { const sourceFile = getSourceFileOfNode(node); const namespace = getNamespaceDeclarationNode(node); - const opts = context.program.getCompilerOptions(); + const opts = context2.program.getCompilerOptions(); const variations = []; - variations.push(createAction(context, sourceFile, node, makeImport( + variations.push(createAction(context2, sourceFile, node, makeImport( namespace.name, /*namedImports*/ void 0, node.moduleSpecifier, - getQuotePreference(sourceFile, context.preferences) + getQuotePreference(sourceFile, context2.preferences) ))); if (getEmitModuleKind(opts) === 1) { variations.push(createAction( - context, + context2, sourceFile, node, factory.createImportEqualsDeclaration( @@ -197808,8 +201083,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return variations; } - function createAction(context, sourceFile, node, replacement) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(sourceFile, node, replacement)); + function createAction(context2, sourceFile, node, replacement) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(sourceFile, node, replacement)); return createCodeFixActionWithoutFixAll(fixName5, changes, [Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]); } registerCodeFix({ @@ -197819,15 +201094,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ], getCodeActions: getActionsForUsageOfInvalidImport }); - function getActionsForUsageOfInvalidImport(context) { - const sourceFile = context.sourceFile; - const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 214 : 215; - const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), (a) => a.kind === targetKind); + function getActionsForUsageOfInvalidImport(context2) { + const sourceFile = context2.sourceFile; + const targetKind = Diagnostics.This_expression_is_not_callable.code === context2.errorCode ? 214 : 215; + const node = findAncestor(getTokenAtPosition(sourceFile, context2.span.start), (a) => a.kind === targetKind); if (!node) { return []; } const expr = node.expression; - return getImportCodeFixesForExpression(context, expr); + return getImportCodeFixesForExpression(context2, expr); } registerCodeFix({ errorCodes: [ @@ -197846,27 +201121,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ], getCodeActions: getActionsForInvalidImportLocation }); - function getActionsForInvalidImportLocation(context) { - const sourceFile = context.sourceFile; - const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), (a) => a.getStart() === context.span.start && a.getEnd() === context.span.start + context.span.length); + function getActionsForInvalidImportLocation(context2) { + const sourceFile = context2.sourceFile; + const node = findAncestor(getTokenAtPosition(sourceFile, context2.span.start), (a) => a.getStart() === context2.span.start && a.getEnd() === context2.span.start + context2.span.length); if (!node) { return []; } - return getImportCodeFixesForExpression(context, node); + return getImportCodeFixesForExpression(context2, node); } - function getImportCodeFixesForExpression(context, expr) { - const type = context.program.getTypeChecker().getTypeAtLocation(expr); + function getImportCodeFixesForExpression(context2, expr) { + const type = context2.program.getTypeChecker().getTypeAtLocation(expr); if (!(type.symbol && isTransientSymbol(type.symbol) && type.symbol.links.originatingImport)) { return []; } const fixes = []; const relatedImport = type.symbol.links.originatingImport; if (!isImportCall(relatedImport)) { - addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport)); + addRange(fixes, getCodeFixesForImportDeclaration(context2, relatedImport)); } if (isExpression(expr) && !(isNamedDeclaration(expr.parent) && expr.parent.name === expr)) { - const sourceFile = context.sourceFile; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(sourceFile, expr, factory.createPropertyAccessExpression(expr, "default"), {})); + const sourceFile = context2.sourceFile; + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => t.replaceNode(sourceFile, expr, factory.createPropertyAccessExpression(expr, "default"), {})); fixes.push(createCodeFixActionWithoutFixAll(fixName5, changes, Diagnostics.Use_synthetic_default_member)); } return fixes; @@ -197878,21 +201153,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes54 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code]; registerCodeFix({ errorCodes: errorCodes54, - getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) { - const info = getInfo17(context.sourceFile, context.span.start); + getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context2) { + const info = getInfo17(context2.sourceFile, context2.span.start); if (!info) return; const result = []; - append(result, getActionForAddMissingUndefinedType(context, info)); - append(result, getActionForAddMissingDefiniteAssignmentAssertion(context, info)); - append(result, getActionForAddMissingInitializer(context, info)); + append(result, getActionForAddMissingUndefinedType(context2, info)); + append(result, getActionForAddMissingDefiniteAssignmentAssertion(context2, info)); + append(result, getActionForAddMissingInitializer(context2, info)); return result; }, fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer], - getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes54, (changes, diag2) => { + getAllCodeActions: (context2) => { + return codeFixAll(context2, errorCodes54, (changes, diag2) => { const info = getInfo17(diag2.file, diag2.start); if (!info) return; - switch (context.fixId) { + switch (context2.fixId) { case fixIdAddDefiniteAssignmentAssertions: addDefiniteAssignmentAssertion(changes, diag2.file, info.prop); break; @@ -197900,20 +201175,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addUndefinedType(changes, diag2.file, info); break; case fixIdAddInitializer: - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); const initializer3 = getInitializer(checker, info.prop); if (!initializer3) return; addInitializer(changes, diag2.file, info.prop, initializer3); break; default: - Debug.fail(JSON.stringify(context.fixId)); + Debug.fail(JSON.stringify(context2.fixId)); } }); } }); function getInfo17(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier26(token) && isPropertyDeclaration(token.parent)) { + if (isIdentifier28(token) && isPropertyDeclaration(token.parent)) { const type = getEffectiveTypeAnnotationNode(token.parent); if (type) { return { type, prop: token.parent, isJs: isInJSFile(token.parent) }; @@ -197921,9 +201196,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } - function getActionForAddMissingDefiniteAssignmentAssertion(context, info) { + function getActionForAddMissingDefiniteAssignmentAssertion(context2, info) { if (info.isJs) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addDefiniteAssignmentAssertion(t, context.sourceFile, info.prop)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addDefiniteAssignmentAssertion(t, context2.sourceFile, info.prop)); return createCodeFixAction(fixName6, changes, [Diagnostics.Add_definite_assignment_assertion_to_property_0, info.prop.getText()], fixIdAddDefiniteAssignmentAssertions, Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties); } function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) { @@ -197941,8 +201216,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property); } - function getActionForAddMissingUndefinedType(context, info) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addUndefinedType(t, context.sourceFile, info)); + function getActionForAddMissingUndefinedType(context2, info) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addUndefinedType(t, context2.sourceFile, info)); return createCodeFixAction(fixName6, changes, [Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { @@ -197962,12 +201237,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changeTracker.replaceNode(sourceFile, info.type, unionTypeNode); } } - function getActionForAddMissingInitializer(context, info) { + function getActionForAddMissingInitializer(context2, info) { if (info.isJs) return void 0; - const checker = context.program.getTypeChecker(); + const checker = context2.program.getTypeChecker(); const initializer3 = getInitializer(checker, info.prop); if (!initializer3) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addInitializer(t, context.sourceFile, info.prop, initializer3)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => addInitializer(t, context2.sourceFile, info.prop, initializer3)); return createCodeFixAction(fixName6, changes, [Diagnostics.Add_initializer_to_property_0, info.prop.name.getText()], fixIdAddInitializer, Diagnostics.Add_initializers_to_all_uninitialized_properties); } function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer3) { @@ -198024,19 +201299,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes55 = [Diagnostics.require_call_may_be_converted_to_an_import.code]; registerCodeFix({ errorCodes: errorCodes55, - getCodeActions(context) { - const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences); + getCodeActions(context2) { + const info = getInfo18(context2.sourceFile, context2.program, context2.span.start, context2.preferences); if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange35(t, context2.sourceFile, info)); return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_require_to_import, fixId43, Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId43], - getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => { - const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes55, (changes, diag2) => { + const info = getInfo18(diag2.file, context2.program, diag2.start, context2.preferences); if (info) { - doChange35(changes, context.sourceFile, info); + doChange35(changes, context2.sourceFile, info); } }) }); @@ -198078,7 +201353,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const decl = cast(parent2.parent, isVariableDeclaration7); const quotePreference = getQuotePreference(sourceFile, preferences); - const defaultImportName = tryCast(decl.name, isIdentifier26); + const defaultImportName = tryCast(decl.name, isIdentifier28); const namedImports = isObjectBindingPattern3(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0; if (defaultImportName || namedImports) { const moduleSpecifier = first(parent2.arguments); @@ -198086,7 +201361,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()), defaultImportName, namedImports, - statement: cast(decl.parent.parent, isVariableStatement11), + statement: cast(decl.parent.parent, isVariableStatement12), moduleSpecifier: isNoSubstitutionTemplateLiteral5(moduleSpecifier) ? factory.createStringLiteral( moduleSpecifier.text, quotePreference === 0 @@ -198098,13 +201373,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function tryCreateNamedImportsFromObjectBindingPattern(node) { const importSpecifiers = []; for (const element of node.elements) { - if (!isIdentifier26(element.name) || element.initializer) { + if (!isIdentifier28(element.name) || element.initializer) { return void 0; } importSpecifiers.push(factory.createImportSpecifier( /*isTypeOnly*/ false, - tryCast(element.propertyName, isIdentifier26), + tryCast(element.propertyName, isIdentifier28), element.name )); } @@ -198116,26 +201391,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes56 = [Diagnostics.Import_may_be_converted_to_a_default_import.code]; registerCodeFix({ errorCodes: errorCodes56, - getCodeActions(context) { - const { sourceFile, span: { start } } = context; + getCodeActions(context2) { + const { sourceFile, span: { start } } = context2; const info = getInfo19(sourceFile, start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, info, context.preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange36(t, sourceFile, info, context2.preferences)); return [createCodeFixAction(fixId44, changes, Diagnostics.Convert_to_default_import, fixId44, Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId44], - getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes56, (changes, diag2) => { const info = getInfo19(diag2.file, diag2.start); - if (info) doChange36(changes, diag2.file, info, context.preferences); + if (info) doChange36(changes, diag2.file, info, context2.preferences); }) }); function getInfo19(sourceFile, pos) { const name = getTokenAtPosition(sourceFile, pos); - if (!isIdentifier26(name)) return void 0; + if (!isIdentifier28(name)) return void 0; const { parent: parent2 } = name; if (isImportEqualsDeclaration(parent2) && isExternalModuleReference(parent2.moduleReference)) { return { importNode: parent2, name, moduleSpecifier: parent2.moduleReference.expression }; - } else if (isNamespaceImport5(parent2) && isImportDeclaration7(parent2.parent.parent)) { + } else if (isNamespaceImport5(parent2) && isImportDeclaration8(parent2.parent.parent)) { const importNode = parent2.parent.parent; return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; } @@ -198155,15 +201430,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes57, - getCodeActions: function getCodeActionsToUseBigintLiteral(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span)); + getCodeActions: function getCodeActionsToUseBigintLiteral(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange10(t, context2.sourceFile, context2.span)); if (changes.length > 0) { return [createCodeFixAction(fixId45, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId45, Diagnostics.Convert_all_to_bigint_numeric_literals)]; } }, fixIds: [fixId45], - getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes57, (changes, diag2) => makeChange10(changes, diag2.file, diag2)); + getAllCodeActions: (context2) => { + return codeFixAll(context2, errorCodes57, (changes, diag2) => makeChange10(changes, diag2.file, diag2)); } }); function makeChange10(changeTracker, sourceFile, span) { @@ -198179,14 +201454,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes58 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code]; registerCodeFix({ errorCodes: errorCodes58, - getCodeActions: function getCodeActionsToAddMissingTypeof(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToAddMissingTypeof(context2) { + const { sourceFile, span } = context2; const importType = getImportTypeNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange37(t, sourceFile, importType)); return [createCodeFixAction(fixId46, changes, Diagnostics.Add_missing_typeof, fixId46, Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId46], - getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes58, (changes, diag2) => doChange37(changes, context2.sourceFile, getImportTypeNode(diag2.file, diag2.start))) }); function getImportTypeNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); @@ -198210,18 +201485,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes59 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code]; registerCodeFix({ errorCodes: errorCodes59, - getCodeActions: function getCodeActionsToWrapJsxInFragment(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToWrapJsxInFragment(context2) { + const { sourceFile, span } = context2; const node = findNodeToFix(sourceFile, span.start); if (!node) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(t, sourceFile, node)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange38(t, sourceFile, node)); return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID2], - getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, diag2) => { - const node = findNodeToFix(context.sourceFile, diag2.start); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes59, (changes, diag2) => { + const node = findNodeToFix(context2.sourceFile, diag2.start); if (!node) return void 0; - doChange38(changes, context.sourceFile, node); + doChange38(changes, context2.sourceFile, node); }) }); function findNodeToFix(sourceFile, pos) { @@ -198259,12 +201534,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes60 = [Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator.code]; registerCodeFix({ errorCodes: errorCodes60, - getCodeActions: function getCodeActionsToWrapDecoratorExpressionInParentheses(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span.start)); + getCodeActions: function getCodeActionsToWrapDecoratorExpressionInParentheses(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange11(t, context2.sourceFile, context2.span.start)); return [createCodeFixAction(fixId47, changes, Diagnostics.Wrap_in_parentheses, fixId47, Diagnostics.Wrap_all_invalid_decorator_expressions_in_parentheses)]; }, fixIds: [fixId47], - getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, diag2) => makeChange11(changes, diag2.file, diag2.start)) + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes60, (changes, diag2) => makeChange11(changes, diag2.file, diag2.start)) }); function makeChange11(changeTracker, sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); @@ -198277,16 +201552,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes61 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; registerCodeFix({ errorCodes: errorCodes61, - getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) { - const { sourceFile, span } = context; + getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context2) { + const { sourceFile, span } = context2; const info = getInfo20(sourceFile, span.start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange39(t, sourceFile, info)); const name = idText(info.container.name); return [createCodeFixAction(fixId48, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId48, [Diagnostics.Convert_0_to_mapped_object_type, name])]; }, fixIds: [fixId48], - getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes61, (changes, diag2) => { const info = getInfo20(diag2.file, diag2.start); if (info) doChange39(changes, diag2.file, info); }) @@ -198309,7 +201584,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const mappedTypeParameter = factory.createTypeParameterDeclaration( /*modifiers*/ void 0, - cast(parameter.name, isIdentifier26), + cast(parameter.name, isIdentifier28), parameter.type ); const mappedIntersectionType = factory.createMappedTypeNode( @@ -198338,13 +201613,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes62, - getCodeActions(context) { - const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression16); + getCodeActions(context2) { + const callExpression = findAncestor(getTokenAtPosition(context2.sourceFile, context2.span.start), isCallExpression16); if (!callExpression) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end }); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => { + t.deleteRange(context2.sourceFile, { pos: callExpression.expression.end, end: callExpression.end }); }); return [createCodeFixActionWithoutFixAll(fixId49, changes, Diagnostics.Remove_parentheses)]; }, @@ -198356,15 +201631,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; registerCodeFix({ errorCodes: errorCodes63, - getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange12(t, context.sourceFile, context.span)); + getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange12(t, context2.sourceFile, context2.span)); if (changes.length > 0) { return [createCodeFixAction(fixId50, changes, Diagnostics.Remove_unnecessary_await, fixId50, Diagnostics.Remove_all_unnecessary_uses_of_await)]; } }, fixIds: [fixId50], - getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange12(changes, diag2.file, diag2)); + getAllCodeActions: (context2) => { + return codeFixAll(context2, errorCodes63, (changes, diag2) => makeChange12(changes, diag2.file, diag2)); } }); function makeChange12(changeTracker, sourceFile, span) { @@ -198378,14 +201653,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } let expressionToReplace = awaitExpression; - const hasSurroundingParens = isParenthesizedExpression7(awaitExpression.parent); + const hasSurroundingParens = isParenthesizedExpression8(awaitExpression.parent); if (hasSurroundingParens) { const leftMostExpression = getLeftmostExpression( awaitExpression.expression, /*stopAtCallExpressions*/ false ); - if (isIdentifier26(leftMostExpression)) { + if (isIdentifier28(leftMostExpression)) { const precedingToken = findPrecedingToken(awaitExpression.parent.pos, sourceFile); if (precedingToken && precedingToken.kind !== 105) { expressionToReplace = awaitExpression.parent; @@ -198399,28 +201674,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes64, fixIds: [fixId51], - getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context); + getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => { + return splitTypeOnlyImport(t, getImportDeclaration2(context2.sourceFile, context2.span), context2); }); if (changes.length) { return [createCodeFixAction(fixId51, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId51, Diagnostics.Split_all_invalid_type_only_imports)]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes64, (changes, error210) => { - splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error210), context); + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes64, (changes, error210) => { + splitTypeOnlyImport(changes, getImportDeclaration2(context2.sourceFile, error210), context2); }) }); function getImportDeclaration2(sourceFile, span) { - return findAncestor(getTokenAtPosition(sourceFile, span.start), isImportDeclaration7); + return findAncestor(getTokenAtPosition(sourceFile, span.start), isImportDeclaration8); } - function splitTypeOnlyImport(changes, importDeclaration, context) { + function splitTypeOnlyImport(changes, importDeclaration, context2) { if (!importDeclaration) { return; } const importClause = Debug.checkDefined(importDeclaration.importClause); changes.replaceNode( - context.sourceFile, + context2.sourceFile, importDeclaration, factory.updateImportDeclaration( importDeclaration, @@ -198437,7 +201712,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) ); changes.insertNodeAfter( - context.sourceFile, + context2.sourceFile, importDeclaration, factory.createImportDeclaration( /*modifiers*/ @@ -198458,18 +201733,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes65 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code]; registerCodeFix({ errorCodes: errorCodes65, - getCodeActions: function getCodeActionsToConvertConstToLet(context) { - const { sourceFile, span, program } = context; + getCodeActions: function getCodeActionsToConvertConstToLet(context2) { + const { sourceFile, span, program } = context2; const info = getInfo21(sourceFile, span.start, program); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange40(t, sourceFile, info.token)); return [createCodeFixActionMaybeFixAll(fixId52, changes, Diagnostics.Convert_const_to_let, fixId52, Diagnostics.Convert_all_const_to_let)]; }, - getAllCodeActions: (context) => { - const { program } = context; + getAllCodeActions: (context2) => { + const { program } = context2; const seen = /* @__PURE__ */ new Set(); - return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes65, (diag2) => { + return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context2, (changes) => { + eachDiagnostic(context2, errorCodes65, (diag2) => { const info = getInfo21(diag2.file, diag2.start, program); if (info) { if (addToSeen(seen, getSymbolId(info.symbol))) { @@ -198504,11 +201779,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var errorCodes66 = [expectedErrorCode]; registerCodeFix({ errorCodes: errorCodes66, - getCodeActions(context) { - const { sourceFile } = context; - const info = getInfo22(sourceFile, context.span.start, context.errorCode); + getCodeActions(context2) { + const { sourceFile } = context2; + const info = getInfo22(sourceFile, context2.span.start, context2.errorCode); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => doChange41(t, sourceFile, info)); return [createCodeFixAction( fixId53, changes, @@ -198518,14 +201793,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )]; }, fixIds: [fixId53], - getAllCodeActions: (context) => codeFixAll(context, errorCodes66, (changes, diag2) => { + getAllCodeActions: (context2) => codeFixAll(context2, errorCodes66, (changes, diag2) => { const info = getInfo22(diag2.file, diag2.start, diag2.code); - if (info) doChange41(changes, context.sourceFile, info); + if (info) doChange41(changes, context2.sourceFile, info); }) }); function getInfo22(sourceFile, pos, _) { const node = getTokenAtPosition(sourceFile, pos); - return node.kind === 27 && node.parent && (isObjectLiteralExpression12(node.parent) || isArrayLiteralExpression7(node.parent)) ? { node } : void 0; + return node.kind === 27 && node.parent && (isObjectLiteralExpression13(node.parent) || isArrayLiteralExpression7(node.parent)) ? { node } : void 0; } function doChange41(changes, sourceFile, { node }) { const newNode = factory.createToken( @@ -198543,19 +201818,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes67, fixIds: [fixId54], - getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange13(t, context.sourceFile, context.span, context.program)); + getCodeActions(context2) { + const changes = ts_textChanges_exports.ChangeTracker.with(context2, (t) => makeChange13(t, context2.sourceFile, context2.span, context2.program)); if (changes.length > 0) { return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId54, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)]; } }, - getAllCodeActions(context) { - return codeFixAll(context, errorCodes67, (changes, diag2) => makeChange13(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set())); + getAllCodeActions(context2) { + return codeFixAll(context2, errorCodes67, (changes, diag2) => makeChange13(changes, diag2.file, diag2, context2.program, /* @__PURE__ */ new Set())); } }); function makeChange13(changes, sourceFile, span, program, seen) { const node = getTokenAtPosition(sourceFile, span.start); - if (!isIdentifier26(node) || !isCallExpression16(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0) return; + if (!isIdentifier28(node) || !isCallExpression16(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0) return; const checker = program.getTypeChecker(); const symbol2 = checker.getSymbolAtLocation(node); const decl = symbol2 == null ? void 0 : symbol2.valueDeclaration; @@ -198592,9 +201867,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getEffectiveTypeArguments(node) { var _a3; if (isInJSFile(node)) { - if (isParenthesizedExpression7(node.parent)) { + if (isParenthesizedExpression8(node.parent)) { const jsDocType = (_a3 = getJSDocTypeTag(node.parent)) == null ? void 0 : _a3.typeExpression.type; - if (jsDocType && isTypeReferenceNode3(jsDocType) && isIdentifier26(jsDocType.typeName) && idText(jsDocType.typeName) === "Promise") { + if (jsDocType && isTypeReferenceNode3(jsDocType) && isIdentifier28(jsDocType.typeName) && idText(jsDocType.typeName) === "Promise") { return jsDocType.typeArguments; } } @@ -198782,7 +202057,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const compilerOptions = program.getCompilerOptions(); const checker = program.getTypeChecker(); const incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a3 = host.getIncompleteCompletionsCache) == null ? void 0 : _a3.call(host) : void 0; - if (incompleteCompletionsCache && completionKind === 3 && previousToken && isIdentifier26(previousToken)) { + if (incompleteCompletionsCache && completionKind === 3 && previousToken && isIdentifier28(previousToken)) { const incompleteContinuation = continuePreviousIncompleteResponse(incompleteCompletionsCache, sourceFile, previousToken, program, host, preferences, cancellationToken, position); if (incompleteContinuation) { return incompleteContinuation; @@ -198890,7 +202165,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*isForImportStatementCompletion*/ false, isValidTypeOnlyAliasUseSite(location), - (context) => { + (context2) => { const entries = mapDefined(previousResponse.entries, (entry) => { var _a3; if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) { @@ -198901,7 +202176,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const { origin } = Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)); const info = exportMap.get(file2.path, entry.data.exportMapKey); - const result = info && context.tryResolve(info, !isExternalModuleNameRelative(stripQuotes(origin.moduleSymbol.name))); + const result = info && context2.tryResolve(info, !isExternalModuleNameRelative(stripQuotes(origin.moduleSymbol.name))); if (result === "skipped") return entry; if (!result || result === "failed") { (_a3 = host.log) == null ? void 0 : _a3.call(host, `Unexpected failure resolving auto import for '${entry.name}' from '${entry.source}'`); @@ -198917,7 +202192,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} entry.sourceDisplay = [textPart(newOrigin.moduleSpecifier)]; return entry; }); - if (!context.skippedAny()) { + if (!context2.skippedAny()) { previousResponse.isIncomplete = void 0; } return entries; @@ -198960,7 +202235,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (getJSDocParameterTags(param).length) { return void 0; } - if (isIdentifier26(param.name)) { + if (isIdentifier28(param.name)) { const tabstopCounter = { tabstop: 1 }; const paramName = param.name.text; let displayText = getJSDocParamAnnotation( @@ -199043,7 +202318,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } }); } - function generateJSDocParamTagsForDestructuring(path, pattern, initializer3, dotDotDotToken, isJs, isSnippet, checker, options, preferences) { + function generateJSDocParamTagsForDestructuring(path, pattern2, initializer3, dotDotDotToken, isJs, isSnippet, checker, options, preferences) { if (!isJs) { return [ getJSDocParamAnnotation( @@ -199061,9 +202336,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) ]; } - return patternWorker(path, pattern, initializer3, dotDotDotToken, { tabstop: 1 }); - function patternWorker(path2, pattern2, initializer22, dotDotDotToken2, counter) { - if (isObjectBindingPattern3(pattern2) && !dotDotDotToken2) { + return patternWorker(path, pattern2, initializer3, dotDotDotToken, { tabstop: 1 }); + function patternWorker(path2, pattern22, initializer22, dotDotDotToken2, counter) { + if (isObjectBindingPattern3(pattern22) && !dotDotDotToken2) { const oldTabstop = counter.tabstop; const childCounter = { tabstop: oldTabstop }; const rootParam = getJSDocParamAnnotation( @@ -199080,7 +202355,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} childCounter ); let childTags = []; - for (const element of pattern2.elements) { + for (const element of pattern22.elements) { const elementTags = elementWorker(path2, element, childCounter); if (!elementTags) { childTags = void 0; @@ -199111,7 +202386,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; } function elementWorker(path2, element, counter) { - if (!element.propertyName && isIdentifier26(element.name) || isIdentifier26(element.name)) { + if (!element.propertyName && isIdentifier28(element.name) || isIdentifier28(element.name)) { const propertyName = element.propertyName ? tryGetTextOfPropertyName(element.propertyName) : element.name.text; if (!propertyName) { return void 0; @@ -199492,7 +202767,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; case 197: const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference); - return exp && (isIdentifier26(exp) ? exp : factory.createParenthesizedExpression(exp)); + return exp && (isIdentifier28(exp) ? exp : factory.createParenthesizedExpression(exp)); case 187: return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference); case 206: @@ -199501,7 +202776,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } function entityNameToExpression(entityName, languageVersion, quotePreference) { - if (isIdentifier26(entityName)) { + if (isIdentifier28(entityName)) { return entityName; } const unescapedName = unescapeLeadingUnderscores(entityName.right.escapedText); @@ -199661,7 +202936,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} hasAction = true; } if (completionKind === 0 && contextToken && ((_a3 = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a3.kind) !== 28) { - if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment6(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment11)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment6(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) { + if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment7(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment12)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment7(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) { source = "ObjectLiteralMemberWithComma/"; hasAction = true; } @@ -199883,7 +203158,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (presentDecorators == null ? void 0 : presentDecorators.length) { const lastNode = completionNodes[completionNodes.length - 1]; if (canHaveDecorators(lastNode)) { - completionNodes[completionNodes.length - 1] = factory.replaceDecoratorsAndModifiers(lastNode, presentDecorators.concat(getModifiers(lastNode) || [])); + completionNodes[completionNodes.length - 1] = factory.replaceDecoratorsAndModifiers(lastNode, presentDecorators.concat(getModifiers2(lastNode) || [])); } } const format = 1 | 131072; @@ -199936,7 +203211,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isModifier(node)) { return node.kind; } - if (isIdentifier26(node)) { + if (isIdentifier28(node)) { const originalKeywordKind = identifierToKeywordKind(node); if (originalKeywordKind && isModifierKind(originalKeywordKind)) { return originalKeywordKind; @@ -200381,7 +203656,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function shouldIncludeSymbol(symbol2, symbolToSortTextMap2) { var _a3; let allFlags = symbol2.flags; - if (location.parent && isExportAssignment3(location.parent)) { + if (location.parent && isExportAssignment4(location.parent)) { return true; } if (closestSymbolDeclaration && tryCast(closestSymbolDeclaration, isVariableDeclaration7)) { @@ -200712,7 +203987,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} host, program, formatContext, - previousToken && isIdentifier26(previousToken) ? previousToken.getStart(sourceFile) : position, + previousToken && isIdentifier28(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken ); @@ -201086,7 +204361,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const isImportType = isLiteralImportTypeNode(node); const isTypeLocation = isImportType && !node.isTypeOf || isPartOfTypeNode(node.parent) || isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node); - if (isEntityName(node) || isImportType || isPropertyAccessExpression16(node)) { + if (isEntityName(node) || isImportType || isPropertyAccessExpression17(node)) { const isNamespaceName = isModuleDeclaration(node.parent); if (isNamespaceName) { isNewIdentifierLocation = true; @@ -201289,7 +204564,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getLeftMostName(e) { - return isIdentifier26(e) ? e : isPropertyAccessExpression16(e) ? getLeftMostName(e.expression) : void 0; + return isIdentifier28(e) ? e : isPropertyAccessExpression17(e) ? getLeftMostName(e.expression) : void 0; } function tryGetGlobalSymbols() { const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetImportAttributesCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1); @@ -201427,7 +204702,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } flags |= 1; const isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken && importStatementCompletion; - const lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && isIdentifier26(previousToken) ? previousToken.text.toLowerCase() : ""; + const lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && isIdentifier28(previousToken) ? previousToken.text.toLowerCase() : ""; const moduleSpecifierCache = (_a3 = host.getModuleSpecifierCache) == null ? void 0 : _a3.call(host); const exportInfo = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); const packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) == null ? void 0 : _b.call(host); @@ -201441,7 +204716,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} preferences, !!importStatementCompletion, isValidTypeOnlyAliasUseSite(location), - (context) => { + (context2) => { exportInfo.search( sourceFile.path, /*preferCapitalized*/ @@ -201464,7 +204739,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!info.length) { return; } - const result = context.tryResolve(info, isFromAmbientModule) || {}; + const result = context2.tryResolve(info, isFromAmbientModule) || {}; if (result === "failed") return; let exportInfo2 = info[0], moduleSpecifier; if (result !== "skipped") { @@ -201485,9 +204760,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); } ); - hasUnresolvedAutoImports = context.skippedAny(); - flags |= context.resolvedAny() ? 8 : 0; - flags |= context.resolvedBeyondLimit() ? 16 : 0; + hasUnresolvedAutoImports = context2.skippedAny(); + flags |= context2.resolvedAny() ? 8 : 0; + flags |= context2.resolvedBeyondLimit() ? 16 : 0; } ); function isImportableExportInfo(info) { @@ -202063,7 +205338,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; } if (isConstructorParameterCompletion(contextToken2)) { - if (!isIdentifier26(contextToken2) || isParameterPropertyModifier(keywordForNode(contextToken2)) || isCurrentlyEditingNode(contextToken2)) { + if (!isIdentifier28(contextToken2) || isParameterPropertyModifier(keywordForNode(contextToken2)) || isCurrentlyEditingNode(contextToken2)) { return false; } } @@ -202101,7 +205376,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; } } - return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment6(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration2(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end)); + return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment7(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration2(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end)); } function isPreviousPropertyDeclarationTerminated(contextToken2, position2) { return contextToken2.kind !== 64 && (contextToken2.kind === 27 || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile)); @@ -202133,7 +205408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} continue; } let existingName; - if (isSpreadAssignment6(m)) { + if (isSpreadAssignment7(m)) { setMembersDeclaredBySpreadAssignment(m, membersDeclaredBySpreadAssignment); } else if (isBindingElement(m) && m.propertyName) { if (m.propertyName.kind === 80) { @@ -202258,36 +205533,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 19: // const x = { | case 28: - if (isObjectLiteralExpression12(parent2) || isObjectBindingPattern3(parent2)) { + if (isObjectLiteralExpression13(parent2) || isObjectBindingPattern3(parent2)) { return parent2; } break; case 42: - return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression12) : void 0; + return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression13) : void 0; case 134: - return tryCast(parent2.parent, isObjectLiteralExpression12); + return tryCast(parent2.parent, isObjectLiteralExpression13); case 80: - if (contextToken.text === "async" && isShorthandPropertyAssignment6(contextToken.parent)) { + if (contextToken.text === "async" && isShorthandPropertyAssignment7(contextToken.parent)) { return contextToken.parent.parent; } else { - if (isObjectLiteralExpression12(contextToken.parent.parent) && (isSpreadAssignment6(contextToken.parent) || isShorthandPropertyAssignment6(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) { + if (isObjectLiteralExpression13(contextToken.parent.parent) && (isSpreadAssignment7(contextToken.parent) || isShorthandPropertyAssignment7(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) { return contextToken.parent.parent; } - const ancestorNode2 = findAncestor(parent2, isPropertyAssignment11); - if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression12(ancestorNode2.parent)) { + const ancestorNode2 = findAncestor(parent2, isPropertyAssignment12); + if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression13(ancestorNode2.parent)) { return ancestorNode2.parent; } } break; default: - if (((_a3 = parent2.parent) == null ? void 0 : _a3.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression12(parent2.parent.parent)) { + if (((_a3 = parent2.parent) == null ? void 0 : _a3.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression13(parent2.parent.parent)) { return parent2.parent.parent; } - if (isSpreadAssignment6(parent2) && isObjectLiteralExpression12(parent2.parent)) { + if (isSpreadAssignment7(parent2) && isObjectLiteralExpression13(parent2.parent)) { return parent2.parent; } - const ancestorNode = findAncestor(parent2, isPropertyAssignment11); - if (contextToken.kind !== 59 && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression12(ancestorNode.parent)) { + const ancestorNode = findAncestor(parent2, isPropertyAssignment12); + if (contextToken.kind !== 59 && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression13(ancestorNode.parent)) { return ancestorNode.parent; } } @@ -202454,7 +205729,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return kind === 134 || kind === 135 || kind === 160 || kind === 130 || kind === 152 || kind === 156 || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { - return isIdentifier26(node) ? identifierToKeywordKind(node) ?? 0 : node.kind; + return isIdentifier28(node) ? identifierToKeywordKind(node) ?? 0 : node.kind; } function getContextualKeywords(contextToken, position) { const entries = []; @@ -202463,7 +205738,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parent2 = contextToken.parent; const tokenLine = file2.getLineAndCharacterOfPosition(contextToken.end).line; const currentLine = file2.getLineAndCharacterOfPosition(position).line; - if ((isImportDeclaration7(parent2) || isExportDeclaration2(parent2) && parent2.moduleSpecifier) && contextToken === parent2.moduleSpecifier && tokenLine === currentLine) { + if ((isImportDeclaration8(parent2) || isExportDeclaration3(parent2) && parent2.moduleSpecifier) && contextToken === parent2.moduleSpecifier && tokenLine === currentLine) { entries.push({ name: tokenToString( 132 @@ -202535,7 +205810,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (!contextToken) return void 0; - if (location.kind === 137 || isIdentifier26(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { + if (location.kind === 137 || isIdentifier28(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { return findAncestor(contextToken, isClassLike); } switch (contextToken.kind) { @@ -202555,7 +205830,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return location; } const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword; - return isValidKeyword(contextToken.kind) || contextToken.kind === 42 || isIdentifier26(contextToken) && isValidKeyword( + return isValidKeyword(contextToken.kind) || contextToken.kind === 42 || isIdentifier28(contextToken) && isValidKeyword( identifierToKeywordKind(contextToken) ?? 0 /* Unknown */ ) ? contextToken.parent.parent : void 0; @@ -202687,7 +205962,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} isKeywordOnlyCompletion, keywordCompletion, isNewIdentifierLocation: !!(candidate || keywordCompletion === 156), - isTopLevelTypeOnly: !!((_b = (_a3 = tryCast(candidate, isImportDeclaration7)) == null ? void 0 : _a3.importClause) == null ? void 0 : _b.isTypeOnly) || !!((_c = tryCast(candidate, isImportEqualsDeclaration)) == null ? void 0 : _c.isTypeOnly), + isTopLevelTypeOnly: !!((_b = (_a3 = tryCast(candidate, isImportDeclaration8)) == null ? void 0 : _a3.importClause) == null ? void 0 : _b.isTypeOnly) || !!((_c = tryCast(candidate, isImportEqualsDeclaration)) == null ? void 0 : _c.isTypeOnly), couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate) }; @@ -202695,7 +205970,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parent2 = contextToken.parent; if (isImportEqualsDeclaration(parent2)) { const lastToken = parent2.getLastToken(sourceFile); - if (isIdentifier26(contextToken) && lastToken !== contextToken) { + if (isIdentifier28(contextToken) && lastToken !== contextToken) { keywordCompletion = 161; isKeywordOnlyCompletion = true; return void 0; @@ -202706,7 +205981,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (couldBeTypeOnlyImportSpecifier(parent2, contextToken) && canCompleteFromNamedBindings(parent2.parent)) { return parent2; } - if (isNamedImports5(parent2) || isNamespaceImport5(parent2)) { + if (isNamedImports6(parent2) || isNamespaceImport5(parent2)) { if (!parent2.parent.isTypeOnly && (contextToken.kind === 19 || contextToken.kind === 102 || contextToken.kind === 28)) { keywordCompletion = 156; } @@ -202720,7 +205995,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } - if (isExportDeclaration2(parent2) && contextToken.kind === 42 || isNamedExports2(parent2) && contextToken.kind === 20) { + if (isExportDeclaration3(parent2) && contextToken.kind === 42 || isNamedExports2(parent2) && contextToken.kind === 20) { isKeywordOnlyCompletion = true; keywordCompletion = 161; return void 0; @@ -202729,7 +206004,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} keywordCompletion = 156; return contextToken; } - if (isImportKeyword(contextToken) && isImportDeclaration7(parent2)) { + if (isImportKeyword(contextToken) && isImportDeclaration8(parent2)) { keywordCompletion = 156; return isModuleSpecifierMissingOrEmpty(parent2.moduleSpecifier) ? parent2 : void 0; } @@ -202739,7 +206014,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getSingleLineReplacementSpanForImportCompletionNode(node) { var _a3; if (!node) return void 0; - const top = findAncestor(node, or(isImportDeclaration7, isImportEqualsDeclaration, isJSDocImportTag)) ?? node; + const top = findAncestor(node, or(isImportDeclaration8, isImportEqualsDeclaration, isJSDocImportTag)) ?? node; const sourceFile = top.getSourceFile(); if (rangeIsOnSingleLine(top, sourceFile)) { return createTextSpanFromNode(top, sourceFile); @@ -202760,7 +206035,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getPotentiallyInvalidImportSpecifier(namedBindings) { var _a3; return find( - (_a3 = tryCast(namedBindings, isNamedImports5)) == null ? void 0 : _a3.elements, + (_a3 = tryCast(namedBindings, isNamedImports6)) == null ? void 0 : _a3.elements, (e) => { var _a22; return !e.propertyName && isStringANonContextualKeyword(e.name.text) && ((_a22 = findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) == null ? void 0 : _a22.kind) !== 28; @@ -202774,7 +206049,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { return false; } - if (isNamedImports5(namedBindings)) { + if (isNamedImports6(namedBindings)) { const invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); const validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; return validImports < 2; @@ -203062,7 +206337,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return fromUnionableLiteralType(grandParent); } case 304: - if (isObjectLiteralExpression12(parent2.parent) && parent2.name === node) { + if (isObjectLiteralExpression13(parent2.parent) && parent2.name === node) { return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent); } return fromContextualType() || fromContextualType( @@ -203658,11 +206933,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} moduleSpecifierResolutionHost, keys, (key) => { - const pattern = getPatternFromFirstMatchingCondition(lookupTable[key], conditions); - if (pattern === void 0) { + const pattern2 = getPatternFromFirstMatchingCondition(lookupTable[key], conditions); + if (pattern2 === void 0) { return void 0; } - return singleElementArray(endsWith(key, "/") && endsWith(pattern, "/") ? pattern + "*" : pattern); + return singleElementArray(endsWith(key, "/") && endsWith(pattern2, "/") ? pattern2 + "*" : pattern2); }, comparePatternKeys ); @@ -203675,8 +206950,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (target && typeof target === "object" && !isArray(target)) { for (const condition in target) { if (condition === "default" || conditions.includes(condition) || isApplicableVersionedTypesKey(conditions, condition)) { - const pattern = target[condition]; - return getPatternFromFirstMatchingCondition(pattern, conditions); + const pattern2 = target[condition]; + return getPatternFromFirstMatchingCondition(pattern2, conditions); } } } @@ -203703,21 +206978,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} parsedPath.prefix, "directory" /* directory */ - ) : flatMap(patterns, (pattern) => { + ) : flatMap(patterns, (pattern2) => { var _a3; - return (_a3 = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost)) == null ? void 0 : _a3.map(({ name, ...rest }) => ({ name: parsedPath.prefix + name + parsedPath.suffix, ...rest })); + return (_a3 = getModulesForPathsPattern("", packageDirectory, pattern2, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost)) == null ? void 0 : _a3.map(({ name, ...rest }) => ({ name: parsedPath.prefix + name + parsedPath.suffix, ...rest })); }); } - return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost)); + return flatMap(patterns, (pattern2) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern2, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost)); function justPathMappingName(name, kind) { return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray; } } - function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost) { + function getModulesForPathsPattern(fragment, packageDirectory, pattern2, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost) { if (!host.readDirectory) { return void 0; } - const parsed = tryParsePattern(pattern); + const parsed = tryParsePattern(pattern2); if (parsed === void 0 || isString(parsed)) { return void 0; } @@ -203743,7 +207018,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} normalizedSuffix ].filter(isString); const includeGlobs = normalizedSuffix ? matchingSuffixes.map((suffix) => "**/*" + suffix) : ["./*"]; - const isExportsOrImportsWildcard = (isExports || isImports) && endsWith(pattern, "/*"); + const isExportsOrImportsWildcard = (isExports || isImports) && endsWith(pattern2, "/*"); let matches2 = getMatchesWithPrefix(baseDirectory); if (possibleInputBaseDirectoryForOutDir) { matches2 = concatenate(matches2, getMatchesWithPrefix(possibleInputBaseDirectoryForOutDir)); @@ -203924,7 +207199,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return fragment.includes(directorySeparator); } function isRequireCallArgument(node) { - return isCallExpression16(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier26(node.parent.expression) && node.parent.expression.escapedText === "require"; + return isCallExpression16(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier28(node.parent.expression) && node.parent.expression.escapedText === "require"; } var ts_FindAllReferences_exports = {}; __export2(ts_FindAllReferences_exports, { @@ -204092,7 +207367,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isExported2(node, stopAtAmbientModule = false) { return findAncestor(node, (node2) => { if (stopAtAmbientModule && isAmbientModuleDeclaration(node2)) return "quit"; - return canHaveModifiers(node2) && some(node2.modifiers, isExportModifier); + return canHaveModifiers2(node2) && some(node2.modifiers, isExportModifier); }); } function handleNamespaceImport(importDeclaration, name, isReExport, alreadyAddedDirect) { @@ -204236,7 +207511,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function findNamespaceReExports(sourceFileLike, name, checker) { const namespaceImportSymbol = checker.getSymbolAtLocation(name); return !!forEachPossibleImportOrExportStatement(sourceFileLike, (statement) => { - if (!isExportDeclaration2(statement)) return; + if (!isExportDeclaration3(statement)) return; const { exportClause, moduleSpecifier } = statement; return !moduleSpecifier && exportClause && isNamedExports2(exportClause) && exportClause.elements.some((element) => checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol); }); @@ -204358,9 +207633,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 0 /* Named */ ); - } else if (isExportAssignment3(parent2)) { + } else if (isExportAssignment4(parent2)) { return getExportAssignmentExport(parent2); - } else if (isExportAssignment3(grandparent)) { + } else if (isExportAssignment4(grandparent)) { return getExportAssignmentExport(grandparent); } else if (isBinaryExpression4(parent2)) { return getSpecialPropertyExport( @@ -204436,7 +207711,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return checker.getImmediateAliasedSymbol(importedSymbol); } const decl = Debug.checkDefined(importedSymbol.valueDeclaration); - if (isExportAssignment3(decl)) { + if (isExportAssignment4(decl)) { return (_a3 = tryCast(decl.expression, canHaveSymbol)) == null ? void 0 : _a3.symbol; } else if (isBinaryExpression4(decl)) { return (_b = tryCast(decl.right, canHaveSymbol)) == null ? void 0 : _b.symbol; @@ -204448,7 +207723,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getExportNode(parent2, node) { const declaration = isVariableDeclaration7(parent2) ? parent2 : isBindingElement(parent2) ? walkUpBindingElementsAndPatterns(parent2) : void 0; if (declaration) { - return parent2.name !== node ? void 0 : isCatchClause(declaration.parent) ? void 0 : isVariableStatement11(declaration.parent.parent) ? declaration.parent.parent : void 0; + return parent2.name !== node ? void 0 : isCatchClause(declaration.parent) ? void 0 : isVariableStatement12(declaration.parent.parent) ? declaration.parent.parent : void 0; } else { return parent2; } @@ -204481,9 +207756,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} for (const declaration of symbol2.declarations) { if (isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { return checker.getExportSpecifierLocalTargetSymbol(declaration) || symbol2; - } else if (isPropertyAccessExpression16(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) { + } else if (isPropertyAccessExpression17(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) { return checker.getSymbolAtLocation(declaration); - } else if (isShorthandPropertyAssignment6(declaration) && isBinaryExpression4(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2) { + } else if (isShorthandPropertyAssignment7(declaration) && isBinaryExpression4(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2) { return checker.getExportSpecifierLocalTargetSymbol(declaration.name); } } @@ -204545,7 +207820,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return getContextNode(node); } if (!node.parent) return void 0; - if (!isDeclaration(node.parent) && !isExportAssignment3(node.parent)) { + if (!isDeclaration(node.parent) && !isExportAssignment4(node.parent)) { if (isInJSFile(node)) { const binaryExpression = isBinaryExpression4(node.parent) ? node.parent : isAccessExpression(node.parent) && isBinaryExpression4(node.parent.parent) && node.parent.parent.left === node.parent ? node.parent.parent : void 0; if (binaryExpression && getAssignmentDeclarationKind(binaryExpression) !== 0) { @@ -204567,7 +207842,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return propertyName ? getContextNode(propertyName.parent) : void 0; } if (node.parent.name === node || // node is name of declaration, use parent - isConstructorDeclaration2(node.parent) || isExportAssignment3(node.parent) || // Property name of the import export specifier or binding pattern, use parent + isConstructorDeclaration2(node.parent) || isExportAssignment4(node.parent) || // Property name of the import export specifier or binding pattern, use parent (isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export node.kind === 90 && hasSyntacticModifier( node.parent, @@ -204582,7 +207857,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!node) return void 0; switch (node.kind) { case 261: - return !isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : isVariableStatement11(node.parent.parent) ? node.parent.parent : isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; + return !isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : isVariableStatement12(node.parent.parent) ? node.parent.parent : isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; case 209: return getContextNode(node.parent.parent); case 277: @@ -204619,9 +207894,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return node; } } - function toContextSpan(textSpan, sourceFile, context) { - if (!context) return void 0; - const contextSpan = isContextWithStartAndEndNode(context) ? getTextSpan(context.start, sourceFile, context.end) : getTextSpan(context, sourceFile); + function toContextSpan(textSpan, sourceFile, context2) { + if (!context2) return void 0; + const contextSpan = isContextWithStartAndEndNode(context2) ? getTextSpan(context2.start, sourceFile, context2.end) : getTextSpan(context2, sourceFile); return contextSpan.start !== textSpan.start || contextSpan.length !== textSpan.length ? { contextSpan } : void 0; } var FindReferencesUse = /* @__PURE__ */ ((FindReferencesUse2) => { @@ -204780,7 +208055,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return Debug.assertNever(def); } })(); - const { sourceFile, textSpan, name, kind, displayParts, context } = info; + const { sourceFile, textSpan, name, kind, displayParts, context: context2 } = info; return { containerKind: "", containerName: "", @@ -204789,7 +208064,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} name, textSpan, displayParts, - ...toContextSpan(textSpan, sourceFile, context) + ...toContextSpan(textSpan, sourceFile, context2) }; } function getFileAndTextSpanFromNode(node) { @@ -204842,11 +208117,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) { - if (entry.kind !== 0 && (isIdentifier26(originalNode) || isStringLiteralLike4(originalNode))) { + if (entry.kind !== 0 && (isIdentifier28(originalNode) || isStringLiteralLike4(originalNode))) { const { node, kind } = entry; const parent2 = node.parent; const name = originalNode.text; - const isShorthandAssignment = isShorthandPropertyAssignment6(parent2); + const isShorthandAssignment = isShorthandPropertyAssignment7(parent2); if (isShorthandAssignment || isObjectBindingElementWithoutPropertyName(parent2) && parent2.name === node && parent2.dotDotDotToken === void 0) { const prefixColon = { prefixText: name + ": " }; const suffixColon = { suffixText: ": " + name }; @@ -204858,7 +208133,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isShorthandAssignment) { const grandParent = parent2.parent; - if (isObjectLiteralExpression12(grandParent) && isBinaryExpression4(grandParent.parent) && isModuleExportsAccessExpression(grandParent.parent.left)) { + if (isObjectLiteralExpression13(grandParent) && isBinaryExpression4(grandParent.parent) && isModuleExportsAccessExpression(grandParent.parent.left)) { return prefixColon; } return suffixColon; @@ -205256,7 +208531,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} for (const decl of exported.declarations) { const sourceFile = decl.getSourceFile(); if (sourceFilesSet.has(sourceFile.fileName)) { - const node = isBinaryExpression4(decl) && isPropertyAccessExpression16(decl.left) ? decl.left.expression : isExportAssignment3(decl) ? Debug.checkDefined(findChildOfKind(decl, 95, sourceFile)) : getNameOfDeclaration(decl) || decl; + const node = isBinaryExpression4(decl) && isPropertyAccessExpression17(decl.left) ? decl.left.expression : isExportAssignment4(decl) ? Debug.checkDefined(findChildOfKind(decl, 95, sourceFile)) : getNameOfDeclaration(decl) || decl; references.push(nodeEntry(node)); } } @@ -205528,15 +208803,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} cb(importLocation); } for (const singleReference of singleReferences) { - if (isIdentifier26(singleReference) && isImportTypeNode(singleReference.parent)) { + if (isIdentifier28(singleReference) && isImportTypeNode(singleReference.parent)) { cb(singleReference); } } for (const indirectUser of indirectUsers) { for (const node of getPossibleSymbolReferenceNodes(indirectUser, isDefaultExport ? "default" : exportName)) { const symbol2 = checker.getSymbolAtLocation(node); - const hasExportAssignmentDeclaration = some(symbol2 == null ? void 0 : symbol2.declarations, (d) => tryCast(d, isExportAssignment3) ? true : false); - if (isIdentifier26(node) && !isImportOrExportSpecifier(node.parent) && (symbol2 === exportSymbol || hasExportAssignmentDeclaration)) { + const hasExportAssignmentDeclaration = some(symbol2 == null ? void 0 : symbol2.declarations, (d) => tryCast(d, isExportAssignment4) ? true : false); + if (isIdentifier28(node) && !isImportOrExportSpecifier(node.parent) && (symbol2 === exportSymbol || hasExportAssignmentDeclaration)) { cb(node); } } @@ -205546,7 +208821,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function shouldAddSingleReference(singleRef, state) { if (!hasMatchingMeaning(singleRef, state)) return false; if (state.options.use !== 2) return true; - if (!isIdentifier26(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false; + if (!isIdentifier28(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false; return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef)); } function searchForImportedSymbol(symbol2, state) { @@ -205626,7 +208901,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const symbol2 = isParameterPropertyDeclaration(definition.parent, definition.parent.parent) ? first(checker.getSymbolsOfParameterPropertyDeclaration(definition.parent, definition.text)) : checker.getSymbolAtLocation(definition); if (!symbol2) return void 0; for (const token of getPossibleSymbolReferenceNodes(sourceFile, symbol2.name, searchContainer)) { - if (!isIdentifier26(token) || token === definition || token.escapedText !== definition.escapedText) continue; + if (!isIdentifier28(token) || token === definition || token.escapedText !== definition.escapedText) continue; const referenceSymbol = checker.getSymbolAtLocation(token); if (referenceSymbol === symbol2 || checker.getShorthandAssignmentValueSymbol(token.parent) === symbol2 || isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol2) { const res = cb(token); @@ -205659,11 +208934,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } Core2.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile; function someSignatureUsage(signature, sourceFiles, checker, cb) { - if (!signature.name || !isIdentifier26(signature.name)) return false; + if (!signature.name || !isIdentifier28(signature.name)) return false; const symbol2 = Debug.checkDefined(checker.getSymbolAtLocation(signature.name)); for (const sourceFile of sourceFiles) { for (const name of getPossibleSymbolReferenceNodes(sourceFile, symbol2.name)) { - if (!isIdentifier26(name) || name === signature.name || name.escapedText !== signature.name.escapedText) continue; + if (!isIdentifier28(name) || name === signature.name || name.escapedText !== signature.name.escapedText) continue; const called = climbPastPropertyAccess(name); const call = isCallExpression16(called.parent) && called.parent.expression === called ? called.parent : void 0; const referenceSymbol = checker.getSymbolAtLocation(name); @@ -206064,7 +209339,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { addIfImplementation(body); } - } else if (isAssertionExpression(typeHavingNode) || isSatisfiesExpression5(typeHavingNode)) { + } else if (isAssertionExpression(typeHavingNode) || isSatisfiesExpression6(typeHavingNode)) { addIfImplementation(typeHavingNode.expression); } } @@ -206073,7 +209348,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getContainingNodeIfInHeritageClause(node) { - return isIdentifier26(node) || isPropertyAccessExpression16(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration2)) : void 0; + return isIdentifier28(node) || isPropertyAccessExpression17(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration2)) : void 0; } function isImplementationExpression(node) { switch (node.kind) { @@ -206531,7 +209806,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const { parent: parent2 } = node; const typeChecker = program.getTypeChecker(); - if (node.kind === 164 || isIdentifier26(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { + if (node.kind === 164 || isIdentifier28(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { const def = getDefinitionFromOverriddenMember(typeChecker, node); if (def !== void 0 || node.kind !== 164) { return def || emptyArray; @@ -207098,8 +210373,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function shouldUseInteractiveInlayHints(preferences) { return preferences.interactiveInlayHints === true; } - function provideInlayHints(context) { - const { file: file2, program, span, cancellationToken, preferences } = context; + function provideInlayHints(context2) { + const { file: file2, program, span, cancellationToken, preferences } = context2; const sourceFileText = file2.text; const compilerOptions = program.getCompilerOptions(); const quotePreference = getQuotePreference(file2, preferences); @@ -207263,10 +210538,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function identifierOrAccessExpressionPostfixMatchesParameterName(expr, parameterName) { - if (isIdentifier26(expr)) { + if (isIdentifier28(expr)) { return expr.text === parameterName; } - if (isPropertyAccessExpression16(expr)) { + if (isPropertyAccessExpression17(expr)) { return expr.name.text === parameterName; } return false; @@ -207286,7 +210561,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (node.kind) { case 225: { const operand = node.operand; - return isLiteralExpression(operand) || isIdentifier26(operand) && isInfinityOrNaNString(operand.escapedText); + return isLiteralExpression(operand) || isIdentifier28(operand) && isInfinityOrNaNString(operand.escapedText); } case 112: case 97: @@ -207461,7 +210736,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } switch (node2.kind) { case 80: - Debug.assertNode(node2, isIdentifier26); + Debug.assertNode(node2, isIdentifier28); const identifierText = idText(node2); const name = node2.symbol && node2.symbol.declarations && node2.symbol.declarations.length && getNameOfDeclaration(node2.symbol.declarations[0]); if (name) { @@ -207870,7 +211145,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isHintableDeclaration(node) { if ((isPartOfParameterDeclaration(node) || isVariableDeclaration7(node) && isVarConst(node)) && node.initializer) { const initializer3 = skipParentheses(node.initializer); - return !(isHintableLiteral(initializer3) || isNewExpression19(initializer3) || isObjectLiteralExpression12(initializer3) || isAssertionExpression(initializer3)); + return !(isHintableLiteral(initializer3) || isNewExpression19(initializer3) || isObjectLiteralExpression13(initializer3) || isAssertionExpression(initializer3)); } return true; } @@ -208176,7 +211451,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; } function getJSDocParameterNameCompletions(tag) { - if (!isIdentifier26(tag.name)) { + if (!isIdentifier28(tag.name)) { return emptyArray; } const nameThusFar = tag.name.text; @@ -208184,9 +211459,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const fn = jsdoc.parent; if (!isFunctionLike(fn)) return []; return mapDefined(fn.parameters, (param) => { - if (!isIdentifier26(param.name)) return void 0; + if (!isIdentifier28(param.name)) return void 0; const name = param.name.text; - if (jsdoc.tags.some((t) => t !== tag && isJSDocParameterTag(t) && isIdentifier26(t.name) && t.name.escapedText === name) || nameThusFar !== void 0 && !startsWith(name, nameThusFar)) { + if (jsdoc.tags.some((t) => t !== tag && isJSDocParameterTag(t) && isIdentifier28(t.name) && t.name.escapedText === name) || nameThusFar !== void 0 && !startsWith(name, nameThusFar)) { return void 0; } return { name, kind: "parameter", kindModifiers: "", sortText: ts_Completions_exports.SortText.LocationPriority }; @@ -208344,7 +211619,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function parse4(sourceFile, content) { const nodeKinds = [ { - parse: () => createSourceFile5( + parse: () => createSourceFile6( "__mapcode_content_nodes.ts", content, sourceFile.languageVersion, @@ -208355,7 +211630,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} body: (sf) => sf.statements }, { - parse: () => createSourceFile5( + parse: () => createSourceFile6( "__mapcode_class_content_nodes.ts", `class __class { ${content} @@ -208541,7 +211816,7 @@ ${content} const shouldSort = mode === "SortAndCombine" || mode === "All"; const shouldCombine = shouldSort; const shouldRemove = mode === "RemoveUnused" || mode === "All"; - const topLevelImportDecls = sourceFile.statements.filter(isImportDeclaration7); + const topLevelImportDecls = sourceFile.statements.filter(isImportDeclaration8); const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, topLevelImportDecls); const { comparersToTest, typeOrdersToTest } = getDetectionLists(preferences); const defaultComparer = comparersToTest[0]; @@ -208567,10 +211842,10 @@ ${content} } for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { if (!ambientModule.body) continue; - const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration7)); + const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration8)); ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, comparer)); if (mode !== "RemoveUnused") { - const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration2); + const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration3); organizeExportsWorker(ambientModuleExportDecls, comparer.namedImportComparer); } } @@ -208687,7 +211962,7 @@ ${content} let i = 0; let groupIndex = 0; while (i < len) { - if (isExportDeclaration2(statements[i])) { + if (isExportDeclaration3(statements[i])) { if (topLevelExportGroups[groupIndex] === void 0) { topLevelExportGroups[groupIndex] = []; } @@ -208696,7 +211971,7 @@ ${content} topLevelExportGroups[groupIndex].push(exportDecl); i++; } else { - while (i < len && isExportDeclaration2(statements[i])) { + while (i < len && isExportDeclaration3(statements[i])) { topLevelExportGroups[groupIndex].push(statements[i++]); } groupIndex++; @@ -208996,7 +212271,7 @@ ${content} } function tryGetNamedBindingElements(namedImport) { var _a3; - return ((_a3 = namedImport.importClause) == null ? void 0 : _a3.namedBindings) && isNamedImports5(namedImport.importClause.namedBindings) ? namedImport.importClause.namedBindings.elements : void 0; + return ((_a3 = namedImport.importClause) == null ? void 0 : _a3.namedBindings) && isNamedImports6(namedImport.importClause.namedBindings) ? namedImport.importClause.namedBindings.elements : void 0; } function detectModuleSpecifierCaseBySort(importDeclsByGroup, comparersToTest) { const moduleSpecifiersByGroup = []; @@ -209009,7 +212284,7 @@ ${content} let bothNamedImports = false; const importDeclsWithNamed = originalGroups.filter((i) => { var _a3, _b; - const namedImports = (_b = tryCast((_a3 = i.importClause) == null ? void 0 : _a3.namedBindings, isNamedImports5)) == null ? void 0 : _b.elements; + const namedImports = (_b = tryCast((_a3 = i.importClause) == null ? void 0 : _a3.namedBindings, isNamedImports6)) == null ? void 0 : _b.elements; if (!(namedImports == null ? void 0 : namedImports.length)) return false; if (!bothNamedImports && namedImports.some((n) => n.isTypeOnly) && namedImports.some((n) => !n.isTypeOnly)) { bothNamedImports = true; @@ -209019,7 +212294,7 @@ ${content} if (importDeclsWithNamed.length === 0) return; const namedImportsByDecl = importDeclsWithNamed.map((importDecl) => { var _a3, _b; - return (_b = tryCast((_a3 = importDecl.importClause) == null ? void 0 : _a3.namedBindings, isNamedImports5)) == null ? void 0 : _b.elements; + return (_b = tryCast((_a3 = importDecl.importClause) == null ? void 0 : _a3.namedBindings, isNamedImports6)) == null ? void 0 : _b.elements; }).filter((elements) => elements !== void 0); if (!bothNamedImports || typesToTest.length === 0) { const sortState = detectCaseSensitivityBySort(namedImportsByDecl.map((i) => i.map((n) => n.name.text)), comparersToTest); @@ -209150,7 +212425,7 @@ ${content} isSorted = isDetectedSorted; specifierComparer = getNamedImportSpecifierComparer({ organizeImportsTypeOrder: typeOrder }, namedImportComparer); } else if (sourceFile) { - const detectFromFile = detectNamedImportOrganizationBySort(sourceFile.statements.filter(isImportDeclaration7), comparersToTest, typeOrdersToTest); + const detectFromFile = detectNamedImportOrganizationBySort(sourceFile.statements.filter(isImportDeclaration8), comparersToTest, typeOrdersToTest); if (detectFromFile) { const { namedImportComparer, typeOrder, isSorted: isDetectedSorted } = detectFromFile; isSorted = isDetectedSorted; @@ -209226,10 +212501,10 @@ ${content} var _a3; if (depthRemaining === 0) return; cancellationToken.throwIfCancellationRequested(); - if (isDeclaration(n2) || isVariableStatement11(n2) || isReturnStatement4(n2) || isCallOrNewExpression(n2) || n2.kind === 1) { + if (isDeclaration(n2) || isVariableStatement12(n2) || isReturnStatement4(n2) || isCallOrNewExpression(n2) || n2.kind === 1) { addOutliningForLeadingCommentsForNode(n2, sourceFile, cancellationToken, out); } - if (isFunctionLike(n2) && isBinaryExpression4(n2.parent) && isPropertyAccessExpression16(n2.parent.left)) { + if (isFunctionLike(n2) && isBinaryExpression4(n2.parent) && isPropertyAccessExpression17(n2.parent.left)) { addOutliningForLeadingCommentsForNode(n2.parent.left, sourceFile, cancellationToken, out); } if (isBlock6(n2) || isModuleBlock(n2)) { @@ -209493,7 +212768,7 @@ ${content} ); } function spanForArrowFunction(node) { - if (isBlock6(node.body) || isParenthesizedExpression7(node.body) || positionsAreOnSameLine(node.body.getFullStart(), node.body.getEnd(), sourceFile)) { + if (isBlock6(node.body) || isParenthesizedExpression8(node.body) || positionsAreOnSameLine(node.body.getFullStart(), node.body.getEnd(), sourceFile)) { return void 0; } const textSpan = createTextSpanFromBounds(node.body.getFullStart(), node.body.getEnd()); @@ -209546,18 +212821,18 @@ ${content} /* Code */ ); } - function spanForObjectOrArrayLiteral(node, open2 = 19) { + function spanForObjectOrArrayLiteral(node, open = 19) { return spanForNode( node, /*autoCollapse*/ false, /*useFullStart*/ !isArrayLiteralExpression7(node.parent) && !isCallExpression16(node.parent), - open2 + open ); } - function spanForNode(hintSpanNode, autoCollapse = false, useFullStart = true, open2 = 19, close = open2 === 19 ? 20 : 24) { - const openToken = findChildOfKind(n, open2, sourceFile); + function spanForNode(hintSpanNode, autoCollapse = false, useFullStart = true, open = 19, close = open === 19 ? 20 : 24) { + const openToken = findChildOfKind(n, open, sourceFile); const closeToken = findChildOfKind(n, close, sourceFile); return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); } @@ -209637,7 +212912,7 @@ ${content} if (declarations.some((declaration) => isDefinedInLibraryFile(program, declaration))) { return getRenameInfoError(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } - if (isIdentifier26(node) && node.escapedText === "default" && symbol2.parent && symbol2.parent.flags & 1536) { + if (isIdentifier28(node) && node.escapedText === "default" && symbol2.parent && symbol2.parent.flags & 1536) { return void 0; } if (isStringLiteralLike4(node) && tryGetImportFromModuleSpecifier(node)) { @@ -209797,7 +213072,7 @@ ${content} } case 1: { const { called } = invocation; - if (onlyUseSyntacticOwners && !containsPrecedingToken(startingToken, sourceFile, isIdentifier26(called) ? called.parent : called)) { + if (onlyUseSyntacticOwners && !containsPrecedingToken(startingToken, sourceFile, isIdentifier28(called) ? called.parent : called)) { return void 0; } const candidates = getPossibleGenericSignatures(called, argumentCount, checker); @@ -209830,7 +213105,7 @@ ${content} function createJSSignatureHelpItems(argumentInfo, program, cancellationToken) { if (argumentInfo.invocation.kind === 2) return void 0; const expression = getExpressionFromInvocation(argumentInfo.invocation); - const name = isPropertyAccessExpression16(expression) ? expression.name.text : void 0; + const name = isPropertyAccessExpression17(expression) ? expression.name.text : void 0; const typeChecker = program.getTypeChecker(); return name === void 0 ? void 0 : firstDefined(program.getSourceFiles(), (sourceFile) => firstDefined(sourceFile.getNamedDeclarations().get(name), (declaration) => { const type = declaration.symbol && typeChecker.getTypeOfSymbolAtLocation(declaration.symbol, declaration); @@ -210339,7 +213614,7 @@ ${content} if (isFunctionBody(node) && isFunctionLikeDeclaration(parentNode) && !positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { pushSelectionRange(node.getStart(sourceFile), node.getEnd()); } - if (isBlock6(node) || isTemplateSpan(node) || isTemplateHead(node) || isTemplateTail(node) || prevNode && isTemplateHead(prevNode) || isVariableDeclarationList(node) && isVariableStatement11(parentNode) || isSyntaxList(node) && isVariableDeclarationList(parentNode) || isVariableDeclaration7(node) && isSyntaxList(parentNode) && children.length === 1 || isJSDocTypeExpression(node) || isJSDocSignature(node) || isJSDocTypeLiteral(node)) { + if (isBlock6(node) || isTemplateSpan(node) || isTemplateHead(node) || isTemplateTail(node) || prevNode && isTemplateHead(prevNode) || isVariableDeclarationList(node) && isVariableStatement12(parentNode) || isSyntaxList(node) && isVariableDeclarationList(parentNode) || isVariableDeclaration7(node) && isSyntaxList(parentNode) && children.length === 1 || isJSDocTypeExpression(node) || isJSDocSignature(node) || isJSDocTypeLiteral(node)) { parentNode = node; break; } @@ -210403,7 +213678,7 @@ ${content} } return false; } - var isImport2 = or(isImportDeclaration7, isImportEqualsDeclaration); + var isImport2 = or(isImportDeclaration8, isImportEqualsDeclaration); function getSelectionChildren(node) { var _a3; if (isSourceFile(node)) { @@ -211184,7 +214459,7 @@ ${content} } if (isTransientSymbol(symbol2) && symbol2.links.target && isTransientSymbol(symbol2.links.target) && symbol2.links.target.links.tupleLabelDeclaration) { const labelDecl = symbol2.links.target.links.tupleLabelDeclaration; - Debug.assertNode(labelDecl.name, isIdentifier26); + Debug.assertNode(labelDecl.name, isIdentifier28); displayParts.push(spacePart()); displayParts.push(punctuationPart( 21 @@ -211233,11 +214508,11 @@ ${content} } } } - if (documentation.length === 0 && isIdentifier26(location) && symbol2.valueDeclaration && isBindingElement(symbol2.valueDeclaration)) { + if (documentation.length === 0 && isIdentifier28(location) && symbol2.valueDeclaration && isBindingElement(symbol2.valueDeclaration)) { const declaration = symbol2.valueDeclaration; const parent2 = declaration.parent; const name = declaration.propertyName || declaration.name; - if (isIdentifier26(name) && isObjectBindingPattern3(parent2)) { + if (isIdentifier28(name) && isObjectBindingPattern3(parent2)) { const propertyName = getTextOfIdentifierOrLiteral(name); const objectType = typeChecker.getTypeAtLocation(parent2); documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => { @@ -211692,11 +214967,11 @@ ${content} this.classesWithNodesInsertedAtStart = /* @__PURE__ */ new Map(); this.deletedNodes = []; } - static fromContext(context) { - return new _ChangeTracker(getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext); + static fromContext(context2) { + return new _ChangeTracker(getNewLineOrDefaultFromHost(context2.host, context2.formatContext.options), context2.formatContext); } - static with(context, cb) { - const tracker = _ChangeTracker.fromContext(context); + static with(context2, cb) { + const tracker = _ChangeTracker.fromContext(context2); cb(tracker); return tracker.getChanges(); } @@ -211939,7 +215214,7 @@ ${content} return { suffix: ", " }; } else if (isParameter(before)) { return isParameter(inserted) ? { suffix: ", " } : {}; - } else if (isStringLiteral15(before) && isImportDeclaration7(before.parent) || isNamedImports5(before)) { + } else if (isStringLiteral15(before) && isImportDeclaration8(before.parent) || isNamedImports6(before)) { return { suffix: ", " }; } else if (isImportSpecifier(before)) { return { suffix: "," + (blankLineBetween ? this.newLineCharacter : " ") }; @@ -212027,8 +215302,8 @@ ${content} if (isFirstInsertion) { this.classesWithNodesInsertedAtStart.set(getNodeId(node), { node, sourceFile }); } - const insertTrailingComma = isObjectLiteralExpression12(node) && (!isJsonSourceFile(sourceFile) || !isEmpty); - const insertLeadingComma = isObjectLiteralExpression12(node) && isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion; + const insertTrailingComma = isObjectLiteralExpression13(node) && (!isJsonSourceFile(sourceFile) || !isEmpty); + const insertLeadingComma = isObjectLiteralExpression13(node) && isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion; return { indentation, prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter, @@ -212280,7 +215555,7 @@ ${options.prefix}` : "\n" : options.prefix case 342: { const oldParam = oldTag; const newParam = newTag; - return isIdentifier26(oldParam.name) && isIdentifier26(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( + return isIdentifier28(oldParam.name) && isIdentifier28(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( /*tagName*/ void 0, newParam.name, @@ -212348,12 +215623,12 @@ ${options.prefix}` : "\n" : options.prefix return end; } function getClassOrObjectBraceEnds(cls, sourceFile) { - const open2 = findChildOfKind(cls, 19, sourceFile); + const open = findChildOfKind(cls, 19, sourceFile); const close = findChildOfKind(cls, 20, sourceFile); - return [open2 == null ? void 0 : open2.end, close == null ? void 0 : close.end]; + return [open == null ? void 0 : open.end, close == null ? void 0 : close.end]; } function getMembersOrProperties(node) { - return isObjectLiteralExpression12(node) ? node.properties : node.members; + return isObjectLiteralExpression13(node) ? node.properties : node.members; } var changesToText; ((changesToText2) => { @@ -212384,7 +215659,7 @@ ${options.prefix}` : "\n" : options.prefix changesToText2.newFileChanges = newFileChanges; function newFileChangesWorker(scriptKind, insertions, newLineCharacter, formatContext) { const nonFormattedText = flatMap(insertions, (insertion) => insertion.statements.map((s) => s === 4 ? "" : getNonformattedText(s, insertion.oldFile, newLineCharacter).text)).join(newLineCharacter); - const sourceFile = createSourceFile5( + const sourceFile = createSourceFile6( "any file name", nonFormattedText, { @@ -212777,8 +216052,8 @@ ${options.prefix}` : "\n" : options.prefix }); break; case 209: - const pattern = node.parent; - const preserveComma = pattern.kind === 208 && node !== last(pattern.elements); + const pattern2 = node.parent; + const preserveComma = pattern2.kind === 208 && node !== last(pattern2.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } else { @@ -214717,8 +217992,8 @@ ${options.prefix}` : "\n" : options.prefix ...lowPriorityCommonRules ]; } - function rule(debugName, left, right, context, action, flags = 0) { - return { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName, context, action, flags } }; + function rule(debugName, left, right, context2, action, flags = 0) { + return { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName, context: context2, action, flags } }; } function tokenRangeFrom(tokens) { return { tokens, isSpecific: true }; @@ -214736,33 +218011,33 @@ ${options.prefix}` : "\n" : options.prefix return tokenRangeFrom(tokens); } function optionEquals(optionName, optionValue) { - return (context) => context.options && context.options[optionName] === optionValue; + return (context2) => context2.options && context2.options[optionName] === optionValue; } function isOptionEnabled(optionName) { - return (context) => context.options && hasProperty(context.options, optionName) && !!context.options[optionName]; + return (context2) => context2.options && hasProperty(context2.options, optionName) && !!context2.options[optionName]; } function isOptionDisabled(optionName) { - return (context) => context.options && hasProperty(context.options, optionName) && !context.options[optionName]; + return (context2) => context2.options && hasProperty(context2.options, optionName) && !context2.options[optionName]; } function isOptionDisabledOrUndefined(optionName) { - return (context) => !context.options || !hasProperty(context.options, optionName) || !context.options[optionName]; + return (context2) => !context2.options || !hasProperty(context2.options, optionName) || !context2.options[optionName]; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return (context) => !context.options || !hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); + return (context2) => !context2.options || !hasProperty(context2.options, optionName) || !context2.options[optionName] || context2.TokensAreOnSameLine(); } function isOptionEnabledOrUndefined(optionName) { - return (context) => !context.options || !hasProperty(context.options, optionName) || !!context.options[optionName]; + return (context2) => !context2.options || !hasProperty(context2.options, optionName) || !!context2.options[optionName]; } - function isForContext(context) { - return context.contextNode.kind === 249; + function isForContext(context2) { + return context2.contextNode.kind === 249; } - function isNotForContext(context) { - return !isForContext(context); + function isNotForContext(context2) { + return !isForContext(context2); } - function isBinaryOpContext(context) { - switch (context.contextNode.kind) { + function isBinaryOpContext(context2) { + switch (context2.contextNode.kind) { case 227: - return context.contextNode.operatorToken.kind !== 28; + return context2.contextNode.operatorToken.kind !== 28; case 228: case 195: case 235: @@ -214793,58 +218068,58 @@ ${options.prefix}` : "\n" : options.prefix case 307: case 173: case 172: - return context.currentTokenSpan.kind === 64 || context.nextTokenSpan.kind === 64; + return context2.currentTokenSpan.kind === 64 || context2.nextTokenSpan.kind === 64; // "in" keyword in for (let x in []) { } case 250: // "in" keyword in [P in keyof T]: T[P] // falls through case 169: - return context.currentTokenSpan.kind === 103 || context.nextTokenSpan.kind === 103 || context.currentTokenSpan.kind === 64 || context.nextTokenSpan.kind === 64; + return context2.currentTokenSpan.kind === 103 || context2.nextTokenSpan.kind === 103 || context2.currentTokenSpan.kind === 64 || context2.nextTokenSpan.kind === 64; // Technically, "of" is not a binary operator, but format it the same way as "in" case 251: - return context.currentTokenSpan.kind === 165 || context.nextTokenSpan.kind === 165; + return context2.currentTokenSpan.kind === 165 || context2.nextTokenSpan.kind === 165; } return false; } - function isNotBinaryOpContext(context) { - return !isBinaryOpContext(context); + function isNotBinaryOpContext(context2) { + return !isBinaryOpContext(context2); } - function isNotTypeAnnotationContext(context) { - return !isTypeAnnotationContext(context); + function isNotTypeAnnotationContext(context2) { + return !isTypeAnnotationContext(context2); } - function isTypeAnnotationContext(context) { - const contextKind = context.contextNode.kind; + function isTypeAnnotationContext(context2) { + const contextKind = context2.contextNode.kind; return contextKind === 173 || contextKind === 172 || contextKind === 170 || contextKind === 261 || isFunctionLikeKind(contextKind); } - function isOptionalPropertyContext(context) { - return isPropertyDeclaration(context.contextNode) && context.contextNode.questionToken; + function isOptionalPropertyContext(context2) { + return isPropertyDeclaration(context2.contextNode) && context2.contextNode.questionToken; } - function isNonOptionalPropertyContext(context) { - return !isOptionalPropertyContext(context); + function isNonOptionalPropertyContext(context2) { + return !isOptionalPropertyContext(context2); } - function isConditionalOperatorContext(context) { - return context.contextNode.kind === 228 || context.contextNode.kind === 195; + function isConditionalOperatorContext(context2) { + return context2.contextNode.kind === 228 || context2.contextNode.kind === 195; } - function isSameLineTokenOrBeforeBlockContext(context) { - return context.TokensAreOnSameLine() || isBeforeBlockContext(context); + function isSameLineTokenOrBeforeBlockContext(context2) { + return context2.TokensAreOnSameLine() || isBeforeBlockContext(context2); } - function isBraceWrappedContext(context) { - return context.contextNode.kind === 207 || context.contextNode.kind === 201 || isSingleLineBlockContext(context); + function isBraceWrappedContext(context2) { + return context2.contextNode.kind === 207 || context2.contextNode.kind === 201 || isSingleLineBlockContext(context2); } - function isBeforeMultilineBlockContext(context) { - return isBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + function isBeforeMultilineBlockContext(context2) { + return isBeforeBlockContext(context2) && !(context2.NextNodeAllOnSameLine() || context2.NextNodeBlockIsOnOneLine()); } - function isMultilineBlockContext(context) { - return isBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + function isMultilineBlockContext(context2) { + return isBlockContext(context2) && !(context2.ContextNodeAllOnSameLine() || context2.ContextNodeBlockIsOnOneLine()); } - function isSingleLineBlockContext(context) { - return isBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + function isSingleLineBlockContext(context2) { + return isBlockContext(context2) && (context2.ContextNodeAllOnSameLine() || context2.ContextNodeBlockIsOnOneLine()); } - function isBlockContext(context) { - return nodeIsBlockContext(context.contextNode); + function isBlockContext(context2) { + return nodeIsBlockContext(context2.contextNode); } - function isBeforeBlockContext(context) { - return nodeIsBlockContext(context.nextTokenParent); + function isBeforeBlockContext(context2) { + return nodeIsBlockContext(context2.nextTokenParent); } function nodeIsBlockContext(node) { if (nodeIsTypeScriptDeclWithBlockContext(node)) { @@ -214859,8 +218134,8 @@ ${options.prefix}` : "\n" : options.prefix } return false; } - function isFunctionDeclContext(context) { - switch (context.contextNode.kind) { + function isFunctionDeclContext(context2) { + switch (context2.contextNode.kind) { case 263: case 175: case 174: @@ -214883,14 +218158,14 @@ ${options.prefix}` : "\n" : options.prefix } return false; } - function isNotFunctionDeclContext(context) { - return !isFunctionDeclContext(context); + function isNotFunctionDeclContext(context2) { + return !isFunctionDeclContext(context2); } - function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 263 || context.contextNode.kind === 219; + function isFunctionDeclarationOrFunctionExpressionContext(context2) { + return context2.contextNode.kind === 263 || context2.contextNode.kind === 219; } - function isTypeScriptDeclWithBlockContext(context) { - return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); + function isTypeScriptDeclWithBlockContext(context2) { + return nodeIsTypeScriptDeclWithBlockContext(context2.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { @@ -214908,8 +218183,8 @@ ${options.prefix}` : "\n" : options.prefix } return false; } - function isAfterCodeBlockContext(context) { - switch (context.currentTokenParent.kind) { + function isAfterCodeBlockContext(context2) { + switch (context2.currentTokenParent.kind) { case 264: case 268: case 267: @@ -214918,7 +218193,7 @@ ${options.prefix}` : "\n" : options.prefix case 256: return true; case 242: { - const blockParent = context.currentTokenParent.parent; + const blockParent = context2.currentTokenParent.parent; if (!blockParent || blockParent.kind !== 220 && blockParent.kind !== 219) { return true; } @@ -214926,8 +218201,8 @@ ${options.prefix}` : "\n" : options.prefix } return false; } - function isControlDeclContext(context) { - switch (context.contextNode.kind) { + function isControlDeclContext(context2) { + switch (context2.contextNode.kind) { case 246: case 256: case 249: @@ -214946,65 +218221,65 @@ ${options.prefix}` : "\n" : options.prefix return false; } } - function isObjectContext(context) { - return context.contextNode.kind === 211; + function isObjectContext(context2) { + return context2.contextNode.kind === 211; } - function isFunctionCallContext(context) { - return context.contextNode.kind === 214; + function isFunctionCallContext(context2) { + return context2.contextNode.kind === 214; } - function isNewContext(context) { - return context.contextNode.kind === 215; + function isNewContext(context2) { + return context2.contextNode.kind === 215; } - function isFunctionCallOrNewContext(context) { - return isFunctionCallContext(context) || isNewContext(context); + function isFunctionCallOrNewContext(context2) { + return isFunctionCallContext(context2) || isNewContext(context2); } - function isPreviousTokenNotComma(context) { - return context.currentTokenSpan.kind !== 28; + function isPreviousTokenNotComma(context2) { + return context2.currentTokenSpan.kind !== 28; } - function isNextTokenNotCloseBracket(context) { - return context.nextTokenSpan.kind !== 24; + function isNextTokenNotCloseBracket(context2) { + return context2.nextTokenSpan.kind !== 24; } - function isNextTokenNotCloseParen(context) { - return context.nextTokenSpan.kind !== 22; + function isNextTokenNotCloseParen(context2) { + return context2.nextTokenSpan.kind !== 22; } - function isArrowFunctionContext(context) { - return context.contextNode.kind === 220; + function isArrowFunctionContext(context2) { + return context2.contextNode.kind === 220; } - function isImportTypeContext(context) { - return context.contextNode.kind === 206; + function isImportTypeContext(context2) { + return context2.contextNode.kind === 206; } - function isNonJsxSameLineTokenContext(context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 12; + function isNonJsxSameLineTokenContext(context2) { + return context2.TokensAreOnSameLine() && context2.contextNode.kind !== 12; } - function isNonJsxTextContext(context) { - return context.contextNode.kind !== 12; + function isNonJsxTextContext(context2) { + return context2.contextNode.kind !== 12; } - function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 285 && context.contextNode.kind !== 289; + function isNonJsxElementOrFragmentContext(context2) { + return context2.contextNode.kind !== 285 && context2.contextNode.kind !== 289; } - function isJsxExpressionContext(context) { - return context.contextNode.kind === 295 || context.contextNode.kind === 294; + function isJsxExpressionContext(context2) { + return context2.contextNode.kind === 295 || context2.contextNode.kind === 294; } - function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 292 || context.nextTokenParent.kind === 296 && context.nextTokenParent.parent.kind === 292; + function isNextTokenParentJsxAttribute(context2) { + return context2.nextTokenParent.kind === 292 || context2.nextTokenParent.kind === 296 && context2.nextTokenParent.parent.kind === 292; } - function isJsxAttributeContext(context) { - return context.contextNode.kind === 292; + function isJsxAttributeContext(context2) { + return context2.contextNode.kind === 292; } - function isNextTokenParentNotJsxNamespacedName(context) { - return context.nextTokenParent.kind !== 296; + function isNextTokenParentNotJsxNamespacedName(context2) { + return context2.nextTokenParent.kind !== 296; } - function isNextTokenParentJsxNamespacedName(context) { - return context.nextTokenParent.kind === 296; + function isNextTokenParentJsxNamespacedName(context2) { + return context2.nextTokenParent.kind === 296; } - function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 286; + function isJsxSelfClosingElementContext(context2) { + return context2.contextNode.kind === 286; } - function isNotBeforeBlockInFunctionDeclarationContext(context) { - return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); + function isNotBeforeBlockInFunctionDeclarationContext(context2) { + return !isFunctionDeclContext(context2) && !isBeforeBlockContext(context2); } - function isEndOfDecoratorContextOnSameLine(context) { - return context.TokensAreOnSameLine() && hasDecorators(context.contextNode) && nodeIsInDecoratorContext(context.currentTokenParent) && !nodeIsInDecoratorContext(context.nextTokenParent); + function isEndOfDecoratorContextOnSameLine(context2) { + return context2.TokensAreOnSameLine() && hasDecorators(context2.contextNode) && nodeIsInDecoratorContext(context2.currentTokenParent) && !nodeIsInDecoratorContext(context2.nextTokenParent); } function nodeIsInDecoratorContext(node) { while (node && isExpression(node)) { @@ -215012,20 +218287,20 @@ ${options.prefix}` : "\n" : options.prefix } return node && node.kind === 171; } - function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 262 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + function isStartOfVariableDeclarationList(context2) { + return context2.currentTokenParent.kind === 262 && context2.currentTokenParent.getStart(context2.sourceFile) === context2.currentTokenSpan.pos; } - function isNotFormatOnEnter(context) { - return context.formattingRequestKind !== 2; + function isNotFormatOnEnter(context2) { + return context2.formattingRequestKind !== 2; } - function isModuleDeclContext(context) { - return context.contextNode.kind === 268; + function isModuleDeclContext(context2) { + return context2.contextNode.kind === 268; } - function isObjectTypeContext(context) { - return context.contextNode.kind === 188; + function isObjectTypeContext(context2) { + return context2.contextNode.kind === 188; } - function isConstructorSignatureContext(context) { - return context.contextNode.kind === 181; + function isConstructorSignatureContext(context2) { + return context2.contextNode.kind === 181; } function isTypeArgumentOrParameterOrAssertion(token, parent2) { if (token.kind !== 30 && token.kind !== 32) { @@ -215053,29 +218328,29 @@ ${options.prefix}` : "\n" : options.prefix return false; } } - function isTypeArgumentOrParameterOrAssertionContext(context) { - return isTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + function isTypeArgumentOrParameterOrAssertionContext(context2) { + return isTypeArgumentOrParameterOrAssertion(context2.currentTokenSpan, context2.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context2.nextTokenSpan, context2.nextTokenParent); } - function isTypeAssertionContext(context) { - return context.contextNode.kind === 217; + function isTypeAssertionContext(context2) { + return context2.contextNode.kind === 217; } - function isNonTypeAssertionContext(context) { - return !isTypeAssertionContext(context); + function isNonTypeAssertionContext(context2) { + return !isTypeAssertionContext(context2); } - function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 116 && context.currentTokenParent.kind === 223; + function isVoidOpContext(context2) { + return context2.currentTokenSpan.kind === 116 && context2.currentTokenParent.kind === 223; } - function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 230 && context.contextNode.expression !== void 0; + function isYieldOrYieldStarWithOperand(context2) { + return context2.contextNode.kind === 230 && context2.contextNode.expression !== void 0; } - function isNonNullAssertionContext(context) { - return context.contextNode.kind === 236; + function isNonNullAssertionContext(context2) { + return context2.contextNode.kind === 236; } - function isNotStatementConditionContext(context) { - return !isStatementConditionContext(context); + function isNotStatementConditionContext(context2) { + return !isStatementConditionContext(context2); } - function isStatementConditionContext(context) { - switch (context.contextNode.kind) { + function isStatementConditionContext(context2) { + switch (context2.contextNode.kind) { case 246: case 249: case 250: @@ -215087,45 +218362,45 @@ ${options.prefix}` : "\n" : options.prefix return false; } } - function isSemicolonDeletionContext(context) { - let nextTokenKind = context.nextTokenSpan.kind; - let nextTokenStart = context.nextTokenSpan.pos; + function isSemicolonDeletionContext(context2) { + let nextTokenKind = context2.nextTokenSpan.kind; + let nextTokenStart = context2.nextTokenSpan.pos; if (isTrivia(nextTokenKind)) { - const nextRealToken = context.nextTokenParent === context.currentTokenParent ? findNextToken( - context.currentTokenParent, - findAncestor(context.currentTokenParent, (a) => !a.parent), - context.sourceFile - ) : context.nextTokenParent.getFirstToken(context.sourceFile); + const nextRealToken = context2.nextTokenParent === context2.currentTokenParent ? findNextToken( + context2.currentTokenParent, + findAncestor(context2.currentTokenParent, (a) => !a.parent), + context2.sourceFile + ) : context2.nextTokenParent.getFirstToken(context2.sourceFile); if (!nextRealToken) { return true; } nextTokenKind = nextRealToken.kind; - nextTokenStart = nextRealToken.getStart(context.sourceFile); + nextTokenStart = nextRealToken.getStart(context2.sourceFile); } - const startLine = context.sourceFile.getLineAndCharacterOfPosition(context.currentTokenSpan.pos).line; - const endLine = context.sourceFile.getLineAndCharacterOfPosition(nextTokenStart).line; + const startLine = context2.sourceFile.getLineAndCharacterOfPosition(context2.currentTokenSpan.pos).line; + const endLine = context2.sourceFile.getLineAndCharacterOfPosition(nextTokenStart).line; if (startLine === endLine) { return nextTokenKind === 20 || nextTokenKind === 1; } - if (nextTokenKind === 27 && context.currentTokenSpan.kind === 27) { + if (nextTokenKind === 27 && context2.currentTokenSpan.kind === 27) { return true; } if (nextTokenKind === 241 || nextTokenKind === 27) { return false; } - if (context.contextNode.kind === 265 || context.contextNode.kind === 266) { - return !isPropertySignature3(context.currentTokenParent) || !!context.currentTokenParent.type || nextTokenKind !== 21; + if (context2.contextNode.kind === 265 || context2.contextNode.kind === 266) { + return !isPropertySignature3(context2.currentTokenParent) || !!context2.currentTokenParent.type || nextTokenKind !== 21; } - if (isPropertyDeclaration(context.currentTokenParent)) { - return !context.currentTokenParent.initializer; + if (isPropertyDeclaration(context2.currentTokenParent)) { + return !context2.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 249 && context.currentTokenParent.kind !== 243 && context.currentTokenParent.kind !== 241 && nextTokenKind !== 23 && nextTokenKind !== 21 && nextTokenKind !== 40 && nextTokenKind !== 41 && nextTokenKind !== 44 && nextTokenKind !== 14 && nextTokenKind !== 28 && nextTokenKind !== 229 && nextTokenKind !== 16 && nextTokenKind !== 15 && nextTokenKind !== 25; + return context2.currentTokenParent.kind !== 249 && context2.currentTokenParent.kind !== 243 && context2.currentTokenParent.kind !== 241 && nextTokenKind !== 23 && nextTokenKind !== 21 && nextTokenKind !== 40 && nextTokenKind !== 41 && nextTokenKind !== 44 && nextTokenKind !== 14 && nextTokenKind !== 28 && nextTokenKind !== 229 && nextTokenKind !== 16 && nextTokenKind !== 15 && nextTokenKind !== 25; } - function isSemicolonInsertionContext(context) { - return positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); + function isSemicolonInsertionContext(context2) { + return positionIsASICandidate(context2.currentTokenSpan.end, context2.currentTokenParent, context2.sourceFile); } - function isNotPropertyAccessOnIntegerLiteral(context) { - return !isPropertyAccessExpression16(context.contextNode) || !isNumericLiteral5(context.contextNode.expression) || context.contextNode.expression.getText().includes("."); + function isNotPropertyAccessOnIntegerLiteral(context2) { + return !isPropertyAccessExpression17(context2.contextNode) || !isNumericLiteral5(context2.contextNode.expression) || context2.contextNode.expression.getText().includes("."); } function getFormatContext(options, host) { return { options, getRules: getRulesMap(), host }; @@ -215155,14 +218430,14 @@ ${options.prefix}` : "\n" : options.prefix } function createRulesMap(rules) { const map22 = buildMap(rules); - return (context) => { - const bucket = map22[getRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind)]; + return (context2) => { + const bucket = map22[getRuleBucketIndex(context2.currentTokenSpan.kind, context2.nextTokenSpan.kind)]; if (bucket) { const rules2 = []; let ruleActionMask = 0; for (const rule2 of bucket) { const acceptRuleActions = ~getRuleActionExclusion(ruleActionMask); - if (rule2.action & acceptRuleActions && every(rule2.context, (c) => c(context))) { + if (rule2.action & acceptRuleActions && every(rule2.context, (c) => c(context2))) { rules2.push(rule2); ruleActionMask |= rule2.action; } @@ -215582,7 +218857,7 @@ ${options.prefix}` : "\n" : options.prefix } } function getFirstNonDecoratorTokenOfNode(node) { - if (canHaveModifiers(node)) { + if (canHaveModifiers2(node)) { const modifier = find(node.modifiers, isModifier, findIndex(node.modifiers, isDecorator)); if (modifier) return modifier.kind; } @@ -216836,7 +220111,7 @@ ${options.prefix}` : "\n" : options.prefix forEachChild27(enclosingNode, function checkNameResolution(node) { var _a3; if (shouldProvidePasteEdits) return; - if (isIdentifier26(node) && rangeContainsPosition(range, node.getStart(sourceFile))) { + if (isIdentifier28(node) && rangeContainsPosition(range, node.getStart(sourceFile))) { const resolvedSymbol = checker.resolveName( node.text, node, @@ -216902,7 +220177,7 @@ ${options.prefix}` : "\n" : options.prefix addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax); addTargetFileImports(copiedFrom.file, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, originalProgramTypeChecker, updatedProgram, importAdder); } else { - const context = { + const context2 = { sourceFile: updatedFile, program: originalProgram, cancellationToken, @@ -216919,12 +220194,12 @@ ${options.prefix}` : "\n" : options.prefix const range = { pos: startPos, end: endPos }; offset += textToBePasted.length - oldTextLength; const enclosingNode = findAncestor( - getTokenAtPosition(context.sourceFile, range.pos), + getTokenAtPosition(context2.sourceFile, range.pos), (ancestorNode) => rangeContainsRange(ancestorNode, range) ); if (!enclosingNode) return; forEachChild27(enclosingNode, function importUnresolvedIdentifiers(node) { - const isImportCandidate = isIdentifier26(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName( + const isImportCandidate = isIdentifier28(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName( node.text, node, -1, @@ -216933,7 +220208,7 @@ ${options.prefix}` : "\n" : options.prefix )); if (isImportCandidate) { return importAdder.addImportForUnresolvedIdentifier( - context, + context2, node, /*useAutoImportProvider*/ true @@ -216962,8 +220237,8 @@ ${options.prefix}` : "\n" : options.prefix const startToken = getTokenAtPosition(sourceFile, pos); const endToken = findTokenOnLeftOfPosition(sourceFile, pos) ?? getTokenAtPosition(sourceFile, end); return { - pos: isIdentifier26(startToken) && pos <= startToken.getStart(sourceFile) ? startToken.getFullStart() : pos, - end: isIdentifier26(endToken) && end === endToken.getEnd() ? ts_textChanges_exports.getAdjustedEndPosition(sourceFile, endToken, {}) : end + pos: isIdentifier28(startToken) && pos <= startToken.getStart(sourceFile) ? startToken.getFullStart() : pos, + end: isIdentifier28(endToken) && end === endToken.getEnd() ? ts_textChanges_exports.getAdjustedEndPosition(sourceFile, endToken, {}) : end }; } var ts_exports2 = {}; @@ -217058,7 +220333,7 @@ ${options.prefix}` : "\n" : options.prefix NodeBuilderFlags: () => NodeBuilderFlags, NodeCheckFlags: () => NodeCheckFlags, NodeFactoryFlags: () => NodeFactoryFlags, - NodeFlags: () => NodeFlags6, + NodeFlags: () => NodeFlags7, NodeResolutionFeatures: () => NodeResolutionFeatures, ObjectFlags: () => ObjectFlags, OperationCanceledException: () => OperationCanceledException, @@ -217088,7 +220363,7 @@ ${options.prefix}` : "\n" : options.prefix ScriptElementKindModifier: () => ScriptElementKindModifier, ScriptKind: () => ScriptKind2, ScriptSnapshot: () => ScriptSnapshot, - ScriptTarget: () => ScriptTarget5, + ScriptTarget: () => ScriptTarget6, SemanticClassificationFormat: () => SemanticClassificationFormat, SemanticMeaning: () => SemanticMeaning, SemicolonPreference: () => SemicolonPreference, @@ -217106,7 +220381,7 @@ ${options.prefix}` : "\n" : options.prefix SymbolDisplayPartKind: () => SymbolDisplayPartKind, SymbolFlags: () => SymbolFlags, SymbolFormatFlags: () => SymbolFormatFlags, - SyntaxKind: () => SyntaxKind10, + SyntaxKind: () => SyntaxKind11, Ternary: () => Ternary, ThrottledCancellationToken: () => ThrottledCancellationToken, TokenClass: () => TokenClass, @@ -217181,7 +220456,7 @@ ${options.prefix}` : "\n" : options.prefix canHaveIllegalTypeParameters: () => canHaveIllegalTypeParameters, canHaveJSDoc: () => canHaveJSDoc, canHaveLocals: () => canHaveLocals, - canHaveModifiers: () => canHaveModifiers, + canHaveModifiers: () => canHaveModifiers2, canHaveModuleSpecifier: () => canHaveModuleSpecifier, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, @@ -217384,7 +220659,7 @@ ${options.prefix}` : "\n" : options.prefix createSolutionBuilderWithWatch: () => createSolutionBuilderWithWatch, createSolutionBuilderWithWatchHost: () => createSolutionBuilderWithWatchHost, createSortedArray: () => createSortedArray, - createSourceFile: () => createSourceFile5, + createSourceFile: () => createSourceFile6, createSourceMapGenerator: () => createSourceMapGenerator, createSourceMapSource: () => createSourceMapSource, createSuperAccessVariableStatement: () => createSuperAccessVariableStatement, @@ -217809,7 +221084,7 @@ ${options.prefix}` : "\n" : options.prefix getModeForResolutionAtIndex: () => getModeForResolutionAtIndex, getModeForUsageLocation: () => getModeForUsageLocation, getModifiedTime: () => getModifiedTime, - getModifiers: () => getModifiers, + getModifiers: () => getModifiers2, getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, @@ -218109,7 +221384,7 @@ ${options.prefix}` : "\n" : options.prefix isArrayLiteralOrObjectLiteralDestructuringPattern: () => isArrayLiteralOrObjectLiteralDestructuringPattern, isArrayTypeNode: () => isArrayTypeNode2, isArrowFunction: () => isArrowFunction8, - isAsExpression: () => isAsExpression7, + isAsExpression: () => isAsExpression8, isAssertClause: () => isAssertClause, isAssertEntry: () => isAssertEntry, isAssertionExpression: () => isAssertionExpression, @@ -218249,8 +221524,8 @@ ${options.prefix}` : "\n" : options.prefix isExcludedFile: () => isExcludedFile, isExclusivelyTypeOnlyImportOrExport: () => isExclusivelyTypeOnlyImportOrExport, isExpandoPropertyDeclaration: () => isExpandoPropertyDeclaration, - isExportAssignment: () => isExportAssignment3, - isExportDeclaration: () => isExportDeclaration2, + isExportAssignment: () => isExportAssignment4, + isExportDeclaration: () => isExportDeclaration3, isExportModifier: () => isExportModifier, isExportName: () => isExportName, isExportNamespaceAsDefaultDeclaration: () => isExportNamespaceAsDefaultDeclaration, @@ -218308,7 +221583,7 @@ ${options.prefix}` : "\n" : options.prefix isHeritageClause: () => isHeritageClause, isHoistedFunction: () => isHoistedFunction, isHoistedVariableStatement: () => isHoistedVariableStatement, - isIdentifier: () => isIdentifier26, + isIdentifier: () => isIdentifier28, isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword, isIdentifierName: () => isIdentifierName, isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode, @@ -218325,7 +221600,7 @@ ${options.prefix}` : "\n" : options.prefix isImportAttributes: () => isImportAttributes, isImportCall: () => isImportCall, isImportClause: () => isImportClause, - isImportDeclaration: () => isImportDeclaration7, + isImportDeclaration: () => isImportDeclaration8, isImportEqualsDeclaration: () => isImportEqualsDeclaration, isImportKeyword: () => isImportKeyword, isImportMeta: () => isImportMeta, @@ -218506,7 +221781,7 @@ ${options.prefix}` : "\n" : options.prefix isNamedExportBindings: () => isNamedExportBindings, isNamedExports: () => isNamedExports2, isNamedImportBindings: () => isNamedImportBindings, - isNamedImports: () => isNamedImports5, + isNamedImports: () => isNamedImports6, isNamedImportsOrExports: () => isNamedImportsOrExports, isNamedTupleMember: () => isNamedTupleMember, isNamespaceBody: () => isNamespaceBody, @@ -218529,7 +221804,7 @@ ${options.prefix}` : "\n" : options.prefix isNonGlobalAmbientModule: () => isNonGlobalAmbientModule, isNonNullAccess: () => isNonNullAccess, isNonNullChain: () => isNonNullChain, - isNonNullExpression: () => isNonNullExpression5, + isNonNullExpression: () => isNonNullExpression6, isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName, isNotEmittedStatement: () => isNotEmittedStatement, isNullishCoalesce: () => isNullishCoalesce, @@ -218542,7 +221817,7 @@ ${options.prefix}` : "\n" : options.prefix isObjectBindingPattern: () => isObjectBindingPattern3, isObjectLiteralElement: () => isObjectLiteralElement, isObjectLiteralElementLike: () => isObjectLiteralElementLike, - isObjectLiteralExpression: () => isObjectLiteralExpression12, + isObjectLiteralExpression: () => isObjectLiteralExpression13, isObjectLiteralMethod: () => isObjectLiteralMethod, isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor, isObjectTypeDeclaration: () => isObjectTypeDeclaration, @@ -218560,7 +221835,7 @@ ${options.prefix}` : "\n" : options.prefix isParameter: () => isParameter, isParameterPropertyDeclaration: () => isParameterPropertyDeclaration, isParameterPropertyModifier: () => isParameterPropertyModifier, - isParenthesizedExpression: () => isParenthesizedExpression7, + isParenthesizedExpression: () => isParenthesizedExpression8, isParenthesizedTypeNode: () => isParenthesizedTypeNode, isParseTreeNode: () => isParseTreeNode, isPartOfParameterDeclaration: () => isPartOfParameterDeclaration, @@ -218584,10 +221859,10 @@ ${options.prefix}` : "\n" : options.prefix isPrologueDirective: () => isPrologueDirective, isPropertyAccessChain: () => isPropertyAccessChain, isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression, - isPropertyAccessExpression: () => isPropertyAccessExpression16, + isPropertyAccessExpression: () => isPropertyAccessExpression17, isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName, isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode, - isPropertyAssignment: () => isPropertyAssignment11, + isPropertyAssignment: () => isPropertyAssignment12, isPropertyDeclaration: () => isPropertyDeclaration, isPropertyName: () => isPropertyName, isPropertyNameLiteral: () => isPropertyNameLiteral, @@ -218621,13 +221896,13 @@ ${options.prefix}` : "\n" : options.prefix isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName: () => isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, isRootedDiskPath: () => isRootedDiskPath, isSameEntityName: () => isSameEntityName, - isSatisfiesExpression: () => isSatisfiesExpression5, + isSatisfiesExpression: () => isSatisfiesExpression6, isSemicolonClassElement: () => isSemicolonClassElement, isSetAccessor: () => isSetAccessor, isSetAccessorDeclaration: () => isSetAccessorDeclaration, isShiftOperatorOrHigher: () => isShiftOperatorOrHigher, isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol, - isShorthandPropertyAssignment: () => isShorthandPropertyAssignment6, + isShorthandPropertyAssignment: () => isShorthandPropertyAssignment7, isSideEffectImport: () => isSideEffectImport, isSignedNumericLiteral: () => isSignedNumericLiteral, isSimpleCopiableExpression: () => isSimpleCopiableExpression, @@ -218642,7 +221917,7 @@ ${options.prefix}` : "\n" : options.prefix isSourceFileNotJson: () => isSourceFileNotJson, isSourceMapping: () => isSourceMapping, isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration, - isSpreadAssignment: () => isSpreadAssignment6, + isSpreadAssignment: () => isSpreadAssignment7, isSpreadElement: () => isSpreadElement5, isStatement: () => isStatement, isStatementButNotDeclaration: () => isStatementButNotDeclaration, @@ -218704,7 +221979,7 @@ ${options.prefix}` : "\n" : options.prefix isTupleTypeNode: () => isTupleTypeNode, isTypeAlias: () => isTypeAlias, isTypeAliasDeclaration: () => isTypeAliasDeclaration2, - isTypeAssertionExpression: () => isTypeAssertionExpression2, + isTypeAssertionExpression: () => isTypeAssertionExpression3, isTypeDeclaration: () => isTypeDeclaration, isTypeElement: () => isTypeElement, isTypeKeyword: () => isTypeKeyword, @@ -218743,7 +222018,7 @@ ${options.prefix}` : "\n" : options.prefix isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire, isVariableDeclarationList: () => isVariableDeclarationList, isVariableLike: () => isVariableLike, - isVariableStatement: () => isVariableStatement11, + isVariableStatement: () => isVariableStatement12, isVoidExpression: () => isVoidExpression, isWatchSet: () => isWatchSet, isWhileStatement: () => isWhileStatement, @@ -218874,7 +222149,7 @@ ${options.prefix}` : "\n" : options.prefix parseJSDocTypeExpressionForTests: () => parseJSDocTypeExpressionForTests, parseJsonConfigFileContent: () => parseJsonConfigFileContent, parseJsonSourceFileConfigFileContent: () => parseJsonSourceFileConfigFileContent, - parseJsonText: () => parseJsonText, + parseJsonText: () => parseJsonText2, parseListTypeOption: () => parseListTypeOption, parseNodeFactory: () => parseNodeFactory, parseNodeModuleFromPath: () => parseNodeModuleFromPath, @@ -224924,7 +228199,7 @@ ${options.prefix}` : "\n" : options.prefix } const cachedDirectoryStructureHost = ((_a3 = configFileExistenceInfo.config) == null ? void 0 : _a3.cachedDirectoryStructureHost) || createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames); const configFileContent = tryReadFile(configFilename, (fileName) => this.host.readFile(fileName)); - const configFile = parseJsonText(configFilename, isString(configFileContent) ? configFileContent : ""); + const configFile = parseJsonText2(configFilename, isString(configFileContent) ? configFileContent : ""); const configFileErrors = configFile.parseDiagnostics; if (!isString(configFileContent)) configFileErrors.push(configFileContent); const configDir = getDirectoryPath(configFilename); @@ -226170,8 +229445,8 @@ Dynamic files must always be opened with service's current directory or service basePath )) return false; return validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.some((includeSpec) => { - const pattern = getPatternFromSpec(includeSpec, basePath, "files"); - return !!pattern && getRegexFromPattern(`(${pattern})$`, this.host.useCaseSensitiveFileNames).test(info.fileName); + const pattern2 = getPatternFromSpec(includeSpec, basePath, "files"); + return !!pattern2 && getRegexFromPattern(`(${pattern2})$`, this.host.useCaseSensitiveFileNames).test(info.fileName); }); } tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(info, kind, initialConfigResult, referencedProjectReason, allowDeferredClosed, reloadedProjects) { @@ -227099,10 +230374,10 @@ Dynamic files must always be opened with service's current directory or service if (!cache || currentKey !== key(fromFileName, preferences, options)) return void 0; return cache.get(toFileName2); }, - set(fromFileName, toFileName2, preferences, options, kind, modulePaths, moduleSpecifiers2) { + set(fromFileName, toFileName2, preferences, options, kind, modulePaths2, moduleSpecifiers2) { ensureCache(fromFileName, preferences, options).set(toFileName2, createInfo( kind, - modulePaths, + modulePaths2, moduleSpecifiers2, /*packageName*/ void 0, @@ -227110,7 +230385,7 @@ Dynamic files must always be opened with service's current directory or service false )); if (moduleSpecifiers2) { - for (const p of modulePaths) { + for (const p of modulePaths2) { if (p.isInNodeModules) { const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1); const key2 = host.toPath(nodeModulesPath); @@ -227124,16 +230399,16 @@ Dynamic files must always be opened with service's current directory or service } } }, - setModulePaths(fromFileName, toFileName2, preferences, options, modulePaths) { + setModulePaths(fromFileName, toFileName2, preferences, options, modulePaths2) { const cache2 = ensureCache(fromFileName, preferences, options); const info = cache2.get(toFileName2); if (info) { - info.modulePaths = modulePaths; + info.modulePaths = modulePaths2; } else { cache2.set(toFileName2, createInfo( /*kind*/ void 0, - modulePaths, + modulePaths2, /*moduleSpecifiers*/ void 0, /*packageName*/ @@ -227187,8 +230462,8 @@ Dynamic files must always be opened with service's current directory or service function key(fromFileName, preferences, options) { return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`; } - function createInfo(kind, modulePaths, moduleSpecifiers2, packageName, isBlockedByPackageJsonDependencies) { - return { kind, modulePaths, moduleSpecifiers: moduleSpecifiers2, packageName, isBlockedByPackageJsonDependencies }; + function createInfo(kind, modulePaths2, moduleSpecifiers2, packageName, isBlockedByPackageJsonDependencies) { + return { kind, modulePaths: modulePaths2, moduleSpecifiers: moduleSpecifiers2, packageName, isBlockedByPackageJsonDependencies }; } } function createPackageJsonCache(host) { @@ -229449,7 +232724,7 @@ Project '${project2.projectName}' (${ProjectKind[project2.projectKind]}) ${count const ls = project2.getLanguageService(); const program = ls.getProgram(); const initialNode = getTouchingPropertyName(program.getSourceFile(file2), position); - if ((isStringLiteralLike4(initialNode) || isIdentifier26(initialNode)) && isAccessExpression(initialNode.parent)) { + if ((isStringLiteralLike4(initialNode) || isIdentifier28(initialNode)) && isAccessExpression(initialNode.parent)) { return forEachNameInAccessChainWalkingLeft(initialNode, (nameInChain) => { var _a22; if (nameInChain === initialNode) return void 0; @@ -229586,8 +232861,8 @@ Project '${project2.projectName}' (${ProjectKind[project2.projectKind]}) ${count } toFileSpanWithContext(fileName, textSpan, contextSpan, project2) { const fileSpan = this.toFileSpan(fileName, textSpan, project2); - const context = contextSpan && this.toFileSpan(fileName, contextSpan, project2); - return context ? { ...fileSpan, contextStart: context.start, contextEnd: context.end } : fileSpan; + const context2 = contextSpan && this.toFileSpan(fileName, contextSpan, project2); + return context2 ? { ...fileSpan, contextStart: context2.start, contextEnd: context2.end } : fileSpan; } getTypeDefinition(args) { const { file: file2, project: project2 } = this.getFileAndProject(args); @@ -231898,8 +235173,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range installPackage(options) { this.packageInstallId++; const request = { kind: "installPackage", ...options, id: this.packageInstallId }; - const promise2 = new Promise((resolve9, reject) => { - (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve9, reject }); + const promise2 = new Promise((resolve12, reject) => { + (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve12, reject }); }); this.installer.send(request); return promise2; @@ -232171,9 +235446,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range }; } })({ get exports() { - return ts34; + return ts37; }, set exports(v) { - ts34 = v; + ts37 = v; if (typeof module !== "undefined" && module.exports) { module.exports = v; } @@ -232181,6 +235456,28 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range } }); +// node_modules/@intentius/chant/src/lexicon.ts +function intrinsicTagFolds(def) { + return def.isTag === true; +} +function intrinsicCallFolds(def) { + return def.isTag !== true && def.foldsAsCall === true; +} +function intrinsicCallFoldsEagerly(def) { + return def.isTag !== true && def.foldsEagerly === true; +} +function isLexiconPlugin(value) { + if (typeof value !== "object" || value === null || !("name" in value) || typeof value.name !== "string" || !("serializer" in value) || typeof value.serializer !== "object") { + return false; + } + const obj = value; + return typeof obj.generate === "function" && typeof obj.validate === "function" && typeof obj.coverage === "function" && typeof obj.package === "function"; +} +var init_lexicon = __esm({ + "node_modules/@intentius/chant/src/lexicon.ts"() { + } +}); + // node_modules/@intentius/chant/src/fold/foldable-helpers.ts function isFoldableHelperName(name) { return HELPER_NAMES.has(name); @@ -232497,555 +235794,1794 @@ function findFunctionSubsetViolation(fn) { return "a destructured `const` with a rest, default, or nested element is not foldable"; } } - continue; + continue; + } + return "an array-destructured `const` in a function body is not foldable"; + } + } + return void 0; +} +function insideFunctionBody(node, what) { + if (functionBodyDepth === 0) return void 0; + return foldError(node, `${what} inside a folded function body is not foldable`, "EVL001", true); +} +function fileLabel(file2) { + const rel = relative3(process.cwd(), file2); + return rel.startsWith("..") ? file2 : rel; +} +function callFoldableFunction(callee, node, consts, intrinsics, externals) { + const label = `call to "${callee.name}" (${fileLabel(callee.file)})`; + const violation = findFunctionSubsetViolation(callee.fn); + if (violation) throw foldError(node, `${label} is not foldable: ${violation}`); + if (functionBodyDepth >= MAX_FUNCTION_CALL_DEPTH) { + throw foldError(node, `${label} is not foldable: call depth exceeded \u2014 is it recursive?`); + } + const args = []; + for (const arg of node.arguments) { + if (ts2.isSpreadElement(arg)) throw foldError(arg, `${label} is not foldable: a spread argument is not foldable`); + args.push(fold(arg, consts, intrinsics, externals)); + } + const bodyConsts = new Map(callee.consts); + const bodyExternals = new Map(callee.externals); + const bind = (name, value) => { + bodyConsts.delete(name); + bodyExternals.set(name, value); + }; + const destructure = (pattern2, value) => { + if (value === null || typeof value !== "object") { + throw foldError(pattern2, `destructured source in \`${briefNodeText(pattern2)}\` is not an object`); + } + for (const el of pattern2.elements) { + bind(el.name.text, value[plainBindingKey(el)]); + } + }; + functionBodyDepth += 1; + try { + const result = evaluateFunctionBody(callee, args, bodyConsts, bodyExternals, intrinsics, bind, destructure); + if (!callee.leakedIdentity && carriesLiveObject(result) && !args.some((arg) => carriesLiveObject(arg))) { + callee.leakedIdentity = true; + } + return result; + } catch (err) { + if (!(err instanceof FoldError)) throw err; + const prefix = `${err.line}:${err.column} - `; + const inner2 = err.message.startsWith(prefix) ? err.message.slice(prefix.length) : err.message; + let reason = inner2; + const unresolved = /^unresolved identifier: (\w+)$/.exec(inner2); + if (unresolved && callee.failures?.has(unresolved[1])) { + reason = `${inner2} (${callee.failures.get(unresolved[1])})`; + } + throw foldError( + node, + `${label} is not foldable: ${fileLabel(callee.file)}:${err.line}:${err.column} - ${reason}`, + err.ruleId, + // chant#2441 — the refusal happened inside the callee's body and this + // frame is the CALL site, so without carrying the flag the caller sees + // an ordinary failure and falls back to invoking. + err.refusedAtDepth + ); + } finally { + functionBodyDepth -= 1; + } +} +function evaluateFunctionBody(callee, args, bodyConsts, bodyExternals, intrinsics, bind, destructure) { + callee.fn.parameters.forEach((param, i) => { + let value = args[i]; + if (value === void 0 && param.initializer) { + value = fold(param.initializer, bodyConsts, intrinsics, bodyExternals); + } + if (ts2.isIdentifier(param.name)) bind(param.name.text, value); + else destructure(param.name, value); + }); + const body = callee.fn.body; + if (!ts2.isBlock(body)) return fold(body, bodyConsts, intrinsics, bodyExternals); + for (const statement of body.statements) { + if (ts2.isReturnStatement(statement)) { + return statement.expression ? fold(statement.expression, bodyConsts, intrinsics, bodyExternals) : void 0; + } + for (const decl of statement.declarationList.declarations) { + const value = fold(decl.initializer, bodyConsts, intrinsics, bodyExternals); + if (ts2.isIdentifier(decl.name)) bind(decl.name.text, value); + else destructure(decl.name, value); + } + } + return void 0; +} +function locate(node) { + const sourceFile = node.getSourceFile(); + const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + return { line: line + 1, column: character + 1 }; +} +function foldError(node, message, ruleId = "EVL001", refusedAtDepth = false) { + const { line, column } = locate(node); + return new FoldError(message, line, column, ruleId, refusedAtDepth); +} +function collectConsts(sourceFile) { + const consts = /* @__PURE__ */ new Map(); + for (const statement of sourceFile.statements) { + if (!ts2.isVariableStatement(statement)) continue; + if ((statement.declarationList.flags & ts2.NodeFlags.Const) === 0) continue; + for (const decl of statement.declarationList.declarations) { + if (ts2.isIdentifier(decl.name) && decl.initializer) { + consts.set(decl.name.text, decl.initializer); + } + } + } + return consts; +} +function propName(node) { + if (isLiteralPropertyName(node)) return node.text; + throw foldError(node, computedPropertyNameMessage(node)); +} +function elementKey(node) { + if (isLiteralElementKey(node)) return node.text; + throw foldError(node, dynamicElementAccessMessage(node), "EVL003"); +} +function resolvesToResource(consts, ident) { + const init = consts.get(ident.text); + return init !== void 0 && ts2.isNewExpression(init); +} +function isUnclaimedBareCall(node, consts, intrinsics, externals) { + if (!ts2.isCallExpression(node) || !ts2.isIdentifier(node.expression)) return false; + const name = node.expression.text; + if (consts.has(name)) return false; + if (isFoldableHelperName(name)) return false; + if (intrinsics.some((i) => i.name === name && intrinsicCallFolds(i))) return false; + if (isFoldableFunction(externals?.get(name))) return false; + return true; +} +function isFoldedResource(value) { + return typeof value === "object" && value !== null && !Array.isArray(value) && "__resource" in value; +} +function isFoldSymbolicEnvelope(value) { + if (typeof value !== "object" || value === null || Array.isArray(value)) return false; + return "__attrRef" in value || "__intrinsic" in value || "__helper" in value || "__resource" in value || "__compositeStep" in value; +} +function attrRefOnFoldedResource(node, attribute) { + if (ts2.isIdentifier(node.expression)) { + return { __attrRef: { entity: node.expression.text, attribute } }; + } + throw foldError( + node, + `attribute "${attribute}" read on an inline resource expression is not foldable \u2014 bind the resource to a const first (falls back to run)` + ); +} +function isChainShortCircuit(value) { + return value === CHAIN_SHORT_CIRCUIT; +} +function shortCircuited(node) { + return continuesOptionalChain(node) ? CHAIN_SHORT_CIRCUIT : void 0; +} +function continuesOptionalChain(node) { + const parent = node.parent; + if (parent === void 0) return false; + if (ts2.isNonNullExpression(parent) && ts2.isOptionalChain(parent)) return continuesOptionalChain(parent); + return (ts2.isPropertyAccessExpression(parent) || ts2.isElementAccessExpression(parent) || ts2.isCallExpression(parent)) && parent.expression === node && ts2.isOptionalChain(parent); +} +function nullishAccessMessage(member, obj) { + return `property "${member}" read on ${String(obj)} is not foldable \u2014 running this expression throws a TypeError, so the file falls back to run (write \`?.\` if the value is genuinely optional)`; +} +function isUnresolvedSymbolChain(node, consts, externals) { + if (ts2.isIdentifier(node)) { + return node.text !== "undefined" && !consts.has(node.text) && !externals?.has(node.text); + } + if (ts2.isPropertyAccessExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); + if (ts2.isElementAccessExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); + if (ts2.isNonNullExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); + return false; +} +function foldIntrinsicValue(node, consts, intrinsics, externals) { + if (isUnresolvedSymbolChain(node, consts, externals)) { + return { __symbol: node.getText() }; + } + return fold(node, consts, intrinsics, externals); +} +function foldTaggedTemplate(node, consts, intrinsics, externals) { + const tagName = node.tag.getText(); + const isRegistered = intrinsics.some((i) => i.name === tagName && intrinsicTagFolds(i)); + if (!isRegistered) { + throw foldError(node, `unregistered tagged template intrinsic: ${briefNodeText(node.tag)}\`...\``); + } + const template = node.template; + if (ts2.isNoSubstitutionTemplateLiteral(template)) { + return { __intrinsic: tagName, strings: [template.text], values: [] }; + } + const strings = [template.head.text, ...template.templateSpans.map((span) => span.literal.text)]; + const values = template.templateSpans.map( + (span) => foldIntrinsicValue(span.expression, consts, intrinsics, externals) + ); + return { __intrinsic: tagName, strings, values }; +} +function fold(node, consts, intrinsics = [], externals) { + if (ts2.isParenthesizedExpression(node) || ts2.isAsExpression(node) || ts2.isSatisfiesExpression(node) || ts2.isNonNullExpression(node)) { + return fold(node.expression, consts, intrinsics, externals); + } + if (ts2.isArrowFunction(node) || ts2.isFunctionExpression(node)) { + throw foldError(node, "a function used as a value is not foldable"); + } + if (ts2.isStringLiteral(node) || ts2.isNoSubstitutionTemplateLiteral(node)) { + return node.text; + } + if (ts2.isNumericLiteral(node)) { + return Number(node.text); + } + if (node.kind === ts2.SyntaxKind.TrueKeyword) return true; + if (node.kind === ts2.SyntaxKind.FalseKeyword) return false; + if (node.kind === ts2.SyntaxKind.NullKeyword) return null; + if (ts2.isIdentifier(node) && node.text === "undefined") return void 0; + if (ts2.isTaggedTemplateExpression(node)) { + const inside = insideFunctionBody(node, "a tagged template intrinsic"); + if (inside) throw inside; + return foldTaggedTemplate(node, consts, intrinsics, externals); + } + if (ts2.isTemplateExpression(node)) { + let out = node.head.text; + for (const span of node.templateSpans) { + const value = fold(span.expression, consts, intrinsics, externals); + const symbolic = symbolicEnvelopeKind(value); + if (symbolic) { + throw foldError( + span.expression, + `${symbolic} interpolated into a plain template literal, which would stringify it as "[object Object]". A symbolic value has no string form until the build resolves it, so a plain template cannot carry one. Use the lexicon's own intrinsic, whose interior handles envelopes \u2014 \`Sub\`\${\u2026}\`\` for CloudFormation \u2014 or move the reference out of the template.` + ); + } + out += String(value) + span.literal.text; + } + return out; + } + if (ts2.isObjectLiteralExpression(node)) { + const obj = {}; + for (const prop of node.properties) { + if (ts2.isPropertyAssignment(prop)) { + obj[propName(prop.name)] = fold(prop.initializer, consts, intrinsics, externals); + } else if (ts2.isShorthandPropertyAssignment(prop)) { + obj[prop.name.text] = fold(prop.name, consts, intrinsics, externals); + } else if (ts2.isSpreadAssignment(prop)) { + const src = fold(prop.expression, consts, intrinsics, externals); + if (src === null || typeof src !== "object") { + throw foldError(prop, "spread source not an object"); + } + Object.assign(obj, src); + } else { + throw foldError(prop, UNSUPPORTED_OBJECT_MEMBER_MESSAGE); + } + } + return obj; + } + if (ts2.isArrayLiteralExpression(node)) { + const arr = []; + for (const el of node.elements) { + if (ts2.isSpreadElement(el)) { + const src = fold(el.expression, consts, intrinsics, externals); + if (!Array.isArray(src)) { + throw foldError(el, "spread source not an array"); + } + arr.push(...src); + } else { + arr.push(fold(el, consts, intrinsics, externals)); + } + } + return arr; + } + if (ts2.isIdentifier(node)) { + if (!consts.has(node.text)) { + if (externals?.has(node.text)) { + const external = externals.get(node.text); + if (isFoldableFunction(external)) { + throw foldError(node, `function "${node.text}" used as a value is not foldable`); + } + if (typeof external === "function" && intrinsics.some((i) => i.name === node.text && intrinsicCallFoldsEagerly(i))) { + throw foldError(node, `function "${node.text}" used as a value is not foldable \u2014 call it instead`); + } + return external; + } + if (node.text === "process") { + throw foldError( + node, + `ambient "process" read is not foldable \u2014 declare a build-time parameter instead (chant.config.ts's buildParams + \`chant build --param name=value\`/\`--params-file\`) and reference it via \`import { params } from "@intentius/chant/params"\`, rather than reading process.env directly` + ); + } + throw foldError(node, `unresolved identifier: ${node.text}`); + } + const initializer3 = consts.get(node.text); + if (ts2.isNewExpression(initializer3)) { + if (externals?.has(node.text)) return externals.get(node.text); + throw foldError( + node, + `same-file resource \`${node.text}\` used as a value is not foldable \u2014 falls back to run` + ); + } + return fold(initializer3, consts, intrinsics, externals); + } + if (ts2.isPropertyAccessExpression(node)) { + if (ts2.isIdentifier(node.expression) && resolvesToResource(consts, node.expression)) { + return { __attrRef: { entity: node.expression.text, attribute: node.name.text } }; + } + if (node.name.text === "step" && isUnclaimedBareCall(node.expression, consts, intrinsics, externals)) { + const call = node.expression; + const calleeName = call.expression.text; + const inside = insideFunctionBody(node, `composite call \`${calleeName}(...).step\``); + if (inside) throw inside; + return { + __compositeStep: calleeName, + args: call.arguments.map((arg) => fold(arg, consts, intrinsics, externals)) + }; + } + const obj = fold(node.expression, consts, intrinsics, externals); + if (isChainShortCircuit(obj)) return shortCircuited(node); + if (obj === null || obj === void 0) { + if (node.questionDotToken) return shortCircuited(node); + throw foldError(node, nullishAccessMessage(node.name.text, obj)); + } + if (isFoldedResource(obj)) return attrRefOnFoldedResource(node, node.name.text); + return obj[node.name.text]; + } + if (ts2.isElementAccessExpression(node)) { + const key = elementKey(node.argumentExpression); + if (ts2.isIdentifier(node.expression) && resolvesToResource(consts, node.expression)) { + return { __attrRef: { entity: node.expression.text, attribute: key } }; + } + const obj = fold(node.expression, consts, intrinsics, externals); + if (isChainShortCircuit(obj)) return shortCircuited(node); + if (obj === null || obj === void 0) { + if (node.questionDotToken) return shortCircuited(node); + throw foldError(node, nullishAccessMessage(key, obj)); + } + if (isFoldedResource(obj)) return attrRefOnFoldedResource(node, key); + return obj[key]; + } + if (ts2.isPrefixUnaryExpression(node)) { + if (!SUPPORTED_UNARY_OPERATORS.has(node.operator)) { + throw foldError(node, UNSUPPORTED_UNARY_MESSAGE); + } + const value = fold(node.operand, consts, intrinsics, externals); + if (node.operator === ts2.SyntaxKind.ExclamationToken) return !value; + return -value; + } + if (ts2.isBinaryExpression(node)) { + const opKind = node.operatorToken.kind; + const S = ts2.SyntaxKind; + if (opKind === S.AmpersandAmpersandToken) { + const left2 = fold(node.left, consts, intrinsics, externals); + return left2 ? fold(node.right, consts, intrinsics, externals) : left2; + } + if (opKind === S.BarBarToken) { + const left2 = fold(node.left, consts, intrinsics, externals); + return left2 ? left2 : fold(node.right, consts, intrinsics, externals); + } + if (opKind === S.QuestionQuestionToken) { + const left2 = fold(node.left, consts, intrinsics, externals); + return left2 === null || left2 === void 0 ? fold(node.right, consts, intrinsics, externals) : left2; + } + if (!SUPPORTED_BINARY_OPERATORS.has(opKind)) { + throw foldError(node, unsupportedBinaryMessage(opKind)); + } + const left = fold(node.left, consts, intrinsics, externals); + const right = fold(node.right, consts, intrinsics, externals); + switch (opKind) { + case S.PlusToken: + return left + right; + case S.MinusToken: + return left - right; + case S.AsteriskToken: + return left * right; + case S.SlashToken: + return left / right; + case S.EqualsEqualsEqualsToken: + return left === right; + case S.ExclamationEqualsEqualsToken: + return left !== right; + case S.GreaterThanToken: + return left > right; + case S.LessThanToken: + return left < right; + case S.GreaterThanEqualsToken: + return left >= right; + case S.LessThanEqualsToken: + return left <= right; + default: + throw foldError(node, unsupportedBinaryMessage(opKind)); + } + } + if (ts2.isConditionalExpression(node)) { + return fold(node.condition, consts, intrinsics, externals) ? fold(node.whenTrue, consts, intrinsics, externals) : fold(node.whenFalse, consts, intrinsics, externals); + } + if (ts2.isNewExpression(node)) { + if (!ts2.isIdentifier(node.expression)) { + throw foldError( + node, + `nested \`new ${briefNodeText(node.expression)}(...)\` as a value needs a plain imported constructor \u2014 falls back to run` + ); + } + const inside = insideFunctionBody(node, `\`new ${node.expression.text}(...)\``); + if (inside) throw inside; + return foldResource(node, consts, intrinsics, externals); + } + if (ts2.isCallExpression(node)) { + if (ts2.isIdentifier(node.expression) && isFoldableHelperName(node.expression.text) && !consts.has(node.expression.text)) { + const inside = insideFunctionBody(node, `authoring helper call \`${node.expression.text}(...)\``); + if (inside) throw inside; + return { + __helper: node.expression.text, + args: node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)) + }; + } + if (ts2.isIdentifier(node.expression) && !consts.has(node.expression.text)) { + const calleeName = node.expression.text; + if (intrinsics.some((i) => i.name === calleeName && intrinsicCallFolds(i))) { + const inside = insideFunctionBody(node, `intrinsic call \`${calleeName}(...)\``); + if (inside) throw inside; + return { + __intrinsic: calleeName, + args: node.arguments.map((arg) => foldIntrinsicValue(arg, consts, intrinsics, externals)) + }; + } + } + if (ts2.isIdentifier(node.expression)) { + const callee = externals?.get(node.expression.text); + if (isFoldableFunction(callee)) { + return callFoldableFunction(callee, node, consts, intrinsics, externals); + } + if (externals === void 0) { + const local = sameFileFunctions(node, consts)?.get(node.expression.text); + if (local) return callFoldableFunction(local, node, consts, intrinsics, local.externals); + } + } + if (ts2.isIdentifier(node.expression) && !consts.has(node.expression.text) && intrinsics.some((i) => i.name === node.expression.text && intrinsicCallFoldsEagerly(i))) { + const callee = externals?.get(node.expression.text); + if (typeof callee !== "function") { + throw foldError(node, `"${node.expression.text}" did not resolve to a function \u2014 falls back to run`); + } + const args = node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)); + return callee(...args); + } + if (ts2.isPropertyAccessExpression(node.expression)) { + const methodName = node.expression.name.text; + const receiver = fold(node.expression.expression, consts, intrinsics, externals); + if (isChainShortCircuit(receiver)) return shortCircuited(node); + if (receiver === null || receiver === void 0) { + if (node.expression.questionDotToken) return shortCircuited(node); + throw foldError(node, `cannot call ".${methodName}(...)" on ${String(receiver)}`); + } + if (isFoldSymbolicEnvelope(receiver)) { + throw foldError( + node, + `method call \`.${methodName}(...)\` on an unresolved value is not foldable \u2014 falls back to run` + ); + } + const method = receiver[methodName]; + if (typeof method !== "function") { + throw foldError(node, `"${methodName}" is not a callable method on the folded value \u2014 falls back to run`); + } + const args = node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)); + return method.apply(receiver, args); + } + throw foldError(node, callExpressionMessage(node)); + } + throw foldError(node, unsupportedExpressionMessage(node)); +} +function foldResource(node, consts, intrinsics = [], externals) { + const typeName = node.expression.getText(); + const args = node.arguments ?? []; + const [firstArg, secondArg] = args; + const foldArg = (arg) => fold(arg, consts, intrinsics, externals); + if (!firstArg) { + return { __resource: typeName, props: {} }; + } + if (ts2.isObjectLiteralExpression(firstArg)) { + const props2 = foldArg(firstArg); + if (args.length === 1) { + return { __resource: typeName, props: props2 }; + } + if (args.length === 2 && ts2.isObjectLiteralExpression(secondArg)) { + return { __resource: typeName, props: props2, attributes: foldArg(secondArg) }; + } + } + const folded = args.map(foldArg); + const propsIndex = args.findIndex((arg) => ts2.isObjectLiteralExpression(arg)); + const props = propsIndex === -1 ? {} : folded[propsIndex]; + return { __resource: typeName, props, args: folded }; +} +var ts2, FoldError, FoldableFunction, sameFileFunctionCache, functionBodyDepth, MAX_FUNCTION_CALL_DEPTH, CHAIN_SHORT_CIRCUIT; +var init_fold = __esm({ + "node_modules/@intentius/chant/src/fold/fold.ts"() { + ts2 = __toESM(require_typescript(), 1); + init_lexicon(); + init_subset(); + init_foldable_helpers(); + FoldError = class extends Error { + line; + column; + ruleId; + /** + * This refusal is `F-Div-Depth` (chant#2441), not an ordinary fold failure. + * + * The distinction is load-bearing rather than informational. An ordinary + * failure to fold an imported call is allowed to fall back to importing and + * invoking the callee, which is `resolveCallExpression`'s pre-#1373 arm and + * is right for a helper that wraps a composite call. A depth refusal must + * NOT take that arm: the specification says the folder declines here, and + * invoking instead produces the envelope the fixture's own note warns about + * — a value the file's own declarators never produced. Unlike every other + * `F-Div` row this one is not a fallback, so papering over it is wrong + * output rather than a safe degradation. + */ + refusedAtDepth; + constructor(message, line, column, ruleId = "EVL001", refusedAtDepth = false) { + const prevStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + super(`${line}:${column} - ${message}`); + Error.stackTraceLimit = prevStackTraceLimit; + this.name = "FoldError"; + this.line = line; + this.column = column; + this.ruleId = ruleId; + this.refusedAtDepth = refusedAtDepth; + } + }; + FoldableFunction = class { + constructor(name, fn, file2, consts, externals, failures) { + this.name = name; + this.fn = fn; + this.file = file2; + this.consts = consts; + this.externals = externals; + this.failures = failures; + } + name; + fn; + file; + consts; + externals; + failures; + /** + * Set once a call to this function has RETURNED a live object (a value + * with a prototype — a pre-built resource instance of the defining module, + * say) into a caller. The caller then shares that object's identity with + * the defining module exactly as an imported resource binding would, and + * fold-import.ts records the same `liveSources` edge for it so the two + * files fold or run together. A function that returns only plain data never + * sets this, which is what keeps a parameter helper from tainting anything. + */ + leakedIdentity = false; + }; + sameFileFunctionCache = /* @__PURE__ */ new WeakMap(); + functionBodyDepth = 0; + MAX_FUNCTION_CALL_DEPTH = 32; + CHAIN_SHORT_CIRCUIT = /* @__PURE__ */ Symbol("chant.fold.optional-chain-short-circuit"); + } +}); + +// node_modules/@intentius/chant/src/config-static.ts +import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs"; +function readLexiconDeclarationsStatically(startDir) { + const { configPath } = findProjectConfigPastFragments(startDir); + if (configPath === void 0) return { status: "no-config" }; + try { + const value = readFields(configPath, ["lexicons"]).lexicons; + if (value === void 0) return { status: "read", configPath, entries: [] }; + const parsed = ChantConfigSchema.shape.lexicons.safeParse(value); + if (!parsed.success) { + return { status: "unknown", configPath, reason: "`lexicons` is not a list of lexicon entries" }; + } + return { status: "read", configPath, entries: parsed.data ?? [] }; + } catch (err) { + return { status: "unknown", configPath, reason: unreadableReason(err) }; + } +} +function unreadableReason(err) { + return err instanceof FoldError ? `line ${err.line}: ${err.message}` : err instanceof Unreadable ? err.message : `the file could not be read (${err instanceof Error ? err.message : String(err)})`; +} +function readFields(configPath, fields) { + const values = configPath.endsWith(".json") ? readJsonFields(configPath, fields) : readTsFields(configPath, fields); + return Object.fromEntries(Object.entries(values).filter(([, v]) => v !== void 0)); +} +function unknownPathLexiconsNotice(read) { + if (read.status !== "unknown") return void 0; + return `note: could not read the lexicons in ${read.configPath} without running it (${read.reason}). chant does not run it for this command, so any lexicon it declares by path is unknown here and is treated as a package.`; +} +function readJsonFields(configPath, fields) { + const parsed = JSON.parse(readFileSync6(configPath, "utf-8")); + if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) { + throw new Unreadable("the config is not a JSON object"); + } + return Object.fromEntries(fields.map((f) => [f, parsed[f]])); +} +function readTsFields(configPath, fields) { + const source = ts3.createSourceFile(configPath, readFileSync6(configPath, "utf-8"), ts3.ScriptTarget.Latest, true); + const consts = collectConsts(source); + let defaultExport; + const named = /* @__PURE__ */ new Map(); + for (const statement of source.statements) { + if (ts3.isExportAssignment(statement)) { + if (statement.isExportEquals) throw new Unreadable("`export =` is not read"); + defaultExport = statement.expression; + } else if (ts3.isExportDeclaration(statement)) { + throw new Unreadable("an `export { \u2026 }` or `export \u2026 from` declaration is not read"); + } else if (ts3.isVariableStatement(statement) && hasExportModifier(statement)) { + if ((statement.declarationList.flags & ts3.NodeFlags.Const) === 0) { + throw new Unreadable("an exported `let` or `var` is not read"); + } + for (const decl of statement.declarationList.declarations) { + if (ts3.isIdentifier(decl.name) && decl.initializer) named.set(decl.name.text, decl.initializer); + else throw new Unreadable("a destructured export is not read"); + } + } else if (hasExportModifier(statement) && hasDefaultModifier(statement)) { + throw new Unreadable("the default export is not an object"); + } + } + const configExpr = defaultExport ?? named.get("config"); + if (configExpr === void 0) { + return Object.fromEntries( + fields.map((f) => { + const expr = named.get(f); + return [f, expr === void 0 ? void 0 : fold(expr, consts)]; + }) + ); + } + const obj = configObject(configExpr, consts, /* @__PURE__ */ new Set()); + return Object.fromEntries(fields.map((f) => [f, fieldOfObject(obj, f, consts)])); +} +function configObject(node, consts, seen) { + const inner2 = unwrap(node); + if (ts3.isObjectLiteralExpression(inner2)) return inner2; + if (ts3.isIdentifier(inner2)) { + const init = consts.get(inner2.text); + if (init === void 0 || seen.has(inner2.text)) { + throw new Unreadable(`the exported config \`${inner2.text}\` is not a top-level const of this file`); + } + seen.add(inner2.text); + return configObject(init, consts, seen); + } + throw new Unreadable("the exported config is not an object literal"); +} +function fieldOfObject(obj, field, consts) { + let value = void 0; + for (const prop of obj.properties) { + if (ts3.isSpreadAssignment(prop)) { + const spread = fold(prop.expression, consts); + if (spread !== null && typeof spread === "object" && Object.prototype.hasOwnProperty.call(spread, field)) { + value = spread[field]; + } + continue; + } + if (prop.name === void 0) continue; + const name = propName(prop.name); + if (name !== field) continue; + if (ts3.isPropertyAssignment(prop)) value = fold(prop.initializer, consts); + else if (ts3.isShorthandPropertyAssignment(prop)) value = fold(prop.name, consts); + else throw new Unreadable(`\`${field}\` is a method or accessor`); + } + return value; +} +function unwrap(node) { + let current = node; + while (ts3.isParenthesizedExpression(current) || ts3.isAsExpression(current) || ts3.isSatisfiesExpression(current) || ts3.isNonNullExpression(current) || ts3.isTypeAssertionExpression(current)) { + current = current.expression; + } + return current; +} +function hasExportModifier(node) { + return (ts3.canHaveModifiers(node) && ts3.getModifiers(node)?.some((m) => m.kind === ts3.SyntaxKind.ExportKeyword)) ?? false; +} +function hasDefaultModifier(node) { + return (ts3.canHaveModifiers(node) && ts3.getModifiers(node)?.some((m) => m.kind === ts3.SyntaxKind.DefaultKeyword)) ?? false; +} +var ts3, Unreadable; +var init_config_static = __esm({ + "node_modules/@intentius/chant/src/config-static.ts"() { + ts3 = __toESM(require_typescript(), 1); + init_config(); + init_fold(); + Unreadable = class extends Error { + }; + } +}); + +// node_modules/@intentius/chant/src/declarable.ts +function isResourceDeclarable(value) { + return "props" in value; +} +function isDeclarable(value) { + if (typeof value !== "object" || value === null) return false; + if (value[DECLARABLE_MARKER] === true) return true; + return carriesForeignDeclarableMarker(value); +} +function carriesForeignDeclarableMarker(value) { + for (const marker of Object.getOwnPropertySymbols(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, marker); + if (descriptor === void 0 || descriptor.enumerable || descriptor.value !== true) continue; + if (marker.description?.endsWith(DECLARABLE_MARKER_SUFFIX) === true) return true; + } + return false; +} +var DECLARABLE_MARKER, DECLARABLE_MARKER_SUFFIX; +var init_declarable = __esm({ + "node_modules/@intentius/chant/src/declarable.ts"() { + DECLARABLE_MARKER = /* @__PURE__ */ Symbol.for("chant.declarable"); + DECLARABLE_MARKER_SUFFIX = ".declarable"; + } +}); + +// node_modules/@intentius/chant/src/held-elsewhere.ts +var init_held_elsewhere = __esm({ + "node_modules/@intentius/chant/src/held-elsewhere.ts"() { + } +}); + +// node_modules/@intentius/chant/src/provenance.ts +function isPathPrefix(prefix, path) { + if (prefix === "") return true; + if (!path.startsWith(prefix)) return false; + if (path.length === prefix.length) return true; + const next = path[prefix.length]; + return next === "." || next === "["; +} +function setProvenance(entity, prov) { + if (!Object.isExtensible(entity)) return; + const existing = entity[PROVENANCE]; + if (existing) { + existing.sourceFile ??= prov.sourceFile; + existing.composite ??= prov.composite; + existing.compositeInstance ??= prov.compositeInstance; + if (prov.paths) { + existing.paths ??= {}; + for (const [path, origin] of Object.entries(prov.paths)) { + existing.paths[path] ??= origin; + } + } + return; + } + Object.defineProperty(entity, PROVENANCE, { + value: { ...prov, ...prov.paths ? { paths: { ...prov.paths } } : {} }, + enumerable: false, + writable: true, + configurable: true + }); +} +function getProvenance(entity) { + return entity[PROVENANCE]; +} +function setPathProvenance(entity, path, origin) { + setProvenance(entity, { paths: { [path]: origin } }); +} +function originOfPath(paths, path) { + if (!paths) return void 0; + let best; + for (const key of Object.keys(paths)) { + if (!isPathPrefix(key, path)) continue; + if (best === void 0 || key.length > best.length) best = key; + } + return best === void 0 ? void 0 : paths[best]; +} +var PROVENANCE; +var init_provenance = __esm({ + "node_modules/@intentius/chant/src/provenance.ts"() { + PROVENANCE = /* @__PURE__ */ Symbol.for("chant.provenance"); + } +}); + +// node_modules/@intentius/chant/src/composite.ts +function isCompositeInstance(value) { + return typeof value === "object" && value !== null && COMPOSITE_MARKER in value && value[COMPOSITE_MARKER] === true; +} +function Composite(factory, name) { + const id = /* @__PURE__ */ Symbol(); + const compositeName = name ?? "anonymous"; + const definition = ((props) => { + const members = factory(props); + for (const [key, value] of Object.entries(members)) { + if (!isDeclarable(value) && !isCompositeInstance(value)) { + throw new Error( + `Composite "${compositeName}" member "${key}" is not a Declarable or CompositeInstance` + ); + } + } + const instance = {}; + Object.defineProperty(instance, COMPOSITE_MARKER, { value: true, enumerable: false }); + Object.defineProperty(instance, "members", { value: members, enumerable: false }); + Object.defineProperty(instance, "_definition", { value: definition, enumerable: false }); + return Object.assign(instance, members); + }); + Object.defineProperty(definition, "compositeName", { value: compositeName, writable: false }); + Object.defineProperty(definition, "_id", { value: id, writable: false }); + CompositeRegistry.register(definition); + return definition; +} +function expandComposite(prefix, instance, instanceName = prefix) { + const result = /* @__PURE__ */ new Map(); + const shared = instance[SHARED_PROPS]; + const compositeName = instance._definition?.compositeName; + for (const [memberName, member] of Object.entries(instance.members)) { + const fullName = `${prefix}${memberName[0].toUpperCase()}${memberName.slice(1)}`; + if (isCompositeInstance(member)) { + const nested = expandComposite(fullName, member, instanceName); + for (const [nestedName, nestedEntity] of nested) { + if (compositeName) setProvenance(nestedEntity, { composite: compositeName }); + result.set(nestedName, nestedEntity); + } + } else { + if (compositeName) setProvenance(member, { composite: compositeName }); + result.set(fullName, member); + } + } + if (compositeName) { + for (const entity of result.values()) { + setPathProvenance(entity, "", { kind: "composite", composite: compositeName, instance: instanceName }); + } + } + if (shared) { + for (const entity of result.values()) { + if ("props" in entity) { + const store = entity; + let existing = store[ORIGINAL_PROPS]; + if (existing === void 0) { + existing = entity.props; + Object.defineProperty(entity, ORIGINAL_PROPS, { + value: existing, + enumerable: false, + configurable: true + }); + } + const merged = {}; + for (const [k, v] of Object.entries(shared)) { + if (v !== void 0) { + merged[k] = v; + } + } + for (const [k, v] of Object.entries(existing)) { + if (v !== void 0) { + if (Array.isArray(v) && Array.isArray(merged[k])) { + merged[k] = [...merged[k], ...v]; + } else { + merged[k] = v; + } + } + } + Object.defineProperty(entity, "props", { + value: merged, + enumerable: false, + configurable: true + }); + if (compositeName) { + for (const k of Object.keys(shared)) { + if (shared[k] === void 0 || existing[k] !== void 0) continue; + setPathProvenance(entity, k, { + kind: "composite", + composite: compositeName, + instance: instanceName + }); + } + } + } + } + } + return result; +} +var COMPOSITE_MARKER, CompositeRegistry, SHARED_PROPS, ORIGINAL_PROPS; +var init_composite = __esm({ + "node_modules/@intentius/chant/src/composite.ts"() { + init_declarable(); + init_provenance(); + COMPOSITE_MARKER = /* @__PURE__ */ Symbol.for("chant.composite"); + CompositeRegistry = class { + static definitions = /* @__PURE__ */ new Map(); + static register(definition) { + this.definitions.set(definition._id, definition); + } + static getAll() { + return Array.from(this.definitions.values()); + } + static clear() { + this.definitions.clear(); + } + static get size() { + return this.definitions.size; + } + }; + SHARED_PROPS = /* @__PURE__ */ Symbol.for("chant.composite.shared"); + ORIGINAL_PROPS = /* @__PURE__ */ Symbol.for("chant.composite.origProps"); + } +}); + +// node_modules/@intentius/chant/src/secret-provenance.ts +function isSecretDeclaration(value) { + return typeof value === "object" && value !== null && SECRET_DECLARATION_MARKER in value && value[SECRET_DECLARATION_MARKER] === true; +} +var SECRET_DECLARATION_MARKER; +var init_secret_provenance = __esm({ + "node_modules/@intentius/chant/src/secret-provenance.ts"() { + init_declarable(); + SECRET_DECLARATION_MARKER = /* @__PURE__ */ Symbol.for("chant.secret-declaration"); + } +}); + +// node_modules/@intentius/chant/src/secret-materialization.ts +var vault, REDACTED, SecretMaterial; +var init_secret_materialization = __esm({ + "node_modules/@intentius/chant/src/secret-materialization.ts"() { + vault = /* @__PURE__ */ new WeakMap(); + REDACTED = "[secret material]"; + SecretMaterial = class _SecretMaterial { + constructor() { + } + /** Wrap plaintext in an opaque handle. Call inside a generator only. */ + static mint(plaintext) { + const handle = new _SecretMaterial(); + vault.set(handle, plaintext); + return handle; + } + toString() { + return REDACTED; + } + toJSON() { + return REDACTED; + } + /** node:util.inspect (console.log) sees the redaction marker, not the vault. */ + [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() { + return REDACTED; + } + }; + } +}); + +// node_modules/@intentius/chant/src/content-digest.ts +import { createHash } from "node:crypto"; +function contentDigest(input) { + return `sha256:${createHash("sha256").update(input, "utf8").digest("hex")}`; +} +var init_content_digest = __esm({ + "node_modules/@intentius/chant/src/content-digest.ts"() { + } +}); + +// node_modules/@intentius/chant/src/intrinsic.ts +function isIntrinsic(value) { + return typeof value === "object" && value !== null && INTRINSIC_MARKER in value && value[INTRINSIC_MARKER] === true; +} +var INTRINSIC_MARKER; +var init_intrinsic = __esm({ + "node_modules/@intentius/chant/src/intrinsic.ts"() { + INTRINSIC_MARKER = /* @__PURE__ */ Symbol.for("chant.intrinsic"); + } +}); + +// node_modules/@intentius/chant/src/effect-receipt.ts +function isEffectReceipt(value) { + return typeof value === "object" && value !== null && EFFECT_RECEIPT_MARKER in value && value[EFFECT_RECEIPT_MARKER] === true; +} +function splitReceiptEntities(entities) { + const applyBound = /* @__PURE__ */ new Map(); + const receipts = /* @__PURE__ */ new Map(); + for (const [name, entity] of entities) { + if (isEffectReceipt(entity)) receipts.set(name, entity); + else applyBound.set(name, entity); + } + return { applyBound, receipts }; +} +function canonicalJson(value) { + const out = encodeCanonical(value, "$", /* @__PURE__ */ new Set()); + if (out === void 0) { + throw new Error(`canonicalJson: value at $ is not representable in JSON`); + } + return out; +} +function encodeCanonical(value, path, seen) { + if (value !== null && (typeof value === "object" || typeof value === "function")) { + const toJSON = value.toJSON; + if (typeof toJSON === "function") { + value = toJSON.call(value); + } + } + if (value === void 0) return void 0; + if (value === null) return "null"; + switch (typeof value) { + case "boolean": + return value ? "true" : "false"; + case "number": + if (!Number.isFinite(value)) { + throw new Error(`canonicalJson: non-finite number at ${path}`); + } + return String(value); + // ECMAScript ToString — what JCS specifies. + case "string": + return JSON.stringify(value); + case "bigint": + throw new Error(`canonicalJson: bigint at ${path} is not representable in JSON`); + case "function": + case "symbol": + throw new Error(`canonicalJson: ${typeof value} at ${path} is not representable in JSON`); + } + const obj = value; + if (seen.has(obj)) { + throw new Error(`canonicalJson: circular structure at ${path}`); + } + seen.add(obj); + try { + if (Array.isArray(obj)) { + const parts2 = obj.map((el, i) => encodeCanonical(el, `${path}[${i}]`, seen) ?? "null"); + return `[${parts2.join(",")}]`; + } + const keys = Object.keys(obj).sort(); + const parts = []; + for (const key of keys) { + const encoded = encodeCanonical(obj[key], `${path}.${key}`, seen); + if (encoded !== void 0) parts.push(`${JSON.stringify(key)}:${encoded}`); + } + return `{${parts.join(",")}}`; + } finally { + seen.delete(obj); + } +} +var EFFECT_RECEIPT_MARKER; +var init_effect_receipt = __esm({ + "node_modules/@intentius/chant/src/effect-receipt.ts"() { + init_content_digest(); + init_declarable(); + init_intrinsic(); + EFFECT_RECEIPT_MARKER = /* @__PURE__ */ Symbol.for("chant.effect-receipt"); + } +}); + +// node_modules/@intentius/chant/src/build-params.ts +function buildParamValues(provenance) { + return Object.fromEntries(provenance.map((p) => [p.name, p.value])); +} +var init_build_params = __esm({ + "node_modules/@intentius/chant/src/build-params.ts"() { + } +}); + +// node_modules/@intentius/chant/src/types.ts +var init_types = __esm({ + "node_modules/@intentius/chant/src/types.ts"() { + } +}); + +// node_modules/@intentius/chant/src/errors.ts +var errors_exports2 = {}; +__export(errors_exports2, { + BuildError: () => BuildError, + DiscoveryError: () => DiscoveryError, + LintError: () => LintError +}); +var DiscoveryError, BuildError, LintError; +var init_errors3 = __esm({ + "node_modules/@intentius/chant/src/errors.ts"() { + DiscoveryError = class extends Error { + file; + type; + constructor(file2, message, type) { + super(message); + this.name = "DiscoveryError"; + this.file = file2; + this.type = type; + } + toJSON() { + return { + name: this.name, + file: this.file, + message: this.message, + type: this.type + }; + } + }; + BuildError = class extends Error { + entityName; + constructor(entityName, message) { + super(message); + this.name = "BuildError"; + this.entityName = entityName; + } + toJSON() { + return { + name: this.name, + entityName: this.entityName, + message: this.message + }; + } + }; + LintError = class extends Error { + file; + line; + column; + ruleId; + constructor(file2, line, column, ruleId, message) { + super(message); + this.name = "LintError"; + this.file = file2; + this.line = line; + this.column = column; + this.ruleId = ruleId; + } + toJSON() { + return { + name: this.name, + file: this.file, + line: this.line, + column: this.column, + ruleId: this.ruleId, + message: this.message + }; + } + }; + } +}); + +// node_modules/@intentius/chant/src/attrref.ts +var AttrRef; +var init_attrref = __esm({ + "node_modules/@intentius/chant/src/attrref.ts"() { + init_intrinsic(); + AttrRef = class { + [INTRINSIC_MARKER] = true; + parent; + attribute; + logicalName; + constructor(parent, attribute) { + this.parent = new WeakRef(parent); + this.attribute = attribute; + } + /** + * Set the logical name for this attribute reference + * @internal + */ + _setLogicalName(name) { + this.logicalName = name; + } + /** + * Get the logical name assigned to this attribute reference. + */ + getLogicalName() { + return this.logicalName; + } + /** + * Refuse to become a string (#2349). + * + * An `AttrRef` stands for a value the build resolves later, so it has no + * string form here. Without this, `` `${bucket.arn}-suffix` `` produced + * `"[object Object]-suffix"` and shipped it — and the fold path produced + * exactly the same wrong string from the `{__attrRef}` envelope, so the two + * paths agreed and the differential harness reported nothing. Agreement on a + * wrong value is the failure this class of check exists to catch, which is + * why this throws rather than returning something more helpful-looking. + * + * `toJSON` below is the honest serialization and is untouched: a serializer + * that wants the envelope asks for it by name. + */ + toString() { + const where = this.logicalName ? `${this.logicalName}.${this.attribute}` : `.${this.attribute}`; + throw new Error( + `A resource attribute reference (${where}) has no string form: it stands for a value the build resolves later, and interpolating it into a plain template literal would produce "[object Object]". Use the lexicon's own intrinsic, whose interior handles references \u2014 \`Sub\`\${\u2026}\`\` for CloudFormation \u2014 or move the reference out of the template.` + ); + } + /** + * The same refusal for `+` and for anything else that coerces, so + * `"prefix" + bucket.arn` fails where `` `${bucket.arn}` `` fails rather + * than taking a different path to the same wrong string. + */ + [Symbol.toPrimitive]() { + return this.toString(); + } + /** + * Serialize to a generic envelope. Lexicon-specific serializers should + * read `getLogicalName()` and `attribute` directly instead of relying + * on this format. + * @throws {Error} If logical name has not been set + */ + toJSON() { + if (!this.logicalName) { + throw new Error( + `Cannot serialize AttrRef for attribute "${this.attribute}": logical name not set` + ); + } + return { + __attrRef: { entity: this.logicalName, attribute: this.attribute } + }; + } + }; + } +}); + +// node_modules/@intentius/chant/src/utils.ts +function isAttrRefLike(value) { + if (value instanceof AttrRef) return true; + return typeof value === "object" && value !== null && "parent" in value && "attribute" in value && "_setLogicalName" in value && typeof value.parent === "object" && typeof value.attribute === "string"; +} +function getAttributes(entity) { + const attributes = []; + const obj = entity; + for (const key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + const value = obj[key]; + if (isAttrRefLike(value)) { + attributes.push(key); + } + } + } + return attributes; +} +var LOGICAL_NAME_SYMBOL; +var init_utils = __esm({ + "node_modules/@intentius/chant/src/utils.ts"() { + init_attrref(); + LOGICAL_NAME_SYMBOL = /* @__PURE__ */ Symbol.for("chant.logicalName"); + } +}); + +// node_modules/@intentius/chant/src/builder.ts +var init_builder = __esm({ + "node_modules/@intentius/chant/src/builder.ts"() { + } +}); + +// node_modules/@intentius/chant/src/serializer.ts +var init_serializer = __esm({ + "node_modules/@intentius/chant/src/serializer.ts"() { + } +}); + +// node_modules/@intentius/chant/src/lexicon-output.ts +function sanitizeLogicalId(...parts) { + const segments = parts.join("_").split(/[^A-Za-z0-9]+/).filter((segment) => segment.length > 0); + if (segments.length === 0) return "Output"; + return segments.map((segment, i) => i === 0 ? segment : segment.charAt(0).toUpperCase() + segment.slice(1)).join(""); +} +function isLexiconOutput(value) { + return typeof value === "object" && value !== null && LEXICON_OUTPUT_MARKER in value && value[LEXICON_OUTPUT_MARKER] === true; +} +var LEXICON_OUTPUT_MARKER, LexiconOutput; +var init_lexicon_output = __esm({ + "node_modules/@intentius/chant/src/lexicon-output.ts"() { + init_intrinsic(); + init_utils(); + LEXICON_OUTPUT_MARKER = /* @__PURE__ */ Symbol.for("chant.lexiconOutput"); + LexiconOutput = class _LexiconOutput { + [INTRINSIC_MARKER] = true; + /** @internal Brand marker — see {@link LEXICON_OUTPUT_MARKER}. Declared + * here only for type purposes; the real, non-enumerable property is + * installed by the constructor. */ + [LEXICON_OUTPUT_MARKER]; + sourceLexicon; + sourceEntity; + sourceAttribute; + outputName; + /** @internal WeakRef to the source entity object for identity-based matching */ + _sourceParent; + /** + * @internal Intrinsic value when constructed from an Intrinsic rather than AttrRef. + * Readable outside the class (like `_sourceParent` above) so the entity-wire + * encoder can reach it without an `as unknown as` cast that would erase type + * checking on every field it reads (#1047). + */ + _intrinsic; + /** + * @internal The already-resolved literal (string/number/boolean) when + * constructed from neither an AttrRef nor an Intrinsic — non-null exactly + * when `_intrinsic` is null AND `sourceAttribute` is null. There is no + * source entity or attribute to reference, so `getOutputValue()` returns + * this value verbatim rather than fabricating a `Fn::GetAtt` out of an + * unset attribute (chant #1121). Readable outside the class for the same + * reason as `_intrinsic`/`_sourceParent` above. + */ + _literalValue; + constructor(ref, name) { + Object.defineProperty(this, LEXICON_OUTPUT_MARKER, { + value: true, + enumerable: false + }); + if (isAttrRefLike(ref)) { + const parent = ref.parent.deref(); + if (!parent) { + throw new Error("Cannot create LexiconOutput: parent entity has been garbage collected"); + } + if (!("lexicon" in parent) || typeof parent.lexicon !== "string") { + throw new Error("Cannot create LexiconOutput: parent entity has no lexicon field"); + } + this.sourceLexicon = parent.lexicon; + this.sourceEntity = ""; + this.sourceAttribute = ref.attribute; + this.outputName = name; + this._sourceParent = ref.parent; + this._intrinsic = null; + this._literalValue = null; + } else if (isIntrinsic(ref)) { + this.sourceLexicon = ""; + this.sourceEntity = ""; + this.sourceAttribute = null; + this.outputName = name; + this._sourceParent = null; + this._intrinsic = ref; + this._literalValue = null; + } else if (typeof ref === "string" || typeof ref === "number" || typeof ref === "boolean") { + this.sourceLexicon = ""; + this.sourceEntity = ""; + this.sourceAttribute = null; + this.outputName = name; + this._sourceParent = null; + this._intrinsic = null; + this._literalValue = ref; + } else { + throw new Error( + `output(ref, "${name}"): ref must be an AttrRef, an Intrinsic, or an already-resolved string/number/boolean \u2014 got ${ref === null ? "null" : typeof ref} instead. If this came from a resource member access (e.g. "resource.SomeField"), that member is neither a generated attribute nor a real value here \u2014 check for a typo or a property that CloudFormation does not expose via Fn::GetAtt.` + ); + } + } + /** + * Set the source entity logical name. + * Called during build when entity names are resolved. + * @internal + */ + _setSourceEntity(name) { + this.sourceEntity = name; + } + /** + * Returns the CloudFormation Output Value for this output. + * For a literal output: the resolved value itself, verbatim. + * For AttrRef-based outputs: emits Fn::GetAtt. + * For Intrinsic-based outputs: delegates to the intrinsic's toJSON(). + */ + getOutputValue() { + if (this._literalValue !== null) { + return this._literalValue; + } + if (this._intrinsic) { + return this._intrinsic.toJSON(); + } + return { "Fn::GetAtt": [this.sourceEntity, this.sourceAttribute] }; + } + /** + * Create a LexiconOutput with an auto-generated name from entity name and attribute. + * Used during cross-lexicon ref auto-detection. + * + * The name is sanitized to a valid CloudFormation logical id (see + * {@link sanitizeLogicalId}) since it is used verbatim as the `Outputs` + * key by lexicon serializers (e.g. AWS CloudFormation), which reject + * dots or underscores in logical ids. + * + * @param ref - The AttrRef pointing to the source entity + * @param entityName - The logical name of the source entity + * @returns A LexiconOutput with a name derived from `{entityName}{Attribute}` + */ + static auto(ref, entityName) { + const name = sanitizeLogicalId(entityName, ref.attribute); + const output = new _LexiconOutput(ref, name); + output._setSourceEntity(entityName); + return output; + } + toJSON() { + return { "chant::output": this.outputName }; + } + }; + } +}); + +// node_modules/@intentius/chant/src/discovery/files.ts +function hasSkipMarker(head) { + return SKIP_MARKER_PATTERN.test(head.slice(0, SKIP_MARKER_HEAD_BYTES)); +} +function hasDiscoveryMarkerSync(file2) { + const head = readHead(file2, SKIP_MARKER_HEAD_BYTES); + return head.slice(0, 256).includes(GENERATED_MARKER) || hasSkipMarker(head); +} +function isSourceFileName(name) { + return name.endsWith(".ts") && !name.endsWith(".test.ts") && !name.endsWith(".spec.ts"); +} +async function findInfraFiles(path, options) { + const globs = options?.globs === null ? void 0 : options?.globs ?? await resolveDiscoveryGlobs(path); + return walkDiscovery({ + walker: "source", + root: path, + globs, + excludeDirs: await workspaceMemberDirs(path), + accept: (name, full) => isSourceFileName(name) && !hasDiscoveryMarkerSync(full) + }); +} +var GENERATED_MARKER, SKIP_MARKER_HEAD_BYTES, SKIP_MARKER_PATTERN; +var init_files = __esm({ + "node_modules/@intentius/chant/src/discovery/files.ts"() { + init_config(); + init_walk(); + GENERATED_MARKER = "Generated by chant \u2014 do not edit directly"; + SKIP_MARKER_HEAD_BYTES = 1024; + SKIP_MARKER_PATTERN = /^[ \t]*(?:\/\/|\/\*+|\*)[ \t]*chant-discovery-skip(?![\w-])/m; + } +}); + +// node_modules/@intentius/chant/src/discovery/import.ts +async function importModule(path) { + const failed = evaluationFailures.get(path); + if (failed) throw failed; + try { + return await import(path); + } catch (error51) { + const message = error51 instanceof Error ? error51.message : "Unknown import error"; + const discoveryError = new DiscoveryError(path, message, "import"); + evaluationFailures.set(path, discoveryError); + throw discoveryError; + } +} +var evaluationFailures; +var init_import = __esm({ + "node_modules/@intentius/chant/src/discovery/import.ts"() { + init_errors3(); + evaluationFailures = /* @__PURE__ */ new Map(); + } +}); + +// node_modules/@intentius/chant/src/discovery/collect.ts +import { basename, dirname as dirname9, relative as relative4, resolve as resolve5 } from "node:path"; +function exportKey(rawName, file2) { + if (rawName !== "default") return rawName; + return basename(file2).replace(/\.ts$/, "").replace(/\.op$/, ""); +} +function stackPrefix(file2, buildRoot) { + const dir = dirname9(file2); + const rel = buildRoot ? relative4(resolve5(buildRoot), resolve5(dir)) : dir; + const segments = rel.split(/[^A-Za-z0-9]+/).filter((s) => s.length > 0); + return segments.map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(""); +} +function enumerateEntries(modules) { + const entries = []; + for (const { file: file2, exports } of modules) { + const sortedExports = Object.entries(exports).sort(([a], [b]) => a.localeCompare(b)); + for (const [rawName, value] of sortedExports) { + const name = exportKey(rawName, file2); + if (isDeclarable(value)) { + entries.push({ bareKey: name, value, file: file2, provenance: { sourceFile: file2, paths: AUTHORED_ROOT } }); + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (isDeclarable(item)) { + entries.push({ bareKey: `${name}_${i}`, value: item, file: file2, provenance: { sourceFile: file2, paths: AUTHORED_ROOT } }); + } else if (isCompositeInstance(item)) { + const indexedName = `${name}_${i}`; + for (const [expandedName, entity] of expandComposite(indexedName, item)) { + entries.push({ + bareKey: expandedName, + value: entity, + file: file2, + provenance: { sourceFile: file2, compositeInstance: indexedName } + }); + } + } + } + } else if (isCompositeInstance(value)) { + for (const [expandedName, entity] of expandComposite(name, value)) { + entries.push({ + bareKey: expandedName, + value: entity, + file: file2, + provenance: { sourceFile: file2, compositeInstance: name } + }); + } + } else if (isLexiconOutput(value)) { + entries.push({ bareKey: name, value, file: file2, provenance: { sourceFile: file2 } }); } - return "an array-destructured `const` in a function body is not foldable"; } } - return void 0; -} -function insideFunctionBody(node, what) { - if (functionBodyDepth === 0) return void 0; - return foldError(node, `${what} inside a folded function body is not foldable`); -} -function fileLabel(file2) { - const rel = relative3(process.cwd(), file2); - return rel.startsWith("..") ? file2 : rel; + return entries; } -function callFoldableFunction(callee, node, consts, intrinsics, externals) { - const label = `call to "${callee.name}" (${fileLabel(callee.file)})`; - const violation = findFunctionSubsetViolation(callee.fn); - if (violation) throw foldError(node, `${label} is not foldable: ${violation}`); - if (functionBodyDepth >= MAX_FUNCTION_CALL_DEPTH) { - throw foldError(node, `${label} is not foldable: call depth exceeded \u2014 is it recursive?`); - } - const args = []; - for (const arg of node.arguments) { - if (ts2.isSpreadElement(arg)) throw foldError(arg, `${label} is not foldable: a spread argument is not foldable`); - args.push(fold(arg, consts, intrinsics, externals)); - } - const bodyConsts = new Map(callee.consts); - const bodyExternals = new Map(callee.externals); - const bind = (name, value) => { - bodyConsts.delete(name); - bodyExternals.set(name, value); - }; - const destructure = (pattern, value) => { - if (value === null || typeof value !== "object") { - throw foldError(pattern, `destructured source in \`${briefNodeText(pattern)}\` is not an object`); - } - for (const el of pattern.elements) { - bind(el.name.text, value[plainBindingKey(el)]); - } - }; - functionBodyDepth += 1; - try { - const result = evaluateFunctionBody(callee, args, bodyConsts, bodyExternals, intrinsics, bind, destructure); - if (!callee.leakedIdentity && carriesLiveObject(result) && !args.some((arg) => carriesLiveObject(arg))) { - callee.leakedIdentity = true; +function collectEntities(modules, buildRoot) { + const entries = enumerateEntries(modules); + const dirsByKey = /* @__PURE__ */ new Map(); + for (const { bareKey, value, file: file2 } of entries) { + const dir = dirname9(file2); + let byDir = dirsByKey.get(bareKey); + if (!byDir) { + byDir = /* @__PURE__ */ new Map(); + dirsByKey.set(bareKey, byDir); } - return result; - } catch (err) { - if (!(err instanceof FoldError)) throw err; - const prefix = `${err.line}:${err.column} - `; - const inner2 = err.message.startsWith(prefix) ? err.message.slice(prefix.length) : err.message; - let reason = inner2; - const unresolved = /^unresolved identifier: (\w+)$/.exec(inner2); - if (unresolved && callee.failures?.has(unresolved[1])) { - reason = `${inner2} (${callee.failures.get(unresolved[1])})`; + let objs = byDir.get(dir); + if (!objs) { + objs = /* @__PURE__ */ new Set(); + byDir.set(dir, objs); } - throw foldError( - node, - `${label} is not foldable: ${fileLabel(callee.file)}:${err.line}:${err.column} - ${reason}`, - err.ruleId - ); - } finally { - functionBodyDepth -= 1; + objs.add(value); } -} -function evaluateFunctionBody(callee, args, bodyConsts, bodyExternals, intrinsics, bind, destructure) { - callee.fn.parameters.forEach((param, i) => { - let value = args[i]; - if (value === void 0 && param.initializer) { - value = fold(param.initializer, bodyConsts, intrinsics, bodyExternals); - } - if (ts2.isIdentifier(param.name)) bind(param.name.text, value); - else destructure(param.name, value); - }); - const body = callee.fn.body; - if (!ts2.isBlock(body)) return fold(body, bodyConsts, intrinsics, bodyExternals); - for (const statement of body.statements) { - if (ts2.isReturnStatement(statement)) { - return statement.expression ? fold(statement.expression, bodyConsts, intrinsics, bodyExternals) : void 0; + const crossDirKeys = /* @__PURE__ */ new Set(); + for (const [bareKey, byDir] of dirsByKey) { + const dirsWithObjects = [...byDir.values()].filter((objs) => objs.size > 0).length; + const distinctObjects = /* @__PURE__ */ new Set(); + for (const objs of byDir.values()) for (const o of objs) distinctObjects.add(o); + if (dirsWithObjects > 1 && distinctObjects.size > 1) crossDirKeys.add(bareKey); + } + const entities = /* @__PURE__ */ new Map(); + const claimedByDir = /* @__PURE__ */ new Map(); + for (const { bareKey, value, file: file2, provenance } of entries) { + const dir = dirname9(file2); + let perDir = claimedByDir.get(bareKey); + if (!perDir) { + perDir = /* @__PURE__ */ new Map(); + claimedByDir.set(bareKey, perDir); } - for (const decl of statement.declarationList.declarations) { - const value = fold(decl.initializer, bodyConsts, intrinsics, bodyExternals); - if (ts2.isIdentifier(decl.name)) bind(decl.name.text, value); - else destructure(decl.name, value); + const claimed = perDir.get(dir); + if (claimed !== void 0 && claimed !== value) { + throw new DiscoveryError(file2, `Duplicate export name "${bareKey}" found`, "resolution"); } - } - return void 0; -} -function locate(node) { - const sourceFile = node.getSourceFile(); - const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); - return { line: line + 1, column: character + 1 }; -} -function foldError(node, message, ruleId = "EVL001") { - const { line, column } = locate(node); - return new FoldError(message, line, column, ruleId); -} -function collectConsts(sourceFile) { - const consts = /* @__PURE__ */ new Map(); - for (const statement of sourceFile.statements) { - if (!ts2.isVariableStatement(statement)) continue; - if ((statement.declarationList.flags & ts2.NodeFlags.Const) === 0) continue; - for (const decl of statement.declarationList.declarations) { - if (ts2.isIdentifier(decl.name) && decl.initializer) { - consts.set(decl.name.text, decl.initializer); + perDir.set(dir, value); + const key = crossDirKeys.has(bareKey) ? `${stackPrefix(file2, buildRoot)}${bareKey}` : bareKey; + const existing = entities.get(key); + if (existing !== void 0) { + if (existing !== value) { + throw new DiscoveryError(file2, `Duplicate export name "${bareKey}" found`, "resolution"); } + continue; } + setProvenance(value, provenance); + entities.set(key, value); } - return consts; -} -function propName(node) { - if (isLiteralPropertyName(node)) return node.text; - throw foldError(node, computedPropertyNameMessage(node)); -} -function elementKey(node) { - if (isLiteralElementKey(node)) return node.text; - throw foldError(node, dynamicElementAccessMessage(node), "EVL003"); -} -function resolvesToResource(consts, ident) { - const init = consts.get(ident.text); - return init !== void 0 && ts2.isNewExpression(init); -} -function isUnclaimedBareCall(node, consts, intrinsics, externals) { - if (!ts2.isCallExpression(node) || !ts2.isIdentifier(node.expression)) return false; - const name = node.expression.text; - if (consts.has(name)) return false; - if (isFoldableHelperName(name)) return false; - if (intrinsics.some((i) => i.name === name && intrinsicCallFolds(i))) return false; - if (isFoldableFunction(externals?.get(name))) return false; - return true; -} -function isFoldedResource(value) { - return typeof value === "object" && value !== null && !Array.isArray(value) && "__resource" in value; -} -function isFoldSymbolicEnvelope(value) { - if (typeof value !== "object" || value === null || Array.isArray(value)) return false; - return "__attrRef" in value || "__intrinsic" in value || "__helper" in value || "__resource" in value || "__compositeStep" in value; + return entities; } -function attrRefOnFoldedResource(node, attribute) { - if (ts2.isIdentifier(node.expression)) { - return { __attrRef: { entity: node.expression.text, attribute } }; +var AUTHORED_ROOT; +var init_collect = __esm({ + "node_modules/@intentius/chant/src/discovery/collect.ts"() { + init_declarable(); + init_composite(); + init_lexicon_output(); + init_errors3(); + init_provenance(); + AUTHORED_ROOT = { "": { kind: "authored" } }; } - throw foldError( - node, - `attribute "${attribute}" read on an inline resource expression is not foldable \u2014 bind the resource to a const first (falls back to run)` - ); -} -function isChainShortCircuit(value) { - return value === CHAIN_SHORT_CIRCUIT; -} -function shortCircuited(node) { - return continuesOptionalChain(node) ? CHAIN_SHORT_CIRCUIT : void 0; -} -function continuesOptionalChain(node) { - const parent = node.parent; - if (parent === void 0) return false; - if (ts2.isNonNullExpression(parent) && ts2.isOptionalChain(parent)) return continuesOptionalChain(parent); - return (ts2.isPropertyAccessExpression(parent) || ts2.isElementAccessExpression(parent) || ts2.isCallExpression(parent)) && parent.expression === node && ts2.isOptionalChain(parent); -} -function nullishAccessMessage(member, obj) { - return `property "${member}" read on ${String(obj)} is not foldable \u2014 running this expression throws a TypeError, so the file falls back to run (write \`?.\` if the value is genuinely optional)`; -} -function isUnresolvedSymbolChain(node, consts, externals) { - if (ts2.isIdentifier(node)) { - return node.text !== "undefined" && !consts.has(node.text) && !externals?.has(node.text); +}); + +// node_modules/@intentius/chant/src/discovery/cycles.ts +function normalizeGraph(graph) { + if (graph instanceof Map) return graph; + const result = /* @__PURE__ */ new Map(); + for (const [node, neighbors] of Object.entries(graph)) { + result.set(node, new Set(neighbors)); } - if (ts2.isPropertyAccessExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); - if (ts2.isElementAccessExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); - if (ts2.isNonNullExpression(node)) return isUnresolvedSymbolChain(node.expression, consts, externals); - return false; + return result; } -function foldIntrinsicValue(node, consts, intrinsics, externals) { - if (isUnresolvedSymbolChain(node, consts, externals)) { - return { __symbol: node.getText() }; +function detectCycles(graph) { + const g = normalizeGraph(graph); + const WHITE = 0; + const GRAY = 1; + const BLACK = 2; + const color = /* @__PURE__ */ new Map(); + const parent = /* @__PURE__ */ new Map(); + const cycles = []; + const reportedCycles = /* @__PURE__ */ new Set(); + for (const node of g.keys()) { + color.set(node, WHITE); } - return fold(node, consts, intrinsics, externals); -} -function foldTaggedTemplate(node, consts, intrinsics, externals) { - const tagName = node.tag.getText(); - const isRegistered = intrinsics.some((i) => i.name === tagName && intrinsicTagFolds(i)); - if (!isRegistered) { - throw foldError(node, `unregistered tagged template intrinsic: ${briefNodeText(node.tag)}\`...\``); + function dfs(node) { + color.set(node, GRAY); + const neighbors = g.get(node) ?? /* @__PURE__ */ new Set(); + for (const neighbor of neighbors) { + const c = color.get(neighbor); + if (c === void 0 || c === WHITE) { + if (c === void 0) { + continue; + } + parent.set(neighbor, node); + dfs(neighbor); + } else if (c === GRAY) { + const cycle = [neighbor]; + let current = node; + while (current !== neighbor) { + cycle.push(current); + current = parent.get(current); + } + cycle.push(neighbor); + cycle.reverse(); + const key = normalizeCycleKey(cycle); + if (!reportedCycles.has(key)) { + reportedCycles.add(key); + cycles.push(cycle.slice(0, -1)); + } + } + } + color.set(node, BLACK); } - const template = node.template; - if (ts2.isNoSubstitutionTemplateLiteral(template)) { - return { __intrinsic: tagName, strings: [template.text], values: [] }; + for (const node of g.keys()) { + if (color.get(node) === WHITE) { + dfs(node); + } } - const strings = [template.head.text, ...template.templateSpans.map((span) => span.literal.text)]; - const values = template.templateSpans.map( - (span) => foldIntrinsicValue(span.expression, consts, intrinsics, externals) - ); - return { __intrinsic: tagName, strings, values }; + return cycles; } -function fold(node, consts, intrinsics = [], externals) { - if (ts2.isParenthesizedExpression(node) || ts2.isAsExpression(node) || ts2.isSatisfiesExpression(node) || ts2.isNonNullExpression(node)) { - return fold(node.expression, consts, intrinsics, externals); - } - if (ts2.isArrowFunction(node) || ts2.isFunctionExpression(node)) { - throw foldError(node, "a function used as a value is not foldable"); - } - if (ts2.isStringLiteral(node) || ts2.isNoSubstitutionTemplateLiteral(node)) { - return node.text; +function normalizeCycleKey(cycle) { + const nodes = cycle.slice(0, -1); + let minIdx = 0; + for (let i = 1; i < nodes.length; i++) { + if (nodes[i] < nodes[minIdx]) { + minIdx = i; + } } - if (ts2.isNumericLiteral(node)) { - return Number(node.text); + const rotated = [...nodes.slice(minIdx), ...nodes.slice(0, minIdx)]; + return rotated.join(","); +} +var init_cycles = __esm({ + "node_modules/@intentius/chant/src/discovery/cycles.ts"() { } - if (node.kind === ts2.SyntaxKind.TrueKeyword) return true; - if (node.kind === ts2.SyntaxKind.FalseKeyword) return false; - if (node.kind === ts2.SyntaxKind.NullKeyword) return null; - if (ts2.isIdentifier(node) && node.text === "undefined") return void 0; - if (ts2.isTaggedTemplateExpression(node)) { - const inside = insideFunctionBody(node, "a tagged template intrinsic"); - if (inside) throw inside; - return foldTaggedTemplate(node, consts, intrinsics, externals); +}); + +// node_modules/@intentius/chant/src/sort.ts +function topologicalSort(dependencies) { + const cycles = detectCycles(dependencies); + if (cycles.length > 0) { + const cycleStr = cycles[0].join(" -> "); + throw new BuildError( + cycles[0][0], + `Circular dependency detected: ${cycleStr}` + ); } - if (ts2.isTemplateExpression(node)) { - let out = node.head.text; - for (const span of node.templateSpans) { - const value = fold(span.expression, consts, intrinsics, externals); - const symbolic = symbolicEnvelopeKind(value); - if (symbolic) { - throw foldError( - span.expression, - `${symbolic} interpolated into a plain template literal, which would stringify it as "[object Object]". A symbolic value has no string form until the build resolves it, so a plain template cannot carry one. Use the lexicon's own intrinsic, whose interior handles envelopes \u2014 \`Sub\`\${\u2026}\`\` for CloudFormation \u2014 or move the reference out of the template.` - ); - } - out += String(value) + span.literal.text; + const sorted = []; + const visited = /* @__PURE__ */ new Set(); + const visiting = /* @__PURE__ */ new Set(); + function visit(node) { + if (visited.has(node)) { + return; } - return out; - } - if (ts2.isObjectLiteralExpression(node)) { - const obj = {}; - for (const prop of node.properties) { - if (ts2.isPropertyAssignment(prop)) { - obj[propName(prop.name)] = fold(prop.initializer, consts, intrinsics, externals); - } else if (ts2.isShorthandPropertyAssignment(prop)) { - obj[prop.name.text] = fold(prop.name, consts, intrinsics, externals); - } else if (ts2.isSpreadAssignment(prop)) { - const src = fold(prop.expression, consts, intrinsics, externals); - if (src === null || typeof src !== "object") { - throw foldError(prop, "spread source not an object"); - } - Object.assign(obj, src); - } else { - throw foldError(prop, UNSUPPORTED_OBJECT_MEMBER_MESSAGE); + visiting.add(node); + const deps = dependencies[node] || []; + for (const dep of deps) { + if (!visited.has(dep)) { + visit(dep); } } - return obj; + visiting.delete(node); + visited.add(node); + sorted.push(node); } - if (ts2.isArrayLiteralExpression(node)) { - const arr = []; - for (const el of node.elements) { - if (ts2.isSpreadElement(el)) { - const src = fold(el.expression, consts, intrinsics, externals); - if (!Array.isArray(src)) { - throw foldError(el, "spread source not an array"); - } - arr.push(...src); - } else { - arr.push(fold(el, consts, intrinsics, externals)); - } + for (const node of Object.keys(dependencies)) { + if (!visited.has(node)) { + visit(node); } - return arr; } - if (ts2.isIdentifier(node)) { - if (!consts.has(node.text)) { - if (externals?.has(node.text)) { - const external = externals.get(node.text); - if (isFoldableFunction(external)) { - throw foldError(node, `function "${node.text}" used as a value is not foldable`); + return sorted; +} +var init_sort = __esm({ + "node_modules/@intentius/chant/src/sort.ts"() { + init_errors3(); + init_cycles(); + } +}); + +// node_modules/@intentius/chant/src/discovery/resolve.ts +function resolveAttrRefs(entities) { + for (const [name, entity] of entities.entries()) { + entity[LOGICAL_NAME_SYMBOL] = name; + } + for (const [name, entity] of entities.entries()) { + const attributes = getAttributes(entity); + for (const attrName of attributes) { + const attrRef = entity[attrName]; + if (isAttrRefLike(attrRef)) { + const parent = attrRef.parent.deref(); + if (!parent) { + throw new Error( + `Cannot resolve AttrRef on "${name}.${attrName}": parent has been garbage collected` + ); } - if (typeof external === "function" && intrinsics.some((i) => i.name === node.text && intrinsicCallFoldsEagerly(i))) { - throw foldError(node, `function "${node.text}" used as a value is not foldable \u2014 call it instead`); + let parentLogicalName; + for (const [entityName, entityValue] of entities.entries()) { + if (entityValue === parent) { + parentLogicalName = entityName; + break; + } } - return external; - } - if (node.text === "process") { - throw foldError( - node, - `ambient "process" read is not foldable \u2014 declare a build-time parameter instead (chant.config.ts's buildParams + \`chant build --param name=value\`/\`--params-file\`) and reference it via \`import { params } from "@intentius/chant/params"\`, rather than reading process.env directly` - ); + if (!parentLogicalName) { + throw new Error( + `Cannot resolve AttrRef on "${name}.${attrName}": parent entity not found in entities collection` + ); + } + attrRef._setLogicalName(parentLogicalName); } - throw foldError(node, `unresolved identifier: ${node.text}`); - } - const initializer3 = consts.get(node.text); - if (ts2.isNewExpression(initializer3)) { - if (externals?.has(node.text)) return externals.get(node.text); - throw foldError( - node, - `same-file resource \`${node.text}\` used as a value is not foldable \u2014 falls back to run` - ); } - return fold(initializer3, consts, intrinsics, externals); } - if (ts2.isPropertyAccessExpression(node)) { - if (ts2.isIdentifier(node.expression) && resolvesToResource(consts, node.expression)) { - return { __attrRef: { entity: node.expression.text, attribute: node.name.text } }; - } - if (node.name.text === "step" && isUnclaimedBareCall(node.expression, consts, intrinsics, externals)) { - const call = node.expression; - const calleeName = call.expression.text; - const inside = insideFunctionBody(node, `composite call \`${calleeName}(...).step\``); - if (inside) throw inside; - return { - __compositeStep: calleeName, - args: call.arguments.map((arg) => fold(arg, consts, intrinsics, externals)) - }; - } - const obj = fold(node.expression, consts, intrinsics, externals); - if (isChainShortCircuit(obj)) return shortCircuited(node); - if (obj === null || obj === void 0) { - if (node.questionDotToken) return shortCircuited(node); - throw foldError(node, nullishAccessMessage(node.name.text, obj)); - } - if (isFoldedResource(obj)) return attrRefOnFoldedResource(node, node.name.text); - return obj[node.name.text]; +} +var init_resolve = __esm({ + "node_modules/@intentius/chant/src/discovery/resolve.ts"() { + init_utils(); } - if (ts2.isElementAccessExpression(node)) { - const key = elementKey(node.argumentExpression); - if (ts2.isIdentifier(node.expression) && resolvesToResource(consts, node.expression)) { - return { __attrRef: { entity: node.expression.text, attribute: key } }; - } - const obj = fold(node.expression, consts, intrinsics, externals); - if (isChainShortCircuit(obj)) return shortCircuited(node); - if (obj === null || obj === void 0) { - if (node.questionDotToken) return shortCircuited(node); - throw foldError(node, nullishAccessMessage(key, obj)); - } - if (isFoldedResource(obj)) return attrRefOnFoldedResource(node, key); - return obj[key]; +}); + +// node_modules/@intentius/chant/src/discovery/graph.ts +function buildDependencyGraph(entities) { + const graph = /* @__PURE__ */ new Map(); + for (const name of entities.keys()) { + graph.set(name, /* @__PURE__ */ new Set()); } - if (ts2.isPrefixUnaryExpression(node)) { - if (!SUPPORTED_UNARY_OPERATORS.has(node.operator)) { - throw foldError(node, UNSUPPORTED_UNARY_MESSAGE); - } - const value = fold(node.operand, consts, intrinsics, externals); - if (node.operator === ts2.SyntaxKind.ExclamationToken) return !value; - return -value; + const entityToName = /* @__PURE__ */ new Map(); + for (const [name, entity] of entities.entries()) { + entityToName.set(entity, name); } - if (ts2.isBinaryExpression(node)) { - const opKind = node.operatorToken.kind; - const S = ts2.SyntaxKind; - if (opKind === S.AmpersandAmpersandToken) { - const left2 = fold(node.left, consts, intrinsics, externals); - return left2 ? fold(node.right, consts, intrinsics, externals) : left2; - } - if (opKind === S.BarBarToken) { - const left2 = fold(node.left, consts, intrinsics, externals); - return left2 ? left2 : fold(node.right, consts, intrinsics, externals); - } - if (opKind === S.QuestionQuestionToken) { - const left2 = fold(node.left, consts, intrinsics, externals); - return left2 === null || left2 === void 0 ? fold(node.right, consts, intrinsics, externals) : left2; - } - if (!SUPPORTED_BINARY_OPERATORS.has(opKind)) { - throw foldError(node, unsupportedBinaryMessage(opKind)); - } - const left = fold(node.left, consts, intrinsics, externals); - const right = fold(node.right, consts, intrinsics, externals); - switch (opKind) { - case S.PlusToken: - return left + right; - case S.MinusToken: - return left - right; - case S.AsteriskToken: - return left * right; - case S.SlashToken: - return left / right; - case S.EqualsEqualsEqualsToken: - return left === right; - case S.ExclamationEqualsEqualsToken: - return left !== right; - case S.GreaterThanToken: - return left > right; - case S.LessThanToken: - return left < right; - case S.GreaterThanEqualsToken: - return left >= right; - case S.LessThanEqualsToken: - return left <= right; - default: - throw foldError(node, unsupportedBinaryMessage(opKind)); - } + for (const [name, entity] of entities.entries()) { + const dependencies = graph.get(name); + const visited = /* @__PURE__ */ new Set(); + scanProperties(entity, entities, entityToName, dependencies, visited, entity); } - if (ts2.isConditionalExpression(node)) { - return fold(node.condition, consts, intrinsics, externals) ? fold(node.whenTrue, consts, intrinsics, externals) : fold(node.whenFalse, consts, intrinsics, externals); + return graph; +} +function scanProperties(obj, entities, entityToName, dependencies, visited, rootEntity) { + if (!isDeclarable(obj) && !visited.has(obj)) { + visited.add(obj); } - if (ts2.isNewExpression(node)) { - if (!ts2.isIdentifier(node.expression)) { - throw foldError( - node, - `nested \`new ${briefNodeText(node.expression)}(...)\` as a value needs a plain imported constructor \u2014 falls back to run` - ); + if (Array.isArray(obj)) { + for (const item of obj) { + findDependencies(item, entities, entityToName, dependencies, visited, rootEntity); } - const inside = insideFunctionBody(node, `\`new ${node.expression.text}(...)\``); - if (inside) throw inside; - return foldResource(node, consts, intrinsics, externals); + return; } - if (ts2.isCallExpression(node)) { - if (ts2.isIdentifier(node.expression) && isFoldableHelperName(node.expression.text) && !consts.has(node.expression.text)) { - const inside = insideFunctionBody(node, `authoring helper call \`${node.expression.text}(...)\``); - if (inside) throw inside; - return { - __helper: node.expression.text, - args: node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)) - }; + for (const prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + const propValue = obj[prop]; + findDependencies( + propValue, + entities, + entityToName, + dependencies, + visited, + rootEntity + ); } - if (ts2.isIdentifier(node.expression) && !consts.has(node.expression.text)) { - const calleeName = node.expression.text; - if (intrinsics.some((i) => i.name === calleeName && intrinsicCallFolds(i))) { - const inside = insideFunctionBody(node, `intrinsic call \`${calleeName}(...)\``); - if (inside) throw inside; - return { - __intrinsic: calleeName, - args: node.arguments.map((arg) => foldIntrinsicValue(arg, consts, intrinsics, externals)) - }; - } + } +} +function findDependencies(value, entities, entityToName, dependencies, visited, rootEntity) { + if (value === null || value === void 0) { + return; + } + if (typeof value !== "object") { + return; + } + if (isAttrRefLike(value)) { + if (visited.has(value)) { + return; } - if (ts2.isIdentifier(node.expression)) { - const callee = externals?.get(node.expression.text); - if (isFoldableFunction(callee)) { - return callFoldableFunction(callee, node, consts, intrinsics, externals); - } - if (externals === void 0) { - const local = sameFileFunctions(node, consts)?.get(node.expression.text); - if (local) return callFoldableFunction(local, node, consts, intrinsics, local.externals); + visited.add(value); + const parent = value.parent.deref(); + if (parent && isDeclarable(parent) && parent !== rootEntity) { + const parentName = entityToName.get(parent); + if (parentName) { + dependencies.add(parentName); } } - if (ts2.isIdentifier(node.expression) && !consts.has(node.expression.text) && intrinsics.some((i) => i.name === node.expression.text && intrinsicCallFoldsEagerly(i))) { - const callee = externals?.get(node.expression.text); - if (typeof callee !== "function") { - throw foldError(node, `"${node.expression.text}" did not resolve to a function \u2014 falls back to run`); + return; + } + if (isDeclarable(value)) { + if (value === rootEntity) { + if (visited.has(value)) { + const referencedName2 = entityToName.get(value); + if (referencedName2) { + dependencies.add(referencedName2); + } + return; } - const args = node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)); - return callee(...args); + visited.add(value); + scanProperties(value, entities, entityToName, dependencies, visited, rootEntity); + return; } - if (ts2.isPropertyAccessExpression(node.expression)) { - const methodName = node.expression.name.text; - const receiver = fold(node.expression.expression, consts, intrinsics, externals); - if (isChainShortCircuit(receiver)) return shortCircuited(node); - if (receiver === null || receiver === void 0) { - if (node.expression.questionDotToken) return shortCircuited(node); - throw foldError(node, `cannot call ".${methodName}(...)" on ${String(receiver)}`); - } - if (isFoldSymbolicEnvelope(receiver)) { - throw foldError( - node, - `method call \`.${methodName}(...)\` on an unresolved value is not foldable \u2014 falls back to run` - ); - } - const method = receiver[methodName]; - if (typeof method !== "function") { - throw foldError(node, `"${methodName}" is not a callable method on the folded value \u2014 falls back to run`); - } - const args = node.arguments.map((arg) => fold(arg, consts, intrinsics, externals)); - return method.apply(receiver, args); + const referencedName = entityToName.get(value); + if (referencedName) { + dependencies.add(referencedName); } - throw foldError(node, callExpressionMessage(node)); - } - throw foldError(node, unsupportedExpressionMessage(node)); -} -function foldResource(node, consts, intrinsics = [], externals) { - const typeName = node.expression.getText(); - const args = node.arguments ?? []; - const [firstArg, secondArg] = args; - const foldArg = (arg) => fold(arg, consts, intrinsics, externals); - if (!firstArg) { - return { __resource: typeName, props: {} }; + return; } - if (ts2.isObjectLiteralExpression(firstArg)) { - const props2 = foldArg(firstArg); - if (args.length === 1) { - return { __resource: typeName, props: props2 }; - } - if (args.length === 2 && ts2.isObjectLiteralExpression(secondArg)) { - return { __resource: typeName, props: props2, attributes: foldArg(secondArg) }; - } + if (visited.has(value)) { + return; } - const folded = args.map(foldArg); - const propsIndex = args.findIndex((arg) => ts2.isObjectLiteralExpression(arg)); - const props = propsIndex === -1 ? {} : folded[propsIndex]; - return { __resource: typeName, props, args: folded }; + scanProperties(value, entities, entityToName, dependencies, visited, rootEntity); } -var ts2, FoldError, FoldableFunction, sameFileFunctionCache, functionBodyDepth, MAX_FUNCTION_CALL_DEPTH, CHAIN_SHORT_CIRCUIT; -var init_fold = __esm({ - "node_modules/@intentius/chant/src/fold/fold.ts"() { - ts2 = __toESM(require_typescript(), 1); - init_lexicon(); - init_subset(); - init_foldable_helpers(); - FoldError = class extends Error { - line; - column; - ruleId; - constructor(message, line, column, ruleId = "EVL001") { - const prevStackTraceLimit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - super(`${line}:${column} - ${message}`); - Error.stackTraceLimit = prevStackTraceLimit; - this.name = "FoldError"; - this.line = line; - this.column = column; - this.ruleId = ruleId; - } - }; - FoldableFunction = class { - constructor(name, fn, file2, consts, externals, failures) { - this.name = name; - this.fn = fn; - this.file = file2; - this.consts = consts; - this.externals = externals; - this.failures = failures; - } - name; - fn; - file; - consts; - externals; - failures; - /** - * Set once a call to this function has RETURNED a live object (a value - * with a prototype — a pre-built resource instance of the defining module, - * say) into a caller. The caller then shares that object's identity with - * the defining module exactly as an imported resource binding would, and - * fold-import.ts records the same `liveSources` edge for it so the two - * files fold or run together. A function that returns only plain data never - * sets this, which is what keeps a parameter helper from tainting anything. - */ - leakedIdentity = false; - }; - sameFileFunctionCache = /* @__PURE__ */ new WeakMap(); - functionBodyDepth = 0; - MAX_FUNCTION_CALL_DEPTH = 32; - CHAIN_SHORT_CIRCUIT = /* @__PURE__ */ Symbol("chant.fold.optional-chain-short-circuit"); +var init_graph = __esm({ + "node_modules/@intentius/chant/src/discovery/graph.ts"() { + init_declarable(); + init_utils(); } }); // node_modules/@intentius/chant/src/discovery/param-deps.ts function literalName(name) { if (!name) return void 0; - if (ts3.isIdentifier(name) || ts3.isStringLiteral(name) || ts3.isNumericLiteral(name)) return name.text; + if (ts4.isIdentifier(name) || ts4.isStringLiteral(name) || ts4.isNumericLiteral(name)) return name.text; return void 0; } -function unwrap(expr) { +function unwrap2(expr) { let current = expr; for (; ; ) { - if (ts3.isParenthesizedExpression(current) || ts3.isAsExpression(current) || ts3.isNonNullExpression(current)) { + if (ts4.isParenthesizedExpression(current) || ts4.isAsExpression(current) || ts4.isNonNullExpression(current)) { current = current.expression; continue; } @@ -233055,24 +237591,24 @@ function unwrap(expr) { function readParams(expr, consts, paramLocals, out) { const followed = /* @__PURE__ */ new Set(); const visit = (node) => { - if (ts3.isPropertyAccessExpression(node)) { - if (ts3.isIdentifier(node.expression) && paramLocals.has(node.expression.text)) { + if (ts4.isPropertyAccessExpression(node)) { + if (ts4.isIdentifier(node.expression) && paramLocals.has(node.expression.text)) { out.add(node.name.text); return; } visit(node.expression); return; } - if (ts3.isElementAccessExpression(node)) { - if (ts3.isIdentifier(node.expression) && paramLocals.has(node.expression.text)) { - if (ts3.isStringLiteralLike(node.argumentExpression)) out.add(node.argumentExpression.text); + if (ts4.isElementAccessExpression(node)) { + if (ts4.isIdentifier(node.expression) && paramLocals.has(node.expression.text)) { + if (ts4.isStringLiteralLike(node.argumentExpression)) out.add(node.argumentExpression.text); } else { visit(node.expression); } visit(node.argumentExpression); return; } - if (ts3.isIdentifier(node)) { + if (ts4.isIdentifier(node)) { if (paramLocals.has(node.text)) return; const initializer3 = consts.get(node.text); if (initializer3 && !followed.has(node.text)) { @@ -233081,11 +237617,11 @@ function readParams(expr, consts, paramLocals, out) { } return; } - if (ts3.isPropertyAssignment(node)) { + if (ts4.isPropertyAssignment(node)) { visit(node.initializer); return; } - ts3.forEachChild(node, visit); + ts4.forEachChild(node, visit); }; visit(expr); } @@ -233102,21 +237638,21 @@ function collectParamDependencies(props, consts, paramLocals) { }; const walk = (object2, prefix) => { for (const member of object2.properties) { - if (ts3.isSpreadAssignment(member)) { + if (ts4.isSpreadAssignment(member)) { record2(prefix, member.expression); continue; } - if (ts3.isShorthandPropertyAssignment(member)) { + if (ts4.isShorthandPropertyAssignment(member)) { const key2 = member.name.text; record2(prefix ? `${prefix}.${key2}` : key2, member.name); continue; } - if (!ts3.isPropertyAssignment(member)) continue; + if (!ts4.isPropertyAssignment(member)) continue; const key = literalName(member.name); if (key === void 0) continue; const path = prefix ? `${prefix}.${key}` : key; - const initializer3 = unwrap(member.initializer); - if (ts3.isObjectLiteralExpression(initializer3)) { + const initializer3 = unwrap2(member.initializer); + if (ts4.isObjectLiteralExpression(initializer3)) { walk(initializer3, path); continue; } @@ -233130,19 +237666,19 @@ function parameterPathOf(node, scope) { const segments = []; let current = node; for (; ; ) { - if (ts3.isPropertyAccessExpression(current)) { + if (ts4.isPropertyAccessExpression(current)) { segments.unshift(current.name.text); current = current.expression; continue; } - if (ts3.isElementAccessExpression(current) && ts3.isStringLiteralLike(current.argumentExpression)) { + if (ts4.isElementAccessExpression(current) && ts4.isStringLiteralLike(current.argumentExpression)) { segments.unshift(current.argumentExpression.text); current = current.expression; continue; } break; } - if (!ts3.isIdentifier(current)) return void 0; + if (!ts4.isIdentifier(current)) return void 0; if (scope.whole.has(current.text)) { return segments.length === 0 ? void 0 : segments.join("."); } @@ -233151,23 +237687,23 @@ function parameterPathOf(node, scope) { return segments.length === 0 ? base : `${base}.${segments.join(".")}`; } function isEntityBinding(initializer3) { - const expr = unwrap(initializer3); - return ts3.isNewExpression(expr) || ts3.isCallExpression(expr); + const expr = unwrap2(initializer3); + return ts4.isNewExpression(expr) || ts4.isCallExpression(expr); } function readCompositeParameters(expr, consts, scope, out) { const followed = /* @__PURE__ */ new Set(); const visit = (node) => { - if (ts3.isPropertyAccessExpression(node) || ts3.isElementAccessExpression(node)) { + if (ts4.isPropertyAccessExpression(node) || ts4.isElementAccessExpression(node)) { const path = parameterPathOf(node, scope); if (path !== void 0) { out.add(path); return; } visit(node.expression); - if (ts3.isElementAccessExpression(node)) visit(node.argumentExpression); + if (ts4.isElementAccessExpression(node)) visit(node.argumentExpression); return; } - if (ts3.isIdentifier(node)) { + if (ts4.isIdentifier(node)) { const path = parameterPathOf(node, scope); if (path !== void 0) { out.add(path); @@ -233181,11 +237717,11 @@ function readCompositeParameters(expr, consts, scope, out) { } return; } - if (ts3.isPropertyAssignment(node)) { + if (ts4.isPropertyAssignment(node)) { visit(node.initializer); return; } - ts3.forEachChild(node, visit); + ts4.forEachChild(node, visit); }; visit(expr); } @@ -233209,21 +237745,21 @@ function collectCompositeOrigins(props, consts, scope, composite) { }; const walk = (object2, prefix) => { for (const member of object2.properties) { - if (ts3.isSpreadAssignment(member)) { + if (ts4.isSpreadAssignment(member)) { record2(prefix, member.expression, true); continue; } - if (ts3.isShorthandPropertyAssignment(member)) { + if (ts4.isShorthandPropertyAssignment(member)) { const key2 = member.name.text; record2(prefix ? `${prefix}.${key2}` : key2, member.name, false); continue; } - if (!ts3.isPropertyAssignment(member)) continue; + if (!ts4.isPropertyAssignment(member)) continue; const key = literalName(member.name); if (key === void 0) continue; const path = prefix ? `${prefix}.${key}` : key; - const initializer3 = unwrap(member.initializer); - if (ts3.isObjectLiteralExpression(initializer3)) { + const initializer3 = unwrap2(member.initializer); + if (ts4.isObjectLiteralExpression(initializer3)) { walk(initializer3, path); continue; } @@ -233233,23 +237769,33 @@ function collectCompositeOrigins(props, consts, scope, composite) { walk(props, ""); return out; } -var ts3; +var ts4; var init_param_deps = __esm({ "node_modules/@intentius/chant/src/discovery/param-deps.ts"() { - ts3 = __toESM(require_typescript(), 1); + ts4 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/discovery/fold-import.ts import { readFile } from "node:fs/promises"; -import { existsSync as existsSync5, statSync as statSync2, readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs"; -import { dirname as dirname8, basename as basename2, join as join7, sep, isAbsolute, resolve as resolvePath2 } from "node:path"; -import { fileURLToPath } from "node:url"; -import { createRequire as createRequire2 } from "node:module"; +import { existsSync as existsSync7, statSync as statSync4, readFileSync as readFileSync7, realpathSync as realpathSync3 } from "node:fs"; +import { dirname as dirname10, basename as basename2, join as join10, sep as sep3, isAbsolute as isAbsolute3, resolve as resolvePath2 } from "node:path"; +import { fileURLToPath as fileURLToPath2 } from "node:url"; +import { createRequire as createRequire5 } from "node:module"; function lexiconPackageName(lexiconName) { return `@intentius/chant-lexicon-${lexiconName}`; } -function createFoldSession(intrinsics = [], buildParams, lexicons = [], sandbox = false, lexiconPackages = []) { +function createFoldSession(intrinsics = [], buildParams, lexicons = [], sandbox = false, lexiconPackages = [], executing = false, sourceFiles = []) { + const packages = new Set(lexiconPackages); + const modules = /* @__PURE__ */ new Set(); + const roots = []; + for (const name of lexicons) { + const modulePath = lexiconModulePath(name); + if (modulePath === void 0) packages.add(lexiconPackageName(name)); + else modules.add(resolveModulePath(modulePath, modulePath)); + const root = lexiconModuleRoot(name); + if (root !== void 0 && !sourceFiles.some((file2) => isUnderDirectory(resolvePath2(file2), root))) roots.push(root); + } return { intrinsics, cache: /* @__PURE__ */ new Map(), @@ -233257,13 +237803,16 @@ function createFoldSession(intrinsics = [], buildParams, lexicons = [], sandbox importCache: /* @__PURE__ */ new Map(), resolvePathCache: /* @__PURE__ */ new Map(), buildParams, - lexiconPackages: /* @__PURE__ */ new Set([...lexicons.map(lexiconPackageName), ...lexiconPackages]), + lexiconPackages: packages, + lexiconModules: modules, + lexiconRoots: roots, sandbox, + executing, factoryModules: /* @__PURE__ */ new Map() }; } function resolveModulePathMemoized(specifier, fromFile, resolvePathCache) { - const isBare = !specifier.startsWith(".") && !isAbsolute(specifier); + const isBare = !specifier.startsWith(".") && !isAbsolute3(specifier); if (isBare) { const cached3 = bareSpecifierPathCache.get(specifier); if (cached3 !== void 0) return cached3; @@ -233271,7 +237820,7 @@ function resolveModulePathMemoized(specifier, fromFile, resolvePathCache) { bareSpecifierPathCache.set(specifier, resolved2); return resolved2; } - const key = `${dirname8(fromFile)}\0${specifier}`; + const key = `${dirname10(fromFile)}\0${specifier}`; const cached2 = resolvePathCache.get(key); if (cached2 !== void 0) return cached2; const resolved = resolveModulePath(specifier, fromFile); @@ -233294,37 +237843,37 @@ function importModuleMemoized(modulePath, importCache) { importCache.set(modulePath, promise2); return promise2; } -function hasExportModifier(node) { - return node.modifiers?.some((m) => m.kind === ts4.SyntaxKind.ExportKeyword) ?? false; +function hasExportModifier2(node) { + return node.modifiers?.some((m) => m.kind === ts5.SyntaxKind.ExportKeyword) ?? false; } function isIndexableObject(value) { return typeof value === "object" && value !== null && !Array.isArray(value); } function bindingElementPropKey(el) { - if (el.dotDotDotToken || el.initializer || !ts4.isIdentifier(el.name)) return void 0; + if (el.dotDotDotToken || el.initializer || !ts5.isIdentifier(el.name)) return void 0; if (!el.propertyName) return el.name.text; - return ts4.isIdentifier(el.propertyName) ? el.propertyName.text : void 0; + return ts5.isIdentifier(el.propertyName) ? el.propertyName.text : void 0; } function scanExports(sourceFile) { const declarators = []; for (const statement of sourceFile.statements) { - if (ts4.isExportAssignment(statement)) { + if (ts5.isExportAssignment(statement)) { return { declarators, unfoldableReason: "`export default` is not foldable" }; } - if (ts4.isExportDeclaration(statement)) { + if (ts5.isExportDeclaration(statement)) { if (statement.isTypeOnly) continue; if (statement.moduleSpecifier) { - if (!ts4.isStringLiteral(statement.moduleSpecifier)) { + if (!ts5.isStringLiteral(statement.moduleSpecifier)) { return { declarators, unfoldableReason: "re-export declaration is not foldable" }; } - if (!statement.exportClause || !ts4.isNamedExports(statement.exportClause)) { + if (!statement.exportClause || !ts5.isNamedExports(statement.exportClause)) { return { declarators, unfoldableReason: "re-export declaration is not foldable" }; } const elements2 = []; for (const el of statement.exportClause.elements) { if (el.isTypeOnly) continue; const importedNameNode = el.propertyName ?? el.name; - if (!ts4.isIdentifier(importedNameNode)) { + if (!ts5.isIdentifier(importedNameNode)) { return { declarators, unfoldableReason: "re-export declaration is not foldable" }; } elements2.push({ imported: importedNameNode.text, exportedName: el.name.text }); @@ -233337,14 +237886,14 @@ function scanExports(sourceFile) { }); continue; } - if (!statement.exportClause || !ts4.isNamedExports(statement.exportClause)) { + if (!statement.exportClause || !ts5.isNamedExports(statement.exportClause)) { return { declarators, unfoldableReason: "export declaration is not foldable" }; } const elements = []; for (const el of statement.exportClause.elements) { if (el.isTypeOnly) continue; const localNameNode = el.propertyName ?? el.name; - if (!ts4.isIdentifier(localNameNode)) { + if (!ts5.isIdentifier(localNameNode)) { return { declarators, unfoldableReason: "export declaration is not foldable" }; } elements.push({ localNameNode, exportedName: el.name.text }); @@ -233352,37 +237901,37 @@ function scanExports(sourceFile) { declarators.push({ kind: "named-export", elements }); continue; } - if (ts4.isFunctionDeclaration(statement) && hasExportModifier(statement)) { - if (statement.modifiers?.some((m) => m.kind === ts4.SyntaxKind.DefaultKeyword) || !statement.name) { + if (ts5.isFunctionDeclaration(statement) && hasExportModifier2(statement)) { + if (statement.modifiers?.some((m) => m.kind === ts5.SyntaxKind.DefaultKeyword) || !statement.name) { return { declarators, unfoldableReason: "`export default` is not foldable" }; } if (!statement.body) continue; declarators.push({ kind: "function", name: statement.name.text }); continue; } - if (ts4.isClassDeclaration(statement) && hasExportModifier(statement)) { + if (ts5.isClassDeclaration(statement) && hasExportModifier2(statement)) { return { declarators, unfoldableReason: `exported class declaration "${statement.name?.text ?? ""}" is not foldable` }; } - if (!ts4.isVariableStatement(statement) || !hasExportModifier(statement)) continue; - if ((statement.declarationList.flags & ts4.NodeFlags.Const) === 0) { + if (!ts5.isVariableStatement(statement) || !hasExportModifier2(statement)) continue; + if ((statement.declarationList.flags & ts5.NodeFlags.Const) === 0) { return { declarators, unfoldableReason: "exported `let`/`var` declaration is not foldable" }; } for (const decl of statement.declarationList.declarations) { if (!decl.initializer) { return { declarators, unfoldableReason: "exported destructured or uninitialized declaration is not foldable" }; } - if (ts4.isIdentifier(decl.name)) { - if (ts4.isNewExpression(decl.initializer)) { + if (ts5.isIdentifier(decl.name)) { + if (ts5.isNewExpression(decl.initializer)) { declarators.push({ kind: "resource", name: decl.name.text, node: decl.initializer }); } else { declarators.push({ kind: "single", name: decl.name.text, node: decl.initializer }); } continue; } - if (ts4.isObjectBindingPattern(decl.name)) { + if (ts5.isObjectBindingPattern(decl.name)) { const elements = []; let allSupported = true; for (const el of decl.name.elements) { @@ -233407,13 +237956,13 @@ function scanExports(sourceFile) { function collectLocalBindings(sourceFile) { const bindings = /* @__PURE__ */ new Map(); for (const statement of sourceFile.statements) { - if (!ts4.isVariableStatement(statement)) continue; - if ((statement.declarationList.flags & ts4.NodeFlags.Const) === 0) continue; + if (!ts5.isVariableStatement(statement)) continue; + if ((statement.declarationList.flags & ts5.NodeFlags.Const) === 0) continue; for (const decl of statement.declarationList.declarations) { if (!decl.initializer) continue; - if (ts4.isIdentifier(decl.name)) { + if (ts5.isIdentifier(decl.name)) { bindings.set(decl.name.text, { source: decl.initializer }); - } else if (ts4.isObjectBindingPattern(decl.name)) { + } else if (ts5.isObjectBindingPattern(decl.name)) { for (const el of decl.name.elements) { const propKey = bindingElementPropKey(el); if (propKey === void 0) continue; @@ -233431,8 +237980,8 @@ function collectImports(sourceFile) { const named = /* @__PURE__ */ new Map(); const namespaces = /* @__PURE__ */ new Map(); for (const statement of sourceFile.statements) { - if (!ts4.isImportDeclaration(statement)) continue; - if (!ts4.isStringLiteral(statement.moduleSpecifier)) continue; + if (!ts5.isImportDeclaration(statement)) continue; + if (!ts5.isStringLiteral(statement.moduleSpecifier)) continue; const clause = statement.importClause; if (!clause) continue; if (clause.isTypeOnly) continue; @@ -233442,13 +237991,13 @@ function collectImports(sourceFile) { named.set(clause.name.text, { specifier, imported: "default", specifierNode }); } if (clause.namedBindings) { - if (ts4.isNamedImports(clause.namedBindings)) { + if (ts5.isNamedImports(clause.namedBindings)) { for (const element of clause.namedBindings.elements) { if (element.isTypeOnly) continue; const imported = element.propertyName?.text ?? element.name.text; named.set(element.name.text, { specifier, imported, specifierNode }); } - } else if (ts4.isNamespaceImport(clause.namedBindings)) { + } else if (ts5.isNamespaceImport(clause.namedBindings)) { namespaces.set(clause.namedBindings.name.text, { specifier, specifierNode }); } } @@ -233456,31 +238005,31 @@ function collectImports(sourceFile) { return { named, namespaces }; } function fastResolveBareSpecifier(specifier, fromFile) { - let dir = dirname8(fromFile); + let dir = dirname10(fromFile); for (; ; ) { - const packageDir = join7(dir, "node_modules", specifier); - if (existsSync5(packageDir)) { + const packageDir = join10(dir, "node_modules", specifier); + if (existsSync7(packageDir)) { const entry = fastResolvePackageEntry(packageDir); if (entry === void 0) return void 0; const resolved = resolvePath2(packageDir, entry); - if (!existsSync5(resolved) || !statSync2(resolved).isFile()) return void 0; + if (!existsSync7(resolved) || !statSync4(resolved).isFile()) return void 0; try { return realpathSync3(resolved); } catch { return void 0; } } - const parent = dirname8(dir); + const parent = dirname10(dir); if (parent === dir) return void 0; dir = parent; } } function fastResolvePackageEntry(packageDir) { - const pkgJsonPath = join7(packageDir, "package.json"); - if (!existsSync5(pkgJsonPath)) return void 0; + const pkgJsonPath = join10(packageDir, "package.json"); + if (!existsSync7(pkgJsonPath)) return void 0; let pkg; try { - pkg = JSON.parse(readFileSync4(pkgJsonPath, "utf-8")); + pkg = JSON.parse(readFileSync7(pkgJsonPath, "utf-8")); } catch { return void 0; } @@ -233509,30 +238058,30 @@ function fastResolvePackageEntry(packageDir) { return "index.js"; } function resolveModulePath(specifier, fromFile) { - if (specifier.startsWith(".") || isAbsolute(specifier)) { - const base = specifier.startsWith(".") ? resolvePath2(dirname8(fromFile), specifier) : specifier; + if (specifier.startsWith(".") || isAbsolute3(specifier)) { + const base = specifier.startsWith(".") ? resolvePath2(dirname10(fromFile), specifier) : specifier; const candidates = [ base, `${base}.ts`, `${base}.tsx`, `${base}.js`, `${base}.mjs`, - join7(base, "index.ts"), - join7(base, "index.js") + join10(base, "index.ts"), + join10(base, "index.js") ]; for (const candidate of candidates) { - if (existsSync5(candidate) && statSync2(candidate).isFile()) return candidate; + if (existsSync7(candidate) && statSync4(candidate).isFile()) return candidate; } return base; } const fast = fastResolveBareSpecifier(specifier, fromFile); if (fast !== void 0) return fast; - return createRequire2(fromFile).resolve(specifier); + return createRequire5(fromFile).resolve(specifier); } function paramsModulePath() { if (paramsModulePathMemo === void 0) { try { - paramsModulePathMemo = resolveModulePath("../params", fileURLToPath(import.meta.url)); + paramsModulePathMemo = resolveModulePath("../params", fileURLToPath2(import.meta.url)); } catch { paramsModulePathMemo = null; } @@ -233542,8 +238091,24 @@ function paramsModulePath() { function activeLexiconPackage(specifier, lexiconPackages) { return lexiconPackages.has(specifier) ? specifier : void 0; } +function activeLexiconModule(specifier, fromFile, lexiconModules, resolvePathCache) { + if (lexiconModules.size === 0 || !isProjectFileSpecifier(specifier)) return void 0; + let modulePath; + try { + modulePath = resolveModulePathMemoized(specifier, fromFile, resolvePathCache); + } catch { + return void 0; + } + return lexiconModules.has(modulePath) ? modulePath : void 0; +} +function isUnderDirectory(file2, dir) { + return file2.startsWith(dir.endsWith(sep3) ? dir : dir + sep3); +} +function inPathLexiconRoot(path, roots) { + return roots.some((root) => isUnderDirectory(path, root)); +} function bareSpecifierPackageRoot(specifier) { - if (specifier.startsWith(".") || isAbsolute(specifier)) return void 0; + if (specifier.startsWith(".") || isAbsolute3(specifier)) return void 0; const segments = specifier.split("/"); if (specifier.startsWith("@")) { return segments.length > 2 ? `${segments[0]}/${segments[1]}` : void 0; @@ -233551,12 +238116,16 @@ function bareSpecifierPackageRoot(specifier) { return segments.length > 1 ? segments[0] : void 0; } async function resolveActiveLexiconExport(binding, fromFile, session) { - if (!activeLexiconPackage(binding.specifier, session.lexiconPackages)) return void 0; let modulePath; - try { - modulePath = resolveModulePathMemoized(binding.specifier, fromFile, session.resolvePathCache); - } catch { - return void 0; + if (activeLexiconPackage(binding.specifier, session.lexiconPackages)) { + try { + modulePath = resolveModulePathMemoized(binding.specifier, fromFile, session.resolvePathCache); + } catch { + return void 0; + } + } else { + modulePath = activeLexiconModule(binding.specifier, fromFile, session.lexiconModules, session.resolvePathCache); + if (modulePath === void 0) return void 0; } let mod; try { @@ -233580,10 +238149,10 @@ function resolveMemoized(node, ctx) { return promise2; } async function resolveLiveValue(node, ctx) { - if (ts4.isParenthesizedExpression(node) || ts4.isNonNullExpression(node) || ts4.isAsExpression(node) || ts4.isSatisfiesExpression(node)) { + if (ts5.isParenthesizedExpression(node) || ts5.isNonNullExpression(node) || ts5.isAsExpression(node) || ts5.isSatisfiesExpression(node)) { return resolveLiveValue(node.expression, ctx); } - if (ts4.isIdentifier(node)) { + if (ts5.isIdentifier(node)) { const binding = ctx.locals.get(node.text); if (!binding) { if (ctx.externals.has(node.text)) { @@ -233603,10 +238172,10 @@ async function resolveLiveValue(node, ctx) { } return { value: resolvedSource.value[binding.propKey] }; } - if (ts4.isCallExpression(node)) { + if (ts5.isCallExpression(node)) { return { value: await resolveCallExpression(node, ctx) }; } - if (ts4.isPropertyAccessExpression(node)) { + if (ts5.isPropertyAccessExpression(node)) { const base = await resolveLiveValue(node.expression, ctx); if (base === void 0) return void 0; const key = node.name.text; @@ -233618,7 +238187,7 @@ async function resolveLiveValue(node, ctx) { return void 0; } async function resolveCallExpression(node, ctx) { - if (!ts4.isIdentifier(node.expression)) { + if (!ts5.isIdentifier(node.expression)) { throw cheapError(callExpressionMessage(node)); } const calleeName = node.expression.text; @@ -233633,14 +238202,21 @@ async function resolveCallExpression(node, ctx) { if (!(err instanceof Error)) throw err; foldFailure = err; } - if (!binding) throw foldFailure; - try { - return await resolveImportedCall(node, calleeName, binding, ctx); - } catch (err) { + if (ctx.executing && binding) { + try { + return await resolveImportedCall(node, calleeName, binding, ctx); + } catch (err) { + throw cheapError( + `${foldFailure.message}; invoking it instead failed: ${err instanceof Error ? err.message : String(err)}` + ); + } + } + if (binding && !ctx.sandbox) { throw cheapError( - `${foldFailure.message}; invoking it instead failed: ${err instanceof Error ? err.message : String(err)}` + `${foldFailure.message} (the default mode does not invoke a declared project function; \`executing\` would run it and fold what it returns)` ); } + throw foldFailure; } if (!binding) { throw cheapError(callExpressionMessage(node)); @@ -233660,6 +238236,11 @@ async function resolveImportedCall(node, calleeName, binding, ctx) { async function invokeResolvedCallee(calleeName, binding, ctx, args) { const refusal = sandboxedExecutionRefusal(binding, ctx, calleeName, "composite factory"); if (refusal) throw cheapError(refusal); + if (!ctx.executing && isProjectFileSpecifier(binding.specifier) && !isTrustedExecutableBinding(binding, ctx)) { + throw cheapError( + `"${calleeName}" is imported from "${binding.specifier}", which is a project file; the default mode does not invoke project-owned code (\`executing\` would run it and fold what it returns)` + ); + } let modulePath; try { modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); @@ -233720,10 +238301,10 @@ async function readFactoryModuleCore(modulePath) { let sourceFile; try { const source = await readFile(modulePath, "utf-8"); - sourceFile = ts4.createSourceFile( + sourceFile = ts5.createSourceFile( modulePath, source, - ts4.ScriptTarget.Latest, + ts5.ScriptTarget.Latest, /* setParentNodes */ true ); @@ -233757,21 +238338,21 @@ function factoryModuleScopeResolved(scope, session) { } function findCompositeDefinition(scope, exportName, ctx) { for (const statement of scope.sourceFile.statements) { - if (!ts4.isVariableStatement(statement)) continue; - if (!hasExportModifier(statement)) continue; - if ((statement.declarationList.flags & ts4.NodeFlags.Const) === 0) continue; + if (!ts5.isVariableStatement(statement)) continue; + if (!hasExportModifier2(statement)) continue; + if ((statement.declarationList.flags & ts5.NodeFlags.Const) === 0) continue; for (const decl of statement.declarationList.declarations) { - if (!ts4.isIdentifier(decl.name) || decl.name.text !== exportName) continue; + if (!ts5.isIdentifier(decl.name) || decl.name.text !== exportName) continue; const init = decl.initializer; - if (!init || !ts4.isCallExpression(init) || !ts4.isIdentifier(init.expression)) return void 0; + if (!init || !ts5.isCallExpression(init) || !ts5.isIdentifier(init.expression)) return void 0; const compositeBinding = scope.imports.get(init.expression.text); if (!compositeBinding || compositeBinding.imported !== "Composite") return void 0; const chantOwned = isChantOwnedHelperBinding(compositeBinding, { ...ctx, file: scope.file }); - const hostOwned = activeLexiconPackage(compositeBinding.specifier, ctx.lexiconPackages) !== void 0; + const hostOwned = activeLexiconPackage(compositeBinding.specifier, ctx.lexiconPackages) !== void 0 || activeLexiconModule(compositeBinding.specifier, scope.file, ctx.lexiconModules, ctx.resolvePathCache) !== void 0; if (!chantOwned && !hostOwned) return void 0; const [fnArg, nameArg] = init.arguments; - if (!fnArg || !ts4.isArrowFunction(fnArg) && !ts4.isFunctionExpression(fnArg)) return void 0; - if (nameArg !== void 0 && !ts4.isStringLiteral(nameArg)) return void 0; + if (!fnArg || !ts5.isArrowFunction(fnArg) && !ts5.isFunctionExpression(fnArg)) return void 0; + if (nameArg !== void 0 && !ts5.isStringLiteral(nameArg)) return void 0; return { fn: fnArg, compositeName: nameArg ? nameArg.text : "anonymous", hostForm: !chantOwned }; } } @@ -233805,23 +238386,23 @@ function findFactorySubsetViolation(fn) { if (param) { if (param.dotDotDotToken) return "a rest parameter is not interpretable"; if (param.initializer) return "a defaulted parameter is not interpretable"; - if (ts4.isObjectBindingPattern(param.name)) { + if (ts5.isObjectBindingPattern(param.name)) { for (const el of param.name.elements) { if (bindingElementPropKey(el) === void 0) { return "a destructured props parameter with a rest, default, or nested element is not interpretable"; } } - } else if (!ts4.isIdentifier(param.name)) { + } else if (!ts5.isIdentifier(param.name)) { return "an array-destructured props parameter is not interpretable"; } } - if (!ts4.isBlock(fn.body)) return checkFactoryExpression(fn.body); + if (!ts5.isBlock(fn.body)) return checkFactoryExpression(fn.body); const statements = fn.body.statements; if (statements.length === 0) return "an empty composite factory body has no members to interpret"; for (let i = 0; i < statements.length; i += 1) { const statement = statements[i]; const last = i === statements.length - 1; - if (ts4.isReturnStatement(statement)) { + if (ts5.isReturnStatement(statement)) { if (!last) return "an early `return` is not interpretable"; if (!statement.expression) return "a composite factory must return its members"; const violation = checkFactoryExpression(statement.expression); @@ -233829,21 +238410,21 @@ function findFactorySubsetViolation(fn) { continue; } if (last) return "a composite factory body must end in `return`"; - if (!ts4.isVariableStatement(statement)) { - return `\`${ts4.SyntaxKind[statement.kind]}\` in a composite factory body is not interpretable`; + if (!ts5.isVariableStatement(statement)) { + return `\`${ts5.SyntaxKind[statement.kind]}\` in a composite factory body is not interpretable`; } - if ((statement.declarationList.flags & ts4.NodeFlags.Const) === 0) { + if ((statement.declarationList.flags & ts5.NodeFlags.Const) === 0) { return "`let`/`var` in a composite factory body is not interpretable"; } for (const decl of statement.declarationList.declarations) { if (!decl.initializer) return "an uninitialized `const` in a composite factory body is not interpretable"; - if (ts4.isObjectBindingPattern(decl.name)) { + if (ts5.isObjectBindingPattern(decl.name)) { for (const el of decl.name.elements) { if (bindingElementPropKey(el) === void 0) { return "a destructured `const` with a rest, default, or nested element is not interpretable"; } } - } else if (!ts4.isIdentifier(decl.name)) { + } else if (!ts5.isIdentifier(decl.name)) { return "an array-destructured `const` is not interpretable"; } const violation = checkFactoryExpression(decl.initializer); @@ -233853,15 +238434,15 @@ function findFactorySubsetViolation(fn) { return void 0; } function checkFactoryExpression(node) { - if (ts4.isParenthesizedExpression(node) || ts4.isAsExpression(node) || ts4.isSatisfiesExpression(node) || ts4.isNonNullExpression(node) || ts4.isTypeAssertionExpression(node)) { + if (ts5.isParenthesizedExpression(node) || ts5.isAsExpression(node) || ts5.isSatisfiesExpression(node) || ts5.isNonNullExpression(node) || ts5.isTypeAssertionExpression(node)) { return checkFactoryExpression(node.expression); } - if (ts4.isStringLiteral(node) || ts4.isNoSubstitutionTemplateLiteral(node) || ts4.isNumericLiteral(node) || ts4.isIdentifier(node) || node.kind === ts4.SyntaxKind.TrueKeyword || node.kind === ts4.SyntaxKind.FalseKeyword || node.kind === ts4.SyntaxKind.NullKeyword) { + if (ts5.isStringLiteral(node) || ts5.isNoSubstitutionTemplateLiteral(node) || ts5.isNumericLiteral(node) || ts5.isIdentifier(node) || node.kind === ts5.SyntaxKind.TrueKeyword || node.kind === ts5.SyntaxKind.FalseKeyword || node.kind === ts5.SyntaxKind.NullKeyword) { return void 0; } - if (ts4.isNewExpression(node) || ts4.isCallExpression(node)) { - if (!ts4.isIdentifier(node.expression)) { - return ts4.isNewExpression(node) ? `\`new ${briefNodeText(node.expression)}(...)\` needs a plain imported constructor to interpret` : callExpressionMessage(node); + if (ts5.isNewExpression(node) || ts5.isCallExpression(node)) { + if (!ts5.isIdentifier(node.expression)) { + return ts5.isNewExpression(node) ? `\`new ${briefNodeText(node.expression)}(...)\` needs a plain imported constructor to interpret` : callExpressionMessage(node); } for (const arg of node.arguments ?? []) { const violation = checkFactoryExpression(arg); @@ -233869,31 +238450,31 @@ function checkFactoryExpression(node) { } return void 0; } - if (ts4.isTaggedTemplateExpression(node)) { - if (!ts4.isIdentifier(node.tag)) return unsupportedExpressionMessage(node); - if (ts4.isNoSubstitutionTemplateLiteral(node.template)) return void 0; + if (ts5.isTaggedTemplateExpression(node)) { + if (!ts5.isIdentifier(node.tag)) return unsupportedExpressionMessage(node); + if (ts5.isNoSubstitutionTemplateLiteral(node.template)) return void 0; for (const span of node.template.templateSpans) { const violation = checkFactoryExpression(span.expression); if (violation) return violation; } return void 0; } - if (ts4.isTemplateExpression(node)) { + if (ts5.isTemplateExpression(node)) { for (const span of node.templateSpans) { const violation = checkFactoryExpression(span.expression); if (violation) return violation; } return void 0; } - if (ts4.isObjectLiteralExpression(node)) { + if (ts5.isObjectLiteralExpression(node)) { for (const prop of node.properties) { - if (ts4.isPropertyAssignment(prop)) { + if (ts5.isPropertyAssignment(prop)) { if (!isLiteralPropertyNameNode(prop.name)) return computedPropertyNameMessage(prop.name); const violation = checkFactoryExpression(prop.initializer); if (violation) return violation; - } else if (ts4.isShorthandPropertyAssignment(prop)) { + } else if (ts5.isShorthandPropertyAssignment(prop)) { if (prop.objectAssignmentInitializer) return UNSUPPORTED_OBJECT_MEMBER_MESSAGE; - } else if (ts4.isSpreadAssignment(prop)) { + } else if (ts5.isSpreadAssignment(prop)) { const violation = checkFactoryExpression(prop.expression); if (violation) return violation; } else { @@ -233902,59 +238483,59 @@ function checkFactoryExpression(node) { } return void 0; } - if (ts4.isArrayLiteralExpression(node)) { + if (ts5.isArrayLiteralExpression(node)) { for (const el of node.elements) { - const violation = checkFactoryExpression(ts4.isSpreadElement(el) ? el.expression : el); + const violation = checkFactoryExpression(ts5.isSpreadElement(el) ? el.expression : el); if (violation) return violation; } return void 0; } - if (ts4.isPropertyAccessExpression(node)) return checkFactoryExpression(node.expression); - if (ts4.isElementAccessExpression(node)) { + if (ts5.isPropertyAccessExpression(node)) return checkFactoryExpression(node.expression); + if (ts5.isElementAccessExpression(node)) { if (!isLiteralElementKey(node.argumentExpression)) { return `dynamic element access [${briefNodeText(node.argumentExpression)}] is not interpretable`; } return checkFactoryExpression(node.expression); } - if (ts4.isPrefixUnaryExpression(node)) { + if (ts5.isPrefixUnaryExpression(node)) { if (!SUPPORTED_UNARY_OPERATORS.has(node.operator)) return UNSUPPORTED_UNARY_MESSAGE; return checkFactoryExpression(node.operand); } - if (ts4.isBinaryExpression(node)) { + if (ts5.isBinaryExpression(node)) { if (!SUPPORTED_BINARY_OPERATORS.has(node.operatorToken.kind)) { return unsupportedBinaryMessage(node.operatorToken.kind); } return checkFactoryExpression(node.left) ?? checkFactoryExpression(node.right); } - if (ts4.isConditionalExpression(node)) { + if (ts5.isConditionalExpression(node)) { return checkFactoryExpression(node.condition) ?? checkFactoryExpression(node.whenTrue) ?? checkFactoryExpression(node.whenFalse); } return unsupportedExpressionMessage(node); } function isLiteralPropertyNameNode(node) { - return ts4.isIdentifier(node) || ts4.isStringLiteral(node) || ts4.isNumericLiteral(node); + return ts5.isIdentifier(node) || ts5.isStringLiteral(node) || ts5.isNumericLiteral(node); } function compositeParamRecorder(factory, moduleConsts) { const whole = /* @__PURE__ */ new Set(); const destructured = /* @__PURE__ */ new Map(); const param = factory.fn.parameters[0]; if (param) { - if (ts4.isIdentifier(param.name)) { + if (ts5.isIdentifier(param.name)) { whole.add(param.name.text); - } else if (ts4.isObjectBindingPattern(param.name)) { + } else if (ts5.isObjectBindingPattern(param.name)) { for (const el of param.name.elements) { const key = bindingElementPropKey(el); - if (key !== void 0 && ts4.isIdentifier(el.name)) destructured.set(el.name.text, key); + if (key !== void 0 && ts5.isIdentifier(el.name)) destructured.set(el.name.text, key); } } } const consts = new Map(moduleConsts); const body = factory.fn.body; - if (ts4.isBlock(body)) { + if (ts5.isBlock(body)) { for (const statement of body.statements) { - if (!ts4.isVariableStatement(statement)) continue; + if (!ts5.isVariableStatement(statement)) continue; for (const decl of statement.declarationList.declarations) { - if (ts4.isIdentifier(decl.name) && decl.initializer) consts.set(decl.name.text, decl.initializer); + if (ts5.isIdentifier(decl.name) && decl.initializer) consts.set(decl.name.text, decl.initializer); } } } @@ -233966,7 +238547,7 @@ function stampCompositeOrigins(entity, node, ctx) { if (typeof entity !== "object" || entity === null) return; let propsArg; for (const argument of node.arguments ?? []) { - if (ts4.isObjectLiteralExpression(argument)) { + if (ts5.isObjectLiteralExpression(argument)) { propsArg = argument; break; } @@ -233994,7 +238575,10 @@ async function interpretCompositeFactory(factory, args, ctx) { importCache: ctx.importCache, resolvePathCache: ctx.resolvePathCache, lexiconPackages: ctx.lexiconPackages, + lexiconModules: ctx.lexiconModules, + lexiconRoots: ctx.lexiconRoots, sandbox: ctx.sandbox, + executing: ctx.executing, session: ctx.session, interpretDepth: ctx.interpretDepth + 1, // chant #2161 — set unconditionally, and NOT inherited from `ctx`: a nested @@ -234009,9 +238593,9 @@ async function interpretCompositeFactory(factory, args, ctx) { const param = fn.parameters[0]; if (param) { const props = args[0]; - if (ts4.isIdentifier(param.name)) { + if (ts5.isIdentifier(param.name)) { bind(param.name.text, props); - } else if (ts4.isObjectBindingPattern(param.name)) { + } else if (ts5.isObjectBindingPattern(param.name)) { if (!isIndexableObject(props)) return void 0; for (const el of param.name.elements) { const key = bindingElementPropKey(el); @@ -234031,15 +238615,15 @@ async function interpretCompositeFactory(factory, args, ctx) { } } async function interpretFactoryBody(fn, ctx, bind) { - if (!ts4.isBlock(fn.body)) return interpretExpression(fn.body, ctx); + if (!ts5.isBlock(fn.body)) return interpretExpression(fn.body, ctx); for (const statement of fn.body.statements) { - if (ts4.isReturnStatement(statement)) { + if (ts5.isReturnStatement(statement)) { return interpretExpression(statement.expression, ctx); } const declarations = statement.declarationList.declarations; for (const decl of declarations) { const value = await interpretExpression(decl.initializer, ctx); - if (ts4.isIdentifier(decl.name)) { + if (ts5.isIdentifier(decl.name)) { bind(decl.name.text, value); continue; } @@ -234054,16 +238638,16 @@ async function interpretFactoryBody(fn, ctx, bind) { throw cheapError("composite factory body did not return"); } async function interpretExpression(node, ctx) { - if (ts4.isParenthesizedExpression(node) || ts4.isAsExpression(node) || ts4.isSatisfiesExpression(node) || ts4.isNonNullExpression(node)) { + if (ts5.isParenthesizedExpression(node) || ts5.isAsExpression(node) || ts5.isSatisfiesExpression(node) || ts5.isNonNullExpression(node)) { return interpretExpression(node.expression, ctx); } - if (ts4.isNewExpression(node)) return interpretNewExpression(node, ctx); - if (ts4.isObjectLiteralExpression(node)) { + if (ts5.isNewExpression(node)) return interpretNewExpression(node, ctx); + if (ts5.isObjectLiteralExpression(node)) { const obj = {}; for (const prop of node.properties) { - if (ts4.isPropertyAssignment(prop)) { + if (ts5.isPropertyAssignment(prop)) { obj[propName(prop.name)] = await interpretExpression(prop.initializer, ctx); - } else if (ts4.isShorthandPropertyAssignment(prop)) { + } else if (ts5.isShorthandPropertyAssignment(prop)) { obj[prop.name.text] = await interpretExpression(prop.name, ctx); } else { const src = await interpretExpression(prop.expression, ctx); @@ -234073,10 +238657,10 @@ async function interpretExpression(node, ctx) { } return obj; } - if (ts4.isArrayLiteralExpression(node)) { + if (ts5.isArrayLiteralExpression(node)) { const arr = []; for (const el of node.elements) { - if (ts4.isSpreadElement(el)) { + if (ts5.isSpreadElement(el)) { const src = await interpretExpression(el.expression, ctx); if (!Array.isArray(src)) throw cheapError("spread source not an array"); arr.push(...src); @@ -234086,11 +238670,11 @@ async function interpretExpression(node, ctx) { } return arr; } - if (ts4.isConditionalExpression(node)) { + if (ts5.isConditionalExpression(node)) { return await interpretExpression(node.condition, ctx) ? interpretExpression(node.whenTrue, ctx) : interpretExpression(node.whenFalse, ctx); } - if (ts4.isBinaryExpression(node)) { - const S = ts4.SyntaxKind; + if (ts5.isBinaryExpression(node)) { + const S = ts5.SyntaxKind; const opKind = node.operatorToken.kind; if (opKind === S.AmpersandAmpersandToken) { const left = await interpretExpression(node.left, ctx); @@ -234108,7 +238692,7 @@ async function interpretExpression(node, ctx) { return (await resolveDeclaratorValue(node, ctx)).value; } async function interpretNewExpression(node, ctx) { - if (!ts4.isIdentifier(node.expression)) { + if (!ts5.isIdentifier(node.expression)) { throw cheapError(`\`new ${briefNodeText(node.expression)}(...)\` needs a plain imported constructor`); } const typeName = node.expression.text; @@ -234260,7 +238844,7 @@ function isChantOwnedHelperBinding(binding, ctx) { return false; } const root = chantCoreRoot(); - return targetPath === root || targetPath.startsWith(root + sep); + return targetPath === root || targetPath.startsWith(root + sep3); } function isTrustedExecutableBinding(binding, ctx) { if (activeLexiconPackage(binding.specifier, ctx.lexiconPackages) !== void 0) return true; @@ -234273,8 +238857,10 @@ function isTrustedExecutableBinding(binding, ctx) { } catch { return false; } + if (ctx.lexiconModules.has(targetPath)) return true; + if (inPathLexiconRoot(targetPath, ctx.lexiconRoots)) return true; const root = chantCoreRoot(); - return targetPath === root || targetPath.startsWith(root + sep); + return targetPath === root || targetPath.startsWith(root + sep3); } function sandboxedExecutionRefusal(binding, ctx, name, what) { if (!ctx.sandbox) return void 0; @@ -234282,7 +238868,7 @@ function sandboxedExecutionRefusal(binding, ctx, name, what) { return `${what} "${name}" is imported from "${binding.specifier}", which is neither chant's own nor an active lexicon \u2014 under --sandbox it is executed in the sandboxed child, not in this process`; } function chantCoreRoot() { - chantCoreRootMemo ??= dirname8(dirname8(fileURLToPath(import.meta.url))); + chantCoreRootMemo ??= dirname10(dirname10(fileURLToPath2(import.meta.url))); return chantCoreRootMemo; } async function reviveFoldedProps(props, ctx, requireLiveRefs) { @@ -234349,7 +238935,7 @@ function stampParamDependencies(entity, node, ctx) { if (paramLocals.size === 0) return; let propsArg; for (const argument of node.arguments ?? []) { - if (ts4.isObjectLiteralExpression(argument)) { + if (ts5.isObjectLiteralExpression(argument)) { propsArg = argument; break; } @@ -234362,7 +238948,7 @@ function stampParamDependencies(entity, node, ctx) { async function preresolveResourceConsts(ctx) { const built = /* @__PURE__ */ new Map(); for (const [name, initializer3] of ctx.consts) { - if (!ts4.isNewExpression(initializer3) || !ts4.isIdentifier(initializer3.expression)) continue; + if (!ts5.isNewExpression(initializer3) || !ts5.isIdentifier(initializer3.expression)) continue; try { const spec = foldResource(initializer3, ctx.consts, ctx.intrinsics, ctx.externals); const instance = await constructFoldedResource(spec, ctx, false); @@ -234417,7 +239003,7 @@ function describeFoldFailure(err, ctx) { return err.message; } function describeDestructureSource(node) { - return ts4.isCallExpression(node) ? `${briefNodeText(node.expression)}(...)` : briefNodeText(node); + return ts5.isCallExpression(node) ? `${briefNodeText(node.expression)}(...)` : briefNodeText(node); } function locatedMessage(node, message) { const { line, column } = locate(node); @@ -234447,7 +239033,7 @@ function foldFileMemoized(file2, session) { return promise2; } function isProjectFileSpecifier(specifier) { - return specifier.startsWith(".") || isAbsolute(specifier); + return specifier.startsWith(".") || isAbsolute3(specifier); } async function buildExternals(file2, imports, namespaceImports, session) { const externals = /* @__PURE__ */ new Map(); @@ -234484,6 +239070,12 @@ async function buildExternals(file2, imports, namespaceImports, session) { } catch { continue; } + if (session.lexiconModules.has(targetPath)) { + const lexiconExport = await resolveActiveLexiconExport(binding, file2, session); + if (lexiconExport) externals.set(localName, lexiconExport.value); + continue; + } + if (inPathLexiconRoot(targetPath, session.lexiconRoots)) continue; const result = await foldFileMemoized(targetPath, session); if (!result.ok) { failures.set(localName, locatedMessage(binding.specifierNode, result.reason)); @@ -234508,6 +239100,7 @@ async function buildExternals(file2, imports, namespaceImports, session) { } catch { continue; } + if (session.lexiconModules.has(targetPath) || inPathLexiconRoot(targetPath, session.lexiconRoots)) continue; const result = await foldFileMemoized(targetPath, session); if (!result.ok) { failures.set(localName, locatedMessage(binding.specifierNode, result.reason)); @@ -234536,16 +239129,16 @@ async function resolveDeclaratorValue(node, ctx) { async function tryFoldFileCore(file2, session) { { const root = chantCoreRoot(); - if (file2 === root || file2.startsWith(root + sep)) { + if (file2 === root || file2.startsWith(root + sep3)) { return { ok: false, reason: "chant's own module is not project source" }; } } try { const source = await readFile(file2, "utf-8"); - const sourceFile = ts4.createSourceFile( + const sourceFile = ts5.createSourceFile( file2, source, - ts4.ScriptTarget.Latest, + ts5.ScriptTarget.Latest, /* setParentNodes */ true ); @@ -234567,7 +239160,10 @@ async function tryFoldFileCore(file2, session) { importCache: session.importCache, resolvePathCache: session.resolvePathCache, lexiconPackages: session.lexiconPackages, + lexiconModules: session.lexiconModules, + lexiconRoots: session.lexiconRoots, sandbox: session.sandbox, + executing: session.executing, session, interpretDepth: 0, // chant#2423 — filled by the pre-build below, read by @@ -234599,7 +239195,7 @@ async function tryFoldFileCore(file2, session) { continue; } if (decl.kind === "single") { - const aliased = ts4.isIdentifier(decl.node) ? ctx.externals.get(decl.node.text) : void 0; + const aliased = ts5.isIdentifier(decl.node) ? ctx.externals.get(decl.node.text) : void 0; const marker = localFunctions.get(decl.name) ?? (isFoldableFunction(aliased) ? aliased : void 0); if (marker) { applyResolvedValue(decl.name, marker, entities, exportedValues); @@ -234707,12 +239303,12 @@ async function buildProjectImportEdges(files) { }; try { const source = await readFile(file2, "utf-8"); - const sourceFile = ts4.createSourceFile(file2, source, ts4.ScriptTarget.Latest, true); + const sourceFile = ts5.createSourceFile(file2, source, ts5.ScriptTarget.Latest, true); const collected = collectImports(sourceFile); for (const binding of collected.named.values()) addTarget(binding.specifier); for (const binding of collected.namespaces.values()) addTarget(binding.specifier); for (const statement of sourceFile.statements) { - if (ts4.isExportDeclaration(statement) && !statement.isTypeOnly && statement.moduleSpecifier && ts4.isStringLiteral(statement.moduleSpecifier)) { + if (ts5.isExportDeclaration(statement) && !statement.isTypeOnly && statement.moduleSpecifier && ts5.isStringLiteral(statement.moduleSpecifier)) { addTarget(statement.moduleSpecifier.text); } } @@ -234760,16 +239356,17 @@ async function planFoldTaintWithEdges(files, wouldFold, liveSources) { } return { tainted, reachedBy }; } -var ts4, bareSpecifierPathCache, executionCounts, PARAMS_BARE_SPECIFIER, paramsModulePathMemo, MAX_INTERPRETATION_DEPTH, InterpretationDepthError, SIMPLE_DOTTED_CHAIN, chantCoreRootMemo, UNRESOLVED_IDENTIFIER_RE, SAME_FILE_RESOURCE_RE, MAX_RESOLUTION_DEPTH; +var ts5, bareSpecifierPathCache, executionCounts, PARAMS_BARE_SPECIFIER, paramsModulePathMemo, MAX_INTERPRETATION_DEPTH, InterpretationDepthError, SIMPLE_DOTTED_CHAIN, chantCoreRootMemo, UNRESOLVED_IDENTIFIER_RE, SAME_FILE_RESOURCE_RE, MAX_RESOLUTION_DEPTH; var init_fold_import = __esm({ "node_modules/@intentius/chant/src/discovery/fold-import.ts"() { - ts4 = __toESM(require_typescript(), 1); + ts5 = __toESM(require_typescript(), 1); init_declarable(); init_composite(); init_utils(); init_intrinsic(); init_fold(); init_foldable_helpers(); + init_lexicon_module(); init_subset(); init_import(); init_param_deps(); @@ -234945,7 +239542,7 @@ __export(run_exports, { runFallbackFilesSandboxed: () => runFallbackFilesSandboxed }); import { realpathSync as realpathSync4, rmSync as rmSync3 } from "node:fs"; -import { resolve as resolve4 } from "node:path"; +import { resolve as resolve6 } from "node:path"; function isChildResponse(value) { return typeof value === "object" && value !== null && "entitySet" in value && "errors" in value; } @@ -234958,9 +239555,9 @@ async function runFallbackFilesSandboxed(files, buildRoot) { try { let projectRealpath; try { - projectRealpath = realpathSync4(resolve4(buildRoot)); + projectRealpath = realpathSync4(resolve6(buildRoot)); } catch { - projectRealpath = resolve4(buildRoot); + projectRealpath = resolve6(buildRoot); } const response = await forkSandboxed( { @@ -235017,15 +239614,15 @@ var init_run = __esm({ }); // node_modules/@intentius/chant/src/discovery/index.ts -import { relative as relative4 } from "node:path"; -import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs"; -import { dirname as dirname9, join as join8, parse as parse3 } from "node:path"; +import { relative as relative5 } from "node:path"; +import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs"; +import { dirname as dirname11, join as join11, parse as parse3 } from "node:path"; function warnIfParamsCannotReachProject(path, values) { if (Object.keys(values).length === 0) return; try { const pkgPath = findPackageJsonUpward(path); if (!pkgPath) return; - const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8")); + const pkg = JSON.parse(readFileSync8(pkgPath, "utf-8")); if (pkg.type === "module") return; const found = pkg.type ? `"type": "${pkg.type}"` : "no `type` field"; const names = Object.keys(values).sort().join(", "); @@ -235039,10 +239636,10 @@ function findPackageJsonUpward(startDir) { let dir = startDir; const { root } = parse3(dir); for (; ; ) { - const candidate = join8(dir, "package.json"); - if (existsSync6(candidate)) return candidate; + const candidate = join11(dir, "package.json"); + if (existsSync8(candidate)) return candidate; if (dir === root) return void 0; - const parent = dirname9(dir); + const parent = dirname11(dir); if (parent === dir) return void 0; dir = parent; } @@ -235059,7 +239656,20 @@ async function discover(path, options) { const modules = []; const sandboxFiles = []; const foldAttempts = /* @__PURE__ */ new Map(); - const foldSession = options?.fold ? createFoldSession(options.intrinsics, buildParamValuesMap, options.lexicons, options.sandbox === true) : void 0; + if (options?.sandbox === true && options?.executing === true) { + throw new Error( + "discover: `sandbox` and `executing` are mutually exclusive \u2014 the first refuses to import project code and the second exists to invoke it. Pass one." + ); + } + const foldSession = options?.fold ? createFoldSession( + options.intrinsics, + buildParamValuesMap, + options.lexicons, + options.sandbox === true, + [], + options.executing === true, + files + ) : void 0; if (options?.fold) { for (const file2 of files) { foldAttempts.set(file2, await tryFoldFile(file2, options.intrinsics, foldSession)); @@ -235088,7 +239698,7 @@ async function discover(path, options) { continue; } const edge = taintPlan.reachedBy.get(file2); - const reason = !folded.ok ? folded.reason : edge?.kind === "capture" ? `would fold in isolation, but it captured objects from ${relative4(process.cwd(), edge.from)}, which falls back to run \u2014 folding independently would hold an instance the build never collects` : `would fold in isolation, but a file that imports it (directly or transitively) falls back to run \u2014 folding independently would create a duplicate, non-identical instance`; + const reason = !folded.ok ? folded.reason : edge?.kind === "capture" ? `would fold in isolation, but it captured objects from ${relative5(process.cwd(), edge.from)}, which falls back to run \u2014 folding independently would hold an instance the build never collects` : `would fold in isolation, but a file that imports it (directly or transitively) falls back to run \u2014 folding independently would create a duplicate, non-identical instance`; foldDecisions.push({ file: file2, mode: "run", reason, reverseTainted: folded.ok }); } if (options?.sandbox) { @@ -235366,14 +239976,19 @@ __export(build_exports, { collectLexiconOutputs: () => collectLexiconOutputs, computeStackGraph: () => computeStackGraph, detectCrossLexiconRefs: () => detectCrossLexiconRefs, + isStackMember: () => isStackMember, mergeBuildRootEntities: () => mergeBuildRootEntities, partitionByLexicon: () => partitionByLexicon }); -import { resolve as resolve5 } from "node:path"; -function computeStackGraph(entities, lexiconNames) { +import { resolve as resolve7 } from "node:path"; +function isStackMember(entity) { + return !isLexiconOutput(entity) && !isSecretDeclaration(entity) && !isScenario(entity) && !isOpEntity(entity); +} +function computeStackGraph(entities, lexiconNames2) { const edges = []; const edgeSet = /* @__PURE__ */ new Set(); const addEdge = (from, to) => { + if (typeof from !== "string" || typeof to !== "string") return; if (from === to) return; const key = `${from}\0${to}`; if (edgeSet.has(key)) return; @@ -235398,6 +240013,7 @@ function computeStackGraph(entities, lexiconNames) { for (const val of Object.values(value)) walk(val, consumer, visited); }; for (const [, entity] of entities) { + if (!isStackMember(entity)) continue; const consumer = entity.lexicon; const visited = /* @__PURE__ */ new Set(); for (const val of Object.values(entity)) { @@ -235407,11 +240023,11 @@ function computeStackGraph(entities, lexiconNames) { walk(entity.props, consumer, visited); } } - const nodes = lexiconNames.length ? [...lexiconNames] : ( - // Secret provenance declarations (#1828) and plan scenarios (#1292) never - // form a stack — their pseudo-lexicon has no serializer and must not - // appear in the manifest. - [...new Set([...entities.values()].filter((e) => !isSecretDeclaration(e) && !isScenario(e)).map((e) => e.lexicon))] + const nodes = lexiconNames2.length ? [...lexiconNames2] : ( + // The same predicate, rather than the partial copy of it this branch + // carried: it filtered secrets and scenarios but not outputs or Ops, so + // it could mint a node the partition would have dropped (#2480). + [...new Set([...entities.values()].filter(isStackMember).map((e) => e.lexicon))] ); const deps = /* @__PURE__ */ new Map(); for (const n of nodes) deps.set(n, /* @__PURE__ */ new Set()); @@ -235439,10 +240055,7 @@ function computeStackGraph(entities, lexiconNames) { function partitionByLexicon(entities) { const partitions = /* @__PURE__ */ new Map(); for (const [name, entity] of entities) { - if (isLexiconOutput(entity)) continue; - if (isSecretDeclaration(entity)) continue; - if (isScenario(entity)) continue; - if (isOpEntity(entity)) continue; + if (!isStackMember(entity)) continue; const lexicon = entity.lexicon; if (!partitions.has(lexicon)) { partitions.set(lexicon, /* @__PURE__ */ new Map()); @@ -235558,13 +240171,13 @@ function detectCrossLexiconRefs(entities) { } return outputs; } -function computeDeployOrder(lexiconNames, lexiconOutputs) { +function computeDeployOrder(lexiconNames2, lexiconOutputs) { const deps = /* @__PURE__ */ new Map(); - for (const name of lexiconNames) { + for (const name of lexiconNames2) { deps.set(name, /* @__PURE__ */ new Set()); } for (const output of lexiconOutputs) { - for (const name of lexiconNames) { + for (const name of lexiconNames2) { if (name !== output.sourceLexicon) { deps.get(name)?.add(output.sourceLexicon); } @@ -235584,12 +240197,12 @@ function computeDeployOrder(lexiconNames, lexiconOutputs) { visited.add(name); sorted.push(name); } - for (const name of lexiconNames) { + for (const name of lexiconNames2) { visit(name); } return sorted; } -function generateManifest(lexiconNames, lexiconOutputs, entities) { +function generateManifest(lexiconNames2, lexiconOutputs, entities) { const outputsRecord = {}; for (const output of lexiconOutputs) { outputsRecord[output.outputName] = { @@ -235599,10 +240212,10 @@ function generateManifest(lexiconNames, lexiconOutputs, entities) { }; } return { - lexicons: lexiconNames, + lexicons: lexiconNames2, outputs: outputsRecord, - deployOrder: computeDeployOrder(lexiconNames, lexiconOutputs), - stackGraph: computeStackGraph(entities, lexiconNames) + deployOrder: computeDeployOrder(lexiconNames2, lexiconOutputs), + stackGraph: computeStackGraph(entities, lexiconNames2) }; } async function mergeBuildRootEntities(entities, contributors) { @@ -235631,6 +240244,7 @@ async function build2(path, serializers, parentBuildStack, options) { intrinsics: options?.intrinsics, lexicons: options?.lexicons, sandbox: options?.sandbox, + executing: options?.executing, buildParams: options?.buildParams }); return buildFromDiscoveryResult(discoveryResult, path, serializers, parentBuildStack, options); @@ -235657,12 +240271,12 @@ async function buildFromDiscoveryResult(discoveryResult, resolvedPathForChildSta ); } } - const resolvedPath = resolve5(resolvedPathForChildStack); + const resolvedPath = resolve7(resolvedPathForChildStack); const buildStack = parentBuildStack ? new Set(parentBuildStack) : /* @__PURE__ */ new Set(); buildStack.add(resolvedPath); for (const [name, entity] of discoveryResult.entities) { if (isChildProject(entity)) { - const childPath = resolve5(entity.projectPath); + const childPath = resolve7(entity.projectPath); if (buildStack.has(childPath)) { errors.push( new BuildError( @@ -235743,8 +240357,8 @@ async function buildFromDiscoveryResult(discoveryResult, resolvedPathForChildSta warnings.push(`No serializer found for lexicon "${lexiconName}"`); } } - const lexiconNames = Array.from(partitions.keys()); - const manifest = generateManifest(lexiconNames, lexiconOutputs, discoveryResult.entities); + const lexiconNames2 = Array.from(partitions.keys()); + const manifest = generateManifest(lexiconNames2, lexiconOutputs, discoveryResult.entities); return { outputs, entities: discoveryResult.entities, @@ -235800,6 +240414,7 @@ var init_build = __esm({ // node_modules/@intentius/chant/src/graph-ir.ts var graph_ir_exports = {}; __export(graph_ir_exports, { + GRAPH_IR_VERSION: () => GRAPH_IR_VERSION, buildGraphIr: () => buildGraphIr, buildLiveGraphIr: () => buildLiveGraphIr, collectUnobserved: () => collectUnobserved, @@ -235808,7 +240423,7 @@ __export(graph_ir_exports, { overlayGraphs: () => overlayGraphs, sourceOverlayGraphs: () => sourceOverlayGraphs }); -import { relative as relative5, isAbsolute as isAbsolute2 } from "node:path"; +import { relative as relative6, isAbsolute as isAbsolute4 } from "node:path"; function isEntityReference(value) { return typeof value === "object" && value !== null && typeof value.to === "string"; } @@ -235828,8 +240443,8 @@ function isNodeEntity(entity) { } function relFile(file2, projectPath) { if (!file2) return void 0; - if (projectPath && isAbsolute2(file2)) { - const rel = relative5(projectPath, file2); + if (projectPath && isAbsolute4(file2)) { + const rel = relative6(projectPath, file2); return rel.startsWith("..") ? file2 : rel; } return file2; @@ -236141,7 +240756,7 @@ function sourceOverlayGraphs(declared, live, opts) { } return { ...declared, nodes, edges, ...exports ? { exports } : {} }; } -var SKIP_KEYS; +var GRAPH_IR_VERSION, SKIP_KEYS; var init_graph_ir = __esm({ "node_modules/@intentius/chant/src/graph-ir.ts"() { init_utils(); @@ -236149,6 +240764,7 @@ var init_graph_ir = __esm({ init_lexicon_output(); init_provenance(); init_intrinsic(); + GRAPH_IR_VERSION = 1; SKIP_KEYS = /* @__PURE__ */ new Set(["lexicon", "entityType", "kind", "attributes", "Ref", "references", "stack"]); } }); @@ -236212,10 +240828,10 @@ var init_detectLexicon = __esm({ }); // node_modules/@intentius/chant/src/lint/parser.ts -var ts5; +var ts6; var init_parser = __esm({ "node_modules/@intentius/chant/src/lint/parser.ts"() { - ts5 = __toESM(require_typescript(), 1); + ts6 = __toESM(require_typescript(), 1); } }); @@ -236225,233 +240841,252 @@ var init_rule = __esm({ } }); +// node_modules/@intentius/chant/src/lint/rules/property-kind.ts +var ts7; +var init_property_kind = __esm({ + "node_modules/@intentius/chant/src/lint/rules/property-kind.ts"() { + ts7 = __toESM(require_typescript(), 1); + } +}); + // node_modules/@intentius/chant/src/lint/rules/flat-declarations.ts -var ts6; +var ts8; var init_flat_declarations = __esm({ "node_modules/@intentius/chant/src/lint/rules/flat-declarations.ts"() { - ts6 = __toESM(require_typescript(), 1); + ts8 = __toESM(require_typescript(), 1); + init_property_kind(); } }); // node_modules/@intentius/chant/src/lint/rules/export-required.ts -var ts7; +var ts9; var init_export_required = __esm({ "node_modules/@intentius/chant/src/lint/rules/export-required.ts"() { - ts7 = __toESM(require_typescript(), 1); + ts9 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/file-declarable-limit.ts -var ts8; +var ts10; var init_file_declarable_limit = __esm({ "node_modules/@intentius/chant/src/lint/rules/file-declarable-limit.ts"() { - ts8 = __toESM(require_typescript(), 1); + ts10 = __toESM(require_typescript(), 1); + init_property_kind(); } }); // node_modules/@intentius/chant/src/lint/rules/single-concern-file.ts -var ts9; +var ts11; var init_single_concern_file = __esm({ "node_modules/@intentius/chant/src/lint/rules/single-concern-file.ts"() { - ts9 = __toESM(require_typescript(), 1); + ts11 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/declarable-naming-convention.ts -var ts10; +var ts12; var init_declarable_naming_convention = __esm({ "node_modules/@intentius/chant/src/lint/rules/declarable-naming-convention.ts"() { - ts10 = __toESM(require_typescript(), 1); + ts12 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/no-unused-declarable-import.ts -var ts11; +var ts13; var init_no_unused_declarable_import = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-unused-declarable-import.ts"() { - ts11 = __toESM(require_typescript(), 1); + ts13 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/no-redundant-value-cast.ts -var ts12; +var ts14; var init_no_redundant_value_cast = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-redundant-value-cast.ts"() { - ts12 = __toESM(require_typescript(), 1); + ts14 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/no-unused-declarable.ts -var ts13; +var ts15; var init_no_unused_declarable = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-unused-declarable.ts"() { - ts13 = __toESM(require_typescript(), 1); + ts15 = __toESM(require_typescript(), 1); + init_property_kind(); } }); // node_modules/@intentius/chant/src/lint/rules/no-cyclic-declarable-ref.ts -var ts14; +var ts16; var init_no_cyclic_declarable_ref = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-cyclic-declarable-ref.ts"() { - ts14 = __toESM(require_typescript(), 1); + ts16 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/no-redundant-type-import.ts -var ts15; +var ts17; var init_no_redundant_type_import = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-redundant-type-import.ts"() { - ts15 = __toESM(require_typescript(), 1); + ts17 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/no-string-ref.ts -var ts16; +var ts18; var init_no_string_ref = __esm({ "node_modules/@intentius/chant/src/lint/rules/no-string-ref.ts"() { - ts16 = __toESM(require_typescript(), 1); + ts18 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/composite-scope.ts -var ts17; +var ts19; var init_composite_scope = __esm({ "node_modules/@intentius/chant/src/lint/rules/composite-scope.ts"() { - ts17 = __toESM(require_typescript(), 1); + ts19 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/evl001-non-literal-expression.ts -var ts18; +var ts20; var init_evl001_non_literal_expression = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl001-non-literal-expression.ts"() { - ts18 = __toESM(require_typescript(), 1); + ts20 = __toESM(require_typescript(), 1); init_composite_scope(); init_subset(); } }); // node_modules/@intentius/chant/src/lint/rules/evl002-control-flow-resource.ts -var ts19, CONTROL_FLOW_KINDS; +var ts21, CONTROL_FLOW_KINDS; var init_evl002_control_flow_resource = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl002-control-flow-resource.ts"() { - ts19 = __toESM(require_typescript(), 1); + ts21 = __toESM(require_typescript(), 1); CONTROL_FLOW_KINDS = /* @__PURE__ */ new Set([ - ts19.SyntaxKind.IfStatement, - ts19.SyntaxKind.ForStatement, - ts19.SyntaxKind.ForInStatement, - ts19.SyntaxKind.ForOfStatement, - ts19.SyntaxKind.WhileStatement, - ts19.SyntaxKind.DoStatement, - ts19.SyntaxKind.SwitchStatement, - ts19.SyntaxKind.TryStatement + ts21.SyntaxKind.IfStatement, + ts21.SyntaxKind.ForStatement, + ts21.SyntaxKind.ForInStatement, + ts21.SyntaxKind.ForOfStatement, + ts21.SyntaxKind.WhileStatement, + ts21.SyntaxKind.DoStatement, + ts21.SyntaxKind.SwitchStatement, + ts21.SyntaxKind.TryStatement ]); } }); // node_modules/@intentius/chant/src/lint/rules/evl003-dynamic-property-access.ts -var ts20; +var ts22; var init_evl003_dynamic_property_access = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl003-dynamic-property-access.ts"() { - ts20 = __toESM(require_typescript(), 1); + ts22 = __toESM(require_typescript(), 1); init_subset(); } }); // node_modules/@intentius/chant/src/lint/rules/evl004-spread-non-const.ts -var ts21; +var ts23; var init_evl004_spread_non_const = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl004-spread-non-const.ts"() { - ts21 = __toESM(require_typescript(), 1); + ts23 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/evl005-resource-block-body.ts -var ts22; +var ts24; var init_evl005_resource_block_body = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl005-resource-block-body.ts"() { - ts22 = __toESM(require_typescript(), 1); + ts24 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/evl007-invalid-siblings.ts -var ts23; +var ts25; var init_evl007_invalid_siblings = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl007-invalid-siblings.ts"() { - ts23 = __toESM(require_typescript(), 1); + ts25 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/evl009-composite-no-constant.ts -var ts24; +var ts26; var init_evl009_composite_no_constant = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl009-composite-no-constant.ts"() { - ts24 = __toESM(require_typescript(), 1); + ts26 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/evl010-composite-no-transform.ts -var ts25; +var ts27; var init_evl010_composite_no_transform = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl010-composite-no-transform.ts"() { - ts25 = __toESM(require_typescript(), 1); + ts27 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/evl011-symbolic-in-template.ts -var ts26; +var ts28; var init_evl011_symbolic_in_template = __esm({ "node_modules/@intentius/chant/src/lint/rules/evl011-symbolic-in-template.ts"() { - ts26 = __toESM(require_typescript(), 1); + ts28 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/cor017-composite-name-match.ts -var ts27; +var ts29; var init_cor017_composite_name_match = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor017-composite-name-match.ts"() { - ts27 = __toESM(require_typescript(), 1); + ts29 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/cor018-composite-prefer-lexicon-type.ts -var ts28; +var ts30; var init_cor018_composite_prefer_lexicon_type = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor018-composite-prefer-lexicon-type.ts"() { - ts28 = __toESM(require_typescript(), 1); + ts30 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/cor021-env-literal-name.ts -var ts29; +var ts31; var init_cor021_env_literal_name = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor021-env-literal-name.ts"() { - ts29 = __toESM(require_typescript(), 1); + ts31 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/cor022-receipt-leaf.ts -var ts30; +var ts32; var init_cor022_receipt_leaf = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor022-receipt-leaf.ts"() { - ts30 = __toESM(require_typescript(), 1); + ts32 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/cor024-receipt-secret-pointer.ts -var ts31; +var ts33; var init_cor024_receipt_secret_pointer = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor024-receipt-secret-pointer.ts"() { - ts31 = __toESM(require_typescript(), 1); + ts33 = __toESM(require_typescript(), 1); init_cor022_receipt_leaf(); } }); +// node_modules/@intentius/chant/src/lint/rules/sys001-no-literal-key.ts +var import_typescript; +var init_sys001_no_literal_key = __esm({ + "node_modules/@intentius/chant/src/lint/rules/sys001-no-literal-key.ts"() { + import_typescript = __toESM(require_typescript(), 1); + } +}); + // node_modules/@intentius/chant/src/lint/rules/index.ts var init_rules = __esm({ "node_modules/@intentius/chant/src/lint/rules/index.ts"() { @@ -236480,6 +241115,7 @@ var init_rules = __esm({ init_cor021_env_literal_name(); init_cor022_receipt_leaf(); init_cor024_receipt_secret_pointer(); + init_sys001_no_literal_key(); init_composite_scope(); init_flat_declarations(); init_export_required(); @@ -236506,6 +241142,7 @@ var init_rules = __esm({ init_cor021_env_literal_name(); init_cor022_receipt_leaf(); init_cor024_receipt_secret_pointer(); + init_sys001_no_literal_key(); } }); @@ -236516,45 +241153,45 @@ function collectNodes(root, predicate) { if (predicate(node)) { results.push(node); } - ts32.forEachChild(node, visit); + ts35.forEachChild(node, visit); } visit(root); return results; } function selectResource(sf) { - return collectNodes(sf, (node) => ts32.isNewExpression(node)); + return collectNodes(sf, (node) => ts35.isNewExpression(node)); } function selectAnyResource(sf) { return selectResource(sf); } function selectStringLiteral(sf) { - return collectNodes(sf, (node) => ts32.isStringLiteral(node)); + return collectNodes(sf, (node) => ts35.isStringLiteral(node)); } function selectExportName(sf) { return collectNodes(sf, (node) => { - if (ts32.isVariableStatement(node)) { - return node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; + if (ts35.isVariableStatement(node)) { + return node.modifiers?.some((m) => m.kind === ts35.SyntaxKind.ExportKeyword) ?? false; } - if (ts32.isFunctionDeclaration(node) || ts32.isClassDeclaration(node)) { - return node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; + if (ts35.isFunctionDeclaration(node) || ts35.isClassDeclaration(node)) { + return node.modifiers?.some((m) => m.kind === ts35.SyntaxKind.ExportKeyword) ?? false; } return false; }); } function selectImportSource(sf) { return collectNodes(sf, (node) => { - if (ts32.isImportDeclaration(node)) { + if (ts35.isImportDeclaration(node)) { return true; } return false; }); } function selectProperty(sf) { - return collectNodes(sf, (node) => ts32.isPropertyAssignment(node)); + return collectNodes(sf, (node) => ts35.isPropertyAssignment(node)); } function selectResourceType(sf) { return collectNodes(sf, (node) => { - if (ts32.isNewExpression(node) && node.typeArguments && node.typeArguments.length > 0) { + if (ts35.isNewExpression(node) && node.typeArguments && node.typeArguments.length > 0) { return true; } return false; @@ -236562,16 +241199,16 @@ function selectResourceType(sf) { } function selectExportedConst(sf) { return collectNodes(sf, (node) => { - if (!ts32.isVariableStatement(node)) return false; - const hasExport = node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; + if (!ts35.isVariableStatement(node)) return false; + const hasExport = node.modifiers?.some((m) => m.kind === ts35.SyntaxKind.ExportKeyword) ?? false; if (!hasExport) return false; - return node.declarationList.flags === ts32.NodeFlags.Const || (node.declarationList.flags & ts32.NodeFlags.Const) !== 0; + return node.declarationList.flags === ts35.NodeFlags.Const || (node.declarationList.flags & ts35.NodeFlags.Const) !== 0; }); } -var ts32, selectorRegistry, builtins; +var ts35, selectorRegistry, builtins; var init_selectors = __esm({ "node_modules/@intentius/chant/src/lint/selectors.ts"() { - ts32 = __toESM(require_typescript(), 1); + ts35 = __toESM(require_typescript(), 1); selectorRegistry = /* @__PURE__ */ new Map(); builtins = [ ["resource", selectResource], @@ -236636,10 +241273,10 @@ var init_format = __esm({ }); // node_modules/@intentius/chant/src/runtime-adapter.ts -import { dirname as dirname10 } from "path"; -import { fileURLToPath as fileURLToPath2 } from "url"; +import { dirname as dirname12 } from "path"; +import { fileURLToPath as fileURLToPath3 } from "url"; function moduleDir(importMetaUrl) { - return dirname10(fileURLToPath2(importMetaUrl)); + return dirname12(fileURLToPath3(importMetaUrl)); } var init_runtime_adapter = __esm({ "node_modules/@intentius/chant/src/runtime-adapter.ts"() { @@ -237016,7 +241653,7 @@ var init_strict = __esm({ }); // node_modules/@intentius/chant/src/lint/config.ts -import { join as join9, dirname as dirname11, resolve as resolve6 } from "path"; +import { join as join12, dirname as dirname13, resolve as resolve8 } from "path"; var BUILTIN_PRESETS, SeveritySchema, RuleConfigSchema, LintConfigSchema, DEFAULT_CONFIG; var init_config2 = __esm({ "node_modules/@intentius/chant/src/lint/config.ts"() { @@ -237027,8 +241664,8 @@ var init_config2 = __esm({ init_strict(); init_project_root(); BUILTIN_PRESETS = { - "@intentius/chant/lint/presets/strict": resolve6(moduleDir(import.meta.url), "presets/strict.json"), - "@intentius/chant/lint/presets/relaxed": resolve6(moduleDir(import.meta.url), "presets/relaxed.json") + "@intentius/chant/lint/presets/strict": resolve8(moduleDir(import.meta.url), "presets/strict.json"), + "@intentius/chant/lint/presets/relaxed": resolve8(moduleDir(import.meta.url), "presets/relaxed.json") }; SeveritySchema = external_exports.enum(["off", "error", "warning", "info"]); RuleConfigSchema = external_exports.union([ @@ -237092,18 +241729,9 @@ var init_reproducibility = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/build-archive.ts -function contentDigest(input) { - let hash2 = 0; - for (let i = 0; i < input.length; i++) { - hash2 = Math.imul(hash2, 31) + input.charCodeAt(i) | 0; - } - const hex3 = Math.abs(hash2).toString(16).padStart(8, "0"); - return `sha256:${hex3.repeat(8).slice(0, 64)}`; -} function computeManifestDigest(contents) { - const sorted = [...contents].sort((a, b) => a.path.localeCompare(b.path)); - const canonical2 = sorted.map((e) => `${e.kind}:${e.path}:${e.digest}`).join("\n"); - return contentDigest(canonical2); + const sorted = contents.map((e) => ({ kind: e.kind, path: e.path, digest: e.digest })).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0); + return contentDigest(canonicalJson(sorted)); } function createBuildArchiveManifest(component, opts) { const createdAt = (opts?.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(); @@ -237126,6 +241754,8 @@ var DEFAULT_MEDIA_TYPES; var init_build_archive = __esm({ "node_modules/@intentius/chant/src/components/verbs/build-archive.ts"() { init_reproducibility(); + init_content_digest(); + init_effect_receipt(); DEFAULT_MEDIA_TYPES = { image: "application/vnd.oci.image.layout.v1.tar", template: "application/json", @@ -237139,7 +241769,7 @@ var init_build_archive = __esm({ import { exec } from "node:child_process"; import { createConnection } from "node:net"; import { promisify } from "node:util"; -import { isAbsolute as isAbsolute3, join as join10 } from "node:path"; +import { isAbsolute as isAbsolute5, join as join13 } from "node:path"; function run(command) { return execFileAsync(command, { maxBuffer: 64 * 1024 * 1024 }); } @@ -237149,11 +241779,11 @@ function q(value) { function probeBoltPort(endpoint, timeoutMs = 5e3) { const [host, portStr] = endpoint.split(":"); const port = Number(portStr ?? 7687); - return new Promise((resolve9) => { + return new Promise((resolve12) => { const socket = createConnection({ host, port, timeout: timeoutMs }); const finish = (healthy) => { socket.destroy(); - resolve9(healthy); + resolve12(healthy); }; socket.once("connect", () => finish(true)); socket.once("timeout", () => finish(false)); @@ -237168,7 +241798,7 @@ function defaultCloudExecutor() { return defaultExecutor; } function sleep(ms) { - return new Promise((resolve9) => setTimeout(resolve9, ms)); + return new Promise((resolve12) => setTimeout(resolve12, ms)); } var execFileAsync, realDocker, realNeo4j, defaultExecutor; var init_cloud_executor = __esm({ @@ -237178,7 +241808,7 @@ var init_cloud_executor = __esm({ async build(args) { const parts = [`docker build`, `-t ${q(args.tag)}`]; if (args.dockerfile) { - const dockerfilePath = isAbsolute3(args.dockerfile) ? args.dockerfile : join10(args.context, args.dockerfile); + const dockerfilePath = isAbsolute5(args.dockerfile) ? args.dockerfile : join13(args.context, args.dockerfile); parts.push(`-f ${q(dockerfilePath)}`); } if (args.target) parts.push(`--target ${q(args.target)}`); @@ -237229,15 +241859,15 @@ function realProcessExecutor() { return realProcessRunner; } function defaultProcessRunner() { - if (!defaultRunner) defaultRunner = realProcessExecutor(); - return defaultRunner; + if (!defaultRunner2) defaultRunner2 = realProcessExecutor(); + return defaultRunner2; } async function requireTool(runner, tool, purpose) { if (!await runner.available(tool)) { throw new ToolNotAvailableError(tool, purpose); } } -var execAsync, realProcessRunner, defaultRunner, ToolNotAvailableError; +var execAsync, realProcessRunner, defaultRunner2, ToolNotAvailableError; var init_process_runner = __esm({ "node_modules/@intentius/chant/src/components/verbs/process-runner.ts"() { execAsync = promisify2(exec2); @@ -237271,8 +241901,8 @@ var init_process_runner = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/build.ts -import { readFileSync as readFileSync6 } from "node:fs"; -import { createHash } from "node:crypto"; +import { readFileSync as readFileSync9 } from "node:fs"; +import { createHash as createHash2 } from "node:crypto"; function createDockerBuildCapability(executor = defaultCloudExecutor()) { return { kind: "docker-build", @@ -237304,7 +241934,7 @@ function createZipPackageCapability(processRunner = defaultProcessRunner()) { async run(_ctx, input) { const excludes = (input.exclude ?? []).map((p) => `-x ${q2(p)}`).join(" "); await processRunner.run(`rm -f ${q2(input.into)} && zip -r -X ${q2(input.into)} ${q2(input.source)}${excludes ? ` ${excludes}` : ""}`); - const digest = `sha256:${createHash("sha256").update(readFileSync6(input.into)).digest("hex")}`; + const digest = `sha256:${createHash2("sha256").update(readFileSync9(input.into)).digest("hex")}`; return { archivePath: input.into, digest }; } }; @@ -237324,7 +241954,7 @@ function createJvmBuildCapability(processRunner = defaultProcessRunner()) { `cp "$(ls ${q2(`${input.path}/target`)}/*.jar | grep -Ev '(-sources|-javadoc)\\.jar$' | head -1)" ${q2(input.into)}` ); } - const digest = `sha256:${createHash("sha256").update(readFileSync6(input.into)).digest("hex")}`; + const digest = `sha256:${createHash2("sha256").update(readFileSync9(input.into)).digest("hex")}`; return { archivePath: input.into, digest }; } }; @@ -237390,8 +242020,8 @@ var init_sbom = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/tool-sbom-generator.ts -import { basename as basename3, dirname as dirname12, join as join11 } from "node:path"; -import { existsSync as existsSync7 } from "node:fs"; +import { basename as basename3, dirname as dirname14, join as join14 } from "node:path"; +import { existsSync as existsSync9 } from "node:fs"; function countPackages(format, bytes) { try { const doc = JSON.parse(bytes); @@ -237404,7 +242034,7 @@ function countPackages(format, bytes) { function scratchPath(workDir, subject, format) { const dir = workDir ?? "/tmp/chant-sbom"; const safeName = basename3(subject).replace(/[^a-zA-Z0-9_.-]/g, "_"); - return join11(dir, `${safeName}.${Date.now()}.${format}.json`); + return join14(dir, `${safeName}.${Date.now()}.${format}.json`); } function createToolSbomGenerator(options = {}) { const runner = options.runner ?? defaultProcessRunner(); @@ -237418,14 +242048,14 @@ function createToolSbomGenerator(options = {}) { return { async forImage(input) { const format = input.format ?? DEFAULT_SBOM_FORMAT; - const buildContext = dirname12(input.imagePath); - const hasDockerfile = existsSync7(join11(buildContext, "Dockerfile")); + const buildContext = dirname14(input.imagePath); + const hasDockerfile = existsSync9(join14(buildContext, "Dockerfile")); if (hasDockerfile && await runner.available("docker")) { const out = scratchPath(options.workDir, input.imagePath, format); await runner.run( `docker buildx build --sbom=true --output type=local,dest=${q2(out)} ${q2(buildContext)}` ); - const { stdout } = await runner.run(`cat ${q2(join11(out, "sbom.spdx.json"))}`); + const { stdout } = await runner.run(`cat ${q2(join14(out, "sbom.spdx.json"))}`); return { format, mediaType: SBOM_MEDIA_TYPES[format], @@ -237439,13 +242069,13 @@ function createToolSbomGenerator(options = {}) { }, async forJar(input) { const format = input.format ?? DEFAULT_SBOM_FORMAT; - const projectDir = dirname12(input.jarPath); - const hasPom = existsSync7(join11(projectDir, "pom.xml")); + const projectDir = dirname14(input.jarPath); + const hasPom = existsSync9(join14(projectDir, "pom.xml")); if (hasPom && await runner.available("mvn")) { await requireTool(runner, "mvn", `run cyclonedx-maven against ${projectDir}`); const out = scratchPath(options.workDir, input.jarPath, "cyclonedx"); await runner.run( - `mvn -f ${q2(join11(projectDir, "pom.xml"))} org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom -DoutputFormat=json -DoutputName=${q2(basename3(out, ".json"))}`, + `mvn -f ${q2(join14(projectDir, "pom.xml"))} org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom -DoutputFormat=json -DoutputName=${q2(basename3(out, ".json"))}`, { cwd: projectDir } ); const { stdout } = await runner.run(`cat ${q2(out)}`); @@ -237694,7 +242324,6 @@ var init_verify = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/run-agent.ts -import { createHash as createHash2 } from "node:crypto"; function defaultSpriteActivities() { const notWired = (method) => async () => { throw new SpriteActivitiesNotWiredError(method); @@ -237769,9 +242398,6 @@ function createRunAgentCapability(sprites = defaultSpriteActivities()) { } }; } -function sha256Digest(content) { - return `sha256:${createHash2("sha256").update(content, "utf8").digest("hex")}`; -} function computeTranscriptDigest(params2) { const basis = { agent: params2.agent, @@ -237816,9 +242442,10 @@ async function collectArtifacts(sprites, spriteId) { throw err; } } -var SpriteActivitiesNotWiredError, PROMPT_PATH, OUTPUT_PATH, EMPTY_DIGEST, runAgentCapability; +var SpriteActivitiesNotWiredError, PROMPT_PATH, OUTPUT_PATH, sha256Digest, EMPTY_DIGEST, runAgentCapability; var init_run_agent = __esm({ "node_modules/@intentius/chant/src/components/verbs/run-agent.ts"() { + init_content_digest(); init_sign(); SpriteActivitiesNotWiredError = class extends Error { constructor(method) { @@ -237832,6 +242459,7 @@ var init_run_agent = __esm({ }; PROMPT_PATH = "/work/prompt"; OUTPUT_PATH = "/work/output"; + sha256Digest = contentDigest; EMPTY_DIGEST = sha256Digest(""); runAgentCapability = createRunAgentCapability(); } @@ -237987,9 +242615,9 @@ var init_r2_sync = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/vuln-scan.ts -import { writeFileSync as writeFileSync3 } from "node:fs"; +import { readFileSync as readFileSync10, writeFileSync as writeFileSync3 } from "node:fs"; import { tmpdir as tmpdir2 } from "node:os"; -import { join as join12 } from "node:path"; +import { join as join15 } from "node:path"; import { createHash as createHash3 } from "node:crypto"; function normalizeSeverity(raw) { const s = (raw ?? "").toLowerCase(); @@ -238045,7 +242673,7 @@ function createToolVulnScanner(tool = "grype", processRunner = defaultProcessRun await requireTool(processRunner, tool, `scan the SBOM for known vulnerabilities`); const hash2 = createHash3("sha256").update(input.sbom.bytes).digest("hex").slice(0, 16); const ext = input.sbom.format === "cyclonedx" ? "cdx.json" : "spdx.json"; - const path = join12(tmpdir2(), `chant-scan-${hash2}.${ext}`); + const path = join15(tmpdir2(), `chant-scan-${hash2}.${ext}`); writeFileSync3(path, input.sbom.bytes); if (tool === "trivy") { const { stdout: stdout2 } = await processRunner.run(`trivy sbom --quiet --format json ${q2(path)}`); @@ -238536,11 +243164,11 @@ var init_rule_loader = __esm({ }); // node_modules/@intentius/chant/src/lint/discover.ts -import { createRequire as createRequire3 } from "module"; +import { createRequire as createRequire6 } from "module"; var init_discover = __esm({ "node_modules/@intentius/chant/src/lint/discover.ts"() { try { - const _req = createRequire3(import.meta.url); + const _req = createRequire6(import.meta.url); const { register } = _req("tsx/cjs/api"); register(); } catch { @@ -238561,8 +243189,19 @@ var init_generator = __esm({ }); // node_modules/@intentius/chant/src/observation.ts +var UNOBSERVED_REASON_WITNESS, UNOBSERVED_REASONS; var init_observation = __esm({ "node_modules/@intentius/chant/src/observation.ts"() { + UNOBSERVED_REASON_WITNESS = { + "read-failed": true, + "no-credentials": true, + "no-binding": true, + "unsupported-kind": true, + filtered: true + }; + UNOBSERVED_REASONS = Object.keys( + UNOBSERVED_REASON_WITNESS + ); } }); @@ -238941,7 +243580,7 @@ function stripUrlSecrets(value) { function stripFlagSecrets(value) { return value.replace( /(--?[A-Za-z0-9-]*(?:secret|token|password|passwd|key|credential|auth|pat)[A-Za-z0-9-]*)([=\s])(\S+)/gi, - (_m, flag, sep2) => `${flag}${sep2}${REDACTED2}` + (_m, flag, sep4) => `${flag}${sep4}${REDACTED2}` ).replace(/(^|\s)(-[pPkK])(\s+)(\S+)/g, (_m, lead, flag, sp) => `${lead}${flag}${sp}${REDACTED2}`); } function redactEngineAddress(value, env2 = process.env) { @@ -239303,11 +243942,11 @@ function coverageFor(contributors, entityType, props) { if (late !== void 0) return { status: "declared-unmapped", reason: late }; return { status: "unknown-type" }; } -function ownerOf(contributors, entityType) { +function ownerOf2(contributors, entityType) { return contributors.find((c) => c.prefixes.some((p) => entityType.startsWith(p))); } function coverageLabel(contributors, entityType, props) { - const owner = ownerOf(contributors, entityType); + const owner = ownerOf2(contributors, entityType); if (!owner?.resolveType) return entityType; const type = owner.resolveType(entityType, props); return type === void 0 || type === entityType ? entityType : `${type} (${entityType})`; @@ -239320,7 +243959,7 @@ function unmappedDetail(label, verdict, owner) { return `${label} belongs to ${verdict.substrate}, which nothing here models. A substrate is added by the lexicon that owns its types contributing rows for them, not by adding a row elsewhere. This is a stated boundary rather than a gap \u2014 nothing needs filing.`; } const where = owner ? `the lexicon that owns ${owner.prefixes.join(", ")}` : "the lexicon that owns this entity type"; - return `${label} has no row in any contributed coverage table \u2014 it is a type from a substrate that is modelled, and is neither mapped to an engine kind nor declared unmapped, so nothing has an opinion about it rather than a stated one. Add a row in ${where}.`; + return `${label} has no row in any contributed coverage table. It is a type from a substrate that is modelled, and is neither mapped to an engine kind nor declared unmapped, so nothing has an opinion about it rather than a stated one. Add a row in ${where}.`; } var ENGINE_KIND_WITNESS, ENGINE_KINDS, CHANT_PSEUDO_PREFIX, byCodeUnit; var init_behaviour_kinds = __esm({ @@ -239683,7 +244322,7 @@ var init_lexicon_manifest = __esm({ }); // node_modules/@intentius/chant/src/lexicon-schema.ts -var IntrinsicDefSchema, semverRegex, LexiconManifestSchema, ExtensionConstraintSchema, PropertyConstraintsSchema, LexiconEntrySchema; +var IntrinsicDefSchema, semverRegex, LexiconManifestSchema, ExtensionConstraintSchema, PropertyConstraintsSchema, LexiconEntrySchema2; var init_lexicon_schema = __esm({ "node_modules/@intentius/chant/src/lexicon-schema.ts"() { init_zod(); @@ -239729,7 +244368,7 @@ var init_lexicon_schema = __esm({ default: external_exports.unknown().optional(), enum: external_exports.array(external_exports.string()).optional() }); - LexiconEntrySchema = external_exports.object({ + LexiconEntrySchema2 = external_exports.object({ resourceType: external_exports.string(), kind: external_exports.enum(["resource", "property"]), lexicon: external_exports.string(), @@ -239816,10 +244455,10 @@ var init_okf = __esm({ }); // node_modules/@intentius/chant/src/codegen/okf-lexicon.ts -var ts33; +var ts36; var init_okf_lexicon = __esm({ "node_modules/@intentius/chant/src/codegen/okf-lexicon.ts"() { - ts33 = __toESM(require_typescript(), 1); + ts36 = __toESM(require_typescript(), 1); init_okf(); } }); @@ -239917,6 +244556,7 @@ var init_pinned_upgrade = __esm({ init_lexicon_regen(); init_fetch(); init_lexicon(); + init_lexicon_module(); } }); @@ -239959,18 +244599,26 @@ var init_types4 = __esm({ } }); +// node_modules/@intentius/chant/src/lifecycle/member-ledger.ts +var init_member_ledger = __esm({ + "node_modules/@intentius/chant/src/lifecycle/member-ledger.ts"() { + init_project_root(); + } +}); + // node_modules/@intentius/chant/src/lifecycle/git.ts var init_git = __esm({ "node_modules/@intentius/chant/src/lifecycle/git.ts"() { init_runtime_adapter(); + init_member_ledger(); } }); // node_modules/@intentius/chant/src/lifecycle/digest.ts var init_digest = __esm({ "node_modules/@intentius/chant/src/lifecycle/digest.ts"() { - init_utils(); - init_runtime_adapter(); + init_effect_receipt(); + init_content_digest(); } }); @@ -240097,14 +244745,20 @@ var init_receipt_plan = __esm({ }); // node_modules/@intentius/chant/src/lifecycle/affected.ts -import { execFile } from "node:child_process"; +import { execFile as execFile2 } from "node:child_process"; import { promisify as promisify4 } from "node:util"; var execFileAsync2; var init_affected = __esm({ "node_modules/@intentius/chant/src/lifecycle/affected.ts"() { init_build(); init_post_synth(); - execFileAsync2 = promisify4(execFile); + execFileAsync2 = promisify4(execFile2); + } +}); + +// node_modules/@intentius/chant/src/lifecycle/legacy-digest.ts +var init_legacy_digest = __esm({ + "node_modules/@intentius/chant/src/lifecycle/legacy-digest.ts"() { } }); @@ -240112,6 +244766,7 @@ var init_affected = __esm({ var init_release_ledger = __esm({ "node_modules/@intentius/chant/src/lifecycle/release-ledger.ts"() { init_utils(); + init_legacy_digest(); init_git(); } }); @@ -240127,6 +244782,7 @@ var init_build_ledger = __esm({ var init_build_ledger_store = __esm({ "node_modules/@intentius/chant/src/lifecycle/build-ledger-store.ts"() { init_utils(); + init_legacy_digest(); init_git(); } }); @@ -240142,6 +244798,7 @@ var init_oras_referrer_lookup = __esm({ var init_status = __esm({ "node_modules/@intentius/chant/src/lifecycle/status.ts"() { init_release_ledger(); + init_legacy_digest(); init_observation(); } }); @@ -240198,8 +244855,8 @@ var init_scenario_eval = __esm({ // node_modules/@intentius/chant/src/lifecycle/plan-digest.ts var init_plan_digest = __esm({ "node_modules/@intentius/chant/src/lifecycle/plan-digest.ts"() { - init_utils(); - init_runtime_adapter(); + init_effect_receipt(); + init_content_digest(); } }); @@ -240235,23 +244892,23 @@ var init_lifecycle = __esm({ } }); -// node_modules/@intentius/chant/src/op/receipt-store.ts -var init_receipt_store = __esm({ - "node_modules/@intentius/chant/src/op/receipt-store.ts"() { - init_effect_receipt(); - } -}); - // node_modules/@intentius/chant/src/op/types.ts var init_types5 = __esm({ "node_modules/@intentius/chant/src/op/types.ts"() { } }); +// node_modules/@intentius/chant/src/op/duration.ts +var init_duration = __esm({ + "node_modules/@intentius/chant/src/op/duration.ts"() { + } +}); + // node_modules/@intentius/chant/src/op/activity-profiles.ts -var ACTIVITY_PROFILES, ACTIVITY_PROFILE_NAMES; +var ACTIVITY_PROFILES, ACTIVITY_PROFILE_NAMES, MAX_STEP_TIMEOUT_MS; var init_activity_profiles = __esm({ "node_modules/@intentius/chant/src/op/activity-profiles.ts"() { + init_duration(); ACTIVITY_PROFILES = { /** * Fast, idempotent operations: `chant build`, `kubectl apply` without `--wait`, @@ -240336,6 +244993,7 @@ var init_activity_profiles = __esm({ } }; ACTIVITY_PROFILE_NAMES = Object.keys(ACTIVITY_PROFILES); + MAX_STEP_TIMEOUT_MS = 6 * 36e5; } }); @@ -240361,10 +245019,35 @@ var init_activity_contract = __esm({ // node_modules/@intentius/chant/src/op/step-output-ref.ts var init_step_output_ref = __esm({ "node_modules/@intentius/chant/src/op/step-output-ref.ts"() { + init_types5(); init_activity_contract(); } }); +// node_modules/@intentius/chant/src/op/work-lease-decl.ts +var init_work_lease_decl = __esm({ + "node_modules/@intentius/chant/src/op/work-lease-decl.ts"() { + init_step_output_ref(); + init_duration(); + init_types5(); + } +}); + +// node_modules/@intentius/chant/src/op/receipt-store.ts +var init_receipt_store = __esm({ + "node_modules/@intentius/chant/src/op/receipt-store.ts"() { + init_effect_receipt(); + } +}); + +// node_modules/@intentius/chant/src/op/gate-approval.ts +var init_gate_approval = __esm({ + "node_modules/@intentius/chant/src/op/gate-approval.ts"() { + init_lexicon_module(); + init_step_output_ref(); + } +}); + // node_modules/@intentius/chant/src/op/cron.ts var MAX_SCAN_MINUTES; var init_cron = __esm({ @@ -240377,8 +245060,11 @@ var init_cron = __esm({ var init_builders = __esm({ "node_modules/@intentius/chant/src/op/builders.ts"() { init_resource(); + init_work_lease_decl(); + init_types5(); init_effect_receipt(); init_receipt_store(); + init_gate_approval(); init_step_output_ref(); init_cron(); } @@ -240390,6 +245076,44 @@ var init_emulator_freshness = __esm({ } }); +// node_modules/@intentius/chant/src/lifecycle/lease.ts +var DEFAULT_LEASE_TTL_MS; +var init_lease = __esm({ + "node_modules/@intentius/chant/src/lifecycle/lease.ts"() { + init_git(); + init_member_ledger(); + DEFAULT_LEASE_TTL_MS = 5 * 6e4; + } +}); + +// node_modules/@intentius/chant/src/lifecycle/work-lease.ts +var DEFAULT_WORK_LEASE_TTL_MS; +var init_work_lease = __esm({ + "node_modules/@intentius/chant/src/lifecycle/work-lease.ts"() { + init_utils(); + init_runtime_adapter(); + init_lease(); + init_git(); + init_member_ledger(); + DEFAULT_WORK_LEASE_TTL_MS = 10 * 6e4; + } +}); + +// node_modules/@intentius/chant/src/op/work-lease-run.ts +var init_work_lease_run = __esm({ + "node_modules/@intentius/chant/src/op/work-lease-run.ts"() { + init_runtime_adapter(); + init_work_lease(); + init_member_ledger(); + init_lease(); + init_duration(); + init_step_output_ref(); + init_types5(); + init_types5(); + init_work_lease_decl(); + } +}); + // node_modules/@intentius/chant/src/op/composites/watch-op.ts var init_watch_op = __esm({ "node_modules/@intentius/chant/src/op/composites/watch-op.ts"() { @@ -240418,6 +245142,7 @@ var execAsync3; var init_apply2 = __esm({ "node_modules/@intentius/chant/src/op/activities/apply.ts"() { init_apply(); + init_lexicon_module(); execAsync3 = promisify5(exec4); } }); @@ -240442,6 +245167,7 @@ var init_converge_rule = __esm({ var init_converge_op = __esm({ "node_modules/@intentius/chant/src/op/composites/converge-op.ts"() { init_builders(); + init_step_output_ref(); init_converge_rule(); init_symptoms(); } @@ -240489,10 +245215,23 @@ var init_composites = __esm({ } }); +// node_modules/@intentius/chant/src/op/steward.ts +var init_steward = __esm({ + "node_modules/@intentius/chant/src/op/steward.ts"() { + init_step_output_ref(); + init_cron(); + init_work_lease_decl(); + } +}); + // node_modules/@intentius/chant/src/op/discover.ts var init_discover2 = __esm({ "node_modules/@intentius/chant/src/op/discover.ts"() { init_runtime_adapter(); + init_walk(); + init_files(); + init_config(); + init_steward(); } }); @@ -240500,6 +245239,7 @@ var init_discover2 = __esm({ var init_generate_pipeline = __esm({ "node_modules/@intentius/chant/src/op/generate-pipeline.ts"() { init_discover2(); + init_lexicon_module(); init_lexicon(); } }); @@ -240532,13 +245272,45 @@ var init_wait = __esm({ } }); +// node_modules/@intentius/chant/src/op/gate-wait.ts +var GATE_WAIT, GateWait; +var init_gate_wait = __esm({ + "node_modules/@intentius/chant/src/op/gate-wait.ts"() { + GATE_WAIT = /* @__PURE__ */ Symbol.for("chant.op.GateWait"); + GateWait = class extends Error { + constructor(pending2) { + super(`stopped at gate ${pending2.op} / ${pending2.gate}: approve it with \`chant approve ${pending2.op} ${pending2.gate}\` and run again`); + this.pending = pending2; + this.name = "GateWait"; + } + pending; + [GATE_WAIT] = true; + }; + } +}); + +// node_modules/@intentius/chant/src/op/run-live.ts +import { AsyncLocalStorage } from "node:async_hooks"; +import { execFile as execFile3 } from "node:child_process"; +import { promisify as promisify8 } from "node:util"; +var execFileAsync3, context; +var init_run_live = __esm({ + "node_modules/@intentius/chant/src/op/run-live.ts"() { + init_member_ledger(); + execFileAsync3 = promisify8(execFile3); + context = new AsyncLocalStorage(); + } +}); + // node_modules/@intentius/chant/src/op/activities/shell.ts import { exec as exec7 } from "node:child_process"; -import { promisify as promisify8 } from "node:util"; +import { promisify as promisify9 } from "node:util"; var execAsync6, MAX_STDOUT_BYTES; var init_shell2 = __esm({ "node_modules/@intentius/chant/src/op/activities/shell.ts"() { - execAsync6 = promisify8(exec7); + init_gate_wait(); + init_run_live(); + execAsync6 = promisify9(exec7); MAX_STDOUT_BYTES = 64 * 1024 * 1024; } }); @@ -240550,24 +245322,46 @@ var init_http_check = __esm({ } }); +// node_modules/@intentius/chant/src/op/source-archive.ts +var init_source_archive = __esm({ + "node_modules/@intentius/chant/src/op/source-archive.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/activities/source-release.ts +var init_source_release = __esm({ + "node_modules/@intentius/chant/src/op/activities/source-release.ts"() { + init_utils(); + init_source_archive(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/source-rollback.ts +var init_source_rollback = __esm({ + "node_modules/@intentius/chant/src/op/activities/source-rollback.ts"() { + init_source_archive(); + init_source_release(); + } +}); + // node_modules/@intentius/chant/src/op/activities/lifecycle.ts import { exec as exec8 } from "node:child_process"; -import { promisify as promisify9 } from "node:util"; +import { promisify as promisify10 } from "node:util"; var execAsync7; var init_lifecycle2 = __esm({ "node_modules/@intentius/chant/src/op/activities/lifecycle.ts"() { init_plan_digest(); - execAsync7 = promisify9(exec8); + execAsync7 = promisify10(exec8); } }); // node_modules/@intentius/chant/src/op/activities/teardown.ts import { exec as exec9 } from "node:child_process"; -import { promisify as promisify10 } from "node:util"; +import { promisify as promisify11 } from "node:util"; var execAsync8; var init_teardown2 = __esm({ "node_modules/@intentius/chant/src/op/activities/teardown.ts"() { - execAsync8 = promisify10(exec9); + execAsync8 = promisify11(exec9); } }); @@ -240584,7 +245378,7 @@ var init_env_teardown = __esm({ // node_modules/@intentius/chant/src/op/activities/reconcile.ts import { exec as exec10 } from "node:child_process"; import { readFile as readFile3 } from "node:fs/promises"; -import { promisify as promisify11 } from "node:util"; +import { promisify as promisify12 } from "node:util"; function reconcileBranchName(env2) { const safe = env2.replace(/[^a-zA-Z0-9._-]+/g, "-"); return `chant/reconcile-${safe}`; @@ -240962,7 +245756,7 @@ ${summary}`)}`, var execAsync9; var init_reconcile2 = __esm({ "node_modules/@intentius/chant/src/op/activities/reconcile.ts"() { - execAsync9 = promisify11(exec10); + execAsync9 = promisify12(exec10); } }); @@ -240987,6 +245781,12 @@ var init_guard_validate = __esm({ } }); +// node_modules/@intentius/chant/src/op/activities/work-evidence.ts +var init_work_evidence = __esm({ + "node_modules/@intentius/chant/src/op/activities/work-evidence.ts"() { + } +}); + // node_modules/@intentius/chant/src/op/activities/workflow-audit.ts var init_workflow_audit = __esm({ "node_modules/@intentius/chant/src/op/activities/workflow-audit.ts"() { @@ -241005,17 +245805,24 @@ var init_op_verb_class = __esm({ } }); +// node_modules/@intentius/chant/src/lifecycle/gate-origin.ts +var init_gate_origin = __esm({ + "node_modules/@intentius/chant/src/lifecycle/gate-origin.ts"() { + } +}); + // node_modules/@intentius/chant/src/lifecycle/gate-ledger.ts var init_gate_ledger = __esm({ "node_modules/@intentius/chant/src/lifecycle/gate-ledger.ts"() { init_utils(); + init_gate_origin(); init_git(); } }); // node_modules/@intentius/chant/src/op/activities/converge.ts import { exec as exec11 } from "node:child_process"; -import { promisify as promisify12 } from "node:util"; +import { promisify as promisify13 } from "node:util"; var execAsync10; var init_converge = __esm({ "node_modules/@intentius/chant/src/op/activities/converge.ts"() { @@ -241026,7 +245833,7 @@ var init_converge = __esm({ init_converge_ledger(); init_gate_ledger(); init_git(); - execAsync10 = promisify12(exec11); + execAsync10 = promisify13(exec11); } }); @@ -241038,13 +245845,13 @@ var init_version_bump = __esm({ // node_modules/@intentius/chant/src/op/activities/lexicon-upgrade.ts import { exec as exec12 } from "node:child_process"; -import { promisify as promisify13 } from "node:util"; +import { promisify as promisify14 } from "node:util"; var execAsync11; var init_lexicon_upgrade = __esm({ "node_modules/@intentius/chant/src/op/activities/lexicon-upgrade.ts"() { init_version_bump(); init_reconcile2(); - execAsync11 = promisify13(exec12); + execAsync11 = promisify14(exec12); } }); @@ -241063,9 +245870,9 @@ function sizeOf(props, sizeProp, sizeType) { if (sizeType === "number") { return typeof raw === "number" && Number.isFinite(raw) ? String(raw) : void 0; } - return isLiteral(raw) ? raw : void 0; + return isLiteral2(raw) ? raw : void 0; } -function isLiteral(raw) { +function isLiteral2(raw) { return typeof raw === "string" && raw.length > 0 && !raw.includes("${"); } function buildEngineRequest(options, kinds) { @@ -241083,7 +245890,7 @@ function buildEngineRequest(options, kinds) { continue; } const verdict = coverageFor(kinds, declared.entityType, declared.props); - const owner = ownerOf(kinds, declared.entityType); + const owner = ownerOf2(kinds, declared.entityType); const resolved = owner?.resolveType?.(declared.entityType, declared.props); const resourceType = resolved && resolved !== declared.entityType ? resolved : void 0; if (verdict.status !== "mapped") { @@ -241102,7 +245909,7 @@ function buildEngineRequest(options, kinds) { } const { mapping } = verdict; const declaredRegion = mapping.regionProp ? readPath(declared.props, mapping.regionProp) : void 0; - const region = isLiteral(declaredRegion) ? declaredRegion : options.region; + const region = isLiteral2(declaredRegion) ? declaredRegion : options.region; const size = sizeOf(declared.props, mapping.sizeProp, mapping.sizeType); nodes.push({ name, @@ -241158,7 +245965,7 @@ var init_behaviour_request = __esm({ }); // node_modules/@intentius/chant/src/behaviour-engine.ts -import { execFile as execFile2 } from "node:child_process"; +import { execFile as execFile4 } from "node:child_process"; function transportEngine(transport, endpoint) { return { async predict(request) { @@ -241184,8 +245991,8 @@ function commandTransport(endpoint) { return { async send(body) { const raw = await new Promise( - (resolve9) => { - const child = execFile2( + (resolve12) => { + const child = execFile4( program, args, { @@ -241196,7 +246003,7 @@ function commandTransport(endpoint) { env: behaviourEngineChildEnvironment() }, (error51, stdout, stderr) => { - resolve9({ stdout: String(stdout), stderr: String(stderr), ...error51 ? { error: error51 } : {} }); + resolve12({ stdout: String(stdout), stderr: String(stderr), ...error51 ? { error: error51 } : {} }); } ); child.stdin?.end(body); @@ -241478,8 +246285,8 @@ var init_behaviour_predict = __esm({ // node_modules/@intentius/chant/src/op/activities/predict-behaviour.ts import { exec as exec13 } from "node:child_process"; import { mkdtemp, rm } from "node:fs/promises"; -import { join as join13, resolve as resolve7 } from "node:path"; -import { promisify as promisify14 } from "node:util"; +import { join as join16, resolve as resolve9 } from "node:path"; +import { promisify as promisify15 } from "node:util"; function shellQuote2(s) { return `'${s.replace(/'/g, "'\\''")}'`; } @@ -241495,7 +246302,7 @@ async function predictDeclared(projectPath, args) { const lexicons = await resolveProjectLexicons2(projectPath); const plugins = await loadPlugins2(lexicons); const kinds = plugins.map((p) => p.behaviourKinds).filter((k) => k !== void 0); - const sourceDir = resolve7(projectPath, config2.sourceDir ?? "."); + const sourceDir = resolve9(projectPath, config2.sourceDir ?? "."); const result = await build4(sourceDir, plugins.map((p) => p.serializer)); if (result.errors.length > 0) { const messages = result.errors.map((e) => typeof e === "string" ? e : e.message ?? String(e)); @@ -241523,7 +246330,10 @@ async function predictDeclared(projectPath, args) { ...args.owned !== void 0 ? { owned: args.owned } : {}, traffic: args.traffic, edges, - edgeCoverage: declaredEdgeCoverage() + edgeCoverage: declaredEdgeCoverage(), + // This activity builds from `discover` + `build`, never from an account — + // it is the declared estate by construction, on whichever checkout it runs. + from: "declared" }; const answer = await createBehaviourPredict({ kinds })(options); return validateBehaviourResult(answer, options.entityNames); @@ -241561,7 +246371,7 @@ async function checkoutBase(base, signal) { } catch { commitish = base; } - const dir = await mkdtemp(join13(root, ".chant-behaviour-base-")); + const dir = await mkdtemp(join16(root, ".chant-behaviour-base-")); try { await execAsync12(`git worktree add --detach ${shellQuote2(dir)} ${shellQuote2(commitish)}`, { signal }); } catch (err) { @@ -241571,7 +246381,7 @@ async function checkoutBase(base, signal) { ); } return { - projectPath: prefix ? join13(dir, prefix) : dir, + projectPath: prefix ? join16(dir, prefix) : dir, async cleanup() { try { await execAsync12(`git worktree remove --force ${shellQuote2(dir)}`); @@ -241612,7 +246422,7 @@ function createBehaviourFinding(deps = {}) { ...args.region ? { region: args.region } : {}, ...args.owned !== void 0 ? { owned: args.owned } : {} }; - const headResult = await predict(resolve7("."), predictArgs); + const headResult = await predict(resolve9("."), predictArgs); const baseCheckout = await checkout(base, signal); let baseResult; try { @@ -241654,11 +246464,63 @@ var init_predict_behaviour = __esm({ init_behaviour_delta(); init_behaviour_predict(); init_reconcile2(); - execAsync12 = promisify14(exec13); + execAsync12 = promisify15(exec13); behaviourFinding = createBehaviourFinding(); } }); +// node_modules/@intentius/chant/src/op/activities/propose-upgrade.ts +import { execFile as execFile5 } from "node:child_process"; +import { promisify as promisify16 } from "node:util"; +var execFileAsync4; +var init_propose_upgrade = __esm({ + "node_modules/@intentius/chant/src/op/activities/propose-upgrade.ts"() { + execFileAsync4 = promisify16(execFile5); + } +}); + +// node_modules/@intentius/chant/src/op/activities/change-coverage.ts +var init_change_coverage = __esm({ + "node_modules/@intentius/chant/src/op/activities/change-coverage.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/steward-turn.ts +var init_steward_turn = __esm({ + "node_modules/@intentius/chant/src/op/steward-turn.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/steward-points.ts +var POINT_WAIT, PointWait; +var init_steward_points = __esm({ + "node_modules/@intentius/chant/src/op/steward-points.ts"() { + init_steward_turn(); + POINT_WAIT = /* @__PURE__ */ Symbol.for("chant.op.PointWait"); + PointWait = class extends Error { + constructor(question) { + super( + `waiting on decision point ${question.point} (${question.id}, ${question.state}): a person answers it through hud or \`chant workspace points answer ${question.id}\`` + ); + this.question = question; + this.name = "PointWait"; + } + question; + [POINT_WAIT] = true; + }; + } +}); + +// node_modules/@intentius/chant/src/op/activities/decide.ts +var init_decide = __esm({ + "node_modules/@intentius/chant/src/op/activities/decide.ts"() { + init_config(); + init_steward_points(); + init_steward_turn(); + init_decide_config(); + } +}); + // node_modules/@intentius/chant/src/op/activities/index.ts var init_activities = __esm({ "node_modules/@intentius/chant/src/op/activities/index.ts"() { @@ -241666,6 +246528,8 @@ var init_activities = __esm({ init_wait(); init_shell2(); init_http_check(); + init_source_release(); + init_source_rollback(); init_lifecycle2(); init_teardown2(); init_env_teardown(); @@ -241673,11 +246537,15 @@ var init_activities = __esm({ init_apply2(); init_policy2(); init_guard_validate(); + init_work_evidence(); init_workflow_audit(); init_pipeline_audit(); init_converge(); init_lexicon_upgrade(); init_predict_behaviour(); + init_propose_upgrade(); + init_change_coverage(); + init_decide(); } }); @@ -241686,15 +246554,17 @@ var init_activity_registry = __esm({ "node_modules/@intentius/chant/src/op/activity-registry.ts"() { init_activities(); init_activity_profiles(); + init_lexicon_module(); } }); // node_modules/@intentius/chant/src/op/activities/activity-contracts.ts -var lifecycleSnapshotContract, lifecycleDiffContract, shellCmdContract, httpCheckContract, chantTeardownContract, predictBehaviourContract, behaviourFindingContract; +var lifecycleSnapshotContract, lifecycleDiffContract, shellCmdContract, httpCheckContract, chantTeardownContract, predictBehaviourContract, behaviourFindingContract, proposeWorkspaceUpgradeContract, changeCoverageContract, workEvidenceContract, sourceArchiveContract, releasePlanContract, releaseRecordContract, decideEscalation, decideContract, releaseRollbackPlanContract, releaseRollbackRecordContract; var init_activity_contracts = __esm({ "node_modules/@intentius/chant/src/op/activities/activity-contracts.ts"() { init_zod(); init_activity_contract(); + init_decide_config(); lifecycleSnapshotContract = activityContract( "lifecycleSnapshot", external_exports.strictObject({ env: external_exports.string() }) @@ -241710,9 +246580,15 @@ var init_activity_contracts = __esm({ cmd: external_exports.string(), env: external_exports.record(external_exports.string(), external_exports.string()).optional(), cwd: external_exports.string().optional(), - okExit: external_exports.array(external_exports.number()).optional() + okExit: external_exports.array(external_exports.number()).optional(), + gatedExit: external_exports.number().optional(), + gate: external_exports.strictObject({ op: external_exports.string(), gate: external_exports.string() }).optional(), + json: external_exports.boolean().optional() }), - external_exports.object({ stdout: external_exports.string(), stderr: external_exports.string(), exitCode: external_exports.number() }) + // `json` is stdout parsed, when the step sets `json` (#2787): whatever the + // command printed, so its shape is the author's and only the whole value is + // a reference target (`sh.out.json`). + external_exports.object({ stdout: external_exports.string(), stderr: external_exports.string(), exitCode: external_exports.number(), json: external_exports.unknown().optional() }) ); httpCheckContract = activityContract( "httpCheck", @@ -241770,6 +246646,180 @@ var init_activity_contracts = __esm({ mergeRequest: external_exports.string().optional() }) ); + proposeWorkspaceUpgradeContract = activityContract( + "proposeWorkspaceUpgrade", + external_exports.strictObject({ + scope: external_exports.string().optional(), + to: external_exports.string().optional(), + mode: external_exports.enum(["report", "branch", "pull-request"]).optional(), + branch: external_exports.string().optional(), + base: external_exports.string().optional(), + remote: external_exports.string().optional(), + allowCode: external_exports.boolean().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ + scope: external_exports.string(), + mode: external_exports.enum(["report", "branch", "pull-request"]), + changed: external_exports.boolean(), + proposed: external_exports.boolean(), + checksOk: external_exports.boolean(), + from: external_exports.string().nullable(), + to: external_exports.string().nullable(), + digest: external_exports.string(), + manualSteps: external_exports.number(), + governance: external_exports.boolean(), + branch: external_exports.string().optional(), + commit: external_exports.string().optional(), + pushed: external_exports.boolean().optional(), + prUrl: external_exports.string().optional(), + summary: external_exports.string() + }) + ); + changeCoverageContract = activityContract( + "changeCoverage", + external_exports.strictObject({ + cwd: external_exports.string().optional(), + range: external_exports.string().optional(), + work: external_exports.string().optional(), + severity: external_exports.enum(["off", "warn", "fail"]).optional() + }), + external_exports.object({ + ok: external_exports.boolean(), + range: external_exports.object({ spec: external_exports.string(), base: external_exports.string(), head: external_exports.string() }), + work: external_exports.string().nullable(), + severity: external_exports.enum(["off", "warn", "fail"]), + findings: external_exports.array( + external_exports.object({ + code: external_exports.enum(["change-uncovered", "change-out-of-scope"]), + path: external_exports.string(), + message: external_exports.string(), + severity: external_exports.enum(["warn", "fail"]), + records: external_exports.array(external_exports.string()), + triage: external_exports.object({ finding: external_exports.enum(["change-uncovered", "change-out-of-scope"]), region: external_exports.string() }) + }) + ), + summary: external_exports.object({ + paths: external_exports.number(), + covered: external_exports.number(), + uncovered: external_exports.number(), + outOfScope: external_exports.number(), + ignored: external_exports.number(), + records: external_exports.number() + }) + }) + ); + workEvidenceContract = activityContract( + "workEvidence", + external_exports.strictObject({ + lease: external_exports.unknown(), + criterion: external_exports.string(), + result: external_exports.enum(["pass", "fail"]), + title: external_exports.string(), + url: external_exports.string().optional(), + path: external_exports.string().optional(), + kind: external_exports.string().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ + item: external_exports.string(), + path: external_exports.string(), + evidence: external_exports.record(external_exports.string(), external_exports.unknown()), + acceptance: external_exports.object({ met: external_exports.number(), total: external_exports.number(), criteria: external_exports.array(external_exports.object({ id: external_exports.string(), verification: external_exports.string(), met: external_exports.boolean() })) }) + }) + ); + sourceArchiveContract = activityContract( + "sourceArchive", + external_exports.strictObject({ path: external_exports.string(), ref: external_exports.string().optional(), out: external_exports.string().optional(), cwd: external_exports.string().optional() }), + external_exports.object({ digest: external_exports.string(), archive: external_exports.string(), commit: external_exports.string(), dir: external_exports.string(), files: external_exports.number(), bytes: external_exports.number() }) + ); + releasePlanContract = activityContract( + "releasePlan", + external_exports.strictObject({ + component: external_exports.string(), + env: external_exports.string(), + gitSha: external_exports.string(), + content: external_exports.record(external_exports.string(), external_exports.unknown()), + dir: external_exports.string().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ digest: external_exports.string(), file: external_exports.string(), gitSha: external_exports.string() }) + ); + releaseRecordContract = activityContract( + "releaseRecord", + external_exports.strictObject({ + plan: external_exports.string(), + digest: external_exports.string().optional(), + approval: external_exports.strictObject({ op: external_exports.string(), gate: external_exports.string() }).optional(), + actor: external_exports.string().optional(), + runId: external_exports.string().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ recorded: external_exports.boolean(), digest: external_exports.string(), env: external_exports.string(), component: external_exports.string(), approver: external_exports.string().nullable() }) + ); + decideEscalation = external_exports.object({ kind: external_exports.enum(["table", "model"]), reason: external_exports.string() }).loose(); + decideContract = activityContract( + "decide", + external_exports.strictObject({ + point: external_exports.string().min(1), + inputs: external_exports.record(external_exports.string(), external_exports.unknown()).optional(), + read: external_exports.record(external_exports.string(), external_exports.string()).optional(), + subject: external_exports.string().optional(), + kind: external_exports.string().optional(), + cwd: external_exports.string().optional(), + backends: external_exports.record(external_exports.string(), backendSchema).optional(), + dryRun: external_exports.boolean().optional() + }), + external_exports.strictObject({ + id: external_exports.string(), + path: external_exports.string(), + state: external_exports.enum(["escalated", "proposed", "answered"]), + open: external_exports.boolean(), + answer: external_exports.union([external_exports.string(), external_exports.boolean(), external_exports.null()]), + decider: external_exports.string(), + model: external_exports.string().nullable(), + backend: external_exports.string().nullable(), + confidence: external_exports.number().nullable(), + threshold: external_exports.number().nullable(), + answeredBy: external_exports.array(external_exports.string()), + escalations: external_exports.array(decideEscalation), + missing: external_exports.array(external_exports.string()) + }), + { entities: ["point"] } + ); + releaseRollbackPlanContract = activityContract( + "releaseRollbackPlan", + external_exports.strictObject({ + component: external_exports.string(), + env: external_exports.string(), + to: external_exports.string().optional(), + path: external_exports.string().optional(), + dir: external_exports.string().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ + digest: external_exports.string(), + file: external_exports.string(), + to: external_exports.string(), + from: external_exports.string(), + gitSha: external_exports.string(), + archive: external_exports.string(), + archiveDigest: external_exports.string(), + dir: external_exports.string() + }) + ); + releaseRollbackRecordContract = activityContract( + "releaseRollbackRecord", + external_exports.strictObject({ + plan: external_exports.string(), + digest: external_exports.string().optional(), + approval: external_exports.strictObject({ op: external_exports.string(), gate: external_exports.string() }).optional(), + actor: external_exports.string().optional(), + runId: external_exports.string().optional(), + cwd: external_exports.string().optional() + }), + external_exports.object({ recorded: external_exports.boolean(), digest: external_exports.string(), env: external_exports.string(), component: external_exports.string(), approver: external_exports.string().nullable() }) + ); } }); @@ -241778,12 +246828,7 @@ var init_activity_contract_registry = __esm({ "node_modules/@intentius/chant/src/op/activity-contract-registry.ts"() { init_activity_contracts(); init_activity_contract(); - } -}); - -// node_modules/@intentius/chant/src/op/duration.ts -var init_duration = __esm({ - "node_modules/@intentius/chant/src/op/duration.ts"() { + init_lexicon_module(); } }); @@ -241793,6 +246838,8 @@ var init_gate = __esm({ "node_modules/@intentius/chant/src/op/gate.ts"() { init_gate_ledger(); init_plan_digest(); + init_gate_origin(); + init_utils(); init_git(); init_duration(); EPOCH = (/* @__PURE__ */ new Date(0)).toISOString(); @@ -241807,8 +246854,16 @@ var init_local_executor = __esm({ init_activity_registry(); init_step_output_ref(); init_duration(); + init_activity_profiles(); init_gate(); init_gate_name(); + init_steward_points(); + init_gate_wait(); + init_steward_turn(); + init_run_ledger(); + init_work_lease_run(); + init_types5(); + init_run_live(); init_run_ledger(); init_duration(); FALLBACK_TIMEOUT_MS = 5 * 6e4; @@ -241828,6 +246883,9 @@ var init_discover3 = __esm({ init_component(); init_build_params(); init_params(); + init_files(); + init_config(); + init_walk(); } }); @@ -241837,12 +246895,20 @@ var init_topo_sort = __esm({ } }); +// node_modules/@intentius/chant/src/components/gate-plan.ts +var init_gate_plan = __esm({ + "node_modules/@intentius/chant/src/components/gate-plan.ts"() { + init_plan_digest(); + } +}); + // node_modules/@intentius/chant/src/components/driver.ts var init_driver2 = __esm({ "node_modules/@intentius/chant/src/components/driver.ts"() { init_topo_sort(); init_gate(); init_gate_name(); + init_gate_plan(); } }); @@ -241850,6 +246916,7 @@ var init_driver2 = __esm({ var init_capability_plugin_loader = __esm({ "node_modules/@intentius/chant/src/components/capability-plugin-loader.ts"() { init_capability(); + init_lexicon_module(); init_capability_plugin(); init_starter_plugin(); } @@ -241865,6 +246932,7 @@ var init_config_defaults = __esm({ // node_modules/@intentius/chant/src/components/cli-support.ts var init_cli_support = __esm({ "node_modules/@intentius/chant/src/components/cli-support.ts"() { + init_lexicon_module(); init_discover3(); init_component(); init_driver2(); @@ -241885,6 +246953,7 @@ var init_runtime2 = __esm({ // node_modules/@intentius/chant/src/op/runtimes/local.ts var init_local = __esm({ "node_modules/@intentius/chant/src/op/runtimes/local.ts"() { + init_lexicon_module(); init_config(); init_activity_registry(); init_local_executor(); @@ -241910,12 +246979,13 @@ var init_local_output = __esm({ } }); -// node_modules/@intentius/chant/src/lifecycle/lease.ts -var DEFAULT_LEASE_TTL_MS; -var init_lease = __esm({ - "node_modules/@intentius/chant/src/lifecycle/lease.ts"() { - init_git(); - DEFAULT_LEASE_TTL_MS = 5 * 6e4; +// node_modules/@intentius/chant/src/op/steward-beside.ts +var init_steward_beside = __esm({ + "node_modules/@intentius/chant/src/op/steward-beside.ts"() { + init_local_executor(); + init_duration(); + init_lease(); + init_steward(); } }); @@ -241931,6 +247001,12 @@ var init_operator = __esm({ init_discover2(); init_local_executor(); init_lease(); + init_run_ledger(); + init_gate_ledger(); + init_steward_turn(); + init_steward(); + init_steward_beside(); + init_work_lease_run(); init_git(); init_cron(); init_change_signal(); @@ -241946,8 +247022,10 @@ var init_op = __esm({ init_emulator_lifecycle(); init_emulator_freshness(); init_types5(); + init_work_lease_run(); init_cron(); init_composites(); + init_symptoms(); init_receipt_store(); init_discover2(); init_generate_pipeline(); @@ -241957,6 +247035,8 @@ var init_op = __esm({ init_activity_failure(); init_local_executor(); init_gate(); + init_gate(); + init_gate_approval(); init_plan_digest(); init_gate_name(); init_local(); @@ -241967,6 +247047,13 @@ var init_op = __esm({ init_step_output_ref(); init_converge_rule(); init_operator(); + init_steward_beside(); + init_steward(); + init_discover2(); + init_steward_points(); + init_gate_wait(); + init_steward_turn(); + init_run_live(); init_change_signal(); init_op_verb_class(); init_builders(); @@ -242096,7 +247183,8 @@ var init_command_group = __esm({ "emulator", "serve", "operator", - "approve" + "approve", + "workspace" ]); } }); @@ -242176,6 +247264,13 @@ function checkConflicts(plugins) { } return { conflicts, warnings }; } +function describeConflict(c) { + const line = ` ${c.type} "${c.key}" from: ${c.plugins.join(", ")}`; + if (c.type === "command-group-name" && RESERVED_COMMAND_NAMES.has(c.key)) { + return `${line} \u2014 "${c.key}" is a reserved chant command name, so no lexicon can register a command group with it. Rename the group.`; + } + return line; +} var init_conflict_check = __esm({ "node_modules/@intentius/chant/src/cli/conflict-check.ts"() { init_command_group(); @@ -242187,17 +247282,41 @@ var plugins_exports = {}; __export(plugins_exports, { collectBuildRootContributors: () => collectBuildRootContributors, collectChangeSubscribers: () => collectChangeSubscribers, + listInstalledLexicons: () => listInstalledLexicons, loadPlugin: () => loadPlugin, loadPlugins: () => loadPlugins, + recordProjectLexicons: () => recordProjectLexicons, resolveLexiconVersions: () => resolveLexiconVersions, - resolveProjectLexicons: () => resolveProjectLexicons + resolveProjectLexicons: () => resolveProjectLexicons, + unknownPathLexiconsNotice: () => unknownPathLexiconsNotice }); -import { createRequire as createRequire4 } from "node:module"; -import { dirname as dirname13, join as join14 } from "node:path"; -import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs"; +import { createRequire as createRequire7 } from "node:module"; +import { dirname as dirname15, join as join17, resolve as resolve10 } from "node:path"; +import { fileURLToPath as fileURLToPath4 } from "node:url"; +import { existsSync as existsSync10, readdirSync as readdirSync3, readFileSync as readFileSync11 } from "node:fs"; +function recordProjectLexicons(dir) { + const read = readLexiconDeclarationsStatically(dir); + if (read.status === "read") registerLexiconDeclarations(read.entries, dirname15(read.configPath)); + return read; +} async function loadPlugin(lexiconName) { + const modulePath = lexiconModulePath(lexiconName); + if (modulePath !== void 0) { + const mod2 = await importLexiconModule(lexiconName); + for (const value of Object.values(mod2)) { + if (isLexiconPlugin(value)) { + if (value.name !== lexiconName) { + throw new Error( + `lexicon "${lexiconName}" is declared with module ${modulePath}, but the plugin it exports is named "${value.name}"` + ); + } + return value; + } + } + throw new Error(`Module ${modulePath} (lexicon "${lexiconName}") does not export a LexiconPlugin`); + } const packageName = `@intentius/chant-lexicon-${lexiconName}`; - const mod = await import(packageName); + const mod = await importLexiconPackage(packageName); for (const value of Object.values(mod)) { if (isLexiconPlugin(value)) { return value; @@ -242219,23 +247338,56 @@ async function loadPlugin(lexiconName) { } throw new Error(`Package ${packageName} does not export a LexiconPlugin or Serializer`); } -function resolveLexiconVersions(lexiconNames) { - const require_ = createRequire4(import.meta.url); +function listInstalledLexicons(projectDir = process.cwd()) { + const names = /* @__PURE__ */ new Set(); + const starts = [dirname15(fileURLToPath4(import.meta.url)), resolve10(projectDir)]; + for (const start of starts) { + let dir = start; + for (; ; ) { + const scope = join17(dir, "node_modules", "@intentius"); + let entries = []; + try { + entries = readdirSync3(scope, { withFileTypes: true }); + } catch { + } + for (const entry of entries) { + if (!entry.name.startsWith(LEXICON_PACKAGE_PREFIX)) continue; + if (!entry.isDirectory() && !entry.isSymbolicLink()) continue; + const name = entry.name.slice(LEXICON_PACKAGE_PREFIX.length); + if (name !== "") names.add(name); + } + const parent = dirname15(dir); + if (parent === dir) break; + dir = parent; + } + } + return [...names].sort(); +} +function resolveLexiconVersions(lexiconNames2) { + const require_ = createRequire7(import.meta.url); const versions = {}; - for (const name of lexiconNames) { + for (const name of lexiconNames2) { + if (lexiconModulePath(name) !== void 0) continue; const packageName = `@intentius/chant-lexicon-${name}`; try { - let dir = dirname13(require_.resolve(packageName)); + let entry; + try { + entry = require_.resolve(packageName); + } catch (err) { + entry = resolveFromProject(packageName); + if (entry === void 0) throw err; + } + let dir = dirname15(entry); for (let depth = 0; depth < 10; depth++) { - const candidate = join14(dir, "package.json"); - if (existsSync8(candidate)) { - const pkg = JSON.parse(readFileSync7(candidate, "utf-8")); + const candidate = join17(dir, "package.json"); + if (existsSync10(candidate)) { + const pkg = JSON.parse(readFileSync11(candidate, "utf-8")); if (pkg.name === packageName && pkg.version) { versions[name] = pkg.version; break; } } - const parent = dirname13(dir); + const parent = dirname15(dir); if (parent === dir) break; dir = parent; } @@ -242260,9 +247412,9 @@ function collectChangeSubscribers(plugins, options) { }) })); } -async function loadPlugins(lexiconNames) { +async function loadPlugins(lexiconNames2) { const plugins = []; - for (const name of lexiconNames) { + for (const name of lexiconNames2) { const plugin = await loadPlugin(name); if (plugin.init) { await plugin.init(); @@ -242276,7 +247428,7 @@ async function loadPlugins(lexiconNames) { ); } if (report2.conflicts.length > 0) { - const details = report2.conflicts.map((c) => ` ${c.type} "${c.key}" from: ${c.plugins.join(", ")}`).join("\n"); + const details = report2.conflicts.map(describeConflict).join("\n"); throw new Error( `Cross-lexicon conflicts detected: ${details}` @@ -242287,17 +247439,22 @@ ${details}` async function resolveProjectLexicons(projectPath) { const { config: config2 } = await loadChantConfigUpward(projectPath); if (config2.lexicons && config2.lexicons.length > 0) { - return config2.lexicons; + return lexiconNames(config2.lexicons); } const files = await findInfraFiles(projectPath); return detectLexicons(files); } +var LEXICON_PACKAGE_PREFIX; var init_plugins = __esm({ "node_modules/@intentius/chant/src/cli/plugins.ts"() { + init_lexicon_module(); + init_config_static(); + init_config_static(); init_lexicon(); init_config(); init_src(); init_conflict_check(); + LEXICON_PACKAGE_PREFIX = "chant-lexicon-"; } }); @@ -242305,6 +247462,7 @@ var init_plugins = __esm({ var discover_exports = {}; __export(discover_exports, { AUDIT_LEXICONS: () => AUDIT_LEXICONS, + DEFAULT_MAX_WALK_FILES: () => DEFAULT_MAX_WALK_FILES, ciLexiconForPath: () => ciLexiconForPath, classifyFiles: () => classifyFiles, collectCandidates: () => collectCandidates, @@ -242312,10 +247470,11 @@ __export(discover_exports, { hintLexiconForFile: () => hintLexiconForFile, isCandidatePath: () => isCandidatePath, loadAuditPlugins: () => loadAuditPlugins, - unclaimedFiles: () => unclaimedFiles + unclaimedFiles: () => unclaimedFiles, + walkCandidates: () => walkCandidates }); -import { readdirSync, readFileSync as readFileSync8, statSync as statSync3 } from "fs"; -import { basename as basename4, join as join15, relative as relative6, resolve as resolve8 } from "path"; +import { readFileSync as readFileSync12, statSync as statSync5 } from "fs"; +import { basename as basename4, join as join18, relative as relative7, resolve as resolve11 } from "path"; async function loadAuditPlugins(names = AUDIT_LEXICONS) { const { loadPlugin: loadPlugin2 } = await Promise.resolve().then(() => (init_plugins(), plugins_exports)); const plugins = []; @@ -242327,30 +247486,37 @@ async function loadAuditPlugins(names = AUDIT_LEXICONS) { } return plugins; } -function walkFiles(dir, out) { - if (out.length >= MAX_WALK_FILES) return; - let entries; +function auditGlobs(root) { + const { dir, configPath } = findProjectConfig(root); + if (!configPath?.endsWith(".json")) return void 0; + let raw; try { - entries = readdirSync(dir, { withFileTypes: true }); + raw = JSON.parse(readFileSync12(configPath, "utf-8")); } catch { - return; - } - for (const e of entries.sort((a, b) => a.name < b.name ? -1 : 1)) { - if (out.length >= MAX_WALK_FILES) return; - if (e.name.startsWith(".") && e.isDirectory() && !WALK_DOT_DIRS.has(e.name)) { - if (e.name === TERRAFORM_WORK_DIR) out.push(join15(dir, e.name)); - continue; - } - if (WALK_SKIP.has(e.name)) continue; - const full = join15(dir, e.name); - if (e.isDirectory()) walkFiles(full, out); - else out.push(full); + return void 0; } + const list = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : []; + const exclude = list(raw?.exclude); + const include = list(raw?.include); + return exclude.length === 0 && include.length === 0 ? void 0 : { root: dir, exclude, include }; +} +function walkFiles(root, state, excludeDirs) { + return walkDiscovery({ + walker: "audit", + root, + excludeDirs, + globs: auditGlobs(root), + sorted: true, + limit: state, + takeSkippedDir: (name) => name === TERRAFORM_WORK_DIR, + keepIgnored: (full) => isTerraformStatePath(relative7(root, full)), + accept: () => true + }); } function readSafe(full) { try { - if (statSync3(full).size > MAX_FILE_BYTES) return void 0; - return readFileSync8(full, "utf-8"); + if (statSync5(full).size > MAX_FILE_BYTES) return void 0; + return readFileSync12(full, "utf-8"); } catch { return void 0; } @@ -242536,14 +247702,14 @@ ${bundle[name]}`).join("\n"); content, lexicon: "terraform", files: bundle, - ...baseDir === void 0 ? {} : { dir: resolve8(baseDir, dir), baseDir } + ...baseDir === void 0 ? {} : { dir: resolve11(baseDir, dir), baseDir } }); } return { inputs, claimed }; } function classifyFiles(files, plugins, opts = {}) { const byName = new Map(plugins.map((p) => [p.name, p])); - const baseDir = opts.baseDir === void 0 ? void 0 : resolve8(opts.baseDir); + const baseDir = opts.baseDir === void 0 ? void 0 : resolve11(opts.baseDir); const helm = classifyHelm(files, byName.get("helm")); const underChart = (p) => helm.prefixes.some((pre) => pre === "" ? true : p.startsWith(pre)); const terraform = classifyTerraform(files, byName.get("terraform"), baseDir); @@ -242577,14 +247743,23 @@ function discoverByDetection(root, plugins) { return classifyFiles(collectCandidates(root), plugins, { baseDir: root }); } function collectCandidates(root) { - const all = []; - walkFiles(root, all); - const gitignore = readSafe(join15(root, ".gitignore")) ?? ""; + return walkCandidates(root).files; +} +function walkCandidates(root, opts = {}) { + const state = { max: opts.maxFiles ?? DEFAULT_MAX_WALK_FILES, truncated: false }; + const all = walkFiles(root, state, opts.excludeDirs); + const gitignore = readSafe(join18(root, ".gitignore")) ?? ""; + const nestedBodies = /* @__PURE__ */ new Map(); + const nestedGitignoreAt = (dir) => { + if (!nestedBodies.has(dir)) nestedBodies.set(dir, readSafe(join18(root, dir, ".gitignore"))); + return nestedBodies.get(dir); + }; const files = []; for (const full of all) { - const path = relative6(root, full); + const path = relative7(root, full); if (isTerraformStatePath(path)) { - if (!gitignoreCoversTerraformState(gitignore, path)) files.push({ path, content: "" }); + const ignored = gitignoreCoversTerraformState(gitignore, path) || nestedGitignoreCovering(path, nestedGitignoreAt) !== void 0; + if (!ignored) files.push({ path, content: "" }); continue; } if (isTerraformFileName(basename4(path))) { @@ -242596,19 +247771,19 @@ function collectCandidates(root) { const content = readSafe(full); if (content !== void 0) files.push({ path, content }); } - return files; + return { files, maxFiles: state.max, truncated: state.truncated }; } -var AUDIT_LEXICONS, WALK_SKIP, TERRAFORM_WORK_DIR, WALK_DOT_DIRS, MAX_WALK_FILES, MAX_FILE_BYTES, CONTENT_DETECTORS, LOCAL_MODULE_SOURCE; +var AUDIT_LEXICONS, TERRAFORM_WORK_DIR, DEFAULT_MAX_WALK_FILES, MAX_FILE_BYTES, CONTENT_DETECTORS, LOCAL_MODULE_SOURCE; var init_discover4 = __esm({ "node_modules/@intentius/chant/src/audit/discover.ts"() { init_yaml(); init_nginx(); + init_walk(); + init_project_root(); init_terraform_state(); AUDIT_LEXICONS = ["github", "gitlab", "forgejo", "k8s", "docker", "aws", "azure", "gcp", "helm", "fountain", "terraform"]; - WALK_SKIP = /* @__PURE__ */ new Set(["node_modules", ".git", "dist"]); TERRAFORM_WORK_DIR = ".terraform"; - WALK_DOT_DIRS = /* @__PURE__ */ new Set([".github", ".forgejo"]); - MAX_WALK_FILES = 1e3; + DEFAULT_MAX_WALK_FILES = 1e3; MAX_FILE_BYTES = 2 * 1024 * 1024; CONTENT_DETECTORS = [ { @@ -243064,10 +248239,19 @@ async function load(names) { const { loadPlugins: loadPlugins2 } = await Promise.resolve().then(() => (init_plugins(), plugins_exports)); return await loadPlugins2(names); } catch (err) { - const pkgs = names.map((n) => `@intentius/chant-lexicon-${n}`).join(" "); + const detail = err instanceof Error ? err.message : String(err); + const pkgs = lexiconPackagesToInstall(names); + const paths = names.filter((n) => lexiconModulePath(n) !== void 0).map((n) => lexiconSourceLabel(n)); + if (pkgs.length === 0) { + throw new MissingLexiconError( + `Could not load the lexicon module ${paths.join(", ")} needed to audit ${names.join("/")} workflows. +(${detail})` + ); + } + const fromPath = paths.length > 0 ? ` The lexicon module ${paths.join(", ")} is declared by path and has nothing to install.` : ""; throw new MissingLexiconError( - `Missing lexicon package needed to audit ${names.join("/")} workflows. Install it with: npm i ${pkgs} -(${err instanceof Error ? err.message : String(err)})` + `Missing lexicon package needed to audit ${names.join("/")} workflows. Install it with: npm i ${pkgs.join(" ")}${fromPath} +(${detail})` ); } } @@ -243193,6 +248377,7 @@ var checksCache, entitiesParserCache, MissingLexiconError, CROSS_FILE; var init_core4 = __esm({ "node_modules/@intentius/chant/src/audit/core.ts"() { init_suppressions(); + init_lexicon_module(); checksCache = /* @__PURE__ */ new Map(); entitiesParserCache = /* @__PURE__ */ new Map(); MissingLexiconError = class extends Error { @@ -243359,14 +248544,14 @@ function diffOps(a, b) { while (j < m) ops.push({ type: "add", line: b[j++] }); return ops; } -function unifiedDiff(oldStr, newStr, context = 3) { +function unifiedDiff(oldStr, newStr, context2 = 3) { const a = oldStr.split("\n"); const b = newStr.split("\n"); const ops = diffOps(a, b); const keep = new Array(ops.length).fill(false); for (let k2 = 0; k2 < ops.length; k2++) { if (ops[k2].type !== "eq") { - for (let d = -context; d <= context; d++) { + for (let d = -context2; d <= context2; d++) { const idx = k2 + d; if (idx >= 0 && idx < ops.length) keep[idx] = true; } @@ -245231,7 +250416,7 @@ var init_gha046 = __esm({ }); // node_modules/@intentius/chant-lexicon-github/src/lint/post-synth/gha047.ts -function isLiteral2(arg) { +function isLiteral3(arg) { const t = arg.trim(); return t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"'); } @@ -245251,7 +250436,7 @@ var init_gha047 = __esm({ let m; REVERSED_CONTAINS.lastIndex = 0; while ((m = REVERSED_CONTAINS.exec(expr)) !== null) { - if (isLiteral2(m[2])) continue; + if (isLiteral3(m[2])) continue; diagnostics.push({ checkId: "GHA047", severity: "warning", @@ -246544,8 +251729,8 @@ var init_engine = __esm({ }); // src/cli.ts -import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs"; -import { pathToFileURL } from "node:url"; +import { existsSync as existsSync11, readFileSync as readFileSync13, writeFileSync as writeFileSync4 } from "node:fs"; +import { pathToFileURL as pathToFileURL2 } from "node:url"; // package.json var package_default = { @@ -246585,8 +251770,8 @@ var package_default = { prepublishOnly: "npm run build" }, dependencies: { - "@intentius/chant": "^0.72.1", - "@intentius/chant-lexicon-github": "^0.72.1" + "@intentius/chant": "^0.100.0", + "@intentius/chant-lexicon-github": "^0.100.0" }, devDependencies: { "@types/libsodium-wrappers": "^0.7.14", @@ -248763,6 +253948,174 @@ function complianceArtifact(report2) { `; } +// src/workspace/members.ts +import { execFile } from "node:child_process"; +import { existsSync } from "node:fs"; +import { createRequire } from "node:module"; +import { dirname, join } from "node:path"; +var READ_CONTRACT = 1; +var WorkspaceReadError = class extends Error { + constructor(message) { + super(`[workspace] ${message}`); + this.name = "WorkspaceReadError"; + } +}; +var defaultRunner = (cmd, args, cwd) => new Promise((resolve12, reject) => { + execFile(cmd, args, { cwd, maxBuffer: 64 * 1024 * 1024 }, (err, stdout, stderr) => { + if (err && err.code === "ENOENT") { + reject(err); + return; + } + const code = err ? err.code : 0; + resolve12({ stdout, stderr, code: typeof code === "number" ? code : 1 }); + }); +}); +function parseLsDocument(stdout) { + let doc; + try { + doc = JSON.parse(stdout); + } catch { + throw new WorkspaceReadError("`chant workspace ls --json` did not print JSON"); + } + if (doc === null || typeof doc !== "object" || Array.isArray(doc)) { + throw new WorkspaceReadError("`chant workspace ls --json` did not print an object"); + } + const d = doc; + if (d["contract"] !== READ_CONTRACT) { + throw new WorkspaceReadError( + `read contract ${String(d["contract"])} is not supported, this warden reads contract ${READ_CONTRACT}` + ); + } + if (d["error"] && typeof d["error"] === "object") { + const e = d["error"]; + throw new WorkspaceReadError(`chant could not read the workspace: ${String(e.code)}: ${String(e.message)}`); + } + const ws = d["workspace"]; + if (!ws || typeof ws["name"] !== "string" || typeof ws["root"] !== "string" || !Array.isArray(d["members"])) { + throw new WorkspaceReadError("`chant workspace ls --json` document lacks workspace or members"); + } + const members = d["members"].map((m, i) => { + const o = m; + if (!o || typeof o["name"] !== "string" || typeof o["dir"] !== "string") { + throw new WorkspaceReadError(`members[${i}] lacks a name or a dir`); + } + return { + name: o["name"], + dir: o["dir"], + kind: typeof o["kind"] === "string" ? o["kind"] : "other", + readable: o["readable"] !== false, + reason: typeof o["reason"] === "string" ? o["reason"] : null + }; + }); + return { + name: ws["name"], + root: ws["root"], + chant: typeof d["chant"] === "string" ? d["chant"] : "unknown", + members + }; +} +function chantLauncher() { + try { + let dir = dirname(createRequire(import.meta.url).resolve("@intentius/chant")); + for (let i = 0; i < 6; i++, dir = dirname(dir)) { + const bin = join(dir, "bin", "chant"); + if (existsSync(join(dir, "package.json")) && existsSync(bin)) return bin; + } + } catch { + } + return null; +} +async function readWorkspace(dir, run4 = defaultRunner) { + let result; + try { + result = await run4(chantLauncher() ?? "chant", ["workspace", "ls", "--json"], dir); + } catch (err) { + throw new WorkspaceReadError(`could not run chant: ${err instanceof Error ? err.message : String(err)}`); + } + if (result.stdout.trim() === "") { + throw new WorkspaceReadError( + `\`chant workspace ls --json\` printed nothing (exit ${result.code}); chant 0.81.0 or newer is required. ${result.stderr.trim()}`.trim() + ); + } + return parseLsDocument(result.stdout); +} + +// src/workspace/codeowners.ts +var OwnersConfigError = class extends Error { + constructor(message) { + super(`[codeowners] ${message}`); + this.name = "OwnersConfigError"; + } +}; +var OWNER = /^@[A-Za-z0-9][A-Za-z0-9-]*(\/[A-Za-z0-9._-]+)?$|^[^\s@]+@[^\s@]+$/; +function ownerList(value, field) { + if (!Array.isArray(value) || value.length === 0) { + throw new OwnersConfigError(`${field}: expected a non-empty list of owners`); + } + return value.map((o, i) => { + if (typeof o !== "string" || !OWNER.test(o)) { + throw new OwnersConfigError(`${field}[${i}]: "${String(o)}" is not an @user, @org/team or email`); + } + return o; + }); +} +function parseOwnersConfig(raw) { + if (raw === null || typeof raw !== "object" || Array.isArray(raw)) { + throw new OwnersConfigError("expected an object"); + } + const r = raw; + for (const k of Object.keys(r)) { + if (k !== "default" && k !== "members") throw new OwnersConfigError(`unknown key "${k}"`); + } + const out = {}; + if (r["default"] !== void 0) out.default = ownerList(r["default"], "default"); + if (r["members"] !== void 0) { + const m = r["members"]; + if (m === null || typeof m !== "object" || Array.isArray(m)) { + throw new OwnersConfigError("members: expected a map of member name to owners"); + } + out.members = {}; + for (const [name, owners] of Object.entries(m)) { + out.members[name] = ownerList(owners, `members.${name}`); + } + } + return out; +} +function pattern(root, dir) { + const parts = [root, dir].filter((p) => p !== "." && p !== ""); + return parts.length === 0 ? "*" : `/${parts.join("/")}/`; +} +function buildCodeowners(ws, owners) { + const byName = new Map(ws.members.map((m) => [m.name, m])); + for (const name of Object.keys(owners.members ?? {})) { + if (!byName.has(name)) { + throw new OwnersConfigError( + `members.${name}: workspace "${ws.name}" has no member of that name (members: ${ws.members.map((m) => m.name).join(", ")})` + ); + } + } + const skipped = []; + const rules = []; + for (const [name, list] of Object.entries(owners.members ?? {})) { + const m = byName.get(name); + if (m.reason === "dir-missing") { + skipped.push({ name, reason: "its directory does not exist" }); + continue; + } + const pat = pattern(ws.root, m.dir); + rules.push({ pat, depth: pat === "*" ? 0 : pat.split("/").length, name, owners: list }); + } + rules.sort((a, b) => a.depth - b.depth || a.pat.localeCompare(b.pat)); + const lines = [ + `# Generated by github-warden from the members of workspace "${ws.name}" (chant workspace ls --json).`, + "# Edit the owners file, not this one.", + "" + ]; + if (owners.default) lines.push(`* ${owners.default.join(" ")}`); + for (const r of rules) lines.push(`${r.pat} ${r.owners.join(" ")}`); + return { text: lines.join("\n") + "\n", skipped }; +} + // src/cli.ts var CliError = class extends Error { constructor(code, message) { @@ -249119,8 +254472,12 @@ async function main(argv = process.argv.slice(2)) { await runReport(argv.slice(1)); return; } + if (subcommand === "codeowners") { + await runCodeowners(argv.slice(1)); + return; + } if (subcommand !== "reconcile") { - die(2, `unknown subcommand: ${subcommand}. Did you mean "reconcile", "audit", or "report"?`); + die(2, `unknown subcommand: ${subcommand}. Did you mean "reconcile", "audit", "report", or "codeowners"?`); } let args; try { @@ -249131,7 +254488,7 @@ async function main(argv = process.argv.slice(2)) { } let rawConfig; try { - const text = readFileSync9(args.config, "utf-8"); + const text = readFileSync13(args.config, "utf-8"); rawConfig = parseConfigFile(args.config, text); } catch (err) { die(3, `failed to read config file "${args.config}": ${errMsg2(err)}`); @@ -249378,7 +254735,7 @@ async function runAudit(argv) { } let rawConfig; try { - const text = readFileSync9(auditArgs.config, "utf-8"); + const text = readFileSync13(auditArgs.config, "utf-8"); rawConfig = parseConfigFile(auditArgs.config, text); } catch (err) { die(3, `failed to read config file "${auditArgs.config}": ${errMsg2(err)}`); @@ -249446,7 +254803,7 @@ async function runReport(argv) { } let rawConfig; try { - const text = readFileSync9(reportArgs.config, "utf-8"); + const text = readFileSync13(reportArgs.config, "utf-8"); rawConfig = parseConfigFile(reportArgs.config, text); } catch (err) { die(3, `failed to read config file "${reportArgs.config}": ${errMsg2(err)}`); @@ -249560,6 +254917,75 @@ async function runReport(argv) { } process.exit(0); } +function parseCodeownersArgs(argv) { + const args = { owners: "", dir: ".", out: void 0, check: false }; + for (let i = 0; i < argv.length; i++) { + const flag = argv[i]; + const value = () => { + const v = argv[++i]; + if (!v || v.startsWith("--")) throw new CliError(2, `${flag} requires a value`); + return v; + }; + switch (flag) { + case "--owners": + args.owners = value(); + break; + case "--dir": + args.dir = value(); + break; + case "--out": + args.out = value(); + break; + case "--check": + args.check = true; + break; + default: + throw new CliError(2, `unknown flag for codeowners: ${flag}`); + } + } + if (!args.owners) throw new CliError(2, "codeowners requires --owners "); + if (args.check && !args.out) throw new CliError(2, "--check requires --out "); + return args; +} +async function runCodeowners(argv) { + let args; + try { + args = parseCodeownersArgs(argv); + } catch (err) { + if (err instanceof CliError) die(err.code, err.message); + throw err; + } + let text; + try { + const owners = parseOwnersConfig(parseConfigFile(args.owners, readFileSync13(args.owners, "utf8"))); + const ws = await readWorkspace(args.dir); + const result = buildCodeowners(ws, owners); + for (const s of result.skipped) process.stderr.write(`github-warden: skipped member ${s.name}: ${s.reason} +`); + text = result.text; + } catch (err) { + if (err instanceof OwnersConfigError) die(2, errMsg2(err)); + if (err instanceof WorkspaceReadError) die(3, errMsg2(err)); + die(2, errMsg2(err)); + } + if (!args.out) { + process.stdout.write(text); + process.exit(0); + } + if (args.check) { + const current = existsSync11(args.out) ? readFileSync13(args.out, "utf8") : null; + if (current !== text) { + process.stderr.write(`github-warden: ${args.out} is out of date; run codeowners --out ${args.out} +`); + process.exit(4); + } + process.exit(0); + } + writeFileSync4(args.out, text); + process.stdout.write(`wrote ${args.out} +`); + process.exit(0); +} function printUsage() { process.stdout.write( [ @@ -249569,6 +254995,7 @@ function printUsage() { " reconcile Load config, authenticate, and run governance cycles.", " audit Audit managed repos for security/correctness posture.", " report Aggregate cycle drift (+ optional audit) into a compliance snapshot.", + " codeowners Generate CODEOWNERS from a chant workspace's members.", "", "Flags (reconcile):", " --config Path to governance config file (YAML or JSON).", @@ -249598,12 +255025,18 @@ function printUsage() { " --identity Include an identity & service-account hygiene pass.", " --fail-on none|attention Exit 4 when the report needs attention (default: none).", "", + "Flags (codeowners):", + " --owners Owners by workspace member name (YAML or JSON). Required.", + " --dir Where chant looks for the workspace (default: .).", + " --out Write the file here instead of stdout.", + " --check With --out: exit 4 when the file differs. Writes nothing.", + "", "Exit codes:", " 0 Success.", " 1 Guardrail block (apply mode, override not set).", " 2 Argument or config error.", " 3 Runtime error.", - " 4 Audit/report: threshold exceeded or report needs attention.", + " 4 Audit/report: threshold exceeded or report needs attention. Codeowners --check: file differs.", "" ].join("\n") ); @@ -249639,7 +255072,7 @@ function printAuditUsage() { async function run3(argv) { await main(argv); } -var invokedPath = process.argv[1] ? pathToFileURL(process.argv[1]).href : ""; +var invokedPath = process.argv[1] ? pathToFileURL2(process.argv[1]).href : ""; if (import.meta.url === invokedPath && false) { main().catch((err) => { process.stderr.write(`github-warden: fatal: ${errMsg2(err)} diff --git a/package-lock.json b/package-lock.json index c4677b1..8bdbe7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.6.1", "license": "Apache-2.0", "dependencies": { - "@intentius/chant": "^0.72.1", - "@intentius/chant-lexicon-github": "^0.72.1" + "@intentius/chant": "^0.100.0", + "@intentius/chant-lexicon-github": "^0.100.0" }, "bin": { "github-warden": "bin/github-warden.js" @@ -44,7 +44,6 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -56,7 +55,6 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -67,7 +65,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -491,12 +488,13 @@ } }, "node_modules/@intentius/chant": { - "version": "0.72.1", - "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.72.1.tgz", - "integrity": "sha512-srOVhbHoyCbsnocGoUVo3x4WdxZBS38MqrWDASlkV1GrCSKNy6sVHxlBGmtfFMj85UJqWCqeSLFtmWXJiTzm3w==", + "version": "0.100.0", + "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.100.0.tgz", + "integrity": "sha512-t/ukw5iwUZ+U5VldegNyAaK67CrPaQCLmBk5lBBL8zQnqyde1pNEDs102QK7AHWwX9rITW+Ouy9kU0dcCvGu1Q==", "license": "Apache-2.0", "dependencies": { "@dagrejs/dagre": "^3.0.0", + "ajv": "^8.20.0", "esbuild": "^0.28.1", "fflate": "^0.8.2", "js-yaml": "^4.3.1", @@ -507,15 +505,23 @@ }, "bin": { "chant": "bin/chant" + }, + "peerDependencies": { + "vitest": ">=2" + }, + "peerDependenciesMeta": { + "vitest": { + "optional": true + } } }, "node_modules/@intentius/chant-lexicon-github": { - "version": "0.72.1", - "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-github/-/chant-lexicon-github-0.72.1.tgz", - "integrity": "sha512-PCEoBZ6TfKlsPSWwCQ6h6A4FtlhjDCxj+sXTeqLuc2v52kHa80STfXZzzW1/skBWyegN5P87Zhmjea3WYJDIFw==", + "version": "0.100.0", + "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-github/-/chant-lexicon-github-0.100.0.tgz", + "integrity": "sha512-AwLDwlVP7m+ZUwK2vUMutalkt6DG/tPoaoo2Qft17Z8zCXWM1PXxxhX1/6WOe04I2+e6xmcovQB6a/V9ZW07Ng==", "license": "Apache-2.0", "peerDependencies": { - "@intentius/chant": "^0.72.1", + "@intentius/chant": "^0.100.0", "typescript": "^5.9.3" } }, @@ -523,14 +529,13 @@ "version": "1.5.5", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@napi-rs/wasm-runtime": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.5.tgz", "integrity": "sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -549,7 +554,7 @@ "version": "0.133.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.133.0.tgz", "integrity": "sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==", - "dev": true, + "devOptional": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/Boshen" @@ -562,7 +567,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -579,7 +583,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -596,7 +599,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -613,7 +615,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -630,7 +631,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -647,7 +647,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -664,7 +663,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -681,7 +679,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -698,7 +695,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -715,7 +711,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -732,7 +727,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -749,7 +743,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -766,7 +759,6 @@ "cpu": [ "wasm32" ], - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -785,7 +777,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -802,7 +793,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -816,21 +806,20 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@standard-schema/spec": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@tybys/wasm-util": { "version": "0.10.2", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", "integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -841,7 +830,7 @@ "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@types/deep-eql": "*", @@ -852,14 +841,14 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@types/libsodium-wrappers": { @@ -873,7 +862,7 @@ "version": "22.19.21", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.21.tgz", "integrity": "sha512-VMeFBSCKQKmm2swI2kW51SFusDqekC6q9trBCvJ/JliDchFSuoYYKN7yVNjPthP1HKZcx3U1gI/wTcEBjEFKTA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -883,7 +872,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.9.tgz", "integrity": "sha512-vl/rYsUKcBr3SnQn166+XR5ZQcgMx3DQhFWdfli/cWpLnLUmbxZvyrJZotLFUryib+LtArYMSTJ5RbQ57ZqrlA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.1.0", @@ -901,7 +890,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.9.tgz", "integrity": "sha512-EVkXzBjrPGM+cK8/ANWgBrkUCfJfb38/EfTSO8h7pWvKkyPkpWxvR7BkD2MyItMF62C97zAEoqdpUixwR/e+Rw==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@vitest/spy": "4.1.9", @@ -928,7 +917,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.9.tgz", "integrity": "sha512-s0iufns3iIFitdgm+YR7g1whCAaGtXz459VS9/PqyKDEEFgYIhsHOQmXgIgDuYCt7DeQmiZT0Qe2OA2p4ZPu5A==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "tinyrainbow": "^3.1.0" @@ -941,7 +930,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.9.tgz", "integrity": "sha512-KXLMDtc7oe70+3mJfGrPUWPesswH+3sTxAMAMl8DG7I8IUQT4XW718dY5ID3vPUcmlu27CcKfY4P3h3I29SLJg==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@vitest/utils": "4.1.9", @@ -955,7 +944,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.9.tgz", "integrity": "sha512-Jc7RKGNBo8Z28WYIm0Niej4xdSPByRf6mU58VpHQkd6Zh05rlnA+twjbK5HyeIGHxrzsc3mJgS43uM0CZKzaIA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@vitest/pretty-format": "4.1.9", @@ -971,7 +960,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.9.tgz", "integrity": "sha512-fHpsS6mIi+PiEW+vcRVOMkX1oSaPKne3VOclSFICPcGOmfKgXPU5iAah+wcNcj2xPrCCmfq99IDGf+EojhhvhA==", - "dev": true, + "devOptional": true, "license": "MIT", "funding": { "url": "https://opencollective.com/vitest" @@ -981,7 +970,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.9.tgz", "integrity": "sha512-A51o8ymO5PpqlWNnBP9ZHPXDIpuMtTLlGSjN7la4US+LJzoUMyhwjA5QXlm39JexgwHKW4Xjs8Z2d3dLCXOeuA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@vitest/pretty-format": "4.1.9", @@ -992,6 +981,22 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1002,7 +1007,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=12" @@ -1012,7 +1017,7 @@ "version": "6.2.2", "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=18" @@ -1037,14 +1042,14 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=8" @@ -1064,7 +1069,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/esbuild": { @@ -1112,7 +1117,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.0" @@ -1122,17 +1127,39 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=12.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", + "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=12.0.0" @@ -1198,6 +1225,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, "node_modules/libsodium": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.8.4.tgz", @@ -1219,7 +1252,7 @@ "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", - "dev": true, + "devOptional": true, "license": "MPL-2.0", "dependencies": { "detect-libc": "^2.0.3" @@ -1252,7 +1285,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1273,7 +1305,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1294,7 +1325,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1315,7 +1345,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1336,7 +1365,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1357,7 +1385,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1378,7 +1405,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1399,7 +1425,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1420,7 +1445,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1441,7 +1465,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1462,7 +1485,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -1480,7 +1502,7 @@ "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" @@ -1490,7 +1512,7 @@ "version": "3.3.18", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", - "dev": true, + "devOptional": true, "funding": [ { "type": "github", @@ -1509,7 +1531,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.3.tgz", "integrity": "sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==", - "dev": true, + "devOptional": true, "funding": [ "https://github.com/sponsors/sxzz", "https://opencollective.com/debug" @@ -1523,14 +1545,14 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/picomatch": { @@ -1549,7 +1571,7 @@ "version": "8.5.26", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz", "integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==", - "dev": true, + "devOptional": true, "funding": [ { "type": "opencollective", @@ -1574,11 +1596,20 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rolldown": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.3.tgz", "integrity": "sha512-i00lAJ2ks1BYr7rjNjKC7BcqAS7nVfiT3QX1SI5aY+AFHblCmaUf9OE9dbdzDvW6dJxbi2ZCZiy9v3CcwOiX3g==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@oxc-project/types": "=0.133.0", @@ -1622,14 +1653,14 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, + "devOptional": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -1639,14 +1670,14 @@ "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/std-env": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.1.0.tgz", "integrity": "sha512-Rq7ybcX2RuC55r9oaPVEW7/xu3tj8u4GeBYHBWCychFtzMIr86A7e3PPEBPT37sHStKX3+TiX/Fr/ACmJLVlLQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/suffix-thumb": { @@ -1660,14 +1691,14 @@ "version": "2.9.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/tinyexec": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=18" @@ -1677,7 +1708,7 @@ "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", @@ -1694,7 +1725,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=14.0.0" @@ -1704,7 +1735,6 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, "license": "0BSD", "optional": true }, @@ -1743,14 +1773,14 @@ "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/vite": { "version": "8.0.16", "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.16.tgz", "integrity": "sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "lightningcss": "^1.32.0", @@ -1828,7 +1858,7 @@ "version": "4.1.9", "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.9.tgz", "integrity": "sha512-nE3/LEyc0z87uHYLZebqCUOaJr2hdtuPp7BQ4BosVFnfltxgAvMG08NyrSGlPpOUWvR27c5flSmYFTNr78L9GQ==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@vitest/expect": "4.1.9", @@ -1918,7 +1948,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "siginfo": "^2.0.0", diff --git a/package.json b/package.json index b303eae..cfada18 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@intentius/chant": "^0.72.1", - "@intentius/chant-lexicon-github": "^0.72.1" + "@intentius/chant": "^0.100.0", + "@intentius/chant-lexicon-github": "^0.100.0" }, "devDependencies": { "@types/libsodium-wrappers": "^0.7.14", diff --git a/src/cli.ts b/src/cli.ts index d7cde23..cd3bfa0 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -7,6 +7,7 @@ * Subcommands: * reconcile Load config, build an authed client, run selected cycles. * audit Run chant's posture-audit engine over all managed repos. + * codeowners Generate CODEOWNERS from a chant workspace's members. * * Flag contract (must stay in sync with emit/pipeline.ts): * --config Path to the governance config file (YAML/JSON). @@ -38,7 +39,7 @@ * 4 Audit: findings exceed --fail-on threshold. */ -import { readFileSync, writeFileSync } from "node:fs"; +import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { pathToFileURL } from "node:url"; import pkg from "../package.json" with { type: "json" }; import { loadGovernanceConfig } from "./config/load.js"; @@ -55,6 +56,8 @@ import { renderPostureSummary, shouldFail, type FailOn } from "./audit/summary.j import type { Cycle, ReconcileResult } from "./reconcile/runner.js"; import { buildComplianceReport, renderComplianceReport, complianceArtifact } from "./report/compliance.js"; import { buildIdentityReport, type RawInstallation } from "./report/identity.js"; +import { readWorkspace, WorkspaceReadError } from "./workspace/members.js"; +import { buildCodeowners, parseOwnersConfig, OwnersConfigError } from "./workspace/codeowners.js"; // --------------------------------------------------------------------------- // Arg parser @@ -568,8 +571,13 @@ async function main(argv: string[] = process.argv.slice(2)) { return; } + if (subcommand === "codeowners") { + await runCodeowners(argv.slice(1)); + return; + } + if (subcommand !== "reconcile") { - die(2, `unknown subcommand: ${subcommand}. Did you mean "reconcile", "audit", or "report"?`); + die(2, `unknown subcommand: ${subcommand}. Did you mean "reconcile", "audit", "report", or "codeowners"?`); } let args: ReconcileArgs; @@ -1190,6 +1198,82 @@ async function runReport(argv: string[]): Promise { process.exit(0); } +// --------------------------------------------------------------------------- +// Codeowners subcommand +// --------------------------------------------------------------------------- + +export interface CodeownersArgs { + owners: string; + dir: string; + out: string | undefined; + check: boolean; +} + +/** Parse codeowners argv (everything after the `codeowners` subcommand). */ +export function parseCodeownersArgs(argv: string[]): CodeownersArgs { + const args: CodeownersArgs = { owners: "", dir: ".", out: undefined, check: false }; + for (let i = 0; i < argv.length; i++) { + const flag = argv[i]!; + const value = (): string => { + const v = argv[++i]; + if (!v || v.startsWith("--")) throw new CliError(2, `${flag} requires a value`); + return v; + }; + switch (flag) { + case "--owners": args.owners = value(); break; + case "--dir": args.dir = value(); break; + case "--out": args.out = value(); break; + case "--check": args.check = true; break; + default: throw new CliError(2, `unknown flag for codeowners: ${flag}`); + } + } + if (!args.owners) throw new CliError(2, "codeowners requires --owners "); + if (args.check && !args.out) throw new CliError(2, "--check requires --out "); + return args; +} + +/** + * Run `codeowners`: read members with `chant workspace ls --json`, build the + * file from the owners file, then print it, write it (--out) or compare it + * with the committed one (--out --check, exit 4 when it differs). + */ +async function runCodeowners(argv: string[]): Promise { + let args: CodeownersArgs; + try { + args = parseCodeownersArgs(argv); + } catch (err) { + if (err instanceof CliError) die(err.code, err.message); + throw err; + } + let text: string; + try { + const owners = parseOwnersConfig(parseConfigFile(args.owners, readFileSync(args.owners, "utf8"))); + const ws = await readWorkspace(args.dir); + const result = buildCodeowners(ws, owners); + for (const s of result.skipped) process.stderr.write(`github-warden: skipped member ${s.name}: ${s.reason}\n`); + text = result.text; + } catch (err) { + if (err instanceof OwnersConfigError) die(2, errMsg(err)); + if (err instanceof WorkspaceReadError) die(3, errMsg(err)); + die(2, errMsg(err)); + } + if (!args.out) { + process.stdout.write(text); + process.exit(0); + } + if (args.check) { + const current = existsSync(args.out) ? readFileSync(args.out, "utf8") : null; + if (current !== text) { + process.stderr.write(`github-warden: ${args.out} is out of date; run codeowners --out ${args.out}\n`); + process.exit(4); + } + process.exit(0); + } + writeFileSync(args.out, text); + process.stdout.write(`wrote ${args.out}\n`); + process.exit(0); +} + function printUsage() { process.stdout.write( [ @@ -1199,6 +1283,7 @@ function printUsage() { " reconcile Load config, authenticate, and run governance cycles.", " audit Audit managed repos for security/correctness posture.", " report Aggregate cycle drift (+ optional audit) into a compliance snapshot.", + " codeowners Generate CODEOWNERS from a chant workspace's members.", "", "Flags (reconcile):", " --config Path to governance config file (YAML or JSON).", @@ -1228,12 +1313,18 @@ function printUsage() { " --identity Include an identity & service-account hygiene pass.", " --fail-on none|attention Exit 4 when the report needs attention (default: none).", "", + "Flags (codeowners):", + " --owners Owners by workspace member name (YAML or JSON). Required.", + " --dir Where chant looks for the workspace (default: .).", + " --out Write the file here instead of stdout.", + " --check With --out: exit 4 when the file differs. Writes nothing.", + "", "Exit codes:", " 0 Success.", " 1 Guardrail block (apply mode, override not set).", " 2 Argument or config error.", " 3 Runtime error.", - " 4 Audit/report: threshold exceeded or report needs attention.", + " 4 Audit/report: threshold exceeded or report needs attention. Codeowners --check: file differs.", "", ].join("\n"), ); diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index f96412d..012f0ec 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -460,3 +460,21 @@ describe("pipeline.ts ↔ CLI flag consistency", () => { expect(args.cycles).toEqual(["branch-protection"]); }); }); + +describe("parseCodeownersArgs", () => { + it("parses owners, dir, out and check", async () => { + const { parseCodeownersArgs } = await import("../cli.js"); + expect(parseCodeownersArgs(["--owners", "o.json", "--dir", "ws", "--out", ".github/CODEOWNERS", "--check"])).toEqual({ + owners: "o.json", + dir: "ws", + out: ".github/CODEOWNERS", + check: true, + }); + }); + it("requires --owners, and --out with --check", async () => { + const { parseCodeownersArgs } = await import("../cli.js"); + expect(() => parseCodeownersArgs([])).toThrow(CliError); + expect(() => parseCodeownersArgs(["--owners", "o.json", "--check"])).toThrow(/--out/); + expect(() => parseCodeownersArgs(["--owners", "o.json", "--bogus"])).toThrow(/unknown flag/); + }); +}); diff --git a/src/workspace/codeowners.test.ts b/src/workspace/codeowners.test.ts new file mode 100644 index 0000000..1f9c632 --- /dev/null +++ b/src/workspace/codeowners.test.ts @@ -0,0 +1,92 @@ +import { describe, it, expect } from "vitest"; +import { execFileSync } from "node:child_process"; +import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { buildCodeowners, parseOwnersConfig, OwnersConfigError } from "./codeowners.js"; +import { readWorkspace, type Workspace } from "./members.js"; + +const ws = (root = "."): Workspace => ({ + name: "demo", + root, + chant: "0.100.0", + members: [ + { name: "app", dir: ".", kind: "chant", readable: true, reason: null }, + { name: "api", dir: "packages/api", kind: "other", readable: true, reason: null }, + { name: "core", dir: "packages", kind: "other", readable: true, reason: null }, + { name: "gone", dir: "old", kind: "other", readable: false, reason: "dir-missing" }, + ], +}); + +describe("parseOwnersConfig", () => { + it("accepts users, teams and emails", () => { + expect(parseOwnersConfig({ default: ["@a"], members: { api: ["@org/team", "x@y.io"] } })).toEqual({ + default: ["@a"], + members: { api: ["@org/team", "x@y.io"] }, + }); + }); + it("rejects bad owners, empty lists and unknown keys", () => { + expect(() => parseOwnersConfig({ members: { api: ["nobody"] } })).toThrow(OwnersConfigError); + expect(() => parseOwnersConfig({ members: { api: [] } })).toThrow(/non-empty/); + expect(() => parseOwnersConfig({ extra: 1 })).toThrow(/unknown key/); + expect(() => parseOwnersConfig([])).toThrow(/expected an object/); + }); +}); + +describe("buildCodeowners", () => { + it("emits one rule per declared member, shallow rules before nested ones", () => { + const { text } = buildCodeowners(ws(), { + default: ["@org/all"], + members: { api: ["@org/api"], core: ["@org/core"], app: ["@org/app"] }, + }); + const rules = text.split("\n").filter((l) => l && !l.startsWith("#")); + expect(rules).toEqual(["* @org/all", "* @org/app", "/packages/ @org/core", "/packages/api/ @org/api"]); + }); + + it("prefixes the workspace root for a nested workspace", () => { + const { text } = buildCodeowners(ws("infra"), { members: { api: ["@a"], app: ["@b"] } }); + expect(text).toContain("/infra/ @b\n"); + expect(text).toContain("/infra/packages/api/ @a\n"); + }); + + it("skips a member whose directory is missing", () => { + const r = buildCodeowners(ws(), { members: { gone: ["@a"] } }); + expect(r.skipped).toEqual([{ name: "gone", reason: "its directory does not exist" }]); + expect(r.text).not.toContain("/old/"); + }); + + it("fails on a member the workspace does not have", () => { + expect(() => buildCodeowners(ws(), { members: { nope: ["@a"] } })).toThrow(/no member of that name/); + }); + + it("ends in a newline and names its source", () => { + const { text } = buildCodeowners(ws(), {}); + expect(text.endsWith("\n")).toBe(true); + expect(text).toContain('workspace "demo"'); + }); +}); + +describe("against a real chant workspace", () => { + it("reads members through `chant workspace ls --json`", async () => { + const dir = mkdtempSync(join(tmpdir(), "warden-ws-")); + execFileSync("git", ["init", "-q"], { cwd: dir }); + mkdirSync(join(dir, "packages/api"), { recursive: true }); + mkdirSync(join(dir, "docs")); + writeFileSync( + join(dir, "chant.workspace.json"), + JSON.stringify({ + schema: 1, + name: "demo", + members: [ + { name: "api", kind: "other", dir: "packages/api", because: "the api" }, + { name: "docs", kind: "other", dir: "docs", because: "the docs" }, + ], + }), + ); + const real = await readWorkspace(dir); + expect(real.members.map((m) => m.dir)).toEqual(["packages/api", "docs"]); + const { text } = buildCodeowners(real, { members: { api: ["@org/api"], docs: ["@org/docs"] } }); + expect(text).toContain("/docs/ @org/docs\n"); + expect(text).toContain("/packages/api/ @org/api\n"); + }, 60_000); +}); diff --git a/src/workspace/codeowners.ts b/src/workspace/codeowners.ts new file mode 100644 index 0000000..48eaaee --- /dev/null +++ b/src/workspace/codeowners.ts @@ -0,0 +1,109 @@ +/** + * CODEOWNERS entries per workspace member directory. + * + * Members come from chant's read contract (./members.ts). Owners are declared + * by member name in an owners file, so a member that moves keeps its owners. + */ + +import type { Workspace } from "./members.js"; + +export interface OwnersConfig { + /** Owners for the whole repository (a `*` rule). Optional. */ + default?: string[]; + /** Owners by workspace member name. */ + members?: Record; +} + +export class OwnersConfigError extends Error { + constructor(message: string) { + super(`[codeowners] ${message}`); + this.name = "OwnersConfigError"; + } +} + +const OWNER = /^@[A-Za-z0-9][A-Za-z0-9-]*(\/[A-Za-z0-9._-]+)?$|^[^\s@]+@[^\s@]+$/; + +function ownerList(value: unknown, field: string): string[] { + if (!Array.isArray(value) || value.length === 0) { + throw new OwnersConfigError(`${field}: expected a non-empty list of owners`); + } + return value.map((o, i) => { + if (typeof o !== "string" || !OWNER.test(o)) { + throw new OwnersConfigError(`${field}[${i}]: "${String(o)}" is not an @user, @org/team or email`); + } + return o; + }); +} + +/** Validate an owners file that was already parsed from YAML or JSON. */ +export function parseOwnersConfig(raw: unknown): OwnersConfig { + if (raw === null || typeof raw !== "object" || Array.isArray(raw)) { + throw new OwnersConfigError("expected an object"); + } + const r = raw as Record; + for (const k of Object.keys(r)) { + if (k !== "default" && k !== "members") throw new OwnersConfigError(`unknown key "${k}"`); + } + const out: OwnersConfig = {}; + if (r["default"] !== undefined) out.default = ownerList(r["default"], "default"); + if (r["members"] !== undefined) { + const m = r["members"]; + if (m === null || typeof m !== "object" || Array.isArray(m)) { + throw new OwnersConfigError("members: expected a map of member name to owners"); + } + out.members = {}; + for (const [name, owners] of Object.entries(m as Record)) { + out.members[name] = ownerList(owners, `members.${name}`); + } + } + return out; +} + +export interface CodeownersResult { + /** The file text, ending in a newline. */ + text: string; + /** Members skipped, with why. */ + skipped: { name: string; reason: string }[]; +} + +function pattern(root: string, dir: string): string { + const parts = [root, dir].filter((p) => p !== "." && p !== ""); + return parts.length === 0 ? "*" : `/${parts.join("/")}/`; +} + +/** + * Build the CODEOWNERS text. GitHub uses the last matching rule, so rules are + * ordered by depth: a nested member's rule comes after its parent's. + * Throws when the owners file names a member the workspace doesn't have. + */ +export function buildCodeowners(ws: Workspace, owners: OwnersConfig): CodeownersResult { + const byName = new Map(ws.members.map((m) => [m.name, m])); + for (const name of Object.keys(owners.members ?? {})) { + if (!byName.has(name)) { + throw new OwnersConfigError( + `members.${name}: workspace "${ws.name}" has no member of that name (members: ${ws.members.map((m) => m.name).join(", ")})`, + ); + } + } + const skipped: CodeownersResult["skipped"] = []; + const rules: { pat: string; depth: number; name: string; owners: string[] }[] = []; + for (const [name, list] of Object.entries(owners.members ?? {})) { + const m = byName.get(name)!; + if (m.reason === "dir-missing") { + skipped.push({ name, reason: "its directory does not exist" }); + continue; + } + const pat = pattern(ws.root, m.dir); + rules.push({ pat, depth: pat === "*" ? 0 : pat.split("/").length, name, owners: list }); + } + rules.sort((a, b) => a.depth - b.depth || a.pat.localeCompare(b.pat)); + + const lines = [ + `# Generated by github-warden from the members of workspace "${ws.name}" (chant workspace ls --json).`, + "# Edit the owners file, not this one.", + "", + ]; + if (owners.default) lines.push(`* ${owners.default.join(" ")}`); + for (const r of rules) lines.push(`${r.pat} ${r.owners.join(" ")}`); + return { text: lines.join("\n") + "\n", skipped }; +} diff --git a/src/workspace/members.test.ts b/src/workspace/members.test.ts new file mode 100644 index 0000000..2e6ff4d --- /dev/null +++ b/src/workspace/members.test.ts @@ -0,0 +1,72 @@ +import { describe, it, expect } from "vitest"; +import { chantLauncher, parseLsDocument, readWorkspace, WorkspaceReadError, type CommandRunner } from "./members.js"; + +const doc = (over: Record = {}) => + JSON.stringify({ + $schema: "https://intentius.io/chant/schemas/workspace/ls/v1/ls.schema.json", + contract: 1, + chant: "0.100.0", + at: null, + workspace: { name: "demo", root: "sub", file: "chant.workspace.json", schema: 1, minReader: null, pins: [] }, + members: [ + { name: "api", dir: "packages/api", kind: "other", roles: [], readable: true, reason: null }, + { name: "gone", dir: "old", kind: "other", roles: [], readable: false, reason: "dir-missing" }, + ], + groups: [], + diagrams: [], + summary: { members: 2, unreadable: 1, groups: 0, matches: 0 }, + ...over, + }); + +describe("parseLsDocument", () => { + it("reads members, root and chant version", () => { + const ws = parseLsDocument(doc()); + expect(ws.name).toBe("demo"); + expect(ws.root).toBe("sub"); + expect(ws.chant).toBe("0.100.0"); + expect(ws.members).toEqual([ + { name: "api", dir: "packages/api", kind: "other", readable: true, reason: null }, + { name: "gone", dir: "old", kind: "other", readable: false, reason: "dir-missing" }, + ]); + }); + + it("refuses a contract it does not know", () => { + expect(() => parseLsDocument(doc({ contract: 2 }))).toThrow(/contract 2 is not supported/); + }); + + it("reports a failure document", () => { + const failure = JSON.stringify({ contract: 1, chant: "0.100.0", error: { code: "declaration-missing", message: "none" } }); + expect(() => parseLsDocument(failure)).toThrow(/declaration-missing: none/); + }); + + it("refuses output that is not JSON or lacks members", () => { + expect(() => parseLsDocument("nope")).toThrow(WorkspaceReadError); + expect(() => parseLsDocument(doc({ members: undefined }))).toThrow(/lacks workspace or members/); + }); +}); + +describe("readWorkspace", () => { + it("runs chant workspace ls --json in the directory", async () => { + const calls: unknown[] = []; + const run: CommandRunner = async (cmd, args, cwd) => { + calls.push([cmd, args, cwd]); + return { stdout: doc(), stderr: "", code: 0 }; + }; + const ws = await readWorkspace("/repo", run); + expect(ws.members).toHaveLength(2); + expect(calls).toEqual([[chantLauncher(), ["workspace", "ls", "--json"], "/repo"]]); + expect(chantLauncher()).toMatch(/@intentius\/chant\/bin\/chant$/); + }); + + it("names the chant floor when chant prints nothing", async () => { + const run: CommandRunner = async () => ({ stdout: "", stderr: "unknown command", code: 1 }); + await expect(readWorkspace("/repo", run)).rejects.toThrow(/0\.81\.0 or newer/); + }); + + it("wraps a spawn failure", async () => { + const run: CommandRunner = async () => { + throw new Error("spawn npx ENOENT"); + }; + await expect(readWorkspace("/repo", run)).rejects.toThrow(/could not run chant/); + }); +}); diff --git a/src/workspace/members.ts b/src/workspace/members.ts new file mode 100644 index 0000000..5481fad --- /dev/null +++ b/src/workspace/members.ts @@ -0,0 +1,148 @@ +/** + * Read a chant workspace's members through chant's read contract. + * + * The warden never parses chant.workspace.json itself. It runs + * `chant workspace ls --json` and reads the document against contract 1 + * (INTENTIUS/chant docs: reference/workspace-read-contract). Contract 1 is + * written by chant 0.81.0 and newer. + */ + +import { execFile } from "node:child_process"; +import { existsSync } from "node:fs"; +import { createRequire } from "node:module"; +import { dirname, join } from "node:path"; + +/** The contract version this reader knows. */ +export const READ_CONTRACT = 1; + +export interface WorkspaceMember { + name: string; + /** Relative to the workspace root, "/" separators, "." for the root member. */ + dir: string; + kind: string; + readable: boolean; + /** Reason code when the member can't be read, else null. */ + reason: string | null; +} + +export interface Workspace { + name: string; + /** The workspace root relative to the git root, "." for the git root itself. */ + root: string; + /** The chant version that wrote the document. */ + chant: string; + members: WorkspaceMember[]; +} + +export class WorkspaceReadError extends Error { + constructor(message: string) { + super(`[workspace] ${message}`); + this.name = "WorkspaceReadError"; + } +} + +/** Runs a command and resolves with its stdout, or rejects with the failure. */ +export type CommandRunner = ( + cmd: string, + args: string[], + cwd: string, +) => Promise<{ stdout: string; stderr: string; code: number | null }>; + +export const defaultRunner: CommandRunner = (cmd, args, cwd) => + new Promise((resolve, reject) => { + execFile(cmd, args, { cwd, maxBuffer: 64 * 1024 * 1024 }, (err, stdout, stderr) => { + if (err && (err as NodeJS.ErrnoException).code === "ENOENT") { + reject(err); + return; + } + const code = err ? ((err as { code?: number | string }).code as number | null) : 0; + resolve({ stdout, stderr, code: typeof code === "number" ? code : 1 }); + }); + }); + +/** + * Parse one `chant workspace ls --json` document. Pure, so tests need no chant. + * Throws WorkspaceReadError for a failure document, an unknown contract or a + * document that is not an ls result. + */ +export function parseLsDocument(stdout: string): Workspace { + let doc: unknown; + try { + doc = JSON.parse(stdout); + } catch { + throw new WorkspaceReadError("`chant workspace ls --json` did not print JSON"); + } + if (doc === null || typeof doc !== "object" || Array.isArray(doc)) { + throw new WorkspaceReadError("`chant workspace ls --json` did not print an object"); + } + const d = doc as Record; + if (d["contract"] !== READ_CONTRACT) { + throw new WorkspaceReadError( + `read contract ${String(d["contract"])} is not supported, this warden reads contract ${READ_CONTRACT}`, + ); + } + if (d["error"] && typeof d["error"] === "object") { + const e = d["error"] as { code?: unknown; message?: unknown }; + throw new WorkspaceReadError(`chant could not read the workspace: ${String(e.code)}: ${String(e.message)}`); + } + const ws = d["workspace"] as Record | undefined; + if (!ws || typeof ws["name"] !== "string" || typeof ws["root"] !== "string" || !Array.isArray(d["members"])) { + throw new WorkspaceReadError("`chant workspace ls --json` document lacks workspace or members"); + } + const members: WorkspaceMember[] = (d["members"] as unknown[]).map((m, i) => { + const o = m as Record; + if (!o || typeof o["name"] !== "string" || typeof o["dir"] !== "string") { + throw new WorkspaceReadError(`members[${i}] lacks a name or a dir`); + } + return { + name: o["name"], + dir: o["dir"], + kind: typeof o["kind"] === "string" ? o["kind"] : "other", + readable: o["readable"] !== false, + reason: typeof o["reason"] === "string" ? o["reason"] : null, + }; + }); + return { + name: ws["name"], + root: ws["root"], + chant: typeof d["chant"] === "string" ? d["chant"] : "unknown", + members, + }; +} + +/** + * The chant launcher installed beside the warden, found from the warden's own + * dependency rather than from the workspace directory, which may sit anywhere. + */ +export function chantLauncher(): string | null { + try { + let dir = dirname(createRequire(import.meta.url).resolve("@intentius/chant")); + for (let i = 0; i < 6; i++, dir = dirname(dir)) { + const bin = join(dir, "bin", "chant"); + if (existsSync(join(dir, "package.json")) && existsSync(bin)) return bin; + } + } catch { + // not resolvable: fall back to PATH + } + return null; +} + +/** + * Run `chant workspace ls --json` in `dir` and return the workspace. + * Uses the chant installed beside the warden, else `chant` on PATH. + */ +export async function readWorkspace(dir: string, run: CommandRunner = defaultRunner): Promise { + let result; + try { + result = await run(chantLauncher() ?? "chant", ["workspace", "ls", "--json"], dir); + } catch (err) { + throw new WorkspaceReadError(`could not run chant: ${err instanceof Error ? err.message : String(err)}`); + } + // A failed read still prints a JSON failure document, with exit code 1. + if (result.stdout.trim() === "") { + throw new WorkspaceReadError( + `\`chant workspace ls --json\` printed nothing (exit ${result.code}); chant 0.81.0 or newer is required. ${result.stderr.trim()}`.trim(), + ); + } + return parseLsDocument(result.stdout); +}