From 87945f0d3df6cc7de67fc763ec99533f30fa3ebf Mon Sep 17 00:00:00 2001 From: lex00 Date: Sat, 12 Sep 2026 12:35:34 -0600 Subject: [PATCH] chore(deps): chant 0.56 -> 0.71.1 Fifteen minor versions. Typecheck, all 553 tests, the CLI bundle and the action bundle are clean on the new pin. The jump needed a chant fix first. chant 0.71.0's core imports `js-yaml` by name without declaring it (INTENTIUS/chant#2433); inside chant's own workspace it resolved via hoisting, but here it did not, and the production esbuild bundle failed: node_modules/@intentius/chant/src/op/activities/apply.ts:227:35: ERROR: Could not resolve "js-yaml" chant 0.71.1 declares it, so it now arrives transitively and the bundle resolves. Pinning ^0.71.1 rather than ^0.71.0 is deliberate: 0.71.0 cannot build here. `action/index.mjs` is rebuilt because the bundle embeds package.json and the chant code it links. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_0146g8Ahc75AXVSWGBt7ggmJ --- action/index.mjs | 12706 +++++++++++++++++++++++++++++++++++--------- package-lock.json | 47 +- package.json | 4 +- 3 files changed, 10263 insertions(+), 2494 deletions(-) diff --git a/action/index.mjs b/action/index.mjs index a897a09..d95a493 100644 --- a/action/index.mjs +++ b/action/index.mjs @@ -1388,9 +1388,9 @@ function parseYAMLLines(lines, startIndex, baseIndent) { } else { const header = blockScalarHeader(inlineValue); if (header) { - const block = parseBlockScalar(lines, i + 1, indent, header); - result[key] = block.value; - i = block.endIndex; + const block2 = parseBlockScalar(lines, i + 1, indent, header); + result[key] = block2.value; + i = block2.endIndex; } else { result[key] = parseScalar(inlineValue); i++; @@ -1518,9 +1518,9 @@ function parseYAMLArray(lines, startIndex, baseIndent) { } else { const header = blockScalarHeader(itemValue); if (header) { - const block = parseBlockScalar(lines, i + 1, indent, header); - result.push(block.value); - i = block.endIndex; + const block2 = parseBlockScalar(lines, i + 1, indent, header); + result.push(block2.value); + i = block2.endIndex; } else { result.push(parseScalar(itemValue)); i++; @@ -1619,7 +1619,48 @@ 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; + } + return false; +} +var init_terraform_state = __esm({ + "node_modules/@intentius/chant/src/audit/terraform-state.ts"() { + } +}); + // 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; @@ -18278,7 +18319,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((resolve4) => { + requestCallbacks["on-end"] = (id, request2) => new Promise((resolve9) => { buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => { const response = { errors: onEndErrors, @@ -18288,7 +18329,7 @@ is not a problem with esbuild. You need to fix your environment instead. latestResultPromise = void 0; provideLatestResult = void 0; sendResponse(id, response); - resolve4(); + resolve9(); }); }); sendRequest(refs, request, (error51, response) => { @@ -18305,10 +18346,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((resolve4, reject) => { + if (!latestResultPromise) latestResultPromise = new Promise((resolve9, reject) => { let settlePromise; provideLatestResult = (err, result2) => { - if (!settlePromise) settlePromise = () => err ? reject(err) : resolve4(result2); + if (!settlePromise) settlePromise = () => err ? reject(err) : resolve9(result2); }; const triggerAnotherBuild = () => { const request2 = { @@ -18329,7 +18370,7 @@ is not a problem with esbuild. You need to fix your environment instead. }); return latestResultPromise; }, - watch: (options2 = {}) => new Promise((resolve4, reject) => { + watch: (options2 = {}) => new Promise((resolve9, reject) => { if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`); const keys = {}; const delay = getFlag(options2, keys, "delay", mustBeInteger); @@ -18341,10 +18382,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 resolve4(void 0); + else resolve9(void 0); }); }), - serve: (options2 = {}) => new Promise((resolve4, reject) => { + serve: (options2 = {}) => new Promise((resolve9, reject) => { if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`); const keys = {}; const port = getFlag(options2, keys, "port", mustBeValidPortNumber); @@ -18382,28 +18423,28 @@ is not a problem with esbuild. You need to fix your environment instead. sendResponse(id, {}); }; } - resolve4(response2); + resolve9(response2); }); }), - cancel: () => new Promise((resolve4) => { - if (didDispose) return resolve4(); + cancel: () => new Promise((resolve9) => { + if (didDispose) return resolve9(); const request2 = { command: "cancel", key: buildKey }; sendRequest(refs, request2, () => { - resolve4(); + resolve9(); }); }), - dispose: () => new Promise((resolve4) => { - if (didDispose) return resolve4(); + dispose: () => new Promise((resolve9) => { + if (didDispose) return resolve9(); didDispose = true; const request2 = { command: "dispose", key: buildKey }; sendRequest(refs, request2, () => { - resolve4(); + resolve9(); scheduleOnDisposeCallbacks(); refs.unref(); }); @@ -18442,7 +18483,7 @@ is not a problem with esbuild. You need to fix your environment instead. onLoad: [] }; i++; - let resolve4 = (path3, options = {}) => { + let resolve9 = (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); @@ -18486,7 +18527,7 @@ is not a problem with esbuild. You need to fix your environment instead. }; let promise2 = setup({ initialOptions, - resolve: resolve4, + resolve: resolve9, onStart(callback) { let registeredText = `This error came from the "onStart" callback registered here:`; let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); @@ -19373,46 +19414,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_ } }; longLivedService = { - build: (options) => new Promise((resolve4, reject) => { + build: (options) => new Promise((resolve9, reject) => { service.buildOrContext({ callName: "build", refs, options, isTTY: isTTY(), defaultWD, - callback: (err, res) => err ? reject(err) : resolve4(res) + callback: (err, res) => err ? reject(err) : resolve9(res) }); }), - context: (options) => new Promise((resolve4, reject) => service.buildOrContext({ + context: (options) => new Promise((resolve9, reject) => service.buildOrContext({ callName: "context", refs, options, isTTY: isTTY(), defaultWD, - callback: (err, res) => err ? reject(err) : resolve4(res) + callback: (err, res) => err ? reject(err) : resolve9(res) })), - transform: (input, options) => new Promise((resolve4, reject) => service.transform({ + transform: (input, options) => new Promise((resolve9, reject) => service.transform({ callName: "transform", refs, input, options: options || {}, isTTY: isTTY(), fs: fsAsync, - callback: (err, res) => err ? reject(err) : resolve4(res) + callback: (err, res) => err ? reject(err) : resolve9(res) })), - formatMessages: (messages, options) => new Promise((resolve4, reject) => service.formatMessages({ + formatMessages: (messages, options) => new Promise((resolve9, reject) => service.formatMessages({ callName: "formatMessages", refs, messages, options, - callback: (err, res) => err ? reject(err) : resolve4(res) + callback: (err, res) => err ? reject(err) : resolve9(res) })), - analyzeMetafile: (metafile, options) => new Promise((resolve4, reject) => service.analyzeMetafile({ + analyzeMetafile: (metafile, options) => new Promise((resolve9, reject) => service.analyzeMetafile({ callName: "analyzeMetafile", refs, metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), options, - callback: (err, res) => err ? reject(err) : resolve4(res) + callback: (err, res) => err ? reject(err) : resolve9(res) })) }; return longLivedService; @@ -19490,13 +19531,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: resolve4, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); + let { message: { id: id2, resolve: resolve9, 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 resolve4; + return resolve9; }; worker.unref(); return { @@ -19680,13 +19721,19 @@ var init_bundle = __esm({ esbuild = __toESM(require_main(), 1); HERE = import.meta.dirname; require2 = createRequire(import.meta.url); - EXTERNAL_PACKAGES = ["typescript"]; + EXTERNAL_PACKAGES = ["typescript", "@cdktf/hcl2json"]; } }); // node_modules/@intentius/chant/src/params.ts +function setBuildParams(values) { + for (const key of Object.keys(params)) delete params[key]; + Object.assign(params, values); +} +var params; var init_params = __esm({ "node_modules/@intentius/chant/src/params.ts"() { + params = {}; } }); @@ -19695,6 +19742,96 @@ import { dirname as dirname4, join as join4 } from "node:path"; function lit(value) { return JSON.stringify(value); } +function generateDriverSource(options) { + const { files, buildRoot } = options; + const lines = [ + `import { collectEntities } from ${lit(COLLECT_MODULE)};`, + `import { resolveAttrRefs } from ${lit(RESOLVE_MODULE)};`, + `import { encodeEntitySet } from ${lit(ENTITY_WIRE_CODEC_MODULE)};`, + `import { classifyChildError } from ${lit(CHILD_ERRORS_MODULE)};`, + `import { getProvenance } from ${lit(PROVENANCE_MODULE)};`, + `import { setBuildParams } from ${lit(PARAMS_MODULE)};`, + ``, + `const BUILD_ROOT = ${lit(buildRoot)};`, + ``, + // chant #1108 — a snapshot of the PARENT's resolved build-time parameter + // values, embedded as a literal at generation time (the parent bound them + // via applyBuildParams/discover() before this source was generated). + // Values are declared-scalar only (BuildParamValue), so JSON round-trips + // 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));`, + `}`, + ``, + // collectEntities (bundled, real DiscoveryError instances) already names + // the exact offending file on a same-directory duplicate — reuse that + // instead of reporting an empty file, which is what forwarding a bare "" + // through classifyChildError would otherwise do. + `function errFile(err) {`, + ` return err && typeof err === "object" && typeof err.file === "string" ? err.file : "";`, + `}`, + ``, + `async function main() {`, + ` const modules = [];`, + ` const errors = [];` + ]; + for (const file2 of files) { + lines.push( + ` try {`, + ` const mod = await import(${lit(file2)});`, + ` modules.push({ file: ${lit(file2)}, exports: mod });`, + ` } catch (err) {`, + ` errors.push(classifyChildError(${lit(file2)}, err).toJSON());`, + ` }` + ); + } + lines.push( + ``, + ` let entities = new Map();`, + ` try {`, + ` entities = collectEntities(modules, BUILD_ROOT);`, + ` } catch (err) {`, + ` errors.push(classifyChildError(errFile(err), err, "resolution").toJSON());`, + ` send({ entitySet: { entities: [] }, errors, provenanceByName: {} });`, + ` return;`, + ` }`, + ``, + // Recorded BEFORE resolveAttrRefs/encode — not for the parent's own + // entities (it never sees this subset's raw exports at all), but so a + // parent-side merge collision against the fold-only set (chant#1045 + // Phase 2 — a same-directory bare name genuinely exported twice, once + // folded, once run) can name the real run-fallback file instead of the + // entity name. See discover()'s merge step in ../index.ts. + ` const provenanceByName = {};`, + ` for (const [name, entity] of entities) {`, + ` const prov = getProvenance(entity);`, + ` if (prov?.sourceFile) provenanceByName[name] = prov.sourceFile;`, + ` }`, + ``, + ` try {`, + ` resolveAttrRefs(entities);`, + ` } catch (err) {`, + ` errors.push(classifyChildError("", err, "resolution").toJSON());`, + ` }`, + ``, + ` try {`, + ` const entitySet = encodeEntitySet(entities);`, + ` send({ entitySet, errors, provenanceByName });`, + ` } catch (err) {`, + ` errors.push(classifyChildError("", err, "resolution").toJSON());`, + ` send({ entitySet: { entities: [] }, errors, provenanceByName });`, + ` }`, + `}`, + ``, + `main().catch((err) => {`, + ` send({ entitySet: { entities: [] }, errors: [classifyChildError("", err).toJSON()], provenanceByName: {}, fatal: true });`, + `});` + ); + return lines.join("\n"); +} function generateConfigDriverSource(configPath) { return [ `import { classifyChildError } from ${lit(CHILD_ERRORS_MODULE)};`, @@ -19965,8 +20102,67 @@ var init_config_sandbox = __esm({ }); // node_modules/@intentius/chant/src/config.ts +var config_exports = {}; +__export(config_exports, { + ChantConfigSchema: () => ChantConfigSchema, + DEFAULT_CHANT_CONFIG: () => DEFAULT_CHANT_CONFIG, + environmentEndpoint: () => environmentEndpoint, + environmentName: () => environmentName, + environmentNames: () => environmentNames, + isEnvironmentPattern: () => isEnvironmentPattern, + isOwnershipParamRef: () => isOwnershipParamRef, + loadChantConfig: () => loadChantConfig, + loadChantConfigUpward: () => loadChantConfigUpward, + matchesDeclaredEnvironment: () => matchesDeclaredEnvironment, + matchesEnvironmentPattern: () => matchesEnvironmentPattern, + ownershipEnvDisagreement: () => ownershipEnvDisagreement, + resolveAutoReleaseDisabled: () => resolveAutoReleaseDisabled, + resolveFoldEnabled: () => resolveFoldEnabled, + resolveKnowledgeDir: () => resolveKnowledgeDir, + resolveOwnershipEnv: () => resolveOwnershipEnv, + resolveOwnershipMarker: () => resolveOwnershipMarker, + resolveOwnershipStack: () => resolveOwnershipStack, + resolveSandboxEnabled: () => resolveSandboxEnabled, + resolveSbomFormat: () => resolveSbomFormat, + resolveSigningDefaults: () => resolveSigningDefaults, + resolveVulnPolicy: () => resolveVulnPolicy +}); import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs"; import { dirname as dirname6, join as join5 } from "path"; +function environmentName(entry) { + return typeof entry === "string" ? entry : entry.name; +} +function environmentNames(environments) { + return environments?.map(environmentName); +} +function isEnvironmentPattern(declaredName) { + return declaredName.includes("*"); +} +function matchesEnvironmentPattern(pattern, name) { + const parts = pattern.split("*"); + if (parts.length === 1) return pattern === name; + const first = parts[0]; + const last = parts[parts.length - 1]; + if (!name.startsWith(first)) return false; + let cursor = first.length; + for (let i = 1; i < parts.length - 1; i++) { + const part = parts[i]; + if (part === "") continue; + const at = name.indexOf(part, cursor); + if (at === -1) return false; + cursor = at + part.length; + } + return name.length - cursor >= last.length && name.endsWith(last); +} +function matchesDeclaredEnvironment(environments, name) { + const names = environmentNames(environments) ?? []; + if (names.includes(name)) return true; + return names.some((declared) => isEnvironmentPattern(declared) && matchesEnvironmentPattern(declared, name)); +} +function environmentEndpoint(environments, name) { + const found = environments?.find((e) => environmentName(e) === name) ?? environments?.find((e) => isEnvironmentPattern(environmentName(e)) && matchesEnvironmentPattern(environmentName(e), name)); + return found && typeof found !== "string" ? found.endpoint : void 0; +} async function loadChantConfig(dir) { const tsPath = join5(dir, "chant.config.ts"); if (existsSync3(tsPath)) { @@ -19975,8 +20171,8 @@ async function loadChantConfig(dir) { } const jsonPath = join5(dir, "chant.config.json"); if (existsSync3(jsonPath)) { - const { readFileSync: readFileSync8 } = await import("fs"); - const content = readFileSync8(jsonPath, "utf-8"); + const { readFileSync: readFileSync10 } = await import("fs"); + const content = readFileSync10(jsonPath, "utf-8"); const parsed = JSON.parse(content); return { config: normalizeConfig(parsed, jsonPath), configPath: jsonPath }; } @@ -20018,6 +20214,94 @@ function warnIfFragmentShadowsProjectConfig(configPath) { } catch { } } +function isOwnershipParamRef(env2) { + return typeof env2 === "object" && env2 !== null && typeof env2.param === "string"; +} +function resolveOwnershipStack(config2) { + const o = config2.ownership; + if (!o || !o.stack || o.enabled === false) return void 0; + return o.stack; +} +function resolveOwnershipEnv(config2, buildParams) { + const env2 = config2.ownership?.env; + if (!isOwnershipParamRef(env2)) return env2; + const name = env2.param; + const declared = config2.buildParams?.[name]; + if (!declared) { + throw new Error( + `ownership.env references build parameter "${name}", which chant.config.ts's buildParams does not declare` + ); + } + const resolved = buildParams?.find((p) => p.name === name); + if (!resolved) { + throw new Error( + `ownership.env references build parameter "${name}", which resolved to no value for this build \u2014 pass --param ${name}=${declared.env ? `, set ${declared.env}` : ""}, or give it a default` + ); + } + return String(resolved.value); +} +function resolveOwnershipMarker(config2, buildParams) { + const stack = resolveOwnershipStack(config2); + if (stack === void 0) return void 0; + return { stack, env: resolveOwnershipEnv(config2, buildParams) }; +} +function ownershipEnvDisagreement(config2, buildParams) { + const literal2 = config2.ownership?.env; + if (typeof literal2 !== "string") return void 0; + if (resolveOwnershipStack(config2) === void 0) return void 0; + const param = buildParams?.find((p) => p.name === "env"); + if (!param || String(param.value) === literal2) return void 0; + return `ownership.env is "${literal2}" but the env build parameter resolved to ${JSON.stringify(param.value)} (${param.source}) \u2014 the ownership marker and params.env disagree about which environment this build is for. Use ownership: { env: { param: "env" } } so the marker follows the parameter.`; +} +function resolveAutoReleaseDisabled(config2, cliFlag) { + if (cliFlag) return true; + return config2.release?.autoRecord === false; +} +function resolveFoldEnabled(config2, cliFlag) { + if (cliFlag !== void 0) return cliFlag; + if (config2.build?.fold !== void 0) return config2.build.fold; + return true; +} +function resolveSandboxEnabled(config2, cliFlag) { + if (cliFlag) return true; + return config2.build?.sandbox === true; +} +function resolveSbomFormat(config2, stepFormat) { + return stepFormat ?? config2.sbom?.format ?? DEFAULT_SBOM_FORMAT; +} +function resolveSigningDefaults(config2) { + const s = config2.signing; + const keyless = s?.keyless !== false; + return { + keyless, + ...!keyless && s?.key ? { key: { key: s.key } } : {}, + identityPolicyDefaults: { + expectedIssuer: s?.oidcIssuer, + expectedIdentity: s?.identity, + identityIsRegexp: s?.identityIsRegexp, + key: s?.keyless === false ? s?.key : void 0 + } + }; +} +function resolveVulnPolicy(config2) { + const v = config2.vulnPolicy; + if (!v) return {}; + const out = {}; + if (v.failSeverity) out.failSeverity = v.failSeverity; + if (v.fixableOnly !== void 0) out.fixableOnly = v.fixableOnly; + if (v.warnSeverity) out.warnSeverity = v.warnSeverity; + if (v.failOnLicense !== void 0) out.failOnLicense = v.failOnLicense; + if (v.failOnUnknownSeverity !== void 0) out.failOnUnknownSeverity = v.failOnUnknownSeverity; + if (v.failOnKev !== void 0) out.failOnKev = v.failOnKev; + if (v.failEpssAtOrAbove !== void 0) out.failEpssAtOrAbove = v.failEpssAtOrAbove; + if (v.warnEpssAtOrAbove !== void 0) out.warnEpssAtOrAbove = v.warnEpssAtOrAbove; + if (v.exploitabilityFixableOnly !== void 0) out.exploitabilityFixableOnly = v.exploitabilityFixableOnly; + if (v.license) out.license = v.license; + return out; +} +function resolveKnowledgeDir(config2, projectPath) { + return join5(projectPath, config2.knowledge?.dir ?? "knowledge"); +} function normalizeConfig(raw, source) { if (typeof raw !== "object" || raw === null) { return DEFAULT_CHANT_CONFIG; @@ -20113,6 +20397,12 @@ var init_config = __esm({ }); // 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"() { @@ -20120,24 +20410,196 @@ var init_declarable = __esm({ } }); +// 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"); } }); @@ -20182,14 +20644,31 @@ var init_intrinsic = __esm({ }); // 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 }; +} +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"); } }); // 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"() { } @@ -20202,8 +20681,72 @@ var init_types = __esm({ }); // 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 + }; + } + }; } }); @@ -20234,6 +20777,34 @@ var init_attrref = __esm({ 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 @@ -20259,9 +20830,24 @@ 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"); } }); @@ -20283,6 +20869,9 @@ function sanitizeLogicalId(...parts) { 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"() { @@ -20468,13 +21057,131 @@ var init_files = __esm({ }); // 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(); @@ -20482,16 +21189,118 @@ var init_collect = __esm({ 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; +} var init_sort = __esm({ "node_modules/@intentius/chant/src/sort.ts"() { init_errors3(); @@ -20500,6 +21309,38 @@ var init_sort = __esm({ }); // 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); + } + } + } +} var init_resolve = __esm({ "node_modules/@intentius/chant/src/discovery/resolve.ts"() { init_utils(); @@ -20507,6 +21348,91 @@ var init_resolve = __esm({ }); // 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 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 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; + } + scanProperties(value, entities, entityToName, dependencies, visited, rootEntity); +} var init_graph = __esm({ "node_modules/@intentius/chant/src/discovery/graph.ts"() { init_declarable(); @@ -20517,7 +21443,7 @@ var init_graph = __esm({ // node_modules/typescript/lib/typescript.js var require_typescript = __commonJS({ "node_modules/typescript/lib/typescript.js"(exports, module) { - var ts33 = {}; + var ts34 = {}; ((module2) => { "use strict"; var __defProp2 = Object.defineProperty; @@ -21098,7 +22024,7 @@ var require_typescript = __commonJS({ forEachAncestor: () => forEachAncestor, forEachAncestorDirectory: () => forEachAncestorDirectory, forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache, - forEachChild: () => forEachChild26, + forEachChild: () => forEachChild27, forEachChildRecursively: () => forEachChildRecursively, forEachDynamicImportOrRequireCall: () => forEachDynamicImportOrRequireCall, forEachEmittedFile: () => forEachEmittedFile, @@ -21723,7 +22649,7 @@ var require_typescript = __commonJS({ isBuilderProgram: () => isBuilderProgram, isBundle: () => isBundle, isCallChain: () => isCallChain, - isCallExpression: () => isCallExpression14, + isCallExpression: () => isCallExpression16, isCallExpressionTarget: () => isCallExpressionTarget, isCallLikeExpression: () => isCallLikeExpression, isCallLikeOrFunctionLikeExpression: () => isCallLikeOrFunctionLikeExpression, @@ -21879,7 +22805,7 @@ var require_typescript = __commonJS({ isHeritageClause: () => isHeritageClause, isHoistedFunction: () => isHoistedFunction, isHoistedVariableStatement: () => isHoistedVariableStatement, - isIdentifier: () => isIdentifier25, + isIdentifier: () => isIdentifier26, isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword, isIdentifierName: () => isIdentifierName, isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode, @@ -22085,7 +23011,7 @@ var require_typescript = __commonJS({ isNamespaceExportDeclaration: () => isNamespaceExportDeclaration, isNamespaceImport: () => isNamespaceImport5, isNamespaceReexportDeclaration: () => isNamespaceReexportDeclaration, - isNewExpression: () => isNewExpression17, + isNewExpression: () => isNewExpression19, isNewExpressionTarget: () => isNewExpressionTarget, isNewScopeNode: () => isNewScopeNode, isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral5, @@ -22118,7 +23044,7 @@ var require_typescript = __commonJS({ isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor, isObjectTypeDeclaration: () => isObjectTypeDeclaration, isOmittedExpression: () => isOmittedExpression, - isOptionalChain: () => isOptionalChain, + isOptionalChain: () => isOptionalChain2, isOptionalChainRoot: () => isOptionalChainRoot, isOptionalDeclaration: () => isOptionalDeclaration, isOptionalJSDocPropertyLikeTag: () => isOptionalJSDocPropertyLikeTag, @@ -22155,7 +23081,7 @@ var require_typescript = __commonJS({ isPrologueDirective: () => isPrologueDirective, isPropertyAccessChain: () => isPropertyAccessChain, isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression, - isPropertyAccessExpression: () => isPropertyAccessExpression15, + isPropertyAccessExpression: () => isPropertyAccessExpression16, isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName, isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode, isPropertyAssignment: () => isPropertyAssignment11, @@ -22241,9 +23167,9 @@ var require_typescript = __commonJS({ isSyntheticExpression: () => isSyntheticExpression, isSyntheticReference: () => isSyntheticReference, isTagName: () => isTagName, - isTaggedTemplateExpression: () => isTaggedTemplateExpression4, + isTaggedTemplateExpression: () => isTaggedTemplateExpression5, isTaggedTemplateTag: () => isTaggedTemplateTag, - isTemplateExpression: () => isTemplateExpression4, + isTemplateExpression: () => isTemplateExpression5, isTemplateHead: () => isTemplateHead, isTemplateLiteral: () => isTemplateLiteral, isTemplateLiteralKind: () => isTemplateLiteralKind, @@ -22308,7 +23234,7 @@ var require_typescript = __commonJS({ isVarConst: () => isVarConst, isVarConstLike: () => isVarConstLike, isVarUsing: () => isVarUsing, - isVariableDeclaration: () => isVariableDeclaration6, + isVariableDeclaration: () => isVariableDeclaration7, isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement, isVariableDeclarationInitializedToBareOrAccessedRequire: () => isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire, @@ -22526,7 +23452,7 @@ var require_typescript = __commonJS({ resolveModuleName: () => resolveModuleName, resolveModuleNameFromCache: () => resolveModuleNameFromCache, resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson, - resolvePath: () => resolvePath2, + resolvePath: () => resolvePath3, resolveProjectReferencePath: () => resolveProjectReferencePath, resolveTripleslashReference: () => resolveTripleslashReference, resolveTypeReferenceDirective: () => resolveTypeReferenceDirective, @@ -24861,7 +25787,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" : isIdentifier25(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" : 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); return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; } }, @@ -29112,7 +30038,7 @@ ${lanes.join("\n")} writeOutputIsTTY() { return process.stdout.isTTY; }, - readFile: readFile2, + readFile: readFile4, writeFile: writeFile2, watchFile: watchFile2, watchDirectory, @@ -29153,7 +30079,7 @@ ${lanes.join("\n")} return process.memoryUsage().heapUsed; }, getFileSize(path) { - const stat2 = statSync3(path); + const stat2 = statSync4(path); if (stat2 == null ? void 0 : stat2.isFile()) { return stat2.size; } @@ -29197,7 +30123,7 @@ ${lanes.join("\n")} } }; return nodeSystem; - function statSync3(path) { + function statSync4(path) { try { return _fs.statSync(path, statSyncOptions); } catch { @@ -29256,7 +30182,7 @@ ${lanes.join("\n")} activeSession.post("Profiler.stop", (err, { profile }) => { var _a3; if (!err) { - if ((_a3 = statSync3(profilePath)) == null ? void 0 : _a3.isDirectory()) { + if ((_a3 = statSync4(profilePath)) == null ? void 0 : _a3.isDirectory()) { profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`); } try { @@ -29318,7 +30244,7 @@ ${lanes.join("\n")} callback ); } - function readFile2(fileName, _encoding) { + function readFile4(fileName, _encoding) { let buffer; try { buffer = _fs.readFileSync(fileName); @@ -29376,7 +30302,7 @@ ${lanes.join("\n")} let stat2; if (typeof dirent === "string" || dirent.isSymbolicLink()) { const name = combinePaths(path, entry); - stat2 = statSync3(name); + stat2 = statSync4(name); if (!stat2) { continue; } @@ -29400,7 +30326,7 @@ ${lanes.join("\n")} return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath); } function fileSystemEntryExists(path, entryKind) { - const stat2 = statSync3(path); + const stat2 = statSync4(path); if (!stat2) { return false; } @@ -29442,7 +30368,7 @@ ${lanes.join("\n")} } function getModifiedTime3(path) { var _a3; - return (_a3 = statSync3(path)) == null ? void 0 : _a3.mtime; + return (_a3 = statSync4(path)) == null ? void 0 : _a3.mtime; } function setModifiedTime(path, time3) { try { @@ -29679,7 +30605,7 @@ ${lanes.join("\n")} } return path; } - function resolvePath2(path, ...paths) { + function resolvePath3(path, ...paths) { return normalizePath(some(paths) ? combinePaths(path, ...paths) : normalizeSlashes(path)); } function getNormalizedPathComponents(path, currentDirectory) { @@ -29906,11 +30832,11 @@ ${lanes.join("\n")} return toComponents; } const components = toComponents.slice(start); - const relative3 = []; + const relative7 = []; for (; start < fromComponents.length; start++) { - relative3.push(".."); + relative7.push(".."); } - return ["", ...relative3, ...components]; + return ["", ...relative7, ...components]; } function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative"); @@ -29934,8 +30860,8 @@ ${lanes.join("\n")} } function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { const pathComponents2 = getPathComponentsRelativeTo( - resolvePath2(currentDirectory, directoryPathOrUrl), - resolvePath2(currentDirectory, relativeOrAbsolutePath), + resolvePath3(currentDirectory, directoryPathOrUrl), + resolvePath3(currentDirectory, relativeOrAbsolutePath), equateStringsCaseSensitive, getCanonicalFileName ); @@ -35927,7 +36853,7 @@ ${lanes.join("\n")} return expr.name; case 213: const arg = expr.argumentExpression; - if (isIdentifier25(arg)) { + if (isIdentifier26(arg)) { return arg; } } @@ -35945,10 +36871,10 @@ ${lanes.join("\n")} } function getDeclarationIdentifier(node) { const name = getNameOfDeclaration(node); - return name && isIdentifier25(name) ? name : void 0; + return name && isIdentifier26(name) ? name : void 0; } function nodeHasName(statement, name) { - if (isNamedDeclaration(statement) && isIdentifier25(statement.name) && idText(statement.name) === idText(name)) { + if (isNamedDeclaration(statement) && isIdentifier26(statement.name) && idText(statement.name) === idText(name)) { return true; } if (isVariableStatement10(statement) && some(statement.declarationList.declarations, (d) => nodeHasName(d, name))) { @@ -35997,7 +36923,7 @@ ${lanes.join("\n")} return nameForNamelessJSDocTypedef(declaration); case 278: { const { expression } = declaration; - return isIdentifier25(expression) ? expression : void 0; + return isIdentifier26(expression) ? expression : void 0; } case 213: const expr = declaration; @@ -36017,12 +36943,12 @@ ${lanes.join("\n")} } else if (isPropertyAssignment11(node.parent) || isBindingElement(node.parent)) { return node.parent.name; } else if (isBinaryExpression4(node.parent) && node === node.parent.right) { - if (isIdentifier25(node.parent.left)) { + if (isIdentifier26(node.parent.left)) { return node.parent.left; } else if (isAccessExpression(node.parent.left)) { return getElementOrPropertyAccessArgumentExpressionOrName(node.parent.left); } - } else if (isVariableDeclaration6(node.parent) && isIdentifier25(node.parent.name)) { + } else if (isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name)) { return node.parent.name; } } @@ -36042,9 +36968,9 @@ ${lanes.join("\n")} } function getJSDocParameterTagsWorker(param, noCache) { if (param.name) { - if (isIdentifier25(param.name)) { + if (isIdentifier26(param.name)) { const name = param.name.escapedText; - return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier25(tag.name) && tag.name.escapedText === name); + return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier26(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"); @@ -36294,32 +37220,32 @@ ${lanes.join("\n")} return node.kind === 179 || node.kind === 178; } function isPropertyAccessChain(node) { - return isPropertyAccessExpression15(node) && !!(node.flags & 64); + return isPropertyAccessExpression16(node) && !!(node.flags & 64); } function isElementAccessChain(node) { return isElementAccessExpression8(node) && !!(node.flags & 64); } function isCallChain(node) { - return isCallExpression14(node) && !!(node.flags & 64); + return isCallExpression16(node) && !!(node.flags & 64); } - function isOptionalChain(node) { + function isOptionalChain2(node) { const kind = node.kind; return !!(node.flags & 64) && (kind === 212 || kind === 213 || kind === 214 || kind === 236); } function isOptionalChainRoot(node) { - return isOptionalChain(node) && !isNonNullExpression5(node) && !!node.questionDotToken; + return isOptionalChain2(node) && !isNonNullExpression5(node) && !!node.questionDotToken; } function isExpressionOfOptionalChainRoot(node) { return isOptionalChainRoot(node.parent) && node.parent.expression === node; } function isOutermostOptionalChain(node) { - return !isOptionalChain(node.parent) || isOptionalChainRoot(node.parent) || node !== node.parent.expression; + return !isOptionalChain2(node.parent) || isOptionalChainRoot(node.parent) || node !== node.parent.expression; } function isNullishCoalesce(node) { return node.kind === 227 && node.operatorToken.kind === 61; } function isConstTypeReference(node) { - return isTypeReferenceNode3(node) && isIdentifier25(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; + return isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; } function skipPartiallyEmittedExpressions(node) { return skipOuterExpressions( @@ -36416,11 +37342,11 @@ ${lanes.join("\n")} return node.kind === 11 || isTemplateLiteralKind(node.kind); } function isImportAttributeName(node) { - return isStringLiteral15(node) || isIdentifier25(node); + return isStringLiteral15(node) || isIdentifier26(node); } function isGeneratedIdentifier(node) { var _a3; - return isIdentifier25(node) && ((_a3 = node.emitNode) == null ? void 0 : _a3.autoGenerate) !== void 0; + return isIdentifier26(node) && ((_a3 = node.emitNode) == null ? void 0 : _a3.autoGenerate) !== void 0; } function isGeneratedPrivateIdentifier(node) { var _a3; @@ -36434,7 +37360,7 @@ ${lanes.join("\n")} return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name); } function isPrivateIdentifierPropertyAccessExpression(node) { - return isPropertyAccessExpression15(node) && isPrivateIdentifier(node.name); + return isPropertyAccessExpression16(node) && isPrivateIdentifier(node.name); } function isModifierKind(token) { switch (token) { @@ -36605,7 +37531,7 @@ ${lanes.join("\n")} return false; } function isBindingOrAssignmentElement(node) { - return isVariableDeclaration6(node) || isParameter(node) || isObjectBindingOrAssignmentElement(node) || isArrayBindingOrAssignmentElement(node); + return isVariableDeclaration7(node) || isParameter(node) || isObjectBindingOrAssignmentElement(node) || isArrayBindingOrAssignmentElement(node); } function isBindingOrAssignmentPattern(node) { return isObjectBindingOrAssignmentPattern(node) || isArrayBindingOrAssignmentPattern(node); @@ -37395,7 +38321,7 @@ ${lanes.join("\n")} } function aggregateChildData(node) { if (!(node.flags & 2097152)) { - const thisNodeOrAnySubNodesHasError = (node.flags & 262144) !== 0 || forEachChild26(node, containsParseError); + const thisNodeOrAnySubNodesHasError = (node.flags & 262144) !== 0 || forEachChild27(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.flags |= 1048576; } @@ -38266,7 +39192,7 @@ ${lanes.join("\n")} return isModuleDeclaration(node) && isStringLiteral15(node.name); } function isEffectiveModuleDeclaration(node) { - return isModuleDeclaration(node) || isIdentifier25(node); + return isModuleDeclaration(node) || isIdentifier26(node); } function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); @@ -38489,7 +39415,7 @@ ${lanes.join("\n")} case 167: return entityNameToString(name.left) + "." + entityNameToString(name.right); case 212: - if (isIdentifier25(name.name) || isPrivateIdentifier(name.name)) { + if (isIdentifier26(name.name) || isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return Debug.assertNever(name.name); @@ -38764,7 +39690,7 @@ ${lanes.join("\n")} return isCustomPrologue(node) && isFunctionDeclaration3(node); } function isHoistedVariable(node) { - return isIdentifier25(node.name) && !node.initializer; + return isIdentifier26(node.name) && !node.initializer; } function isHoistedVariableStatement(node) { return isCustomPrologue(node) && isVariableStatement10(node) && every(node.declarationList.declarations, isHoistedVariable); @@ -38893,7 +39819,7 @@ ${lanes.join("\n")} case 257: case 259: case 300: - return forEachChild26(node, traverse); + return forEachChild27(node, traverse); } } } @@ -38920,7 +39846,7 @@ ${lanes.join("\n")} return; } } else if (!isPartOfTypeNode(node)) { - forEachChild26(node, traverse); + forEachChild27(node, traverse); } } } @@ -38973,7 +39899,7 @@ ${lanes.join("\n")} return isBinaryExpression4(node) && getAssignmentDeclarationKind(node) === 1; } function isValidESSymbolDeclaration(node) { - return (isVariableDeclaration6(node) ? isVarConst(node) && isIdentifier25(node.name) && isVariableDeclarationInVariableStatement(node) : isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : isPropertySignature3(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node); + return (isVariableDeclaration7(node) ? isVarConst(node) && isIdentifier26(node.name) && isVariableDeclarationInVariableStatement(node) : isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : isPropertySignature3(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node); } function introducesArgumentsExoticObject(node) { switch (node.kind) { @@ -39130,7 +40056,7 @@ ${lanes.join("\n")} } } function isInTopLevelContext(node) { - if (isIdentifier25(node) && (isClassDeclaration5(node.parent) || isFunctionDeclaration3(node.parent)) && node.parent.name === node) { + if (isIdentifier26(node) && (isClassDeclaration5(node.parent) || isFunctionDeclaration3(node.parent)) && node.parent.name === node) { node = node.parent; } const container = getThisContainer( @@ -39219,7 +40145,7 @@ ${lanes.join("\n")} } function isThisInitializedDeclaration(node) { var _a3; - return !!node && isVariableDeclaration6(node) && ((_a3 = node.initializer) == null ? void 0 : _a3.kind) === 110; + 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; @@ -39500,7 +40426,7 @@ ${lanes.join("\n")} return !!node && !!(node.flags & 16777216); } function isJSDocIndexSignature(node) { - return isTypeReferenceNode3(node) && isIdentifier25(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) && isIdentifier26(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) { @@ -39534,7 +40460,7 @@ ${lanes.join("\n")} return isBindingElement(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) { - return isVariableDeclaration6(node) && !!node.initializer && isRequireCall( + return isVariableDeclaration7(node) && !!node.initializer && isRequireCall( allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true @@ -39550,7 +40476,7 @@ ${lanes.join("\n")} return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34; } function isAssignmentDeclaration(decl) { - return isBinaryExpression4(decl) || isAccessExpression(decl) || isIdentifier25(decl) || isCallExpression14(decl); + return isBinaryExpression4(decl) || isAccessExpression(decl) || isIdentifier26(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)) { @@ -39563,14 +40489,14 @@ ${lanes.join("\n")} return init && getExpandoInitializer(init, isPrototypeAccess(node.name)); } function hasExpandoValueProperty(node, isPrototypeAssignment) { - return forEach(node.properties, (p) => isPropertyAssignment11(p) && isIdentifier25(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment)); + return forEach(node.properties, (p) => isPropertyAssignment11(p) && isIdentifier26(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) { const isPrototypeAssignment = isPrototypeAccess(node.parent.left); return getExpandoInitializer(node.parent.right, isPrototypeAssignment) || getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment); } - if (node && isCallExpression14(node) && isBindableObjectDefinePropertyCall(node)) { + if (node && isCallExpression16(node) && isBindableObjectDefinePropertyCall(node)) { const result = hasExpandoValueProperty(node.arguments[2], node.arguments[1].text === "prototype"); if (result) { return result; @@ -39578,7 +40504,7 @@ ${lanes.join("\n")} } } function getExpandoInitializer(initializer3, isPrototypeAssignment) { - if (isCallExpression14(initializer3)) { + if (isCallExpression16(initializer3)) { const e = skipParentheses(initializer3.expression); return e.kind === 219 || e.kind === 220 ? initializer3 : void 0; } @@ -39596,16 +40522,16 @@ ${lanes.join("\n")} } } function isDefaultedExpandoInitializer(node) { - const name = isVariableDeclaration6(node.parent) ? node.parent.name : isBinaryExpression4(node.parent) && node.parent.operatorToken.kind === 64 ? node.parent.left : void 0; + const name = isVariableDeclaration7(node.parent) ? node.parent.name : isBinaryExpression4(node.parent) && node.parent.operatorToken.kind === 64 ? node.parent.left : void 0; return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left); } 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 && isIdentifier25(parent2.left)) { + if (parent2.operatorToken.kind === 64 && isIdentifier26(parent2.left)) { return parent2.left; } - } else if (isVariableDeclaration6(node.parent)) { + } else if (isVariableDeclaration7(node.parent)) { return node.parent.name; } } @@ -39613,7 +40539,7 @@ ${lanes.join("\n")} if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer3)) { return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer3); } - if (isMemberName(name) && isLiteralLikeAccess(initializer3) && (initializer3.expression.kind === 110 || isIdentifier25(initializer3.expression) && (initializer3.expression.escapedText === "window" || initializer3.expression.escapedText === "self" || initializer3.expression.escapedText === "global"))) { + if (isMemberName(name) && isLiteralLikeAccess(initializer3) && (initializer3.expression.kind === 110 || isIdentifier26(initializer3.expression) && (initializer3.expression.escapedText === "window" || initializer3.expression.escapedText === "self" || initializer3.expression.escapedText === "global"))) { return isSameEntityName(name, getNameOrArgument(initializer3)); } if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer3)) { @@ -39632,33 +40558,33 @@ ${lanes.join("\n")} return node; } function isExportsIdentifier(node) { - return isIdentifier25(node) && node.escapedText === "exports"; + return isIdentifier26(node) && node.escapedText === "exports"; } function isModuleIdentifier(node) { - return isIdentifier25(node) && node.escapedText === "module"; + return isIdentifier26(node) && node.escapedText === "module"; } function isModuleExportsAccessExpression(node) { - return (isPropertyAccessExpression15(node) || isLiteralLikeElementAccess(node)) && isModuleIdentifier(node.expression) && getElementOrPropertyAccessName(node) === "exports"; + return (isPropertyAccessExpression16(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 && isPropertyAccessExpression15(expr.expression) && isIdentifier25(expr.expression.expression) && idText(expr.expression.expression) === "Object" && idText(expr.expression.name) === "defineProperty" && isStringOrNumericLiteralLike(expr.arguments[1]) && isBindableStaticNameExpression( + 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( expr.arguments[0], /*excludeThisKeyword*/ true ); } function isLiteralLikeAccess(node) { - return isPropertyAccessExpression15(node) || isLiteralLikeElementAccess(node); + return isPropertyAccessExpression16(node) || isLiteralLikeElementAccess(node); } function isLiteralLikeElementAccess(node) { return isElementAccessExpression8(node) && isStringOrNumericLiteralLike(node.argumentExpression); } function isBindableStaticAccessExpression(node, excludeThisKeyword) { - return isPropertyAccessExpression15(node) && (!excludeThisKeyword && node.expression.kind === 110 || isIdentifier25(node.name) && isBindableStaticNameExpression( + return isPropertyAccessExpression16(node) && (!excludeThisKeyword && node.expression.kind === 110 || isIdentifier26(node.name) && isBindableStaticNameExpression( node.expression, /*excludeThisKeyword*/ true @@ -39675,13 +40601,13 @@ ${lanes.join("\n")} return isEntityNameExpression(node) || isBindableStaticAccessExpression(node, excludeThisKeyword); } function getNameOrArgument(expr) { - if (isPropertyAccessExpression15(expr)) { + if (isPropertyAccessExpression16(expr)) { return expr.name; } return expr.argumentExpression; } function getAssignmentDeclarationKindWorker(expr) { - if (isCallExpression14(expr)) { + if (isCallExpression16(expr)) { if (!isBindableObjectDefinePropertyCall(expr)) { return 0; } @@ -39710,7 +40636,7 @@ ${lanes.join("\n")} return isVoidExpression(node) && isNumericLiteral5(node.expression) && node.expression.text === "0"; } function getElementOrPropertyAccessArgumentExpressionOrName(node) { - if (isPropertyAccessExpression15(node)) { + if (isPropertyAccessExpression16(node)) { return node.name; } const arg = skipParentheses(node.argumentExpression); @@ -39722,7 +40648,7 @@ ${lanes.join("\n")} function getElementOrPropertyAccessName(node) { const name = getElementOrPropertyAccessArgumentExpressionOrName(node); if (name) { - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { return name.escapedText; } if (isStringLiteralLike4(name) || isNumericLiteral5(name)) { @@ -39745,7 +40671,7 @@ ${lanes.join("\n")} return 3; } let nextToLast = lhs; - while (!isIdentifier25(nextToLast.expression)) { + while (!isIdentifier26(nextToLast.expression)) { nextToLast = nextToLast.expression; } const id = nextToLast.expression; @@ -39786,7 +40712,7 @@ ${lanes.join("\n")} return false; } const decl = symbol2.valueDeclaration; - return decl.kind === 263 || isVariableDeclaration6(decl) && decl.initializer && isFunctionLike(decl.initializer); + return decl.kind === 263 || isVariableDeclaration7(decl) && decl.initializer && isFunctionLike(decl.initializer); } function canHaveModuleSpecifier(node) { switch (node == null ? void 0 : node.kind) { @@ -39922,7 +40848,7 @@ ${lanes.join("\n")} } function isJSDocConstructSignature(node) { const param = isJSDocFunctionType(node) ? firstOrUndefined(node.parameters) : void 0; - const name = tryCast(param && param.name, isIdentifier25); + const name = tryCast(param && param.name, isIdentifier26); return !!name && name.escapedText === "new"; } function isJSDocTypeAlias(node) { @@ -40100,7 +41026,7 @@ ${lanes.join("\n")} if (node.symbol) { return node.symbol; } - if (!isIdentifier25(node.name)) { + if (!isIdentifier26(node.name)) { return void 0; } const name = node.name.escapedText; @@ -40608,7 +41534,7 @@ ${lanes.join("\n")} return startsWith(symbol2.escapedName, "__#"); } function isProtoSetter(node) { - return isIdentifier25(node) ? idText(node) === "__proto__" : isStringLiteral15(node) && node.text === "__proto__"; + return isIdentifier26(node) ? idText(node) === "__proto__" : isStringLiteral15(node) && node.text === "__proto__"; } function isAnonymousFunctionDefinition(node, cb) { node = skipOuterExpressions(node); @@ -40637,11 +41563,11 @@ ${lanes.join("\n")} case 305: return !!node.objectAssignmentInitializer; case 261: - return isIdentifier25(node.name) && !!node.initializer; + return isIdentifier26(node.name) && !!node.initializer; case 170: - return isIdentifier25(node.name) && !!node.initializer && !node.dotDotDotToken; + return isIdentifier26(node.name) && !!node.initializer && !node.dotDotDotToken; case 209: - return isIdentifier25(node.name) && !!node.initializer && !node.dotDotDotToken; + return isIdentifier26(node.name) && !!node.initializer && !node.dotDotDotToken; case 173: return !!node.initializer; case 227: @@ -40650,7 +41576,7 @@ ${lanes.join("\n")} case 77: case 76: case 78: - return isIdentifier25(node.left); + return isIdentifier26(node.left); } break; case 278: @@ -41369,7 +42295,7 @@ ${lanes.join("\n")} ]; } function getPossibleOriginalInputPathWithoutChangingExt(filePath, ignoreCase, outputDir, getCommonSourceDirectory2) { - return outputDir ? resolvePath2( + return outputDir ? resolvePath3( getCommonSourceDirectory2(), getRelativePathFromDirectory(outputDir, filePath, ignoreCase) ) : filePath; @@ -41978,10 +42904,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 isPropertyAccessExpression15(node) && isIdentifier25(node.name) && isEntityNameExpression(node.expression); + return isPropertyAccessExpression16(node) && isIdentifier26(node.name) && isEntityNameExpression(node.expression); } function tryGetPropertyAccessOrIdentifierToString(expr) { - if (isPropertyAccessExpression15(expr)) { + if (isPropertyAccessExpression16(expr)) { const baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression); if (baseStr !== void 0) { return baseStr + "." + entityNameToString(expr.name); @@ -41991,7 +42917,7 @@ ${lanes.join("\n")} if (baseStr !== void 0 && isPropertyName(expr.argumentExpression)) { return baseStr + "." + getPropertyNameForPropertyNameNode(expr.argumentExpression); } - } else if (isIdentifier25(expr)) { + } else if (isIdentifier26(expr)) { return unescapeLeadingUnderscores(expr.escapedText); } else if (isJsxNamespacedName(expr)) { return getTextOfJsxNamespacedName(expr); @@ -42005,10 +42931,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 && (isPropertyAccessExpression15(node.parent) && node.parent.name === node || isElementAccessExpression8(node.parent) && node.parent.argumentExpression === node); + return !!node.parent && (isPropertyAccessExpression16(node.parent) && node.parent.name === node || isElementAccessExpression8(node.parent) && node.parent.argumentExpression === node); } function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) { - return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression15(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; + return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression16(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; } function isInstanceOfExpression(node) { return isBinaryExpression4(node) && node.operatorToken.kind === 104; @@ -42317,7 +43243,7 @@ ${lanes.join("\n")} return filter(node.declarations, isInitializedVariable); } function isInitializedVariable(node) { - return isVariableDeclaration6(node) && node.initializer !== void 0; + return isVariableDeclaration7(node) && node.initializer !== void 0; } function isWatchSet(options) { return options.watch && hasProperty(options, "watch"); @@ -42466,7 +43392,7 @@ ${lanes.join("\n")} } function getLastChild(node) { let lastChild; - forEachChild26(node, (child) => { + forEachChild27(node, (child) => { if (nodeIsPresent(child)) lastChild = child; }, (children) => { for (let i = children.length - 1; i >= 0; i--) { @@ -42524,7 +43450,7 @@ ${lanes.join("\n")} return res; } } else if (access.kind === 213) { - if (isIdentifier25(access.argumentExpression) || isStringLiteralLike4(access.argumentExpression)) { + if (isIdentifier26(access.argumentExpression) || isStringLiteralLike4(access.argumentExpression)) { const res = action(access.argumentExpression); if (res !== void 0) { return res; @@ -42536,7 +43462,7 @@ ${lanes.join("\n")} if (isAccessExpression(access.expression)) { return walkAccessExpression(access.expression); } - if (isIdentifier25(access.expression)) { + if (isIdentifier26(access.expression)) { return action(access.expression); } return void 0; @@ -42930,7 +43856,7 @@ ${lanes.join("\n")} } function walkTreeForJSXTags(node) { if (!(node.transformFlags & 2)) return void 0; - return isJsxOpeningLikeElement(node) || isJsxFragment(node) ? node : forEachChild26(node, walkTreeForJSXTags); + return isJsxOpeningLikeElement(node) || isJsxFragment(node) ? node : forEachChild27(node, walkTreeForJSXTags); } function isFileModuleFromUsingJSXTag(file2) { return !file2.isDeclarationFile ? walkTreeForJSXTags(file2) : void 0; @@ -44098,7 +45024,7 @@ ${lanes.join("\n")} return !!(useSite.flags & 33554432) || isInJSDoc(useSite) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); } function isShorthandPropertyNameUseSite(useSite) { - return isIdentifier25(useSite) && isShorthandPropertyAssignment6(useSite.parent) && useSite.parent.name === useSite; + return isIdentifier26(useSite) && isShorthandPropertyAssignment6(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { while (node.kind === 80 || node.kind === 212) { @@ -44133,7 +45059,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) && isIdentifier25(node.typeName); + return isTypeReferenceNode3(node) && isIdentifier26(node.typeName); } function arrayIsHomogeneous(array2, comparer = equateValues) { if (array2.length < 2) return true; @@ -44447,10 +45373,10 @@ ${lanes.join("\n")} return tag && tag.typeExpression && tag.typeExpression.type; } function getEscapedTextOfJsxAttributeName(node) { - return isIdentifier25(node) ? node.escapedText : getEscapedTextOfJsxNamespacedName(node); + return isIdentifier26(node) ? node.escapedText : getEscapedTextOfJsxNamespacedName(node); } function getTextOfJsxAttributeName(node) { - return isIdentifier25(node) ? idText(node) : getTextOfJsxNamespacedName(node); + return isIdentifier26(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isJsxAttributeName(node) { const kind = node.kind; @@ -44463,7 +45389,7 @@ ${lanes.join("\n")} return `${idText(node.namespace)}:${idText(node.name)}`; } function intrinsicTagNameToString(node) { - return isIdentifier25(node) ? idText(node) : getTextOfJsxNamespacedName(node); + return isIdentifier26(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isTypeUsableAsPropertyName(type) { return !!(type.flags & 8576); @@ -44478,7 +45404,7 @@ ${lanes.join("\n")} return Debug.fail(); } function isExpandoPropertyDeclaration(declaration) { - return !!declaration && (isPropertyAccessExpression15(declaration) || isElementAccessExpression8(declaration) || isBinaryExpression4(declaration)); + return !!declaration && (isPropertyAccessExpression16(declaration) || isElementAccessExpression8(declaration) || isBinaryExpression4(declaration)); } function hasResolutionModeOverride(node) { if (node === void 0) { @@ -44491,7 +45417,7 @@ ${lanes.join("\n")} return stringReplace.call(s, "*", replacement); } function getNameFromImportAttribute(node) { - return isIdentifier25(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text); + return isIdentifier26(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text); } function isSourceElement(node) { switch (node.kind) { @@ -45093,14 +46019,14 @@ ${lanes.join("\n")} } return requiresScopeChangeWorker(node.name); default: - if (isNullishCoalesce(node) || isOptionalChain(node)) { + if (isNullishCoalesce(node) || isOptionalChain2(node)) { return target < 7; } if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern3(node.parent)) { return target < 4; } if (isTypeNode(node)) return false; - return forEachChild26(node, requiresScopeChangeWorker) || false; + return forEachChild27(node, requiresScopeChangeWorker) || false; } } } @@ -45307,7 +46233,7 @@ ${lanes.join("\n")} } }; while (true) { - const child = isJavaScriptFile && includeJSDoc && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild26(current, getContainingChild); + const child = isJavaScriptFile && includeJSDoc && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild27(current, getContainingChild); if (!child || isMetaProperty(child)) { return current; } @@ -45449,7 +46375,7 @@ ${lanes.join("\n")} if (child) addEmitFlagsRecursively(child, flag, getChild); } function getFirstChild(node) { - return forEachChild26(node, (child) => child); + return forEachChild27(node, (child) => child); } function createBaseNodeFactory() { let NodeConstructor2; @@ -45711,7 +46637,7 @@ ${lanes.join("\n")} } function parenthesizeLeftSideOfAccess(expression, optionalChain) { const emittedExpression = skipPartiallyEmittedExpressions(expression); - if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 215 || emittedExpression.arguments) && (optionalChain || !isOptionalChain(emittedExpression))) { + if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 215 || emittedExpression.arguments) && (optionalChain || !isOptionalChain2(emittedExpression))) { return expression; } return setTextRange(factory2.createParenthesizedExpression(expression), expression); @@ -45738,7 +46664,7 @@ ${lanes.join("\n")} } function parenthesizeExpressionOfExpressionStatement(expression) { const emittedExpression = skipPartiallyEmittedExpressions(expression); - if (isCallExpression14(emittedExpression)) { + if (isCallExpression16(emittedExpression)) { const callee = emittedExpression.expression; const kind = skipPartiallyEmittedExpressions(callee).kind; if (kind === 219 || kind === 220) { @@ -45969,7 +46895,7 @@ ${lanes.join("\n")} function convertToArrayAssignmentElement(element) { if (isBindingElement(element)) { if (element.dotDotDotToken) { - Debug.assertNode(element.name, isIdentifier25); + Debug.assertNode(element.name, isIdentifier26); return setOriginalNode(setTextRange(factory2.createSpreadElement(element.name), element), element); } const expression = convertToAssignmentElementTarget(element.name); @@ -45986,14 +46912,14 @@ ${lanes.join("\n")} function convertToObjectAssignmentElement(element) { if (isBindingElement(element)) { if (element.dotDotDotToken) { - Debug.assertNode(element.name, isIdentifier25); + Debug.assertNode(element.name, isIdentifier26); 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, isIdentifier25); + Debug.assertNode(element.name, isIdentifier26); return setOriginalNode(setTextRange(factory2.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } return cast(element, isObjectLiteralElementLike); @@ -48156,7 +49082,7 @@ ${lanes.join("\n")} node.expression = expression; node.questionDotToken = questionDotToken; node.name = name; - node.transformFlags = propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | (isIdentifier25(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); + node.transformFlags = propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | (isIdentifier26(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); node.jsDoc = void 0; node.flowNode = void 0; return node; @@ -48179,7 +49105,7 @@ ${lanes.join("\n")} } function updatePropertyAccessExpression(node, expression, name) { if (isPropertyAccessChain(node)) { - return updatePropertyAccessChain(node, expression, node.questionDotToken, cast(name, isIdentifier25)); + return updatePropertyAccessChain(node, expression, node.questionDotToken, cast(name, isIdentifier26)); } return node.expression !== expression || node.name !== name ? update(createPropertyAccessExpression(expression, name), node) : node; } @@ -48493,7 +49419,7 @@ ${lanes.join("\n")} node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); - if ((operator === 46 || operator === 47) && isIdentifier25(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { + if ((operator === 46 || operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { node.transformFlags |= 268435456; } return node; @@ -48509,7 +49435,7 @@ ${lanes.join("\n")} node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); - if (isIdentifier25(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { + if (isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { node.transformFlags |= 268435456; } return node; @@ -50137,20 +51063,20 @@ ${lanes.join("\n")} function updateHeritageClause(node, types) { return node.types !== types ? update(createHeritageClause(node.token, types), node) : node; } - function createCatchClause(variableDeclaration, block) { + function createCatchClause(variableDeclaration, block2) { const node = createBaseNode( 300 /* CatchClause */ ); node.variableDeclaration = asVariableDeclaration(variableDeclaration); - node.block = block; + node.block = block2; node.transformFlags |= propagateChildFlags(node.variableDeclaration) | propagateChildFlags(node.block) | (!variableDeclaration ? 64 : 0); node.locals = void 0; node.nextContainer = void 0; return node; } - function updateCatchClause(node, variableDeclaration, block) { - return node.variableDeclaration !== variableDeclaration || node.block !== block ? update(createCatchClause(variableDeclaration, block), node) : node; + function updateCatchClause(node, variableDeclaration, block2) { + return node.variableDeclaration !== variableDeclaration || node.block !== block2 ? update(createCatchClause(variableDeclaration, block2), node) : node; } function createPropertyAssignment(name, initializer3) { const node = createBaseDeclaration( @@ -50494,7 +51420,7 @@ ${lanes.join("\n")} if (isGeneratedIdentifier(node)) { return cloneGeneratedIdentifier(node); } - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { return cloneIdentifier(node); } if (isGeneratedPrivateIdentifier(node)) { @@ -50760,7 +51686,7 @@ ${lanes.join("\n")} /*optionalChain*/ false ); - } else if (isPropertyAccessExpression15(callee)) { + } else if (isPropertyAccessExpression16(callee)) { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createPropertyAccessExpression( @@ -50842,7 +51768,7 @@ ${lanes.join("\n")} } function getName(node, allowComments, allowSourceMaps, emitFlags = 0, ignoreAssignedName) { const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node); - if (nodeName && isIdentifier25(nodeName) && !isGeneratedIdentifier(nodeName)) { + if (nodeName && isIdentifier26(nodeName) && !isGeneratedIdentifier(nodeName)) { const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent); emitFlags |= getEmitFlags(nodeName); if (!allowSourceMaps) emitFlags |= 96; @@ -51050,7 +51976,7 @@ ${lanes.join("\n")} return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginal(createEmptyStatement(), statement), statement) : statement; } function asVariableDeclaration(variableDeclaration) { - if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration6(variableDeclaration)) { + if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration7(variableDeclaration)) { return createVariableDeclaration( variableDeclaration, /*exclamationToken*/ @@ -51171,7 +52097,7 @@ ${lanes.join("\n")} return tokenValue; } function propagateNameFlags(node) { - return node && isIdentifier25(node) ? propagateIdentifierNameFlags(node) : propagateChildFlags(node); + return node && isIdentifier26(node) ? propagateIdentifierNameFlags(node) : propagateChildFlags(node); } function propagateIdentifierNameFlags(node) { return propagateChildFlags(node) & ~67108864; @@ -51763,7 +52689,7 @@ ${lanes.join("\n")} ); } function createESDecorateClassElementAccessHasMethod(elementName) { - const propertyName = elementName.computed ? elementName.name : isIdentifier25(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name; + const propertyName = elementName.computed ? elementName.name : isIdentifier26(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name; return factory2.createPropertyAssignment( "has", factory2.createArrowFunction( @@ -52686,7 +53612,7 @@ ${lanes.join("\n")} })(name => super[name], (name, value) => super[name] = value);` }; function isCallToHelper(firstSegment, helperName) { - return isCallExpression14(firstSegment) && isIdentifier25(firstSegment.expression) && (getEmitFlags(firstSegment.expression) & 8192) !== 0 && firstSegment.expression.escapedText === helperName; + return isCallExpression16(firstSegment) && isIdentifier26(firstSegment.expression) && (getEmitFlags(firstSegment.expression) & 8192) !== 0 && firstSegment.expression.escapedText === helperName; } function isNumericLiteral5(node) { return node.kind === 9; @@ -52745,7 +53671,7 @@ ${lanes.join("\n")} function isEqualsGreaterThanToken(node) { return node.kind === 39; } - function isIdentifier25(node) { + function isIdentifier26(node) { return node.kind === 80; } function isPrivateIdentifier(node) { @@ -52925,19 +53851,19 @@ ${lanes.join("\n")} function isObjectLiteralExpression12(node) { return node.kind === 211; } - function isPropertyAccessExpression15(node) { + function isPropertyAccessExpression16(node) { return node.kind === 212; } function isElementAccessExpression8(node) { return node.kind === 213; } - function isCallExpression14(node) { + function isCallExpression16(node) { return node.kind === 214; } - function isNewExpression17(node) { + function isNewExpression19(node) { return node.kind === 215; } - function isTaggedTemplateExpression4(node) { + function isTaggedTemplateExpression5(node) { return node.kind === 216; } function isTypeAssertionExpression2(node) { @@ -52976,7 +53902,7 @@ ${lanes.join("\n")} function isConditionalExpression4(node) { return node.kind === 228; } - function isTemplateExpression4(node) { + function isTemplateExpression5(node) { return node.kind === 229; } function isYieldExpression(node) { @@ -53078,7 +54004,7 @@ ${lanes.join("\n")} function isDebuggerStatement(node) { return node.kind === 260; } - function isVariableDeclaration6(node) { + function isVariableDeclaration7(node) { return node.kind === 261; } function isVariableDeclarationList(node) { @@ -53556,7 +54482,7 @@ ${lanes.join("\n")} } } function createExpressionForPropertyName(factory2, memberName) { - if (isIdentifier25(memberName)) { + if (isIdentifier26(memberName)) { return factory2.createStringLiteralFromNode(memberName); } else if (isComputedPropertyName(memberName)) { return setParent(setTextRange(factory2.cloneNode(memberName.expression), memberName.expression), memberName.expression.parent); @@ -54081,8 +55007,8 @@ ${lanes.join("\n")} if (fullName) { let rightNode = fullName; while (true) { - if (isIdentifier25(rightNode) || !rightNode.body) { - return isIdentifier25(rightNode) ? rightNode : rightNode.name; + if (isIdentifier26(rightNode) || !rightNode.body) { + return isIdentifier26(rightNode) ? rightNode : rightNode.name; } rightNode = rightNode.body; } @@ -54108,7 +55034,7 @@ ${lanes.join("\n")} return isQuestionToken(node) || isExclamationToken(node); } function isIdentifierOrThisTypeNode(node) { - return isIdentifier25(node) || isThisTypeNode(node); + return isIdentifier26(node) || isThisTypeNode(node); } function isReadonlyKeywordOrPlusOrMinusToken(node) { return isReadonlyKeyword(node) || isPlusToken(node) || isMinusToken(node); @@ -54117,7 +55043,7 @@ ${lanes.join("\n")} return isQuestionToken(node) || isPlusToken(node) || isMinusToken(node); } function isModuleName(node) { - return isIdentifier25(node) || isStringLiteral15(node); + return isIdentifier26(node) || isStringLiteral15(node); } function isExponentiationOperator(kind) { return kind === 43; @@ -54542,7 +55468,7 @@ ${lanes.join("\n")} return sourceFile.flags & 8388608 ? walkTreeForImportMeta(sourceFile) : void 0; } function walkTreeForImportMeta(node) { - return isImportMeta2(node) ? node : forEachChild26(node, walkTreeForImportMeta); + return isImportMeta2(node) ? node : forEachChild27(node, walkTreeForImportMeta); } function hasModifierOfKind(node, kind) { return some(node.modifiers, (m) => m.kind === kind); @@ -55555,7 +56481,7 @@ ${lanes.join("\n")} function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); } - function forEachChild26(node, cbNode, cbNodes) { + function forEachChild27(node, cbNode, cbNodes) { if (node === void 0 || node.kind <= 166) { return; } @@ -55600,7 +56526,7 @@ ${lanes.join("\n")} } function gatherPossibleChildren(node) { const children = []; - forEachChild26(node, addWorkItem, addWorkItem); + forEachChild27(node, addWorkItem, addWorkItem); return children; function addWorkItem(n) { children.unshift(n); @@ -56404,7 +57330,7 @@ ${lanes.join("\n")} } return token() > 118; } - function isIdentifier26() { + function isIdentifier27() { if (token() === 80) { return true; } @@ -56432,11 +57358,11 @@ ${lanes.join("\n")} } const viableKeywordSuggestions = Object.keys(textToKeywordObj).filter((keyword) => keyword.length > 2); function parseErrorForMissingSemicolonAfter(node) { - if (isTaggedTemplateExpression4(node)) { + if (isTaggedTemplateExpression5(node)) { parseErrorAt(skipTrivia(sourceText, node.template.pos), node.template.end, Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); return; } - const expressionText = isIdentifier25(node) ? idText(node) : void 0; + const expressionText = isIdentifier26(node) ? idText(node) : void 0; if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString( 27 @@ -56731,7 +57657,7 @@ ${lanes.join("\n")} ); } function parseIdentifier(diagnosticMessage, privateIdentifierDiagnosticMessage) { - return createIdentifier(isIdentifier26(), diagnosticMessage, privateIdentifierDiagnosticMessage); + return createIdentifier(isIdentifier27(), diagnosticMessage, privateIdentifierDiagnosticMessage); } function parseIdentifierName(diagnosticMessage) { return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage); @@ -56884,14 +57810,14 @@ ${lanes.join("\n")} if (!inErrorRecovery) { return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); } else { - return isIdentifier26() && !isHeritageClauseExtendsOrImplementsKeyword(); + return isIdentifier27() && !isHeritageClauseExtendsOrImplementsKeyword(); } case 8: return isBindingIdentifierOrPrivateIdentifierOrPattern(); case 10: return token() === 28 || token() === 26 || isBindingIdentifierOrPrivateIdentifierOrPattern(); case 19: - return token() === 103 || token() === 87 || isIdentifier26(); + return token() === 103 || token() === 87 || isIdentifier27(); case 15: switch (token()) { case 28: @@ -56950,7 +57876,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifier() { nextToken(); - return isIdentifier26(); + return isIdentifier27(); } function nextTokenIsIdentifierOrKeyword() { nextToken(); @@ -57974,10 +58900,10 @@ ${lanes.join("\n")} } if (isModifierKind(token())) { nextToken(); - if (isIdentifier26()) { + if (isIdentifier27()) { return true; } - } else if (!isIdentifier26()) { + } else if (!isIdentifier27()) { return false; } else { nextToken(); @@ -58537,7 +59463,7 @@ ${lanes.join("\n")} case 21: return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: - return isIdentifier26(); + return isIdentifier27(); } } function isStartOfParenthesizedOrFunctionType() { @@ -58699,7 +59625,7 @@ ${lanes.join("\n")} false ); } - if (isIdentifier26() || token() === 110) { + if (isIdentifier27() || token() === 110) { nextToken(); return true; } @@ -58730,7 +59656,7 @@ ${lanes.join("\n")} } function parseTypeOrTypePredicate() { const pos = getNodePos(); - const typePredicateVariable = isIdentifier26() && tryParse(parseTypePredicatePrefix); + const typePredicateVariable = isIdentifier27() && tryParse(parseTypePredicatePrefix); const type = parseType(); if (typePredicateVariable) { return finishNode(factory2.createTypePredicateNode( @@ -58822,7 +59748,7 @@ ${lanes.join("\n")} case 102: return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: - return isIdentifier26(); + return isIdentifier27(); } } function isStartOfExpression() { @@ -58849,7 +59775,7 @@ ${lanes.join("\n")} if (isBinaryOperator2()) { return true; } - return isIdentifier26(); + return isIdentifier27(); } } function isStartOfExpressionStatement() { @@ -58935,7 +59861,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifierOnSameLine() { nextToken(); - return !scanner2.hasPrecedingLineBreak() && isIdentifier26(); + return !scanner2.hasPrecedingLineBreak() && isIdentifier27(); } function parseYieldExpression() { const pos = getNodePos(); @@ -59058,7 +59984,7 @@ ${lanes.join("\n")} } return 1; } - if (!isIdentifier26() && second !== 110) { + if (!isIdentifier27() && second !== 110) { return 0; } switch (nextToken()) { @@ -59081,7 +60007,7 @@ ${lanes.join("\n")} first2 === 30 /* LessThanToken */ ); - if (!isIdentifier26() && token() !== 87) { + if (!isIdentifier27() && token() !== 87) { return 0; } if (languageVariant === 1) { @@ -59902,9 +60828,9 @@ ${lanes.join("\n")} /*allowUnicodeEscapeSequenceInIdentifierName*/ true ); - const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression); - const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name); - if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) { + const isOptionalChain22 = questionDotToken || tryReparseOptionalChain(expression); + const propertyAccess = isOptionalChain22 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name); + if (isOptionalChain22 && isPrivateIdentifier(propertyAccess.name)) { parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers); } if (isExpressionWithTypeArguments(expression) && expression.typeArguments) { @@ -60249,7 +61175,7 @@ ${lanes.join("\n")} 42 /* AsteriskToken */ ); - const tokenIsIdentifier = isIdentifier26(); + const tokenIsIdentifier = isIdentifier27(); const name = parsePropertyName(); const questionToken = parseOptionalToken( 58 @@ -60415,7 +61341,7 @@ ${lanes.join("\n")} false ); } - const block = parseBlock(!!(flags & 16), diagnosticMessage); + const block2 = parseBlock(!!(flags & 16), diagnosticMessage); if (saveDecoratorContext) { setDecoratorContext( /*val*/ @@ -60425,7 +61351,7 @@ ${lanes.join("\n")} topLevel = savedTopLevel; setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - return block; + return block2; } function parseEmptyStatement() { const pos = getNodePos(); @@ -60733,11 +61659,11 @@ ${lanes.join("\n")} } else { variableDeclaration = void 0; } - const block = parseBlock( + const block2 = parseBlock( /*ignoreMissingOpenBrace*/ false ); - return finishNode(factory2.createCatchClause(variableDeclaration, block), pos); + return finishNode(factory2.createCatchClause(variableDeclaration, block2), pos); } function parseDebuggerStatement() { const pos = getNodePos(); @@ -60755,7 +61681,7 @@ ${lanes.join("\n")} let node; const hasParen = token() === 21; const expression = allowInAnd(parseExpression); - if (isIdentifier25(expression) && parseOptional( + if (isIdentifier26(expression) && parseOptional( 59 /* ColonToken */ )) { @@ -61174,7 +62100,7 @@ ${lanes.join("\n")} } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner2.hasPrecedingLineBreak() && (isIdentifier26() || token() === 11); + return !scanner2.hasPrecedingLineBreak() && (isIdentifier27() || token() === 11); } function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { if (token() !== 19) { @@ -62010,16 +62936,16 @@ ${lanes.join("\n")} ); const afterImportPos = scanner2.getTokenFullStart(); let identifier; - if (isIdentifier26()) { + if (isIdentifier27()) { identifier = parseIdentifier(); } let phaseModifier; - if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 || isIdentifier26() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier26() || tokenAfterImportDefinitelyProducesImportDeclaration())) { + if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 || isIdentifier27() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier27() || tokenAfterImportDefinitelyProducesImportDeclaration())) { phaseModifier = 156; - identifier = isIdentifier26() ? parseIdentifier() : void 0; + identifier = isIdentifier27() ? parseIdentifier() : void 0; } else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && (token() === 161 ? !lookAhead(nextTokenIsStringLiteral) : token() !== 28 && token() !== 64)) { phaseModifier = 166; - identifier = isIdentifier26() ? parseIdentifier() : void 0; + identifier = isIdentifier27() ? parseIdentifier() : void 0; } if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() && phaseModifier !== 166) { return parseImportEqualsDeclaration( @@ -62245,7 +63171,7 @@ ${lanes.join("\n")} } function parseImportOrExportSpecifier(kind) { const pos = getNodePos(); - let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier26(); + let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier27(); let checkIdentifierStart = scanner2.getTokenStart(); let checkIdentifierEnd = scanner2.getTokenEnd(); let isTypeOnly = false; @@ -62303,7 +63229,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()) && !isIdentifier26(); + checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier27(); checkIdentifierStart = scanner2.getTokenStart(); checkIdentifierEnd = scanner2.getTokenEnd(); return parseIdentifierName(); @@ -63061,7 +63987,7 @@ ${lanes.join("\n")} case 189: return isObjectOrObjectArrayTypeReference(node.elementType); default: - return isTypeReferenceNode3(node) && isIdentifier25(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; + return isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; } } function parseParameterOrPropertyTag(start2, tagName, target, indent3) { @@ -63182,7 +64108,7 @@ ${lanes.join("\n")} function parseImportTag(start2, tagName, margin, indentText) { const afterImportTagPos = scanner2.getTokenFullStart(); let identifier; - if (isIdentifier26()) { + if (isIdentifier27()) { identifier = parseIdentifier(); } const importClause = tryParseImportClause( @@ -63377,8 +64303,8 @@ ${lanes.join("\n")} return finishNode(factory2.createJSDocOverloadTag(tagName, typeExpression, comment), start2, end2); } function escapedTextsEqual(a, b) { - while (!isIdentifier25(a) || !isIdentifier25(b)) { - if (!isIdentifier25(a) && !isIdentifier25(b) && a.right.escapedText === b.right.escapedText) { + while (!isIdentifier26(a) || !isIdentifier26(b)) { + if (!isIdentifier26(a) && !isIdentifier26(b) && a.right.escapedText === b.right.escapedText) { a = a.left; b = b.left; } else { @@ -63398,7 +64324,7 @@ ${lanes.join("\n")} case 60: if (canParseTag) { const child = tryParseChildTag(target, indent3); - if (child && (child.kind === 342 || child.kind === 349) && name && (isIdentifier25(child.name) || !escapedTextsEqual(name, child.name.left))) { + if (child && (child.kind === 342 || child.kind === 349) && name && (isIdentifier26(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } return child; @@ -63700,7 +64626,7 @@ ${lanes.join("\n")} if (aggressiveChecks && shouldCheckNode(node)) { Debug.assert(text === newText.substring(node.pos, node.end)); } - forEachChild26(node, visitNode3, visitArray2); + forEachChild27(node, visitNode3, visitArray2); if (hasJSDocNodes(node)) { for (const jsDocComment of node.jsDoc) { visitNode3(jsDocComment); @@ -63757,7 +64683,7 @@ ${lanes.join("\n")} visitNode3(jsDocComment); } } - forEachChild26(node, visitNode3); + forEachChild27(node, visitNode3); Debug.assert(pos <= node.end); } } @@ -63784,7 +64710,7 @@ ${lanes.join("\n")} markAsIntersectingIncrementalChange(child); unsetNodeChildren(child, sourceFile); adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - forEachChild26(child, visitNode3, visitArray2); + forEachChild27(child, visitNode3, visitArray2); if (hasJSDocNodes(child)) { for (const jsDocComment of child.jsDoc) { visitNode3(jsDocComment); @@ -63838,7 +64764,7 @@ ${lanes.join("\n")} function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { let bestResult = sourceFile; let lastNodeEntirelyBeforePosition; - forEachChild26(sourceFile, visit); + forEachChild27(sourceFile, visit); if (lastNodeEntirelyBeforePosition) { const lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition); if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { @@ -63865,7 +64791,7 @@ ${lanes.join("\n")} bestResult = child; } if (position < child.end) { - forEachChild26(child, visit); + forEachChild27(child, visit); return true; } else { Debug.assert(child.end <= position); @@ -63920,11 +64846,11 @@ ${lanes.join("\n")} currentArray = void 0; currentArrayIndex = -1; current = void 0; - forEachChild26(sourceFile, visitNode3, visitArray2); + forEachChild27(sourceFile, visitNode3, visitArray2); return; function visitNode3(node) { if (position >= node.pos && position < node.end) { - forEachChild26(node, visitNode3, visitArray2); + forEachChild27(node, visitNode3, visitArray2); return true; } return false; @@ -63941,7 +64867,7 @@ ${lanes.join("\n")} return true; } else { if (child.pos < position && position < child.end) { - forEachChild26(child, visitNode3, visitArray2); + forEachChild27(child, visitNode3, visitArray2); return true; } } @@ -65874,7 +66800,7 @@ ${lanes.join("\n")} const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName); return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); } - function parseCommandLineWorker(diagnostics, commandLine, readFile2) { + function parseCommandLineWorker(diagnostics, commandLine, readFile4) { const options = {}; let watchOptions; const fileNames = []; @@ -65922,7 +66848,7 @@ ${lanes.join("\n")} } } function parseResponseFile(fileName) { - const text = tryReadFile(fileName, readFile2 || ((fileName2) => sys.readFile(fileName2))); + const text = tryReadFile(fileName, readFile4 || ((fileName2) => sys.readFile(fileName2))); if (!isString(text)) { errors.push(text); return; @@ -66025,8 +66951,8 @@ ${lanes.join("\n")} unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1, optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument }; - function parseCommandLine(commandLine, readFile2) { - return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile2); + function parseCommandLine(commandLine, readFile4) { + return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile4); } function getOptionFromName(optionName, allowShort) { return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort); @@ -66108,8 +67034,8 @@ ${lanes.join("\n")} watchOptionsToExtend ); } - function readConfigFile(fileName, readFile2) { - const textOrDiagnostic = tryReadFile(fileName, readFile2); + function readConfigFile(fileName, readFile4) { + const textOrDiagnostic = tryReadFile(fileName, readFile4); return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic }; } function parseConfigFileTextToJson(fileName, jsonText) { @@ -66124,14 +67050,14 @@ ${lanes.join("\n")} error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0 }; } - function readJsonConfigFile(fileName, readFile2) { - const textOrDiagnostic = tryReadFile(fileName, readFile2); + function readJsonConfigFile(fileName, readFile4) { + const textOrDiagnostic = tryReadFile(fileName, readFile4); return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] }; } - function tryReadFile(fileName, readFile2) { + function tryReadFile(fileName, readFile4) { let text; try { - text = readFile2(fileName); + text = readFile4(fileName); } catch (e) { return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message); } @@ -68479,11 +69405,11 @@ ${lanes.join("\n")} if (i < rootLength) { return void 0; } - const sep = directory.lastIndexOf(directorySeparator, i - 1); - if (sep === -1) { + const sep2 = directory.lastIndexOf(directorySeparator, i - 1); + if (sep2 === -1) { return void 0; } - return directory.substr(0, Math.max(sep, rootLength)); + return directory.substr(0, Math.max(sep2, rootLength)); } } } @@ -70488,7 +71414,7 @@ ${lanes.join("\n")} // 5. other uninstantiated module declarations. case 269: { let state = 0; - forEachChild26(node, (n) => { + forEachChild27(node, (n) => { const childState = getModuleInstanceStateCached(n, visited); switch (childState) { case 0: @@ -70858,9 +71784,9 @@ ${lanes.join("\n")} return symbol2; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - const hasExportModifier = !!(getCombinedModifierFlags(node) & 32) || jsdocTreatAsExported(node); + const hasExportModifier2 = !!(getCombinedModifierFlags(node) & 32) || jsdocTreatAsExported(node); if (symbolFlags & 2097152) { - if (node.kind === 282 || node.kind === 272 && hasExportModifier) { + if (node.kind === 282 || node.kind === 272 && hasExportModifier2) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { Debug.assertNode(container, canHaveLocals); @@ -70875,7 +71801,7 @@ ${lanes.join("\n")} } } else { if (isJSDocTypeAlias(node)) Debug.assert(isInJSFile(node)); - if (!isAmbientModule(node) && (hasExportModifier || container.flags & 128)) { + if (!isAmbientModule(node) && (hasExportModifier2 || container.flags & 128)) { if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier( node, 2048 @@ -71002,7 +71928,7 @@ ${lanes.join("\n")} } else if (containerFlags & 64) { seenThisKeyword = false; bindChildren(node); - Debug.assertNotNode(node, isIdentifier25); + Debug.assertNotNode(node, isIdentifier26); node.flags = seenThisKeyword ? node.flags | 256 : node.flags & ~256; } else { bindChildren(node); @@ -71023,7 +71949,7 @@ ${lanes.join("\n")} forEach(nodes, bindFunction); } function bindEachChild(node) { - forEachChild26(node, bind, bindEach); + forEachChild27(node, bind, bindEach); } function bindChildren(node) { const saveInAssignmentPattern = inAssignmentPattern; @@ -71198,7 +72124,7 @@ ${lanes.join("\n")} return false; } function containsNarrowableReference(expr) { - return isNarrowableReference(expr) || isOptionalChain(expr) && containsNarrowableReference(expr.expression); + return isNarrowableReference(expr) || isOptionalChain2(expr) && containsNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -71358,7 +72284,7 @@ ${lanes.join("\n")} while (isParenthesizedExpression7(node.parent) || isPrefixUnaryExpression4(node.parent) && node.parent.operator === 54) { node = node.parent; } - return !isStatementCondition(node) && !isLogicalExpression(node.parent) && !(isOptionalChain(node.parent) && node.parent.expression === node); + return !isStatementCondition(node) && !isLogicalExpression(node.parent) && !(isOptionalChain2(node.parent) && node.parent.expression === node); } function doWithConditionalBranches(action, value, trueTarget, falseTarget) { const savedTrueTarget = currentTrueTarget; @@ -71371,7 +72297,7 @@ ${lanes.join("\n")} } function bindCondition(node, trueTarget, falseTarget) { doWithConditionalBranches(bind, node, trueTarget, falseTarget); - if (!node || !isLogicalAssignmentExpression(node) && !isLogicalExpression(node) && !(isOptionalChain(node) && isOutermostOptionalChain(node))) { + if (!node || !isLogicalAssignmentExpression(node) && !isLogicalExpression(node) && !(isOptionalChain2(node) && isOutermostOptionalChain(node))) { addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); } @@ -71931,7 +72857,7 @@ ${lanes.join("\n")} } function bindOptionalExpression(node, trueTarget, falseTarget) { doWithConditionalBranches(bind, node, trueTarget, falseTarget); - if (!isOptionalChain(node) || isOutermostOptionalChain(node)) { + if (!isOptionalChain2(node) || isOutermostOptionalChain(node)) { addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); } @@ -71978,21 +72904,21 @@ ${lanes.join("\n")} } } function bindNonNullExpressionFlow(node) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { bindOptionalChainFlow(node); } else { bindEachChild(node); } } function bindAccessExpressionFlow(node) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { bindOptionalChainFlow(node); } else { bindEachChild(node); } } function bindCallExpressionFlow(node) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { bindOptionalChainFlow(node); } else { const expr = skipParentheses(node.expression); @@ -72009,7 +72935,7 @@ ${lanes.join("\n")} } if (node.expression.kind === 212) { const propertyAccess = node.expression; - if (isIdentifier25(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { + if (isIdentifier26(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256, currentFlow, node); } } @@ -72248,7 +73174,7 @@ ${lanes.join("\n")} file2.symbol, declName.parent, isTopLevel, - !!findAncestor(declName, (d) => isPropertyAccessExpression15(d) && d.name.escapedText === "prototype"), + !!findAncestor(declName, (d) => isPropertyAccessExpression16(d) && d.name.escapedText === "prototype"), /*containerIsClass*/ false ); @@ -72269,7 +73195,7 @@ ${lanes.join("\n")} container = declName.parent.expression.name; break; case 5: - container = isExportsOrModuleExportsOrAlias(file2, declName.parent.expression) ? file2 : isPropertyAccessExpression15(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression; + container = isExportsOrModuleExportsOrAlias(file2, declName.parent.expression) ? file2 : isPropertyAccessExpression16(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"); @@ -72385,7 +73311,7 @@ ${lanes.join("\n")} } } function isEvalOrArgumentsIdentifier(node) { - return isIdentifier25(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); + return isIdentifier26(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { if (name && name.kind === 80) { @@ -72609,7 +73535,7 @@ ${lanes.join("\n")} break; case 5: const expression = node.left.expression; - if (isInJSFile(node) && isIdentifier25(expression)) { + if (isInJSFile(node) && isIdentifier26(expression)) { const symbol2 = lookupSymbolForName(blockScopeContainer, expression.escapedText); if (isThisInitializedDeclaration(symbol2 == null ? void 0 : symbol2.valueDeclaration)) { bindThisPropertyAssignment(node); @@ -73053,7 +73979,7 @@ ${lanes.join("\n")} } function bindThisPropertyAssignment(node) { Debug.assert(isInJSFile(node)); - const hasPrivateIdentifier = isBinaryExpression4(node) && isPropertyAccessExpression15(node.left) && isPrivateIdentifier(node.left.name) || isPropertyAccessExpression15(node) && isPrivateIdentifier(node.name); + const hasPrivateIdentifier = isBinaryExpression4(node) && isPropertyAccessExpression16(node.left) && isPrivateIdentifier(node.left.name) || isPropertyAccessExpression16(node) && isPrivateIdentifier(node.name); if (hasPrivateIdentifier) { return; } @@ -73246,12 +74172,12 @@ ${lanes.join("\n")} return; } const rootExpr = getLeftmostAccessExpression(node.left); - if (isIdentifier25(rootExpr) && ((_a3 = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a3.flags) & 2097152) { + if (isIdentifier26(rootExpr) && ((_a3 = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a3.flags) & 2097152) { return; } setParent(node.left, node); setParent(node.right, node); - if (isIdentifier25(node.left.expression) && container === file2 && isExportsOrModuleExportsOrAlias(file2, node.left.expression)) { + if (isIdentifier26(node.left.expression) && container === file2 && isExportsOrModuleExportsOrAlias(file2, node.left.expression)) { bindExportsPropertyAssignment(node); } else if (hasDynamicName(node)) { bindAnonymousDeclaration( @@ -73275,7 +74201,7 @@ ${lanes.join("\n")} } } function bindStaticPropertyAssignment(node) { - Debug.assert(!isIdentifier25(node)); + Debug.assert(!isIdentifier26(node)); setParent(node.expression, node); bindPropertyAssignment( node.expression, @@ -73323,17 +74249,17 @@ ${lanes.join("\n")} if (isFunctionLikeDeclaration(getAssignedExpandoInitializer(declaration))) { includes = 8192; excludes = 103359; - } else if (isCallExpression14(declaration) && isBindableObjectDefinePropertyCall(declaration)) { + } else if (isCallExpression16(declaration) && isBindableObjectDefinePropertyCall(declaration)) { if (some(declaration.arguments[2].properties, (p) => { const id = getNameOfDeclaration(p); - return !!id && isIdentifier25(id) && idText(id) === "set"; + return !!id && isIdentifier26(id) && idText(id) === "set"; })) { includes |= 65536 | 4; excludes |= 78783; } if (some(declaration.arguments[2].properties, (p) => { const id = getNameOfDeclaration(p); - return !!id && isIdentifier25(id) && idText(id) === "get"; + return !!id && isIdentifier26(id) && idText(id) === "get"; })) { includes |= 32768 | 4; excludes |= 46015; @@ -73366,13 +74292,13 @@ ${lanes.join("\n")} return true; } const node = symbol2.valueDeclaration; - if (node && isCallExpression14(node)) { + if (node && isCallExpression16(node)) { return !!getAssignedExpandoInitializer(node); } - let init = !node ? void 0 : isVariableDeclaration6(node) ? node.initializer : isBinaryExpression4(node) ? node.right : isPropertyAccessExpression15(node) && isBinaryExpression4(node.parent) ? node.parent.right : void 0; + let init = !node ? void 0 : isVariableDeclaration7(node) ? node.initializer : isBinaryExpression4(node) ? node.right : isPropertyAccessExpression16(node) && isBinaryExpression4(node.parent) ? node.parent.right : void 0; init = init && getRightMostAssignedExpression(init); if (init) { - const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration6(node) ? node.name : isBinaryExpression4(node) ? node.left : node); + const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration7(node) ? node.name : isBinaryExpression4(node) ? node.left : node); return !!getExpandoInitializer(isBinaryExpression4(init) && (init.operatorToken.kind === 57 || init.operatorToken.kind === 61) ? init.right : init, isPrototypeAssignment); } return false; @@ -73384,7 +74310,7 @@ ${lanes.join("\n")} return expr.parent; } function lookupSymbolForPropertyAccess(node, lookupContainer = container) { - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { return lookupSymbolForName(lookupContainer, node.escapedText); } else { const symbol2 = lookupSymbolForPropertyAccess(node.expression); @@ -73394,7 +74320,7 @@ ${lanes.join("\n")} function forEachIdentifierInEntityName(e, parent3, action) { if (isExportsOrModuleExportsOrAlias(file2, e)) { return file2.symbol; - } else if (isIdentifier25(e)) { + } else if (isIdentifier26(e)) { return action(e, lookupSymbolForPropertyAccess(e), parent3); } else { const s = forEachIdentifierInEntityName(e.expression, parent3, action); @@ -73689,9 +74615,9 @@ ${lanes.join("\n")} node = q3.dequeue(); if (isExportsIdentifier(node) || isModuleExportsAccessExpression(node)) { return true; - } else if (isIdentifier25(node)) { + } else if (isIdentifier26(node)) { const symbol2 = lookupSymbolForName(sourceFile, node.escapedText); - if (!!symbol2 && !!symbol2.valueDeclaration && isVariableDeclaration6(symbol2.valueDeclaration) && !!symbol2.valueDeclaration.initializer) { + if (!!symbol2 && !!symbol2.valueDeclaration && isVariableDeclaration7(symbol2.valueDeclaration) && !!symbol2.valueDeclaration.initializer) { const init = symbol2.valueDeclaration.initializer; q3.enqueue(init); if (isAssignmentExpression( @@ -74389,9 +75315,9 @@ ${lanes.join("\n")} if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) { return; } - const relative3 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName); + const relative7 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName); for (const symlinkDirectory of symlinkDirectories) { - const option = resolvePath2(symlinkDirectory, relative3); + const option = resolvePath3(symlinkDirectory, relative7); const result2 = cb(option, target === referenceRedirect); shouldFilterIgnoredPaths = true; if (result2) return result2; @@ -75423,7 +76349,7 @@ ${lanes.join("\n")} return node && getTypeOfAssignmentPattern(node) || errorType; }, getPropertySymbolOfDestructuringAssignment: (locationIn) => { - const location = getParseTreeNode(locationIn, isIdentifier25); + const location = getParseTreeNode(locationIn, isIdentifier26); return location ? getPropertySymbolOfDestructuringAssignment(location) : void 0; }, signatureToString: (signature, enclosingDeclaration, flags, kind) => { @@ -75513,7 +76439,7 @@ ${lanes.join("\n")} return !!node && isValidPropertyAccess(node, escapeLeadingUnderscores(propertyName)); }, isValidPropertyAccessForCompletions: (nodeIn, type, property) => { - const node = getParseTreeNode(nodeIn, isPropertyAccessExpression15); + const node = getParseTreeNode(nodeIn, isPropertyAccessExpression16); return !!node && isValidPropertyAccessForCompletions(node, type, property); }, getSignatureFromDeclaration: (declarationIn) => { @@ -76279,10 +77205,10 @@ ${lanes.join("\n")} initializeTypeChecker(); return checker; function isDefinitelyReferenceToGlobalSymbolObject(node) { - if (!isPropertyAccessExpression15(node)) return false; - if (!isIdentifier25(node.name)) return false; - if (!isPropertyAccessExpression15(node.expression) && !isIdentifier25(node.expression)) return false; - if (isIdentifier25(node.expression)) { + if (!isPropertyAccessExpression16(node)) return false; + if (!isIdentifier26(node.name)) return false; + if (!isPropertyAccessExpression16(node.expression) && !isIdentifier26(node.expression)) return false; + if (isIdentifier26(node.expression)) { return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol( "Symbol", 111551 | 1048576, @@ -76290,7 +77216,7 @@ ${lanes.join("\n")} void 0 ) || unknownSymbol); } - if (!isIdentifier25(node.expression.expression)) return false; + if (!isIdentifier26(node.expression.expression)) return false; return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol; } function getCachedType(key) { @@ -76877,7 +77803,7 @@ ${lanes.join("\n")} } if (isPropertyDeclaration(declaration2) && getContainingClass(usage2) === getContainingClass(declaration2)) { const propName2 = declaration2.name; - if (isIdentifier25(propName2) || isPrivateIdentifier(propName2)) { + if (isIdentifier26(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)) { @@ -77077,7 +78003,7 @@ ${lanes.join("\n")} return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg); } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { - if (!isIdentifier25(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) { + if (!isIdentifier26(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) { return false; } const container = getThisContainer( @@ -77365,9 +78291,9 @@ ${lanes.join("\n")} const commonJSPropertyAccess = getCommonJSPropertyAccess(node); if (commonJSPropertyAccess) { const name = getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0]; - return isIdentifier25(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; + return isIdentifier26(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; } - if (isVariableDeclaration6(node) || node.moduleReference.kind === 284) { + if (isVariableDeclaration7(node) || node.moduleReference.kind === 284) { const immediate = resolveExternalModuleName( node, getExternalModuleRequireArgument(node) || getExternalModuleImportEqualsDeclarationExpression(node) @@ -77719,8 +78645,8 @@ ${lanes.join("\n")} var _a3; const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier; const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); - const name = !isPropertyAccessExpression15(specifier) && specifier.propertyName || specifier.name; - if (!isIdentifier25(name) && name.kind !== 11) { + const name = !isPropertyAccessExpression16(specifier) && specifier.propertyName || specifier.name; + if (!isIdentifier26(name) && name.kind !== 11) { return void 0; } const nameText = moduleExportNameTextEscaped(name); @@ -77773,7 +78699,7 @@ ${lanes.join("\n")} var _a3; const moduleName = getFullyQualifiedName(moduleSymbol, node); const declarationName = declarationNameToString(name); - const suggestion = isIdentifier25(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0; + const suggestion = isIdentifier26(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); @@ -77844,7 +78770,7 @@ ${lanes.join("\n")} const commonJSPropertyAccess = getCommonJSPropertyAccess(root); const resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias); const name = node.propertyName || node.name; - if (commonJSPropertyAccess && resolved && isIdentifier25(name)) { + if (commonJSPropertyAccess && resolved && isIdentifier26(name)) { return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias); } markSymbolOfAliasDeclarationIfTypeOnly( @@ -77858,7 +78784,7 @@ ${lanes.join("\n")} return resolved; } function getCommonJSPropertyAccess(node) { - if (isVariableDeclaration6(node) && node.initializer && isPropertyAccessExpression15(node.initializer)) { + if (isVariableDeclaration7(node) && node.initializer && isPropertyAccessExpression16(node.initializer)) { return node.initializer; } } @@ -78050,7 +78976,7 @@ ${lanes.join("\n")} return flags; } function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty, exportStarDeclaration, exportStarName) { - if (!aliasDeclaration || isPropertyAccessExpression15(aliasDeclaration)) return false; + if (!aliasDeclaration || isPropertyAccessExpression16(aliasDeclaration)) return false; const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration); if (isTypeOnlyImportOrExportDeclaration(aliasDeclaration)) { const links2 = getSymbolLinks(sourceSymbol); @@ -78210,7 +79136,7 @@ ${lanes.join("\n")} } else if (namespace === unknownSymbol) { return namespace; } - if (namespace.valueDeclaration && isInJSFile(namespace.valueDeclaration) && getEmitModuleResolutionKind(compilerOptions) !== 100 && isVariableDeclaration6(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && isCommonJsRequire(namespace.valueDeclaration.initializer)) { + if (namespace.valueDeclaration && isInJSFile(namespace.valueDeclaration) && getEmitModuleResolutionKind(compilerOptions) !== 100 && isVariableDeclaration7(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && isCommonJsRequire(namespace.valueDeclaration.initializer)) { const moduleName = namespace.valueDeclaration.initializer.arguments[0]; const moduleSym = resolveExternalModuleName(moduleName, moduleName); if (moduleSym) { @@ -78342,7 +79268,7 @@ ${lanes.join("\n")} )) { return void 0; } - const init = isVariableDeclaration6(decl) ? getDeclaredExpandoInitializer(decl) : getAssignedExpandoInitializer(decl); + const init = isVariableDeclaration7(decl) ? getDeclaredExpandoInitializer(decl) : getAssignedExpandoInitializer(decl); if (init) { const initSymbol = getSymbolOfNode(init); if (initSymbol) { @@ -78374,7 +79300,7 @@ ${lanes.join("\n")} return ambientModule; } const currentSourceFile = getSourceFileOfNode(location); - const contextSpecifier = isStringLiteralLike4(location) ? location : ((_a3 = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a3.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration6(location) && location.initializer && isRequireCall( + const contextSpecifier = isStringLiteralLike4(location) ? location : ((_a3 = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a3.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration7(location) && location.initializer && isRequireCall( location.initializer, /*requireStringLiteralLikeArgument*/ true @@ -78972,7 +79898,7 @@ ${lanes.join("\n")} } function getVariableDeclarationOfObjectLiteral(symbol2, meaning) { const firstDecl = !!length(symbol2.declarations) && first(symbol2.declarations); - if (meaning & 111551 && firstDecl && firstDecl.parent && isVariableDeclaration6(firstDecl.parent)) { + if (meaning & 111551 && firstDecl && firstDecl.parent && isVariableDeclaration7(firstDecl.parent)) { if (isObjectLiteralExpression12(firstDecl) && firstDecl === firstDecl.parent.initializer || isTypeLiteralNode2(firstDecl) && firstDecl === firstDecl.parent.type) { return getSymbolOfDeclaration(firstDecl.parent); } @@ -79471,7 +80397,7 @@ ${lanes.join("\n")} ) && // import clause without export isDeclarationVisible(anyImportSyntax.parent)) { return addVisibleAlias(declaration, anyImportSyntax); - } else if (isVariableDeclaration6(declaration) && isVariableStatement10(declaration.parent.parent) && !hasSyntacticModifier( + } else if (isVariableDeclaration7(declaration) && isVariableStatement10(declaration.parent.parent) && !hasSyntacticModifier( declaration.parent.parent, 32 /* Export */ @@ -79485,7 +80411,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) && isVariableDeclaration6(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement10(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) && isVariableStatement10(declaration.parent.parent.parent.parent) && !hasSyntacticModifier( declaration.parent.parent.parent.parent, 32 /* Export */ @@ -79803,7 +80729,7 @@ ${lanes.join("\n")} }, getJsDocPropertyOverride(syntacticContext, jsDocTypeLiteral, jsDocProperty) { const context = syntacticContext; - const name = isIdentifier25(jsDocProperty.name) ? jsDocProperty.name : jsDocProperty.name.right; + 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; return overrideTypeNode; @@ -81107,7 +82033,7 @@ ${lanes.join("\n")} let typeArguments = root.typeArguments; let qualifier = root.qualifier; if (qualifier) { - if (isIdentifier25(qualifier)) { + if (isIdentifier26(qualifier)) { if (typeArguments !== getIdentifierTypeArguments(qualifier)) { qualifier = setIdentifierTypeArguments(factory.cloneNode(qualifier), typeArguments); } @@ -81133,7 +82059,7 @@ ${lanes.join("\n")} } else { let typeArguments = root.typeArguments; let typeName = root.typeName; - if (isIdentifier25(typeName)) { + if (isIdentifier26(typeName)) { if (typeArguments !== getIdentifierTypeArguments(typeName)) { typeName = setIdentifierTypeArguments(factory.cloneNode(typeName), typeArguments); } @@ -81157,7 +82083,7 @@ ${lanes.join("\n")} function getAccessStack(ref) { let state = ref.typeName; const ids = []; - while (!isIdentifier25(state)) { + while (!isIdentifier26(state)) { ids.unshift(state.right); state = state.left; } @@ -81683,7 +82609,7 @@ ${lanes.join("\n")} modifiers, /*asteriskToken*/ void 0, - (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier25) : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier26) : factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, @@ -81693,7 +82619,7 @@ ${lanes.join("\n")} modifiers, /*asteriskToken*/ void 0, - (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier25) : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ? cast(options.name, isIdentifier26) : factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, @@ -82346,7 +83272,7 @@ ${lanes.join("\n")} context.approximateLength += specifier.length + 10; if (!nonRootParts || isEntityName(nonRootParts)) { if (nonRootParts) { - const lastId = isIdentifier25(nonRootParts) ? nonRootParts : nonRootParts.right; + const lastId = isIdentifier26(nonRootParts) ? nonRootParts : nonRootParts.right; setIdentifierTypeArguments( lastId, /*typeArguments*/ @@ -82367,7 +83293,7 @@ ${lanes.join("\n")} if (isTypeOf) { return factory.createTypeQueryNode(entityName); } else { - const lastId = isIdentifier25(entityName) ? entityName : entityName.right; + const lastId = isIdentifier26(entityName) ? entityName : entityName.right; const lastTypeArgs = getIdentifierTypeArguments(lastId); setIdentifierTypeArguments( lastId, @@ -83042,7 +83968,7 @@ ${lanes.join("\n")} const exportAssignment = find(statements, isExportAssignment3); const nsIndex = findIndex(statements, isModuleDeclaration); let ns = nsIndex !== -1 ? statements[nsIndex] : void 0; - if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier25(exportAssignment.expression) && isIdentifier25(ns.name) && idText(ns.name) === idText(exportAssignment.expression) && ns.body && isModuleBlock(ns.body)) { + if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier26(exportAssignment.expression) && isIdentifier26(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; @@ -83285,12 +84211,12 @@ ${lanes.join("\n")} } else { const flags = !(symbol2.flags & 2) ? ((_c = symbol2.parent) == null ? void 0 : _c.valueDeclaration) && isSourceFile((_d = symbol2.parent) == null ? void 0 : _d.valueDeclaration) ? 2 : void 0 : isConstantVariable(symbol2) ? 2 : 1; const name = needsPostExportDefault || !(symbol2.flags & 4) ? localName : getUnusedName(localName, symbol2); - let textRange = symbol2.declarations && find(symbol2.declarations, (d) => isVariableDeclaration6(d)); + let textRange = symbol2.declarations && find(symbol2.declarations, (d) => isVariableDeclaration7(d)); if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { textRange = textRange.parent.parent; } - const propertyAccessRequire = (_e = symbol2.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression15); - if (propertyAccessRequire && isBinaryExpression4(propertyAccessRequire.parent) && isIdentifier25(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(isPropertyAccessExpression16); + if (propertyAccessRequire && isBinaryExpression4(propertyAccessRequire.parent) && isIdentifier26(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); addResult( @@ -83784,14 +84710,14 @@ ${lanes.join("\n")} if (isBinaryExpression4(signature.declaration.parent) && getAssignmentDeclarationKind(signature.declaration.parent) === 5) { return signature.declaration.parent; } - if (isVariableDeclaration6(signature.declaration.parent) && signature.declaration.parent.parent) { + if (isVariableDeclaration7(signature.declaration.parent) && signature.declaration.parent.parent) { return signature.declaration.parent.parent; } } return signature.declaration; } function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) { - const nodeFlags = isIdentifier25(localName) ? 32 : 0; + const nodeFlags = isIdentifier26(localName) ? 32 : 0; const expanding = isExpanding(context); if (length(props)) { context.approximateLength += 14; @@ -83824,7 +84750,7 @@ ${lanes.join("\n")} addingDeclare = oldAddingDeclare; const declarations = results; results = oldResults; - const defaultReplaced = map2(declarations, (d) => isExportAssignment3(d) && !d.isExportEquals && isIdentifier25(d.expression) ? factory.createExportDeclaration( + const defaultReplaced = map2(declarations, (d) => isExportAssignment3(d) && !d.isExportEquals && isIdentifier26(d.expression) ? factory.createExportDeclaration( /*modifiers*/ void 0, /*isTypeOnly*/ @@ -83874,7 +84800,7 @@ ${lanes.join("\n")} context.enclosingDeclaration = e; let expr = e.expression; if (isEntityNameExpression(expr)) { - if (isIdentifier25(expr) && idText(expr) === "") { + if (isIdentifier26(expr) && idText(expr) === "") { return cleanup( /*result*/ void 0 @@ -84010,13 +84936,13 @@ ${lanes.join("\n")} } if (isBinaryExpression4(d) || isExportAssignment3(d)) { const expression = isExportAssignment3(d) ? d.expression : d.right; - if (isPropertyAccessExpression15(expression)) { + if (isPropertyAccessExpression16(expression)) { return idText(expression.name); } } if (isAliasSymbolDeclaration(d)) { const name = getNameOfDeclaration(d); - if (name && isIdentifier25(name)) { + if (name && isIdentifier26(name)) { return idText(name); } } @@ -84046,7 +84972,7 @@ ${lanes.join("\n")} if (((_b = (_a22 = node.parent) == null ? void 0 : _a22.parent) == null ? void 0 : _b.kind) === 261) { const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); const { propertyName } = node; - const propertyNameText = propertyName && isIdentifier25(propertyName) ? idText(propertyName) : void 0; + const propertyNameText = propertyName && isIdentifier26(propertyName) ? idText(propertyName) : void 0; context.approximateLength += 24 + localName.length + specifier2.length + ((propertyNameText == null ? void 0 : propertyNameText.length) ?? 0); addResult( factory.createImportDeclaration( @@ -84084,7 +85010,7 @@ ${lanes.join("\n")} } break; case 261: - if (isPropertyAccessExpression15(node.initializer)) { + if (isPropertyAccessExpression16(node.initializer)) { const initializer3 = node.initializer; const uniqueName = factory.createUniqueName(localName); const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); @@ -84121,7 +85047,7 @@ ${lanes.join("\n")} serializeMaybeAliasAssignment(symbol2); break; } - const isLocalImport = !(target.flags & 512) && !isVariableDeclaration6(node); + const isLocalImport = !(target.flags & 512) && !isVariableDeclaration7(node); context.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length; addResult( factory.createImportEqualsDeclaration( @@ -84461,7 +85387,7 @@ ${lanes.join("\n")} } 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, isVariableDeclaration6, isPropertySignature3, isBinaryExpression4, isPropertyAccessExpression15)); + const firstPropertyLikeDecl = (_a22 = p.declarations) == null ? void 0 : _a22.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration7, isPropertySignature3, isBinaryExpression4, isPropertyAccessExpression16)); if (p.flags & 98304 && useAccessors) { const result = []; if (p.flags & 65536) { @@ -84469,10 +85395,10 @@ ${lanes.join("\n")} if (d.kind === 179) { return d; } - if (isCallExpression14(d) && isBindableObjectDefinePropertyCall(d)) { + if (isCallExpression16(d) && isBindableObjectDefinePropertyCall(d)) { return forEach(d.arguments[2].properties, (propDecl) => { const id = getNameOfDeclaration(propDecl); - if (!!id && isIdentifier25(id) && idText(id) === "set") { + if (!!id && isIdentifier26(id) && idText(id) === "set") { return propDecl; } }); @@ -84538,7 +85464,7 @@ ${lanes.join("\n")} /*initializer*/ void 0 ), - ((_e = p.declarations) == null ? void 0 : _e.find(or(isPropertyDeclaration, isVariableDeclaration6))) || firstPropertyLikeDecl + ((_e = p.declarations) == null ? void 0 : _e.find(or(isPropertyDeclaration, isVariableDeclaration7))) || firstPropertyLikeDecl ); } if (p.flags & (8192 | 16)) { @@ -84961,7 +85887,7 @@ ${lanes.join("\n")} let declaration = firstDefined(symbol2.declarations, (d) => getNameOfDeclaration(d) ? d : void 0); const name2 = declaration && getNameOfDeclaration(declaration); if (declaration && name2) { - if (isCallExpression14(declaration) && isBindableObjectDefinePropertyCall(declaration)) { + if (isCallExpression16(declaration) && isBindableObjectDefinePropertyCall(declaration)) { return symbolName(symbol2); } if (isComputedPropertyName(name2) && !(getCheckFlags(symbol2) & 4096)) { @@ -85482,7 +86408,7 @@ ${lanes.join("\n")} return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { - if (isVariableDeclaration6(declaration) && declaration.parent.parent.kind === 250) { + if (isVariableDeclaration7(declaration) && declaration.parent.parent.kind === 250) { const indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression( declaration.parent.parent.expression, /*checkMode*/ @@ -85490,7 +86416,7 @@ ${lanes.join("\n")} ))); return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType; } - if (isVariableDeclaration6(declaration) && declaration.parent.parent.kind === 251) { + if (isVariableDeclaration7(declaration) && declaration.parent.parent.kind === 251) { const forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement) || anyType; } @@ -85509,7 +86435,7 @@ ${lanes.join("\n")} if (declaredType) { return addOptionality(declaredType, isProperty, isOptional); } - if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration6(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) & 32) && !(declaration.flags & 33554432)) { + if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration7(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) & 32) && !(declaration.flags & 33554432)) { if (!(getCombinedNodeFlagsCached(declaration) & 6) && (!declaration.initializer || isNullOrUndefined3(declaration.initializer))) { return autoType; } @@ -85700,7 +86626,7 @@ ${lanes.join("\n")} if (symbol2.declarations) { let jsdocType; for (const declaration of symbol2.declarations) { - const expression = isBinaryExpression4(declaration) || isCallExpression14(declaration) ? declaration : isAccessExpression(declaration) ? isBinaryExpression4(declaration.parent) ? declaration.parent : declaration : void 0; + const expression = isBinaryExpression4(declaration) || isCallExpression16(declaration) ? declaration : isAccessExpression(declaration) ? isBinaryExpression4(declaration.parent) ? declaration.parent : declaration : void 0; if (!expression) { continue; } @@ -85712,11 +86638,11 @@ ${lanes.join("\n")} definedInMethod = true; } } - if (!isCallExpression14(expression)) { + if (!isCallExpression16(expression)) { jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol2, declaration); } if (!jsdocType) { - (types || (types = [])).push(isBinaryExpression4(expression) || isCallExpression14(expression) ? getInitializerTypeFromAssignmentDeclaration(symbol2, resolvedSymbol, expression, kind) : neverType); + (types || (types = [])).push(isBinaryExpression4(expression) || isCallExpression16(expression) ? getInitializerTypeFromAssignmentDeclaration(symbol2, resolvedSymbol, expression, kind) : neverType); } } type = jsdocType; @@ -85755,7 +86681,7 @@ ${lanes.join("\n")} return void 0; } const exports2 = createSymbolTable(); - while (isBinaryExpression4(decl) || isPropertyAccessExpression15(decl)) { + while (isBinaryExpression4(decl) || isPropertyAccessExpression16(decl)) { const s2 = getSymbolOfNode(decl); if ((_a3 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a3.size) { mergeSymbolTable(exports2, s2.exports); @@ -85802,7 +86728,7 @@ ${lanes.join("\n")} return declaredType; } function getInitializerTypeFromAssignmentDeclaration(symbol2, resolvedSymbol, expression, kind) { - if (isCallExpression14(expression)) { + if (isCallExpression16(expression)) { if (resolvedSymbol) { return getTypeOfSymbol(resolvedSymbol); } @@ -85830,7 +86756,7 @@ ${lanes.join("\n")} if (containsSameNamedThisProperty(expression.left, expression.right)) { return anyType; } - const isDirectExport = kind === 1 && (isPropertyAccessExpression15(expression.left) || isElementAccessExpression8(expression.left)) && (isModuleExportsAccessExpression(expression.left.expression) || isIdentifier25(expression.left.expression) && isExportsIdentifier(expression.left.expression)); + const isDirectExport = kind === 1 && (isPropertyAccessExpression16(expression.left) || isElementAccessExpression8(expression.left)) && (isModuleExportsAccessExpression(expression.left.expression) || isIdentifier26(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); @@ -85901,7 +86827,7 @@ ${lanes.join("\n")} return type; } function containsSameNamedThisProperty(thisProperty, expression) { - return isPropertyAccessExpression15(thisProperty) && thisProperty.expression.kind === 110 && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); + return isPropertyAccessExpression16(thisProperty) && thisProperty.expression.kind === 110 && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); } function isDeclarationInConstructor(expression) { const thisContainer = getThisContainer( @@ -86148,9 +87074,9 @@ ${lanes.join("\n")} let type; if (declaration.kind === 278) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); - } else if (isBinaryExpression4(declaration) || isInJSFile(declaration) && (isCallExpression14(declaration) || (isPropertyAccessExpression15(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression4(declaration.parent))) { + } else if (isBinaryExpression4(declaration) || isInJSFile(declaration) && (isCallExpression16(declaration) || (isPropertyAccessExpression16(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression4(declaration.parent))) { type = getWidenedTypeForAssignmentDeclaration(symbol2); - } else if (isPropertyAccessExpression15(declaration) || isElementAccessExpression8(declaration) || isIdentifier25(declaration) || isStringLiteralLike4(declaration) || isNumericLiteral5(declaration) || isClassDeclaration5(declaration) || isFunctionDeclaration3(declaration) || isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration) || isMethodSignature(declaration) || isSourceFile(declaration)) { + } else if (isPropertyAccessExpression16(declaration) || isElementAccessExpression8(declaration) || isIdentifier26(declaration) || isStringLiteralLike4(declaration) || isNumericLiteral5(declaration) || isClassDeclaration5(declaration) || isFunctionDeclaration3(declaration) || isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration) || isMethodSignature(declaration) || isSourceFile(declaration)) { if (symbol2.flags & (16 | 8192 | 32 | 384 | 512)) { return getTypeOfFuncClassEnumModule(symbol2); } @@ -86171,7 +87097,7 @@ ${lanes.join("\n")} 0 /* Normal */ ); - } else if (isParameter(declaration) || isPropertyDeclaration(declaration) || isPropertySignature3(declaration) || isVariableDeclaration6(declaration) || isBindingElement(declaration) || isJSDocPropertyLikeTag(declaration)) { + } else if (isParameter(declaration) || isPropertyDeclaration(declaration) || isPropertySignature3(declaration) || isVariableDeclaration7(declaration) || isBindingElement(declaration) || isJSDocPropertyLikeTag(declaration)) { type = getWidenedTypeForVariableLikeDeclaration( declaration, /*reportErrors*/ @@ -89406,7 +90332,7 @@ ${lanes.join("\n")} case 304: return traverse(node.initializer); default: - return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild26(node, traverse); + return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild27(node, traverse); } } } @@ -90230,7 +91156,7 @@ ${lanes.join("\n")} return true; } function getIntendedTypeFromJSDocTypeReference(node) { - if (isIdentifier25(node.typeName)) { + if (isIdentifier26(node.typeName)) { const typeArgs = node.typeArguments; switch (node.typeName.escapedText) { case "String": @@ -92025,7 +92951,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) && isIdentifier25(node) && hasMatchingArgument(parent2, node); + return isCallOrNewExpression(parent2) && isIdentifier26(node) && hasMatchingArgument(parent2, node); } return every(symbol2.declarations, (d) => !isFunctionLike(d) || isDeprecatedDeclaration2(d)); } @@ -92663,7 +93589,7 @@ ${lanes.join("\n")} return links.resolvedType; } function getIdentifierChain(node) { - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { return [node]; } else { return append(getIdentifierChain(node.left), node.right); @@ -93380,7 +94306,7 @@ ${lanes.join("\n")} if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { const container = tp.symbol.declarations[0].parent; for (let n = node; n !== container; n = n.parent) { - if (!n || n.kind === 242 || n.kind === 195 && forEachChild26(n.extendsType, containsReference)) { + if (!n || n.kind === 242 || n.kind === 195 && forEachChild27(n.extendsType, containsReference)) { return true; } } @@ -93416,7 +94342,7 @@ ${lanes.join("\n")} case 174: return !node2.type && !!node2.body || some(node2.typeParameters, containsReference) || some(node2.parameters, containsReference) || !!node2.type && containsReference(node2.type); } - return !!forEachChild26(node2, containsReference); + return !!forEachChild27(node2, containsReference); } } function getHomomorphicTypeVariable(type) { @@ -95216,13 +96142,13 @@ ${lanes.join("\n")} if (!headMessage2 && maybeSuppress) { const savedErrorState = captureErrorCalculationState(); reportRelationError(headMessage2, source2, target2); - let canonical; + let canonical2; if (errorInfo && errorInfo !== savedErrorState.errorInfo) { - canonical = { code: errorInfo.code, messageText: errorInfo.messageText }; + canonical2 = { code: errorInfo.code, messageText: errorInfo.messageText }; } resetErrorInfo(savedErrorState); - if (canonical && errorInfo) { - errorInfo.canonicalHead = canonical; + if (canonical2 && errorInfo) { + errorInfo.canonicalHead = canonical2; } lastSkippedInfo = [source2, target2]; return; @@ -95317,7 +96243,7 @@ ${lanes.join("\n")} Debug.assertNode(propDeclaration, isObjectLiteralElementLike); const name = propDeclaration.name; errorNode = name; - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { suggestion = getSuggestionForNonexistentProperty(name, errorTarget); } } @@ -97961,7 +98887,7 @@ ${lanes.join("\n")} return wasOptional ? isOutermostOptionalChain(node) ? getOptionalType(type) : addOptionalTypeMarker(type) : type; } function getOptionalExpressionType(exprType, expression) { - return isExpressionOfOptionalChainRoot(expression) ? getNonNullableType(exprType) : isOptionalChain(expression) ? removeOptionalTypeMarker(exprType) : exprType; + return isExpressionOfOptionalChainRoot(expression) ? getNonNullableType(exprType) : isOptionalChain2(expression) ? removeOptionalTypeMarker(exprType) : exprType; } function removeMissingType(type, isOptional) { return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type; @@ -98196,7 +99122,7 @@ ${lanes.join("\n")} break; case 170: const param = declaration; - if (isIdentifier25(param.name)) { + if (isIdentifier26(param.name)) { const originalKeywordKind = identifierToKeywordKind(param.name); if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.includes(param) && (resolveName( param, @@ -99538,7 +100464,7 @@ ${lanes.join("\n")} case "BigUint64Array": return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later; case "await": - if (isCallExpression14(node.parent)) { + if (isCallExpression16(node.parent)) { return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; } // falls through @@ -99591,7 +100517,7 @@ ${lanes.join("\n")} const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && `${key}.${propName2}`; } - if (isElementAccessExpression8(node) && isIdentifier25(node.argumentExpression)) { + if (isElementAccessExpression8(node) && isIdentifier26(node.argumentExpression)) { const symbol2 = getResolvedSymbol(node.argumentExpression); if (isConstantVariable(symbol2) || isParameterOrMutableLocalVariable(symbol2) && !isSymbolAssigned(symbol2)) { const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); @@ -99622,7 +100548,7 @@ ${lanes.join("\n")} return target.kind === 237 && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 80: case 81: - return isThisInTypeQuery(source) ? target.kind === 110 : target.kind === 80 && getResolvedSymbol(source) === getResolvedSymbol(target) || (isVariableDeclaration6(target) || isBindingElement(target)) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfDeclaration(target); + return isThisInTypeQuery(source) ? target.kind === 110 : target.kind === 80 && getResolvedSymbol(source) === getResolvedSymbol(target) || (isVariableDeclaration7(target) || isBindingElement(target)) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfDeclaration(target); case 110: return target.kind === 110; case 108: @@ -99640,7 +100566,7 @@ ${lanes.join("\n")} return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); } } - if (isElementAccessExpression8(source) && isElementAccessExpression8(target) && isIdentifier25(source.argumentExpression) && isIdentifier25(target.argumentExpression)) { + if (isElementAccessExpression8(source) && isElementAccessExpression8(target) && isIdentifier26(source.argumentExpression) && isIdentifier26(target.argumentExpression)) { const symbol2 = getResolvedSymbol(source.argumentExpression); if (symbol2 === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol2) || isParameterOrMutableLocalVariable(symbol2) && !isSymbolAssigned(symbol2))) { return isMatchingReference(source.expression, target.expression); @@ -99655,7 +100581,7 @@ ${lanes.join("\n")} return false; } function getAccessedPropertyName(access) { - if (isPropertyAccessExpression15(access)) { + if (isPropertyAccessExpression16(access)) { return access.name.escapedText; } if (isElementAccessExpression8(access)) { @@ -99715,7 +100641,7 @@ ${lanes.join("\n")} return false; } function optionalChainContainsReference(source, target) { - while (isOptionalChain(source)) { + while (isOptionalChain2(source)) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -100333,7 +101259,7 @@ ${lanes.join("\n")} function isEvolvingArrayOperationTarget(node) { const root = getReferenceRoot(node); const parent2 = root.parent; - const isLengthPushOrUnshift = isPropertyAccessExpression15(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 && isIdentifier25(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); + const isLengthPushOrUnshift = isPropertyAccessExpression16(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 && isIdentifier26(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 @@ -100342,7 +101268,7 @@ ${lanes.join("\n")} return isLengthPushOrUnshift || isElementAssignment; } function isDeclarationWithExplicitTypeAnnotation(node) { - return (isVariableDeclaration6(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isParameter(node)) && !!(getEffectiveTypeAnnotationNode(node) || isInJSFile(node) && hasInitializer(node) && node.initializer && isFunctionExpressionOrArrowFunction(node.initializer) && getEffectiveReturnTypeNode(node.initializer)); + return (isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isParameter(node)) && !!(getEffectiveTypeAnnotationNode(node) || isInJSFile(node) && hasInitializer(node) && node.initializer && isFunctionExpressionOrArrowFunction(node.initializer) && getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol2, diagnostic) { symbol2 = resolveSymbol(symbol2); @@ -100361,7 +101287,7 @@ ${lanes.join("\n")} if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol2); } - if (isVariableDeclaration6(declaration) && declaration.parent.parent.kind === 251) { + if (isVariableDeclaration7(declaration) && declaration.parent.parent.kind === 251) { const statement = declaration.parent.parent; const expressionType = getTypeOfDottedName( statement.expression, @@ -100432,7 +101358,7 @@ ${lanes.join("\n")} void 0 ); } else if (node.expression.kind !== 108) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { funcType = checkNonNullType( getOptionalExpressionType(checkExpression(node.expression), node.expression), node.expression @@ -100462,9 +101388,9 @@ ${lanes.join("\n")} return isAccessExpression(invokedExpression) ? skipParentheses(invokedExpression.expression) : void 0; } function reportFlowControlError(node) { - const block = findAncestor(node, isFunctionOrModuleBlock); + const block2 = findAncestor(node, isFunctionOrModuleBlock); const sourceFile = getSourceFileOfNode(node); - const span = getSpanOfTokenAtPosition(sourceFile, block.statements.pos); + const span = getSpanOfTokenAtPosition(sourceFile, block2.statements.pos); diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)); } function isReachableFlowNode(flow) { @@ -100617,7 +101543,7 @@ ${lanes.join("\n")} case 207: case 208: const rootDeclaration = getRootDeclaration(node.parent); - return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration6(rootDeclaration) && isVarConstLike2(rootDeclaration); + return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration7(rootDeclaration) && isVarConstLike2(rootDeclaration); } return false; } @@ -100760,7 +101686,7 @@ ${lanes.join("\n")} if (!isReachableFlowNode(flow)) { return unreachableNeverType; } - if (isVariableDeclaration6(node) && (isInJSFile(node) || isVarConstLike2(node))) { + if (isVariableDeclaration7(node) && (isInJSFile(node) || isVarConstLike2(node))) { const init = getDeclaredExpandoInitializer(node); if (init && (init.kind === 219 || init.kind === 220)) { return getTypeAtFlowNode(flow.antecedent); @@ -100768,7 +101694,7 @@ ${lanes.join("\n")} } return declaredType; } - if (isVariableDeclaration6(node) && node.parent.parent.kind === 250 && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { + if (isVariableDeclaration7(node) && node.parent.parent.kind === 250 && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } return void 0; @@ -101015,7 +101941,7 @@ ${lanes.join("\n")} } function getCandidateDiscriminantPropertyAccess(expr) { if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) { - if (isIdentifier25(expr)) { + if (isIdentifier26(expr)) { const symbol2 = getResolvedSymbol(expr); const declaration = getExportSymbolOfValueSymbolIfExported(symbol2).valueDeclaration; if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) { @@ -101026,16 +101952,16 @@ ${lanes.join("\n")} if (isMatchingReference(reference, expr.expression)) { return expr; } - } else if (isIdentifier25(expr)) { + } else if (isIdentifier26(expr)) { const symbol2 = getResolvedSymbol(expr); if (isConstantVariable(symbol2)) { const declaration = symbol2.valueDeclaration; - if (isVariableDeclaration6(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) { + if (isVariableDeclaration7(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) { return declaration.initializer; } if (isBindingElement(declaration) && !declaration.initializer) { const parent2 = declaration.parent.parent; - if (isVariableDeclaration6(parent2) && !parent2.type && parent2.initializer && (isIdentifier25(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) { + if (isVariableDeclaration7(parent2) && !parent2.type && parent2.initializer && (isIdentifier26(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) { return declaration; } } @@ -101063,7 +101989,7 @@ ${lanes.join("\n")} if (propName2 === void 0) { return type; } - const optionalChain = isOptionalChain(access); + const optionalChain = isOptionalChain2(access); const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind( type, 98304 @@ -101570,7 +102496,7 @@ ${lanes.join("\n")} ) : neverType)); } function isMatchingConstructorReference(expr) { - return (isPropertyAccessExpression15(expr) && idText(expr.name) === "constructor" || isElementAccessExpression8(expr) && isStringLiteralLike4(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression); + return (isPropertyAccessExpression16(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) { @@ -101712,9 +102638,9 @@ ${lanes.join("\n")} return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue); } } - if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression15(callExpression.expression)) { + if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression16(callExpression.expression)) { const callAccess = callExpression.expression; - if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && isIdentifier25(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) { + if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && isIdentifier26(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( @@ -101775,7 +102701,7 @@ ${lanes.join("\n")} const symbol2 = getResolvedSymbol(expr); if (isConstantVariable(symbol2)) { const declaration = symbol2.valueDeclaration; - if (declaration && isVariableDeclaration6(declaration) && !declaration.type && declaration.initializer && isConstantReference(reference)) { + if (declaration && isVariableDeclaration7(declaration) && !declaration.type && declaration.initializer && isConstantReference(reference)) { inlineLevel++; const result = narrowType(type, declaration.initializer, assumeTrue); inlineLevel--; @@ -101885,7 +102811,7 @@ ${lanes.join("\n")} return !symbol2.lastAssignmentPos || location && Math.abs(symbol2.lastAssignmentPos) < location.pos; } function isSomeSymbolAssigned(rootDeclaration) { - Debug.assert(isVariableDeclaration6(rootDeclaration) || isParameter(rootDeclaration)); + Debug.assert(isVariableDeclaration7(rootDeclaration) || isParameter(rootDeclaration)); return isSomeSymbolAssignedWorker(rootDeclaration.name); } function isSomeSymbolAssignedWorker(node) { @@ -101945,7 +102871,7 @@ ${lanes.join("\n")} if (isTypeNode(node)) { return; } - forEachChild26(node, markNodeAssignments); + forEachChild27(node, markNodeAssignments); } function extendAssignmentPosition(node, declaration) { let pos = node.pos; @@ -101974,7 +102900,7 @@ ${lanes.join("\n")} } function isParameterOrMutableLocalVariable(symbol2) { const declaration = symbol2.valueDeclaration && getRootDeclaration(symbol2.valueDeclaration); - return !!declaration && (isParameter(declaration) || isVariableDeclaration6(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration))); + return !!declaration && (isParameter(declaration) || isVariableDeclaration7(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration))); } function isMutableLocalVariableDeclaration(declaration) { return !!(declaration.parent.flags & 1) && !(getCombinedModifierFlags(declaration) & 32 || declaration.parent.parent.kind === 244 && isGlobalSourceFile(declaration.parent.parent.parent)); @@ -102034,7 +102960,7 @@ ${lanes.join("\n")} )); } function hasContextualTypeWithNoGenericTypes(node, checkMode) { - const contextualType = (isIdentifier25(node) || isPropertyAccessExpression15(node) || isElementAccessExpression8(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 ? getContextualType2( + const contextualType = (isIdentifier26(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 ? getContextualType2( node, 8 /* SkipBindingPatterns */ @@ -102092,9 +103018,9 @@ ${lanes.join("\n")} case 8: return markDecoratorAliasReferenced(location); case 0: { - if (isIdentifier25(location) && (isExpressionNode(location) || isShorthandPropertyAssignment6(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) { + if (isIdentifier26(location) && (isExpressionNode(location) || isShorthandPropertyAssignment6(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) { if (isPropertyAccessOrQualifiedName(location.parent)) { - const left = isPropertyAccessExpression15(location.parent) ? location.parent.expression : location.parent.left; + const left = isPropertyAccessExpression16(location.parent) ? location.parent.expression : location.parent.left; if (left !== location) return; } markIdentifierAliasReferenced(location); @@ -102145,8 +103071,8 @@ ${lanes.join("\n")} } } function markPropertyAliasReferenced(location, propSymbol, parentType) { - const left = isPropertyAccessExpression15(location) ? location.expression : location.left; - if (isThisIdentifier(left) || !isIdentifier25(left)) { + const left = isPropertyAccessExpression16(location) ? location.expression : location.left; + if (isThisIdentifier(left) || !isIdentifier26(left)) { return; } const parentSymbol = getResolvedSymbol(left); @@ -102164,7 +103090,7 @@ ${lanes.join("\n")} } let prop = propSymbol; if (!prop && !parentType) { - const right = isPropertyAccessExpression15(location) ? location.name : location.right; + const right = isPropertyAccessExpression16(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); @@ -102176,7 +103102,7 @@ ${lanes.join("\n")} return; } function markExportAssignmentAliasReferenced(location) { - if (isIdentifier25(location.expression)) { + if (isIdentifier26(location.expression)) { const id = location.expression; const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName( id, @@ -102618,7 +103544,7 @@ ${lanes.join("\n")} while (flowContainer !== declarationContainer && (flowContainer.kind === 219 || flowContainer.kind === 220 || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) { flowContainer = getControlFlowContainer(flowContainer); } - const isNeverInitialized = immediateDeclaration && isVariableDeclaration6(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol2); + const isNeverInitialized = immediateDeclaration && isVariableDeclaration7(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol2); const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 282) || node.parent.kind === 236 || declaration.kind === 261 && declaration.exclamationToken || declaration.flags & 33554432; const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type); const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer); @@ -102646,7 +103572,7 @@ ${lanes.join("\n")} var _a3; const parent2 = node.parent; if (parent2) { - if (isPropertyAccessExpression15(parent2) && parent2.expression === node) { + if (isPropertyAccessExpression16(parent2) && parent2.expression === node) { return false; } if (isExportSpecifier(parent2) && parent2.isTypeOnly) { @@ -102752,7 +103678,7 @@ ${lanes.join("\n")} } } function findFirstSuperCall(node) { - return isSuperCall(node) ? node : isFunctionLike(node) ? void 0 : forEachChild26(node, findFirstSuperCall); + return isSuperCall(node) ? node : isFunctionLike(node) ? void 0 : forEachChild27(node, findFirstSuperCall); } function classDeclarationExtendsNull(classDecl) { const classSymbol = getSymbolOfDeclaration(classDecl); @@ -102920,9 +103846,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) && isIdentifier25(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression12(container.parent.parent) && isCallExpression14(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9) { + } 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) { return container.parent.parent.parent.arguments[0].expression; - } else if (isMethodDeclaration(container) && isIdentifier25(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && isObjectLiteralExpression12(container.parent) && isCallExpression14(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && getAssignmentDeclarationKind(container.parent.parent) === 9) { + } 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) { return container.parent.parent.arguments[0].expression; } } @@ -103117,7 +104043,7 @@ ${lanes.join("\n")} const target = parent2.left; if (isAccessExpression(target)) { const { expression } = target; - if (inJs && isIdentifier25(expression)) { + if (inJs && isIdentifier26(expression)) { const sourceFile = getSourceFileOfNode(parent2); if (sourceFile.commonJsModuleIndicator && getResolvedSymbol(expression) === sourceFile.symbol) { return void 0; @@ -103411,10 +104337,10 @@ ${lanes.join("\n")} if (canHaveSymbol(e) && e.symbol) { return e.symbol; } - if (isIdentifier25(e)) { + if (isIdentifier26(e)) { return getResolvedSymbol(e); } - if (isPropertyAccessExpression15(e)) { + if (isPropertyAccessExpression16(e)) { const lhsType = getTypeOfExpression(e.expression); return isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText); } @@ -103462,7 +104388,7 @@ ${lanes.join("\n")} const overallAnnotation = getEffectiveTypeAnnotationNode(decl2); if (overallAnnotation) { return getTypeFromTypeNode(overallAnnotation); - } else if (isIdentifier25(lhs.expression)) { + } else if (isIdentifier26(lhs.expression)) { const id = lhs.expression; const parentSymbol = resolveName( id, @@ -103509,7 +104435,7 @@ ${lanes.join("\n")} if (kind === 4) { return true; } - if (!isInJSFile(declaration) || kind !== 5 || !isIdentifier25(declaration.left.expression)) { + if (!isInJSFile(declaration) || kind !== 5 || !isIdentifier26(declaration.left.expression)) { return false; } const name = declaration.left.expression.escapedText; @@ -104879,7 +105805,7 @@ ${lanes.join("\n")} return name.includes("-"); } function isJsxIntrinsicTagName(tagName) { - return isIdentifier25(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName); + return isIdentifier26(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName); } function checkJsxAttribute(node, checkMode) { return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType; @@ -104925,7 +105851,7 @@ ${lanes.join("\n")} } if (contextualType) { const prop = getPropertyOfType(contextualType, member.escapedName); - if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier25(attributeDecl.name)) { + if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier26(attributeDecl.name)) { addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); } } @@ -105090,7 +106016,7 @@ ${lanes.join("\n")} if (!links.resolvedSymbol) { const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node); if (!isErrorType(intrinsicElementsType)) { - if (!isIdentifier25(node.tagName) && !isJsxNamespacedName(node.tagName)) return Debug.fail(); + if (!isIdentifier26(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) { @@ -105592,7 +106518,7 @@ ${lanes.join("\n")} return; } if (nodeText2 !== void 0 && nodeText2.length < 100) { - if (isIdentifier25(node) && nodeText2 === "undefined") { + if (isIdentifier26(node) && nodeText2 === "undefined") { error210(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined"); return; } @@ -105646,7 +106572,7 @@ ${lanes.join("\n")} if (nonNullType.flags & 16384) { if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); - if (isIdentifier25(node) && nodeText2 === "undefined") { + if (isIdentifier26(node) && nodeText2 === "undefined") { error210(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2); return nonNullType; } @@ -105844,7 +106770,7 @@ ${lanes.join("\n")} } } else { if (isAnyLike) { - if (isIdentifier25(left) && parentSymbol) { + if (isIdentifier26(left) && parentSymbol) { markLinkedReferences( node, 2, @@ -105899,7 +106825,7 @@ ${lanes.join("\n")} if (compilerOptions.noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1) { propType = getUnionType([propType, missingType]); } - if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression15(node)) { + if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression16(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)) { @@ -105933,7 +106859,7 @@ ${lanes.join("\n")} false, suggestion.valueDeclaration ); - return !(file2 !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression15(node) && node.expression.kind === 110 && suggestionHasNoExtendsOrDecorators); + return !(file2 !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression16(node) && node.expression.kind === 110 && suggestionHasNoExtendsOrDecorators); } } return false; @@ -105961,7 +106887,7 @@ ${lanes.join("\n")} } } } - } else if (strictNullChecks && prop && prop.valueDeclaration && isPropertyAccessExpression15(prop.valueDeclaration) && getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) && getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) { + } else if (strictNullChecks && prop && prop.valueDeclaration && isPropertyAccessExpression16(prop.valueDeclaration) && getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) && getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) { assumeUninitialized = true; } const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); @@ -106122,7 +107048,7 @@ ${lanes.join("\n")} let props = getPropertiesOfType(containingType); if (typeof name !== "string") { const parent2 = name.parent; - if (isPropertyAccessExpression15(parent2)) { + if (isPropertyAccessExpression16(parent2)) { props = filter(props, (prop) => isValidPropertyAccessForCompletions(parent2, containingType, prop)); } name = idText(name); @@ -106311,7 +107237,7 @@ ${lanes.join("\n")} } if (property.valueDeclaration && isPrivateIdentifierClassElementDeclaration(property.valueDeclaration)) { const declClass = getContainingClass(property.valueDeclaration); - return !isOptionalChain(node) && !!findAncestor(node, (parent2) => parent2 === declClass); + return !isOptionalChain2(node) && !!findAncestor(node, (parent2) => parent2 === declClass); } return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType, property); } @@ -106382,7 +107308,7 @@ ${lanes.join("\n")} return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } function callLikeExpressionMayHaveTypeArguments(node) { - return isCallOrNewExpression(node) || isTaggedTemplateExpression4(node) || isJsxOpeningLikeElement(node); + return isCallOrNewExpression(node) || isTaggedTemplateExpression5(node) || isJsxOpeningLikeElement(node); } function resolveUntypedCall(node) { if (callLikeExpressionMayHaveTypeArguments(node)) { @@ -106585,7 +107511,7 @@ ${lanes.join("\n")} return voidType; } const thisArgumentType = checkExpression(thisArgumentNode); - return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType; + return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain2(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType; } function inferTypeArguments(node, signature, args, checkMode, context) { if (isJsxOpeningLikeElement(node)) { @@ -106912,7 +107838,7 @@ ${lanes.join("\n")} return void 0; } const thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && !(isNewExpression17(node) || isCallExpression14(node) && isSuperProperty(node.expression))) { + if (thisType && thisType !== voidType && !(isNewExpression19(node) || isCallExpression16(node) && isSuperProperty(node.expression))) { const thisArgumentNode = getThisArgumentOfCall(node); const thisArgumentType = getThisArgumentType(thisArgumentNode); const errorNode = reportErrors2 ? thisArgumentNode || node : void 0; @@ -107086,11 +108012,11 @@ ${lanes.join("\n")} } function getDiagnosticSpanForCallNode(node) { const sourceFile = getSourceFileOfNode(node); - const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression15(node.expression) ? node.expression.name : node.expression); + const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression16(node.expression) ? node.expression.name : node.expression); return { start, length: length2, sourceFile }; } function getDiagnosticForCallNode(node, message, ...args) { - if (isCallExpression14(node)) { + if (isCallExpression16(node)) { const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node); if ("message" in message) { return createFileDiagnostic(sourceFile, start, length2, message, ...args); @@ -107105,10 +108031,10 @@ ${lanes.join("\n")} } function getErrorNodeForCallNode(callLike) { if (isCallOrNewExpression(callLike)) { - return isPropertyAccessExpression15(callLike.expression) ? callLike.expression.name : callLike.expression; + return isPropertyAccessExpression16(callLike.expression) ? callLike.expression.name : callLike.expression; } - if (isTaggedTemplateExpression4(callLike)) { - return isPropertyAccessExpression15(callLike.tag) ? callLike.tag.name : callLike.tag; + if (isTaggedTemplateExpression5(callLike)) { + return isPropertyAccessExpression16(callLike.tag) ? callLike.tag.name : callLike.tag; } if (isJsxOpeningLikeElement(callLike)) { return callLike.tagName; @@ -107116,7 +108042,7 @@ ${lanes.join("\n")} return callLike; } function isPromiseResolveArityError(node) { - if (!isCallExpression14(node) || !isIdentifier25(node.expression)) return false; + if (!isCallExpression16(node) || !isIdentifier26(node.expression)) return false; const symbol2 = resolveName( node.expression, node.expression.escapedText, @@ -107127,7 +108053,7 @@ ${lanes.join("\n")} false ); const decl = symbol2 == null ? void 0 : symbol2.valueDeclaration; - if (!decl || !isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !isNewExpression17(decl.parent.parent) || !isIdentifier25(decl.parent.parent.expression)) { + if (!decl || !isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !isNewExpression19(decl.parent.parent) || !isIdentifier26(decl.parent.parent.expression)) { return false; } const globalPromiseSymbol = getGlobalPromiseConstructorSymbol( @@ -107690,7 +108616,7 @@ ${lanes.join("\n")} } return maxParamsIndex; } - function resolveCallExpression(node, candidatesOutArray, checkMode) { + function resolveCallExpression2(node, candidatesOutArray, checkMode) { if (node.expression.kind === 108) { const superType = checkSuperExpression(node.expression); if (isTypeAny(superType)) { @@ -107991,7 +108917,7 @@ ${lanes.join("\n")} ); } let headMessage = isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable; - if (isCallExpression14(errorTarget.parent) && errorTarget.parent.arguments.length === 0) { + if (isCallExpression16(errorTarget.parent) && errorTarget.parent.arguments.length === 0) { const { resolvedSymbol } = getNodeLinks(errorTarget); if (resolvedSymbol && resolvedSymbol.flags & 32768) { headMessage = Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without; @@ -108008,7 +108934,7 @@ ${lanes.join("\n")} if (relatedInfo) { addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo)); } - if (isCallExpression14(errorTarget.parent)) { + if (isCallExpression16(errorTarget.parent)) { const { start, length: length2 } = getDiagnosticSpanForCallNode(errorTarget.parent); diagnostic.start = start; diagnostic.length = length2; @@ -108313,7 +109239,7 @@ ${lanes.join("\n")} function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { case 214: - return resolveCallExpression(node, candidatesOutArray, checkMode); + return resolveCallExpression2(node, candidatesOutArray, checkMode); case 215: return resolveNewExpression(node, candidatesOutArray, checkMode); case 216: @@ -108357,7 +109283,7 @@ ${lanes.join("\n")} if (!node || !isInJSFile(node)) { return false; } - const func = isFunctionDeclaration3(node) || isFunctionExpression6(node) ? node : (isVariableDeclaration6(node) || isPropertyAssignment11(node)) && node.initializer && isFunctionExpression6(node.initializer) ? node.initializer : void 0; + const func = isFunctionDeclaration3(node) || isFunctionExpression6(node) ? node : (isVariableDeclaration7(node) || isPropertyAssignment11(node)) && node.initializer && isFunctionExpression6(node.initializer) ? node.initializer : void 0; if (func) { if (getJSDocClassTag(node)) return true; if (isPropertyAssignment11(walkUpParenthesizedExpressions(func.parent))) return false; @@ -108404,7 +109330,7 @@ ${lanes.join("\n")} } let name; let decl; - if (isVariableDeclaration6(node.parent) && node.parent.initializer === node) { + if (isVariableDeclaration7(node.parent) && node.parent.initializer === node) { if (!isInJSFile(node) && !(isVarConstLike2(node.parent) && isFunctionLikeDeclaration(node))) { return void 0; } @@ -108417,7 +109343,7 @@ ${lanes.join("\n")} name = parentNode.left; decl = name; } else if (parentNodeOperator === 57 || parentNodeOperator === 61) { - if (isVariableDeclaration6(parentNode.parent) && parentNode.parent.initializer === parentNode) { + if (isVariableDeclaration7(parentNode.parent) && parentNode.parent.initializer === parentNode) { name = parentNode.parent.name; decl = parentNode.parent; } else if (isBinaryExpression4(parentNode.parent) && parentNode.parent.operatorToken.kind === 64 && (allowDeclaration || parentNode.parent.right === parentNode)) { @@ -108536,12 +109462,12 @@ ${lanes.join("\n")} } } function isSymbolOrSymbolForCall(node) { - if (!isCallExpression14(node)) return false; + if (!isCallExpression16(node)) return false; let left = node.expression; - if (isPropertyAccessExpression15(left) && left.name.escapedText === "for") { + if (isPropertyAccessExpression16(left) && left.name.escapedText === "for") { left = left.expression; } - if (!isIdentifier25(left) || left.escapedText !== "Symbol") { + if (!isIdentifier26(left) || left.escapedText !== "Symbol") { return false; } const globalESSymbol = getGlobalESSymbolConstructorSymbol( @@ -108678,7 +109604,7 @@ ${lanes.join("\n")} )) { return false; } - if (!isIdentifier25(node.expression)) return Debug.fail(); + if (!isIdentifier26(node.expression)) return Debug.fail(); const resolvedRequire = resolveName( node.expression, node.expression.escapedText, @@ -108931,7 +109857,7 @@ ${lanes.join("\n")} } if (node.keywordToken === 102) { if (node.name.escapedText === "defer") { - Debug.assert(!isCallExpression14(node.parent) || node.parent.expression !== node, "Trying to get the type of `import.defer` in `import.defer(...)`"); + Debug.assert(!isCallExpression16(node.parent) || node.parent.expression !== node, "Trying to get the type of `import.defer` in `import.defer(...)`"); return errorType; } return checkImportMetaProperty(node); @@ -109018,7 +109944,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(isIdentifier25(d.name)); + Debug.assert(isIdentifier26(d.name)); return d.name.escapedText; } function getParameterNameAtPosition(signature, pos, overrideRestType) { @@ -109065,7 +109991,7 @@ ${lanes.join("\n")} const associatedName = associatedNames == null ? void 0 : associatedNames[index]; const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken); if (associatedName) { - Debug.assert(isIdentifier25(associatedName.name)); + Debug.assert(isIdentifier26(associatedName.name)); return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement }; } return void 0; @@ -109076,10 +110002,10 @@ ${lanes.join("\n")} return void 0; } function getParameterDeclarationIdentifier(symbol2) { - return symbol2.valueDeclaration && isParameter(symbol2.valueDeclaration) && isIdentifier25(symbol2.valueDeclaration.name) && symbol2.valueDeclaration.name; + return symbol2.valueDeclaration && isParameter(symbol2.valueDeclaration) && isIdentifier26(symbol2.valueDeclaration.name) && symbol2.valueDeclaration.name; } function isValidDeclarationForTupleLabel(d) { - return d.kind === 203 || isParameter(d) && d.name && isIdentifier25(d.name); + return d.kind === 203 || isParameter(d) && d.name && isIdentifier26(d.name); } function getNameableDeclarationAtPosition(signature, pos) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -109961,7 +110887,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 || !isIdentifier25(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { + if (!initType || initType.flags & 16 || !isIdentifier26(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { return; } const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType); @@ -110146,7 +111072,7 @@ ${lanes.join("\n")} return true; } function isReadonlyAssignmentDeclaration(d) { - if (!isCallExpression14(d)) { + if (!isCallExpression16(d)) { return false; } if (!isBindableObjectDefinePropertyCall(d)) { @@ -110233,7 +111159,7 @@ ${lanes.join("\n")} error210(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } - if (isPropertyAccessExpression15(expr) && isPrivateIdentifier(expr.name)) { + if (isPropertyAccessExpression16(expr) && isPrivateIdentifier(expr.name)) { error210(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); } const links = getNodeLinks(expr); @@ -111388,8 +112314,8 @@ ${lanes.join("\n")} } } function isIndirectCall(node) { - return node.parent.kind === 218 && isNumericLiteral5(node.left) && node.left.text === "0" && (isCallExpression14(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) || isIdentifier25(node.right) && node.right.escapedText === "eval"); + 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"); } function checkForDisallowedESSymbolOperand(operator2) { const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint( @@ -111439,7 +112365,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 && isPropertyAccessExpression15(left) && maybeTypeOfKind( + if (exactOptionalPropertyTypes && isPropertyAccessExpression16(left) && maybeTypeOfKind( valueType, 32768 /* Undefined */ @@ -111538,7 +112464,7 @@ ${lanes.join("\n")} } } function isGlobalNaN(expr) { - if (isIdentifier25(expr) && expr.escapedText === "NaN") { + if (isIdentifier26(expr) && expr.escapedText === "NaN") { const globalNaNSymbol = getGlobalNaNSymbol(); return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); } @@ -112137,7 +113063,7 @@ ${lanes.join("\n")} const type = getQuickTypeOfExpression(expr.expression); return type ? getAwaitedType(type) : void 0; } - if (isCallExpression14(expr) && expr.expression.kind !== 108 && !isRequireCall( + if (isCallExpression16(expr) && expr.expression.kind !== 108 && !isRequireCall( expr, /*requireStringLiteralLikeArgument*/ true @@ -112394,14 +113320,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 && isIdentifier25(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 177 && isIdentifier26(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 && isIdentifier25(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { + if (node.name && isIdentifier26(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); } @@ -112759,7 +113685,7 @@ ${lanes.join("\n")} } function checkMethodDeclaration(node) { if (!checkGrammarMethod(node)) checkGrammarComputedPropertyName(node.name); - if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier25(node.name) && idText(node.name) === "constructor") { + if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier26(node.name) && idText(node.name) === "constructor") { error210(node.name, Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); @@ -112793,7 +113719,7 @@ ${lanes.join("\n")} } function checkClassStaticBlockDeclaration(node) { checkGrammarModifiers(node); - forEachChild26(node, checkSourceElement); + forEachChild27(node, checkSourceElement); } function checkConstructorDeclaration(node) { checkSignatureDeclaration(node); @@ -112866,10 +113792,10 @@ ${lanes.join("\n")} if (isThisContainerOrFunctionBlock(node)) { return false; } - return !!forEachChild26(node, nodeImmediatelyReferencesSuperOrThis); + return !!forEachChild27(node, nodeImmediatelyReferencesSuperOrThis); } function checkAccessorDeclaration(node) { - if (isIdentifier25(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { + if (isIdentifier26(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { error210(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor); } addLazyDiagnostic(checkAccessorDeclarationDiagnostics); @@ -113138,7 +114064,7 @@ ${lanes.join("\n")} checkSourceElement(node.type); } function checkConditionalType(node) { - forEachChild26(node, checkSourceElement); + forEachChild27(node, checkSourceElement); } function checkInferType(node) { if (!findAncestor(node, (n) => n.parent && n.parent.kind === 195 && n.parent.extendsType === n)) { @@ -113269,7 +114195,7 @@ ${lanes.join("\n")} return; } let seen = false; - const subsequentNode = forEachChild26(node.parent, (c) => { + const subsequentNode = forEachChild27(node.parent, (c) => { if (seen) { return c; } else { @@ -113843,7 +114769,7 @@ ${lanes.join("\n")} node = node.expression; continue; } - if (isCallExpression14(node)) { + if (isCallExpression16(node)) { if (!canHaveCallExpression) { errorNode = node; } @@ -113854,7 +114780,7 @@ ${lanes.join("\n")} canHaveCallExpression = false; continue; } - if (isPropertyAccessExpression15(node)) { + if (isPropertyAccessExpression16(node)) { if (node.questionDotToken) { errorNode = node.questionDotToken; } @@ -113862,7 +114788,7 @@ ${lanes.join("\n")} canHaveCallExpression = false; continue; } - if (!isIdentifier25(node)) { + if (!isIdentifier26(node)) { errorNode = node; } break; @@ -113983,7 +114909,7 @@ ${lanes.join("\n")} return void 0; } if (commonEntityName) { - if (!isIdentifier25(commonEntityName) || !isIdentifier25(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) { + if (!isIdentifier26(commonEntityName) || !isIdentifier26(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) { return void 0; } } else { @@ -114290,7 +115216,7 @@ ${lanes.join("\n")} addDiagnostic(declaration, 0, createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { - return isIdentifier25(node) && idText(node).charCodeAt(0) === 95; + return isIdentifier26(node) && idText(node).charCodeAt(0) === 95; } function checkUnusedClassMembers(node, addDiagnostic) { for (const member of node.members) { @@ -114381,7 +115307,7 @@ ${lanes.join("\n")} } return isIdentifierThatStartsWithUnderscore(declaration.name); } - return isAmbientModule(declaration) || (isVariableDeclaration6(declaration) && isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderscore(declaration.name); + return isAmbientModule(declaration) || (isVariableDeclaration7(declaration) && isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderscore(declaration.name); } function checkUnusedLocalsAndParameters(nodeWithLocals, addDiagnostic) { const unusedImports = /* @__PURE__ */ new Map(); @@ -114403,7 +115329,7 @@ ${lanes.join("\n")} if (declaration === lastElement || !last(declaration.parent.elements).dotDotDotToken) { addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId); } - } else if (isVariableDeclaration6(declaration)) { + } else if (isVariableDeclaration7(declaration)) { const blockScopeKind = getCombinedNodeFlagsCached(declaration) & 7; const name = getNameOfDeclaration(declaration); if (blockScopeKind !== 4 && blockScopeKind !== 6 || !name || !isIdentifierThatStartsWithUnderscore(name)) { @@ -114615,7 +115541,7 @@ ${lanes.join("\n")} function checkWeakMapSetCollision(node) { const enclosingBlockScope = getEnclosingBlockScopeContainer(node); if (getNodeCheckFlags(enclosingBlockScope) & 1048576) { - Debug.assert(isNamedDeclaration(node) && isIdentifier25(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier"); + Debug.assert(isNamedDeclaration(node) && isIdentifier26(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); } } @@ -114644,7 +115570,7 @@ ${lanes.join("\n")} } } if (hasCollision) { - Debug.assert(isNamedDeclaration(node) && isIdentifier25(node.name), "The target of a Reflect collision check should be an identifier"); + Debug.assert(isNamedDeclaration(node) && isIdentifier26(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"); } } @@ -114669,7 +115595,7 @@ ${lanes.join("\n")} } const symbol2 = getSymbolOfDeclaration(node); if (symbol2.flags & 1) { - if (!isIdentifier25(node.name)) return Debug.fail(); + if (!isIdentifier26(node.name)) return Debug.fail(); const localDeclarationSymbol = resolveName( node, node.name.escapedText, @@ -114715,7 +115641,7 @@ ${lanes.join("\n")} } } if (isBindingElement(node)) { - if (node.propertyName && isIdentifier25(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) { + if (node.propertyName && isIdentifier26(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) { potentialUnusedRenamedBindingElementsInTypes.push(node); return; } @@ -114965,11 +115891,11 @@ ${lanes.join("\n")} return; } const type = location === condExpr2 ? condType : checkExpression(location); - if (type.flags & 1024 && isPropertyAccessExpression15(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { + if (type.flags & 1024 && isPropertyAccessExpression16(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { error210(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false"); return; } - const isPropertyExpressionCast = isPropertyAccessExpression15(location) && isTypeAssertion(location.expression); + const isPropertyExpressionCast = isPropertyAccessExpression16(location) && isTypeAssertion(location.expression); if (!hasTypeFacts( type, 4194304 @@ -114984,7 +115910,7 @@ ${lanes.join("\n")} if (callSignatures.length === 0 && !isPromise) { return; } - const testedNode = isIdentifier25(location) ? location : isPropertyAccessExpression15(location) ? location.name : void 0; + const testedNode = isIdentifier26(location) ? location : isPropertyAccessExpression16(location) ? location.name : void 0; const testedSymbol = testedNode && getSymbolAtLocation(testedNode); if (!testedSymbol && !isPromise) { return; @@ -115006,25 +115932,25 @@ ${lanes.join("\n")} } } function isSymbolUsedInConditionBody(expr, body, testedNode, testedSymbol) { - return !!forEachChild26(body, function check2(childNode) { - if (isIdentifier25(childNode)) { + return !!forEachChild27(body, function check2(childNode) { + if (isIdentifier26(childNode)) { const childSymbol = getSymbolAtLocation(childNode); if (childSymbol && childSymbol === testedSymbol) { - if (isIdentifier25(expr) || isIdentifier25(testedNode) && isBinaryExpression4(testedNode.parent)) { + if (isIdentifier26(expr) || isIdentifier26(testedNode) && isBinaryExpression4(testedNode.parent)) { return true; } let testedExpression = testedNode.parent; let childExpression = childNode.parent; while (testedExpression && childExpression) { - if (isIdentifier25(testedExpression) && isIdentifier25(childExpression) || testedExpression.kind === 110 && childExpression.kind === 110) { + if (isIdentifier26(testedExpression) && isIdentifier26(childExpression) || testedExpression.kind === 110 && childExpression.kind === 110) { return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression); - } else if (isPropertyAccessExpression15(testedExpression) && isPropertyAccessExpression15(childExpression)) { + } else if (isPropertyAccessExpression16(testedExpression) && isPropertyAccessExpression16(childExpression)) { if (getSymbolAtLocation(testedExpression.name) !== getSymbolAtLocation(childExpression.name)) { return false; } childExpression = childExpression.expression; testedExpression = testedExpression.expression; - } else if (isCallExpression14(testedExpression) && isCallExpression14(childExpression)) { + } else if (isCallExpression16(testedExpression) && isCallExpression16(childExpression)) { childExpression = childExpression.expression; testedExpression = testedExpression.expression; } else { @@ -115033,19 +115959,19 @@ ${lanes.join("\n")} } } } - return forEachChild26(childNode, check2); + return forEachChild27(childNode, check2); }); } function isSymbolUsedInBinaryExpressionChain(node, testedSymbol) { while (isBinaryExpression4(node) && node.operatorToken.kind === 56) { - const isUsed = forEachChild26(node.right, function visit(child) { - if (isIdentifier25(child)) { + const isUsed = forEachChild27(node.right, function visit(child) { + if (isIdentifier26(child)) { const symbol2 = getSymbolAtLocation(child); if (symbol2 && symbol2 === testedSymbol) { return true; } } - return forEachChild26(child, visit); + return forEachChild27(child, visit); }); if (isUsed) { return true; @@ -116022,7 +116948,7 @@ ${lanes.join("\n")} } function checkThrowStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (isIdentifier25(node.expression) && !node.expression.escapedText) { + if (isIdentifier26(node.expression) && !node.expression.escapedText) { grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } } @@ -116166,7 +117092,7 @@ ${lanes.join("\n")} const parameters = /* @__PURE__ */ new Set(); const excludedParameters = /* @__PURE__ */ new Set(); forEach(node.parameters, ({ name }, index) => { - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { parameters.add(name.escapedText); } if (isBindingPattern(name)) { @@ -116177,12 +117103,12 @@ ${lanes.join("\n")} if (containsArguments) { const lastJSDocParamIndex = jsdocParameters.length - 1; const lastJSDocParam = jsdocParameters[lastJSDocParamIndex]; - if (isJs && lastJSDocParam && isIdentifier25(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) { + if (isJs && lastJSDocParam && isIdentifier26(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) || isIdentifier25(name) && parameters.has(name.escapedText)) { + if (excludedParameters.has(index) || isIdentifier26(name) && parameters.has(name.escapedText)) { return; } if (isQualifiedName2(name)) { @@ -116235,7 +117161,7 @@ ${lanes.join("\n")} } } } - forEachChild26(node, visit); + forEachChild27(node, visit); } } function checkTypeParameterListsIdentical(symbol2) { @@ -116466,7 +117392,7 @@ ${lanes.join("\n")} const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); if (implementedTypeNodes) { for (const typeRefNode of implementedTypeNodes) { - if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) { + if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain2(typeRefNode.expression)) { error210(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } checkTypeReferenceNode(typeRefNode); @@ -116784,7 +117710,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 || !isIdentifier25(propName2) || !strictNullChecks || !isPropertyInitializedInConstructor(propName2, type, constructor)) { + if (uninitialized.exclamationToken || !constructor || !isIdentifier26(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)); } @@ -116902,7 +117828,7 @@ ${lanes.join("\n")} } if (!isStatic(member) && isPropertyWithoutInitializer(member)) { const propName2 = member.name; - if (isIdentifier25(propName2) || isPrivateIdentifier(propName2) || isComputedPropertyName(propName2)) { + if (isIdentifier26(propName2) || isPrivateIdentifier(propName2) || isComputedPropertyName(propName2)) { const type = getTypeOfSymbol(getSymbolOfDeclaration(member)); if (!(type.flags & 3 || containsUndefinedType(type))) { if (!constructor || !isPropertyInitializedInConstructor(propName2, type, constructor)) { @@ -116968,7 +117894,7 @@ ${lanes.join("\n")} checkObjectTypeForDuplicateDeclarations(node); }); forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => { - if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) { + if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain2(heritageElement.expression)) { error210(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } checkTypeReferenceNode(heritageElement); @@ -117107,7 +118033,7 @@ ${lanes.join("\n")} } if (isConstantVariable(symbol2)) { const declaration = symbol2.valueDeclaration; - if (declaration && isVariableDeclaration6(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) { + if (declaration && isVariableDeclaration7(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) { const result = evaluate(declaration.initializer, declaration); if (location && getSourceFileOfNode(location) !== getSourceFileOfNode(declaration)) { return evaluatorResult( @@ -117283,7 +118209,7 @@ ${lanes.join("\n")} grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); } } - if (isIdentifier25(node.name)) { + if (isIdentifier26(node.name)) { checkCollisionsForDeclarationName(node, node.name); if (!(node.flags & (32 | 2048))) { const sourceFile = getSourceFileOfNode(node); @@ -117494,7 +118420,7 @@ ${lanes.join("\n")} ); const importDeclaration = findAncestor(node, or(isImportDeclaration6, isImportEqualsDeclaration)); const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "..."; - const importedIdentifier = unescapeLeadingUnderscores(isIdentifier25(errorNode) ? errorNode.escapedText : symbol2.escapedName); + const importedIdentifier = unescapeLeadingUnderscores(isIdentifier26(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, @@ -118145,7 +119071,7 @@ ${lanes.join("\n")} case 314: case 323: checkJSDocTypeIsInJsFile(node); - forEachChild26(node, checkSourceElement); + forEachChild27(node, checkSourceElement); return; case 319: checkJSDocVariadicType(node); @@ -118710,7 +119636,7 @@ ${lanes.join("\n")} case 3: return getSymbolOfNode(entityName.parent); case 5: - if (isPropertyAccessExpression15(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) { + if (isPropertyAccessExpression16(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) { return void 0; } // falls through @@ -118968,15 +119894,15 @@ ${lanes.join("\n")} true, getHostSignatureFromJSDoc(name) ); - if (!symbol2 && isIdentifier25(name) && container) { + if (!symbol2 && isIdentifier26(name) && container) { symbol2 = getMergedSymbol(getSymbol2(getExportsOfSymbol(container), name.escapedText, meaning)); } if (symbol2) { return symbol2; } } - const left = isIdentifier25(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container); - const right = isIdentifier25(name) ? name.escapedText : name.right.escapedText; + const left = isIdentifier26(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container); + const right = isIdentifier26(name) ? name.escapedText : name.right.escapedText; if (left) { const proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype"); const t = proto ? getTypeOfSymbol(proto) : getDeclaredTypeOfSymbol(left); @@ -119063,7 +119989,7 @@ ${lanes.join("\n")} ) || isImportCall(node.parent)) || isLiteralTypeNode(node.parent) && isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) { return resolveExternalModuleName(node, node, ignoreErrors); } - if (isCallExpression14(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) { + if (isCallExpression16(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) { return getSymbolOfDeclaration(parent2); } // falls through @@ -119106,7 +120032,7 @@ ${lanes.join("\n")} } } function getIndexInfosAtLocation(node) { - if (isIdentifier25(node) && isPropertyAccessExpression15(node.parent) && node.parent.name === node) { + if (isIdentifier26(node) && isPropertyAccessExpression16(node.parent) && node.parent.name === node) { const keyType = getLiteralTypeFromPropertyName(node); const objectType = getTypeOfExpression(node.parent.expression); const objectTypes = objectType.flags & 1048576 ? objectType.types : [objectType]; @@ -119333,11 +120259,11 @@ ${lanes.join("\n")} } function isArgumentsLocalBinding(nodeIn) { if (isGeneratedIdentifier(nodeIn)) return false; - const node = getParseTreeNode(nodeIn, isIdentifier25); + const node = getParseTreeNode(nodeIn, isIdentifier26); if (!node) return false; const parent2 = node.parent; if (!parent2) return false; - const isPropertyName2 = (isPropertyAccessExpression15(parent2) || isPropertyAssignment11(parent2)) && parent2.name === node; + const isPropertyName2 = (isPropertyAccessExpression16(parent2) || isPropertyAssignment11(parent2)) && parent2.name === node; return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol; } function isNameOfModuleOrEnumDeclaration(node) { @@ -119345,7 +120271,7 @@ ${lanes.join("\n")} } function getReferencedExportContainer(nodeIn, prefixLocals) { var _a3; - const node = getParseTreeNode(nodeIn, isIdentifier25); + const node = getParseTreeNode(nodeIn, isIdentifier26); if (node) { let symbol2 = getReferencedValueSymbol( node, @@ -119378,7 +120304,7 @@ ${lanes.join("\n")} if (specifier) { return specifier; } - const node = getParseTreeNode(nodeIn, isIdentifier25); + const node = getParseTreeNode(nodeIn, isIdentifier26); if (node) { const symbol2 = getReferencedValueOrAliasSymbol(node); if (isNonLocalAlias( @@ -119447,7 +120373,7 @@ ${lanes.join("\n")} } function getReferencedDeclarationWithCollidingName(nodeIn) { if (!isGeneratedIdentifier(nodeIn)) { - const node = getParseTreeNode(nodeIn, isIdentifier25); + const node = getParseTreeNode(nodeIn, isIdentifier26); if (node) { const symbol2 = getReferencedValueSymbol(node); if (symbol2 && isSymbolOfDeclarationWithCollidingName(symbol2)) { @@ -119537,7 +120463,7 @@ ${lanes.join("\n")} } } if (checkChildren) { - return !!forEachChild26(node, (node2) => isReferencedAliasDeclaration(node2, checkChildren)); + return !!forEachChild27(node, (node2) => isReferencedAliasDeclaration(node2, checkChildren)); } return false; } @@ -119585,12 +120511,12 @@ ${lanes.join("\n")} ); } function isExpandoFunctionDeclaration(node) { - const declaration = getParseTreeNode(node, (n) => isFunctionDeclaration3(n) || isVariableDeclaration6(n)); + const declaration = getParseTreeNode(node, (n) => isFunctionDeclaration3(n) || isVariableDeclaration7(n)); if (!declaration) { return false; } let symbol2; - if (isVariableDeclaration6(declaration)) { + if (isVariableDeclaration7(declaration)) { if (declaration.type || !isInJSFile(declaration) && !isVarConstLike2(declaration)) { return false; } @@ -119694,9 +120620,9 @@ ${lanes.join("\n")} function checkSingleIdentifier(node2) { const nodeLinks2 = getNodeLinks(node2); nodeLinks2.calculatedFlags |= 536870912; - if (isIdentifier25(node2)) { + if (isIdentifier26(node2)) { nodeLinks2.calculatedFlags |= 32768 | 16384; - if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression15(node2.parent) && node2.parent.name === node2)) { + if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression16(node2.parent) && node2.parent.name === node2)) { const s = getResolvedSymbol(node2); if (s && s !== unknownSymbol) { checkIdentifierCalculateNodeCheckFlags(node2, s); @@ -119979,7 +120905,7 @@ ${lanes.join("\n")} } function getReferencedValueDeclaration(referenceIn) { if (!isGeneratedIdentifier(referenceIn)) { - const reference = getParseTreeNode(referenceIn, isIdentifier25); + const reference = getParseTreeNode(referenceIn, isIdentifier26); if (reference) { const symbol2 = getReferencedValueSymbol(reference); if (symbol2) { @@ -119991,7 +120917,7 @@ ${lanes.join("\n")} } function getReferencedValueDeclarations(referenceIn) { if (!isGeneratedIdentifier(referenceIn)) { - const reference = getParseTreeNode(referenceIn, isIdentifier25); + const reference = getParseTreeNode(referenceIn, isIdentifier26); if (reference) { const symbol2 = getReferencedValueSymbol(reference); if (symbol2) { @@ -120025,7 +120951,7 @@ ${lanes.join("\n")} return void 0; } function isLiteralConstDeclaration(node) { - if (isDeclarationReadonly(node) || isVariableDeclaration6(node) && isVarConstLike2(node)) { + if (isDeclarationReadonly(node) || isVariableDeclaration7(node) && isVarConstLike2(node)) { return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node))); } return false; @@ -120153,7 +121079,7 @@ ${lanes.join("\n")} isBindingCapturedByNode: (node, decl) => { const parseNode = getParseTreeNode(node); const parseDecl = getParseTreeNode(decl); - return !!parseNode && !!parseDecl && (isVariableDeclaration6(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl); + return !!parseNode && !!parseDecl && (isVariableDeclaration7(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl); }, getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => { const n = getParseTreeNode(node); @@ -121352,7 +122278,7 @@ ${lanes.join("\n")} } } function checkGrammarJsxName(node) { - if (isPropertyAccessExpression15(node) && isJsxNamespacedName(node.expression)) { + if (isPropertyAccessExpression16(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)) { @@ -121418,7 +122344,7 @@ ${lanes.join("\n")} } } } - if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536) && isIdentifier25(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { + if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536) && isIdentifier26(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; } @@ -121666,7 +122592,7 @@ ${lanes.join("\n")} return expr.kind === 10 || expr.kind === 225 && expr.operator === 41 && expr.operand.kind === 10; } function isSimpleLiteralEnumReference(expr) { - if ((isPropertyAccessExpression15(expr) || isElementAccessExpression8(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { + if ((isPropertyAccessExpression16(expr) || isElementAccessExpression8(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { return !!(checkExpressionCached(expr).flags & 1056); } } @@ -121674,7 +122600,7 @@ ${lanes.join("\n")} const initializer3 = node.initializer; if (initializer3) { const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer3) || isSimpleLiteralEnumReference(initializer3) || initializer3.kind === 112 || initializer3.kind === 97 || isBigIntLiteralExpression(initializer3)); - const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration6(node) && isVarConstLike2(node); + const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration7(node) && isVarConstLike2(node); if (isConstOrReadonly && !node.type) { if (isInvalidInitializer) { return grammarErrorOnNode(initializer3, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference); @@ -121817,7 +122743,7 @@ ${lanes.join("\n")} break; case 102: if (escapedText !== "meta") { - const isCallee = isCallExpression14(node.parent) && node.parent.expression === node; + const isCallee = isCallExpression16(node.parent) && node.parent.expression === node; if (escapedText === "defer") { if (!isCallee) { return grammarErrorAtPos(node, node.end, 0, Diagnostics._0_expected, "("); @@ -122214,7 +123140,7 @@ ${lanes.join("\n")} switch (name.parent.kind) { case 277: case 282: - return isIdentifier25(name) || name.kind === 11; + return isIdentifier26(name) || name.kind === 11; default: return isDeclarationName(name); } @@ -122597,9 +123523,9 @@ ${lanes.join("\n")} if (!updated) { return context.factory.createBlock(declarations); } - const block = context.factory.converters.convertToFunctionBlock(updated); - const statements = factory.mergeLexicalEnvironment(block.statements, declarations); - return context.factory.updateBlock(block, statements); + const block2 = context.factory.converters.convertToFunctionBlock(updated); + const statements = factory.mergeLexicalEnvironment(block2.statements, declarations); + return context.factory.updateBlock(block2, statements); } return updated; } @@ -122645,7 +123571,7 @@ ${lanes.join("\n")} return context.factory.updateQualifiedName( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isEntityName)), - Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier26)) ); }, [ @@ -122665,7 +123591,7 @@ ${lanes.join("\n")} return context.factory.updateTypeParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), nodeVisitor(node.constraint, visitor, isTypeNode), nodeVisitor(node.default, visitor, isTypeNode) ); @@ -122999,7 +123925,7 @@ ${lanes.join("\n")} return context.factory.updateNamedTupleMember( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123221,7 +124147,7 @@ ${lanes.join("\n")} node, nodesVisitor(node.modifiers, visitor, isModifier), tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, - nodeVisitor(node.name, visitor, isIdentifier25), + nodeVisitor(node.name, visitor, isIdentifier26), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), @@ -123356,7 +124282,7 @@ ${lanes.join("\n")} return context.factory.updateClassExpression( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - nodeVisitor(node.name, visitor, isIdentifier25), + nodeVisitor(node.name, visitor, isIdentifier26), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isClassElement) @@ -123396,7 +124322,7 @@ ${lanes.join("\n")} 236 /* NonNullExpression */ ]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return isOptionalChain(node) ? context.factory.updateNonNullChain( + return isOptionalChain2(node) ? context.factory.updateNonNullChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ) : context.factory.updateNonNullExpression( @@ -123410,7 +124336,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateMetaProperty( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, // Misc @@ -123525,7 +124451,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateContinueStatement( node, - nodeVisitor(node.label, visitor, isIdentifier25) + nodeVisitor(node.label, visitor, isIdentifier26) ); }, [ @@ -123534,7 +124460,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateBreakStatement( node, - nodeVisitor(node.label, visitor, isIdentifier25) + nodeVisitor(node.label, visitor, isIdentifier26) ); }, [ @@ -123572,7 +124498,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateLabeledStatement( node, - Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier26)), Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) ); }, @@ -123614,7 +124540,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateVariableDeclarationList( node, - nodesVisitor(node.declarations, visitor, isVariableDeclaration6) + nodesVisitor(node.declarations, visitor, isVariableDeclaration7) ); }, [ @@ -123625,7 +124551,7 @@ ${lanes.join("\n")} node, nodesVisitor(node.modifiers, visitor, isModifier), tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, - nodeVisitor(node.name, visitor, isIdentifier25), + nodeVisitor(node.name, visitor, isIdentifier26), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, isTypeNode), @@ -123639,7 +124565,7 @@ ${lanes.join("\n")} return context.factory.updateClassDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - nodeVisitor(node.name, visitor, isIdentifier25), + nodeVisitor(node.name, visitor, isIdentifier26), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isClassElement) @@ -123652,7 +124578,7 @@ ${lanes.join("\n")} return context.factory.updateInterfaceDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), nodesVisitor(node.members, visitor, isTypeElement) @@ -123665,7 +124591,7 @@ ${lanes.join("\n")} return context.factory.updateTypeAliasDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); @@ -123677,7 +124603,7 @@ ${lanes.join("\n")} return context.factory.updateEnumDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), nodesVisitor(node.members, visitor, isEnumMember) ); }, @@ -123716,7 +124642,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExportDeclaration( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, [ @@ -123727,7 +124653,7 @@ ${lanes.join("\n")} node, nodesVisitor(node.modifiers, visitor, isModifierLike), node.isTypeOnly, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference)) ); }, @@ -123770,7 +124696,7 @@ ${lanes.join("\n")} return context.factory.updateImportClause( node, node.phaseModifier, - nodeVisitor(node.name, visitor, isIdentifier25), + nodeVisitor(node.name, visitor, isIdentifier26), nodeVisitor(node.namedBindings, visitor, isNamedImportBindings) ); }, @@ -123780,7 +124706,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceImport( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, [ @@ -123789,7 +124715,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExport( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, [ @@ -123809,7 +124735,7 @@ ${lanes.join("\n")} node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, isModuleExportName), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, [ @@ -123914,8 +124840,8 @@ ${lanes.join("\n")} ]: function forEachChildInJsxNamespacedName2(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxNamespacedName( node, - Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier25)), - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)) + Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier26)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)) ); }, [ @@ -124001,7 +124927,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCatchClause( node, - nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration6), + nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration7), Debug.checkDefined(nodeVisitor(node.block, visitor, isBlock6)) ); }, @@ -124022,7 +124948,7 @@ ${lanes.join("\n")} ]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateShorthandPropertyAssignment( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier25)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier26)), nodeVisitor(node.objectAssignmentInitializer, visitor, isExpression) ); }, @@ -124939,10 +125865,10 @@ ${lanes.join("\n")} } }; function isSimpleCopiableExpression(expression) { - return isStringLiteralLike4(expression) || expression.kind === 9 || isKeyword(expression.kind) || isIdentifier25(expression); + return isStringLiteralLike4(expression) || expression.kind === 9 || isKeyword(expression.kind) || isIdentifier26(expression); } function isSimpleInlineableExpression(expression) { - return !isIdentifier25(expression) && isSimpleCopiableExpression(expression); + return !isIdentifier26(expression) && isSimpleCopiableExpression(expression); } function isCompoundAssignment(kind) { return kind >= 65 && kind <= 79; @@ -125148,7 +126074,7 @@ ${lanes.join("\n")} return walkUpLexicalEnvironments(env2, (env22) => getPrivateIdentifier(env22.privateEnv, name)); } function isSimpleParameter(node) { - return !node.initializer && isIdentifier25(node.name); + return !node.initializer && isIdentifier26(node.name); } function isSimpleParameterList(nodes) { return every(nodes, isSimpleParameter); @@ -125195,7 +126121,7 @@ ${lanes.join("\n")} if (value) { value = visitNode(value, visitor, isExpression); Debug.assert(value); - if (isIdentifier25(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) { + if (isIdentifier26(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) { value = ensureIdentifier( flattenContext, value, @@ -125234,7 +126160,7 @@ ${lanes.join("\n")} expressions = append(expressions, expression); } function emitBindingOrAssignment(target, value2, location2, original) { - Debug.assertNode(target, createAssignmentCallback ? isIdentifier25 : isExpression); + Debug.assertNode(target, createAssignmentCallback ? isIdentifier26 : isExpression); const expression = createAssignmentCallback ? createAssignmentCallback(target, value2, location2) : setTextRange( context.factory.createAssignment(Debug.checkDefined(visitNode(target, visitor, isExpression)), value2), location2 @@ -125247,7 +126173,7 @@ ${lanes.join("\n")} const target = getTargetOfBindingOrAssignmentElement(element); if (isBindingOrAssignmentPattern(target)) { return bindingOrAssignmentPatternAssignsToName(target, escapedName); - } else if (isIdentifier25(target)) { + } else if (isIdentifier26(target)) { return target.escapedText === escapedName; } return false; @@ -125288,9 +126214,9 @@ ${lanes.join("\n")} createArrayBindingOrAssignmentElement: (name) => makeBindingElement(context.factory, name), visitor }; - if (isVariableDeclaration6(node)) { + if (isVariableDeclaration7(node)) { let initializer3 = getInitializerOfBindingOrAssignmentElement(node); - if (initializer3 && (isIdentifier25(initializer3) && bindingOrAssignmentElementAssignsToName(node, initializer3.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) { + if (initializer3 && (isIdentifier26(initializer3) && bindingOrAssignmentElementAssignsToName(node, initializer3.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) { initializer3 = ensureIdentifier( flattenContext, Debug.checkDefined(visitNode(initializer3, flattenContext.visitor, isExpression)), @@ -125524,7 +126450,7 @@ ${lanes.join("\n")} const initializer3 = getInitializerOfBindingOrAssignmentElement(element); if (initializer3 && !isSimpleInlineableExpression(initializer3)) return false; if (isBindingOrAssignmentPattern(target)) return every(getElementsOfBindingOrAssignmentPattern(target), isSimpleBindingOrAssignmentElement); - return isIdentifier25(target); + return isIdentifier26(target); } function createDefaultValueCheck(flattenContext, value, defaultValue, location) { value = ensureIdentifier( @@ -125565,7 +126491,7 @@ ${lanes.join("\n")} } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { - if (isIdentifier25(value) && reuseIdentifierExpressions) { + if (isIdentifier26(value) && reuseIdentifierExpressions) { return value; } else { const temp = flattenContext.context.factory.createTempVariable( @@ -125623,9 +126549,9 @@ ${lanes.join("\n")} /*multiLine*/ false ); - const block = factory2.createClassStaticBlockDeclaration(body); - getOrCreateEmitNode(block).classThis = classThis; - return block; + const block2 = factory2.createClassStaticBlockDeclaration(body); + getOrCreateEmitNode(block2).classThis = classThis; + return block2; } function isClassThisAssignmentBlock(node) { var _a3; @@ -125637,7 +126563,7 @@ ${lanes.join("\n")} statement.expression, /*excludeCompoundAssignment*/ true - ) && isIdentifier25(statement.expression.left) && ((_a3 = node.emitNode) == null ? void 0 : _a3.classThis) === statement.expression.left && statement.expression.right.kind === 110; + ) && isIdentifier26(statement.expression.left) && ((_a3 = node.emitNode) == null ? void 0 : _a3.classThis) === statement.expression.left && statement.expression.right.kind === 110; } function classHasClassThisAssignment(node) { var _a3; @@ -125692,7 +126618,7 @@ ${lanes.join("\n")} const assignedName2 = factory2.createStringLiteralFromNode(name); return { assignedName: assignedName2, name }; } - if (isPropertyNameLiteral(name.expression) && !isIdentifier25(name.expression)) { + if (isPropertyNameLiteral(name.expression) && !isIdentifier26(name.expression)) { const assignedName2 = factory2.createStringLiteralFromNode(name.expression); return { assignedName: assignedName2, name }; } @@ -125712,9 +126638,9 @@ ${lanes.join("\n")} /*multiLine*/ false ); - const block = factory2.createClassStaticBlockDeclaration(body); - getOrCreateEmitNode(block).assignedName = assignedName; - return block; + const block2 = factory2.createClassStaticBlockDeclaration(body); + getOrCreateEmitNode(block2).assignedName = assignedName; + return block2; } function isClassNamedEvaluationHelperBlock(node) { var _a3; @@ -126689,7 +127615,7 @@ ${lanes.join("\n")} return factory2.createIdentifier(""); } else if (isComputedPropertyName(name)) { return generateNameForComputedPropertyName && !isSimpleInlineableExpression(name.expression) ? factory2.getGeneratedNameForNode(name) : name.expression; - } else if (isIdentifier25(name)) { + } else if (isIdentifier26(name)) { return factory2.createStringLiteral(idText(name)); } else { return factory2.cloneNode(name); @@ -126836,22 +127762,22 @@ ${lanes.join("\n")} addRange(statements, visitNodes2(body.statements, visitor, isStatement, prologueStatementCount)); } statements = factory2.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - const block = factory2.createBlock( + const block2 = factory2.createBlock( setTextRange(factory2.createNodeArray(statements), body.statements), /*multiLine*/ true ); setTextRange( - block, + block2, /*location*/ body ); - setOriginalNode(block, body); - return block; + setOriginalNode(block2, body); + return block2; } function transformParameterWithPropertyAssignment(node) { const name = node.name; - if (!isIdentifier25(name)) { + if (!isIdentifier26(name)) { return void 0; } const propertyName = setParent(setTextRange(factory2.cloneNode(name), name), name.parent); @@ -127335,7 +128261,7 @@ ${lanes.join("\n")} return true; } function declaredNameInScope(node) { - Debug.assertNode(node.name, isIdentifier25); + Debug.assertNode(node.name, isIdentifier26); return node.name.escapedText; } function addVarForEnumOrModuleDeclaration(statements, node) { @@ -127377,7 +128303,7 @@ ${lanes.join("\n")} if (!shouldEmitModuleDeclaration(node)) { return factory2.createNotEmittedStatement(node); } - Debug.assertNode(node.name, isIdentifier25, "A TypeScript namespace should have an Identifier name."); + Debug.assertNode(node.name, isIdentifier26, "A TypeScript namespace should have an Identifier name."); enableSubstitutionForNamespaceExports(); const statements = []; let emitFlags = 4; @@ -127490,7 +128416,7 @@ ${lanes.join("\n")} currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - const block = factory2.createBlock( + const block2 = factory2.createBlock( setTextRange( factory2.createNodeArray(statements), /*location*/ @@ -127499,15 +128425,15 @@ ${lanes.join("\n")} /*multiLine*/ true ); - setTextRange(block, blockLocation); + setTextRange(block2, blockLocation); if (!node.body || node.body.kind !== 269) { setEmitFlags( - block, - getEmitFlags(block) | 3072 + block2, + getEmitFlags(block2) | 3072 /* NoComments */ ); } - return block; + return block2; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { if (moduleDeclaration.body.kind === 268) { @@ -127591,7 +128517,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, isIdentifier25))); + return factory2.updateNamespaceExport(node, Debug.checkDefined(visitNode(node.name, visitor, isIdentifier26))); } function visitNamedExportBindings(node, allowEmpty) { return isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty); @@ -127873,7 +128799,7 @@ ${lanes.join("\n")} if (getIsolatedModules(compilerOptions)) { return void 0; } - return isPropertyAccessExpression15(node) || isElementAccessExpression8(node) ? resolver.getConstantValue(node) : void 0; + return isPropertyAccessExpression16(node) || isElementAccessExpression8(node) ? resolver.getConstantValue(node) : void 0; } function shouldEmitAliasDeclaration(node) { return compilerOptions.verbatimModuleSyntax || isInJSFile(node) || resolver.isReferencedAliasDeclaration(node); @@ -128484,7 +129410,7 @@ ${lanes.join("\n")} ); } } - if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier25(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier26(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1) { return visitInvalidSuperProperty(node); @@ -128557,8 +129483,8 @@ ${lanes.join("\n")} if (classConstructor && superClassReference) { let setterName; let getterName; - if (isPropertyAccessExpression15(operand)) { - if (isIdentifier25(operand.name)) { + if (isPropertyAccessExpression16(operand)) { + if (isIdentifier26(operand.name)) { getterName = setterName = factory2.createStringLiteralFromNode(operand.name); } } else { @@ -128780,7 +129706,7 @@ ${lanes.join("\n")} ); } if (classConstructor && superClassReference) { - let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier25(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; + let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier26(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; if (setterName) { let expression = visitNode(node.right, visitor, isExpression); if (isCompoundAssignment(node.operatorToken.kind)) { @@ -128980,11 +129906,11 @@ ${lanes.join("\n")} const shouldAlwaysTransformPrivateStaticElements = getInternalEmitFlags(node) & 32; if (shouldTransformPrivateElementsOrClassStaticBlocks || shouldAlwaysTransformPrivateStaticElements) { const name = getNameOfDeclaration(node); - if (name && isIdentifier25(name)) { + if (name && isIdentifier26(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 && isIdentifier25(node.emitNode.assignedName.textSourceNode)) { + if (node.emitNode.assignedName.textSourceNode && isIdentifier26(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); @@ -129288,8 +130214,8 @@ ${lanes.join("\n")} [] )); } - const block = factory2.createBlock([statement]); - syntheticStaticBlock = factory2.createClassStaticBlockDeclaration(block); + const block2 = factory2.createBlock([statement]); + syntheticStaticBlock = factory2.createClassStaticBlockDeclaration(block2); pendingExpressions = void 0; } if (syntheticConstructor || syntheticStaticBlock) { @@ -129635,7 +130561,7 @@ ${lanes.join("\n")} return void 0; } let initializer3 = visitNode(property.initializer, visitor, isExpression); - if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier25(propertyName)) { + if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier26(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)) { @@ -129675,7 +130601,7 @@ ${lanes.join("\n")} const expression = factory2.createAssignment(memberAccess, initializer3); return expression; } else { - const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier25(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier26(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); } @@ -129744,7 +130670,7 @@ ${lanes.join("\n")} ); } function visitInvalidSuperProperty(node) { - return isPropertyAccessExpression15(node) ? factory2.updatePropertyAccessExpression( + return isPropertyAccessExpression16(node) ? factory2.updatePropertyAccessExpression( node, factory2.createVoidZero(), node.name @@ -129774,7 +130700,7 @@ ${lanes.join("\n")} } return factory2.createAssignment(generatedName, expression); } - return inlinable || isIdentifier25(innerExpression) ? void 0 : expression; + return inlinable || isIdentifier26(innerExpression) ? void 0 : expression; } } function startClassLexicalEnvironment() { @@ -129977,7 +130903,7 @@ ${lanes.join("\n")} if (facts & 1) { return visitInvalidSuperProperty(node); } else if (classConstructor && superClassReference) { - const name = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier25(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; + const name = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier26(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; if (name) { const temp = factory2.createTempVariable( /*recordTempVariable*/ @@ -130277,7 +131203,7 @@ ${lanes.join("\n")} const numParameters = parameters.length; for (let i = 0; i < numParameters; i++) { const parameter = parameters[i]; - if (i === 0 && isIdentifier25(parameter.name) && parameter.name.escapedText === "this") { + if (i === 0 && isIdentifier26(parameter.name) && parameter.name.escapedText === "this") { continue; } if (parameter.dotDotDotToken) { @@ -130448,7 +131374,7 @@ ${lanes.join("\n")} continue; } const serializedConstituent = serializeTypeNode(typeNode); - if (isIdentifier25(serializedConstituent) && serializedConstituent.escapedText === "Object") { + if (isIdentifier26(serializedConstituent) && serializedConstituent.escapedText === "Object") { return serializedConstituent; } if (serializedType) { @@ -130466,7 +131392,7 @@ ${lanes.join("\n")} // temp vars used in fallback isGeneratedIdentifier(left) ? isGeneratedIdentifier(right) : ( // entity names - isIdentifier25(left) ? isIdentifier25(right) && left.escapedText === right.escapedText : isPropertyAccessExpression15(left) ? isPropertyAccessExpression15(right) && equateSerializedTypeNodes(left.expression, right.expression) && equateSerializedTypeNodes(left.name, right.name) : ( + isIdentifier26(left) ? isIdentifier26(right) && left.escapedText === right.escapedText : isPropertyAccessExpression16(left) ? isPropertyAccessExpression16(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 @@ -131085,7 +132011,7 @@ ${lanes.join("\n")} return factory2.createIdentifier(""); } else if (isComputedPropertyName(name)) { return generateNameForComputedPropertyName && !isSimpleInlineableExpression(name.expression) ? factory2.getGeneratedNameForNode(name) : name.expression; - } else if (isIdentifier25(name)) { + } else if (isIdentifier26(name)) { return factory2.createStringLiteral(idText(name)); } else { return factory2.cloneNode(name); @@ -131431,7 +132357,7 @@ ${lanes.join("\n")} } } function getHelperVariableName(node) { - let declarationName = node.name && isIdentifier25(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 && 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( node.name.text, 99 /* ESNext */ @@ -132161,13 +133087,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 (isIdentifier25(member.name) || isPrivateIdentifier(member.name)) { + if (isIdentifier26(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) && !isIdentifier25(expression)) { + if (isPropertyNameLiteral(expression) && !isIdentifier26(expression)) { propertyName = { computed: true, name: factory2.createStringLiteralFromNode(expression) }; } else { enterName(); @@ -132492,7 +133418,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitPropertyAccessExpression(node) { - if (isSuperProperty(node) && isIdentifier25(node.name) && classThis && classSuper) { + if (isSuperProperty(node) && isIdentifier26(node.name) && classThis && classSuper) { const propertyName = factory2.createStringLiteralFromNode(node.name); const superProperty = factory2.createReflectGetCall(classSuper, propertyName, classThis); setOriginalNode(superProperty, node.expression); @@ -132574,7 +133500,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } if (isSuperProperty(node.left) && classThis && classSuper) { - let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier25(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; + let setterName = isElementAccessExpression8(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier26(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; if (setterName) { let expression = visitNode(node.right, visitor, isExpression); if (isCompoundAssignment(node.operatorToken.kind)) { @@ -132629,7 +133555,7 @@ ${lanes.join("\n")} 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) : isIdentifier25(operand.name) ? factory2.createStringLiteralFromNode(operand.name) : void 0; + let setterName = isElementAccessExpression8(operand) ? visitNode(operand.argumentExpression, visitor, isExpression) : isIdentifier26(operand.name) ? factory2.createStringLiteralFromNode(operand.name) : void 0; if (setterName) { let getterName = setterName; if (!isSimpleInlineableExpression(setterName)) { @@ -132664,7 +133590,7 @@ ${lanes.join("\n")} const name2 = visitNode(node, visitor, isPropertyName); return { referencedName: referencedName2, name: name2 }; } - if (isPropertyNameLiteral(node.expression) && !isIdentifier25(node.expression)) { + if (isPropertyNameLiteral(node.expression) && !isIdentifier26(node.expression)) { const referencedName2 = factory2.createStringLiteralFromNode(node.expression); const name2 = visitNode(node, visitor, isPropertyName); return { referencedName: referencedName2, name: name2 }; @@ -132712,7 +133638,7 @@ ${lanes.join("\n")} return visitAssignmentPattern(node); } if (isSuperProperty(node) && classThis && classSuper) { - const propertyName = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier25(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; + const propertyName = isElementAccessExpression8(node) ? visitNode(node.argumentExpression, visitor, isExpression) : isIdentifier26(node.name) ? factory2.createStringLiteralFromNode(node.name) : void 0; if (propertyName) { const paramName = factory2.createTempVariable( /*recordTempVariable*/ @@ -133256,7 +134182,7 @@ ${lanes.join("\n")} case 220: return doWithContext(1, visitArrowFunction, node); case 212: - if (capturedSuperProperties && isPropertyAccessExpression15(node) && node.expression.kind === 108) { + if (capturedSuperProperties && isPropertyAccessExpression16(node) && node.expression.kind === 108) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); @@ -133515,7 +134441,7 @@ ${lanes.join("\n")} ); } function recordDeclarationName({ name }, names) { - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { names.add(name.escapedText); } else { for (const element of name.elements) { @@ -133543,7 +134469,7 @@ ${lanes.join("\n")} forEach(node.declarations, hoistVariable); } function hoistVariable({ name }) { - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { hoistVariableDeclaration(name); } else { for (const element of name.elements) { @@ -133564,7 +134490,7 @@ ${lanes.join("\n")} return Debug.checkDefined(visitNode(converted, visitor, isExpression)); } function collidesWithParameterName({ name }) { - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { return enclosingFunctionParameterNames.has(name.escapedText); } else { for (const element of name.elements) { @@ -133712,7 +134638,7 @@ ${lanes.join("\n")} Debug.assert(i < outerParameters.length); const originalParameter = node.parameters[i]; const outerParameter = outerParameters[i]; - Debug.assertNode(outerParameter.name, isIdentifier25); + Debug.assertNode(outerParameter.name, isIdentifier26); if (originalParameter.initializer || originalParameter.dotDotDotToken) { Debug.assert(i === outerParameters.length - 1); parameterBindings.push(factory2.createSpreadElement(outerParameter.name)); @@ -133773,28 +134699,28 @@ ${lanes.join("\n")} if (captureLexicalArguments) { insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]); } - const block = factory2.createBlock( + const block2 = factory2.createBlock( statements, /*multiLine*/ true ); - setTextRange(block, node.body); + setTextRange(block2, node.body); if (emitSuperHelpers && hasSuperElementAccess) { if (resolver.hasNodeCheckFlag( node, 256 /* MethodWithSuperPropertyAssignmentInAsync */ )) { - addEmitHelper(block, advancedAsyncSuperHelper); + addEmitHelper(block2, advancedAsyncSuperHelper); } else if (resolver.hasNodeCheckFlag( node, 128 /* MethodWithSuperPropertyAccessInAsync */ )) { - addEmitHelper(block, asyncSuperHelper); + addEmitHelper(block2, asyncSuperHelper); } } - result = block; + result = block2; } else { result = emitHelpers().createAwaiterHelper( hasLexicalThis, @@ -133804,8 +134730,8 @@ ${lanes.join("\n")} asyncBody ); if (captureLexicalArguments) { - const block = factory2.converters.convertToFunctionBlock(result); - result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()])); + const block2 = factory2.converters.convertToFunctionBlock(result); + result = factory2.updateBlock(block2, factory2.mergeLexicalEnvironment(block2.statements, [createCaptureArgumentsStatement()])); } } enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames; @@ -133947,7 +134873,7 @@ ${lanes.join("\n")} function substituteCallExpression(node) { const expression = node.expression; if (isSuperProperty(expression)) { - const argumentExpression = isPropertyAccessExpression15(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + const argumentExpression = isPropertyAccessExpression16(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return factory2.createCallExpression( factory2.createPropertyAccessExpression(argumentExpression, "call"), /*typeArguments*/ @@ -134332,7 +135258,7 @@ ${lanes.join("\n")} case 216: return visitTaggedTemplateExpression(node); case 212: - if (capturedSuperProperties && isPropertyAccessExpression15(node) && node.expression.kind === 108) { + if (capturedSuperProperties && isPropertyAccessExpression16(node) && node.expression.kind === 108) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); @@ -134573,15 +135499,15 @@ ${lanes.join("\n")} 1 /* ObjectRest */ ); - let block = visitNode(node.block, visitor, isBlock6); + let block2 = visitNode(node.block, visitor, isBlock6); if (some(visitedBindings)) { - block = factory2.updateBlock(block, [ + block2 = factory2.updateBlock(block2, [ factory2.createVariableStatement( /*modifiers*/ void 0, visitedBindings ), - ...block.statements + ...block2.statements ]); } return factory2.updateCatchClause( @@ -134596,7 +135522,7 @@ ${lanes.join("\n")} /*initializer*/ void 0 ), - block + block2 ); } return visitEachChild(node, visitor, context); @@ -134756,11 +135682,11 @@ ${lanes.join("\n")} } function transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) { const expression = visitNode(node.expression, visitor, isExpression); - const iterator = isIdentifier25(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const iterator = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); - const result = isIdentifier25(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( + const result = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -135162,25 +136088,25 @@ ${lanes.join("\n")} insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]); } outerStatements.push(returnStatement); - const block = factory2.updateBlock(node.body, outerStatements); + const block2 = factory2.updateBlock(node.body, outerStatements); if (emitSuperHelpers && hasSuperElementAccess) { if (resolver.hasNodeCheckFlag( node, 256 /* MethodWithSuperPropertyAssignmentInAsync */ )) { - addEmitHelper(block, advancedAsyncSuperHelper); + addEmitHelper(block2, advancedAsyncSuperHelper); } else if (resolver.hasNodeCheckFlag( node, 128 /* MethodWithSuperPropertyAccessInAsync */ )) { - addEmitHelper(block, asyncSuperHelper); + addEmitHelper(block2, asyncSuperHelper); } } capturedSuperProperties = savedCapturedSuperProperties; hasSuperElementAccess = savedHasSuperElementAccess; - return block; + return block2; } function transformFunctionBody2(node) { resumeLexicalEnvironment(); @@ -135203,14 +136129,14 @@ ${lanes.join("\n")} )); const leadingStatements = endLexicalEnvironment(); if (statementOffset > 0 || some(statements) || some(leadingStatements)) { - const block = factory2.converters.convertToFunctionBlock( + const block2 = factory2.converters.convertToFunctionBlock( body, /*multiLine*/ true ); insertStatementsAfterStandardPrologue(statements, leadingStatements); - addRange(statements, block.statements.slice(statementOffset)); - return factory2.updateBlock(block, setTextRange(factory2.createNodeArray(statements), block.statements)); + addRange(statements, block2.statements.slice(statementOffset)); + return factory2.updateBlock(block2, setTextRange(factory2.createNodeArray(statements), block2.statements)); } return body; } @@ -135274,15 +136200,15 @@ ${lanes.join("\n")} 3072 /* NoComments */ ); - const block = factory2.createBlock([factory2.createExpressionStatement(assignment)]); - setTextRange(block, parameter); + const block2 = factory2.createBlock([factory2.createExpressionStatement(assignment)]); + setTextRange(block2, parameter); setEmitFlags( - block, + block2, 1 | 64 | 768 | 3072 /* NoComments */ ); const typeCheck = factory2.createTypeCheck(factory2.cloneNode(parameter.name), "undefined"); - const statement = factory2.createIfStatement(typeCheck, block); + const statement = factory2.createIfStatement(typeCheck, block2); startOnNewLine(statement); setTextRange(statement, parameter); setEmitFlags( @@ -135437,7 +136363,7 @@ ${lanes.join("\n")} function substituteCallExpression(node) { const expression = node.expression; if (isSuperProperty(expression)) { - const argumentExpression = isPropertyAccessExpression15(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + const argumentExpression = isPropertyAccessExpression16(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return factory2.createCallExpression( factory2.createPropertyAccessExpression(argumentExpression, "call"), /*typeArguments*/ @@ -135543,7 +136469,7 @@ ${lanes.join("\n")} } case 212: case 213: - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { const updated = visitOptionalExpression( node, /*captureThisArg*/ @@ -135569,8 +136495,8 @@ ${lanes.join("\n")} function flattenChain(chain) { Debug.assertNotNode(chain, isNonNullChain); const links = [chain]; - while (!chain.questionDotToken && !isTaggedTemplateExpression4(chain)) { - chain = cast(skipPartiallyEmittedExpressions(chain.expression), isOptionalChain); + while (!chain.questionDotToken && !isTaggedTemplateExpression5(chain)) { + chain = cast(skipPartiallyEmittedExpressions(chain.expression), isOptionalChain2); Debug.assertNotNode(chain, isNonNullChain); links.unshift(chain); } @@ -135584,7 +136510,7 @@ ${lanes.join("\n")} return factory2.updateParenthesizedExpression(node, expression); } function visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { return visitOptionalExpression(node, captureThisArg, isDelete); } let expression = visitNode(node.expression, visitor, isExpression); @@ -135598,11 +136524,11 @@ ${lanes.join("\n")} thisArg = expression; } } - expression = node.kind === 212 ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier25)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); + expression = node.kind === 212 ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier26)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); return thisArg ? factory2.createSyntheticReferenceExpression(expression, thisArg) : expression; } function visitNonOptionalCallExpression(node, captureThisArg) { - if (isOptionalChain(node)) { + if (isOptionalChain2(node)) { return visitOptionalExpression( node, captureThisArg, @@ -135610,7 +136536,7 @@ ${lanes.join("\n")} false ); } - if (isParenthesizedExpression7(node.expression) && isOptionalChain(skipParentheses(node.expression))) { + if (isParenthesizedExpression7(node.expression) && isOptionalChain2(skipParentheses(node.expression))) { const expression = visitNonOptionalParenthesizedExpression( node.expression, /*captureThisArg*/ @@ -135680,7 +136606,7 @@ ${lanes.join("\n")} thisArg = rightExpression; } } - rightExpression = segment.kind === 212 ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier25)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); + rightExpression = segment.kind === 212 ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier26)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); break; case 214: if (i === 0 && leftThisArg) { @@ -135784,7 +136710,7 @@ ${lanes.join("\n")} ); } function visitDeleteExpression(node) { - return isOptionalChain(skipParentheses(node.expression)) ? setOriginalNode(visitNonOptionalExpression( + return isOptionalChain2(skipParentheses(node.expression)) ? setOriginalNode(visitNonOptionalExpression( node.expression, /*captureThisArg*/ false, @@ -135827,7 +136753,7 @@ ${lanes.join("\n")} propertyAccessTarget, left.expression ); - if (isPropertyAccessExpression15(left)) { + if (isPropertyAccessExpression16(left)) { assignmentTarget = factory2.createPropertyAccessExpression( propertyAccessTarget, left.name @@ -136148,7 +137074,7 @@ ${lanes.join("\n")} Debug.assertNode(statement, isVariableStatement10); const declarations = []; for (let declaration of statement.declarationList.declarations) { - if (!isIdentifier25(declaration.name)) { + if (!isIdentifier26(declaration.name)) { declarations.length = 0; break; } @@ -136357,7 +137283,7 @@ ${lanes.join("\n")} function hoistInitializedVariable(node) { Debug.assertIsDefined(node.initializer); let target; - if (isIdentifier25(node.name)) { + if (isIdentifier26(node.name)) { target = factory2.cloneNode(node.name); setEmitFlags(target, getEmitFlags(target) & ~(32768 | 16384 | 65536)); } else { @@ -136770,7 +137696,7 @@ ${lanes.join("\n")} } function hasProto(obj) { return obj.properties.some( - (p) => isPropertyAssignment11(p) && (isIdentifier25(p.name) && idText(p.name) === "__proto__" || isStringLiteral15(p.name) && p.name.text === "__proto__") + (p) => isPropertyAssignment11(p) && (isIdentifier26(p.name) && idText(p.name) === "__proto__" || isStringLiteral15(p.name) && p.name.text === "__proto__") ); } function hasKeyAfterPropsSpread(node) { @@ -136778,7 +137704,7 @@ ${lanes.join("\n")} for (const elem of node.attributes.properties) { if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression12(elem.expression) || elem.expression.properties.some(isSpreadAssignment6))) { spread = true; - } else if (spread && isJsxAttribute(elem) && isIdentifier25(elem.name) && elem.name.escapedText === "key") { + } else if (spread && isJsxAttribute(elem) && isIdentifier26(elem.name) && elem.name.escapedText === "key") { return true; } } @@ -136834,7 +137760,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 && isIdentifier25(p.name) && p.name.escapedText === "key"); + const keyAttr = find(node.attributes.properties, (p) => !!p.name && isIdentifier26(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( @@ -137088,7 +138014,7 @@ ${lanes.join("\n")} return getTagName(node.openingElement); } else { const tagName = node.tagName; - if (isIdentifier25(tagName) && isIntrinsicJsxName(tagName.escapedText)) { + if (isIdentifier26(tagName) && isIntrinsicJsxName(tagName.escapedText)) { return factory2.createStringLiteral(idText(tagName)); } else if (isJsxNamespacedName(tagName)) { return factory2.createStringLiteral(idText(tagName.namespace) + ":" + idText(tagName.name)); @@ -137099,7 +138025,7 @@ ${lanes.join("\n")} } function getAttributeName(node) { const name = node.name; - if (isIdentifier25(name)) { + if (isIdentifier26(name)) { const text = idText(name); return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text); } @@ -137420,7 +138346,7 @@ ${lanes.join("\n")} ), left ); - } else if (isPropertyAccessExpression15(left)) { + } else if (isPropertyAccessExpression16(left)) { const expressionTemp = factory2.createTempVariable(hoistVariableDeclaration); target = setTextRange( factory2.createPropertyAccessExpression( @@ -138019,7 +138945,7 @@ ${lanes.join("\n")} ); statements.push(statement); insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); - const block = factory2.createBlock( + const block2 = factory2.createBlock( setTextRange( factory2.createNodeArray(statements), /*location*/ @@ -138029,11 +138955,11 @@ ${lanes.join("\n")} true ); setEmitFlags( - block, + block2, 3072 /* NoComments */ ); - return block; + return block2; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { @@ -138100,21 +139026,21 @@ ${lanes.join("\n")} } const statementsArray = factory2.createNodeArray(statements); setTextRange(statementsArray, node.members); - const block = factory2.createBlock( + const block2 = factory2.createBlock( statementsArray, /*multiLine*/ true ); - setTextRange(block, node); + setTextRange(block2, node); setEmitFlags( - block, + block2, 3072 /* NoComments */ ); - return block; + return block2; } function isUninitializedVariableStatement(node) { - return isVariableStatement10(node) && every(node.declarationList.declarations, (decl) => isIdentifier25(decl.name) && !decl.initializer); + return isVariableStatement10(node) && every(node.declarationList.declarations, (decl) => isIdentifier26(decl.name) && !decl.initializer); } function containsSuperCall(node) { if (isSuperCall(node)) { @@ -138138,12 +139064,12 @@ ${lanes.join("\n")} case 173: { const named = node; if (isComputedPropertyName(named.name)) { - return !!forEachChild26(named.name, containsSuperCall); + return !!forEachChild27(named.name, containsSuperCall); } return false; } } - return !!forEachChild26(node, containsSuperCall); + return !!forEachChild27(node, containsSuperCall); } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106; @@ -138201,7 +139127,7 @@ ${lanes.join("\n")} return isVariableStatement10(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]); } function isThisCapturingVariableDeclaration(node) { - return isVariableDeclaration6(node) && isCapturedThis(node.name) && !!node.initializer; + return isVariableDeclaration7(node) && isCapturedThis(node.name) && !!node.initializer; } function isThisCapturingAssignment(node) { return isAssignmentExpression( @@ -138211,7 +139137,7 @@ ${lanes.join("\n")} ) && isCapturedThis(node.left); } function isTransformedSuperCall(node) { - return isCallExpression14(node) && isPropertyAccessExpression15(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier25(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) && 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; } function isTransformedSuperCallWithFallback(node) { return isBinaryExpression4(node) && node.operatorToken.kind === 57 && node.right.kind === 110 && isTransformedSuperCall(node.left); @@ -138383,7 +139309,7 @@ ${lanes.join("\n")} return factory2.updateBlock(body, visitNodes2(body.statements, elideUnusedThisCaptureWorker, isStatement)); } function injectSuperPresenceCheckWorker(node) { - if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier25(node.arguments[1]) && idText(node.arguments[1]) === "arguments") { + if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier26(node.arguments[1]) && idText(node.arguments[1]) === "arguments") { return factory2.createLogicalAnd( factory2.createStrictInequality( createSyntheticSuper(), @@ -138909,7 +139835,7 @@ ${lanes.join("\n")} Debug.assert(propertyName); let e; if (!isPrivateIdentifier(propertyName) && getUseDefineForClassFields(context.getCompilerOptions())) { - const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier25(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier26(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( @@ -139262,20 +140188,20 @@ ${lanes.join("\n")} if (isBlock6(body) && arrayIsEqualTo(statements, body.statements)) { return body; } - const block = factory2.createBlock(setTextRange(factory2.createNodeArray(statements), statementsLocation), multiLine); - setTextRange(block, node.body); + const block2 = factory2.createBlock(setTextRange(factory2.createNodeArray(statements), statementsLocation), multiLine); + setTextRange(block2, node.body); if (!multiLine && singleLine) { setEmitFlags( - block, + block2, 1 /* SingleLine */ ); } if (closeBraceLocation) { - setTokenSourceMapRange(block, 20, closeBraceLocation); + setTokenSourceMapRange(block2, 20, closeBraceLocation); } - setOriginalNode(block, node.body); - return block; + setOriginalNode(block2, node.body); + return block2; } function visitBlock(node, isFunctionBody2) { if (isFunctionBody2) { @@ -139401,7 +140327,7 @@ ${lanes.join("\n")} const declarations = visitNodes2( node.declarations, node.flags & 1 ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration, - isVariableDeclaration6 + isVariableDeclaration7 ); const declarationList = factory2.createVariableDeclarationList(declarations); setOriginalNode(declarationList, node); @@ -139667,7 +140593,7 @@ ${lanes.join("\n")} const expression = visitNode(node.expression, visitor, isExpression); Debug.assert(expression); const counter = factory2.createLoopVariable(); - const rhsReference = isIdentifier25(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const rhsReference = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -139731,11 +140657,11 @@ ${lanes.join("\n")} function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) { const expression = visitNode(node.expression, visitor, isExpression); Debug.assert(expression); - const iterator = isIdentifier25(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( + const iterator = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); - const result = isIdentifier25(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( + const result = isIdentifier26(expression) ? factory2.getGeneratedNameForNode(iterator) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); @@ -140647,9 +141573,9 @@ ${lanes.join("\n")} ); return updated; } - function addStatementToStartOfBlock(block, statement) { - const transformedStatements = visitNodes2(block.statements, visitor, isStatement); - return factory2.updateBlock(block, [statement, ...transformedStatements]); + function addStatementToStartOfBlock(block2, statement) { + const transformedStatements = visitNodes2(block2.statements, visitor, isStatement); + return factory2.updateBlock(block2, [statement, ...transformedStatements]); } function visitMethodDeclaration(node) { Debug.assert(!isComputedPropertyName(node.name)); @@ -140763,7 +141689,7 @@ ${lanes.join("\n")} if (!aliasAssignment && isBinaryExpression4(initializer3) && initializer3.operatorToken.kind === 28) { aliasAssignment = tryCast(initializer3.left, isAssignmentExpression); } - const call = cast(aliasAssignment ? skipOuterExpressions(aliasAssignment.right) : initializer3, isCallExpression14); + const call = cast(aliasAssignment ? skipOuterExpressions(aliasAssignment.right) : initializer3, isCallExpression16); const func = cast(skipOuterExpressions(call.expression), isFunctionExpression6); const funcStatements = func.body.statements; let classBodyStart = 0; @@ -140781,7 +141707,7 @@ ${lanes.join("\n")} factory2.createExpressionStatement( factory2.createAssignment( aliasAssignment.left, - cast(variable.name, isIdentifier25) + cast(variable.name, isIdentifier26) ) ) ); @@ -140795,7 +141721,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) && !isIdentifier25(returnStatement.expression)) { + if (isReturnStatement4(statement) && (returnStatement == null ? void 0 : returnStatement.expression) && !isIdentifier26(returnStatement.expression)) { statements.push(returnStatement); } else { statements.push(statement); @@ -141112,14 +142038,14 @@ ${lanes.join("\n")} if (hint === 1) { return substituteExpression(node); } - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { return substituteIdentifier(node); } return node; } function substituteIdentifier(node) { if (enabledSubstitutions & 2 && !isInternalName(node)) { - const original = getParseTreeNode(node, isIdentifier25); + const original = getParseTreeNode(node, isIdentifier26); if (original && isNameOfDeclarationWithCollidingName(original)) { return setTextRange(factory2.getGeneratedNameForNode(original), node); } @@ -141204,7 +142130,7 @@ ${lanes.join("\n")} return false; } const expression = callArgument.expression; - return isIdentifier25(expression) && expression.escapedText === "arguments"; + return isIdentifier26(expression) && expression.escapedText === "arguments"; } } function getInstructionName(instruction) { @@ -142372,7 +143298,7 @@ ${lanes.join("\n")} return node; } function substituteExpression(node) { - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { return substituteExpressionIdentifier(node); } return node; @@ -142380,7 +143306,7 @@ ${lanes.join("\n")} function substituteExpressionIdentifier(node) { if (!isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(idText(node))) { const original = getOriginalNode(node); - if (isIdentifier25(original) && original.parent) { + if (isIdentifier26(original) && original.parent) { const declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { const name = renamedCatchVariableDeclarations[getOriginalNodeId(declaration)]; @@ -142429,7 +143355,7 @@ ${lanes.join("\n")} Debug.assert(labelOffsets !== void 0, "No labels were defined."); labelOffsets[label] = operations ? operations.length : 0; } - function beginBlock(block) { + function beginBlock(block2) { if (!blocks) { blocks = []; blockActions = []; @@ -142439,26 +143365,26 @@ ${lanes.join("\n")} const index = blockActions.length; blockActions[index] = 0; blockOffsets[index] = operations ? operations.length : 0; - blocks[index] = block; - blockStack.push(block); + blocks[index] = block2; + blockStack.push(block2); return index; } function endBlock() { - const block = peekBlock(); - if (block === void 0) return Debug.fail("beginBlock was never called."); + const block2 = peekBlock(); + if (block2 === void 0) return Debug.fail("beginBlock was never called."); const index = blockActions.length; blockActions[index] = 1; blockOffsets[index] = operations ? operations.length : 0; - blocks[index] = block; + blocks[index] = block2; blockStack.pop(); - return block; + return block2; } function peekBlock() { return lastOrUndefined(blockStack); } function peekBlockKind() { - const block = peekBlock(); - return block && block.kind; + const block2 = peekBlock(); + return block2 && block2.kind; } function beginWithBlock(expression) { const startLabel = defineLabel(); @@ -142476,8 +143402,8 @@ ${lanes.join("\n")} peekBlockKind() === 1 /* With */ ); - const block = endBlock(); - markLabel(block.endLabel); + const block2 = endBlock(); + markLabel(block2.endLabel); } function beginExceptionBlock() { const startLabel = defineLabel(); @@ -142591,9 +143517,9 @@ ${lanes.join("\n")} peekBlockKind() === 3 /* Loop */ ); - const block = endBlock(); - const breakLabel = block.breakLabel; - if (!block.isScript) { + const block2 = endBlock(); + const breakLabel = block2.breakLabel; + if (!block2.isScript) { markLabel(breakLabel); } } @@ -142618,9 +143544,9 @@ ${lanes.join("\n")} peekBlockKind() === 2 /* Switch */ ); - const block = endBlock(); - const breakLabel = block.breakLabel; - if (!block.isScript) { + const block2 = endBlock(); + const breakLabel = block2.breakLabel; + if (!block2.isScript) { markLabel(breakLabel); } } @@ -142646,19 +143572,19 @@ ${lanes.join("\n")} peekBlockKind() === 4 /* Labeled */ ); - const block = endBlock(); - if (!block.isScript) { - markLabel(block.breakLabel); + const block2 = endBlock(); + if (!block2.isScript) { + markLabel(block2.breakLabel); } } - function supportsUnlabeledBreak(block) { - return block.kind === 2 || block.kind === 3; + function supportsUnlabeledBreak(block2) { + return block2.kind === 2 || block2.kind === 3; } - function supportsLabeledBreakOrContinue(block) { - return block.kind === 4; + function supportsLabeledBreakOrContinue(block2) { + return block2.kind === 4; } - function supportsUnlabeledContinue(block) { - return block.kind === 3; + function supportsUnlabeledContinue(block2) { + return block2.kind === 3; } function hasImmediateContainingLabeledBlock(labelText, start) { for (let j = start; j >= 0; j--) { @@ -142677,18 +143603,18 @@ ${lanes.join("\n")} if (blockStack) { if (labelText) { for (let i = blockStack.length - 1; i >= 0; i--) { - const block = blockStack[i]; - if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) { - return block.breakLabel; - } else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { - return block.breakLabel; + const block2 = blockStack[i]; + if (supportsLabeledBreakOrContinue(block2) && block2.labelText === labelText) { + return block2.breakLabel; + } else if (supportsUnlabeledBreak(block2) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block2.breakLabel; } } } else { for (let i = blockStack.length - 1; i >= 0; i--) { - const block = blockStack[i]; - if (supportsUnlabeledBreak(block)) { - return block.breakLabel; + const block2 = blockStack[i]; + if (supportsUnlabeledBreak(block2)) { + return block2.breakLabel; } } } @@ -142699,16 +143625,16 @@ ${lanes.join("\n")} if (blockStack) { if (labelText) { for (let i = blockStack.length - 1; i >= 0; i--) { - const block = blockStack[i]; - if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { - return block.continueLabel; + const block2 = blockStack[i]; + if (supportsUnlabeledContinue(block2) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block2.continueLabel; } } } else { for (let i = blockStack.length - 1; i >= 0; i--) { - const block = blockStack[i]; - if (supportsUnlabeledContinue(block)) { - return block.continueLabel; + const block2 = blockStack[i]; + if (supportsUnlabeledContinue(block2)) { + return block2.continueLabel; } } } @@ -143030,9 +143956,9 @@ ${lanes.join("\n")} function tryEnterOrLeaveBlock(operationIndex) { if (blocks) { for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) { - const block = blocks[blockIndex]; + const block2 = blocks[blockIndex]; const blockAction = blockActions[blockIndex]; - switch (block.kind) { + switch (block2.kind) { case 0: if (blockAction === 0) { if (!exceptionBlockStack) { @@ -143042,7 +143968,7 @@ ${lanes.join("\n")} statements = []; } exceptionBlockStack.push(currentExceptionBlock); - currentExceptionBlock = block; + currentExceptionBlock = block2; } else if (blockAction === 1) { currentExceptionBlock = exceptionBlockStack.pop(); } @@ -143052,7 +143978,7 @@ ${lanes.join("\n")} if (!withBlockStack) { withBlockStack = []; } - withBlockStack.push(block); + withBlockStack.push(block2); } else if (blockAction === 1) { withBlockStack.pop(); } @@ -143925,7 +144851,7 @@ ${lanes.join("\n")} return true; } } - } else if (isIdentifier25(node)) { + } else if (isIdentifier26(node)) { return length(getExports(node)) > (isExportName(node) ? 1 : 0); } return false; @@ -144120,7 +145046,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) && isIdentifier25(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 || node.operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -144228,7 +145154,7 @@ ${lanes.join("\n")} } } function createImportCallExpressionAMD(arg, containsLexicalThis) { - const resolve4 = factory2.createUniqueName("resolve"); + const resolve9 = factory2.createUniqueName("resolve"); const reject = factory2.createUniqueName("reject"); const parameters = [ factory2.createParameterDeclaration( @@ -144237,7 +145163,7 @@ ${lanes.join("\n")} /*dotDotDotToken*/ void 0, /*name*/ - resolve4 + resolve9 ), factory2.createParameterDeclaration( /*modifiers*/ @@ -144254,7 +145180,7 @@ ${lanes.join("\n")} factory2.createIdentifier("require"), /*typeArguments*/ void 0, - [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve4, reject] + [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve9, reject] ) ) ]); @@ -144790,7 +145716,7 @@ ${lanes.join("\n")} let modifiers; let removeCommentsOnExpressions = false; for (const variable of node.declarationList.declarations) { - if (isIdentifier25(variable.name) && isLocalName(variable.name)) { + if (isIdentifier26(variable.name) && isLocalName(variable.name)) { if (!modifiers) { modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); } @@ -144966,7 +145892,7 @@ ${lanes.join("\n")} statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer); } } - } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration6(decl) || decl.initializer || isForInOrOfInitializer)) { + } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration7(decl) || decl.initializer || isForInOrOfInitializer)) { statements = appendExportsOfDeclaration(statements, new IdentifierNameMap(), decl); } return statements; @@ -145174,10 +146100,10 @@ ${lanes.join("\n")} return node; } function substituteCallExpression(node) { - if (isIdentifier25(node.expression)) { + if (isIdentifier26(node.expression)) { const expression = substituteExpressionIdentifier(node.expression); noSubstitution[getNodeId(expression)] = true; - if (!isIdentifier25(expression) && !(getEmitFlags(node.expression) & 8192)) { + if (!isIdentifier26(expression) && !(getEmitFlags(node.expression) & 8192)) { return addInternalEmitFlags( factory2.updateCallExpression( node, @@ -145194,10 +146120,10 @@ ${lanes.join("\n")} return node; } function substituteTaggedTemplateExpression(node) { - if (isIdentifier25(node.tag)) { + if (isIdentifier26(node.tag)) { const tag = substituteExpressionIdentifier(node.tag); noSubstitution[getNodeId(tag)] = true; - if (!isIdentifier25(tag) && !(getEmitFlags(node.tag) & 8192)) { + if (!isIdentifier26(tag) && !(getEmitFlags(node.tag) & 8192)) { return addInternalEmitFlags( factory2.updateTaggedTemplateExpression( node, @@ -145258,7 +146184,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier25(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier26(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -146151,7 +147077,7 @@ ${lanes.join("\n")} return statement; } function createExportExpression(name, value) { - const exportName = isIdentifier25(name) ? factory2.createStringLiteralFromNode(name) : name; + const exportName = isIdentifier26(name) ? factory2.createStringLiteralFromNode(name) : name; setEmitFlags( value, getEmitFlags(value) | 3072 @@ -146452,7 +147378,7 @@ ${lanes.join("\n")} return hasExportedReferenceInDestructuringTarget(node.name); } else if (isPropertyAssignment11(node)) { return hasExportedReferenceInDestructuringTarget(node.initializer); - } else if (isIdentifier25(node)) { + } else if (isIdentifier26(node)) { const container = resolver.getReferencedExportContainer(node); return container !== void 0 && container.kind === 308; } else { @@ -146460,7 +147386,7 @@ ${lanes.join("\n")} } } function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) { - if ((node.operator === 46 || node.operator === 47) && isIdentifier25(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 || node.operator === 47) && isIdentifier26(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -146617,7 +147543,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier25(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier26(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -146891,7 +147817,7 @@ ${lanes.join("\n")} importRequireStatements = [importStatement, requireStatement]; } const name = importRequireStatements[1].declarationList.declarations[0].name; - Debug.assertNode(name, isIdentifier25); + Debug.assertNode(name, isIdentifier26); return factory2.createCallExpression( factory2.cloneNode(name), /*typeArguments*/ @@ -147041,7 +147967,7 @@ ${lanes.join("\n")} if (node.id && noSubstitution.has(node.id)) { return node; } - if (isIdentifier25(node) && getEmitFlags(node) & 8192) { + if (isIdentifier26(node) && getEmitFlags(node) & 8192) { return substituteHelperName(node); } return node; @@ -147138,7 +148064,7 @@ ${lanes.join("\n")} } } function canProduceDiagnostics(node) { - return isVariableDeclaration6(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration3(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration2(node) || isConstructorDeclaration2(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression15(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) || isFunctionDeclaration3(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration2(node) || isConstructorDeclaration2(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isJSDocTypeAlias(node); } function createGetSymbolAccessibilityDiagnosticForNodeName(node) { if (isSetAccessor(node) || isGetAccessor(node)) { @@ -147184,7 +148110,7 @@ ${lanes.join("\n")} } } function createGetSymbolAccessibilityDiagnosticForNode(node) { - if (isVariableDeclaration6(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isPropertyAccessExpression15(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isBindingElement(node) || isConstructorDeclaration2(node)) { + if (isVariableDeclaration7(node) || isPropertyDeclaration(node) || isPropertySignature3(node) || isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isBinaryExpression4(node) || isBindingElement(node) || isConstructorDeclaration2(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { return getAccessorDeclarationTypeVisibilityError; @@ -147568,7 +148494,7 @@ ${lanes.join("\n")} } } function findNearestDeclaration(node) { - const result = findAncestor(node, (n) => isExportAssignment3(n) || isStatement(n) || isVariableDeclaration6(n) || isPropertyDeclaration(n) || isParameter(n)); + const result = findAncestor(node, (n) => isExportAssignment3(n) || isStatement(n) || isVariableDeclaration7(n) || isPropertyDeclaration(n) || isParameter(n)); if (!result) return void 0; if (isExportAssignment3(result)) return result; if (isReturnStatement4(result)) { @@ -147764,7 +148690,7 @@ ${lanes.join("\n")} function reportInferenceFallback(node) { if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return; if (getSourceFileOfNode(node) !== currentSourceFile) return; - if (isVariableDeclaration6(node) && resolver.isExpandoFunctionDeclaration(node)) { + if (isVariableDeclaration7(node) && resolver.isExpandoFunctionDeclaration(node)) { reportExpandoFunctionErrors(node); } else { context.addDiagnostic(getIsolatedDeclarationError(node)); @@ -147810,7 +148736,7 @@ ${lanes.join("\n")} context.addDiagnostic( addRelatedInfo( createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName), - ...isVariableDeclaration6((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : [] + ...isVariableDeclaration7((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : [] ) ); } @@ -149247,7 +150173,7 @@ ${lanes.join("\n")} } function transformVariableStatement(input) { if (!forEach(input.declarationList.declarations, getBindingNameVisible)) return; - const nodes = visitNodes2(input.declarationList.declarations, visitDeclarationSubtree, isVariableDeclaration6); + const nodes = visitNodes2(input.declarationList.declarations, visitDeclarationSubtree, isVariableDeclaration7); if (!length(nodes)) return; const modifiers = factory2.createNodeArray(ensureModifiers(input)); let declList; @@ -149921,7 +150847,7 @@ ${lanes.join("\n")} } else { if (!configFile) return void 0; const configFileExtensionLess = removeFileExtension(configFile); - buildInfoExtensionLess = options.outDir ? options.rootDir ? resolvePath2(options.outDir, getRelativePathFromDirectory( + buildInfoExtensionLess = options.outDir ? options.rootDir ? resolvePath3(options.outDir, getRelativePathFromDirectory( options.rootDir, configFileExtensionLess, /*ignoreCase*/ @@ -149979,7 +150905,7 @@ ${lanes.join("\n")} ]) ? ".cjs" : ".js"; } function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) { - return outputDir ? resolvePath2( + return outputDir ? resolvePath3( outputDir, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase) ) : inputFileName; @@ -150334,7 +151260,7 @@ ${lanes.join("\n")} ); return; } - forEachChild26(node, collectLinkedAliases); + forEachChild27(node, collectLinkedAliases); } function markLinkedReferences(file2) { if (isSourceFileJS(file2)) return; @@ -150595,7 +151521,7 @@ ${lanes.join("\n")} Debug.assert(isSourceFile(node), "Expected a SourceFile node."); break; case 2: - Debug.assert(isIdentifier25(node), "Expected an Identifier node."); + Debug.assert(isIdentifier26(node), "Expected an Identifier node."); break; case 1: Debug.assert(isExpression(node), "Expected an Expression node."); @@ -150848,7 +151774,7 @@ ${lanes.join("\n")} } } if (hint === 0) return emitSourceFile(cast(node, isSourceFile)); - if (hint === 2) return emitIdentifier(cast(node, isIdentifier25)); + if (hint === 2) return emitIdentifier(cast(node, isIdentifier26)); if (hint === 6) return emitLiteral( cast(node, isStringLiteral15), /*jsxAttributeEscape*/ @@ -153769,7 +154695,7 @@ ${lanes.join("\n")} } function canEmitSimpleArrowHead(parentNode, parameters) { const parameter = singleOrUndefined(parameters); - return parameter && parameter.pos === parentNode.pos && isArrowFunction7(parentNode) && !parentNode.type && !some(parentNode.modifiers) && !some(parentNode.typeParameters) && !some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && isIdentifier25(parameter.name); + return parameter && parameter.pos === parentNode.pos && isArrowFunction7(parentNode) && !parentNode.type && !some(parentNode.modifiers) && !some(parentNode.typeParameters) && !some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && isIdentifier26(parameter.name); } function emitParametersForArrow(parentNode, parameters) { if (canEmitSimpleArrowHead(parentNode, parameters)) { @@ -154236,8 +155162,8 @@ ${lanes.join("\n")} } return 0; } - function isEmptyBlock(block) { - return block.statements.length === 0 && (!currentSourceFile || rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); + function isEmptyBlock(block2) { + return block2.statements.length === 0 && (!currentSourceFile || rangeEndIsOnSameLineAsRangeStart(block2, block2, currentSourceFile)); } function skipSynthesizedParentheses(node) { while (node.kind === 218 && nodeIsSynthesized(node)) { @@ -154273,7 +155199,7 @@ ${lanes.join("\n")} function getLiteralTextOfNode(node, sourceFile = currentSourceFile, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 11 && node.textSourceNode) { const textSourceNode = node.textSourceNode; - if (isIdentifier25(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral5(textSourceNode) || isJsxNamespacedName(textSourceNode)) { + if (isIdentifier26(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 { @@ -154667,7 +155593,7 @@ ${lanes.join("\n")} ); } function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { - if (isIdentifier25(node.name)) { + if (isIdentifier26(node.name)) { return generateNameCached(node.name, privateName); } return makeTempVariableName( @@ -154754,7 +155680,7 @@ ${lanes.join("\n")} case 1: return makeTempVariableName(0, !!(autoGenerate.flags & 8), isPrivateIdentifier(name), prefix, suffix); case 2: - Debug.assertNode(name, isIdentifier25); + Debug.assertNode(name, isIdentifier26); return makeTempVariableName( 268435456, !!(autoGenerate.flags & 8), @@ -155789,12 +156715,12 @@ ${lanes.join("\n")} function createCompilerHost(options, setParentNodes) { return createCompilerHostWorker(options, setParentNodes); } - function createGetSourceFile(readFile2, setParentNodes) { + function createGetSourceFile(readFile4, setParentNodes) { return (fileName, languageVersionOrOptions, onError) => { let text; try { mark("beforeIORead"); - text = readFile2(fileName); + text = readFile4(fileName); mark("afterIORead"); measure("I/O Read", "beforeIORead", "afterIORead"); } catch (e) { @@ -156034,18 +156960,18 @@ ${lanes.join("\n")} return formatStyle + text + resetEscapeSequence; } function formatCodeSpan(file2, start, length2, indent3, squiggleColor, host) { - const { line: firstLine, character: firstLineChar } = getLineAndCharacterOfPosition(file2, start); + const { line: firstLine3, character: firstLineChar } = getLineAndCharacterOfPosition(file2, start); const { line: lastLine, character: lastLineChar } = getLineAndCharacterOfPosition(file2, start + length2); const lastLineInFile = getLineAndCharacterOfPosition(file2, file2.text.length).line; - const hasMoreThanFiveLines = lastLine - firstLine >= 4; + const hasMoreThanFiveLines = lastLine - firstLine3 >= 4; let gutterWidth = (lastLine + 1 + "").length; if (hasMoreThanFiveLines) { gutterWidth = Math.max(ellipsis.length, gutterWidth); } let context = ""; - for (let i = firstLine; i <= lastLine; i++) { + for (let i = firstLine3; i <= lastLine; i++) { context += host.getNewLine(); - if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) { + if (hasMoreThanFiveLines && firstLine3 + 1 < i && i < lastLine - 1) { context += indent3 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine(); i = lastLine - 1; } @@ -156058,7 +156984,7 @@ ${lanes.join("\n")} context += lineContent + host.getNewLine(); context += indent3 + formatColorAndReset("".padStart(gutterWidth), gutterStyleSequence) + gutterSeparator; context += squiggleColor; - if (i === firstLine) { + 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, "~"); @@ -156072,7 +156998,7 @@ ${lanes.join("\n")} return context; } function formatLocation(file2, start, host, color = formatColorAndReset) { - const { line: firstLine, character: firstLineChar } = getLineAndCharacterOfPosition(file2, start); + const { line: firstLine3, character: firstLineChar } = getLineAndCharacterOfPosition(file2, start); const relativeFileName = host ? convertToRelativePath(file2.fileName, host.getCurrentDirectory(), (fileName) => host.getCanonicalFileName(fileName)) : file2.fileName; let output = ""; output += color( @@ -156082,7 +157008,7 @@ ${lanes.join("\n")} ); output += ":"; output += color( - `${firstLine + 1}`, + `${firstLine3 + 1}`, "\x1B[93m" /* Yellow */ ); @@ -156698,7 +157624,7 @@ ${lanes.join("\n")} getRedirectFromOutput, forEachResolvedProjectReference: forEachResolvedProjectReference2 }); - const readFile2 = host.readFile.bind(host); + const readFile4 = host.readFile.bind(host); (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram }); const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options); (_f = tracing) == null ? void 0 : _f.pop(); @@ -156924,7 +157850,7 @@ ${lanes.join("\n")} shouldTransformImportCall, emitBuildInfo, fileExists, - readFile: readFile2, + readFile: readFile4, directoryExists, getSymlinkCache, realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host), @@ -157064,9 +157990,9 @@ ${lanes.join("\n")} /*ignoreCase*/ false )) { - const basename4 = getBaseFileName(a.fileName); - if (basename4 === "lib.d.ts" || basename4 === "lib.es6.d.ts") return 0; - const name = removeSuffix(removePrefix(basename4, "lib."), ".d.ts"); + const basename6 = getBaseFileName(a.fileName); + if (basename6 === "lib.d.ts" || basename6 === "lib.es6.d.ts") return 0; + const name = removeSuffix(removePrefix(basename6, "lib."), ".d.ts"); const index = libs.indexOf(name); if (index !== -1) return index + 1; } @@ -164454,15 +165380,15 @@ ${lanes.join("\n")} UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild"; return UpToDateStatusType2; })(UpToDateStatusType || {}); - function resolveConfigFileProjectName(project) { + function resolveConfigFileProjectName(project2) { if (fileExtensionIs( - project, + project2, ".json" /* Json */ )) { - return project; + return project2; } - return combinePaths(project, "tsconfig.json"); + return combinePaths(project2, "tsconfig.json"); } var minimumDate = /* @__PURE__ */ new Date(-864e13); function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) { @@ -164709,7 +165635,7 @@ ${lanes.join("\n")} return parsed; } function resolveProjectName(state, name) { - return resolveConfigFileProjectName(resolvePath2(state.compilerHost.getCurrentDirectory(), name)); + return resolveConfigFileProjectName(resolvePath3(state.compilerHost.getCurrentDirectory(), name)); } function createBuildOrder(state, roots) { const temporaryMarks = /* @__PURE__ */ new Map(); @@ -164777,9 +165703,9 @@ ${lanes.join("\n")} { onDeleteValue: closeFileWatcher } ); state.allWatchedExtendedConfigFiles.forEach((watcher) => { - watcher.projects.forEach((project) => { - if (!currentProjects.has(project)) { - watcher.projects.delete(project); + watcher.projects.forEach((project2) => { + if (!currentProjects.has(project2)) { + watcher.projects.delete(project2); } }); watcher.close(); @@ -164802,8 +165728,8 @@ ${lanes.join("\n")} } return state.buildOrder = buildOrder; } - function getBuildOrderFor(state, project, onlyReferences) { - const resolvedProject = project && resolveProjectName(state, project); + function getBuildOrderFor(state, project2, onlyReferences) { + const resolvedProject = project2 && resolveProjectName(state, project2); const buildOrderFromState = getBuildOrder(state); if (isCircularBuildOrder(buildOrderFromState)) return buildOrderFromState; if (resolvedProject) { @@ -164906,11 +165832,11 @@ ${lanes.join("\n")} state.projectPendingBuild.delete(projectPath); return state.diagnostics.has(projectPath) ? 1 : 0; } - function createUpdateOutputFileStampsProject(state, project, projectPath, config2, buildOrder) { + function createUpdateOutputFileStampsProject(state, project2, projectPath, config2, buildOrder) { let updateOutputFileStampsPending = true; return { kind: 1, - project, + project: project2, projectPath, buildOrder, getCompilerOptions: () => config2.options, @@ -164928,13 +165854,13 @@ ${lanes.join("\n")} } }; } - function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config2, status, buildOrder) { + function createBuildOrUpdateInvalidedProject(state, project2, projectPath, projectIndex, config2, status, buildOrder) { let step = 0; let program; let buildResult; return { kind: 0, - project, + project: project2, projectPath, buildOrder, getCompilerOptions: () => config2.options, @@ -164975,7 +165901,7 @@ ${lanes.join("\n")} return withProgramOrUndefined( (program2) => { var _a3, _b; - return program2.emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a3 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a3, project))); + return program2.emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a3 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a3, project2))); } ); } @@ -165003,12 +165929,12 @@ ${lanes.join("\n")} var _a3, _b, _c; Debug.assert(program === void 0); if (state.options.dry) { - reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project); + reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project2); buildResult = 1; step = 2; return; } - if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project); + if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project2); if (config2.fileNames.length === 0) { reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2)); buildResult = 0; @@ -165097,7 +166023,7 @@ ${lanes.join("\n")} cancellationToken, /*emitOnlyDtsFiles*/ void 0, - customTransformers || ((_b = (_a3 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a3, project)) + customTransformers || ((_b = (_a3 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a3, project2)) ); if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8)) { updateOutputTimestampsWorker(state, config2, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); @@ -165130,7 +166056,7 @@ ${lanes.join("\n")} emit(writeFile2, cancellationToken, customTransformers); break; case 2: - queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, Debug.checkDefined(buildResult)); + queueReferencingProjects(state, project2, projectPath, projectIndex, config2, buildOrder, Debug.checkDefined(buildResult)); step++; break; // Should never be done @@ -165147,46 +166073,46 @@ ${lanes.join("\n")} if (isCircularBuildOrder(buildOrder)) return void 0; const { options, projectPendingBuild } = state; for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) { - const project = buildOrder[projectIndex]; - const projectPath = toResolvedConfigFilePath(state, project); + const project2 = buildOrder[projectIndex]; + const projectPath = toResolvedConfigFilePath(state, project2); const updateLevel = state.projectPendingBuild.get(projectPath); if (updateLevel === void 0) continue; if (reportQueue) { reportQueue = false; reportBuildQueue(state, buildOrder); } - const config2 = parseConfigFile2(state, project, projectPath); + const config2 = parseConfigFile2(state, project2, projectPath); if (!config2) { reportParseConfigFileDiagnostic(state, projectPath); projectPendingBuild.delete(projectPath); continue; } if (updateLevel === 2) { - watchConfigFile(state, project, projectPath, config2); + watchConfigFile(state, project2, projectPath, config2); watchExtendedConfigFiles(state, projectPath, config2); - watchWildCardDirectories(state, project, projectPath, config2); - watchInputFiles(state, project, projectPath, config2); - watchPackageJsonFiles(state, project, projectPath, config2); + watchWildCardDirectories(state, project2, projectPath, config2); + watchInputFiles(state, project2, projectPath, config2); + watchPackageJsonFiles(state, project2, projectPath, config2); } else if (updateLevel === 1) { - config2.fileNames = getFileNamesFromConfigSpecs(config2.options.configFile.configFileSpecs, getDirectoryPath(project), config2.options, state.parseConfigFileHost); + config2.fileNames = getFileNamesFromConfigSpecs(config2.options.configFile.configFileSpecs, getDirectoryPath(project2), config2.options, state.parseConfigFileHost); updateErrorForNoInputFiles( config2.fileNames, - project, + project2, config2.options.configFile.configFileSpecs, config2.errors, canJsonReportNoInputFiles(config2.raw) ); - watchInputFiles(state, project, projectPath, config2); - watchPackageJsonFiles(state, project, projectPath, config2); + watchInputFiles(state, project2, projectPath, config2); + watchPackageJsonFiles(state, project2, projectPath, config2); } const status = getUpToDateStatus(state, config2, projectPath); if (!options.force) { if (status.type === 1) { - verboseReportProjectStatus(state, project, status); + verboseReportProjectStatus(state, project2, status); reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2)); projectPendingBuild.delete(projectPath); if (options.dry) { - reportStatus(state, Diagnostics.Project_0_is_up_to_date, project); + reportStatus(state, Diagnostics.Project_0_is_up_to_date, project2); } continue; } @@ -165195,7 +166121,7 @@ ${lanes.join("\n")} return { kind: 1, status, - project, + project: project2, projectPath, projectIndex, config: config2 @@ -165203,21 +166129,21 @@ ${lanes.join("\n")} } } if (status.type === 12) { - verboseReportProjectStatus(state, project, status); + verboseReportProjectStatus(state, project2, status); reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2)); projectPendingBuild.delete(projectPath); if (options.verbose) { reportStatus( state, status.upstreamProjectBlocked ? Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built : Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, - project, + project2, status.upstreamProjectName ); } continue; } if (status.type === 16) { - verboseReportProjectStatus(state, project, status); + verboseReportProjectStatus(state, project2, status); reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2)); projectPendingBuild.delete(projectPath); continue; @@ -165225,7 +166151,7 @@ ${lanes.join("\n")} return { kind: 0, status, - project, + project: project2, projectPath, projectIndex, config: config2 @@ -165288,7 +166214,7 @@ ${lanes.join("\n")} } return result; } - function watchFile(state, file2, callback, pollingInterval, options, watchType, project) { + function watchFile(state, file2, callback, pollingInterval, options, watchType, project2) { const path = toPath2(state, file2); const existing = state.filesWatched.get(path); if (existing && isFileWatcherWithModifiedTime(existing)) { @@ -165305,7 +166231,7 @@ ${lanes.join("\n")} pollingInterval, options, watchType, - project + project2 ); state.filesWatched.set(path, { callbacks: [callback], watcher, modifiedTime: existing }); } @@ -165354,20 +166280,20 @@ ${lanes.join("\n")} }; } } - function getUpToDateStatusWorker(state, project, resolvedPath) { + function getUpToDateStatusWorker(state, project2, resolvedPath) { var _a3, _b, _c, _d, _e; - if (isSolutionConfig(project)) return { + if (isSolutionConfig(project2)) return { type: 16 /* ContainerOnly */ }; let referenceStatuses; const force = !!state.options.force; - if (project.projectReferences) { + if (project2.projectReferences) { state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ }); - for (const ref of project.projectReferences) { + for (const ref of project2.projectReferences) { const resolvedRef = resolveProjectReferencePath(ref); const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef); const resolvedConfig = parseConfigFile2(state, resolvedRef, resolvedRefPath); @@ -165391,8 +166317,8 @@ ${lanes.join("\n")} /* ForceBuild */ }; const { host } = state; - const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options); - const isIncremental = isIncrementalCompilation(project.options); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project2.options); + const isIncremental = isIncrementalCompilation(project2.options); let buildInfoCacheEntry = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath); const buildInfoTime = (buildInfoCacheEntry == null ? void 0 : buildInfoCacheEntry.modifiedTime) || getModifiedTime(host, buildInfoPath); if (buildInfoTime === missingFileModifiedTime) { @@ -165422,7 +166348,7 @@ ${lanes.join("\n")} version: buildInfo.version }; } - if (!project.options.noCheck && (buildInfo.errors || // TODO: syntax errors???? + if (!project2.options.noCheck && (buildInfo.errors || // TODO: syntax errors???? buildInfo.checkPending)) { return { type: 8, @@ -165430,24 +166356,24 @@ ${lanes.join("\n")} }; } if (incrementalBuildInfo) { - if (!project.options.noCheck && (((_a3 = incrementalBuildInfo.changeFileSet) == null ? void 0 : _a3.length) || ((_b = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _b.length) || getEmitDeclarations(project.options) && ((_c = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length))) { + if (!project2.options.noCheck && (((_a3 = incrementalBuildInfo.changeFileSet) == null ? void 0 : _a3.length) || ((_b = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _b.length) || getEmitDeclarations(project2.options) && ((_c = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length))) { return { type: 8, buildInfoFile: buildInfoPath }; } - if (!project.options.noEmit && (((_d = incrementalBuildInfo.changeFileSet) == null ? void 0 : _d.length) || ((_e = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _e.length) || incrementalBuildInfo.pendingEmit !== void 0)) { + if (!project2.options.noEmit && (((_d = incrementalBuildInfo.changeFileSet) == null ? void 0 : _d.length) || ((_e = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _e.length) || incrementalBuildInfo.pendingEmit !== void 0)) { return { type: 7, buildInfoFile: buildInfoPath }; } - if ((!project.options.noEmit || project.options.noEmit && getEmitDeclarations(project.options)) && getPendingEmitKindWithSeen( - project.options, + if ((!project2.options.noEmit || project2.options.noEmit && getEmitDeclarations(project2.options)) && getPendingEmitKindWithSeen( + project2.options, incrementalBuildInfo.options || {}, /*emitOnlyDtsFiles*/ void 0, - !!project.options.noEmit + !!project2.options.noEmit )) { return { type: 9, @@ -165462,7 +166388,7 @@ ${lanes.join("\n")} let pseudoInputUpToDate = false; const seenRoots = /* @__PURE__ */ new Set(); let buildInfoVersionMap; - for (const inputFile of project.fileNames) { + for (const inputFile of project2.fileNames) { const inputTime = getModifiedTime2(state, inputFile); if (inputTime === missingFileModifiedTime) { return { @@ -165518,7 +166444,7 @@ ${lanes.join("\n")} }; } if (!isIncremental) { - const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames()); + const outputs = getAllProjectOutputs(project2, !host.useCaseSensitiveFileNames()); const outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath); for (const output of outputs) { if (output === buildInfoPath) continue; @@ -165573,9 +166499,9 @@ ${lanes.join("\n")} }; } } - const configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName); + const configStatus = checkConfigFileUpToDateStatus(state, project2.options.configFilePath, oldestOutputFileTime, oldestOutputFileName); if (configStatus) return configStatus; - const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName)); + const extendedConfigStatus = forEach(project2.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName)); if (extendedConfigStatus) return extendedConfigStatus; const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath); const dependentPackageFileStatus = packageJsonLookups && forEachKey( @@ -165594,8 +166520,8 @@ ${lanes.join("\n")} const refBuildInfo = state.buildInfoCache.get(resolvedRefPath); return refBuildInfo.path === buildInfoCacheEntry.path; } - function getUpToDateStatus(state, project, resolvedPath) { - if (project === void 0) { + function getUpToDateStatus(state, project2, resolvedPath) { + if (project2 === void 0) { return { type: 0, reason: "config file deleted mid-build" }; } const prior = state.projectStatus.get(resolvedPath); @@ -165603,7 +166529,7 @@ ${lanes.join("\n")} return prior; } mark("SolutionBuilder::beforeUpToDateCheck"); - const actual = getUpToDateStatusWorker(state, project, resolvedPath); + const actual = getUpToDateStatusWorker(state, project2, resolvedPath); mark("SolutionBuilder::afterUpToDateCheck"); measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); @@ -165666,7 +166592,7 @@ ${lanes.join("\n")} oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames()) }); } - function queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, buildResult) { + function queueReferencingProjects(state, project2, projectPath, projectIndex, config2, buildOrder, buildResult) { if (state.options.stopBuildOnErrors && buildResult & 4) return; if (!config2.options.composite) return; for (let index = projectIndex + 1; index < buildOrder.length; index++) { @@ -165693,7 +166619,7 @@ ${lanes.join("\n")} state.projectStatus.set(nextProjectPath, { type: 6, outOfDateOutputFileName: status.oldestOutputFileName, - newerProjectName: project + newerProjectName: project2 }); } break; @@ -165714,15 +166640,15 @@ ${lanes.join("\n")} } } } - function build4(state, project, cancellationToken, writeFile2, getCustomTransformers, onlyReferences) { + function build4(state, project2, cancellationToken, writeFile2, getCustomTransformers, onlyReferences) { mark("SolutionBuilder::beforeBuild"); - const result = buildWorker(state, project, cancellationToken, writeFile2, getCustomTransformers, onlyReferences); + const result = buildWorker(state, project2, cancellationToken, writeFile2, getCustomTransformers, onlyReferences); mark("SolutionBuilder::afterBuild"); measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); return result; } - function buildWorker(state, project, cancellationToken, writeFile2, getCustomTransformers, onlyReferences) { - const buildOrder = getBuildOrderFor(state, project, onlyReferences); + function buildWorker(state, project2, cancellationToken, writeFile2, getCustomTransformers, onlyReferences) { + const buildOrder = getBuildOrderFor(state, project2, onlyReferences); if (!buildOrder) return 3; setupInitialBuild(state, cancellationToken); let reportQueue = true; @@ -165739,15 +166665,15 @@ ${lanes.join("\n")} startWatching(state, buildOrder); return isCircularBuildOrder(buildOrder) ? 4 : !buildOrder.some((p) => state.diagnostics.has(toResolvedConfigFilePath(state, p))) ? 0 : successfulProjects ? 2 : 1; } - function clean(state, project, onlyReferences) { + function clean(state, project2, onlyReferences) { mark("SolutionBuilder::beforeClean"); - const result = cleanWorker(state, project, onlyReferences); + const result = cleanWorker(state, project2, onlyReferences); mark("SolutionBuilder::afterClean"); measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); return result; } - function cleanWorker(state, project, onlyReferences) { - const buildOrder = getBuildOrderFor(state, project, onlyReferences); + function cleanWorker(state, project2, onlyReferences) { + const buildOrder = getBuildOrderFor(state, project2, onlyReferences); if (!buildOrder) return 3; if (isCircularBuildOrder(buildOrder)) { reportErrors(state, buildOrder.circularDiagnostics); @@ -165864,8 +166790,8 @@ ${lanes.join("\n")} ); return; } - const project = createInvalidatedProjectWithInfo(state, info, buildOrder); - project.done(); + const project2 = createInvalidatedProjectWithInfo(state, info, buildOrder); + project2.done(); if (info.kind !== 1) projectsBuilt++; } } @@ -166027,20 +166953,20 @@ ${lanes.join("\n")} function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) { const state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions); return { - build: (project, cancellationToken, writeFile2, getCustomTransformers) => build4(state, project, cancellationToken, writeFile2, getCustomTransformers), - clean: (project) => clean(state, project), - buildReferences: (project, cancellationToken, writeFile2, getCustomTransformers) => build4( + build: (project2, cancellationToken, writeFile2, getCustomTransformers) => build4(state, project2, cancellationToken, writeFile2, getCustomTransformers), + clean: (project2) => clean(state, project2), + buildReferences: (project2, cancellationToken, writeFile2, getCustomTransformers) => build4( state, - project, + project2, cancellationToken, writeFile2, getCustomTransformers, /*onlyReferences*/ true ), - cleanReferences: (project) => clean( + cleanReferences: (project2) => clean( state, - project, + project2, /*onlyReferences*/ true ), @@ -166054,8 +166980,8 @@ ${lanes.join("\n")} ); }, getBuildOrder: () => getBuildOrder(state), - getUpToDateStatusOfProject: (project) => { - const configFileName = resolveProjectName(state, project); + getUpToDateStatusOfProject: (project2) => { + const configFileName = resolveProjectName(state, project2); const configFilePath = toResolvedConfigFilePath(state, configFileName); return getUpToDateStatus(state, parseConfigFile2(state, configFileName, configFilePath), configFilePath); }, @@ -166104,8 +167030,8 @@ ${lanes.join("\n")} if (canReportSummary) totalErrors += getErrorCountForSummary(buildOrder.circularDiagnostics); if (canReportSummary) filesInError = [...filesInError, ...getFilesInErrorForSummary(buildOrder.circularDiagnostics)]; } else { - buildOrder.forEach((project) => { - const projectPath = toResolvedConfigFilePath(state, project); + buildOrder.forEach((project2) => { + const projectPath = toResolvedConfigFilePath(state, project2); if (!state.projectErrorsReported.has(projectPath)) { reportErrors(state, diagnostics.get(projectPath) || emptyArray); } @@ -167614,7 +168540,7 @@ ${lanes.join("\n")} } if (isJSDocTypeLiteral(node)) { return factory.createTypeLiteralNode(map2(node.jsDocPropertyTags, (t) => { - const name = visitNode(isIdentifier25(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier25); + const name = visitNode(isIdentifier26(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier26); const overrideTypeNode = resolver.getJsDocPropertyOverride(context, node, t); return factory.createPropertySignature( /*modifiers*/ @@ -167631,7 +168557,7 @@ ${lanes.join("\n")} ); })); } - if (isTypeReferenceNode3(node) && isIdentifier25(node.typeName) && node.typeName.escapedText === "") { + if (isTypeReferenceNode3(node) && isIdentifier26(node.typeName) && node.typeName.escapedText === "") { return setOriginalNode(factory.createKeywordTypeNode( 133 /* AnyKeyword */ @@ -167661,7 +168587,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols, isTypeParameterDeclaration), - mapDefined(node.parameters, (p, i) => p.name && isIdentifier25(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, void 0) : factory.createParameterDeclaration( + mapDefined(node.parameters, (p, i) => p.name && isIdentifier26(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, void 0) : factory.createParameterDeclaration( /*modifiers*/ void 0, getEffectiveDotDotDotForParameter(p), @@ -167818,7 +168744,7 @@ ${lanes.join("\n")} } if (isTypePredicateNode(node)) { let parameterName; - if (isIdentifier25(node.parameterName)) { + if (isIdentifier26(node.parameterName)) { const { node: result, introducesError } = resolver.trackExistingEntityName(context, node.parameterName); if (introducesError) markError(); parameterName = result; @@ -167899,7 +168825,7 @@ ${lanes.join("\n")} ) : void 0); } function getNameForJSDocFunctionParameter(p, index) { - return p.name && isIdentifier25(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`; + return p.name && isIdentifier26(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`; } function rewriteModuleSpecifier2(parent2, lit2) { const newName = resolver.getModuleSpecifierOverride(context, parent2, lit2); @@ -168086,7 +169012,7 @@ ${lanes.join("\n")} let resultType = failed; if (declaredType) { resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2)); - } else if (node.initializer && (((_a3 = symbol2.declarations) == null ? void 0 : _a3.length) === 1 || countWhere(symbol2.declarations, isVariableDeclaration6) === 1)) { + } 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, @@ -168116,7 +169042,7 @@ ${lanes.join("\n")} let resultType = failed; if (declaredType) { resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol2, addUndefined)); - } else if (isParameter(node) && node.initializer && isIdentifier25(node.name) && !isContextuallyTyped(node)) { + } else if (isParameter(node) && node.initializer && isIdentifier26(node.name) && !isContextuallyTyped(node)) { resultType = typeFromExpression( node.initializer, context, @@ -168557,7 +169483,7 @@ ${lanes.join("\n")} ) ); } else { - if (isIdentifier25(name) && name.escapedText === "new") { + if (isIdentifier26(name) && name.escapedText === "new") { name = factory.createStringLiteral("new"); } return factory.createMethodSignature( @@ -168723,7 +169649,7 @@ ${lanes.join("\n")} } function isContextuallyTyped(node) { return findAncestor(node.parent, (n) => { - return isCallExpression14(n) || !isFunctionLikeDeclaration(n) && !!getEffectiveTypeAnnotationNode(n) || isJsxElement(n) || isJsxExpression(n); + return isCallExpression16(n) || !isFunctionLikeDeclaration(n) && !!getEffectiveTypeAnnotationNode(n) || isJsxElement(n) || isJsxExpression(n); }); } } @@ -169487,16 +170413,16 @@ ${lanes.join("\n")} return false; } function isCallExpressionTarget(node, includeElementAccess = false, skipPastOuterExpressions = false) { - return isCalleeWorker(node, isCallExpression14, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + return isCalleeWorker(node, isCallExpression16, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } function isNewExpressionTarget(node, includeElementAccess = false, skipPastOuterExpressions = false) { - return isCalleeWorker(node, isNewExpression17, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + return isCalleeWorker(node, isNewExpression19, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } function isCallOrNewExpressionTarget(node, includeElementAccess = false, skipPastOuterExpressions = false) { return isCalleeWorker(node, isCallOrNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } function isTaggedTemplateTag(node, includeElementAccess = false, skipPastOuterExpressions = false) { - return isCalleeWorker(node, isTaggedTemplateExpression4, selectTagOfTaggedTemplateExpression, includeElementAccess, skipPastOuterExpressions); + return isCalleeWorker(node, isTaggedTemplateExpression5, selectTagOfTaggedTemplateExpression, includeElementAccess, skipPastOuterExpressions); } function isDecoratorTarget(node, includeElementAccess = false, skipPastOuterExpressions = false) { return isCalleeWorker(node, isDecorator, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); @@ -169536,18 +170462,18 @@ ${lanes.join("\n")} return void 0; } function hasPropertyAccessExpressionWithName(node, funcName) { - if (!isPropertyAccessExpression15(node.expression)) { + if (!isPropertyAccessExpression16(node.expression)) { return false; } return node.expression.name.text === funcName; } function isJumpStatementTarget(node) { var _a3; - return isIdentifier25(node) && ((_a3 = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a3.label) === node; + return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a3.label) === node; } function isLabelOfLabeledStatement(node) { var _a3; - return isIdentifier25(node) && ((_a3 = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a3.label) === node; + return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a3.label) === node; } function isLabelName(node) { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); @@ -169562,7 +170488,7 @@ ${lanes.join("\n")} } function isRightSideOfPropertyAccess(node) { var _a3; - return ((_a3 = tryCast(node.parent, isPropertyAccessExpression15)) == null ? void 0 : _a3.name) === node; + return ((_a3 = tryCast(node.parent, isPropertyAccessExpression16)) == null ? void 0 : _a3.name) === node; } function isArgumentExpressionOfElementAccess(node) { var _a3; @@ -169574,7 +170500,7 @@ ${lanes.join("\n")} } function isNameOfFunctionDeclaration(node) { var _a3; - return isIdentifier25(node) && ((_a3 = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a3.name) === node; + return isIdentifier26(node) && ((_a3 = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a3.name) === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { @@ -170039,7 +170965,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 (isIdentifier25(decl.name)) { + if (isIdentifier26(decl.name)) { return decl.name; } } @@ -170115,7 +171041,7 @@ ${lanes.join("\n")} return parent2.type.elementType.typeName; } if (!forRename) { - if (node.kind === 105 && isNewExpression17(parent2) || node.kind === 116 && isVoidExpression(parent2) || node.kind === 114 && isTypeOfExpression(parent2) || node.kind === 135 && isAwaitExpression(parent2) || node.kind === 127 && isYieldExpression(parent2) || node.kind === 91 && isDeleteExpression(parent2)) { + if (node.kind === 105 && isNewExpression19(parent2) || node.kind === 116 && isVoidExpression(parent2) || node.kind === 114 && isTypeOfExpression(parent2) || node.kind === 135 && isAwaitExpression(parent2) || node.kind === 127 && isYieldExpression(parent2) || node.kind === 91 && isDeleteExpression(parent2)) { if (parent2.expression) { return skipOuterExpressions(parent2.expression); } @@ -170464,8 +171390,8 @@ ${lanes.join("\n")} } } } - function removeOptionality(type, isOptionalExpression, isOptionalChain2) { - return isOptionalExpression ? type.getNonNullableType() : isOptionalChain2 ? type.getNonOptionalType() : type; + function removeOptionality(type, isOptionalExpression, isOptionalChain22) { + return isOptionalExpression ? type.getNonNullableType() : isOptionalChain22 ? type.getNonOptionalType() : type; } function isPossiblyTypeArgumentPosition(token, sourceFile, checker) { const info = getPossibleTypeArgumentsInfo(token, sourceFile); @@ -170473,7 +171399,7 @@ ${lanes.join("\n")} } function getPossibleGenericSignatures(called, typeArgumentCount, checker) { let type = checker.getTypeAtLocation(called); - if (isOptionalChain(called.parent)) { + if (isOptionalChain2(called.parent)) { type = removeOptionality( type, isOptionalChainRoot(called.parent), @@ -170481,7 +171407,7 @@ ${lanes.join("\n")} true ); } - const signatures = isNewExpression17(called.parent) ? type.getConstructSignatures() : type.getCallSignatures(); + const signatures = isNewExpression19(called.parent) ? type.getConstructSignatures() : type.getCallSignatures(); return signatures.filter((candidate) => !!candidate.typeParameters && candidate.typeParameters.length >= typeArgumentCount); } function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) { @@ -170498,7 +171424,7 @@ ${lanes.join("\n")} if (token && token.kind === 29) { token = findPrecedingToken(token.getFullStart(), sourceFile); } - if (!token || !isIdentifier25(token)) return void 0; + if (!token || !isIdentifier26(token)) return void 0; if (!remainingLessThanTokens) { return isDeclarationName(token) ? void 0 : { called: token, nTypeArguments }; } @@ -170763,7 +171689,7 @@ ${lanes.join("\n")} return node.kind === 156; } function isTypeKeywordTokenOrIdentifier(node) { - return isTypeKeywordToken(node) || isIdentifier25(node) && node.text === "type"; + return isTypeKeywordToken(node) || isIdentifier26(node) && node.text === "type"; } function nodeSeenTracker() { const seen = []; @@ -170893,7 +171819,7 @@ ${lanes.join("\n")} ) && node.parent.arguments[0] === node || isImportCall(node.parent) && node.parent.arguments[0] === node); } function isObjectBindingElementWithoutPropertyName(bindingElement) { - return isBindingElement(bindingElement) && isObjectBindingPattern3(bindingElement.parent) && isIdentifier25(bindingElement.name) && !bindingElement.propertyName; + return isBindingElement(bindingElement) && isObjectBindingPattern3(bindingElement.parent) && isIdentifier26(bindingElement.name) && !bindingElement.propertyName; } function getPropertySymbolFromBindingElement(checker, bindingElement) { const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); @@ -171644,7 +172570,7 @@ ${lanes.join("\n")} let withSemicolon = 0; let withoutSemicolon = 0; const nStatementsToObserve = 5; - forEachChild26(sourceFile, function visit(node) { + forEachChild27(sourceFile, function visit(node) { if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) { const lastToken = node.getLastToken(sourceFile); if ((lastToken == null ? void 0 : lastToken.kind) === 27) { @@ -171667,7 +172593,7 @@ ${lanes.join("\n")} if (withSemicolon + withoutSemicolon >= nStatementsToObserve) { return true; } - return forEachChild26(node, visit); + return forEachChild27(node, visit); }); if (withSemicolon === 0 && withoutSemicolon <= 1) { return true; @@ -171977,12 +172903,12 @@ ${lanes.join("\n")} return firstDefined(symbol2.declarations, (d) => { var _a3, _b, _c; if (isExportAssignment3(d)) { - return (_a3 = tryCast(skipOuterExpressions(d.expression), isIdentifier25)) == null ? void 0 : _a3.text; + return (_a3 = tryCast(skipOuterExpressions(d.expression), isIdentifier26)) == null ? void 0 : _a3.text; } if (isExportSpecifier(d) && d.symbol.flags === 2097152) { - return (_b = tryCast(d.propertyName, isIdentifier25)) == null ? void 0 : _b.text; + return (_b = tryCast(d.propertyName, isIdentifier26)) == null ? void 0 : _b.text; } - const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier25)) == null ? void 0 : _c.text; + const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier26)) == null ? void 0 : _c.text; if (name) { return name; } @@ -173077,7 +174003,7 @@ ${lanes.join("\n")} return; } checkForClassificationCancellation(cancellationToken, node.kind); - if (isIdentifier25(node) && !nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { + if (isIdentifier26(node) && !nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { const symbol2 = typeChecker.getSymbolAtLocation(node); const type = symbol2 && classifySymbol(symbol2, getMeaningFromLocation(node), typeChecker); if (type) { @@ -174046,7 +174972,7 @@ ${lanes.join("\n")} ); }); } - forEachChild26(func, (child) => { + forEachChild27(func, (child) => { traverseWithoutCrossingFunction(child, (node2) => { if (isAwaitExpression(node2)) { pushKeywordIf( @@ -174066,7 +174992,7 @@ ${lanes.join("\n")} return void 0; } const keywords = []; - forEachChild26(func, (child) => { + forEachChild27(func, (child) => { traverseWithoutCrossingFunction(child, (node2) => { if (isYieldExpression(node2)) { pushKeywordIf( @@ -174083,7 +175009,7 @@ ${lanes.join("\n")} function traverseWithoutCrossingFunction(node, cb) { cb(node); if (!isFunctionLike(node) && !isClassLike(node) && !isInterfaceDeclaration2(node) && !isModuleDeclaration(node) && !isTypeAliasDeclaration2(node) && !isTypeNode(node)) { - forEachChild26(node, (child) => traverseWithoutCrossingFunction(child, cb)); + forEachChild27(node, (child) => traverseWithoutCrossingFunction(child, cb)); } } function getIfElseOccurrences(ifStatement, sourceFile) { @@ -175416,7 +176342,7 @@ ${lanes.join("\n")} function check2(node) { if (isJsFile) { if (canBeConvertedToClass(node, checker)) { - diags.push(createDiagnosticForNode(isVariableDeclaration6(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); + diags.push(createDiagnosticForNode(isVariableDeclaration7(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); } } else { if (isVariableStatement10(node) && node.parent === sourceFile && node.declarationList.flags & 2 && node.declarationList.declarations.length === 1) { @@ -175468,7 +176394,7 @@ ${lanes.join("\n")} }); } function propertyAccessLeftHandSide(node) { - return isPropertyAccessExpression15(node) ? propertyAccessLeftHandSide(node.expression) : node; + return isPropertyAccessExpression16(node) ? propertyAccessLeftHandSide(node.expression) : node; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { @@ -175484,7 +176410,7 @@ ${lanes.join("\n")} function addConvertToAsyncFunctionDiagnostics(node, checker, diags) { if (isConvertibleFunction(node, checker) && !visitedNestedConvertibleFunctions.has(getKeyFromNode(node))) { diags.push(createDiagnosticForNode( - !node.name && isVariableDeclaration6(node.parent) && isIdentifier25(node.parent.name) ? node.parent.name : node, + !node.name && isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name) ? node.parent.name : node, Diagnostics.This_may_be_converted_to_an_async_function )); } @@ -175511,8 +176437,8 @@ ${lanes.join("\n")} return false; } let currentNode = node.expression.expression; - while (isPromiseHandler(currentNode) || isPropertyAccessExpression15(currentNode)) { - if (isCallExpression14(currentNode)) { + while (isPromiseHandler(currentNode) || isPropertyAccessExpression16(currentNode)) { + if (isCallExpression16(currentNode)) { if (!hasSupportedNumberOfArguments(currentNode) || !currentNode.arguments.every((arg) => isFixablePromiseArgument(arg, checker))) { return false; } @@ -175524,7 +176450,7 @@ ${lanes.join("\n")} return true; } function isPromiseHandler(node) { - return isCallExpression14(node) && (hasPropertyAccessExpressionWithName(node, "then") || hasPropertyAccessExpressionWithName(node, "catch") || hasPropertyAccessExpressionWithName(node, "finally")); + return isCallExpression16(node) && (hasPropertyAccessExpressionWithName(node, "then") || hasPropertyAccessExpressionWithName(node, "catch") || hasPropertyAccessExpressionWithName(node, "finally")); } function hasSupportedNumberOfArguments(node) { const name = node.expression.name.text; @@ -175532,7 +176458,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 || isIdentifier25(arg) && arg.text === "undefined"; + return arg.kind === 106 || isIdentifier26(arg) && arg.text === "undefined"; }); } function isFixablePromiseArgument(arg, checker) { @@ -175567,7 +176493,7 @@ ${lanes.join("\n")} function canBeConvertedToClass(node, checker) { var _a3, _b, _c, _d; if (isFunctionExpression6(node)) { - if (isVariableDeclaration6(node.parent) && ((_a3 = node.symbol.members) == null ? void 0 : _a3.size)) { + if (isVariableDeclaration7(node.parent) && ((_a3 = node.symbol.members) == null ? void 0 : _a3.size)) { return true; } const symbol2 = checker.getSymbolOfExpando( @@ -175835,7 +176761,7 @@ interface Symbol { return !!name && (pushLiteral(name, containers) || name.kind === 168 && tryAddComputedPropertyName(name.expression, containers)); } function tryAddComputedPropertyName(expression, containers) { - return pushLiteral(expression, containers) || isPropertyAccessExpression15(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); + return pushLiteral(expression, containers) || isPropertyAccessExpression16(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); } function pushLiteral(node, containers) { return isPropertyNameLiteral(node) && (containers.push(getTextOfIdentifierOrLiteral(node)), true); @@ -176003,7 +176929,7 @@ interface Symbol { function addNodeWithRecursiveInitializer(node) { if (node.initializer && isFunctionOrClassExpression(node.initializer)) { startNode(node); - forEachChild26(node.initializer, addChildrenRecursively); + forEachChild27(node.initializer, addChildrenRecursively); endNode(); } else { addNodeWithRecursiveChild(node, node.initializer); @@ -176072,7 +176998,7 @@ interface Symbol { break; case 306: const { expression } = node; - isIdentifier25(expression) ? addLeafNode(node, expression) : addLeafNode(node); + isIdentifier26(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; case 209: case 304: @@ -176087,7 +177013,7 @@ interface Symbol { } case 263: const nameNode = node.name; - if (nameNode && isIdentifier25(nameNode)) { + if (nameNode && isIdentifier26(nameNode)) { addTrackedEs5Class(nameNode.text); } addNodeWithRecursiveChild(node, node.body); @@ -176119,7 +177045,7 @@ interface Symbol { break; case 278: { const expression2 = node.expression; - const child = isObjectLiteralExpression12(expression2) || isCallExpression14(expression2) ? expression2 : isArrowFunction7(expression2) || isFunctionExpression6(expression2) ? expression2.body : void 0; + const child = isObjectLiteralExpression12(expression2) || isCallExpression16(expression2) ? expression2 : isArrowFunction7(expression2) || isFunctionExpression6(expression2) ? expression2.body : void 0; if (child) { startNode(node); addChildrenRecursively(child); @@ -176152,7 +177078,7 @@ interface Symbol { const prototypeAccess = special === 3 ? assignmentTarget.expression : assignmentTarget; let depth = 0; let className; - if (isIdentifier25(prototypeAccess.expression)) { + if (isIdentifier26(prototypeAccess.expression)) { addTrackedEs5Class(prototypeAccess.expression.text); className = prototypeAccess.expression; } else { @@ -176162,7 +177088,7 @@ interface Symbol { if (isObjectLiteralExpression12(binaryExpression.right)) { if (binaryExpression.right.properties.length > 0) { startNode(binaryExpression, className); - forEachChild26(binaryExpression.right, addChildrenRecursively); + forEachChild27(binaryExpression.right, addChildrenRecursively); endNode(); } } @@ -176194,7 +177120,7 @@ interface Symbol { const binaryExpression = node; const assignmentTarget = binaryExpression.left; const targetFunction = assignmentTarget.expression; - if (isIdentifier25(targetFunction) && getElementOrPropertyAccessName(assignmentTarget) !== "prototype" && trackedEs5Classes && trackedEs5Classes.has(targetFunction.text)) { + if (isIdentifier26(targetFunction) && getElementOrPropertyAccessName(assignmentTarget) !== "prototype" && trackedEs5Classes && trackedEs5Classes.has(targetFunction.text)) { if (isFunctionExpression6(binaryExpression.right) || isArrowFunction7(binaryExpression.right)) { addNodeWithRecursiveChild(node, binaryExpression.right, targetFunction); } else if (isBindableStaticAccessExpression(assignmentTarget)) { @@ -176225,7 +177151,7 @@ interface Symbol { }); }); } - forEachChild26(node, addChildrenRecursively); + forEachChild27(node, addChildrenRecursively); } } function mergeChildren(children, node) { @@ -176303,10 +177229,10 @@ interface Symbol { }; function tryMergeEs5Class(a, b, bIndex, parent2) { function isPossibleConstructor(node) { - return isFunctionExpression6(node) || isFunctionDeclaration3(node) || isVariableDeclaration6(node); + return isFunctionExpression6(node) || isFunctionDeclaration3(node) || isVariableDeclaration7(node); } - const bAssignmentDeclarationKind = isBinaryExpression4(b.node) || isCallExpression14(b.node) ? getAssignmentDeclarationKind(b.node) : 0; - const aAssignmentDeclarationKind = isBinaryExpression4(a.node) || isCallExpression14(a.node) ? getAssignmentDeclarationKind(a.node) : 0; + const bAssignmentDeclarationKind = isBinaryExpression4(b.node) || isCallExpression16(b.node) ? getAssignmentDeclarationKind(b.node) : 0; + const aAssignmentDeclarationKind = isBinaryExpression4(a.node) || isCallExpression16(a.node) ? getAssignmentDeclarationKind(a.node) : 0; if (isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind] || isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind] || isPossibleConstructor(b.node) && isEs5ClassMember[aAssignmentDeclarationKind] || isClassDeclaration5(a.node) && isSynthesized(a.node) && isEs5ClassMember[bAssignmentDeclarationKind] || isClassDeclaration5(b.node) && isEs5ClassMember[aAssignmentDeclarationKind] || isClassDeclaration5(a.node) && isSynthesized(a.node) && isPossibleConstructor(b.node) || isClassDeclaration5(b.node) && isPossibleConstructor(a.node) && isSynthesized(a.node)) { let lastANode = a.additionalNodes && lastOrUndefined(a.additionalNodes) || a.node; if (!isClassDeclaration5(a.node) && !isClassDeclaration5(b.node) || isPossibleConstructor(a.node) || isPossibleConstructor(b.node)) { @@ -176458,7 +177384,7 @@ interface Symbol { return cleanText(getModuleName(node)); } if (name) { - const text = isIdentifier25(name) ? name.text : isElementAccessExpression8(name) ? `[${nodeText(name.argumentExpression)}]` : nodeText(name); + const text = isIdentifier26(name) ? name.text : isElementAccessExpression8(name) ? `[${nodeText(name.argumentExpression)}]` : nodeText(name); if (text.length > 0) { return cleanText(text); } @@ -176618,7 +177544,7 @@ interface Symbol { const { parent: parent2 } = node; if (node.name && getFullWidth(node.name) > 0) { return cleanText(declarationNameToString(node.name)); - } else if (isVariableDeclaration6(parent2)) { + } else if (isVariableDeclaration7(parent2)) { return cleanText(declarationNameToString(parent2.name)); } else if (isBinaryExpression4(parent2) && parent2.operatorToken.kind === 64) { return nodeText(parent2.left).replace(whiteSpaceRegex, ""); @@ -176628,7 +177554,7 @@ interface Symbol { return "default"; } else if (isClassLike(node)) { return ""; - } else if (isCallExpression14(parent2)) { + } else if (isCallExpression16(parent2)) { let name = getCalledExpressionName(parent2.expression); if (name !== void 0) { name = cleanText(name); @@ -176642,9 +177568,9 @@ interface Symbol { return ""; } function getCalledExpressionName(expr) { - if (isIdentifier25(expr)) { + if (isIdentifier26(expr)) { return expr.text; - } else if (isPropertyAccessExpression15(expr)) { + } else if (isPropertyAccessExpression16(expr)) { const left = getCalledExpressionName(expr.expression); const right = expr.name.text; return left === void 0 ? right : `${left}.${right}`; @@ -176772,7 +177698,7 @@ interface Symbol { )) { return { error: getLocaleSpecificMessage(Diagnostics.This_file_already_has_a_default_export) }; } - const noSymbolError = (id) => isIdentifier25(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; + const noSymbolError = (id) => isIdentifier26(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; switch (exportNode.kind) { case 263: case 264: @@ -177113,10 +178039,10 @@ interface Symbol { } } function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression15(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; + return isPropertyAccessExpression16(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; } function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression15(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; + return isPropertyAccessExpression16(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; } function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault = getShouldUseDefault(program, toConvert.parent)) { const checker = program.getTypeChecker(); @@ -177377,7 +178303,7 @@ interface Symbol { return { typeParameters: result, affectedTextRange: selectionRange }; function visitor(node) { if (isTypeReferenceNode3(node)) { - if (isIdentifier25(node.typeName)) { + if (isIdentifier26(node.typeName)) { const typeName = node.typeName; const symbol2 = checker.resolveName( typeName.text, @@ -177409,7 +178335,7 @@ interface Symbol { return true; } } else if (isTypeQueryNode(node)) { - if (isIdentifier25(node.exprName)) { + if (isIdentifier26(node.exprName)) { const symbol2 = checker.resolveName( node.exprName.text, node.exprName, @@ -177433,7 +178359,7 @@ interface Symbol { /* SingleLine */ ); } - return forEachChild26(node, visitor); + return forEachChild27(node, visitor); } } function doTypeAliasChange(changes, file2, name, info) { @@ -177727,7 +178653,7 @@ interface Symbol { return !!symbol2 && movedSymbols.has(symbol2); }; deleteUnusedImports(sourceFile, importNode, changes, shouldMove); - const pathToTargetFileWithExtension = resolvePath2(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName); + const pathToTargetFileWithExtension = resolvePath3(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName); if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0) return; const newModuleSpecifier = ts_moduleSpecifiers_exports.getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host)); const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove); @@ -177745,7 +178671,7 @@ interface Symbol { case 272: return node.name; case 261: - return tryCast(node.name, isIdentifier25); + return tryCast(node.name, isIdentifier26); default: return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); } @@ -177759,7 +178685,7 @@ interface Symbol { let needUniqueName = false; const toChange = []; ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => { - if (!isPropertyAccessExpression15(ref.parent)) return; + if (!isPropertyAccessExpression16(ref.parent)) return; needUniqueName = needUniqueName || !!checker.resolveName( preferredNewNamespaceName, ref, @@ -177871,7 +178797,7 @@ interface Symbol { cb(importOrRequire); } else if (importOrRequire.name.kind === 207) { for (const element of importOrRequire.name.elements) { - if (isIdentifier25(element.name)) { + if (isIdentifier26(element.name)) { cb(element); } } @@ -177929,7 +178855,7 @@ interface Symbol { } } forEachAliasDeclarationInImportOrRequire(importDecl, (i) => { - if (i.name && isIdentifier25(i.name) && isUnused(i.name)) { + if (i.name && isIdentifier26(i.name) && isUnused(i.name)) { changes.delete(sourceFile, i); } }); @@ -177989,7 +178915,7 @@ interface Symbol { return [decl.name.text]; // TODO: GH#18217 case 244: - return mapDefined(decl.declarationList.declarations, (d) => isIdentifier25(d.name) ? d.name.text : void 0); + return mapDefined(decl.declarationList.declarations, (d) => isIdentifier26(d.name) ? d.name.text : void 0); case 268: case 267: case 266: @@ -178043,13 +178969,13 @@ interface Symbol { case 208: return name; case 207: { - const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier25(prop.name) || keep(prop.name)); + const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier26(prop.name) || keep(prop.name)); return newElements.length ? factory.createObjectBindingPattern(newElements) : void 0; } } } function nameOfTopLevelDeclaration(d) { - return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier25) : tryCast(d.name, isIdentifier25); + return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier26) : tryCast(d.name, isIdentifier26); } function getTopLevelDeclarationStatement(d) { switch (d.kind) { @@ -178057,7 +178983,7 @@ interface Symbol { return d.parent.parent; case 209: return getTopLevelDeclarationStatement( - cast(d.parent.parent, (p) => isVariableDeclaration6(p) || isBindingElement(p)) + cast(d.parent.parent, (p) => isVariableDeclaration7(p) || isBindingElement(p)) ); default: return d; @@ -178163,7 +179089,7 @@ interface Symbol { const targetFileImportsFromOldFile = /* @__PURE__ */ new Map(); const jsxNamespaceSymbol = getJsxNamespaceSymbol(containsJsx(toMove)); if (jsxNamespaceSymbol) { - oldImportsNeededByTargetFile.set(jsxNamespaceSymbol, [false, tryCast((_a3 = jsxNamespaceSymbol.declarations) == null ? void 0 : _a3[0], (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport5(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration6(d))]); + oldImportsNeededByTargetFile.set(jsxNamespaceSymbol, [false, tryCast((_a3 = jsxNamespaceSymbol.declarations) == null ? void 0 : _a3[0], (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport5(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration7(d))]); } for (const statement of toMove) { forEachTopLevelDeclaration(statement, (decl) => { @@ -178185,7 +179111,7 @@ interface Symbol { const prevIsTypeOnly = oldImportsNeededByTargetFile.get(symbol2); oldImportsNeededByTargetFile.set(symbol2, [ prevIsTypeOnly === void 0 ? isValidTypeOnlyUseSite : prevIsTypeOnly && isValidTypeOnlyUseSite, - tryCast(importedDeclaration, (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport5(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration6(d)) + tryCast(importedDeclaration, (d) => isImportSpecifier(d) || isImportClause(d) || isNamespaceImport5(d) || isImportEqualsDeclaration(d) || isBindingElement(d) || isVariableDeclaration7(d)) ]); } else if (!movedSymbols.has(symbol2) && every(symbol2.declarations, (decl) => isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile)) { targetFileImportsFromOldFile.set(symbol2, isValidTypeOnlyUseSite); @@ -178235,7 +179161,7 @@ interface Symbol { } function forEachReference(node, checker, enclosingRange, onReference) { node.forEachChild(function cb(node2) { - if (isIdentifier25(node2) && !isDeclarationName(node2)) { + if (isIdentifier26(node2) && !isDeclarationName(node2)) { if (enclosingRange && !rangeContainsRange(enclosingRange, node2)) { return; } @@ -178274,7 +179200,7 @@ interface Symbol { case 261: return isVariableDeclarationInImport(decl); case 209: - return isVariableDeclaration6(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); + return isVariableDeclaration7(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; } @@ -178287,15 +179213,15 @@ interface Symbol { ); } function isTopLevelDeclaration(node) { - return isNonVariableTopLevelDeclaration(node) && isSourceFile(node.parent) || isVariableDeclaration6(node) && isSourceFile(node.parent.parent.parent); + return isNonVariableTopLevelDeclaration(node) && isSourceFile(node.parent) || isVariableDeclaration7(node) && isSourceFile(node.parent.parent.parent); } function sourceFileOfTopLevelDeclaration(node) { - return isVariableDeclaration6(node) ? node.parent.parent.parent : node.parent; + return isVariableDeclaration7(node) ? node.parent.parent.parent : node.parent; } function forEachTopLevelDeclarationInBindingName(name, cb) { switch (name.kind) { case 80: - return cb(cast(name.parent, (x) => isVariableDeclaration6(x) || isBindingElement(x))); + return cb(cast(name.parent, (x) => isVariableDeclaration7(x) || isBindingElement(x))); case 208: case 207: return firstDefined(name.elements, (em) => isOmittedExpression(em) ? void 0 : forEachTopLevelDeclarationInBindingName(em.name, cb)); @@ -178428,7 +179354,7 @@ interface Symbol { return known.substr(0, requested.length) === requested; } function getIdentifierForNode(node, scope, checker, file2) { - return isPropertyAccessExpression15(node) && !isClassLike(scope) && !checker.resolveName( + return isPropertyAccessExpression16(node) && !isClassLike(scope) && !checker.resolveName( node.name.text, node, 111551, @@ -178507,8 +179433,8 @@ interface Symbol { const { references, declaration, replacement } = info; const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => { for (const node of references) { - const closestStringIdentifierParent = isStringLiteral15(replacement) && isIdentifier25(node) && walkUpParenthesizedExpressions(node.parent); - if (closestStringIdentifierParent && isTemplateSpan(closestStringIdentifierParent) && !isTaggedTemplateExpression4(closestStringIdentifierParent.parent.parent)) { + const closestStringIdentifierParent = isStringLiteral15(replacement) && isIdentifier26(node) && walkUpParenthesizedExpressions(node.parent); + if (closestStringIdentifierParent && isTemplateSpan(closestStringIdentifierParent) && !isTaggedTemplateExpression5(closestStringIdentifierParent.parent.parent)) { replaceTemplateStringVariableWithLiteral(tracker, file2, closestStringIdentifierParent, replacement); } else { tracker.replaceNode(file2, node, getReplacementExpression(node, replacement)); @@ -178524,10 +179450,10 @@ interface Symbol { const checker = program.getTypeChecker(); const token = getTouchingPropertyName(file2, startPosition); const parent2 = token.parent; - if (!isIdentifier25(token)) { + if (!isIdentifier26(token)) { return void 0; } - if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier25(parent2.name)) { + if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier26(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) }; } @@ -178550,7 +179476,7 @@ interface Symbol { return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) }; } const declaration = definition.declarations[0]; - if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier25(declaration.name)) { + if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier26(declaration.name)) { return void 0; } if (isDeclarationExported(declaration)) { @@ -178590,13 +179516,13 @@ interface Symbol { if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) { return factory.createParenthesizedExpression(replacement); } - if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression15(parent2))) { + if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression16(parent2))) { return factory.createParenthesizedExpression(replacement); } - if (isPropertyAccessExpression15(parent2) && (isNumericLiteral5(replacement) || isObjectLiteralExpression12(replacement))) { + if (isPropertyAccessExpression16(parent2) && (isNumericLiteral5(replacement) || isObjectLiteralExpression12(replacement))) { return factory.createParenthesizedExpression(replacement); } - if (isIdentifier25(reference) && isShorthandPropertyAssignment6(parent2)) { + if (isIdentifier26(reference) && isShorthandPropertyAssignment6(parent2)) { return factory.createPropertyAssignment(reference, replacement); } return replacement; @@ -178799,7 +179725,7 @@ interface Symbol { ); } function convertParameterToNamedTupleMember(p) { - Debug.assert(isIdentifier25(p.name)); + Debug.assert(isIdentifier26(p.name)); const result = setTextRange( factory.createNamedTupleMember( p.dotDotDotToken, @@ -178872,7 +179798,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 || !isIdentifier25(p.name)))) { + if (some(signatureDecls, (d) => !!d.typeParameters || some(d.parameters, (p) => !!p.modifiers || !isIdentifier26(p.name)))) { return; } const signatures = mapDefined(signatureDecls, (d) => checker.getSignatureFromDeclaration(d)); @@ -179049,7 +179975,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const possibleActions = []; const errors = []; if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) { - const error210 = selectedVariableDeclaration || isArrowFunction7(func) && isVariableDeclaration6(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); + const error210 = selectedVariableDeclaration || isArrowFunction7(func) && isVariableDeclaration7(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); if (error210) { errors.push({ ...toNamedFunctionAction, notApplicableReason: error210 }); } else { @@ -179110,7 +180036,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } if (!isClassLike(child) && !isFunctionDeclaration3(child) && !isFunctionExpression6(child)) { - forEachChild26(child, checkThis); + forEachChild27(child, checkThis); } }); return containsThis; @@ -179130,13 +180056,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } function isSingleVariableDeclaration(parent2) { - return isVariableDeclaration6(parent2) || isVariableDeclarationList(parent2) && parent2.declarations.length === 1; + return isVariableDeclaration7(parent2) || isVariableDeclarationList(parent2) && parent2.declarations.length === 1; } function tryGetFunctionFromVariableDeclaration(sourceFile, typeChecker, parent2) { if (!isSingleVariableDeclaration(parent2)) { return void 0; } - const variableDeclaration = isVariableDeclaration6(parent2) ? parent2 : first(parent2.declarations); + const variableDeclaration = isVariableDeclaration7(parent2) ? parent2 : first(parent2.declarations); const initializer3 = variableDeclaration.initializer; if (initializer3 && (isArrowFunction7(initializer3) || isFunctionExpression6(initializer3) && !isFunctionReferencedInFile(sourceFile, typeChecker, initializer3))) { return initializer3; @@ -179169,10 +180095,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getVariableInfo(func) { const variableDeclaration = func.parent; - if (!isVariableDeclaration6(variableDeclaration) || !isVariableDeclarationInVariableStatement(variableDeclaration)) return void 0; + if (!isVariableDeclaration7(variableDeclaration) || !isVariableDeclarationInVariableStatement(variableDeclaration)) return void 0; const variableDeclarationList = variableDeclaration.parent; const statement = variableDeclarationList.parent; - if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement10(statement) || !isIdentifier25(variableDeclaration.name)) return void 0; + if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement10(statement) || !isIdentifier26(variableDeclaration.name)) return void 0; return { variableDeclaration, variableDeclarationList, statement, name: variableDeclaration.name }; } function getEditInfoForConvertToAnonymousFunction(context, func) { @@ -179453,7 +180379,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; // x.foo(...) case 212: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression15); + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression16); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { const callOrNewExpression2 = tryCast(propertyAccessExpression.parent, isCallOrNewExpression); if (callOrNewExpression2 && callOrNewExpression2.expression === propertyAccessExpression) { @@ -179482,7 +180408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (parent2.kind) { // `C.foo` case 212: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression15); + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression16); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } @@ -179573,10 +180499,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 && isIdentifier25(parameterDeclaration.name); + return !parameterDeclaration.modifiers && isIdentifier26(parameterDeclaration.name); } function isValidVariableDeclaration(node) { - return isVariableDeclaration6(node) && isVarConst(node) && isIdentifier25(node.name) && !node.type; + return isVariableDeclaration7(node) && isVarConst(node) && isIdentifier26(node.name) && !node.type; } function hasThisParameter(parameters) { return parameters.length > 0 && isThis(parameters[0].name); @@ -179594,7 +180520,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return parameters; } function createPropertyOrShorthandAssignment(name, initializer3) { - if (isIdentifier25(initializer3) && getTextOfIdentifierOrLiteral(initializer3) === name) { + if (isIdentifier26(initializer3) && getTextOfIdentifierOrLiteral(initializer3) === name) { return factory.createShorthandPropertyAssignment(name); } return factory.createPropertyAssignment(name, initializer3); @@ -179872,7 +180798,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { nodes: [current2], operators: [], validOperators: true, hasString: isStringLiteral15(current2) || isNoSubstitutionTemplateLiteral5(current2) }; } const { nodes: nodes2, operators: operators2, hasString: leftHasString, validOperators: leftOperatorValid } = loop(current2.left); - if (!(leftHasString || isStringLiteral15(current2.right) || isTemplateExpression4(current2.right))) { + if (!(leftHasString || isStringLiteral15(current2.right) || isTemplateExpression5(current2.right))) { return { nodes: [current2], operators: [], hasString: false, validOperators: true }; } const currentOperatorValid = current2.operatorToken.kind === 40; @@ -179927,7 +180853,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} rawText += escapeRawStringForTemplate(getTextOfNode(node).slice(1, -1)); indexes.push(index); index++; - } else if (isTemplateExpression4(node)) { + } else if (isTemplateExpression5(node)) { text += node.head.text; rawText += getRawTextOfTemplate(node.head); break; @@ -179955,7 +180881,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const [newIndex, subsequentText, rawSubsequentText, stringIndexes] = concatConsecutiveString(i + 1, nodes); i = newIndex - 1; const isLast = i === nodes.length - 1; - if (isTemplateExpression4(currentNode)) { + if (isTemplateExpression5(currentNode)) { const spans = map2(currentNode.templateSpans, (span, index) => { copyExpressionComments(span); const isLastSpan = index === currentNode.templateSpans.length - 1; @@ -180068,7 +180994,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 ((isPropertyAccessExpression15(condition) || isIdentifier25(condition)) && getMatchingStart(condition, finalExpression.expression)) { + if ((isPropertyAccessExpression16(condition) || isIdentifier26(condition)) && getMatchingStart(condition, finalExpression.expression)) { return { finalExpression, occurrences: [condition], expression }; } else if (isBinaryExpression4(condition)) { const occurrences = getOccurrencesInExpression(finalExpression.expression, condition); @@ -180102,28 +181028,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return occurrences.length > 0 ? occurrences : void 0; } function getMatchingStart(chain, subchain) { - if (!isIdentifier25(subchain) && !isPropertyAccessExpression15(subchain) && !isElementAccessExpression8(subchain)) { + if (!isIdentifier26(subchain) && !isPropertyAccessExpression16(subchain) && !isElementAccessExpression8(subchain)) { return void 0; } return chainStartsWith(chain, subchain) ? subchain : void 0; } function chainStartsWith(chain, subchain) { - while (isCallExpression14(chain) || isPropertyAccessExpression15(chain) || isElementAccessExpression8(chain)) { + while (isCallExpression16(chain) || isPropertyAccessExpression16(chain) || isElementAccessExpression8(chain)) { if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) break; chain = chain.expression; } - while (isPropertyAccessExpression15(chain) && isPropertyAccessExpression15(subchain) || isElementAccessExpression8(chain) && isElementAccessExpression8(subchain)) { + while (isPropertyAccessExpression16(chain) && isPropertyAccessExpression16(subchain) || isElementAccessExpression8(chain) && isElementAccessExpression8(subchain)) { if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) return false; chain = chain.expression; subchain = subchain.expression; } - return isIdentifier25(chain) && isIdentifier25(subchain) && chain.getText() === subchain.getText(); + return isIdentifier26(chain) && isIdentifier26(subchain) && chain.getText() === subchain.getText(); } function getTextOfChainNode(node) { - if (isIdentifier25(node) || isStringOrNumericLiteralLike(node)) { + if (isIdentifier26(node) || isStringOrNumericLiteralLike(node)) { return node.getText(); } - if (isPropertyAccessExpression15(node)) { + if (isPropertyAccessExpression16(node)) { return getTextOfChainNode(node.name); } if (isElementAccessExpression8(node)) { @@ -180164,23 +181090,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} node = skipParentheses(node); if (isBinaryExpression4(node)) { return getFinalExpressionInChain(node.left); - } else if ((isPropertyAccessExpression15(node) || isElementAccessExpression8(node) || isCallExpression14(node)) && !isOptionalChain(node)) { + } else if ((isPropertyAccessExpression16(node) || isElementAccessExpression8(node) || isCallExpression16(node)) && !isOptionalChain2(node)) { return node; } return void 0; } function convertOccurrences(checker, toConvert, occurrences) { - if (isPropertyAccessExpression15(toConvert) || isElementAccessExpression8(toConvert) || isCallExpression14(toConvert)) { + if (isPropertyAccessExpression16(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(); if (isOccurrence) occurrences.pop(); - if (isCallExpression14(toConvert)) { + if (isCallExpression16(toConvert)) { return isOccurrence ? factory.createCallChain(chain, factory.createToken( 29 /* QuestionDotToken */ ), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments); - } else if (isPropertyAccessExpression15(toConvert)) { + } else if (isPropertyAccessExpression16(toConvert)) { return isOccurrence ? factory.createPropertyAccessChain(chain, factory.createToken( 29 /* QuestionDotToken */ @@ -180198,7 +181124,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 && (isPropertyAccessExpression15(convertedChain) || isElementAccessExpression8(convertedChain) || isCallExpression14(convertedChain))) { + if (convertedChain && (isPropertyAccessExpression16(convertedChain) || isElementAccessExpression8(convertedChain) || isCallExpression16(convertedChain))) { if (isBinaryExpression4(expression)) { changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); } else if (isConditionalExpression4(expression)) { @@ -180486,7 +181412,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (numInitializers === 1) { return lastInitializer; } - } else if (isVariableDeclaration6(node2)) { + } else if (isVariableDeclaration7(node2)) { if (node2.initializer) { return node2.initializer; } @@ -180494,7 +181420,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return node2; } function checkRootNode(node2) { - if (isIdentifier25(isExpressionStatement(node2) ? node2.expression : node2)) { + if (isIdentifier26(isExpressionStatement(node2) ? node2.expression : node2)) { return [createDiagnosticForNode(node2, Messages.cannotExtractIdentifier)]; } return void 0; @@ -180593,14 +181519,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } break; case 220: - forEachChild26(node2, function check2(n) { + forEachChild27(node2, function check2(n) { if (isThis(n)) { rangeFacts |= 8; thisNode = node2; } else if (isClassLike(n) || isFunctionLike(n) && !isArrowFunction7(n)) { return false; } else { - forEachChild26(n, check2); + forEachChild27(n, check2); } }); // falls through @@ -180654,7 +181580,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 257: { const label = node2.label; (seenLabels || (seenLabels = [])).push(label.escapedText); - forEachChild26(node2, visit); + forEachChild27(node2, visit); seenLabels.pop(); break; } @@ -180686,7 +181612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } break; default: - forEachChild26(node2, visit); + forEachChild27(node2, visit); break; } permittedJumps = savedPermittedJumps; @@ -181372,7 +182298,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { if (functionSignature && !!functionSignature.thisParameter) { const firstParameter = firstOrUndefined(parameters); - if (!firstParameter || isIdentifier25(firstParameter.name) && firstParameter.name.escapedText !== "this") { + if (!firstParameter || isIdentifier26(firstParameter.name) && firstParameter.name.escapedText !== "this") { const thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); parameters.splice( 0, @@ -181409,7 +182335,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getContainingVariableDeclarationIfInList(node, scope) { let prevNode; while (node !== void 0 && node !== scope) { - if (isVariableDeclaration6(node) && node.initializer === prevNode && isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) { + if (isVariableDeclaration7(node) && node.initializer === prevNode && isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) { return node; } prevNode = node; @@ -181661,7 +182587,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (visibleDeclarationsInExtractedRange.length) { const containingLexicalScopeOfExtraction = isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : getEnclosingBlockScopeContainer(scopes[0]); - forEachChild26(containingLexicalScopeOfExtraction, checkForUsedDeclarations); + forEachChild27(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } for (let i = 0; i < scopes.length; i++) { const scopeUsages = usagesPerScope[i]; @@ -181735,16 +182661,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 2 /* Write */ ); - } else if (isPropertyAccessExpression15(node) || isElementAccessExpression8(node)) { - forEachChild26(node, collectUsages); - } else if (isIdentifier25(node)) { + } else if (isPropertyAccessExpression16(node) || isElementAccessExpression8(node)) { + forEachChild27(node, collectUsages); + } else if (isIdentifier26(node)) { if (!node.parent) { return; } if (isQualifiedName2(node.parent) && node !== node.parent.left) { return; } - if (isPropertyAccessExpression15(node.parent) && node !== node.parent.expression) { + if (isPropertyAccessExpression16(node.parent) && node !== node.parent.expression) { return; } recordUsage( @@ -181754,7 +182680,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} isPartOfTypeNode(node) ); } else { - forEachChild26(node, collectUsages); + forEachChild27(node, collectUsages); } } function recordUsage(n, usage, isTypeNode2) { @@ -181838,11 +182764,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.includes(node)) { return; } - const sym = isIdentifier25(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); + const sym = isIdentifier26(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); if (sym) { const decl = find(visibleDeclarationsInExtractedRange, (d) => d.symbol === sym); if (decl) { - if (isVariableDeclaration6(decl)) { + if (isVariableDeclaration7(decl)) { const idString = decl.symbol.id.toString(); if (!exposedVariableSymbolSet.has(idString)) { exposedVariableDeclarations.push(decl); @@ -181853,7 +182779,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - forEachChild26(node, checkForUsedDeclarations); + forEachChild27(node, checkForUsedDeclarations); } function getSymbolReferencedByIdentifier(identifier) { return identifier.parent && isShorthandPropertyAssignment6(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); @@ -181918,7 +182844,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!edits) return void 0; const renameFilename = context.file.fileName; const nameNeedRename = info.renameAccessor ? info.accessorName : info.fieldName; - const renameLocationOffset = isIdentifier25(nameNeedRename) ? 0 : -1; + const renameLocationOffset = isIdentifier26(nameNeedRename) ? 0 : -1; const renameLocation = renameLocationOffset + getRenameLocation( edits, renameFilename, @@ -182150,7 +183076,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isJsxExpression(node)) { inJSXElement = false; } - if (isIdentifier25(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { + if (isIdentifier26(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { let symbol2 = typeChecker.getSymbolAtLocation(node); if (symbol2) { if (symbol2.flags & 2097152) { @@ -182197,7 +183123,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - forEachChild26(node, visit); + forEachChild27(node, visit); inJSXElement = prevInJSXElement; } visit(sourceFile); @@ -182244,7 +183170,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isBindingElement(decl)) { decl = getDeclarationForBindingElement(decl); } - if (isVariableDeclaration6(decl)) { + if (isVariableDeclaration7(decl)) { return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile; } else if (isFunctionDeclaration3(decl)) { return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile; @@ -182268,10 +183194,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) { node = node.parent; } - return isCallExpression14(node.parent) && node.parent.expression === node; + return isCallExpression16(node.parent) && node.parent.expression === node; } function isRightSideOfQualifiedNameOrPropertyAccess2(node) { - return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression15(node.parent) && node.parent.name === node; + return isQualifiedName2(node.parent) && node.parent.right === node || isPropertyAccessExpression16(node.parent) && node.parent.name === node; } var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([ [ @@ -182464,7 +183390,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return child.kind < 167 ? child : child.getLastToken(sourceFile); } forEachChild(cbNode, cbNodeArray) { - return forEachChild26(this, cbNode, cbNodeArray); + return forEachChild27(this, cbNode, cbNodeArray); } }; function createChildren(node, sourceFile) { @@ -182959,7 +183885,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getDeclarationName(declaration) { const name = getNonAssignedNameOfDeclaration(declaration); - return name && (isComputedPropertyName(name) && isPropertyAccessExpression15(name.expression) ? name.expression.name.text : isPropertyName(name) ? getNameFromPropertyName(name) : void 0); + return name && (isComputedPropertyName(name) && isPropertyAccessExpression16(name.expression) ? name.expression.name.text : isPropertyName(name) ? getNameFromPropertyName(name) : void 0); } function visit(node) { switch (node.kind) { @@ -182980,7 +183906,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} declarations.push(functionDeclaration); } } - forEachChild26(node, visit); + forEachChild27(node, visit); break; case 264: case 232: @@ -182997,7 +183923,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 179: case 188: addDeclaration(node); - forEachChild26(node, visit); + forEachChild27(node, visit); break; case 170: if (!hasSyntacticModifier( @@ -183012,7 +183938,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 209: { const decl = node; if (isBindingPattern(decl.name)) { - forEachChild26(decl.name, visit); + forEachChild27(decl.name, visit); break; } if (decl.initializer) { @@ -183056,7 +183982,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } // falls through default: - forEachChild26(node, visit); + forEachChild27(node, visit); } } } @@ -183847,7 +184773,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } function getNodeForQuickInfo(node) { - if (isNewExpression17(node.parent) && node.pos === node.parent.pos) { + if (isNewExpression19(node.parent) && node.pos === node.parent.pos) { return node.parent.expression; } if (isNamedTupleMember(node.parent) && node.pos === node.parent.pos) { @@ -183915,7 +184841,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 (isIdentifier25(node) && (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) && isIntrinsicJsxName(node.escapedText)) { + if (isIdentifier26(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); @@ -184232,14 +185158,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function toggleLineComment(fileName, textRange, insertComment) { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); const textChanges2 = []; - const { lineStarts, firstLine, lastLine } = getLinesForRange(sourceFile, textRange); + const { lineStarts, firstLine: firstLine3, lastLine } = getLinesForRange(sourceFile, textRange); let isCommenting = insertComment || false; let leftMostPosition = Number.MAX_VALUE; const lineTextStarts = /* @__PURE__ */ new Map(); const firstNonWhitespaceCharacterRegex = new RegExp(/\S/); - const isJsx = isInsideJsxElement(sourceFile, lineStarts[firstLine]); + const isJsx = isInsideJsxElement(sourceFile, lineStarts[firstLine3]); const openComment = isJsx ? "{/*" : "//"; - for (let i = firstLine; i <= lastLine; i++) { + for (let i = firstLine3; i <= lastLine; i++) { const lineText = sourceFile.text.substring(lineStarts[i], sourceFile.getLineEndOfPosition(lineStarts[i])); const regExec = firstNonWhitespaceCharacterRegex.exec(lineText); if (regExec) { @@ -184250,8 +185176,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - for (let i = firstLine; i <= lastLine; i++) { - if (firstLine !== lastLine && lineStarts[i] === textRange.end) { + for (let i = firstLine3; i <= lastLine; i++) { + if (firstLine3 !== lastLine && lineStarts[i] === textRange.end) { continue; } const lineTextStart = lineTextStarts.get(i.toString()); @@ -184374,8 +185300,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function commentSelection(fileName, textRange) { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - const { firstLine, lastLine } = getLinesForRange(sourceFile, textRange); - return firstLine === lastLine && textRange.pos !== textRange.end ? toggleMultilineComment( + const { firstLine: firstLine3, lastLine } = getLinesForRange(sourceFile, textRange); + return firstLine3 === lastLine && textRange.pos !== textRange.end ? toggleMultilineComment( fileName, textRange, /*insertComment*/ @@ -184464,7 +185390,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } return result; - function escapeRegExp(str) { + function escapeRegExp2(str) { return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); } function getTodoCommentsRegExp() { @@ -184472,7 +185398,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const multiLineCommentStart = /(?:\/\*+\s*)/.source; const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - const literals = "(?:" + map2(descriptors, (d) => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; + const literals = "(?:" + map2(descriptors, (d) => "(" + escapeRegExp2(d.text) + ")").join("|") + ")"; const endOfLineOrEndOfComment = /(?:$|\*\/)/.source; const messageRemainder = /(?:.*?)/.source; const messagePortion = "(" + literals + messageRemainder + ")"; @@ -184687,17 +185613,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function initializeNameTable(sourceFile) { const nameTable = sourceFile.nameTable = /* @__PURE__ */ new Map(); sourceFile.forEachChild(function walk(node) { - if (isIdentifier25(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) { + if (isIdentifier26(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)) { const text = node.escapedText; nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1); } - forEachChild26(node, walk); + forEachChild27(node, walk); if (hasJSDocNodes(node)) { for (const jsDoc of node.jsDoc) { - forEachChild26(jsDoc, walk); + forEachChild27(jsDoc, walk); } } }); @@ -185104,17 +186030,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return spanInNode(functionDeclaration.body); } - function spanInFunctionBlock(block) { - const nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); - if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { - return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + function spanInFunctionBlock(block2) { + const nodeForSpanInBlock = block2.statements.length ? block2.statements[0] : block2.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block2.parent)) { + return spanInNodeIfStartsOnSameLine(block2.parent, nodeForSpanInBlock); } return spanInNode(nodeForSpanInBlock); } - function spanInBlock(block) { - switch (block.parent.kind) { + function spanInBlock(block2) { + switch (block2.parent.kind) { case 268: - if (getModuleInstanceState(block.parent) !== 1) { + if (getModuleInstanceState(block2.parent) !== 1) { return void 0; } // Set on parent if on same line otherwise on first statement @@ -185122,13 +186048,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 248: case 246: case 250: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + return spanInNodeIfStartsOnSameLine(block2.parent, block2.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block case 249: case 251: - return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + return spanInNodeIfStartsOnSameLine(findPrecedingToken(block2.pos, sourceFile, block2.parent), block2.statements[0]); } - return spanInNode(block.statements[0]); + return spanInNode(block2.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { if (forLikeStatement.initializer.kind === 262) { @@ -185305,16 +186231,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return (isFunctionExpression6(node) || isClassExpression(node)) && isNamedDeclaration(node); } function isVariableLike2(node) { - return isPropertyDeclaration(node) || isVariableDeclaration6(node); + return isPropertyDeclaration(node) || isVariableDeclaration7(node); } function isAssignedExpression(node) { - return (isFunctionExpression6(node) || isArrowFunction7(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier25(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2) || isPropertyDeclaration(node.parent)); + return (isFunctionExpression6(node) || isArrowFunction7(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier26(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2) || isPropertyDeclaration(node.parent)); } function isPossibleCallHierarchyDeclaration(node) { return isSourceFile(node) || isModuleDeclaration(node) || isFunctionDeclaration3(node) || isFunctionExpression6(node) || isClassDeclaration5(node) || isClassExpression(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node); } function isValidCallHierarchyDeclaration(node) { - return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier25(node.name) || isFunctionDeclaration3(node) || isClassDeclaration5(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isAssignedExpression(node); + return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier26(node.name) || isFunctionDeclaration3(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; @@ -185349,7 +186275,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 = isIdentifier25(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0; + let text = isIdentifier26(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); @@ -185369,7 +186295,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) && isIdentifier25(node.parent.parent.parent.parent.parent.name)) { + if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier26(node.parent.parent.parent.parent.parent.name)) { return node.parent.parent.parent.parent.parent.name.getText(); } return; @@ -185385,7 +186311,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 263: case 264: case 268: - if (isModuleBlock(node.parent) && isIdentifier25(node.parent.parent.name)) { + if (isModuleBlock(node.parent) && isIdentifier26(node.parent.parent.name)) { return node.parent.parent.name.getText(); } } @@ -185469,7 +186395,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} location = location.parent; continue; } - if (isVariableDeclaration6(location) && location.initializer && isAssignedExpression(location.initializer)) { + if (isVariableDeclaration7(location) && location.initializer && isAssignedExpression(location.initializer)) { return location.initializer; } if (!followingSymbol) { @@ -185570,7 +186496,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function createCallSiteCollector(program, callSites) { function recordCallSite(node) { - const target = isTaggedTemplateExpression4(node) ? node.tag : isJsxOpeningLikeElement(node) ? node.tagName : isAccessExpression(node) ? node : isClassStaticBlockDeclaration(node) ? node : node.expression; + const target = isTaggedTemplateExpression5(node) ? node.tag : isJsxOpeningLikeElement(node) ? node.tagName : isAccessExpression(node) ? node : isClassStaticBlockDeclaration(node) ? node : node.expression; const declaration = resolveCallHierarchyDeclaration(program, target); if (declaration) { const range = createTextRangeFromNode(target, node.getSourceFile()); @@ -185646,7 +186572,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 212: case 213: recordCallSite(node); - forEachChild26(node, collect); + forEachChild27(node, collect); break; case 239: collect(node.expression); @@ -185655,7 +186581,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isPartOfTypeNode(node)) { return; } - forEachChild26(node, collect); + forEachChild27(node, collect); } return collect; } @@ -186112,8 +187038,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!symbol2) { continue; } - const declaration = tryCast(symbol2.valueDeclaration, isVariableDeclaration6); - const variableName = declaration && tryCast(declaration.name, isIdentifier25); + const declaration = tryCast(symbol2.valueDeclaration, isVariableDeclaration7); + const variableName = declaration && tryCast(declaration.name, isIdentifier26); const variableStatement = getAncestor( declaration, 244 @@ -186146,10 +187072,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; } function getIdentifiersFromErrorSpanExpression(expression, checker) { - if (isPropertyAccessExpression15(expression.parent) && isIdentifier25(expression.parent.expression)) { + if (isPropertyAccessExpression16(expression.parent) && isIdentifier26(expression.parent.expression)) { return { identifiers: [expression.parent.expression], isCompleteFix: true }; } - if (isIdentifier25(expression)) { + if (isIdentifier26(expression)) { return { identifiers: [expression], isCompleteFix: true }; } if (isBinaryExpression4(expression)) { @@ -186158,7 +187084,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 (!isIdentifier25(side)) { + if (!isIdentifier26(side)) { isCompleteFix = false; continue; } @@ -186169,7 +187095,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker) { - const errorNode = isPropertyAccessExpression15(reference.parent) ? reference.parent.name : isBinaryExpression4(reference.parent) ? reference.parent : reference; + const errorNode = isPropertyAccessExpression16(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), @@ -186198,7 +187124,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isBinaryExpression4(insertionSite)) { for (const side of [insertionSite.left, insertionSite.right]) { - if (fixedDeclarations && isIdentifier25(side)) { + if (fixedDeclarations && isIdentifier26(side)) { const symbol2 = checker.getSymbolAtLocation(side); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { continue; @@ -186208,8 +187134,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 && isPropertyAccessExpression15(insertionSite.parent)) { - if (fixedDeclarations && isIdentifier25(insertionSite.parent.expression)) { + } else if (errorCode === propertyAccessCode && isPropertyAccessExpression16(insertionSite.parent)) { + if (fixedDeclarations && isIdentifier26(insertionSite.parent.expression)) { const symbol2 = checker.getSymbolAtLocation(insertionSite.parent.expression); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { return; @@ -186222,7 +187148,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 && isIdentifier25(insertionSite)) { + if (fixedDeclarations && isIdentifier26(insertionSite)) { const symbol2 = checker.getSymbolAtLocation(insertionSite); if (symbol2 && fixedDeclarations.has(getSymbolId(symbol2))) { return; @@ -186231,7 +187157,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 && isVariableDeclaration6(insertionSite.parent) && isIdentifier25(insertionSite.parent.name)) { + if (fixedDeclarations && isVariableDeclaration7(insertionSite.parent) && isIdentifier26(insertionSite.parent.name)) { const symbol2 = checker.getSymbolAtLocation(insertionSite.parent.name); if (symbol2 && !tryAddToSet(fixedDeclarations, getSymbolId(symbol2))) { return; @@ -186307,11 +187233,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function arrayElementCouldBeVariableDeclaration(expression, checker) { - const identifier = isIdentifier25(expression) ? expression : isAssignmentExpression( + const identifier = isIdentifier26(expression) ? expression : isAssignmentExpression( expression, /*excludeCompoundAssignment*/ true - ) && isIdentifier25(expression.left) ? expression.left : void 0; + ) && isIdentifier26(expression.left) ? expression.left : void 0; return !!identifier && !checker.getSymbolAtLocation(identifier); } function isPossiblyPartOfCommaSeperatedInitializer(node) { @@ -186331,7 +187257,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 && isIdentifier25(expression.left) && !checker.getSymbolAtLocation(expression.left); + return expression.operatorToken.kind === 64 && isIdentifier26(expression.left) && !checker.getSymbolAtLocation(expression.left); } var fixId5 = "addMissingDeclareProperty"; var errorCodes5 = [ @@ -186353,7 +187279,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function makeChange5(changeTracker, sourceFile, pos, fixedNodes) { const token = getTokenAtPosition(sourceFile, pos); - if (!isIdentifier25(token)) { + if (!isIdentifier26(token)) { return; } const declaration = token.parent; @@ -186546,7 +187472,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return checker.getExactOptionalProperties(target); } function shouldUseParentTypeOfProperty(sourceNode, targetNode, checker) { - return isPropertyAccessExpression15(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); + return isPropertyAccessExpression16(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); } function getSourceTarget(errorNode, checker) { var _a3; @@ -186554,17 +187480,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } else if (isBinaryExpression4(errorNode.parent) && errorNode.parent.operatorToken.kind === 64) { return { source: errorNode.parent.right, target: errorNode.parent.left }; - } else if (isVariableDeclaration6(errorNode.parent) && errorNode.parent.initializer) { + } else if (isVariableDeclaration7(errorNode.parent) && errorNode.parent.initializer) { return { source: errorNode.parent.initializer, target: errorNode.parent.name }; - } else if (isCallExpression14(errorNode.parent)) { + } else if (isCallExpression16(errorNode.parent)) { const n = checker.getSymbolAtLocation(errorNode.parent.expression); if (!(n == null ? void 0 : n.valueDeclaration) || !isFunctionLikeKind(n.valueDeclaration.kind)) return void 0; if (!isExpression(errorNode)) return void 0; const i = errorNode.parent.arguments.indexOf(errorNode); if (i === -1) return void 0; const name = n.valueDeclaration.parameters[i].name; - if (isIdentifier25(name)) return { source: errorNode, target: name }; - } else if (isPropertyAssignment11(errorNode.parent) && isIdentifier25(errorNode.parent.name) || isShorthandPropertyAssignment6(errorNode.parent)) { + if (isIdentifier26(name)) return { source: errorNode, target: name }; + } else if (isPropertyAssignment11(errorNode.parent) && isIdentifier26(errorNode.parent.name) || isShorthandPropertyAssignment6(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); @@ -186687,7 +187613,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeNode = factory.createTypeLiteralNode(map2(node.jsDocPropertyTags, (tag) => factory.createPropertySignature( /*modifiers*/ void 0, - isIdentifier25(tag.name) ? tag.name : tag.name.right, + isIdentifier26(tag.name) ? tag.name : tag.name.right, isOptionalJSDocPropertyLikeTag(tag) ? factory.createToken( 58 /* QuestionToken */ @@ -186732,7 +187658,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function transformJSDocTypeReference(node) { let name = node.typeName; let args = node.typeArguments; - if (isIdentifier25(node.typeName)) { + if (isIdentifier26(node.typeName)) { if (isJSDocIndexSignature(node)) { return transformJSDocIndexSignature(node); } @@ -186804,7 +187730,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const ctorDeclaration = ctorSymbol.valueDeclaration; if (isFunctionDeclaration3(ctorDeclaration) || isFunctionExpression6(ctorDeclaration)) { changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); - } else if (isVariableDeclaration6(ctorDeclaration)) { + } else if (isVariableDeclaration7(ctorDeclaration)) { const classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); if (!classDeclaration) { return void 0; @@ -186823,7 +187749,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 && isPropertyAccessExpression15(firstDeclaration) && isBinaryExpression4(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 64 && isObjectLiteralExpression12(firstDeclaration.parent.right)) { + if (member.declarations.length === 1 && isPropertyAccessExpression16(firstDeclaration) && isBinaryExpression4(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 64 && isObjectLiteralExpression12(firstDeclaration.parent.right)) { const prototypes = firstDeclaration.parent.right; createClassElement( prototypes.symbol, @@ -186862,7 +187788,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return memberElements; function shouldConvertDeclaration(_target, source) { if (isAccessExpression(_target)) { - if (isPropertyAccessExpression15(_target) && isConstructorAssignment(_target)) return true; + if (isPropertyAccessExpression16(_target) && isConstructorAssignment(_target)) return true; return isFunctionLike(source); } else { return every(_target.properties, (property) => { @@ -186885,7 +187811,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (some(members, (m) => { const name = getNameOfDeclaration(m); - if (name && isIdentifier25(name) && idText(name) === symbolName(symbol22)) { + if (name && isIdentifier26(name) && idText(name) === symbolName(symbol22)) { return true; } return false; @@ -186931,7 +187857,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } else { if (isSourceFileJS(sourceFile)) return; - if (!isPropertyAccessExpression15(memberDeclaration)) return; + if (!isPropertyAccessExpression16(memberDeclaration)) return; const prop = factory.createPropertyDeclaration( modifiers, memberDeclaration.name, @@ -187007,7 +187933,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function createClassFromVariableDeclaration(node) { const initializer3 = node.initializer; - if (!initializer3 || !isFunctionExpression6(initializer3) || !isIdentifier25(node.name)) { + if (!initializer3 || !isFunctionExpression6(initializer3) || !isIdentifier26(node.name)) { return void 0; } const memberElements = createClassElementsFromSymbol(node.symbol); @@ -187067,11 +187993,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isConstructorAssignment(x) { if (!x.name) return false; - if (isIdentifier25(x.name) && x.name.text === "constructor") return true; + if (isIdentifier26(x.name) && x.name.text === "constructor") return true; return false; } function tryGetPropertyName(node, compilerOptions, quotePreference) { - if (isPropertyAccessExpression15(node)) { + if (isPropertyAccessExpression16(node)) { return node.name; } const propName2 = node.argumentExpression; @@ -187103,7 +188029,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function convertToAsyncFunction(changes, sourceFile, position, checker) { const tokenAtPosition = getTokenAtPosition(sourceFile, position); let functionToConvert; - if (isIdentifier25(tokenAtPosition) && isVariableDeclaration6(tokenAtPosition.parent) && tokenAtPosition.parent.initializer && isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) { + if (isIdentifier26(tokenAtPosition) && isVariableDeclaration7(tokenAtPosition.parent) && tokenAtPosition.parent.initializer && isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) { functionToConvert = tokenAtPosition.parent.initializer; } else { functionToConvert = tryCast(getContainingFunction(getTokenAtPosition(sourceFile, position)), canBeConvertedToAsync); @@ -187126,8 +188052,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const pos = skipTrivia(sourceFile.text, moveRangePastModifiers(functionToConvert).pos); changes.insertModifierAt(sourceFile, pos, 134, { suffix: " " }); for (const returnStatement of returnStatements) { - forEachChild26(returnStatement, function visit(node) { - if (isCallExpression14(node)) { + forEachChild27(returnStatement, function visit(node) { + if (isCallExpression16(node)) { const newNodes = transformExpression( node, node, @@ -187140,7 +188066,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } changes.replaceNodeWithNodes(sourceFile, returnStatement, newNodes); } else if (!isFunctionLike(node)) { - forEachChild26(node, visit); + forEachChild27(node, visit); if (hasFailed()) { return true; } @@ -187163,23 +188089,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return /* @__PURE__ */ new Set(); } const setOfExpressionsToReturn = /* @__PURE__ */ new Set(); - forEachChild26(func.body, function visit(node) { + forEachChild27(func.body, function visit(node) { if (isPromiseReturningCallExpression(node, checker, "then")) { setOfExpressionsToReturn.add(getNodeId(node)); forEach(node.arguments, visit); } else if (isPromiseReturningCallExpression(node, checker, "catch") || isPromiseReturningCallExpression(node, checker, "finally")) { setOfExpressionsToReturn.add(getNodeId(node)); - forEachChild26(node, visit); + forEachChild27(node, visit); } else if (isPromiseTypedExpression(node, checker)) { setOfExpressionsToReturn.add(getNodeId(node)); } else { - forEachChild26(node, visit); + forEachChild27(node, visit); } }); return setOfExpressionsToReturn; } function isPromiseReturningCallExpression(node, checker, name) { - if (!isCallExpression14(node)) return false; + if (!isCallExpression16(node)) return false; const isExpressionOfName = hasPropertyAccessExpressionWithName(node, name); const nodeType = isExpressionOfName && checker.getTypeAtLocation(node); return !!(nodeType && checker.getPromisedTypeOfPromise(nodeType)); @@ -187211,9 +188137,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function renameCollidingVarNames(nodeToRename, checker, synthNamesMap) { const identsToRenameMap = /* @__PURE__ */ new Map(); const collidingSymbolMap = createMultiMap(); - forEachChild26(nodeToRename, function visit(node) { - if (!isIdentifier25(node)) { - forEachChild26(node, visit); + forEachChild27(nodeToRename, function visit(node) { + if (!isIdentifier26(node)) { + forEachChild27(node, visit); return; } const symbol2 = checker.getSymbolAtLocation(node); @@ -187223,7 +188149,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, isIdentifier25) || factory.createUniqueName( + const ident = (firstParameter == null ? void 0 : firstParameter.valueDeclaration) && isParameter(firstParameter.valueDeclaration) && tryCast(firstParameter.valueDeclaration.name, isIdentifier26) || factory.createUniqueName( "result", 16 /* Optimistic */ @@ -187231,7 +188157,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const synthName = getNewNameIfConflict(ident, collidingSymbolMap); synthNamesMap.set(symbolIdString, synthName); collidingSymbolMap.add(ident.text, symbol2); - } else if (node.parent && (isParameter(node.parent) || isVariableDeclaration6(node.parent) || isBindingElement(node.parent))) { + } else if (node.parent && (isParameter(node.parent) || isVariableDeclaration7(node.parent) || isBindingElement(node.parent))) { const originalName = node.text; const collidingSymbols = collidingSymbolMap.get(originalName); if (collidingSymbols && collidingSymbols.some((prevSymbol) => prevSymbol !== symbol2)) { @@ -187252,7 +188178,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*includeTrivia*/ true, (original) => { - if (isBindingElement(original) && isIdentifier25(original.name) && isObjectBindingPattern3(original.parent)) { + if (isBindingElement(original) && isIdentifier26(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()) { @@ -187263,7 +188189,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} original.initializer ); } - } else if (isIdentifier25(original)) { + } else if (isIdentifier26(original)) { const symbol2 = checker.getSymbolAtLocation(original); const renameInfo = symbol2 && identsToRenameMap.get(String(getSymbolId(symbol2))); if (renameInfo) { @@ -187295,19 +188221,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 (isPropertyAccessExpression15(node)) { + if (isPropertyAccessExpression16(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, isPropertyAccessExpression15); + Debug.assertNode(getOriginalNode(node).parent, isPropertyAccessExpression16); return transformPromiseExpressionOfPropertyAccess(returnContextNode, node, transformer, hasContinuation, continuationArgName); } return silentFail(); } function isNullOrUndefined2({ checker }, node) { if (node.kind === 106) return true; - if (isIdentifier25(node) && !isGeneratedIdentifier(node) && idText(node) === "undefined") { + if (isIdentifier26(node) && !isGeneratedIdentifier(node) && idText(node) === "undefined") { const symbol2 = checker.getSymbolAtLocation(node); return !symbol2 || checker.isUndefinedSymbol(symbol2); } @@ -187716,15 +188642,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function transformReturnStatementWithFixablePromiseHandler(transformer, innerRetStmt, hasContinuation, continuationArgName) { let innerCbBody = []; - forEachChild26(innerRetStmt, function visit(node) { - if (isCallExpression14(node)) { + forEachChild27(innerRetStmt, function visit(node) { + if (isCallExpression16(node)) { const temp = transformExpression(node, node, transformer, hasContinuation, continuationArgName); innerCbBody = innerCbBody.concat(temp); if (innerCbBody.length > 0) { return; } } else if (!isFunctionLike(node)) { - forEachChild26(node, visit); + forEachChild27(node, visit); } }); return innerCbBody; @@ -187737,9 +188663,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const param = funcNode.parameters[0].name; name = getMappedBindingNameOrDefault(param); } - } else if (isIdentifier25(funcNode)) { + } else if (isIdentifier26(funcNode)) { name = getMapEntryOrDefault(funcNode); - } else if (isPropertyAccessExpression15(funcNode) && isIdentifier25(funcNode.name)) { + } else if (isPropertyAccessExpression16(funcNode) && isIdentifier26(funcNode.name)) { name = getMapEntryOrDefault(funcNode.name); } if (!name || "identifier" in name && name.identifier.text === "undefined") { @@ -187747,7 +188673,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return name; function getMappedBindingNameOrDefault(bindingName) { - if (isIdentifier25(bindingName)) return getMapEntryOrDefault(bindingName); + if (isIdentifier26(bindingName)) return getMapEntryOrDefault(bindingName); const elements = flatMap(bindingName.elements, (element) => { if (isOmittedExpression(element)) return []; return [getMappedBindingNameOrDefault(element.name)]; @@ -187905,7 +188831,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function forEachExportReference(sourceFile, cb) { sourceFile.forEachChild(function recur(node) { - if (isPropertyAccessExpression15(node) && isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && isIdentifier25(node.name)) { + if (isPropertyAccessExpression16(node) && isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && isIdentifier26(node.name)) { const { parent: parent2 } = node; cb( node, @@ -187968,7 +188894,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )) { foundImport = true; return convertSingleImport(name, initializer3.arguments[0], checker, identifiers, target, quotePreference); - } else if (isPropertyAccessExpression15(initializer3) && isRequireCall( + } else if (isPropertyAccessExpression16(initializer3) && isRequireCall( initializer3.expression, /*requireStringLiteralLikeArgument*/ true @@ -188017,7 +188943,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function convertAssignment(sourceFile, checker, assignment, changes, exports2, useSitesToUnqualify) { const { left, right } = assignment; - if (!isPropertyAccessExpression15(left)) { + if (!isPropertyAccessExpression16(left)) { return false; } if (isExportsOrModuleExportsOrAlias(sourceFile, left)) { @@ -188053,9 +188979,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 306: return void 0; case 304: - return !isIdentifier25(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); + return !isIdentifier26(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); case 175: - return !isIdentifier25(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken( + return !isIdentifier26(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken( 95 /* ExportKeyword */ )], prop, useSitesToUnqualify); @@ -188189,7 +189115,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 && !isIdentifier25(e.propertyName) || !isIdentifier25(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 && !isIdentifier26(e.propertyName) || !isIdentifier26(e.name) ? void 0 : makeImportSpecifier2(e.propertyName && e.propertyName.text, e.name.text)); if (importSpecifiers) { return convertedImports([makeImport( /*defaultImport*/ @@ -188235,7 +189161,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} continue; } const { parent: parent2 } = use; - if (isPropertyAccessExpression15(parent2)) { + if (isPropertyAccessExpression16(parent2)) { const { name: { text: propertyName } } = parent2; if (propertyName === "default") { needDefaultImport = true; @@ -188281,7 +189207,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return map22; } function forEachFreeIdentifier(node, cb) { - if (isIdentifier25(node) && isFreeIdentifier(node)) cb(node); + if (isIdentifier26(node) && isFreeIdentifier(node)) cb(node); node.forEachChild((child) => forEachFreeIdentifier(child, cb)); } function isFreeIdentifier(node) { @@ -188395,7 +189321,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 isIdentifier25(qualifiedName.left) ? qualifiedName : void 0; + return isIdentifier26(qualifiedName.left) ? qualifiedName : void 0; } function doChange10(changeTracker, sourceFile, qualifiedName) { const rightText = qualifiedName.right.text; @@ -188835,7 +189761,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo5(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier25(token)) { + if (isIdentifier26(token)) { const propertySignature = cast(token.parent.parent, isPropertySignature3); const propertyName = token.getText(sourceFile); return { @@ -189092,7 +190018,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} preferences ); if (fix) { - const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier25)) == null ? void 0 : _b.text) ?? symbolName2; + const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier26)) == null ? void 0 : _b.text) ?? symbolName2; let addAsTypeOnly; let propertyName; if (referenceImport && isTypeOnlyImportDeclaration(referenceImport) && (fix.kind === 3 || fix.kind === 2) && fix.addAsTypeOnly === 1) { @@ -189706,7 +190632,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var _a3, _b, _c; switch (declaration.kind) { case 261: - return (_a3 = tryCast(declaration.name, isIdentifier25)) == null ? void 0 : _a3.text; + return (_a3 = tryCast(declaration.name, isIdentifier26)) == null ? void 0 : _a3.text; case 272: return declaration.name.text; case 352: @@ -189932,7 +190858,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 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 (!isIdentifier25(symbolToken)) { + } else if (!isIdentifier26(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())); @@ -190034,11 +190960,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ).fixes; return fixes.map((fix) => { var _a3; - return { fix, symbolName: symbolName2, errorIdentifierText: (_a3 = tryCast(token, isIdentifier25)) == null ? void 0 : _a3.text }; + return { fix, symbolName: symbolName2, errorIdentifierText: (_a3 = tryCast(token, isIdentifier26)) == null ? void 0 : _a3.text }; }); } function getUmdSymbol(token, checker) { - const umdSymbol = isIdentifier25(token) ? checker.getSymbolAtLocation(token) : void 0; + const umdSymbol = isIdentifier26(token) ? checker.getSymbolAtLocation(token) : void 0; if (isUMDExportSymbol(umdSymbol)) return umdSymbol; const { parent: parent2 } = token; if (isJsxOpeningLikeElement(parent2) && parent2.tagName === token || isJsxOpeningFragment(parent2)) { @@ -190638,7 +191564,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 (isIdentifier25(declaration) && isTypeParameterDeclaration(declaration.parent)) { + if (isIdentifier26(declaration) && isTypeParameterDeclaration(declaration.parent)) { declaration = declaration.parent; } if (isTypeParameterDeclaration(declaration)) { @@ -190878,7 +191804,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } function getPropertyAccessExpression(sourceFile, pos) { - return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression15); + return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression16); } var fixId20 = "fixImplicitThis"; var errorCodes23 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; @@ -190996,7 +191922,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getInfo7(sourceFile, pos, program) { var _a3, _b; const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier25(token)) { + if (isIdentifier26(token)) { const importDeclaration = findAncestor(token, isImportDeclaration6); if (importDeclaration === void 0) return void 0; const moduleSpecifier = isStringLiteral15(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : void 0; @@ -191092,7 +192018,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return firstOrUndefined(symbol2.declarations); } const declaration = symbol2.valueDeclaration; - const variableStatement = isVariableDeclaration6(declaration) ? tryCast(declaration.parent.parent, isVariableStatement10) : void 0; + const variableStatement = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement10) : void 0; return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; } var fixId22 = "fixIncorrectNamedTupleSyntax"; @@ -191192,7 +192118,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 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(); let suggestedSymbol; - if (isPropertyAccessExpression15(parent2) && parent2.name === node) { + if (isPropertyAccessExpression16(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) { @@ -191208,14 +192134,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, isIdentifier25, "Expected an identifier for spelling (import)"); + Debug.assertNode(node, isIdentifier26, "Expected an identifier for spelling (import)"); const importDeclaration = findAncestor(node, isImportDeclaration6); const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration, sourceFile); if (resolvedSourceFile && resolvedSourceFile.symbol) { suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol); } } else if (isJsxAttribute(parent2) && parent2.name === node) { - Debug.assertNode(node, isIdentifier25, "Expected an identifier for JSX attribute"); + Debug.assertNode(node, isIdentifier26, "Expected an identifier for JSX attribute"); const tag = findAncestor(node, isJsxOpeningLikeElement); const props = checker.getContextualTypeForArgumentAtIndex(tag, 0); suggestedSymbol = checker.getSuggestedSymbolForNonexistentJSXAttribute(node, props); @@ -191236,7 +192162,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function doChange18(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); - if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression15(node.parent)) { + if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression16(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; if (valDecl && isNamedDeclaration(valDecl) && isPrivateIdentifier(valDecl.name)) { changes.replaceNode(sourceFile, node, factory.createIdentifier(suggestion)); @@ -191431,7 +192357,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} false ); case Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code: - if (!declaration || !isCallExpression14(declaration.parent) || !declaration.body) return void 0; + if (!declaration || !isCallExpression16(declaration.parent) || !declaration.body) return void 0; const pos = declaration.parent.arguments.indexOf(declaration); if (pos === -1) return void 0; const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos); @@ -191620,13 +192546,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) && isCallExpression14(parent2.parent))) return void 0; + if (!(token.kind === 19 && isObjectLiteralExpression12(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) && isIdentifier25(param.name))) return void 0; + if (!(param && isParameter(param) && isIdentifier26(param.name))) return void 0; const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2), checker.getParameterType(signature, argIndex).getNonNullableType(), @@ -191655,7 +192581,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (!isMemberName(token)) return void 0; - if (isIdentifier25(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression12(parent2.initializer)) { + if (isIdentifier26(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression12(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), @@ -191668,13 +192594,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 (isIdentifier25(token) && isJsxOpeningLikeElement(token.parent)) { + if (isIdentifier26(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 (isIdentifier25(token)) { + if (isIdentifier26(token)) { const type = (_b = checker.getContextualType(token)) == null ? void 0 : _b.getNonNullableType(); if (type && getObjectFlags(type) & 16) { const signature = firstOrUndefined(checker.getSignaturesOfType( @@ -191685,15 +192611,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (signature === void 0) return void 0; return { kind: 5, token, signature, sourceFile, parentDeclaration: findScope(token) }; } - if (isCallExpression14(parent2) && parent2.expression === token) { + if (isCallExpression16(parent2) && parent2.expression === token) { return { kind: 2, token, call: parent2, sourceFile, modifierFlags: 0, parentDeclaration: findScope(token) }; } } - if (!isPropertyAccessExpression15(parent2)) return void 0; + if (!isPropertyAccessExpression16(parent2)) return void 0; const leftExpressionType = skipConstraint(checker.getTypeAtLocation(parent2.expression)); const symbol2 = leftExpressionType.symbol; if (!symbol2 || !symbol2.declarations) return void 0; - if (isIdentifier25(token) && isCallExpression14(parent2.parent)) { + if (isIdentifier26(token) && isCallExpression16(parent2.parent)) { const moduleDeclaration = find(symbol2.declarations, isModuleDeclaration); const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { @@ -191714,7 +192640,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const declSourceFile = declaration.getSourceFile(); const modifierFlags = isTypeLiteralNode2(declaration) ? 0 : (makeStatic ? 256 : 0) | (startsWithUnderscore(token.text) ? 2 : 0); const isJSFile = isSourceFileJS(declSourceFile); - const call = tryCast(parent2.parent, isCallExpression14); + const call = tryCast(parent2.parent, isCallExpression16); return { kind: 0, token, call, modifierFlags, parentDeclaration: declaration, declSourceFile, isJSFile }; } const enumDeclaration = find(symbol2.declarations, isEnumDeclaration); @@ -192216,7 +193142,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes29, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2)) }); function addMissingNewOperator(changes, sourceFile, span) { - const call = cast(findAncestorMatchingSpan2(sourceFile, span), isCallExpression14); + const call = cast(findAncestorMatchingSpan2(sourceFile, span), isCallExpression16); const newExpression = factory.createNewExpression(call.expression, call.typeArguments, call.arguments); changes.replaceNode(sourceFile, call, newExpression); } @@ -192280,7 +193206,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo11(sourceFile, program, pos) { const token = getTokenAtPosition(sourceFile, pos); - const callExpression = findAncestor(token, isCallExpression14); + const callExpression = findAncestor(token, isCallExpression16); if (callExpression === void 0 || length(callExpression.arguments) === 0) { return void 0; } @@ -192315,7 +193241,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} pos2++; continue; } - const name2 = expr && isIdentifier25(expr) ? expr.text : `p${paramIndex++}`; + const name2 = expr && isIdentifier26(expr) ? expr.text : `p${paramIndex++}`; const typeNode = typeToTypeNode(checker, type2, nonOverloadDeclaration); append(newParameters, { pos: i, @@ -192349,7 +193275,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (name) { return name; } - if (isVariableDeclaration6(node.parent) && isIdentifier25(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) { + if (isVariableDeclaration7(node.parent) && isIdentifier26(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) { return node.parent.name; } } @@ -192616,10 +193542,10 @@ ${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) => isPropertyAccessExpression15(arg) && arg.expression === token) ? { constructor, superCall } : void 0; + return superCall && !superCall.expression.arguments.some((arg) => isPropertyAccessExpression16(arg) && arg.expression === token) ? { constructor, superCall } : void 0; } function findSuperCall(n) { - return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild26(n, findSuperCall); + return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild27(n, findSuperCall); } var fixId28 = "constructorForDerivedNeedSuperCall"; var errorCodes34 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; @@ -192858,7 +193784,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo13(sourceFile, pos, diagCode) { const node = getTokenAtPosition(sourceFile, pos); - if (isIdentifier25(node) || isPrivateIdentifier(node)) { + if (isIdentifier26(node) || isPrivateIdentifier(node)) { return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } @@ -192970,11 +193896,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const tags = getJSDocTags(signature); const names = /* @__PURE__ */ new Set(); for (const tag of tags) { - if (isJSDocParameterTag(tag) && isIdentifier25(tag.name)) { + if (isJSDocParameterTag(tag) && isIdentifier26(tag.name)) { names.add(tag.name.escapedText); } } - const parameterName = firstDefined(signature.parameters, (p) => isIdentifier25(p.name) && !names.has(p.name.escapedText) ? p.name.getText(sourceFile) : void 0); + const parameterName = firstDefined(signature.parameters, (p) => isIdentifier26(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, @@ -192990,7 +193916,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getInfo14(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier25(token.parent.name)) { + if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier26(token.parent.name)) { const jsDocParameterTag = token.parent; const jsDocHost = getJSDocHost(jsDocParameterTag); const signature = getHostSignatureFromJSDoc(jsDocParameterTag); @@ -193021,7 +193947,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} fixIds: [fixId33] }); function getImportDeclaration(sourceFile, program, start) { - const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier25); + const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier26); if (!identifier || identifier.parent.kind !== 184) return; const checker = program.getTypeChecker(); const symbol2 = checker.getSymbolAtLocation(identifier); @@ -193116,7 +194042,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteEntireVariableStatement(t, sourceFile, token.parent)), Diagnostics.Remove_variable_statement) ]; } - if (isIdentifier25(token) && isFunctionDeclaration3(token.parent)) { + if (isIdentifier26(token) && isFunctionDeclaration3(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)])]; } const result = []; @@ -193194,7 +194120,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; } else if (canDeleteEntireVariableStatement(sourceFile, token)) { deleteEntireVariableStatement(changes, sourceFile, token.parent); - } else if (isIdentifier25(token) && isFunctionDeclaration3(token.parent)) { + } else if (isIdentifier26(token) && isFunctionDeclaration3(token.parent)) { deleteFunctionLikeDeclaration(changes, sourceFile, token.parent); } else { tryDeleteDeclaration( @@ -193250,7 +194176,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} forEach(node.elements, (n) => changes.delete(sourceFile, n)); } function deleteDestructuring(context, changes, sourceFile, { parent: parent2 }) { - if (isVariableDeclaration6(parent2) && parent2.initializer && isCallLikeExpression(parent2.initializer)) { + if (isVariableDeclaration7(parent2) && parent2.initializer && isCallLikeExpression(parent2.initializer)) { if (isVariableDeclarationList(parent2.parent) && length(parent2.parent.declarations) > 1) { const varStatement = parent2.parent.parent; const pos = varStatement.getStart(sourceFile); @@ -193272,11 +194198,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (token.kind === 140) { token = cast(token.parent, isInferTypeNode).typeParameter.name; } - if (isIdentifier25(token) && canPrefix(token)) { + if (isIdentifier26(token) && canPrefix(token)) { changes.replaceNode(sourceFile, token, factory.createIdentifier(`_${token.text}`)); if (isParameter(token.parent)) { getJSDocParameterTags(token.parent).forEach((tag) => { - if (isIdentifier25(tag.name)) { + if (isIdentifier26(tag.name)) { changes.replaceNode(sourceFile, tag.name, factory.createIdentifier(`_${tag.name.text}`)); } }); @@ -193301,9 +194227,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 (isIdentifier25(token)) { + if (isIdentifier26(token)) { ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(token, checker, sourceFile, (ref) => { - if (isPropertyAccessExpression15(ref.parent) && ref.parent.name === ref) ref = ref.parent; + if (isPropertyAccessExpression16(ref.parent) && ref.parent.name === ref) ref = ref.parent; if (!isFixAll && mayDeleteExpression(ref)) { changes.delete(sourceFile, ref.parent.parent); } @@ -193314,7 +194240,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 && isIdentifier25(token) && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(token, checker, sourceFile))) { + } else if (!(isFixAll && isIdentifier26(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); @@ -193322,7 +194248,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 && (!isIdentifier25(parameter.name) || ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { + if (parameter.modifiers && parameter.modifiers.length > 0 && (!isIdentifier26(parameter.name) || ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { for (const modifier of parameter.modifiers) { if (isModifier(modifier)) { changes.deleteModifier(sourceFile, modifier); @@ -193349,8 +194275,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} for (const entry of entries) { for (const reference of entry.references) { if (reference.kind === ts_FindAllReferences_exports.EntryKind.Node) { - const isSuperCall2 = isSuperKeyword(reference.node) && isCallExpression14(reference.node.parent) && reference.node.parent.arguments.length > index; - const isSuperMethodCall = isPropertyAccessExpression15(reference.node.parent) && isSuperKeyword(reference.node.parent.expression) && isCallExpression14(reference.node.parent.parent) && reference.node.parent.parent.arguments.length > index; + 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 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; } @@ -193376,13 +194302,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function isCallbackLike(checker, sourceFile, name) { - return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(name, checker, sourceFile, (reference) => isIdentifier25(reference) && isCallExpression14(reference.parent) && reference.parent.arguments.includes(reference)); + return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(name, checker, sourceFile, (reference) => isIdentifier26(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) => isIdentifier25(p.name) && !p.symbol.isReferenced) : index === parameters.length - 1; + return isFixAll ? parameters.slice(index + 1).every((p) => isIdentifier26(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); @@ -193596,14 +194522,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCallName(sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); - if (isPropertyAccessExpression15(token.parent)) { + if (isPropertyAccessExpression16(token.parent)) { let current = token.parent; - while (isPropertyAccessExpression15(current.parent)) { + while (isPropertyAccessExpression16(current.parent)) { current = current.parent; } return current.name; } - if (isIdentifier25(token)) { + if (isIdentifier26(token)) { return token; } return void 0; @@ -193732,7 +194658,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const newProperties = []; for (const symbol2 of elements) { if (!isIdentifierText(symbol2.name, getEmitScriptTarget(program.getCompilerOptions()))) continue; - if (symbol2.valueDeclaration && isVariableDeclaration6(symbol2.valueDeclaration)) continue; + if (symbol2.valueDeclaration && isVariableDeclaration7(symbol2.valueDeclaration)) continue; newProperties.push(factory.createVariableStatement( [factory.createModifier( 95 @@ -193777,7 +194703,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) && !isCallExpression14(node) && !isObjectLiteralExpression12(node) && !isArrayLiteralExpression7(node); + return !isEntityNameExpression(node) && !isCallExpression16(node) && !isObjectLiteralExpression12(node) && !isArrayLiteralExpression7(node); } function createAsExpression(node, type) { if (needsParenthesizedExpressionForAssertion(node)) { @@ -193815,7 +194741,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isSpreadElement5(targetNode)) { return void 0; } - const variableDeclaration = findAncestor(targetNode, isVariableDeclaration6); + const variableDeclaration = findAncestor(targetNode, isVariableDeclaration7); const type = variableDeclaration && typeChecker.getTypeAtLocation(variableDeclaration); if (type && type.flags & 8192) { return void 0; @@ -193933,7 +194859,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (some(properties, (p) => p.valueDeclaration === expandoDeclaration || p.valueDeclaration === expandoDeclaration.parent)) { const fn = targetType.symbol.valueDeclaration; if (fn) { - if (isFunctionExpressionOrArrowFunction(fn) && isVariableDeclaration6(fn.parent)) { + if (isFunctionExpressionOrArrowFunction(fn) && isVariableDeclaration7(fn.parent)) { return fn.parent; } if (isFunctionDeclaration3(fn)) { @@ -194076,7 +195002,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!enclosingVariableDeclaration.initializer) return void 0; let baseExpr; const newNodes = []; - if (!isIdentifier25(enclosingVariableDeclaration.initializer)) { + if (!isIdentifier26(enclosingVariableDeclaration.initializer)) { const tempHolderForReturn = factory.createUniqueName( "dest", 16 @@ -194145,7 +195071,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 && isIdentifier25(propertyName) ? propertyName.text : "temp", + propertyName && isIdentifier26(propertyName) ? propertyName.text : "temp", 16 /* Optimistic */ ); @@ -194341,7 +195267,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} mutatedTarget: false }; function getFlags(type2) { - return (isVariableDeclaration6(node) || isPropertyDeclaration(node) && hasSyntacticModifier( + return (isVariableDeclaration7(node) || isPropertyDeclaration(node) && hasSyntacticModifier( node, 256 | 8 /* Readonly */ @@ -194477,16 +195403,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return relativeType(node.expression); } if (isArrayLiteralExpression7(node)) { - const variableDecl = findAncestor(node, isVariableDeclaration6); - const partName = variableDecl && isIdentifier25(variableDecl.name) ? variableDecl.name.text : void 0; + const variableDecl = findAncestor(node, isVariableDeclaration7); + const partName = variableDecl && isIdentifier26(variableDecl.name) ? variableDecl.name.text : void 0; return typeFromArraySpreadElements(node, partName); } if (isObjectLiteralExpression12(node)) { - const variableDecl = findAncestor(node, isVariableDeclaration6); - const partName = variableDecl && isIdentifier25(variableDecl.name) ? variableDecl.name.text : void 0; + const variableDecl = findAncestor(node, isVariableDeclaration7); + const partName = variableDecl && isIdentifier26(variableDecl.name) ? variableDecl.name.text : void 0; return typeFromObjectSpreadAssignment(node, partName); } - if (isVariableDeclaration6(node) && node.initializer) { + if (isVariableDeclaration7(node) && node.initializer) { return relativeType(node.initializer); } if (isConditionalExpression4(node)) { @@ -194567,7 +195493,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function findAncestorWithMissingType(node) { return findAncestor(node, (n) => { - return canHaveTypeAnnotation.has(n.kind) && (!isObjectBindingPattern3(n) && !isArrayBindingPattern(n) || isVariableDeclaration6(n.parent)); + return canHaveTypeAnnotation.has(n.kind) && (!isObjectBindingPattern3(n) && !isArrayBindingPattern(n) || isVariableDeclaration7(n.parent)); }); } function findBestFittingNode(node, span) { @@ -194577,7 +195503,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} while (node.parent.pos === node.pos && node.parent.end === node.end) { node = node.parent; } - if (isIdentifier25(node) && hasInitializer(node.parent) && node.parent.initializer) { + if (isIdentifier26(node) && hasInitializer(node.parent) && node.parent.initializer) { return node.parent.initializer; } return node; @@ -194613,7 +195539,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (expr.type) { return expr.type; } - if (isVariableDeclaration6(expr.parent) && expr.parent.type && isFunctionTypeNode(expr.parent.type)) { + if (isVariableDeclaration7(expr.parent) && expr.parent.type && isFunctionTypeNode(expr.parent.type)) { return expr.parent.type.type; } } @@ -194820,12 +195746,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} // Variable and Property declarations case Diagnostics.Member_0_implicitly_has_an_1_type.code: case Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code: - if (isVariableDeclaration6(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature3(parent2)) { + if (isVariableDeclaration7(parent2) && markSeen(parent2) || isPropertyDeclaration(parent2) || isPropertySignature3(parent2)) { annotateVariableDeclaration(changes, importAdder, sourceFile, parent2, program, host, cancellationToken); importAdder.writeFixes(changes); return parent2; } - if (isPropertyAccessExpression15(parent2)) { + if (isPropertyAccessExpression16(parent2)) { const type = inferTypeForVariableFromUsage(parent2.name, program, cancellationToken); const typeNode = getTypeNodeIfAccessible(type, parent2, program, host); if (typeNode) { @@ -194844,7 +195770,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; case Diagnostics.Variable_0_implicitly_has_an_1_type.code: { const symbol2 = program.getTypeChecker().getSymbolAtLocation(token); - if (symbol2 && symbol2.valueDeclaration && isVariableDeclaration6(symbol2.valueDeclaration) && markSeen(symbol2.valueDeclaration)) { + if (symbol2 && symbol2.valueDeclaration && isVariableDeclaration7(symbol2.valueDeclaration) && markSeen(symbol2.valueDeclaration)) { annotateVariableDeclaration(changes, importAdder, getSourceFileOfNode(symbol2.valueDeclaration), symbol2.valueDeclaration, program, host, cancellationToken); importAdder.writeFixes(changes); return symbol2.valueDeclaration; @@ -194876,7 +195802,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) && isIdentifier25(containingFunction.name)) { + if (isGetAccessorDeclaration(containingFunction) && isIdentifier26(containingFunction.name)) { annotate(changes, importAdder, sourceFile, containingFunction, inferTypeForVariableFromUsage(containingFunction.name, program, cancellationToken), program, host); declaration = containingFunction; } @@ -194902,12 +195828,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return declaration; } function annotateVariableDeclaration(changes, importAdder, sourceFile, declaration, program, host, cancellationToken) { - if (isIdentifier25(declaration.name)) { + if (isIdentifier26(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 (!isIdentifier25(parameterDeclaration.name)) { + if (!isIdentifier26(parameterDeclaration.name)) { return; } const parameterInferences = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken); @@ -194958,7 +195884,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 && isIdentifier25(setAccessorDeclaration.name) && isIdentifier25(param.name)) { + if (param && isIdentifier26(setAccessorDeclaration.name) && isIdentifier26(param.name)) { let type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken); if (type === program.getTypeChecker().getAnyType()) { type = inferTypeForVariableFromUsage(param.name, program, cancellationToken); @@ -194974,7 +195900,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 = isVariableDeclaration6(declaration) ? tryCast(declaration.parent.parent, isVariableStatement10) : declaration; + const parent2 = isVariableDeclaration7(declaration) ? tryCast(declaration.parent.parent, isVariableStatement10) : declaration; if (!parent2) { return; } @@ -195017,7 +195943,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const inferences = mapDefined(parameterInferences, (inference) => { const param = inference.declaration; - if (param.initializer || getJSDocType(param) || !isIdentifier25(param.name)) { + if (param.initializer || getJSDocType(param) || !isIdentifier26(param.name)) { return; } const typeNode = inference.type && getTypeNodeIfAccessible(inference.type, param, program, host); @@ -195078,7 +196004,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, isIdentifier25) : 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, isIdentifier26) : void 0); } function inferTypeForVariableFromUsage(token, program, cancellationToken) { const references = getReferences(token, program, cancellationToken); @@ -195088,7 +196014,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: isIdentifier25(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + type: isIdentifier26(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() })); } function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { @@ -195100,7 +196026,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 220: case 219: const parent2 = containingFunction.parent; - searchToken = (isVariableDeclaration6(parent2) || isPropertyDeclaration(parent2)) && isIdentifier25(parent2.name) ? parent2.name : containingFunction.name; + searchToken = (isVariableDeclaration7(parent2) || isPropertyDeclaration(parent2)) && isIdentifier26(parent2.name) ? parent2.name : containingFunction.name; break; case 263: case 175: @@ -195207,7 +196133,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} types.push(checker.getBaseTypeOfLiteralType(call.argumentTypes[parameterIndex])); } } - if (isIdentifier25(parameter.name)) { + if (isIdentifier26(parameter.name)) { const inferred = inferTypesFromReferencesSingle(getReferences(parameter.name, program, cancellationToken)); types.push(...isRest ? mapDefined(inferred, checker.getElementTypeOfArrayType) : inferred); } @@ -195297,7 +196223,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function inferTypeFromExpressionStatement(node, usage) { - addCandidateType(usage, isCallExpression14(node) ? checker.getVoidType() : checker.getAnyType()); + addCandidateType(usage, isCallExpression16(node) ? checker.getVoidType() : checker.getAnyType()); } function inferTypeFromPrefixUnaryExpression(node, usage) { switch (node.operator) { @@ -195452,7 +196378,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function inferTypeFromPropertyAssignment(assignment, usage) { - const nodeWithRealType = isVariableDeclaration6(assignment.parent.parent) ? assignment.parent.parent : assignment.parent; + const nodeWithRealType = isVariableDeclaration7(assignment.parent.parent) ? assignment.parent.parent : assignment.parent; addCandidateThisType(usage, checker.getTypeAtLocation(nodeWithRealType)); } function inferTypeFromPropertyDeclaration(declaration, usage) { @@ -195985,7 +196911,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 && isIdentifier25(parameter.name) ? idText(parameter.name) : void 0; + const parameterName = parameter && isIdentifier26(parameter.name) ? idText(parameter.name) : void 0; addClassElement(factory.createSetAccessorDeclaration( modifiers, createName(declarationName), @@ -196054,7 +196980,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !!(context.program.getCompilerOptions().noImplicitOverride && declaration && hasAbstractModifier(declaration)); } function createName(node) { - if (isIdentifier25(node) && node.escapedText === "constructor") { + if (isIdentifier26(node) && node.escapedText === "constructor") { return factory.createComputedPropertyName(factory.createStringLiteral( idText(node), quotePreference === 0 @@ -196067,9 +196993,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} false ); } - function createBody(block, quotePreference2, ambient2) { + function createBody(block2, quotePreference2, ambient2) { return ambient2 ? void 0 : getSynthesizedDeepClone( - block, + block2, /*includeTrivia*/ false ) || createStubbedMethodBody(quotePreference2); @@ -196175,7 +197101,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) : void 0; const asteriskToken = signatureDeclaration.asteriskToken; if (isFunctionExpression6(signatureDeclaration)) { - return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier25), typeParameters, parameters, type, body ?? signatureDeclaration.body); + return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier26), typeParameters, parameters, type, body ?? signatureDeclaration.body); } if (isArrowFunction7(signatureDeclaration)) { return factory.updateArrowFunction(signatureDeclaration, modifiers, typeParameters, parameters, type, signatureDeclaration.equalsGreaterThanToken, body ?? signatureDeclaration.body); @@ -196184,7 +197110,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name ?? factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } if (isFunctionDeclaration3(signatureDeclaration)) { - return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier25), typeParameters, parameters, type, body ?? signatureDeclaration.body); + return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier26), typeParameters, parameters, type, body ?? signatureDeclaration.body); } return void 0; } @@ -196196,7 +197122,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const isJs = isInJSFile(contextNode); const { typeArguments, arguments: args, parent: parent2 } = call; const contextualType = isJs ? void 0 : checker.getContextualType(call); - const names = map2(args, (arg) => isIdentifier25(arg) ? arg.text : isPropertyAccessExpression15(arg) && isIdentifier25(arg.name) ? arg.name.text : void 0); + const names = map2(args, (arg) => isIdentifier26(arg) ? arg.text : isPropertyAccessExpression16(arg) && isIdentifier26(arg.name) ? arg.name.text : void 0); const instanceTypes = isJs ? [] : map2(args, (arg) => checker.getTypeAtLocation(arg)); const { argumentTypeNodes, argumentTypeParameters } = getArgumentTypesAndTypeParameters( checker, @@ -196258,7 +197184,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) : type ); case 263: - Debug.assert(typeof name === "string" || isIdentifier25(name), "Unexpected name"); + Debug.assert(typeof name === "string" || isIdentifier26(name), "Unexpected name"); return factory.createFunctionDeclaration( modifiers, asteriskToken, @@ -196683,17 +197609,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return changeTracker.getChanges(); } function isConvertibleName(name) { - return isIdentifier25(name) || isStringLiteral15(name); + return isIdentifier26(name) || isStringLiteral15(name); } function isAcceptedDeclaration(node) { return isParameterPropertyDeclaration(node, node.parent) || isPropertyDeclaration(node) || isPropertyAssignment11(node); } function createPropertyName(name, originalName) { - return isIdentifier25(originalName) ? factory.createIdentifier(name) : factory.createStringLiteral(name); + return isIdentifier26(originalName) ? factory.createIdentifier(name) : factory.createStringLiteral(name); } function createAccessorAccessExpression(fieldName, isStatic2, container) { const leftHead = isStatic2 ? container.name : factory.createThis(); - return isIdentifier25(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName)); + return isIdentifier26(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName)); } function prepareModifierFlagsForAccessor(modifierFlags) { modifierFlags &= ~8; @@ -196817,7 +197743,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else if (isPropertyAssignment11(declaration)) { updatePropertyAssignmentDeclaration(changeTracker, file2, declaration, fieldName); } else { - changeTracker.replaceNode(file2, declaration, factory.updateParameterDeclaration(declaration, modifiers, declaration.dotDotDotToken, cast(fieldName, isIdentifier25), declaration.questionToken, declaration.type, declaration.initializer)); + changeTracker.replaceNode(file2, declaration, factory.updateParameterDeclaration(declaration, modifiers, declaration.dotDotDotToken, cast(fieldName, isIdentifier26), declaration.questionToken, declaration.type, declaration.initializer)); } } function insertAccessor(changeTracker, file2, accessor, declaration, container) { @@ -196829,7 +197755,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 (isPropertyAccessExpression15(node) && node.expression.kind === 110 && node.name.text === originalName && isWriteAccess(node)) { + if (isPropertyAccessExpression16(node) && node.expression.kind === 110 && node.name.text === originalName && isWriteAccess(node)) { changeTracker.replaceNode(file2, node.name, factory.createIdentifier(fieldName)); } if (!isFunctionLike(node) && !isClassLike(node)) { @@ -196987,7 +197913,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo17(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (isIdentifier25(token) && isPropertyDeclaration(token.parent)) { + if (isIdentifier26(token) && isPropertyDeclaration(token.parent)) { const type = getEffectiveTypeAnnotationNode(token.parent); if (type) { return { type, prop: token.parent, isJs: isInJSFile(token.parent) }; @@ -197150,9 +198076,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )) { Debug.failBadSyntaxKind(parent2); } - const decl = cast(parent2.parent, isVariableDeclaration6); + const decl = cast(parent2.parent, isVariableDeclaration7); const quotePreference = getQuotePreference(sourceFile, preferences); - const defaultImportName = tryCast(decl.name, isIdentifier25); + const defaultImportName = tryCast(decl.name, isIdentifier26); const namedImports = isObjectBindingPattern3(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0; if (defaultImportName || namedImports) { const moduleSpecifier = first(parent2.arguments); @@ -197172,13 +198098,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function tryCreateNamedImportsFromObjectBindingPattern(node) { const importSpecifiers = []; for (const element of node.elements) { - if (!isIdentifier25(element.name) || element.initializer) { + if (!isIdentifier26(element.name) || element.initializer) { return void 0; } importSpecifiers.push(factory.createImportSpecifier( /*isTypeOnly*/ false, - tryCast(element.propertyName, isIdentifier25), + tryCast(element.propertyName, isIdentifier26), element.name )); } @@ -197205,7 +198131,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function getInfo19(sourceFile, pos) { const name = getTokenAtPosition(sourceFile, pos); - if (!isIdentifier25(name)) return void 0; + if (!isIdentifier26(name)) return void 0; const { parent: parent2 } = name; if (isImportEqualsDeclaration(parent2) && isExternalModuleReference(parent2.moduleReference)) { return { importNode: parent2, name, moduleSpecifier: parent2.moduleReference.expression }; @@ -197383,7 +198309,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const mappedTypeParameter = factory.createTypeParameterDeclaration( /*modifiers*/ void 0, - cast(parameter.name, isIdentifier25), + cast(parameter.name, isIdentifier26), parameter.type ); const mappedIntersectionType = factory.createMappedTypeNode( @@ -197413,7 +198339,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes62, getCodeActions(context) { - const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression14); + const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression16); if (!callExpression) { return void 0; } @@ -197459,7 +198385,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*stopAtCallExpressions*/ false ); - if (isIdentifier25(leftMostExpression)) { + if (isIdentifier26(leftMostExpression)) { const precedingToken = findPrecedingToken(awaitExpression.parent.pos, sourceFile); if (precedingToken && precedingToken.kind !== 105) { expressionToReplace = awaitExpression.parent; @@ -197629,11 +198555,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); function makeChange13(changes, sourceFile, span, program, seen) { const node = getTokenAtPosition(sourceFile, span.start); - if (!isIdentifier25(node) || !isCallExpression14(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0) return; + if (!isIdentifier26(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; - if (!decl || !isParameter(decl) || !isNewExpression17(decl.parent.parent)) return; + if (!decl || !isParameter(decl) || !isNewExpression19(decl.parent.parent)) return; if (seen == null ? void 0 : seen.has(decl)) return; seen == null ? void 0 : seen.add(decl); const typeArguments = getEffectiveTypeArguments(decl.parent.parent); @@ -197668,7 +198594,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isInJSFile(node)) { if (isParenthesizedExpression7(node.parent)) { const jsDocType = (_a3 = getJSDocTypeTag(node.parent)) == null ? void 0 : _a3.typeExpression.type; - if (jsDocType && isTypeReferenceNode3(jsDocType) && isIdentifier25(jsDocType.typeName) && idText(jsDocType.typeName) === "Promise") { + if (jsDocType && isTypeReferenceNode3(jsDocType) && isIdentifier26(jsDocType.typeName) && idText(jsDocType.typeName) === "Promise") { return jsDocType.typeArguments; } } @@ -197856,7 +198782,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 && isIdentifier25(previousToken)) { + if (incompleteCompletionsCache && completionKind === 3 && previousToken && isIdentifier26(previousToken)) { const incompleteContinuation = continuePreviousIncompleteResponse(incompleteCompletionsCache, sourceFile, previousToken, program, host, preferences, cancellationToken, position); if (incompleteContinuation) { return incompleteContinuation; @@ -198034,7 +198960,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (getJSDocParameterTags(param).length) { return void 0; } - if (isIdentifier25(param.name)) { + if (isIdentifier26(param.name)) { const tabstopCounter = { tabstop: 1 }; const paramName = param.name.text; let displayText = getJSDocParamAnnotation( @@ -198185,7 +199111,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; } function elementWorker(path2, element, counter) { - if (!element.propertyName && isIdentifier25(element.name) || isIdentifier25(element.name)) { + if (!element.propertyName && isIdentifier26(element.name) || isIdentifier26(element.name)) { const propertyName = element.propertyName ? tryGetTextOfPropertyName(element.propertyName) : element.name.text; if (!propertyName) { return void 0; @@ -198566,7 +199492,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; case 197: const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference); - return exp && (isIdentifier25(exp) ? exp : factory.createParenthesizedExpression(exp)); + return exp && (isIdentifier26(exp) ? exp : factory.createParenthesizedExpression(exp)); case 187: return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference); case 206: @@ -198575,7 +199501,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } function entityNameToExpression(entityName, languageVersion, quotePreference) { - if (isIdentifier25(entityName)) { + if (isIdentifier26(entityName)) { return entityName; } const unescapedName = unescapeLeadingUnderscores(entityName.right.escapedText); @@ -199010,7 +199936,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isModifier(node)) { return node.kind; } - if (isIdentifier25(node)) { + if (isIdentifier26(node)) { const originalKeywordKind = identifierToKeywordKind(node); if (originalKeywordKind && isModifierKind(originalKeywordKind)) { return originalKeywordKind; @@ -199458,7 +200384,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (location.parent && isExportAssignment3(location.parent)) { return true; } - if (closestSymbolDeclaration && tryCast(closestSymbolDeclaration, isVariableDeclaration6)) { + if (closestSymbolDeclaration && tryCast(closestSymbolDeclaration, isVariableDeclaration7)) { if (symbol2.valueDeclaration === closestSymbolDeclaration) { return false; } @@ -199786,7 +200712,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} host, program, formatContext, - previousToken && isIdentifier25(previousToken) ? previousToken.getStart(sourceFile) : position, + previousToken && isIdentifier26(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken ); @@ -199974,7 +200900,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} propertyAccessToConvert = parent2; node = propertyAccessToConvert.expression; const leftmostAccessExpression = getLeftmostAccessExpression(propertyAccessToConvert); - if (nodeIsMissing(leftmostAccessExpression) || (isCallExpression14(node) || isFunctionLike(node)) && node.end === contextToken.pos && node.getChildCount(sourceFile) && last(node.getChildren(sourceFile)).kind !== 22) { + if (nodeIsMissing(leftmostAccessExpression) || (isCallExpression16(node) || isFunctionLike(node)) && node.end === contextToken.pos && node.getChildCount(sourceFile) && last(node.getChildren(sourceFile)).kind !== 22) { return void 0; } break; @@ -200160,7 +201086,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 || isPropertyAccessExpression15(node)) { + if (isEntityName(node) || isImportType || isPropertyAccessExpression16(node)) { const isNamespaceName = isModuleDeclaration(node.parent); if (isNamespaceName) { isNewIdentifierLocation = true; @@ -200363,7 +201289,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getLeftMostName(e) { - return isIdentifier25(e) ? e : isPropertyAccessExpression15(e) ? getLeftMostName(e.expression) : void 0; + return isIdentifier26(e) ? e : isPropertyAccessExpression16(e) ? getLeftMostName(e.expression) : void 0; } function tryGetGlobalSymbols() { const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetImportAttributesCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1); @@ -200501,7 +201427,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } flags |= 1; const isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken && importStatementCompletion; - const lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && isIdentifier25(previousToken) ? previousToken.text.toLowerCase() : ""; + const lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && isIdentifier26(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); @@ -201111,7 +202037,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const ancestorVariableDeclaration = findAncestor( contextToken2.parent, - isVariableDeclaration6 + isVariableDeclaration7 ); if (ancestorVariableDeclaration && isInDifferentLineThanContextToken(contextToken2, position)) { return false; @@ -201137,7 +202063,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; } if (isConstructorParameterCompletion(contextToken2)) { - if (!isIdentifier25(contextToken2) || isParameterPropertyModifier(keywordForNode(contextToken2)) || isCurrentlyEditingNode(contextToken2)) { + if (!isIdentifier26(contextToken2) || isParameterPropertyModifier(keywordForNode(contextToken2)) || isCurrentlyEditingNode(contextToken2)) { return false; } } @@ -201528,7 +202454,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 isIdentifier25(node) ? identifierToKeywordKind(node) ?? 0 : node.kind; + return isIdentifier26(node) ? identifierToKeywordKind(node) ?? 0 : node.kind; } function getContextualKeywords(contextToken, position) { const entries = []; @@ -201609,7 +202535,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } if (!contextToken) return void 0; - if (location.kind === 137 || isIdentifier25(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { + if (location.kind === 137 || isIdentifier26(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { return findAncestor(contextToken, isClassLike); } switch (contextToken.kind) { @@ -201629,7 +202555,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 || isIdentifier25(contextToken) && isValidKeyword( + return isValidKeyword(contextToken.kind) || contextToken.kind === 42 || isIdentifier26(contextToken) && isValidKeyword( identifierToKeywordKind(contextToken) ?? 0 /* Unknown */ ) ? contextToken.parent.parent : void 0; @@ -201769,7 +202695,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parent2 = contextToken.parent; if (isImportEqualsDeclaration(parent2)) { const lastToken = parent2.getLastToken(sourceFile); - if (isIdentifier25(contextToken) && lastToken !== contextToken) { + if (isIdentifier26(contextToken) && lastToken !== contextToken) { keywordCompletion = 161; isKeywordOnlyCompletion = true; return void 0; @@ -201864,7 +202790,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!contextToken) return; let closestDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); if (!closestDeclaration) { - closestDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration6(node)); + closestDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration7(node)); } return closestDeclaration; } @@ -202430,7 +203356,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} fragment = "." + directorySeparator; } fragment = ensureTrailingDirectorySeparator(fragment); - const absolutePath = resolvePath2(scriptDirectory, fragment); + const absolutePath = resolvePath3(scriptDirectory, fragment); const baseDirectory = hasTrailingDirectorySeparator(absolutePath) ? absolutePath : getDirectoryPath(absolutePath); if (!moduleSpecifierIsRelative) { const packageJsonPath = findPackageJson(baseDirectory, host); @@ -202795,7 +203721,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (parsed === void 0 || isString(parsed)) { return void 0; } - const normalizedPrefix = resolvePath2(parsed.prefix); + const normalizedPrefix = resolvePath3(parsed.prefix); const normalizedPrefixDirectory = hasTrailingDirectorySeparator(parsed.prefix) ? normalizedPrefix : getDirectoryPath(normalizedPrefix); const normalizedPrefixBase = hasTrailingDirectorySeparator(parsed.prefix) ? "" : getBaseFileName(normalizedPrefix); const fragmentHasPath = containsSlash(fragment); @@ -202998,7 +203924,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return fragment.includes(directorySeparator); } function isRequireCallArgument(node) { - return isCallExpression14(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier25(node.parent.expression) && node.parent.expression.escapedText === "require"; + return isCallExpression16(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier26(node.parent.expression) && node.parent.expression.escapedText === "require"; } var ts_FindAllReferences_exports = {}; __export2(ts_FindAllReferences_exports, { @@ -203520,7 +204446,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } function getExportNode(parent2, node) { - const declaration = isVariableDeclaration6(parent2) ? parent2 : isBindingElement(parent2) ? walkUpBindingElementsAndPatterns(parent2) : void 0; + const declaration = isVariableDeclaration7(parent2) ? parent2 : isBindingElement(parent2) ? walkUpBindingElementsAndPatterns(parent2) : void 0; if (declaration) { return parent2.name !== node ? void 0 : isCatchClause(declaration.parent) ? void 0 : isVariableStatement10(declaration.parent.parent) ? declaration.parent.parent : void 0; } else { @@ -203555,7 +204481,7 @@ ${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 (isPropertyAccessExpression15(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) { + } else if (isPropertyAccessExpression16(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) { return checker.getSymbolAtLocation(declaration); } else if (isShorthandPropertyAssignment6(declaration) && isBinaryExpression4(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2) { return checker.getExportSpecifierLocalTargetSymbol(declaration.name); @@ -203916,7 +204842,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) { - if (entry.kind !== 0 && (isIdentifier25(originalNode) || isStringLiteralLike4(originalNode))) { + if (entry.kind !== 0 && (isIdentifier26(originalNode) || isStringLiteralLike4(originalNode))) { const { node, kind } = entry; const parent2 = node.parent; const name = originalNode.text; @@ -204330,7 +205256,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) && isPropertyAccessExpression15(decl.left) ? decl.left.expression : isExportAssignment3(decl) ? Debug.checkDefined(findChildOfKind(decl, 95, sourceFile)) : getNameOfDeclaration(decl) || decl; + const node = isBinaryExpression4(decl) && isPropertyAccessExpression16(decl.left) ? decl.left.expression : isExportAssignment3(decl) ? Debug.checkDefined(findChildOfKind(decl, 95, sourceFile)) : getNameOfDeclaration(decl) || decl; references.push(nodeEntry(node)); } } @@ -204602,7 +205528,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} cb(importLocation); } for (const singleReference of singleReferences) { - if (isIdentifier25(singleReference) && isImportTypeNode(singleReference.parent)) { + if (isIdentifier26(singleReference) && isImportTypeNode(singleReference.parent)) { cb(singleReference); } } @@ -204610,7 +205536,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} 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 (isIdentifier25(node) && !isImportOrExportSpecifier(node.parent) && (symbol2 === exportSymbol || hasExportAssignmentDeclaration)) { + if (isIdentifier26(node) && !isImportOrExportSpecifier(node.parent) && (symbol2 === exportSymbol || hasExportAssignmentDeclaration)) { cb(node); } } @@ -204620,7 +205546,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 (!isIdentifier25(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false; + if (!isIdentifier26(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false; return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef)); } function searchForImportedSymbol(symbol2, state) { @@ -204700,7 +205626,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 (!isIdentifier25(token) || token === definition || token.escapedText !== definition.escapedText) continue; + if (!isIdentifier26(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); @@ -204733,13 +205659,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } Core2.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile; function someSignatureUsage(signature, sourceFiles, checker, cb) { - if (!signature.name || !isIdentifier25(signature.name)) return false; + if (!signature.name || !isIdentifier26(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 (!isIdentifier25(name) || name === signature.name || name.escapedText !== signature.name.escapedText) continue; + if (!isIdentifier26(name) || name === signature.name || name.escapedText !== signature.name.escapedText) continue; const called = climbPastPropertyAccess(name); - const call = isCallExpression14(called.parent) && called.parent.expression === called ? called.parent : void 0; + const call = isCallExpression16(called.parent) && called.parent.expression === called ? called.parent : void 0; const referenceSymbol = checker.getSymbolAtLocation(name); if (referenceSymbol && checker.getRootSymbols(referenceSymbol).some((s) => s === symbol2)) { if (cb(name, call)) { @@ -204805,7 +205731,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 15: case 11: { const str = node; - return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression14(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent)); + return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression16(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent)); } case 9: return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length; @@ -205147,7 +206073,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function getContainingNodeIfInHeritageClause(node) { - return isIdentifier25(node) || isPropertyAccessExpression15(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration2)) : void 0; + return isIdentifier26(node) || isPropertyAccessExpression16(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration2)) : void 0; } function isImplementationExpression(node) { switch (node.kind) { @@ -205564,7 +206490,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } Core2.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; function forEachDescendantOfKind(node, kind, action) { - forEachChild26(node, (child) => { + forEachChild27(node, (child) => { if (child.kind === kind) { action(child); } @@ -205605,7 +206531,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const { parent: parent2 } = node; const typeChecker = program.getTypeChecker(); - if (node.kind === 164 || isIdentifier25(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { + if (node.kind === 164 || isIdentifier26(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { const def = getDefinitionFromOverriddenMember(typeChecker, node); if (def !== void 0 || node.kind !== 164) { return def || emptyArray; @@ -205805,7 +206731,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let resolution; if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModuleFromModuleSpecifier(node, sourceFile))) { const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName; - const fileName = verifiedFileName || resolvePath2(getDirectoryPath(sourceFile.fileName), node.text); + const fileName = verifiedFileName || resolvePath3(getDirectoryPath(sourceFile.fileName), node.text); return { file: program.getSourceFile(fileName), fileName, @@ -205926,7 +206852,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function tryGetReturnTypeOfFunction(symbol2, type, checker) { if (type.symbol === symbol2 || // At `const f = () => {}`, the symbol is `f` and the type symbol is at `() => {}` - symbol2.valueDeclaration && type.symbol && isVariableDeclaration6(symbol2.valueDeclaration) && symbol2.valueDeclaration.initializer === type.symbol.valueDeclaration) { + symbol2.valueDeclaration && type.symbol && isVariableDeclaration7(symbol2.valueDeclaration) && symbol2.valueDeclaration.initializer === type.symbol.valueDeclaration) { const sigs = type.getCallSignatures(); if (sigs.length === 1) return checker.getReturnTypeOfSignature(first(sigs)); } @@ -206202,13 +207128,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isTypeNode(node) && !isExpressionWithTypeArguments(node)) { return; } - if (preferences.includeInlayVariableTypeHints && isVariableDeclaration6(node)) { + if (preferences.includeInlayVariableTypeHints && isVariableDeclaration7(node)) { visitVariableLikeDeclaration(node); } else if (preferences.includeInlayPropertyDeclarationTypeHints && isPropertyDeclaration(node)) { visitVariableLikeDeclaration(node); } else if (preferences.includeInlayEnumMemberValueHints && isEnumMember(node)) { visitEnumMember(node); - } else if (shouldShowParameterNameHints(preferences) && (isCallExpression14(node) || isNewExpression17(node))) { + } else if (shouldShowParameterNameHints(preferences) && (isCallExpression16(node) || isNewExpression19(node))) { visitCallOrNewExpression(node); } else { if (preferences.includeInlayFunctionParameterTypeHints && isFunctionLikeDeclaration(node) && hasContextSensitiveParameters(node)) { @@ -206218,7 +207144,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} visitFunctionDeclarationLikeForReturnType(node); } } - return forEachChild26(node, visitor); + return forEachChild27(node, visitor); } function isSignatureSupportingReturnAnnotation(node) { return isArrowFunction7(node) || isFunctionExpression6(node) || isFunctionDeclaration3(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node); @@ -206270,7 +207196,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return type.symbol && type.symbol.flags & 1536; } function visitVariableLikeDeclaration(decl) { - if (decl.initializer === void 0 && !(isPropertyDeclaration(decl) && !(checker.getTypeAtLocation(decl).flags & 1)) || isBindingPattern(decl.name) || isVariableDeclaration6(decl) && !isHintableDeclaration(decl)) { + if (decl.initializer === void 0 && !(isPropertyDeclaration(decl) && !(checker.getTypeAtLocation(decl).flags & 1)) || isBindingPattern(decl.name) || isVariableDeclaration7(decl) && !isHintableDeclaration(decl)) { return; } const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(decl); @@ -206337,10 +207263,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function identifierOrAccessExpressionPostfixMatchesParameterName(expr, parameterName) { - if (isIdentifier25(expr)) { + if (isIdentifier26(expr)) { return expr.text === parameterName; } - if (isPropertyAccessExpression15(expr)) { + if (isPropertyAccessExpression16(expr)) { return expr.name.text === parameterName; } return false; @@ -206360,7 +207286,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (node.kind) { case 225: { const operand = node.operand; - return isLiteralExpression(operand) || isIdentifier25(operand) && isInfinityOrNaNString(operand.escapedText); + return isLiteralExpression(operand) || isIdentifier26(operand) && isInfinityOrNaNString(operand.escapedText); } case 112: case 97: @@ -206535,7 +207461,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } switch (node2.kind) { case 80: - Debug.assertNode(node2, isIdentifier25); + Debug.assertNode(node2, isIdentifier26); const identifierText = idText(node2); const name = node2.symbol && node2.symbol.declarations && node2.symbol.declarations.length && getNameOfDeclaration(node2.symbol.declarations[0]); if (name) { @@ -206942,9 +207868,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return name === "undefined"; } function isHintableDeclaration(node) { - if ((isPartOfParameterDeclaration(node) || isVariableDeclaration6(node) && isVarConst(node)) && node.initializer) { + if ((isPartOfParameterDeclaration(node) || isVariableDeclaration7(node) && isVarConst(node)) && node.initializer) { const initializer3 = skipParentheses(node.initializer); - return !(isHintableLiteral(initializer3) || isNewExpression17(initializer3) || isObjectLiteralExpression12(initializer3) || isAssertionExpression(initializer3)); + return !(isHintableLiteral(initializer3) || isNewExpression19(initializer3) || isObjectLiteralExpression12(initializer3) || isAssertionExpression(initializer3)); } return true; } @@ -207250,7 +208176,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; } function getJSDocParameterNameCompletions(tag) { - if (!isIdentifier25(tag.name)) { + if (!isIdentifier26(tag.name)) { return emptyArray; } const nameThusFar = tag.name.text; @@ -207258,9 +208184,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const fn = jsdoc.parent; if (!isFunctionLike(fn)) return []; return mapDefined(fn.parameters, (param) => { - if (!isIdentifier25(param.name)) return void 0; + if (!isIdentifier26(param.name)) return void 0; const name = param.name.text; - if (jsdoc.tags.some((t) => t !== tag && isJSDocParameterTag(t) && isIdentifier25(t.name) && t.name.escapedText === name) || nameThusFar !== void 0 && !startsWith(name, nameThusFar)) { + if (jsdoc.tags.some((t) => t !== tag && isJSDocParameterTag(t) && isIdentifier26(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 }; @@ -207402,7 +208328,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return ts_textChanges_exports.ChangeTracker.with( { host, formatContext, preferences }, (changeTracker) => { - const parsed = contents.map((c) => parse3(sourceFile, c)); + const parsed = contents.map((c) => parse4(sourceFile, c)); const flattenedLocations = focusLocations && flatten(focusLocations); for (const nodes of parsed) { placeNodeGroup( @@ -207415,7 +208341,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } ); } - function parse3(sourceFile, content) { + function parse4(sourceFile, content) { const nodeKinds = [ { parse: () => createSourceFile5( @@ -207523,7 +208449,7 @@ ${content} for (const location of focusLocations) { const scope = findAncestor( getTokenAtPosition(originalFile, location.start), - (block) => or(isBlock6, isSourceFile)(block) && some(block.statements, (origStmt) => changes.some((newStmt) => matchNode(newStmt, origStmt))) + (block2) => or(isBlock6, isSourceFile)(block2) && some(block2.statements, (origStmt) => changes.some((newStmt) => matchNode(newStmt, origStmt))) ); if (scope) { const start = scope.statements.find((stmt) => changes.some((node) => matchNode(node, stmt))); @@ -207542,12 +208468,12 @@ ${content} } let scopeStatements = originalFile.statements; for (const location of focusLocations) { - const block = findAncestor( + const block2 = findAncestor( getTokenAtPosition(originalFile, location.start), isBlock6 ); - if (block) { - scopeStatements = block.statements; + if (block2) { + scopeStatements = block2.statements; break; } } @@ -208303,7 +209229,7 @@ ${content} if (isDeclaration(n2) || isVariableStatement10(n2) || isReturnStatement4(n2) || isCallOrNewExpression(n2) || n2.kind === 1) { addOutliningForLeadingCommentsForNode(n2, sourceFile, cancellationToken, out); } - if (isFunctionLike(n2) && isBinaryExpression4(n2.parent) && isPropertyAccessExpression15(n2.parent.left)) { + if (isFunctionLike(n2) && isBinaryExpression4(n2.parent) && isPropertyAccessExpression16(n2.parent.left)) { addOutliningForLeadingCommentsForNode(n2.parent.left, sourceFile, cancellationToken, out); } if (isBlock6(n2) || isModuleBlock(n2)) { @@ -208315,7 +209241,7 @@ ${content} const span = getOutliningSpanForNode(n2, sourceFile); if (span) out.push(span); depthRemaining--; - if (isCallExpression14(n2)) { + if (isCallExpression16(n2)) { depthRemaining++; visitNode3(n2.expression); depthRemaining--; @@ -208626,7 +209552,7 @@ ${content} /*autoCollapse*/ false, /*useFullStart*/ - !isArrayLiteralExpression7(node.parent) && !isCallExpression14(node.parent), + !isArrayLiteralExpression7(node.parent) && !isCallExpression16(node.parent), open2 ); } @@ -208711,7 +209637,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 (isIdentifier25(node) && node.escapedText === "default" && symbol2.parent && symbol2.parent.flags & 1536) { + if (isIdentifier26(node) && node.escapedText === "default" && symbol2.parent && symbol2.parent.flags & 1536) { return void 0; } if (isStringLiteralLike4(node) && tryGetImportFromModuleSpecifier(node)) { @@ -208871,7 +209797,7 @@ ${content} } case 1: { const { called } = invocation; - if (onlyUseSyntacticOwners && !containsPrecedingToken(startingToken, sourceFile, isIdentifier25(called) ? called.parent : called)) { + if (onlyUseSyntacticOwners && !containsPrecedingToken(startingToken, sourceFile, isIdentifier26(called) ? called.parent : called)) { return void 0; } const candidates = getPossibleGenericSignatures(called, argumentCount, checker); @@ -208904,7 +209830,7 @@ ${content} function createJSSignatureHelpItems(argumentInfo, program, cancellationToken) { if (argumentInfo.invocation.kind === 2) return void 0; const expression = getExpressionFromInvocation(argumentInfo.invocation); - const name = isPropertyAccessExpression15(expression) ? expression.name.text : void 0; + const name = isPropertyAccessExpression16(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); @@ -208972,7 +209898,7 @@ ${content} const { list, argumentIndex, argumentCount, argumentsSpan } = info; const isTypeParameterList = !!parent2.typeArguments && parent2.typeArguments.pos === list.pos; return { isTypeParameterList, invocation: { kind: 0, node: invocation }, argumentsSpan, argumentIndex, argumentCount }; - } else if (isNoSubstitutionTemplateLiteral5(node) && isTaggedTemplateExpression4(parent2)) { + } else if (isNoSubstitutionTemplateLiteral5(node) && isTaggedTemplateExpression5(parent2)) { if (isInsideTemplateLiteral(node, position, sourceFile)) { return getArgumentListInfoForTemplate( parent2, @@ -208991,7 +209917,7 @@ ${content} ); const argumentIndex = isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); - } else if (isTemplateSpan(parent2) && isTaggedTemplateExpression4(parent2.parent.parent)) { + } else if (isTemplateSpan(parent2) && isTaggedTemplateExpression5(parent2.parent.parent)) { const templateSpan = parent2; const tagExpression = parent2.parent.parent; if (isTemplateTail(node) && !isInsideTemplateLiteral(node, position, sourceFile)) { @@ -209413,7 +210339,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) && isVariableStatement10(parentNode) || isSyntaxList(node) && isVariableDeclarationList(parentNode) || isVariableDeclaration6(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) && isVariableStatement10(parentNode) || isSyntaxList(node) && isVariableDeclarationList(parentNode) || isVariableDeclaration7(node) && isSyntaxList(parentNode) && children.length === 1 || isJSDocTypeExpression(node) || isJSDocSignature(node) || isJSDocTypeLiteral(node)) { parentNode = node; break; } @@ -209785,12 +210711,12 @@ ${content} callExpressionLike = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { callExpressionLike = location.parent; - } else if (location.parent && (isJsxOpeningLikeElement(location.parent) || isTaggedTemplateExpression4(location.parent)) && isFunctionLike(symbol2.valueDeclaration)) { + } else if (location.parent && (isJsxOpeningLikeElement(location.parent) || isTaggedTemplateExpression5(location.parent)) && isFunctionLike(symbol2.valueDeclaration)) { callExpressionLike = location.parent; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); - const useConstructSignatures = callExpressionLike.kind === 215 || isCallExpression14(callExpressionLike) && callExpressionLike.expression.kind === 108; + const useConstructSignatures = callExpressionLike.kind === 215 || isCallExpression16(callExpressionLike) && callExpressionLike.expression.kind === 108; const allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !contains(allSignatures, signature.target) && !contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : void 0; @@ -210258,7 +211184,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, isIdentifier25); + Debug.assertNode(labelDecl.name, isIdentifier26); displayParts.push(spacePart()); displayParts.push(punctuationPart( 21 @@ -210307,11 +211233,11 @@ ${content} } } } - if (documentation.length === 0 && isIdentifier25(location) && symbol2.valueDeclaration && isBindingElement(symbol2.valueDeclaration)) { + if (documentation.length === 0 && isIdentifier26(location) && symbol2.valueDeclaration && isBindingElement(symbol2.valueDeclaration)) { const declaration = symbol2.valueDeclaration; const parent2 = declaration.parent; const name = declaration.propertyName || declaration.name; - if (isIdentifier25(name) && isObjectBindingPattern3(parent2)) { + if (isIdentifier26(name) && isObjectBindingPattern3(parent2)) { const propertyName = getTextOfIdentifierOrLiteral(name); const objectType = typeChecker.getTypeAtLocation(parent2); documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => { @@ -211009,7 +211935,7 @@ ${content} getOptionsForInsertNodeBefore(before, inserted, blankLineBetween) { if (isStatement(before) || isClassElement(before)) { return { suffix: blankLineBetween ? this.newLineCharacter + this.newLineCharacter : this.newLineCharacter }; - } else if (isVariableDeclaration6(before)) { + } else if (isVariableDeclaration7(before)) { return { suffix: ", " }; } else if (isParameter(before)) { return isParameter(inserted) ? { suffix: ", " } : {}; @@ -211354,7 +212280,7 @@ ${options.prefix}` : "\n" : options.prefix case 342: { const oldParam = oldTag; const newParam = newTag; - return isIdentifier25(oldParam.name) && isIdentifier25(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( + return isIdentifier26(oldParam.name) && isIdentifier26(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( /*tagName*/ void 0, newParam.name, @@ -211900,7 +212826,7 @@ ${options.prefix}` : "\n" : options.prefix deleteNode(changes, sourceFile, node); } else if (isImportClause(node.parent) && node.parent.name === node) { deleteDefaultImport(changes, sourceFile, node.parent); - } else if (isCallExpression14(node.parent) && contains(node.parent.arguments, node)) { + } else if (isCallExpression16(node.parent) && contains(node.parent.arguments, node)) { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } else { deleteNode(changes, sourceFile, node); @@ -214199,7 +215125,7 @@ ${options.prefix}` : "\n" : options.prefix return positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } function isNotPropertyAccessOnIntegerLiteral(context) { - return !isPropertyAccessExpression15(context.contextNode) || !isNumericLiteral5(context.contextNode.expression) || context.contextNode.expression.getText().includes("."); + return !isPropertyAccessExpression16(context.contextNode) || !isNumericLiteral5(context.contextNode.expression) || context.contextNode.expression.getText().includes("."); } function getFormatContext(options, host) { return { options, getRules: getRulesMap(), host }; @@ -214432,7 +215358,7 @@ ${options.prefix}` : "\n" : options.prefix function findEnclosingNode(range, sourceFile) { return find2(sourceFile); function find2(n) { - const candidate = forEachChild26(n, (c) => startEndContainsRange(c.getStart(sourceFile), c.end, range) && c); + const candidate = forEachChild27(n, (c) => startEndContainsRange(c.getStart(sourceFile), c.end, range) && c); if (candidate) { const result = find2(candidate); if (result) { @@ -214766,7 +215692,7 @@ ${options.prefix}` : "\n" : options.prefix } const nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta2); let childContextNode = contextNode; - forEachChild26( + forEachChild27( node, (child) => { processChildNode( @@ -215587,7 +216513,7 @@ ${options.prefix}` : "\n" : options.prefix return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent2, child, childStartLine, sourceFile) { - if (!(isCallExpression14(parent2) && contains(parent2.arguments, child))) { + if (!(isCallExpression16(parent2) && contains(parent2.arguments, child))) { return false; } const expressionOfCallExpressionEnd = parent2.expression.getEnd(); @@ -215907,10 +216833,10 @@ ${options.prefix}` : "\n" : options.prefix (ancestorNode) => rangeContainsRange(ancestorNode, range) ); if (!enclosingNode) return; - forEachChild26(enclosingNode, function checkNameResolution(node) { + forEachChild27(enclosingNode, function checkNameResolution(node) { var _a3; if (shouldProvidePasteEdits) return; - if (isIdentifier25(node) && rangeContainsPosition(range, node.getStart(sourceFile))) { + if (isIdentifier26(node) && rangeContainsPosition(range, node.getStart(sourceFile))) { const resolvedSymbol = checker.resolveName( node.text, node, @@ -215997,8 +216923,8 @@ ${options.prefix}` : "\n" : options.prefix (ancestorNode) => rangeContainsRange(ancestorNode, range) ); if (!enclosingNode) return; - forEachChild26(enclosingNode, function importUnresolvedIdentifiers(node) { - const isImportCandidate = isIdentifier25(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName( + forEachChild27(enclosingNode, function importUnresolvedIdentifiers(node) { + const isImportCandidate = isIdentifier26(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName( node.text, node, -1, @@ -216036,8 +216962,8 @@ ${options.prefix}` : "\n" : options.prefix const startToken = getTokenAtPosition(sourceFile, pos); const endToken = findTokenOnLeftOfPosition(sourceFile, pos) ?? getTokenAtPosition(sourceFile, end); return { - pos: isIdentifier25(startToken) && pos <= startToken.getStart(sourceFile) ? startToken.getFullStart() : pos, - end: isIdentifier25(endToken) && end === endToken.getEnd() ? ts_textChanges_exports.getAdjustedEndPosition(sourceFile, endToken, {}) : end + pos: isIdentifier26(startToken) && pos <= startToken.getStart(sourceFile) ? startToken.getFullStart() : pos, + end: isIdentifier26(endToken) && end === endToken.getEnd() ? ts_textChanges_exports.getAdjustedEndPosition(sourceFile, endToken, {}) : end }; } var ts_exports2 = {}; @@ -216601,7 +217527,7 @@ ${options.prefix}` : "\n" : options.prefix forEachAncestor: () => forEachAncestor, forEachAncestorDirectory: () => forEachAncestorDirectory, forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache, - forEachChild: () => forEachChild26, + forEachChild: () => forEachChild27, forEachChildRecursively: () => forEachChildRecursively, forEachDynamicImportOrRequireCall: () => forEachDynamicImportOrRequireCall, forEachEmittedFile: () => forEachEmittedFile, @@ -217226,7 +218152,7 @@ ${options.prefix}` : "\n" : options.prefix isBuilderProgram: () => isBuilderProgram, isBundle: () => isBundle, isCallChain: () => isCallChain, - isCallExpression: () => isCallExpression14, + isCallExpression: () => isCallExpression16, isCallExpressionTarget: () => isCallExpressionTarget, isCallLikeExpression: () => isCallLikeExpression, isCallLikeOrFunctionLikeExpression: () => isCallLikeOrFunctionLikeExpression, @@ -217382,7 +218308,7 @@ ${options.prefix}` : "\n" : options.prefix isHeritageClause: () => isHeritageClause, isHoistedFunction: () => isHoistedFunction, isHoistedVariableStatement: () => isHoistedVariableStatement, - isIdentifier: () => isIdentifier25, + isIdentifier: () => isIdentifier26, isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword, isIdentifierName: () => isIdentifierName, isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode, @@ -217588,7 +218514,7 @@ ${options.prefix}` : "\n" : options.prefix isNamespaceExportDeclaration: () => isNamespaceExportDeclaration, isNamespaceImport: () => isNamespaceImport5, isNamespaceReexportDeclaration: () => isNamespaceReexportDeclaration, - isNewExpression: () => isNewExpression17, + isNewExpression: () => isNewExpression19, isNewExpressionTarget: () => isNewExpressionTarget, isNewScopeNode: () => isNewScopeNode, isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral5, @@ -217621,7 +218547,7 @@ ${options.prefix}` : "\n" : options.prefix isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor, isObjectTypeDeclaration: () => isObjectTypeDeclaration, isOmittedExpression: () => isOmittedExpression, - isOptionalChain: () => isOptionalChain, + isOptionalChain: () => isOptionalChain2, isOptionalChainRoot: () => isOptionalChainRoot, isOptionalDeclaration: () => isOptionalDeclaration, isOptionalJSDocPropertyLikeTag: () => isOptionalJSDocPropertyLikeTag, @@ -217658,7 +218584,7 @@ ${options.prefix}` : "\n" : options.prefix isPrologueDirective: () => isPrologueDirective, isPropertyAccessChain: () => isPropertyAccessChain, isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression, - isPropertyAccessExpression: () => isPropertyAccessExpression15, + isPropertyAccessExpression: () => isPropertyAccessExpression16, isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName, isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode, isPropertyAssignment: () => isPropertyAssignment11, @@ -217744,9 +218670,9 @@ ${options.prefix}` : "\n" : options.prefix isSyntheticExpression: () => isSyntheticExpression, isSyntheticReference: () => isSyntheticReference, isTagName: () => isTagName, - isTaggedTemplateExpression: () => isTaggedTemplateExpression4, + isTaggedTemplateExpression: () => isTaggedTemplateExpression5, isTaggedTemplateTag: () => isTaggedTemplateTag, - isTemplateExpression: () => isTemplateExpression4, + isTemplateExpression: () => isTemplateExpression5, isTemplateHead: () => isTemplateHead, isTemplateLiteral: () => isTemplateLiteral, isTemplateLiteralKind: () => isTemplateLiteralKind, @@ -217811,7 +218737,7 @@ ${options.prefix}` : "\n" : options.prefix isVarConst: () => isVarConst, isVarConstLike: () => isVarConstLike, isVarUsing: () => isVarUsing, - isVariableDeclaration: () => isVariableDeclaration6, + isVariableDeclaration: () => isVariableDeclaration7, isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement, isVariableDeclarationInitializedToBareOrAccessedRequire: () => isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire, @@ -218029,7 +218955,7 @@ ${options.prefix}` : "\n" : options.prefix resolveModuleName: () => resolveModuleName, resolveModuleNameFromCache: () => resolveModuleNameFromCache, resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson, - resolvePath: () => resolvePath2, + resolvePath: () => resolvePath3, resolveProjectReferencePath: () => resolveProjectReferencePath, resolveTripleslashReference: () => resolveTripleslashReference, resolveTypeReferenceDirective: () => resolveTypeReferenceDirective, @@ -218913,19 +219839,19 @@ ${options.prefix}` : "\n" : options.prefix Msg2["Perf"] = "Perf"; return Msg2; })(Msg || {}); - function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { + function createInstallTypingsRequest(project2, typeAcquisition, unresolvedImports, cachePath) { return { - projectName: project.getProjectName(), - fileNames: project.getFileNames( + projectName: project2.getProjectName(), + fileNames: project2.getFileNames( /*excludeFilesFromExternalLibraries*/ true, /*excludeConfigFiles*/ true - ).concat(project.getExcludedFiles()), - compilerOptions: project.getCompilationSettings(), + ).concat(project2.getExcludedFiles()), + compilerOptions: project2.getCompilationSettings(), typeAcquisition, unresolvedImports, - projectRootPath: project.getCurrentDirectory(), + projectRootPath: project2.getCurrentDirectory(), cachePath, kind: "discover" }; @@ -218940,8 +219866,8 @@ ${options.prefix}` : "\n" : options.prefix throw new Error("The project's language service is disabled."); } Errors2.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; - function ThrowProjectDoesNotContainDocument(fileName, project) { - throw new Error(`Project '${project.getProjectName()}' does not contain document '${fileName}'`); + function ThrowProjectDoesNotContainDocument(fileName, project2) { + throw new Error(`Project '${project2.getProjectName()}' does not contain document '${fileName}'`); } Errors2.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; })(Errors || (Errors = {})); @@ -219522,12 +220448,12 @@ ${options.prefix}` : "\n" : options.prefix this.realpath = this.path; if (this.host.realpath) { Debug.assert(!!this.containingProjects.length); - const project = this.containingProjects[0]; + const project2 = this.containingProjects[0]; const realpath = this.host.realpath(this.path); if (realpath) { - this.realpath = project.toPath(realpath); + this.realpath = project2.toPath(realpath); if (this.realpath !== this.path) { - project.projectService.realpathToScriptInfos.add(this.realpath, this); + project2.projectService.realpathToScriptInfos.add(this.realpath, this); } } } @@ -219551,51 +220477,51 @@ ${options.prefix}` : "\n" : options.prefix getPreferences() { return this.preferences; } - attachToProject(project) { - const isNew = !this.isAttached(project); + attachToProject(project2) { + const isNew = !this.isAttached(project2); if (isNew) { - this.containingProjects.push(project); - if (!project.getCompilerOptions().preserveSymlinks) { + this.containingProjects.push(project2); + if (!project2.getCompilerOptions().preserveSymlinks) { this.ensureRealPath(); } - project.onFileAddedOrRemoved(this.isSymlink()); + project2.onFileAddedOrRemoved(this.isSymlink()); } return isNew; } - isAttached(project) { + isAttached(project2) { switch (this.containingProjects.length) { case 0: return false; case 1: - return this.containingProjects[0] === project; + return this.containingProjects[0] === project2; case 2: - return this.containingProjects[0] === project || this.containingProjects[1] === project; + return this.containingProjects[0] === project2 || this.containingProjects[1] === project2; default: - return contains(this.containingProjects, project); + return contains(this.containingProjects, project2); } } - detachFromProject(project) { + detachFromProject(project2) { switch (this.containingProjects.length) { case 0: return; case 1: - if (this.containingProjects[0] === project) { - project.onFileAddedOrRemoved(this.isSymlink()); + if (this.containingProjects[0] === project2) { + project2.onFileAddedOrRemoved(this.isSymlink()); this.containingProjects.pop(); } break; case 2: - if (this.containingProjects[0] === project) { - project.onFileAddedOrRemoved(this.isSymlink()); + if (this.containingProjects[0] === project2) { + project2.onFileAddedOrRemoved(this.isSymlink()); this.containingProjects[0] = this.containingProjects.pop(); - } else if (this.containingProjects[1] === project) { - project.onFileAddedOrRemoved(this.isSymlink()); + } else if (this.containingProjects[1] === project2) { + project2.onFileAddedOrRemoved(this.isSymlink()); this.containingProjects.pop(); } break; default: - if (orderedRemoveItem(this.containingProjects, project)) { - project.onFileAddedOrRemoved(this.isSymlink()); + if (orderedRemoveItem(this.containingProjects, project2)) { + project2.onFileAddedOrRemoved(this.isSymlink()); } break; } @@ -219637,21 +220563,21 @@ ${options.prefix}` : "\n" : options.prefix let firstNonSourceOfProjectReferenceRedirect; let defaultConfiguredProject; for (let index = 0; index < this.containingProjects.length; index++) { - const project = this.containingProjects[index]; - if (isConfiguredProject(project)) { - if (project.deferredClose) continue; - if (!project.isSourceOfProjectReferenceRedirect(this.fileName)) { + const project2 = this.containingProjects[index]; + if (isConfiguredProject(project2)) { + if (project2.deferredClose) continue; + if (!project2.isSourceOfProjectReferenceRedirect(this.fileName)) { if (defaultConfiguredProject === void 0 && index !== this.containingProjects.length - 1) { - defaultConfiguredProject = project.projectService.findDefaultConfiguredProject(this) || false; + defaultConfiguredProject = project2.projectService.findDefaultConfiguredProject(this) || false; } - if (defaultConfiguredProject === project) return project; - if (!firstNonSourceOfProjectReferenceRedirect) firstNonSourceOfProjectReferenceRedirect = project; + if (defaultConfiguredProject === project2) return project2; + if (!firstNonSourceOfProjectReferenceRedirect) firstNonSourceOfProjectReferenceRedirect = project2; } - if (!firstConfiguredProject) firstConfiguredProject = project; - } else if (isExternalProject(project)) { - return project; - } else if (!firstInferredProject && isInferredProject(project)) { - firstInferredProject = project; + if (!firstConfiguredProject) firstConfiguredProject = project2; + } else if (isExternalProject(project2)) { + return project2; + } else if (!firstInferredProject && isInferredProject(project2)) { + firstInferredProject = project2; } } return (defaultConfiguredProject || firstNonSourceOfProjectReferenceRedirect || firstConfiguredProject || firstInferredProject) ?? Errors.ThrowNoProject(); @@ -219814,16 +220740,16 @@ ${options.prefix}` : "\n" : options.prefix } return result; } - function hasOneOrMoreJsAndNoTsFiles(project) { - const counts2 = countEachFileTypes(project.getScriptInfos()); + function hasOneOrMoreJsAndNoTsFiles(project2) { + const counts2 = countEachFileTypes(project2.getScriptInfos()); return counts2.js > 0 && counts2.ts === 0 && counts2.tsx === 0; } - function allRootFilesAreJsOrDts(project) { - const counts2 = countEachFileTypes(project.getRootScriptInfos()); + function allRootFilesAreJsOrDts(project2) { + const counts2 = countEachFileTypes(project2.getRootScriptInfos()); return counts2.ts === 0 && counts2.tsx === 0; } - function allFilesAreJsOrDts(project) { - const counts2 = countEachFileTypes(project.getScriptInfos()); + function allFilesAreJsOrDts(project2) { + const counts2 = countEachFileTypes(project2.getScriptInfos()); return counts2.ts === 0 && counts2.tsx === 0; } function hasNoTypeScriptSource(fileNames) { @@ -220812,8 +221738,8 @@ ${options.prefix}` : "\n" : options.prefix } }; for (const file2 of files) { - const basename4 = getBaseFileName(file2); - if (basename4 === "package.json" || basename4 === "bower.json") { + const basename6 = getBaseFileName(file2); + if (basename6 === "package.json" || basename6 === "bower.json") { createProjectWatcher( file2, "FileWatcher" @@ -222167,20 +223093,20 @@ ${options.prefix}` : "\n" : options.prefix return this.excludedFiles; } }; - function isInferredProject(project) { - return project.projectKind === 0; + function isInferredProject(project2) { + return project2.projectKind === 0; } - function isConfiguredProject(project) { - return project.projectKind === 1; + function isConfiguredProject(project2) { + return project2.projectKind === 1; } - function isExternalProject(project) { - return project.projectKind === 2; + function isExternalProject(project2) { + return project2.projectKind === 2; } - function isBackgroundProject(project) { - return project.projectKind === 3 || project.projectKind === 4; + function isBackgroundProject(project2) { + return project2.projectKind === 3 || project2.projectKind === 4; } - function isProjectDeferredClose(project) { - return isConfiguredProject(project) && !!project.deferredClose; + function isProjectDeferredClose(project2) { + return isConfiguredProject(project2) && !!project2.deferredClose; } var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; var maxFileSize = 4 * 1024 * 1024; @@ -222392,16 +223318,16 @@ ${options.prefix}` : "\n" : options.prefix function toConfiguredProjectLoadOptimized(kind) { return kind - 1; } - function forEachAncestorProjectLoad(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) { + function forEachAncestorProjectLoad(info, project2, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) { var _a3; while (true) { - if (project.parsedCommandLine && (searchOnlyPotentialSolution && !project.parsedCommandLine.options.composite || // Currently disableSolutionSearching is shared for finding solution/project when + if (project2.parsedCommandLine && (searchOnlyPotentialSolution && !project2.parsedCommandLine.options.composite || // Currently disableSolutionSearching is shared for finding solution/project when // - loading solution for find all references // - trying to find default project - project.parsedCommandLine.options.disableSolutionSearching)) return; - const configFileName = project.projectService.getConfigFileNameForFile( + project2.parsedCommandLine.options.disableSolutionSearching)) return; + const configFileName = project2.projectService.getConfigFileNameForFile( { - fileName: project.getConfigFilePath(), + fileName: project2.getConfigFilePath(), path: info.path, configFileInfo: true, isForDefaultProject: !searchOnlyPotentialSolution @@ -222410,7 +223336,7 @@ ${options.prefix}` : "\n" : options.prefix /* CreateReplay */ ); if (!configFileName) return; - const ancestor = project.projectService.findCreateOrReloadConfiguredProject( + const ancestor = project2.projectService.findCreateOrReloadConfiguredProject( configFileName, kind, reason, @@ -222423,15 +223349,15 @@ ${options.prefix}` : "\n" : options.prefix delayReloadedConfiguredProjects ); if (!ancestor) return; - if (!ancestor.project.parsedCommandLine && ((_a3 = project.parsedCommandLine) == null ? void 0 : _a3.options.composite)) { - ancestor.project.setPotentialProjectReference(project.canonicalConfigFilePath); + if (!ancestor.project.parsedCommandLine && ((_a3 = project2.parsedCommandLine) == null ? void 0 : _a3.options.composite)) { + ancestor.project.setPotentialProjectReference(project2.canonicalConfigFilePath); } const result = cb(ancestor); if (result) return result; - project = ancestor.project; + project2 = ancestor.project; } } - function forEachResolvedProjectReferenceProjectLoad(project, parentConfig, cb, kind, reason, allowDeferredClosed, reloadedProjects, seenResolvedRefs) { + function forEachResolvedProjectReferenceProjectLoad(project2, parentConfig, cb, kind, reason, allowDeferredClosed, reloadedProjects, seenResolvedRefs) { const loadKind = parentConfig.options.disableReferencedProjectLoad ? 0 : kind; let children; return forEach( @@ -222439,33 +223365,33 @@ ${options.prefix}` : "\n" : options.prefix (ref) => { var _a3; const childConfigName = toNormalizedPath(resolveProjectReferencePath(ref)); - const childCanonicalConfigPath = asNormalizedPath(project.projectService.toCanonicalFileName(childConfigName)); + const childCanonicalConfigPath = asNormalizedPath(project2.projectService.toCanonicalFileName(childConfigName)); const seenValue = seenResolvedRefs == null ? void 0 : seenResolvedRefs.get(childCanonicalConfigPath); if (seenValue !== void 0 && seenValue >= loadKind) return void 0; - const configFileExistenceInfo = project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath); - let childConfig = loadKind === 0 ? (configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.exists) || ((_a3 = project.resolvedChildConfigs) == null ? void 0 : _a3.has(childCanonicalConfigPath)) ? configFileExistenceInfo.config.parsedCommandLine : void 0 : project.getParsedCommandLine(childConfigName); + const configFileExistenceInfo = project2.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath); + let childConfig = loadKind === 0 ? (configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.exists) || ((_a3 = project2.resolvedChildConfigs) == null ? void 0 : _a3.has(childCanonicalConfigPath)) ? configFileExistenceInfo.config.parsedCommandLine : void 0 : project2.getParsedCommandLine(childConfigName); if (childConfig && loadKind !== kind && loadKind > 2) { - childConfig = project.getParsedCommandLine(childConfigName); + childConfig = project2.getParsedCommandLine(childConfigName); } if (!childConfig) return void 0; - const childProject = project.projectService.findConfiguredProjectByProjectName(childConfigName, allowDeferredClosed); + const childProject = project2.projectService.findConfiguredProjectByProjectName(childConfigName, allowDeferredClosed); if (loadKind === 2 && !configFileExistenceInfo && !childProject) return void 0; switch (loadKind) { case 6: if (childProject) childProject.projectService.reloadConfiguredProjectOptimized(childProject, reason, reloadedProjects); // falls through case 4: - (project.resolvedChildConfigs ?? (project.resolvedChildConfigs = /* @__PURE__ */ new Set())).add(childCanonicalConfigPath); + (project2.resolvedChildConfigs ?? (project2.resolvedChildConfigs = /* @__PURE__ */ new Set())).add(childCanonicalConfigPath); // falls through case 2: case 0: if (childProject || loadKind !== 0) { const result = cb( - configFileExistenceInfo ?? project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath), + configFileExistenceInfo ?? project2.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath), childProject, childConfigName, reason, - project, + project2, childCanonicalConfigPath ); if (result) return result; @@ -222480,7 +223406,7 @@ ${options.prefix}` : "\n" : options.prefix ) || forEach( children, (childConfig) => childConfig.projectReferences && forEachResolvedProjectReferenceProjectLoad( - project, + project2, childConfig, cb, loadKind, @@ -222491,31 +223417,31 @@ ${options.prefix}` : "\n" : options.prefix ) ); } - function updateProjectFoundUsingFind(project, kind, triggerFile, reason, reloadedProjects) { + function updateProjectFoundUsingFind(project2, kind, triggerFile, reason, reloadedProjects) { let sentConfigFileDiag = false; let configFileExistenceInfo; switch (kind) { case 2: case 3: - if (useConfigFileExistenceInfoForOptimizedLoading(project)) { - configFileExistenceInfo = project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath); + if (useConfigFileExistenceInfoForOptimizedLoading(project2)) { + configFileExistenceInfo = project2.projectService.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath); } break; case 4: - configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project); + configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project2); if (configFileExistenceInfo) break; // falls through case 5: - sentConfigFileDiag = updateConfiguredProject(project, triggerFile); + sentConfigFileDiag = updateConfiguredProject(project2, triggerFile); break; case 6: - project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects); - configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project); + project2.projectService.reloadConfiguredProjectOptimized(project2, reason, reloadedProjects); + configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project2); if (configFileExistenceInfo) break; // falls through case 7: - sentConfigFileDiag = project.projectService.reloadConfiguredProjectClearingSemanticCache( - project, + sentConfigFileDiag = project2.projectService.reloadConfiguredProjectClearingSemanticCache( + project2, reason, reloadedProjects ); @@ -222526,82 +223452,82 @@ ${options.prefix}` : "\n" : options.prefix default: Debug.assertNever(kind); } - return { project, sentConfigFileDiag, configFileExistenceInfo, reason }; + return { project: project2, sentConfigFileDiag, configFileExistenceInfo, reason }; } - function forEachPotentialProjectReference(project, cb) { - return project.initialLoadPending ? (project.potentialProjectReferences && forEachKey(project.potentialProjectReferences, cb)) ?? (project.resolvedChildConfigs && forEachKey(project.resolvedChildConfigs, cb)) : void 0; + function forEachPotentialProjectReference(project2, cb) { + return project2.initialLoadPending ? (project2.potentialProjectReferences && forEachKey(project2.potentialProjectReferences, cb)) ?? (project2.resolvedChildConfigs && forEachKey(project2.resolvedChildConfigs, cb)) : void 0; } - function forEachAnyProjectReferenceKind(project, cb, cbProjectRef, cbPotentialProjectRef) { - return project.getCurrentProgram() ? project.forEachResolvedProjectReference(cb) : project.initialLoadPending ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef); + function forEachAnyProjectReferenceKind(project2, cb, cbProjectRef, cbPotentialProjectRef) { + return project2.getCurrentProgram() ? project2.forEachResolvedProjectReference(cb) : project2.initialLoadPending ? forEachPotentialProjectReference(project2, cbPotentialProjectRef) : forEach(project2.getProjectReferences(), cbProjectRef); } - function callbackRefProject(project, cb, refPath) { - const refProject = refPath && project.projectService.configuredProjects.get(refPath); + function callbackRefProject(project2, cb, refPath) { + const refProject = refPath && project2.projectService.configuredProjects.get(refPath); return refProject && cb(refProject); } - function forEachReferencedProject(project, cb) { + function forEachReferencedProject(project2, cb) { return forEachAnyProjectReferenceKind( - project, - (resolvedRef) => callbackRefProject(project, cb, resolvedRef.sourceFile.path), - (projectRef) => callbackRefProject(project, cb, project.toPath(resolveProjectReferencePath(projectRef))), - (potentialProjectRef) => callbackRefProject(project, cb, potentialProjectRef) + project2, + (resolvedRef) => callbackRefProject(project2, cb, resolvedRef.sourceFile.path), + (projectRef) => callbackRefProject(project2, cb, project2.toPath(resolveProjectReferencePath(projectRef))), + (potentialProjectRef) => callbackRefProject(project2, cb, potentialProjectRef) ); } - function getDetailWatchInfo(watchType, project) { - return `${isString(project) ? `Config: ${project} ` : project ? `Project: ${project.getProjectName()} ` : ""}WatchType: ${watchType}`; + function getDetailWatchInfo(watchType, project2) { + return `${isString(project2) ? `Config: ${project2} ` : project2 ? `Project: ${project2.getProjectName()} ` : ""}WatchType: ${watchType}`; } function isScriptInfoWatchedFromNodeModules(info) { return !info.isScriptOpen() && info.mTime !== void 0; } - function updateProjectIfDirty(project) { - project.invalidateResolutionsOfFailedLookupLocations(); - return project.dirty && !project.updateGraph(); + function updateProjectIfDirty(project2) { + project2.invalidateResolutionsOfFailedLookupLocations(); + return project2.dirty && !project2.updateGraph(); } - function updateWithTriggerFile(project, triggerFile, isReload) { + function updateWithTriggerFile(project2, triggerFile, isReload) { if (!isReload) { - project.invalidateResolutionsOfFailedLookupLocations(); - if (!project.dirty) return false; - } - project.triggerFileForConfigFileDiag = triggerFile; - const updateLevel = project.pendingUpdateLevel; - project.updateGraph(); - if (!project.triggerFileForConfigFileDiag && !isReload) return updateLevel === 2; - const sent = project.projectService.sendConfigFileDiagEvent(project, triggerFile, isReload); - project.triggerFileForConfigFileDiag = void 0; + project2.invalidateResolutionsOfFailedLookupLocations(); + if (!project2.dirty) return false; + } + project2.triggerFileForConfigFileDiag = triggerFile; + const updateLevel = project2.pendingUpdateLevel; + project2.updateGraph(); + if (!project2.triggerFileForConfigFileDiag && !isReload) return updateLevel === 2; + const sent = project2.projectService.sendConfigFileDiagEvent(project2, triggerFile, isReload); + project2.triggerFileForConfigFileDiag = void 0; return sent; } - function updateConfiguredProject(project, triggerFile) { + function updateConfiguredProject(project2, triggerFile) { if (triggerFile) { if (updateWithTriggerFile( - project, + project2, triggerFile, /*isReload*/ false )) return true; } else { - updateProjectIfDirty(project); + updateProjectIfDirty(project2); } return false; } - function configFileExistenceInfoForOptimizedLoading(project) { - const configFileName = toNormalizedPath(project.getConfigFilePath()); - const configFileExistenceInfo = project.projectService.ensureParsedConfigUptoDate( + function configFileExistenceInfoForOptimizedLoading(project2) { + const configFileName = toNormalizedPath(project2.getConfigFilePath()); + const configFileExistenceInfo = project2.projectService.ensureParsedConfigUptoDate( configFileName, - project.canonicalConfigFilePath, - project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath), - project + project2.canonicalConfigFilePath, + project2.projectService.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath), + project2 ); const parsedCommandLine = configFileExistenceInfo.config.parsedCommandLine; - project.parsedCommandLine = parsedCommandLine; - project.resolvedChildConfigs = void 0; - project.updateReferences(parsedCommandLine.projectReferences); - if (useConfigFileExistenceInfoForOptimizedLoading(project)) return configFileExistenceInfo; + project2.parsedCommandLine = parsedCommandLine; + project2.resolvedChildConfigs = void 0; + project2.updateReferences(parsedCommandLine.projectReferences); + if (useConfigFileExistenceInfoForOptimizedLoading(project2)) return configFileExistenceInfo; } - function useConfigFileExistenceInfoForOptimizedLoading(project) { - return !!project.parsedCommandLine && (!!project.parsedCommandLine.options.composite || // If solution, no need to load it to determine if file belongs to it - !!isSolutionConfig(project.parsedCommandLine)); + function useConfigFileExistenceInfoForOptimizedLoading(project2) { + return !!project2.parsedCommandLine && (!!project2.parsedCommandLine.options.composite || // If solution, no need to load it to determine if file belongs to it + !!isSolutionConfig(project2.parsedCommandLine)); } - function configFileExistenceInfoForOptimizedReplay(project) { - return useConfigFileExistenceInfoForOptimizedLoading(project) ? project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath) : void 0; + function configFileExistenceInfoForOptimizedReplay(project2) { + return useConfigFileExistenceInfoForOptimizedLoading(project2) ? project2.projectService.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath) : void 0; } function fileOpenReason(info) { return `Creating possible configured project for ${info.fileName} to open`; @@ -222609,9 +223535,9 @@ ${options.prefix}` : "\n" : options.prefix function reloadReason(reason) { return `User requested reload projects: ${reason}`; } - function setProjectOptionsUsed(project) { - if (isConfiguredProject(project)) { - project.projectOptions = true; + function setProjectOptionsUsed(project2) { + if (isConfiguredProject(project2)) { + project2.projectOptions = true; } } function createProjectNameFactoryWithCounter(nameFactory) { @@ -222853,13 +223779,13 @@ ${options.prefix}` : "\n" : options.prefix return this.compilerOptionsForInferredProjects; } /** @internal */ - onUpdateLanguageServiceStateForProject(project, languageServiceEnabled) { + onUpdateLanguageServiceStateForProject(project2, languageServiceEnabled) { if (!this.eventHandler) { return; } const event = { eventName: ProjectLanguageServiceStateEvent, - data: { project, languageServiceEnabled } + data: { project: project2, languageServiceEnabled } }; this.eventHandler(event); } @@ -222888,13 +223814,13 @@ ${options.prefix}` : "\n" : options.prefix } // eslint-disable-line @typescript-eslint/unified-signatures updateTypingsForProject(response) { - const project = this.findProject(response.projectName); - if (!project) { + const project2 = this.findProject(response.projectName); + if (!project2) { return; } switch (response.kind) { case ActionSet: - project.updateTypingFiles( + project2.updateTypingFiles( response.compilerOptions, response.typeAcquisition, response.unresolvedImports, @@ -222902,7 +223828,7 @@ ${options.prefix}` : "\n" : options.prefix ); return; case ActionInvalidate: - project.enqueueInstallTypingsForProject( + project2.enqueueInstallTypingsForProject( /*forceRefresh*/ true ); @@ -222934,26 +223860,26 @@ ${options.prefix}` : "\n" : options.prefix } ); } - delayUpdateProjectGraph(project) { - if (isProjectDeferredClose(project)) return; - project.markAsDirty(); - if (isBackgroundProject(project)) return; - const projectName = project.getProjectName(); - this.pendingProjectUpdates.set(projectName, project); + delayUpdateProjectGraph(project2) { + if (isProjectDeferredClose(project2)) return; + project2.markAsDirty(); + if (isBackgroundProject(project2)) return; + const projectName = project2.getProjectName(); + this.pendingProjectUpdates.set(projectName, project2); this.throttledOperations.schedule( projectName, /*delay*/ 250, () => { if (this.pendingProjectUpdates.delete(projectName)) { - updateProjectIfDirty(project); + updateProjectIfDirty(project2); } } ); } /** @internal */ - hasPendingProjectUpdate(project) { - return this.pendingProjectUpdates.has(project.getProjectName()); + hasPendingProjectUpdate(project2) { + return this.pendingProjectUpdates.has(project2.getProjectName()); } /** @internal */ sendProjectsUpdatedInBackgroundEvent() { @@ -222980,26 +223906,26 @@ ${options.prefix}` : "\n" : options.prefix this.eventHandler(event); } /** @internal */ - sendProjectLoadingStartEvent(project, reason) { + sendProjectLoadingStartEvent(project2, reason) { if (!this.eventHandler) { return; } - project.sendLoadingProjectFinish = true; + project2.sendLoadingProjectFinish = true; const event = { eventName: ProjectLoadingStartEvent, - data: { project, reason } + data: { project: project2, reason } }; this.eventHandler(event); } /** @internal */ - sendProjectLoadingFinishEvent(project) { - if (!this.eventHandler || !project.sendLoadingProjectFinish) { + sendProjectLoadingFinishEvent(project2) { + if (!this.eventHandler || !project2.sendLoadingProjectFinish) { return; } - project.sendLoadingProjectFinish = false; + project2.sendLoadingProjectFinish = false; const event = { eventName: ProjectLoadingFinishEvent, - data: { project } + data: { project: project2 } }; this.eventHandler(event); } @@ -223010,15 +223936,15 @@ ${options.prefix}` : "\n" : options.prefix } } /** @internal */ - delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project) { - this.delayUpdateProjectGraph(project); + delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project2) { + this.delayUpdateProjectGraph(project2); this.delayEnsureProjectForOpenFiles(); } delayUpdateProjectGraphs(projects, clearSourceMapperCache) { if (projects.length) { - for (const project of projects) { - if (clearSourceMapperCache) project.clearSourceMapperCache(); - this.delayUpdateProjectGraph(project); + for (const project2 of projects) { + if (clearSourceMapperCache) project2.clearSourceMapperCache(); + this.delayUpdateProjectGraph(project2); } this.delayEnsureProjectForOpenFiles(); } @@ -223039,15 +223965,15 @@ ${options.prefix}` : "\n" : options.prefix this.watchOptionsForInferredProjects = watchOptions; this.typeAcquisitionForInferredProjects = typeAcquisition; } - for (const project of this.inferredProjects) { - if (canonicalProjectRootPath ? project.projectRootPath === canonicalProjectRootPath : !project.projectRootPath || !this.compilerOptionsForInferredProjectsPerProjectRoot.has(project.projectRootPath)) { - project.setCompilerOptions(compilerOptions); - project.setTypeAcquisition(typeAcquisition); - project.setWatchOptions(watchOptions == null ? void 0 : watchOptions.watchOptions); - project.setProjectErrors(watchOptions == null ? void 0 : watchOptions.errors); - project.compileOnSaveEnabled = compilerOptions.compileOnSave; - project.markAsDirty(); - this.delayUpdateProjectGraph(project); + for (const project2 of this.inferredProjects) { + if (canonicalProjectRootPath ? project2.projectRootPath === canonicalProjectRootPath : !project2.projectRootPath || !this.compilerOptionsForInferredProjectsPerProjectRoot.has(project2.projectRootPath)) { + project2.setCompilerOptions(compilerOptions); + project2.setTypeAcquisition(typeAcquisition); + project2.setWatchOptions(watchOptions == null ? void 0 : watchOptions.watchOptions); + project2.setProjectErrors(watchOptions == null ? void 0 : watchOptions.errors); + project2.compileOnSaveEnabled = compilerOptions.compileOnSave; + project2.markAsDirty(); + this.delayUpdateProjectGraph(project2); } } this.delayEnsureProjectForOpenFiles(); @@ -223069,9 +223995,9 @@ ${options.prefix}` : "\n" : options.prefix } /** @internal */ forEachEnabledProject(cb) { - this.forEachProject((project) => { - if (!project.isOrphan() && project.languageServiceEnabled) { - cb(project); + this.forEachProject((project2) => { + if (!project2.isOrphan() && project2.languageServiceEnabled) { + cb(project2); } }); } @@ -223126,8 +224052,8 @@ ${options.prefix}` : "\n" : options.prefix ensureProjectStructuresUptoDate() { let hasChanges = this.pendingEnsureProjectForOpenFiles; this.pendingProjectUpdates.clear(); - const updateGraph = (project) => { - hasChanges = updateProjectIfDirty(project) || hasChanges; + const updateGraph = (project2) => { + hasChanges = updateProjectIfDirty(project2) || hasChanges; }; this.externalProjects.forEach(updateGraph); this.configuredProjects.forEach(updateGraph); @@ -223280,32 +224206,32 @@ ${options.prefix}` : "\n" : options.prefix config2.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => { var _a3; if (!watchWildcardDirectories) return; - const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath); - if (!project) return; - if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) { + const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath); + if (!project2) return; + if (configuredProjectForConfig !== project2 && this.getHostPreferences().includeCompletionsForModuleExports) { const path = this.toPath(configFileName); - if (find((_a3 = project.getCurrentProgram()) == null ? void 0 : _a3.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) { - project.markAutoImportProviderAsDirty(); + if (find((_a3 = project2.getCurrentProgram()) == null ? void 0 : _a3.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) { + project2.markAutoImportProviderAsDirty(); } } - const updateLevel = configuredProjectForConfig === project ? 1 : 0; - if (project.pendingUpdateLevel > updateLevel) return; + const updateLevel = configuredProjectForConfig === project2 ? 1 : 0; + if (project2.pendingUpdateLevel > updateLevel) return; if (this.openFiles.has(fileOrDirectoryPath)) { const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath)); - if (info.isAttached(project)) { + if (info.isAttached(project2)) { const loadLevelToSet = Math.max( updateLevel, - project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 + project2.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */ ); - project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet); + project2.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet); } else { - project.pendingUpdateLevel = updateLevel; - this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project); + project2.pendingUpdateLevel = updateLevel; + this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project2); } } else { - project.pendingUpdateLevel = updateLevel; - this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project); + project2.pendingUpdateLevel = updateLevel; + this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project2); } }); } @@ -223317,17 +224243,17 @@ ${options.prefix}` : "\n" : options.prefix configFileExistenceInfo.config.cachedDirectoryStructureHost.clearCache(); configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => { var _a3, _b, _c; - const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath); - if (!project) return; + const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath); + if (!project2) return; scheduledAnyProjectUpdate = true; if (projectCanonicalPath === canonicalConfigFilePath) { - if (project.initialLoadPending) return; - project.pendingUpdateLevel = 2; - project.pendingUpdateReason = loadReason; - this.delayUpdateProjectGraph(project); - project.markAutoImportProviderAsDirty(); + if (project2.initialLoadPending) return; + project2.pendingUpdateLevel = 2; + project2.pendingUpdateReason = loadReason; + this.delayUpdateProjectGraph(project2); + project2.markAutoImportProviderAsDirty(); } else { - if (project.initialLoadPending) { + if (project2.initialLoadPending) { (_b = (_a3 = this.configFileExistenceInfoCache.get(projectCanonicalPath)) == null ? void 0 : _a3.openFilesImpactedByConfigFile) == null ? void 0 : _b.forEach((path2) => { var _a22; if (!((_a22 = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a22.has(path2))) { @@ -223340,10 +224266,10 @@ ${options.prefix}` : "\n" : options.prefix return; } const path = this.toPath(canonicalConfigFilePath); - project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(path); - this.delayUpdateProjectGraph(project); - if (this.getHostPreferences().includeCompletionsForModuleExports && find((_c = project.getCurrentProgram()) == null ? void 0 : _c.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) { - project.markAutoImportProviderAsDirty(); + project2.resolutionCache.removeResolutionsFromProjectReferenceRedirects(path); + this.delayUpdateProjectGraph(project2); + if (this.getHostPreferences().includeCompletionsForModuleExports && find((_c = project2.getCurrentProgram()) == null ? void 0 : _c.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) { + project2.markAutoImportProviderAsDirty(); } } }); @@ -223351,16 +224277,16 @@ ${options.prefix}` : "\n" : options.prefix } onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind) { const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath); - const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath); - const wasDefferedClose = project == null ? void 0 : project.deferredClose; + const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath); + const wasDefferedClose = project2 == null ? void 0 : project2.deferredClose; if (eventKind === 2) { configFileExistenceInfo.exists = false; - if (project) project.deferredClose = true; + if (project2) project2.deferredClose = true; } else { configFileExistenceInfo.exists = true; if (wasDefferedClose) { - project.deferredClose = void 0; - project.markAsDirty(); + project2.deferredClose = void 0; + project2.markAsDirty(); } } this.delayUpdateProjectsFromParsedConfigOnConfigFileChange( @@ -223385,9 +224311,9 @@ ${options.prefix}` : "\n" : options.prefix }); this.delayEnsureProjectForOpenFiles(); } - removeProject(project) { + removeProject(project2) { this.logger.info("`remove Project::"); - project.print( + project2.print( /*writeProjectFileNames*/ true, /*writeFileExplaination*/ @@ -223395,20 +224321,20 @@ ${options.prefix}` : "\n" : options.prefix /*writeFileVersionAndText*/ false ); - project.close(); + project2.close(); if (Debug.shouldAssert( 1 /* Normal */ )) { this.filenameToScriptInfo.forEach( (info) => Debug.assert( - !info.isAttached(project), + !info.isAttached(project2), "Found script Info still attached to project", - () => `${project.projectName}: ScriptInfos still attached: ${JSON.stringify( + () => `${project2.projectName}: ScriptInfos still attached: ${JSON.stringify( arrayFrom( mapDefinedIterator( this.filenameToScriptInfo.values(), - (info2) => info2.isAttached(project) ? { + (info2) => info2.isAttached(project2) ? { fileName: info2.fileName, projects: info2.containingProjects.map((p) => p.projectName), hasMixedContent: info2.hasMixedContent @@ -223422,25 +224348,25 @@ ${options.prefix}` : "\n" : options.prefix ) ); } - this.pendingProjectUpdates.delete(project.getProjectName()); - switch (project.projectKind) { + this.pendingProjectUpdates.delete(project2.getProjectName()); + switch (project2.projectKind) { case 2: - unorderedRemoveItem(this.externalProjects, project); - this.projectToSizeMap.delete(project.getProjectName()); + unorderedRemoveItem(this.externalProjects, project2); + this.projectToSizeMap.delete(project2.getProjectName()); break; case 1: - this.configuredProjects.delete(project.canonicalConfigFilePath); - this.projectToSizeMap.delete(project.canonicalConfigFilePath); + this.configuredProjects.delete(project2.canonicalConfigFilePath); + this.projectToSizeMap.delete(project2.canonicalConfigFilePath); break; case 0: - unorderedRemoveItem(this.inferredProjects, project); + unorderedRemoveItem(this.inferredProjects, project2); break; } } /** @internal */ assignOrphanScriptInfoToInferredProject(info, projectRootPath) { Debug.assert(info.isOrphan()); - const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) || this.getOrCreateSingleInferredProjectIfEnabled() || this.getOrCreateSingleInferredWithoutProjectRoot( + const project2 = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) || this.getOrCreateSingleInferredProjectIfEnabled() || this.getOrCreateSingleInferredWithoutProjectRoot( info.isDynamic ? projectRootPath || this.currentDirectory : getDirectoryPath( isRootedDiskPath(info.fileName) ? info.fileName : getNormalizedAbsolutePath( info.fileName, @@ -223448,15 +224374,15 @@ ${options.prefix}` : "\n" : options.prefix ) ) ); - project.addRoot(info); - if (info.containingProjects[0] !== project) { - orderedRemoveItem(info.containingProjects, project); - info.containingProjects.unshift(project); + project2.addRoot(info); + if (info.containingProjects[0] !== project2) { + orderedRemoveItem(info.containingProjects, project2); + info.containingProjects.unshift(project2); } - project.updateGraph(); - if (!this.useSingleInferredProject && !project.projectRootPath) { + project2.updateGraph(); + if (!this.useSingleInferredProject && !project2.projectRootPath) { for (const inferredProject of this.inferredProjects) { - if (inferredProject === project || inferredProject.isOrphan()) { + if (inferredProject === project2 || inferredProject.isOrphan()) { continue; } const roots = inferredProject.getRootScriptInfos(); @@ -223472,7 +224398,7 @@ ${options.prefix}` : "\n" : options.prefix } } } - return project; + return project2; } assignOrphanScriptInfosToInferredProject() { this.openFiles.forEach((projectRootPath, path) => { @@ -223833,7 +224759,7 @@ ${options.prefix}` : "\n" : options.prefix createExternalProject(projectFileName, files, options, typeAcquisition, excludedFiles) { const compilerOptions = convertCompilerOptions(options); const watchOptionsAndErrors = convertWatchOptions(options, getDirectoryPath(normalizeSlashes(projectFileName))); - const project = new ExternalProject( + const project2 = new ExternalProject( projectFileName, this, compilerOptions, @@ -223844,50 +224770,50 @@ ${options.prefix}` : "\n" : options.prefix void 0, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions ); - project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors); - project.excludedFiles = excludedFiles; - this.addFilesToNonInferredProject(project, files, externalFilePropertyReader, typeAcquisition); - this.externalProjects.push(project); - return project; + project2.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors); + project2.excludedFiles = excludedFiles; + this.addFilesToNonInferredProject(project2, files, externalFilePropertyReader, typeAcquisition); + this.externalProjects.push(project2); + return project2; } /** @internal */ - sendProjectTelemetry(project) { - if (this.seenProjects.has(project.projectName)) { - setProjectOptionsUsed(project); + sendProjectTelemetry(project2) { + if (this.seenProjects.has(project2.projectName)) { + setProjectOptionsUsed(project2); return; } - this.seenProjects.set(project.projectName, true); + this.seenProjects.set(project2.projectName, true); if (!this.eventHandler || !this.host.createSHA256Hash) { - setProjectOptionsUsed(project); + setProjectOptionsUsed(project2); return; } - const projectOptions = isConfiguredProject(project) ? project.projectOptions : void 0; - setProjectOptionsUsed(project); + const projectOptions = isConfiguredProject(project2) ? project2.projectOptions : void 0; + setProjectOptionsUsed(project2); const data = { - projectId: this.host.createSHA256Hash(project.projectName), + projectId: this.host.createSHA256Hash(project2.projectName), fileStats: countEachFileTypes( - project.getScriptInfos(), + project2.getScriptInfos(), /*includeSizes*/ true ), - compilerOptions: convertCompilerOptionsForTelemetry(project.getCompilationSettings()), - typeAcquisition: convertTypeAcquisition2(project.getTypeAcquisition()), + compilerOptions: convertCompilerOptionsForTelemetry(project2.getCompilationSettings()), + typeAcquisition: convertTypeAcquisition2(project2.getTypeAcquisition()), extends: projectOptions && projectOptions.configHasExtendsProperty, files: projectOptions && projectOptions.configHasFilesProperty, include: projectOptions && projectOptions.configHasIncludeProperty, exclude: projectOptions && projectOptions.configHasExcludeProperty, - compileOnSave: project.compileOnSaveEnabled, + compileOnSave: project2.compileOnSaveEnabled, configFileName: configFileName(), - projectType: project instanceof ExternalProject ? "external" : "configured", - languageServiceEnabled: project.languageServiceEnabled, + projectType: project2 instanceof ExternalProject ? "external" : "configured", + languageServiceEnabled: project2.languageServiceEnabled, version: version2 }; this.eventHandler({ eventName: ProjectInfoTelemetryEvent, data }); function configFileName() { - if (!isConfiguredProject(project)) { + if (!isConfiguredProject(project2)) { return "other"; } - return getBaseConfigFileName(project.getConfigFilePath()) || "other"; + return getBaseConfigFileName(project2.getConfigFilePath()) || "other"; } function convertTypeAcquisition2({ enable: enable2, include, exclude }) { return { @@ -223897,10 +224823,10 @@ ${options.prefix}` : "\n" : options.prefix }; } } - addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) { - this.updateNonInferredProjectFiles(project, files, propertyReader); - project.setTypeAcquisition(typeAcquisition); - project.markAsDirty(); + addFilesToNonInferredProject(project2, files, propertyReader, typeAcquisition) { + this.updateNonInferredProjectFiles(project2, files, propertyReader); + project2.setTypeAcquisition(typeAcquisition); + project2.markAsDirty(); } /** @internal */ createConfiguredProject(configFileName, reason) { @@ -223921,7 +224847,7 @@ ${options.prefix}` : "\n" : options.prefix /* Full */ }; } - const project = new ConfiguredProject2( + const project2 = new ConfiguredProject2( configFileName, canonicalConfigFilePath, this, @@ -223929,54 +224855,54 @@ ${options.prefix}` : "\n" : options.prefix reason ); Debug.assert(!this.configuredProjects.has(canonicalConfigFilePath)); - this.configuredProjects.set(canonicalConfigFilePath, project); - this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project); - return project; + this.configuredProjects.set(canonicalConfigFilePath, project2); + this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project2); + return project2; } /** * Read the config file of the project, and update the project root file names. */ - loadConfiguredProject(project, reason) { + loadConfiguredProject(project2, reason) { var _a3, _b; - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "loadConfiguredProject", { configFilePath: project.canonicalConfigFilePath }); - this.sendProjectLoadingStartEvent(project, reason); - const configFilename = toNormalizedPath(project.getConfigFilePath()); + (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "loadConfiguredProject", { configFilePath: project2.canonicalConfigFilePath }); + this.sendProjectLoadingStartEvent(project2, reason); + const configFilename = toNormalizedPath(project2.getConfigFilePath()); const configFileExistenceInfo = this.ensureParsedConfigUptoDate( configFilename, - project.canonicalConfigFilePath, - this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath), - project + project2.canonicalConfigFilePath, + this.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath), + project2 ); const parsedCommandLine = configFileExistenceInfo.config.parsedCommandLine; Debug.assert(!!parsedCommandLine.fileNames); const compilerOptions = parsedCommandLine.options; - if (!project.projectOptions) { - project.projectOptions = { + if (!project2.projectOptions) { + project2.projectOptions = { configHasExtendsProperty: parsedCommandLine.raw.extends !== void 0, configHasFilesProperty: parsedCommandLine.raw.files !== void 0, configHasIncludeProperty: parsedCommandLine.raw.include !== void 0, configHasExcludeProperty: parsedCommandLine.raw.exclude !== void 0 }; } - project.parsedCommandLine = parsedCommandLine; - project.setProjectErrors(parsedCommandLine.options.configFile.parseDiagnostics); - project.updateReferences(parsedCommandLine.projectReferences); - const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(project.canonicalConfigFilePath, compilerOptions, parsedCommandLine.fileNames, fileNamePropertyReader); + project2.parsedCommandLine = parsedCommandLine; + project2.setProjectErrors(parsedCommandLine.options.configFile.parseDiagnostics); + project2.updateReferences(parsedCommandLine.projectReferences); + const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(project2.canonicalConfigFilePath, compilerOptions, parsedCommandLine.fileNames, fileNamePropertyReader); if (lastFileExceededProgramSize) { - project.disableLanguageService(lastFileExceededProgramSize); - this.configFileExistenceInfoCache.forEach((_configFileExistenceInfo, canonicalConfigFilePath) => this.stopWatchingWildCards(canonicalConfigFilePath, project)); + project2.disableLanguageService(lastFileExceededProgramSize); + this.configFileExistenceInfoCache.forEach((_configFileExistenceInfo, canonicalConfigFilePath) => this.stopWatchingWildCards(canonicalConfigFilePath, project2)); } else { - project.setCompilerOptions(compilerOptions); - project.setWatchOptions(parsedCommandLine.watchOptions); - project.enableLanguageService(); - this.watchWildcards(configFilename, configFileExistenceInfo, project); + project2.setCompilerOptions(compilerOptions); + project2.setWatchOptions(parsedCommandLine.watchOptions); + project2.enableLanguageService(); + this.watchWildcards(configFilename, configFileExistenceInfo, project2); } - project.enablePluginsWithOptions(compilerOptions); - const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles( + project2.enablePluginsWithOptions(compilerOptions); + const filesToAdd = parsedCommandLine.fileNames.concat(project2.getExternalFiles( 2 /* Full */ )); - this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions); + this.updateRootAndOptionsOfNonInferredProject(project2, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions); (_b = tracing) == null ? void 0 : _b.pop(); } /** @internal */ @@ -224107,21 +225033,21 @@ ${options.prefix}` : "\n" : options.prefix } configFileExistenceInfo.config.watchedDirectoriesStale = void 0; } - updateNonInferredProjectFiles(project, files, propertyReader) { + updateNonInferredProjectFiles(project2, files, propertyReader) { var _a3; - const projectRootFilesMap = project.getRootFilesMap(); + const projectRootFilesMap = project2.getRootFilesMap(); const newRootScriptInfoMap = /* @__PURE__ */ new Map(); for (const f of files) { const newRootFile = propertyReader.getFileName(f); const fileName = toNormalizedPath(newRootFile); const isDynamic = isDynamicFileName(fileName); let path; - if (!isDynamic && !project.fileExists(newRootFile)) { + if (!isDynamic && !project2.fileExists(newRootFile)) { path = normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName); const existingValue = projectRootFilesMap.get(path); if (existingValue) { if (((_a3 = existingValue.info) == null ? void 0 : _a3.path) === path) { - project.removeFile( + project2.removeFile( existingValue.info, /*fileExists*/ false, @@ -224139,17 +225065,17 @@ ${options.prefix}` : "\n" : options.prefix const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); const scriptInfo = Debug.checkDefined(this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath( fileName, - project.currentDirectory, + project2.currentDirectory, scriptKind, hasMixedContent, - project.directoryStructureHost, + project2.directoryStructureHost, /*deferredDeleteOk*/ false )); path = scriptInfo.path; const existingValue = projectRootFilesMap.get(path); if (!existingValue || existingValue.info !== scriptInfo) { - project.addRoot(scriptInfo, fileName); + project2.addRoot(scriptInfo, fileName); if (scriptInfo.isScriptOpen()) { this.removeRootOfInferredProjectIfNowPartOfOtherProject(scriptInfo); } @@ -224163,9 +225089,9 @@ ${options.prefix}` : "\n" : options.prefix projectRootFilesMap.forEach((value, path) => { if (!newRootScriptInfoMap.has(path)) { if (value.info) { - project.removeFile( + project2.removeFile( value.info, - project.fileExists(value.info.fileName), + project2.fileExists(value.info.fileName), /*detachFromProject*/ true ); @@ -224176,32 +225102,32 @@ ${options.prefix}` : "\n" : options.prefix }); } } - updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) { - project.setCompilerOptions(newOptions); - project.setWatchOptions(watchOptions); + updateRootAndOptionsOfNonInferredProject(project2, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) { + project2.setCompilerOptions(newOptions); + project2.setWatchOptions(watchOptions); if (compileOnSave !== void 0) { - project.compileOnSaveEnabled = compileOnSave; + project2.compileOnSaveEnabled = compileOnSave; } - this.addFilesToNonInferredProject(project, newUncheckedFiles, propertyReader, newTypeAcquisition); + this.addFilesToNonInferredProject(project2, newUncheckedFiles, propertyReader, newTypeAcquisition); } /** * Reload the file names from config file specs and update the project graph * * @internal */ - reloadFileNamesOfConfiguredProject(project) { - const config2 = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config); - project.updateErrorOnNoInputFiles(config2); + reloadFileNamesOfConfiguredProject(project2) { + const config2 = this.reloadFileNamesOfParsedConfig(project2.getConfigFilePath(), this.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath).config); + project2.updateErrorOnNoInputFiles(config2); this.updateNonInferredProjectFiles( - project, - config2.fileNames.concat(project.getExternalFiles( + project2, + config2.fileNames.concat(project2.getExternalFiles( 1 /* RootNamesAndUpdate */ )), fileNamePropertyReader ); - project.markAsDirty(); - return project.updateGraph(); + project2.markAsDirty(); + return project2.updateGraph(); } reloadFileNamesOfParsedConfig(configFileName, config2) { if (config2.updateLevel === void 0) return config2.parsedCommandLine; @@ -224222,79 +225148,79 @@ ${options.prefix}` : "\n" : options.prefix return config2.parsedCommandLine; } /** @internal */ - setFileNamesOfAutoImportProviderOrAuxillaryProject(project, fileNames) { - this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader); + setFileNamesOfAutoImportProviderOrAuxillaryProject(project2, fileNames) { + this.updateNonInferredProjectFiles(project2, fileNames, fileNamePropertyReader); } /** @internal */ - reloadConfiguredProjectOptimized(project, reason, reloadedProjects) { - if (reloadedProjects.has(project)) return; + reloadConfiguredProjectOptimized(project2, reason, reloadedProjects) { + if (reloadedProjects.has(project2)) return; reloadedProjects.set( - project, + project2, 6 /* ReloadOptimized */ ); - if (!project.initialLoadPending) { - this.setProjectForReload(project, 2, reason); + if (!project2.initialLoadPending) { + this.setProjectForReload(project2, 2, reason); } } /** @internal */ - reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects) { - if (reloadedProjects.get(project) === 7) return false; + reloadConfiguredProjectClearingSemanticCache(project2, reason, reloadedProjects) { + if (reloadedProjects.get(project2) === 7) return false; reloadedProjects.set( - project, + project2, 7 /* Reload */ ); - this.clearSemanticCache(project); - this.reloadConfiguredProject(project, reloadReason(reason)); + this.clearSemanticCache(project2); + this.reloadConfiguredProject(project2, reloadReason(reason)); return true; } - setProjectForReload(project, updateLevel, reason) { - if (updateLevel === 2) this.clearSemanticCache(project); - project.pendingUpdateReason = reason && reloadReason(reason); - project.pendingUpdateLevel = updateLevel; + setProjectForReload(project2, updateLevel, reason) { + if (updateLevel === 2) this.clearSemanticCache(project2); + project2.pendingUpdateReason = reason && reloadReason(reason); + project2.pendingUpdateLevel = updateLevel; } /** * Read the config file of the project again by clearing the cache and update the project graph * * @internal */ - reloadConfiguredProject(project, reason) { - project.initialLoadPending = false; + reloadConfiguredProject(project2, reason) { + project2.initialLoadPending = false; this.setProjectForReload( - project, + project2, 0 /* Update */ ); - this.loadConfiguredProject(project, reason); + this.loadConfiguredProject(project2, reason); updateWithTriggerFile( - project, - project.triggerFileForConfigFileDiag ?? project.getConfigFilePath(), + project2, + project2.triggerFileForConfigFileDiag ?? project2.getConfigFilePath(), /*isReload*/ true ); } - clearSemanticCache(project) { - project.originalConfiguredProjects = void 0; - project.resolutionCache.clear(); - project.getLanguageService( + clearSemanticCache(project2) { + project2.originalConfiguredProjects = void 0; + project2.resolutionCache.clear(); + project2.getLanguageService( /*ensureSynchronized*/ false ).cleanupSemanticCache(); - project.cleanupProgram(); - project.markAsDirty(); + project2.cleanupProgram(); + project2.markAsDirty(); } /** @internal */ - sendConfigFileDiagEvent(project, triggerFile, force) { + sendConfigFileDiagEvent(project2, triggerFile, force) { if (!this.eventHandler || this.suppressDiagnosticEvents) return false; - const diagnostics = project.getLanguageService().getCompilerOptionsDiagnostics(); - diagnostics.push(...project.getAllProjectErrors()); - if (!force && diagnostics.length === (project.configDiagDiagnosticsReported ?? 0)) return false; - project.configDiagDiagnosticsReported = diagnostics.length; + const diagnostics = project2.getLanguageService().getCompilerOptionsDiagnostics(); + diagnostics.push(...project2.getAllProjectErrors()); + if (!force && diagnostics.length === (project2.configDiagDiagnosticsReported ?? 0)) return false; + project2.configDiagDiagnosticsReported = diagnostics.length; this.eventHandler( { eventName: ConfigFileDiagEvent, - data: { configFileName: project.getConfigFilePath(), diagnostics, triggerFile: triggerFile ?? project.getConfigFilePath() } + data: { configFileName: project2.getConfigFilePath(), diagnostics, triggerFile: triggerFile ?? project2.getConfigFilePath() } } ); return true; @@ -224306,9 +225232,9 @@ ${options.prefix}` : "\n" : options.prefix } if (projectRootPath) { const canonicalProjectRootPath = this.toCanonicalFileName(projectRootPath); - for (const project of this.inferredProjects) { - if (project.projectRootPath === canonicalProjectRootPath) { - return project; + for (const project2 of this.inferredProjects) { + if (project2.projectRootPath === canonicalProjectRootPath) { + return project2; } } return this.createInferredProject( @@ -224319,11 +225245,11 @@ ${options.prefix}` : "\n" : options.prefix ); } let bestMatch; - for (const project of this.inferredProjects) { - if (!project.projectRootPath) continue; - if (!containsPath(project.projectRootPath, info.path, this.host.getCurrentDirectory(), !this.host.useCaseSensitiveFileNames)) continue; - if (bestMatch && bestMatch.projectRootPath.length > project.projectRootPath.length) continue; - bestMatch = project; + for (const project2 of this.inferredProjects) { + if (!project2.projectRootPath) continue; + if (!containsPath(project2.projectRootPath, info.path, this.host.getCurrentDirectory(), !this.host.useCaseSensitiveFileNames)) continue; + if (bestMatch && bestMatch.projectRootPath.length > project2.projectRootPath.length) continue; + bestMatch = project2; } return bestMatch; } @@ -224373,7 +225299,7 @@ ${options.prefix}` : "\n" : options.prefix typeAcquisition = this.typeAcquisitionForInferredProjects; } watchOptionsAndErrors = watchOptionsAndErrors || void 0; - const project = new InferredProject2( + const project2 = new InferredProject2( this, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, @@ -224381,13 +225307,13 @@ ${options.prefix}` : "\n" : options.prefix currentDirectory, typeAcquisition ); - project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors); + project2.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors); if (isSingleInferredProject) { - this.inferredProjects.unshift(project); + this.inferredProjects.unshift(project2); } else { - this.inferredProjects.push(project); + this.inferredProjects.push(project2); } - return project; + return project2; } /** @internal */ getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName, currentDirectory, hostToQueryFileExistsOn, deferredDeleteOk) { @@ -224447,13 +225373,13 @@ All files are: ${JSON.stringify(names)}`, return projects; function combineProjects(toAddInfo) { if (toAddInfo !== info) { - for (const project of toAddInfo.containingProjects) { - if (project.languageServiceEnabled && !project.isOrphan() && !project.getCompilerOptions().preserveSymlinks && !info.isAttached(project)) { + for (const project2 of toAddInfo.containingProjects) { + if (project2.languageServiceEnabled && !project2.isOrphan() && !project2.getCompilerOptions().preserveSymlinks && !info.isAttached(project2)) { if (!projects) { projects = createMultiMap(); - projects.add(toAddInfo.path, project); - } else if (!forEachEntry(projects, (projs, path) => path === toAddInfo.path ? false : contains(projs, project))) { - projects.add(toAddInfo.path, project); + projects.add(toAddInfo.path, project2); + } else if (!forEachEntry(projects, (projs, path) => path === toAddInfo.path ? false : contains(projs, project2))) { + projects.add(toAddInfo.path, project2); } } } @@ -224485,11 +225411,11 @@ All files are: ${JSON.stringify(names)}`, var _a3; const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory)); if (!fileOrDirectoryPath) return; - const basename4 = getBaseFileName(fileOrDirectoryPath); - if (((_a3 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.size) && (basename4 === "package.json" || basename4 === "node_modules")) { - result.affectedModuleSpecifierCacheProjects.forEach((project) => { + const basename6 = getBaseFileName(fileOrDirectoryPath); + if (((_a3 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.size) && (basename6 === "package.json" || basename6 === "node_modules")) { + result.affectedModuleSpecifierCacheProjects.forEach((project2) => { var _a22; - (_a22 = project.getModuleSpecifierCache()) == null ? void 0 : _a22.clear(); + (_a22 = project2.getModuleSpecifierCache()) == null ? void 0 : _a22.clear(); }); } if (result.refreshScriptInfoRefCount) { @@ -224527,16 +225453,16 @@ All files are: ${JSON.stringify(names)}`, return result; } /** @internal */ - watchPackageJsonsInNodeModules(dir, project) { + watchPackageJsonsInNodeModules(dir, project2) { var _a3; const dirPath = this.toPath(dir); const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath); - Debug.assert(!((_a3 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.has(project))); - (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project); + Debug.assert(!((_a3 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.has(project2))); + (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project2); return { close: () => { var _a22; - (_a22 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a22.delete(project); + (_a22 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a22.delete(project2); watcher.close(); } }; @@ -224662,17 +225588,17 @@ Dynamic files must always be opened with service's current directory or service return !info || !info.deferredDelete ? info : void 0; } /** @internal */ - getDocumentPositionMapper(project, generatedFileName, sourceFileName) { + getDocumentPositionMapper(project2, generatedFileName, sourceFileName) { const declarationInfo = this.getOrCreateScriptInfoNotOpenedByClient( generatedFileName, - project.currentDirectory, + project2.currentDirectory, this.host, /*deferredDeleteOk*/ false ); if (!declarationInfo) { if (sourceFileName) { - project.addGeneratedFileWatch(generatedFileName, sourceFileName); + project2.addGeneratedFileWatch(generatedFileName, sourceFileName); } return void 0; } @@ -224682,13 +225608,13 @@ Dynamic files must always be opened with service's current directory or service if (sourceMapFileInfo2) { sourceMapFileInfo2.getSnapshot(); if (sourceMapFileInfo2.documentPositionMapper !== void 0) { - sourceMapFileInfo2.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project, sourceMapFileInfo2.sourceInfos); + sourceMapFileInfo2.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project2, sourceMapFileInfo2.sourceInfos); return sourceMapFileInfo2.documentPositionMapper ? sourceMapFileInfo2.documentPositionMapper : void 0; } } declarationInfo.sourceMapFilePath = void 0; } else if (declarationInfo.sourceMapFilePath) { - declarationInfo.sourceMapFilePath.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project, declarationInfo.sourceMapFilePath.sourceInfos); + declarationInfo.sourceMapFilePath.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project2, declarationInfo.sourceMapFilePath.sourceInfos); return void 0; } else if (declarationInfo.sourceMapFilePath !== void 0) { return void 0; @@ -224697,7 +225623,7 @@ Dynamic files must always be opened with service's current directory or service let readMapFile = (mapFileName, mapFileNameFromDts) => { const mapInfo = this.getOrCreateScriptInfoNotOpenedByClient( mapFileName, - project.currentDirectory, + project2.currentDirectory, this.host, /*deferredDeleteOk*/ true @@ -224708,7 +225634,7 @@ Dynamic files must always be opened with service's current directory or service if (mapInfo.documentPositionMapper !== void 0) return mapInfo.documentPositionMapper; return getSnapshotText(snap); }; - const projectName = project.projectName; + const projectName = project2.projectName; const documentPositionMapper = getDocumentPositionMapper( { getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) }, declarationInfo.fileName, @@ -224721,14 +225647,14 @@ Dynamic files must always be opened with service's current directory or service declarationInfo.sourceMapFilePath = sourceMapFileInfo.path; sourceMapFileInfo.declarationInfoPath = declarationInfo.path; if (!sourceMapFileInfo.deferredDelete) sourceMapFileInfo.documentPositionMapper = documentPositionMapper || false; - sourceMapFileInfo.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project, sourceMapFileInfo.sourceInfos); + sourceMapFileInfo.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project2, sourceMapFileInfo.sourceInfos); } else { declarationInfo.sourceMapFilePath = { watcher: this.addMissingSourceMapFile( - project.currentDirectory === this.currentDirectory ? sourceMapFileInfo : getNormalizedAbsolutePath(sourceMapFileInfo, project.currentDirectory), + project2.currentDirectory === this.currentDirectory ? sourceMapFileInfo : getNormalizedAbsolutePath(sourceMapFileInfo, project2.currentDirectory), declarationInfo.path ), - sourceInfos: this.addSourceInfoToSourceMap(sourceFileName, project) + sourceInfos: this.addSourceInfoToSourceMap(sourceFileName, project2) }; } } else { @@ -224736,12 +225662,12 @@ Dynamic files must always be opened with service's current directory or service } return documentPositionMapper; } - addSourceInfoToSourceMap(sourceFileName, project, sourceInfos) { + addSourceInfoToSourceMap(sourceFileName, project2, sourceInfos) { if (sourceFileName) { const sourceInfo = this.getOrCreateScriptInfoNotOpenedByClient( sourceFileName, - project.currentDirectory, - project.directoryStructureHost, + project2.currentDirectory, + project2.directoryStructureHost, /*deferredDeleteOk*/ false ); @@ -224772,16 +225698,16 @@ Dynamic files must always be opened with service's current directory or service } /** @internal */ getSourceFileLike(fileName, projectNameOrProject, declarationInfo) { - const project = projectNameOrProject.projectName ? projectNameOrProject : this.findProject(projectNameOrProject); - if (project) { - const path = project.toPath(fileName); - const sourceFile = project.getSourceFile(path); + const project2 = projectNameOrProject.projectName ? projectNameOrProject : this.findProject(projectNameOrProject); + if (project2) { + const path = project2.toPath(fileName); + const sourceFile = project2.getSourceFile(path); if (sourceFile && sourceFile.resolvedPath === path) return sourceFile; } const info = this.getOrCreateScriptInfoNotOpenedByClient( fileName, - (project || this).currentDirectory, - project ? project.directoryStructureHost : this.host, + (project2 || this).currentDirectory, + project2 ? project2.directoryStructureHost : this.host, /*deferredDeleteOk*/ false ); @@ -224838,16 +225764,16 @@ Dynamic files must always be opened with service's current directory or service this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences }; if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) { this.externalProjectToConfiguredProjectMap.forEach( - (projects) => projects.forEach((project) => { - if (!project.deferredClose && !project.isClosed() && project.pendingUpdateLevel === 2 && !this.hasPendingProjectUpdate(project)) { - project.updateGraph(); + (projects) => projects.forEach((project2) => { + if (!project2.deferredClose && !project2.isClosed() && project2.pendingUpdateLevel === 2 && !this.hasPendingProjectUpdate(project2)) { + project2.updateGraph(); } }) ); } if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports || !!includeCompletionsForModuleExports !== !!args.preferences.includeCompletionsForModuleExports) { - this.forEachProject((project) => { - project.onAutoImportProviderSettingsChanged(); + this.forEachProject((project2) => { + project2.onAutoImportProviderSettingsChanged(); }); } } @@ -224866,8 +225792,8 @@ Dynamic files must always be opened with service's current directory or service } } /** @internal */ - getWatchOptions(project) { - return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions(), project.getCurrentDirectory()); + getWatchOptions(project2) { + return this.getWatchOptionsFromProjectWatchOptions(project2.getWatchOptions(), project2.getCurrentDirectory()); } getWatchOptionsFromProjectWatchOptions(projectOptions, basePath) { const hostWatchOptions = !this.hostConfiguration.beforeSubstitution ? this.hostConfiguration.watchOptions : handleWatchOptionsConfigDirTemplateSubstitution( @@ -224922,20 +225848,20 @@ Dynamic files must always be opened with service's current directory or service } }); this.configFileForOpenFiles.clear(); - this.externalProjects.forEach((project) => { - this.clearSemanticCache(project); - project.updateGraph(); + this.externalProjects.forEach((project2) => { + this.clearSemanticCache(project2); + project2.updateGraph(); }); const reloadedConfiguredProjects = /* @__PURE__ */ new Map(); const delayReloadedConfiguredProjects = /* @__PURE__ */ new Set(); this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => { const reason = `Reloading configured project in external project: ${externalProjectName}`; - projects.forEach((project) => { + projects.forEach((project2) => { if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) { - this.reloadConfiguredProjectOptimized(project, reason, reloadedConfiguredProjects); + this.reloadConfiguredProjectOptimized(project2, reason, reloadedConfiguredProjects); } else { this.reloadConfiguredProjectClearingSemanticCache( - project, + project2, reason, reloadedConfiguredProjects ); @@ -224957,7 +225883,7 @@ Dynamic files must always be opened with service's current directory or service 7 /* Reload */ )); - this.inferredProjects.forEach((project) => this.clearSemanticCache(project)); + this.inferredProjects.forEach((project2) => this.clearSemanticCache(project2)); this.ensureProjectForOpenFiles(); this.cleanupProjectsAndScriptInfos( reloadedConfiguredProjects, @@ -225031,9 +225957,9 @@ Dynamic files must always be opened with service's current directory or service ); } /** @internal */ - getOriginalLocationEnsuringConfiguredProject(project, location) { - const isSourceOfProjectReferenceRedirect = project.isSourceOfProjectReferenceRedirect(location.fileName); - const originalLocation = isSourceOfProjectReferenceRedirect ? location : project.getSourceMapper().tryGetSourcePosition(location); + getOriginalLocationEnsuringConfiguredProject(project2, location) { + const isSourceOfProjectReferenceRedirect = project2.isSourceOfProjectReferenceRedirect(location.fileName); + const originalLocation = isSourceOfProjectReferenceRedirect ? location : project2.getSourceMapper().tryGetSourcePosition(location); if (!originalLocation) return void 0; const { fileName } = originalLocation; const scriptInfo = this.getScriptInfo(fileName); @@ -225047,7 +225973,7 @@ Dynamic files must always be opened with service's current directory or service if (!configFileName) return void 0; let configuredProject = this.findConfiguredProjectByProjectName(configFileName); if (!configuredProject) { - if (project.getCompilerOptions().disableReferencedProjectLoad) { + if (project2.getCompilerOptions().disableReferencedProjectLoad) { if (isSourceOfProjectReferenceRedirect) { return location; } @@ -225063,21 +225989,21 @@ Dynamic files must always be opened with service's current directory or service 4 /* CreateOptimized */ ), - (project2) => `Creating project referenced in solution ${project2.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}` + (project22) => `Creating project referenced in solution ${project22.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}` ); if (!result.defaultProject) return void 0; - if (result.defaultProject === project) return originalLocation; + if (result.defaultProject === project2) return originalLocation; addOriginalConfiguredProject(result.defaultProject); const originalScriptInfo = this.getScriptInfo(fileName); if (!originalScriptInfo || !originalScriptInfo.containingProjects.length) return void 0; - originalScriptInfo.containingProjects.forEach((project2) => { - if (isConfiguredProject(project2)) { - addOriginalConfiguredProject(project2); + originalScriptInfo.containingProjects.forEach((project22) => { + if (isConfiguredProject(project22)) { + addOriginalConfiguredProject(project22); } }); return originalLocation; function addOriginalConfiguredProject(originalProject) { - (project.originalConfiguredProjects ?? (project.originalConfiguredProjects = /* @__PURE__ */ new Set())).add(originalProject.canonicalConfigFilePath); + (project2.originalConfiguredProjects ?? (project2.originalConfiguredProjects = /* @__PURE__ */ new Set())).add(originalProject.canonicalConfigFilePath); } } /** @internal */ @@ -225110,10 +226036,10 @@ Dynamic files must always be opened with service's current directory or service assignProjectToOpenedScriptInfo(info) { let configFileName; let configFileErrors; - const project = this.findExternalProjectContainingOpenScriptInfo(info); + const project2 = this.findExternalProjectContainingOpenScriptInfo(info); let retainProjects; let sentConfigDiag; - if (!project && this.serverMode === 0) { + if (!project2 && this.serverMode === 0) { const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo( info, 5 @@ -225130,9 +226056,9 @@ Dynamic files must always be opened with service's current directory or service } info.containingProjects.forEach(updateProjectIfDirty); if (info.isOrphan()) { - retainProjects == null ? void 0 : retainProjects.forEach((kind, project2) => { - if (kind !== 4 && !sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent( - project2, + retainProjects == null ? void 0 : retainProjects.forEach((kind, project22) => { + if (kind !== 4 && !sentConfigDiag.has(project22)) this.sendConfigFileDiagEvent( + project22, info.fileName, /*force*/ true @@ -225152,48 +226078,48 @@ Dynamic files must always be opened with service's current directory or service * @internal */ findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects, projectForConfigFile) { - let project = projectForConfigFile ?? this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed); + let project2 = projectForConfigFile ?? this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed); let sentConfigFileDiag = false; let configFileExistenceInfo; switch (kind) { case 0: case 1: case 3: - if (!project) return; + if (!project2) return; break; case 2: - if (!project) return; - configFileExistenceInfo = configFileExistenceInfoForOptimizedReplay(project); + if (!project2) return; + configFileExistenceInfo = configFileExistenceInfoForOptimizedReplay(project2); break; case 4: case 5: - project ?? (project = this.createConfiguredProject(configFileName, reason)); + project2 ?? (project2 = this.createConfiguredProject(configFileName, reason)); if (!delayLoad) { ({ sentConfigFileDiag, configFileExistenceInfo } = updateProjectFoundUsingFind( - project, + project2, kind, triggerFile )); } break; case 6: - project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason))); - project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects); - configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project); + project2 ?? (project2 = this.createConfiguredProject(configFileName, reloadReason(reason))); + project2.projectService.reloadConfiguredProjectOptimized(project2, reason, reloadedProjects); + configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project2); if (configFileExistenceInfo) break; // falls through case 7: - project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason))); - sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects); - if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project) && !reloadedProjects.has(project)) { - this.setProjectForReload(project, 2, reason); - delayReloadedConfiguredProjects.add(project); + project2 ?? (project2 = this.createConfiguredProject(configFileName, reloadReason(reason))); + sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project2, reason, reloadedProjects); + if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project2) && !reloadedProjects.has(project2)) { + this.setProjectForReload(project2, 2, reason); + delayReloadedConfiguredProjects.add(project2); } break; default: Debug.assertNever(kind); } - return { project, sentConfigFileDiag, configFileExistenceInfo, reason }; + return { project: project2, sentConfigFileDiag, configFileExistenceInfo, reason }; } /** * Finds the default configured project for given info @@ -225220,7 +226146,7 @@ Dynamic files must always be opened with service's current directory or service info, kind, result, - (project) => `Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`, + (project2) => `Creating project referenced in solution ${project2.projectName} to find possible configured project for ${info.fileName} to open`, allowDeferredClosed, reloadedProjects ); @@ -225269,10 +226195,10 @@ Dynamic files must always be opened with service's current directory or service function tryFindDefaultConfiguredProject(result) { return isDefaultProjectOptimized(result, result.project) ?? tryFindDefaultConfiguredProjectFromReferences(result.project) ?? tryFindDefaultConfiguredProjectFromAncestor(result.project); } - function isDefaultConfigFileExistenceInfo(configFileExistenceInfo, project, childConfigName, reason, tsconfigProject, canonicalConfigFilePath) { - if (project) { - if (seenProjects.has(project)) return; - seenProjects.set(project, optimizedKind); + function isDefaultConfigFileExistenceInfo(configFileExistenceInfo, project2, childConfigName, reason, tsconfigProject, canonicalConfigFilePath) { + if (project2) { + if (seenProjects.has(project2)) return; + seenProjects.set(project2, optimizedKind); } else { if (seenConfigs == null ? void 0 : seenConfigs.has(canonicalConfigFilePath)) return; (seenConfigs ?? (seenConfigs = /* @__PURE__ */ new Set())).add(canonicalConfigFilePath); @@ -225291,8 +226217,8 @@ Dynamic files must always be opened with service's current directory or service } return; } - const result = project ? updateProjectFoundUsingFind( - project, + const result = project2 ? updateProjectFoundUsingFind( + project2, kind, info.fileName, reason, @@ -225316,18 +226242,18 @@ Dynamic files must always be opened with service's current directory or service if (result.sentConfigFileDiag) sentConfigDiag.add(result.project); return isDefaultProject(result.project, tsconfigProject); } - function isDefaultProject(project, tsconfigProject) { - if (seenProjects.get(project) === kind) return; - seenProjects.set(project, kind); - const scriptInfo = infoIsOpenScriptInfo ? info : project.projectService.getScriptInfo(info.fileName); - const projectWithInfo = scriptInfo && project.containsScriptInfo(scriptInfo); - if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(scriptInfo.path)) { + function isDefaultProject(project2, tsconfigProject) { + if (seenProjects.get(project2) === kind) return; + seenProjects.set(project2, kind); + const scriptInfo = infoIsOpenScriptInfo ? info : project2.projectService.getScriptInfo(info.fileName); + const projectWithInfo = scriptInfo && project2.containsScriptInfo(scriptInfo); + if (projectWithInfo && !project2.isSourceOfProjectReferenceRedirect(scriptInfo.path)) { tsconfigOfDefault = tsconfigProject; - return defaultProject = project; + return defaultProject = project2; } if (!possiblyDefault && infoIsOpenScriptInfo && projectWithInfo) { tsconfigOfPossiblyDefault = tsconfigProject; - possiblyDefault = project; + possiblyDefault = project2; } } function isDefaultProjectOptimized(result, tsconfigProject) { @@ -225341,22 +226267,22 @@ Dynamic files must always be opened with service's current directory or service result.project.canonicalConfigFilePath ) : isDefaultProject(result.project, tsconfigProject); } - function tryFindDefaultConfiguredProjectFromReferences(project) { - return project.parsedCommandLine && forEachResolvedProjectReferenceProjectLoad( - project, - project.parsedCommandLine, + function tryFindDefaultConfiguredProjectFromReferences(project2) { + return project2.parsedCommandLine && forEachResolvedProjectReferenceProjectLoad( + project2, + project2.parsedCommandLine, isDefaultConfigFileExistenceInfo, optimizedKind, - referencedProjectReason(project), + referencedProjectReason(project2), allowDeferredClosed, reloadedProjects ); } - function tryFindDefaultConfiguredProjectFromAncestor(project) { + function tryFindDefaultConfiguredProjectFromAncestor(project2) { return infoIsOpenScriptInfo ? forEachAncestorProjectLoad( // If not in referenced projects, try ancestors and its references info, - project, + project2, tryFindDefaultConfiguredProject, optimizedKind, `Creating possible configured project for ${info.fileName} to open`, @@ -225398,22 +226324,22 @@ Dynamic files must always be opened with service's current directory or service /** @internal */ loadAncestorProjectTree(forProjects) { forProjects ?? (forProjects = new Set( - mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.initialLoadPending ? key : void 0) + mapDefinedIterator(this.configuredProjects.entries(), ([key, project2]) => !project2.initialLoadPending ? key : void 0) )); const seenProjects = /* @__PURE__ */ new Set(); const currentConfiguredProjects = arrayFrom(this.configuredProjects.values()); - for (const project of currentConfiguredProjects) { - if (forEachPotentialProjectReference(project, (potentialRefPath) => forProjects.has(potentialRefPath))) { - updateProjectIfDirty(project); + for (const project2 of currentConfiguredProjects) { + if (forEachPotentialProjectReference(project2, (potentialRefPath) => forProjects.has(potentialRefPath))) { + updateProjectIfDirty(project2); } - this.ensureProjectChildren(project, forProjects, seenProjects); + this.ensureProjectChildren(project2, forProjects, seenProjects); } } - ensureProjectChildren(project, forProjects, seenProjects) { + ensureProjectChildren(project2, forProjects, seenProjects) { var _a3; - if (!tryAddToSet(seenProjects, project.canonicalConfigFilePath)) return; - if (project.getCompilerOptions().disableReferencedProjectLoad) return; - const children = (_a3 = project.getCurrentProgram()) == null ? void 0 : _a3.getResolvedProjectReferences(); + if (!tryAddToSet(seenProjects, project2.canonicalConfigFilePath)) return; + if (project2.getCompilerOptions().disableReferencedProjectLoad) return; + const children = (_a3 = project2.getCurrentProgram()) == null ? void 0 : _a3.getResolvedProjectReferences(); if (!children) return; for (const child of children) { if (!child) continue; @@ -225422,7 +226348,7 @@ Dynamic files must always be opened with service's current directory or service const configFileName = toNormalizedPath(child.sourceFile.fileName); const childProject = this.findConfiguredProjectByProjectName(configFileName) ?? this.createConfiguredProject( configFileName, - `Creating project referenced by : ${project.projectName} as it references project ${referencedProject.sourceFile.fileName}` + `Creating project referenced by : ${project2.projectName} as it references project ${referencedProject.sourceFile.fileName}` ); updateProjectIfDirty(childProject); this.ensureProjectChildren(childProject, forProjects, seenProjects); @@ -225433,7 +226359,7 @@ Dynamic files must always be opened with service's current directory or service toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects - ).forEach((project) => this.removeProject(project)); + ).forEach((project2) => this.removeProject(project2)); } cleanupProjectsAndScriptInfos(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) { this.cleanupConfiguredProjects( @@ -225494,17 +226420,17 @@ Dynamic files must always be opened with service's current directory or service /** @internal */ getOrphanConfiguredProjects(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) { const toRemoveConfiguredProjects = new Set(this.configuredProjects.values()); - const markOriginalProjectsAsUsed = (project) => { - if (project.originalConfiguredProjects && (isConfiguredProject(project) || !project.isOrphan())) { - project.originalConfiguredProjects.forEach( + const markOriginalProjectsAsUsed = (project2) => { + if (project2.originalConfiguredProjects && (isConfiguredProject(project2) || !project2.isOrphan())) { + project2.originalConfiguredProjects.forEach( (_value, configuredProjectPath) => { - const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(configuredProjectPath); - return project2 && retainConfiguredProject(project2); + const project22 = this.getConfiguredProjectByCanonicalConfigFilePath(configuredProjectPath); + return project22 && retainConfiguredProject(project22); } ); } }; - toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach((_, project) => retainConfiguredProject(project)); + toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach((_, project2) => retainConfiguredProject(project2)); if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects; this.inferredProjects.forEach(markOriginalProjectsAsUsed); this.externalProjects.forEach(markOriginalProjectsAsUsed); @@ -225524,31 +226450,31 @@ Dynamic files must always be opened with service's current directory or service /* Find */ ); if (result == null ? void 0 : result.defaultProject) { - result == null ? void 0 : result.seenProjects.forEach((_, project) => retainConfiguredProject(project)); + result == null ? void 0 : result.seenProjects.forEach((_, project2) => retainConfiguredProject(project2)); if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects; } }); if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects; - forEachEntry(this.configuredProjects, (project) => { - if (toRemoveConfiguredProjects.has(project)) { - if (isPendingUpdate(project) || forEachReferencedProject(project, isRetained)) { - retainConfiguredProject(project); + forEachEntry(this.configuredProjects, (project2) => { + if (toRemoveConfiguredProjects.has(project2)) { + if (isPendingUpdate(project2) || forEachReferencedProject(project2, isRetained)) { + retainConfiguredProject(project2); if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects; } } }); return toRemoveConfiguredProjects; - function isRetained(project) { - return !toRemoveConfiguredProjects.has(project) || isPendingUpdate(project); + function isRetained(project2) { + return !toRemoveConfiguredProjects.has(project2) || isPendingUpdate(project2); } - function isPendingUpdate(project) { + function isPendingUpdate(project2) { var _a3, _b; - return (project.deferredClose || project.projectService.hasPendingProjectUpdate(project)) && !!((_b = (_a3 = project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath)) == null ? void 0 : _a3.openFilesImpactedByConfigFile) == null ? void 0 : _b.size); + return (project2.deferredClose || project2.projectService.hasPendingProjectUpdate(project2)) && !!((_b = (_a3 = project2.projectService.configFileExistenceInfoCache.get(project2.canonicalConfigFilePath)) == null ? void 0 : _a3.openFilesImpactedByConfigFile) == null ? void 0 : _b.size); } - function retainConfiguredProject(project) { - if (!toRemoveConfiguredProjects.delete(project)) return; - markOriginalProjectsAsUsed(project); - forEachReferencedProject(project, retainConfiguredProject); + function retainConfiguredProject(project2) { + if (!toRemoveConfiguredProjects.delete(project2)) return; + markOriginalProjectsAsUsed(project2); + forEachReferencedProject(project2, retainConfiguredProject); } } removeOrphanScriptInfos() { @@ -225600,11 +226526,11 @@ Dynamic files must always be opened with service's current directory or service if (this.serverMode !== 0 || !this.eventHandler || !scriptInfo.isJavaScript() || !addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) { return; } - const project = this.ensureDefaultProjectForFile(scriptInfo); - if (!project.languageServiceEnabled) { + const project2 = this.ensureDefaultProjectForFile(scriptInfo); + if (!project2.languageServiceEnabled) { return; } - const sourceFile = project.getSourceFile(scriptInfo.path); + const sourceFile = project2.getSourceFile(scriptInfo.path); const checkJs = !!sourceFile && !!sourceFile.checkJsDirective; this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info: { checkJs } } }); } @@ -225849,13 +226775,13 @@ Dynamic files must always be opened with service's current directory or service const normalized = toNormalizedPath(file2.fileName); if (getBaseConfigFileName(normalized)) { if (this.serverMode === 0 && this.host.fileExists(normalized)) { - let project = this.findConfiguredProjectByProjectName(normalized); - if (!project) { - project = this.createConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`); - if (!this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) project.updateGraph(); + let project2 = this.findConfiguredProjectByProjectName(normalized); + if (!project2) { + project2 = this.createConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`); + if (!this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) project2.updateGraph(); } - (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project); - Debug.assert(!project.isClosed()); + (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project2); + Debug.assert(!project2.isClosed()); } } else { rootFiles.push(file2); @@ -225889,8 +226815,8 @@ Dynamic files must always be opened with service's current directory or service this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions); existingExternalProject.updateGraph(); } else { - const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles); - project.updateGraph(); + const project2 = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles); + project2.updateGraph(); } } if (cleanupAfter) { @@ -225913,7 +226839,7 @@ Dynamic files must always be opened with service's current directory or service * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin either asynchronously or synchronously * @internal */ - requestEnablePlugin(project, pluginConfigEntry, searchPaths) { + requestEnablePlugin(project2, pluginConfigEntry, searchPaths) { if (!this.host.importPlugin && !this.host.require) { this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; @@ -225931,13 +226857,13 @@ Dynamic files must always be opened with service's current directory or service (s) => this.logger.info(s) ); this.pendingPluginEnablements ?? (this.pendingPluginEnablements = /* @__PURE__ */ new Map()); - let promises = this.pendingPluginEnablements.get(project); - if (!promises) this.pendingPluginEnablements.set(project, promises = []); + let promises = this.pendingPluginEnablements.get(project2); + if (!promises) this.pendingPluginEnablements.set(project2, promises = []); promises.push(importPromise); return; } this.endEnablePlugin( - project, + project2, Project2.importServicePluginSync( pluginConfigEntry, searchPaths, @@ -225949,7 +226875,7 @@ Dynamic files must always be opened with service's current directory or service /** * Performs the remaining steps of enabling a plugin after its module has been instantiated. */ - endEnablePlugin(project, { pluginConfigEntry, resolvedModule, errorLogs }) { + endEnablePlugin(project2, { pluginConfigEntry, resolvedModule, errorLogs }) { var _a3; if (resolvedModule) { const configurationOverride = (_a3 = this.currentPluginConfigOverrides) == null ? void 0 : _a3.get(pluginConfigEntry.name); @@ -225958,7 +226884,7 @@ Dynamic files must always be opened with service's current directory or service pluginConfigEntry = configurationOverride; pluginConfigEntry.name = pluginName; } - project.enableProxy(resolvedModule, pluginConfigEntry); + project2.enableProxy(resolvedModule, pluginConfigEntry); } else { forEach(errorLogs, (message) => this.logger.info(message)); this.logger.info(`Couldn't find ${pluginConfigEntry.name}`); @@ -226007,28 +226933,28 @@ Dynamic files must always be opened with service's current directory or service async enableRequestedPluginsWorker(pendingPlugins) { Debug.assert(this.currentPluginEnablementPromise === void 0); let sendProjectsUpdatedInBackgroundEvent = false; - await Promise.all(map2(pendingPlugins, async ([project, promises]) => { + await Promise.all(map2(pendingPlugins, async ([project2, promises]) => { const results = await Promise.all(promises); - if (project.isClosed() || isProjectDeferredClose(project)) { - this.logger.info(`Cancelling plugin enabling for ${project.getProjectName()} as it is ${project.isClosed() ? "closed" : "deferred close"}`); + if (project2.isClosed() || isProjectDeferredClose(project2)) { + this.logger.info(`Cancelling plugin enabling for ${project2.getProjectName()} as it is ${project2.isClosed() ? "closed" : "deferred close"}`); return; } sendProjectsUpdatedInBackgroundEvent = true; for (const result of results) { - this.endEnablePlugin(project, result); + this.endEnablePlugin(project2, result); } - this.delayUpdateProjectGraph(project); + this.delayUpdateProjectGraph(project2); })); this.currentPluginEnablementPromise = void 0; if (sendProjectsUpdatedInBackgroundEvent) this.sendProjectsUpdatedInBackgroundEvent(); } configurePlugin(args) { - this.forEachEnabledProject((project) => project.onPluginConfigurationChanged(args.pluginName, args.configuration)); + this.forEachEnabledProject((project2) => project2.onPluginConfigurationChanged(args.pluginName, args.configuration)); this.currentPluginConfigOverrides = this.currentPluginConfigOverrides || /* @__PURE__ */ new Map(); this.currentPluginConfigOverrides.set(args.pluginName, args.configuration); } /** @internal */ - getPackageJsonsVisibleToFile(fileName, project, rootDir) { + getPackageJsonsVisibleToFile(fileName, project2, rootDir) { const packageJsonCache = this.packageJsonCache; const rootPath = rootDir && this.toPath(rootDir); const result = []; @@ -226036,12 +226962,12 @@ Dynamic files must always be opened with service's current directory or service switch (packageJsonCache.directoryHasPackageJson(directory)) { // Sync and check same directory again case 3: - packageJsonCache.searchDirectoryAndAncestors(directory, project); + packageJsonCache.searchDirectoryAndAncestors(directory, project2); return processDirectory(directory); // Check package.json case -1: const packageJsonFileName = combinePaths(directory, "package.json"); - this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project); + this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project2); const info = packageJsonCache.getInDirectory(directory); if (info) result.push(info); } @@ -226050,16 +226976,16 @@ Dynamic files must always be opened with service's current directory or service } }; forEachAncestorDirectoryStoppingAtGlobalCache( - project, + project2, getDirectoryPath(fileName), processDirectory ); return result; } /** @internal */ - getNearestAncestorDirectoryWithPackageJson(fileName, project) { + getNearestAncestorDirectoryWithPackageJson(fileName, project2) { return forEachAncestorDirectoryStoppingAtGlobalCache( - project, + project2, fileName, (directory) => { switch (this.packageJsonCache.directoryHasPackageJson(directory)) { @@ -226073,8 +226999,8 @@ Dynamic files must always be opened with service's current directory or service } ); } - watchPackageJsonFile(file2, path, project) { - Debug.assert(project !== void 0); + watchPackageJsonFile(file2, path, project2) { + Debug.assert(project2 !== void 0); let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path); if (!result) { let watcher = this.watchFactory.watchFile( @@ -226110,13 +227036,13 @@ Dynamic files must always be opened with service's current directory or service }; this.packageJsonFilesMap.set(path, result); } - result.projects.add(project); - (project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result); + result.projects.add(project2); + (project2.packageJsonWatches ?? (project2.packageJsonWatches = /* @__PURE__ */ new Set())).add(result); } onPackageJsonChange(result) { - result.projects.forEach((project) => { + result.projects.forEach((project2) => { var _a3; - return (_a3 = project.onPackageJsonChange) == null ? void 0 : _a3.call(project); + return (_a3 = project2.onPackageJsonChange) == null ? void 0 : _a3.call(project2); }); } /** @internal */ @@ -226154,8 +227080,8 @@ Dynamic files must always be opened with service's current directory or service function isConfigFile(config2) { return config2.kind !== void 0; } - function printProjectWithoutFileNames(project) { - project.print( + function printProjectWithoutFileNames(project2) { + project2.print( /*writeProjectFileNames*/ false, /*writeFileExplaination*/ @@ -226279,9 +227205,9 @@ Dynamic files must always be opened with service's current directory or service return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0; }, directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)), - searchDirectoryAndAncestors: (directory, project) => { + searchDirectoryAndAncestors: (directory, project2) => { forEachAncestorDirectoryStoppingAtGlobalCache( - project, + project2, directory, (ancestor) => { const ancestorPath = host.toPath(ancestor); @@ -226321,9 +227247,9 @@ Dynamic files must always be opened with service's current directory or service const nanoseconds = time3[1]; return (1e9 * seconds + nanoseconds) / 1e6; } - function isDeclarationFileInJSOnlyNonConfiguredProject(project, file2) { - if ((isInferredProject(project) || isExternalProject(project)) && project.isJsOnlyProject()) { - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); + function isDeclarationFileInJSOnlyNonConfiguredProject(project2, file2) { + if ((isInferredProject(project2) || isExternalProject(project2)) && project2.isJsOnlyProject()) { + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); return scriptInfo && !scriptInfo.isJavaScript(); } return false; @@ -226331,8 +227257,8 @@ Dynamic files must always be opened with service's current directory or service function dtsChangeCanAffectEmit(compilationSettings) { return getEmitDeclarations(compilationSettings) || !!compilationSettings.emitDecoratorMetadata; } - function formatDiag(fileName, project, diag2) { - const scriptInfo = project.getScriptInfoForNormalizedPath(fileName); + function formatDiag(fileName, project2, diag2) { + const scriptInfo = project2.getScriptInfoForNormalizedPath(fileName); return { start: scriptInfo.positionToLineOffset(diag2.start), end: scriptInfo.positionToLineOffset(diag2.start + diag2.length), @@ -226500,11 +227426,11 @@ ${json2}${newLine}`; }; } function combineProjectOutput(defaultValue, getValue, projects, action) { - const outputs = flatMapToMutable(isArray(projects) ? projects : projects.projects, (project) => action(project, defaultValue)); + const outputs = flatMapToMutable(isArray(projects) ? projects : projects.projects, (project2) => action(project2, defaultValue)); if (!isArray(projects) && projects.symLinkedProjects) { projects.symLinkedProjects.forEach((projects2, path) => { const value = getValue(path); - outputs.push(...flatMap(projects2, (project) => action(project, value))); + outputs.push(...flatMap(projects2, (project2) => action(project2, value))); }); } return deduplicate(outputs, equateValues); @@ -226524,7 +227450,7 @@ ${json2}${newLine}`; true ), mapDefinitionInProject, - (project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, preferences), + (project2, position) => project2.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, preferences), (renameLocation, cb) => cb(documentSpanLocation(renameLocation)) ); if (isArray(perProjectResults)) { @@ -226532,9 +227458,9 @@ ${json2}${newLine}`; } const results = []; const seen = createDocumentSpanSet(useCaseSensitiveFileNames2); - perProjectResults.forEach((projectResults, project) => { + perProjectResults.forEach((projectResults, project2) => { for (const result of projectResults) { - if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) { + if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project2)) { results.push(result); seen.add(result); } @@ -226567,9 +227493,9 @@ ${json2}${newLine}`; false ), mapDefinitionInProject, - (project, position) => { - logger.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`); - return project.getLanguageService().findReferences(position.fileName, position.pos); + (project2, position) => { + logger.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project2.getProjectName()}`); + return project2.getLanguageService().findReferences(position.fileName, position.pos); }, (referencedSymbol, cb) => { cb(documentSpanLocation(referencedSymbol.definition)); @@ -226603,18 +227529,18 @@ ${json2}${newLine}`; const updatedProjects = /* @__PURE__ */ new Set(); while (true) { let progress = false; - perProjectResults.forEach((referencedSymbols, project) => { - if (updatedProjects.has(project)) return; - const updated = project.getLanguageService().updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans); + perProjectResults.forEach((referencedSymbols, project2) => { + if (updatedProjects.has(project2)) return; + const updated = project2.getLanguageService().updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans); if (updated) { - updatedProjects.add(project); + updatedProjects.add(project2); progress = true; } }); if (!progress) break; } - perProjectResults.forEach((referencedSymbols, project) => { - if (updatedProjects.has(project)) return; + perProjectResults.forEach((referencedSymbols, project2) => { + if (updatedProjects.has(project2)) return; for (const referencedSymbol of referencedSymbols) { for (const ref of referencedSymbol.references) { ref.isDefinition = false; @@ -226624,15 +227550,15 @@ ${json2}${newLine}`; } const results = []; const seenRefs = createDocumentSpanSet(useCaseSensitiveFileNames2); - perProjectResults.forEach((projectResults, project) => { + perProjectResults.forEach((projectResults, project2) => { for (const referencedSymbol of projectResults) { - const mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project); + const mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project2); const definition = mappedDefinitionFile === void 0 ? referencedSymbol.definition : { ...referencedSymbol.definition, textSpan: createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), // Why would the length be the same in the original? fileName: mappedDefinitionFile.fileName, - contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project) + contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project2) }; let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition, useCaseSensitiveFileNames2)); if (!symbolToAddTo) { @@ -226640,7 +227566,7 @@ ${json2}${newLine}`; results.push(symbolToAddTo); } for (const ref of referencedSymbol.references) { - if (!seenRefs.has(ref) && !getMappedLocationForProject(documentSpanLocation(ref), project)) { + if (!seenRefs.has(ref) && !getMappedLocationForProject(documentSpanLocation(ref), project2)) { seenRefs.add(ref); symbolToAddTo.references.push(ref); } @@ -226650,13 +227576,13 @@ ${json2}${newLine}`; return results.filter((o) => o.references.length !== 0); } function forEachProjectInProjects(projects, path, cb) { - for (const project of isArray(projects) ? projects : projects.projects) { - cb(project, path); + for (const project2 of isArray(projects) ? projects : projects.projects) { + cb(project2, path); } if (!isArray(projects) && projects.symLinkedProjects) { projects.symLinkedProjects.forEach((symlinkedProjects, symlinkedPath) => { - for (const project of symlinkedProjects) { - cb(project, symlinkedPath); + for (const project2 of symlinkedProjects) { + cb(project2, symlinkedPath); } }); } @@ -226665,9 +227591,9 @@ ${json2}${newLine}`; const resultsMap = /* @__PURE__ */ new Map(); const queue = createQueue(); queue.enqueue({ project: defaultProject, location: initialLocation }); - forEachProjectInProjects(projects, initialLocation.fileName, (project, path) => { + forEachProjectInProjects(projects, initialLocation.fileName, (project2, path) => { const location = { fileName: path, pos: initialLocation.pos }; - queue.enqueue({ project, location }); + queue.enqueue({ project: project2, location }); }); const projectService = defaultProject.projectService; const cancellationToken = defaultProject.getCancellationToken(); @@ -226682,25 +227608,25 @@ ${json2}${newLine}`; while (!queue.isEmpty()) { while (!queue.isEmpty()) { if (cancellationToken.isCancellationRequested()) break onCancellation; - const { project, location } = queue.dequeue(); - if (resultsMap.has(project)) continue; - if (isLocationProjectReferenceRedirect(project, location)) continue; - updateProjectIfDirty(project); - if (!project.containsFile(toNormalizedPath(location.fileName))) { + const { project: project2, location } = queue.dequeue(); + if (resultsMap.has(project2)) continue; + if (isLocationProjectReferenceRedirect(project2, location)) continue; + updateProjectIfDirty(project2); + if (!project2.containsFile(toNormalizedPath(location.fileName))) { continue; } - const projectResults = searchPosition(project, location); - resultsMap.set(project, projectResults ?? emptyArray2); - searchedProjectKeys.add(getProjectKey(project)); + const projectResults = searchPosition(project2, location); + resultsMap.set(project2, projectResults ?? emptyArray2); + searchedProjectKeys.add(getProjectKey(project2)); } if (defaultDefinition) { projectService.loadAncestorProjectTree(searchedProjectKeys); - projectService.forEachEnabledProject((project) => { + projectService.forEachEnabledProject((project2) => { if (cancellationToken.isCancellationRequested()) return; - if (resultsMap.has(project)) return; - const location = mapDefinitionInProject2(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition); + if (resultsMap.has(project2)) return; + const location = mapDefinitionInProject2(defaultDefinition, project2, getGeneratedDefinition, getSourceDefinition); if (location) { - queue.enqueue({ project, location }); + queue.enqueue({ project: project2, location }); } }); } @@ -226709,17 +227635,17 @@ ${json2}${newLine}`; return firstIterator(resultsMap.values()); } return resultsMap; - function searchPosition(project, location) { - const projectResults = getResultsForPosition(project, location); + function searchPosition(project2, location) { + const projectResults = getResultsForPosition(project2, location); if (!projectResults || !forPositionInResult) return projectResults; for (const result of projectResults) { forPositionInResult(result, (position) => { - const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, position); + const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project2, position); if (!originalLocation) return; const originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName); - for (const project2 of originalScriptInfo.containingProjects) { - if (!project2.isOrphan() && !resultsMap.has(project2)) { - queue.enqueue({ project: project2, location: originalLocation }); + for (const project22 of originalScriptInfo.containingProjects) { + if (!project22.isOrphan() && !resultsMap.has(project22)) { + queue.enqueue({ project: project22, location: originalLocation }); } } const symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo); @@ -226737,40 +227663,40 @@ ${json2}${newLine}`; return projectResults; } } - function mapDefinitionInProjectIfFileInProject(definition, project) { - if (project.containsFile(toNormalizedPath(definition.fileName)) && !isLocationProjectReferenceRedirect(project, definition)) { + function mapDefinitionInProjectIfFileInProject(definition, project2) { + if (project2.containsFile(toNormalizedPath(definition.fileName)) && !isLocationProjectReferenceRedirect(project2, definition)) { return definition; } } - function mapDefinitionInProject(definition, project, getGeneratedDefinition, getSourceDefinition) { - const result = mapDefinitionInProjectIfFileInProject(definition, project); + function mapDefinitionInProject(definition, project2, getGeneratedDefinition, getSourceDefinition) { + const result = mapDefinitionInProjectIfFileInProject(definition, project2); if (result) return result; const generatedDefinition = getGeneratedDefinition(); - if (generatedDefinition && project.containsFile(toNormalizedPath(generatedDefinition.fileName))) return generatedDefinition; + if (generatedDefinition && project2.containsFile(toNormalizedPath(generatedDefinition.fileName))) return generatedDefinition; const sourceDefinition = getSourceDefinition(); - return sourceDefinition && project.containsFile(toNormalizedPath(sourceDefinition.fileName)) ? sourceDefinition : void 0; + return sourceDefinition && project2.containsFile(toNormalizedPath(sourceDefinition.fileName)) ? sourceDefinition : void 0; } - function isLocationProjectReferenceRedirect(project, location) { + function isLocationProjectReferenceRedirect(project2, location) { if (!location) return false; - const program = project.getLanguageService().getProgram(); + const program = project2.getLanguageService().getProgram(); if (!program) return false; const sourceFile = program.getSourceFile(location.fileName); - return !!sourceFile && sourceFile.resolvedPath !== sourceFile.path && sourceFile.resolvedPath !== project.toPath(location.fileName); + return !!sourceFile && sourceFile.resolvedPath !== sourceFile.path && sourceFile.resolvedPath !== project2.toPath(location.fileName); } - function getProjectKey(project) { - return isConfiguredProject(project) ? project.canonicalConfigFilePath : project.getProjectName(); + function getProjectKey(project2) { + return isConfiguredProject(project2) ? project2.canonicalConfigFilePath : project2.getProjectName(); } function documentSpanLocation({ fileName, textSpan }) { return { fileName, pos: textSpan.start }; } - function getMappedLocationForProject(location, project) { - return getMappedLocation(location, project.getSourceMapper(), (p) => project.projectService.fileExists(p)); + function getMappedLocationForProject(location, project2) { + return getMappedLocation(location, project2.getSourceMapper(), (p) => project2.projectService.fileExists(p)); } - function getMappedDocumentSpanForProject(documentSpan, project) { - return getMappedDocumentSpan(documentSpan, project.getSourceMapper(), (p) => project.projectService.fileExists(p)); + function getMappedDocumentSpanForProject(documentSpan, project2) { + return getMappedDocumentSpan(documentSpan, project2.getSourceMapper(), (p) => project2.projectService.fileExists(p)); } - function getMappedContextSpanForProject(documentSpan, project) { - return getMappedContextSpan(documentSpan, project.getSourceMapper(), (p) => project.projectService.fileExists(p)); + function getMappedContextSpanForProject(documentSpan, project2) { + return getMappedContextSpan(documentSpan, project2.getSourceMapper(), (p) => project2.projectService.fileExists(p)); } var invalidPartialSemanticModeCommands = [ "openExternalProject", @@ -228028,8 +228954,8 @@ ${json2}${newLine}`; )) { if (fileRequest) { try { - const { file: file2, project } = this.getFileAndProject(fileRequest); - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); + const { file: file2, project: project2 } = this.getFileAndProject(fileRequest); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); if (scriptInfo) { const text = getSnapshotText(scriptInfo.getSnapshot()); msg += ` @@ -228050,11 +228976,11 @@ Program files: ${JSON.stringify(err.ProgramFiles)} Projects:: `; let counter = 0; - const addProjectInfo = (project) => { + const addProjectInfo = (project2) => { msg += ` -Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter} +Project '${project2.projectName}' (${ProjectKind[project2.projectKind]}) ${counter} `; - msg += project.filesToString( + msg += project2.filesToString( /*writeProjectFileNames*/ true ); @@ -228127,38 +229053,38 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } this.send(res); } - semanticCheck(file2, project) { + semanticCheck(file2, project2) { var _a3, _b; const diagnosticsStartTime = timestamp(); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "semanticCheck", { file: file2, configFilePath: project.canonicalConfigFilePath }); - const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file2) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file2).filter((d) => !!d.file); - this.sendDiagnosticsEvent(file2, project, diags, "semanticDiag", diagnosticsStartTime); + (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "semanticCheck", { file: file2, configFilePath: project2.canonicalConfigFilePath }); + const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project2, file2) ? emptyArray2 : project2.getLanguageService().getSemanticDiagnostics(file2).filter((d) => !!d.file); + this.sendDiagnosticsEvent(file2, project2, diags, "semanticDiag", diagnosticsStartTime); (_b = tracing) == null ? void 0 : _b.pop(); } - syntacticCheck(file2, project) { + syntacticCheck(file2, project2) { var _a3, _b; const diagnosticsStartTime = timestamp(); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "syntacticCheck", { file: file2, configFilePath: project.canonicalConfigFilePath }); - this.sendDiagnosticsEvent(file2, project, project.getLanguageService().getSyntacticDiagnostics(file2), "syntaxDiag", diagnosticsStartTime); + (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "syntacticCheck", { file: file2, configFilePath: project2.canonicalConfigFilePath }); + this.sendDiagnosticsEvent(file2, project2, project2.getLanguageService().getSyntacticDiagnostics(file2), "syntaxDiag", diagnosticsStartTime); (_b = tracing) == null ? void 0 : _b.pop(); } - suggestionCheck(file2, project) { + suggestionCheck(file2, project2) { var _a3, _b; const diagnosticsStartTime = timestamp(); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "suggestionCheck", { file: file2, configFilePath: project.canonicalConfigFilePath }); - this.sendDiagnosticsEvent(file2, project, project.getLanguageService().getSuggestionDiagnostics(file2), "suggestionDiag", diagnosticsStartTime); + (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "suggestionCheck", { file: file2, configFilePath: project2.canonicalConfigFilePath }); + this.sendDiagnosticsEvent(file2, project2, project2.getLanguageService().getSuggestionDiagnostics(file2), "suggestionDiag", diagnosticsStartTime); (_b = tracing) == null ? void 0 : _b.pop(); } - regionSemanticCheck(file2, project, ranges) { + regionSemanticCheck(file2, project2, ranges) { var _a3, _b, _c; const diagnosticsStartTime = timestamp(); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "regionSemanticCheck", { file: file2, configFilePath: project.canonicalConfigFilePath }); + (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Session, "regionSemanticCheck", { file: file2, configFilePath: project2.canonicalConfigFilePath }); let diagnosticsResult; - if (!this.shouldDoRegionCheck(file2) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file2, ranges))) { + if (!this.shouldDoRegionCheck(file2) || !(diagnosticsResult = project2.getLanguageService().getRegionSemanticDiagnostics(file2, ranges))) { (_b = tracing) == null ? void 0 : _b.pop(); return; } - this.sendDiagnosticsEvent(file2, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans); + this.sendDiagnosticsEvent(file2, project2, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans); (_c = tracing) == null ? void 0 : _c.pop(); return; } @@ -228170,13 +229096,13 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter const lineCount = (_a3 = this.projectService.getScriptInfoForNormalizedPath(file2)) == null ? void 0 : _a3.textStorage.getLineInfo().getLineCount(); return !!(lineCount && lineCount >= this.regionDiagLineCountThreshold); } - sendDiagnosticsEvent(file2, project, diagnostics, kind, diagnosticsStartTime, spans) { + sendDiagnosticsEvent(file2, project2, diagnostics, kind, diagnosticsStartTime, spans) { try { - const scriptInfo = Debug.checkDefined(project.getScriptInfo(file2)); + const scriptInfo = Debug.checkDefined(project2.getScriptInfo(file2)); const duration3 = timestamp() - diagnosticsStartTime; const body = { file: file2, - diagnostics: diagnostics.map((diag2) => formatDiag(file2, project, diag2)), + diagnostics: diagnostics.map((diag2) => formatDiag(file2, project2, diag2)), spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo)) }; this.event( @@ -228203,8 +229129,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return next.delay("checkOne", followMs, checkOne); } }; - const doSemanticCheck = (fileName, project) => { - this.semanticCheck(fileName, project); + const doSemanticCheck = (fileName, project2) => { + this.semanticCheck(fileName, project2); if (this.changeSeq !== seq) { return; } @@ -228212,7 +229138,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return goNext(); } next.immediate("suggestionCheck", () => { - this.suggestionCheck(fileName, project); + this.suggestionCheck(fileName, project2); goNext(); }); }; @@ -228231,31 +229157,31 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter if (!item) { return goNext(); } - const { fileName, project } = item; - updateProjectIfDirty(project); - if (!project.containsFile(fileName, requireOpen)) { + const { fileName, project: project2 } = item; + updateProjectIfDirty(project2); + if (!project2.containsFile(fileName, requireOpen)) { return; } - this.syntacticCheck(fileName, project); + this.syntacticCheck(fileName, project2); if (this.changeSeq !== seq) { return; } - if (project.projectService.serverMode !== 0) { + if (project2.projectService.serverMode !== 0) { return goNext(); } if (ranges) { return next.immediate("regionSemanticCheck", () => { const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName); if (scriptInfo) { - this.regionSemanticCheck(fileName, project, ranges.map((range) => this.getRange({ file: fileName, ...range }, scriptInfo))); + this.regionSemanticCheck(fileName, project2, ranges.map((range) => this.getRange({ file: fileName, ...range }, scriptInfo))); } if (this.changeSeq !== seq) { return; } - next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project2)); }); } - next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project2)); }; if (checkList.length > index && this.changeSeq === seq) { next.delay("checkOne", ms, checkOne); @@ -228288,24 +229214,24 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return languageService.getEncodedSyntacticClassifications(file2, args); } getEncodedSemanticClassifications(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const format = args.format === "2020" ? "2020" : "original"; - return project.getLanguageService().getEncodedSemanticClassifications(file2, args, format); + return project2.getLanguageService().getEncodedSemanticClassifications(file2, args, format); } getProject(projectFileName) { return projectFileName === void 0 ? void 0 : this.projectService.findProject(projectFileName); } getConfigFileAndProject(args) { - const project = this.getProject(args.projectFileName); + const project2 = this.getProject(args.projectFileName); const file2 = toNormalizedPath(args.file); return { - configFile: project && project.hasConfigFile(file2) ? file2 : void 0, - project + configFile: project2 && project2.hasConfigFile(file2) ? file2 : void 0, + project: project2 }; } - getConfigFileDiagnostics(configFile, project, includeLinePosition) { - const projectErrors = project.getAllProjectErrors(); - const optionsErrors = project.getLanguageService().getCompilerOptionsDiagnostics(); + getConfigFileDiagnostics(configFile, project2, includeLinePosition) { + const projectErrors = project2.getAllProjectErrors(); + const optionsErrors = project2.getLanguageService().getCompilerOptionsDiagnostics(); const diagnosticsForConfigFile = filter( concatenate(projectErrors, optionsErrors), (diagnostic) => !!diagnostic.file && diagnostic.file.fileName === configFile @@ -228339,10 +229265,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter })); } getCompilerOptionsDiagnostics(args) { - const project = this.getProject(args.projectFileName); + const project2 = this.getProject(args.projectFileName); return this.convertToDiagnosticsWithLinePosition( filter( - project.getLanguageService().getCompilerOptionsDiagnostics(), + project2.getLanguageService().getCompilerOptionsDiagnostics(), (diagnostic) => !diagnostic.file ), /*scriptInfo*/ @@ -228368,23 +229294,23 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter ); } getDiagnosticsWorker(args, isSemantic, selector, includeLinePosition) { - const { project, file: file2 } = this.getFileAndProject(args); - if (isSemantic && isDeclarationFileInJSOnlyNonConfiguredProject(project, file2)) { + const { project: project2, file: file2 } = this.getFileAndProject(args); + if (isSemantic && isDeclarationFileInJSOnlyNonConfiguredProject(project2, file2)) { return emptyArray2; } - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); - const diagnostics = selector(project, file2); - return includeLinePosition ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo) : diagnostics.map((d) => formatDiag(file2, project, d)); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); + const diagnostics = selector(project2, file2); + return includeLinePosition ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo) : diagnostics.map((d) => formatDiag(file2, project2, d)); } getDefinition(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const definitions = this.mapDefinitionInfoLocations(project.getLanguageService().getDefinitionAtPosition(file2, position) || emptyArray2, project); - return simplifiedResult ? this.mapDefinitionInfo(definitions, project) : definitions.map(_Session.mapToOriginalLocation); + const definitions = this.mapDefinitionInfoLocations(project2.getLanguageService().getDefinitionAtPosition(file2, position) || emptyArray2, project2); + return simplifiedResult ? this.mapDefinitionInfo(definitions, project2) : definitions.map(_Session.mapToOriginalLocation); } - mapDefinitionInfoLocations(definitions, project) { + mapDefinitionInfoLocations(definitions, project2) { return definitions.map((info) => { - const newDocumentSpan = getMappedDocumentSpanForProject(info, project); + const newDocumentSpan = getMappedDocumentSpanForProject(info, project2); return !newDocumentSpan ? info : { ...newDocumentSpan, containerKind: info.containerKind, @@ -228397,10 +229323,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter }); } getDefinitionAndBoundSpan(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const scriptInfo = Debug.checkDefined(project.getScriptInfo(file2)); - const unmappedDefinitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file2, position); + const scriptInfo = Debug.checkDefined(project2.getScriptInfo(file2)); + const unmappedDefinitionAndBoundSpan = project2.getLanguageService().getDefinitionAndBoundSpan(file2, position); if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) { return { definitions: emptyArray2, @@ -228408,11 +229334,11 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter // TODO: GH#18217 }; } - const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project); + const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project2); const { textSpan } = unmappedDefinitionAndBoundSpan; if (simplifiedResult) { return { - definitions: this.mapDefinitionInfo(definitions, project), + definitions: this.mapDefinitionInfo(definitions, project2), textSpan: toProtocolTextSpan(textSpan, scriptInfo) }; } @@ -228423,10 +229349,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } findSourceDefinition(args) { var _a3; - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const unmappedDefinitions = project.getLanguageService().getDefinitionAtPosition(file2, position); - let definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || emptyArray2, project).slice(); + const unmappedDefinitions = project2.getLanguageService().getDefinitionAtPosition(file2, position); + let definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || emptyArray2, project2).slice(); const needsJsResolution = this.projectService.serverMode === 0 && (!some(definitions, (d) => toNormalizedPath(d.fileName) !== file2 && !d.isAmbient) || some(definitions, (d) => !!d.failedAliasResolution)); if (needsJsResolution) { const definitionSet = createSet( @@ -228434,7 +229360,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter getDocumentSpansEqualityComparer(this.host.useCaseSensitiveFileNames) ); definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d)); - const noDtsProject = project.getNoDtsResolutionProject(file2); + const noDtsProject = project2.getNoDtsResolutionProject(file2); const ls = noDtsProject.getLanguageService(); const jsDefinitions = (_a3 = ls.getDefinitionAtPosition( file2, @@ -228447,7 +229373,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter if (some(jsDefinitions)) { for (const jsDefinition of jsDefinitions) { if (jsDefinition.unverified) { - const refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram()); + const refined = tryRefineDefinition(jsDefinition, project2.getLanguageService().getProgram(), ls.getProgram()); if (some(refined)) { for (const def of refined) { definitionSet.add(def); @@ -228484,15 +229410,15 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter definitions = arrayFrom(definitionSet.values()); } definitions = definitions.filter((d) => !d.isAmbient && !d.failedAliasResolution); - return this.mapDefinitionInfo(definitions, project); + return this.mapDefinitionInfo(definitions, project2); function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) { var _a22, _b, _c; const nodeModulesPathParts = getNodeModulePathParts(fileName); if (nodeModulesPathParts && fileName.lastIndexOf(nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) { const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex); - const packageJsonCache = (_a22 = project.getModuleResolutionCache()) == null ? void 0 : _a22.getPackageJsonInfoCache(); - const compilerOptions = project.getCompilationSettings(); - const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); + const packageJsonCache = (_a22 = project2.getModuleResolutionCache()) == null ? void 0 : _a22.getPackageJsonInfoCache(); + const compilerOptions = project2.getCompilationSettings(); + const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project2.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project2, compilerOptions)); if (!packageJson) return void 0; const entrypoints = getEntrypointsFromPackageJsonInfo( packageJson, @@ -228500,16 +229426,16 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter moduleResolution: 2 /* Node10 */ }, - project, - project.getModuleResolutionCache() + project2, + project2.getModuleResolutionCache() ); const packageNamePathPart = fileName.substring( nodeModulesPathParts.topLevelPackageNameIndex + 1, nodeModulesPathParts.packageRootIndex ); const packageName = getPackageNameFromTypesPackageName(unmangleScopedPackageName(packageNamePathPart)); - const path = project.toPath(fileName); - if (entrypoints && some(entrypoints, (e) => project.toPath(e) === path)) { + const path = project2.toPath(fileName); + if (entrypoints && some(entrypoints, (e) => project2.toPath(e) === path)) { return (_b = auxiliaryProject.resolutionCache.resolveSingleModuleNameWithoutWatching(packageName, resolveFromFile).resolvedModule) == null ? void 0 : _b.resolvedFileName; } else { const pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1); @@ -228520,10 +229446,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return void 0; } function getAmbientCandidatesByClimbingAccessChain() { - const ls = project.getLanguageService(); + const ls = project2.getLanguageService(); const program = ls.getProgram(); const initialNode = getTouchingPropertyName(program.getSourceFile(file2), position); - if ((isStringLiteralLike4(initialNode) || isIdentifier25(initialNode)) && isAccessExpression(initialNode.parent)) { + if ((isStringLiteralLike4(initialNode) || isIdentifier26(initialNode)) && isAccessExpression(initialNode.parent)) { return forEachNameInAccessChainWalkingLeft(initialNode, (nameInChain) => { var _a22; if (nameInChain === initialNode) return void 0; @@ -228581,11 +229507,11 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } } getEmitOutput(args) { - const { file: file2, project } = this.getFileAndProject(args); - if (!project.shouldEmitFile(project.getScriptInfo(file2))) { + const { file: file2, project: project2 } = this.getFileAndProject(args); + if (!project2.shouldEmitFile(project2.getScriptInfo(file2))) { return { emitSkipped: true, outputFiles: [], diagnostics: [] }; } - const result = project.getLanguageService().getEmitOutput(file2); + const result = project2.getLanguageService().getEmitOutput(file2); return args.richResponse ? { ...result, diagnostics: args.includeLinePosition ? this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(result.diagnostics) : result.diagnostics.map((d) => formatDiagnosticToProtocol( @@ -228595,36 +229521,36 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter )) } : result; } - mapJSDocTagInfo(tags, project, richResponse) { + mapJSDocTagInfo(tags, project2, richResponse) { return tags ? tags.map((tag) => { var _a3; return { ...tag, - text: richResponse ? this.mapDisplayParts(tag.text, project) : (_a3 = tag.text) == null ? void 0 : _a3.map((part) => part.text).join("") + text: richResponse ? this.mapDisplayParts(tag.text, project2) : (_a3 = tag.text) == null ? void 0 : _a3.map((part) => part.text).join("") }; }) : []; } - mapDisplayParts(parts, project) { + mapDisplayParts(parts, project2) { if (!parts) { return []; } return parts.map( (part) => part.kind !== "linkName" ? part : { ...part, - target: this.toFileSpan(part.target.fileName, part.target.textSpan, project) + target: this.toFileSpan(part.target.fileName, part.target.textSpan, project2) } ); } - mapSignatureHelpItems(items, project, richResponse) { + mapSignatureHelpItems(items, project2, richResponse) { return items.map((item) => ({ ...item, - documentation: this.mapDisplayParts(item.documentation, project), - parameters: item.parameters.map((p) => ({ ...p, documentation: this.mapDisplayParts(p.documentation, project) })), - tags: this.mapJSDocTagInfo(item.tags, project, richResponse) + documentation: this.mapDisplayParts(item.documentation, project2), + parameters: item.parameters.map((p) => ({ ...p, documentation: this.mapDisplayParts(p.documentation, project2) })), + tags: this.mapJSDocTagInfo(item.tags, project2, richResponse) })); } - mapDefinitionInfo(definitions, project) { - return definitions.map((def) => ({ ...this.toFileSpanWithContext(def.fileName, def.textSpan, def.contextSpan, project), ...def.unverified && { unverified: def.unverified } })); + mapDefinitionInfo(definitions, project2) { + return definitions.map((def) => ({ ...this.toFileSpanWithContext(def.fileName, def.textSpan, def.contextSpan, project2), ...def.unverified && { unverified: def.unverified } })); } /* * When we map a .d.ts location to .ts, Visual Studio gets confused because there's no associated Roslyn Document in @@ -228648,8 +229574,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } return def; } - toFileSpan(fileName, textSpan, project) { - const ls = project.getLanguageService(); + toFileSpan(fileName, textSpan, project2) { + const ls = project2.getLanguageService(); const start = ls.toLineColumnOffset(fileName, textSpan.start); const end = ls.toLineColumnOffset(fileName, textSpanEnd(textSpan)); return { @@ -228658,20 +229584,20 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter end: { line: end.line + 1, offset: end.character + 1 } }; } - toFileSpanWithContext(fileName, textSpan, contextSpan, project) { - const fileSpan = this.toFileSpan(fileName, textSpan, project); - const context = contextSpan && this.toFileSpan(fileName, contextSpan, project); + 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; } getTypeDefinition(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const definitions = this.mapDefinitionInfoLocations(project.getLanguageService().getTypeDefinitionAtPosition(file2, position) || emptyArray2, project); - return this.mapDefinitionInfo(definitions, project); + const definitions = this.mapDefinitionInfoLocations(project2.getLanguageService().getTypeDefinitionAtPosition(file2, position) || emptyArray2, project2); + return this.mapDefinitionInfo(definitions, project2); } - mapImplementationLocations(implementations, project) { + mapImplementationLocations(implementations, project2) { return implementations.map((info) => { - const newDocumentSpan = getMappedDocumentSpanForProject(info, project); + const newDocumentSpan = getMappedDocumentSpanForProject(info, project2); return !newDocumentSpan ? info : { ...newDocumentSpan, kind: info.kind, @@ -228680,10 +229606,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter }); } getImplementation(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const implementations = this.mapImplementationLocations(project.getLanguageService().getImplementationAtPosition(file2, position) || emptyArray2, project); - return simplifiedResult ? implementations.map(({ fileName, textSpan, contextSpan }) => this.toFileSpanWithContext(fileName, textSpan, contextSpan, project)) : implementations.map(_Session.mapToOriginalLocation); + const implementations = this.mapImplementationLocations(project2.getLanguageService().getImplementationAtPosition(file2, position) || emptyArray2, project2); + return simplifiedResult ? implementations.map(({ fileName, textSpan, contextSpan }) => this.toFileSpanWithContext(fileName, textSpan, contextSpan, project2)) : implementations.map(_Session.mapToOriginalLocation); } getSyntacticDiagnosticsSync(args) { const { configFile } = this.getConfigFileAndProject(args); @@ -228694,20 +229620,20 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter args, /*isSemantic*/ false, - (project, file2) => project.getLanguageService().getSyntacticDiagnostics(file2), + (project2, file2) => project2.getLanguageService().getSyntacticDiagnostics(file2), !!args.includeLinePosition ); } getSemanticDiagnosticsSync(args) { - const { configFile, project } = this.getConfigFileAndProject(args); + const { configFile, project: project2 } = this.getConfigFileAndProject(args); if (configFile) { - return this.getConfigFileDiagnostics(configFile, project, !!args.includeLinePosition); + return this.getConfigFileDiagnostics(configFile, project2, !!args.includeLinePosition); } return this.getDiagnosticsWorker( args, /*isSemantic*/ true, - (project2, file2) => project2.getLanguageService().getSemanticDiagnostics(file2).filter((d) => !!d.file), + (project22, file2) => project22.getLanguageService().getSemanticDiagnostics(file2).filter((d) => !!d.file), !!args.includeLinePosition ); } @@ -228720,7 +229646,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter args, /*isSemantic*/ true, - (project, file2) => project.getLanguageService().getSuggestionDiagnostics(file2), + (project2, file2) => project2.getLanguageService().getSuggestionDiagnostics(file2), !!args.includeLinePosition ); } @@ -228739,13 +229665,13 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return convertLinkedEditInfoToRanges(linkedEditInfo, scriptInfo); } getDocumentHighlights(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); - const documentHighlights = project.getLanguageService().getDocumentHighlights(file2, position, args.filesToSearch); + const documentHighlights = project2.getLanguageService().getDocumentHighlights(file2, position, args.filesToSearch); if (!documentHighlights) return emptyArray2; if (!simplifiedResult) return documentHighlights; return documentHighlights.map(({ fileName, highlightSpans }) => { - const scriptInfo = project.getScriptInfo(fileName); + const scriptInfo = project2.getScriptInfo(fileName); return { file: fileName, highlightSpans: highlightSpans.map(({ textSpan, kind, contextSpan }) => ({ @@ -228756,9 +229682,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter }); } provideInlayHints(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); - const hints = project.getLanguageService().provideInlayHints(file2, args, this.getPreferences(file2)); + const hints = project2.getLanguageService().provideInlayHints(file2, args, this.getPreferences(file2)); return hints.map((hint) => { const { position, displayParts } = hint; return { @@ -228821,12 +229747,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter ); } getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList, needDefaultConfiguredProjectInfo, excludeConfigFiles) { - const { project } = this.getFileAndProjectWorker(uncheckedFileName, projectFileName); - updateProjectIfDirty(project); + const { project: project2 } = this.getFileAndProjectWorker(uncheckedFileName, projectFileName); + updateProjectIfDirty(project2); const projectInfo = { - configFileName: project.getProjectName(), - languageServiceDisabled: !project.languageServiceEnabled, - fileNames: needFileNameList ? project.getFileNames( + configFileName: project2.getProjectName(), + languageServiceDisabled: !project2.languageServiceEnabled, + fileNames: needFileNameList ? project2.getFileNames( /*excludeFilesFromExternalLibraries*/ false, excludeConfigFiles @@ -228847,12 +229773,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter if (!result) return void 0; let notMatchedByConfig; let notInProject; - result.seenProjects.forEach((kind, project) => { - if (project !== result.defaultProject) { + result.seenProjects.forEach((kind, project2) => { + if (project2 !== result.defaultProject) { if (kind !== 3) { - (notMatchedByConfig ?? (notMatchedByConfig = [])).push(toNormalizedPath(project.getConfigFilePath())); + (notMatchedByConfig ?? (notMatchedByConfig = [])).push(toNormalizedPath(project2.getConfigFilePath())); } else { - (notInProject ?? (notInProject = [])).push(toNormalizedPath(project.getConfigFilePath())); + (notInProject ?? (notInProject = [])).push(toNormalizedPath(project2.getConfigFilePath())); } } }); @@ -228864,18 +229790,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter }; } getRenameInfo(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file2); const preferences = this.getPreferences(file2); - return project.getLanguageService().getRenameInfo(file2, position, preferences); + return project2.getLanguageService().getRenameInfo(file2, position, preferences); } getProjects(args, getScriptInfoEnsuringProjectsUptoDate, ignoreNoProjectError) { let projects; let symLinkedProjects; if (args.projectFileName) { - const project = this.getProject(args.projectFileName); - if (project) { - projects = [project]; + const project2 = this.getProject(args.projectFileName); + if (project2) { + projects = [project2]; } } else { const scriptInfo = getScriptInfoEnsuringProjectsUptoDate ? this.projectService.getScriptInfoEnsuringProjectsUptoDate(args.file) : this.projectService.getScriptInfo(args.file); @@ -228898,9 +229824,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } getDefaultProject(args) { if (args.projectFileName) { - const project = this.getProject(args.projectFileName); - if (project) { - return project; + const project2 = this.getProject(args.projectFileName); + if (project2) { + return project2; } if (!args.file) { return Errors.ThrowNoProject(); @@ -228988,9 +229914,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter initialLocation, initialLocation, mapDefinitionInProjectIfFileInProject, - (project) => { - this.logger.info(`Finding references to file ${fileName} in project ${project.getProjectName()}`); - return project.getLanguageService().getFileReferences(fileName); + (project2) => { + this.logger.info(`Finding references to file ${fileName} in project ${project2.getProjectName()}`); + return project2.getLanguageService().getFileReferences(fileName); } ); let references; @@ -229040,10 +229966,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return this.getFileAndProjectWorker(args.file, args.projectFileName); } getFileAndLanguageServiceForSyntacticOperation(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); return { file: file2, - languageService: project.getLanguageService( + languageService: project2.getLanguageService( /*ensureSynchronized*/ false ) @@ -229051,8 +229977,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } getFileAndProjectWorker(uncheckedFileName, projectFileName) { const file2 = toNormalizedPath(uncheckedFileName); - const project = this.getProject(projectFileName) || this.projectService.ensureDefaultProjectForFile(file2); - return { file: file2, project }; + const project2 = this.getProject(projectFileName) || this.projectService.ensureDefaultProjectForFile(file2); + return { file: file2, project: project2 }; } getOutliningSpans(args, simplifiedResult) { const { file: file2, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); @@ -229071,8 +229997,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } } getTodoComments(args) { - const { file: file2, project } = this.getFileAndProject(args); - return project.getLanguageService().getTodoComments(file2, args.descriptors); + const { file: file2, project: project2 } = this.getFileAndProject(args); + return project2.getLanguageService().getTodoComments(file2, args.descriptors); } getDocCommentTemplate(args) { const { file: file2, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); @@ -229108,10 +230034,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return languageService.isValidBraceCompletionAtPosition(file2, position, args.openingBrace.charCodeAt(0)); } getQuickInfoWorker(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); const userPreferences = this.getPreferences(file2); - const quickInfo = project.getLanguageService().getQuickInfoAtPosition( + const quickInfo = project2.getLanguageService().getQuickInfoAtPosition( file2, this.getPosition(args, scriptInfo), userPreferences.maximumHoverLength, @@ -229129,8 +230055,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)), displayString, - documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), - tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts), + documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project2) : displayPartsToString(quickInfo.documentation), + tags: this.mapJSDocTagInfo(quickInfo.tags, project2, useDisplayParts), canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel }; } else { @@ -229138,7 +230064,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter ...quickInfo, tags: this.mapJSDocTagInfo( quickInfo.tags, - project, + project2, /*richResponse*/ false ) @@ -229213,10 +230139,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter }); } getCompletions(args, kind) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); const position = this.getPosition(args, scriptInfo); - const completions = project.getLanguageService().getCompletionsAtPosition( + const completions = project2.getLanguageService().getCompletionsAtPosition( file2, position, { @@ -229226,7 +230152,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter includeExternalModuleExports: args.includeExternalModuleExports, includeInsertTextCompletions: args.includeInsertTextCompletions }, - project.projectService.getFormatCodeOptions(file2) + project2.projectService.getFormatCodeOptions(file2) ); if (completions === void 0) return void 0; if (kind === "completions-full") return completions; @@ -229254,25 +230180,25 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return res; } getCompletionEntryDetails(args, fullResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); const position = this.getPosition(args, scriptInfo); - const formattingOptions = project.projectService.getFormatCodeOptions(file2); + const formattingOptions = project2.projectService.getFormatCodeOptions(file2); const useDisplayParts = !!this.getPreferences(file2).displayPartsForJSDoc; const result = mapDefined(args.entryNames, (entryName) => { const { name, source, data } = typeof entryName === "string" ? { name: entryName, source: void 0, data: void 0 } : entryName; - return project.getLanguageService().getCompletionEntryDetails(file2, position, name, formattingOptions, source, this.getPreferences(file2), data ? cast(data, isCompletionEntryData) : void 0); + return project2.getLanguageService().getCompletionEntryDetails(file2, position, name, formattingOptions, source, this.getPreferences(file2), data ? cast(data, isCompletionEntryData) : void 0); }); return fullResult ? useDisplayParts ? result : result.map((details) => ({ ...details, tags: this.mapJSDocTagInfo( details.tags, - project, + project2, /*richResponse*/ false ) })) : result.map((details) => ({ ...details, codeActions: map2(details.codeActions, (action) => this.mapCodeAction(action)), - documentation: this.mapDisplayParts(details.documentation, project), - tags: this.mapJSDocTagInfo(details.tags, project, useDisplayParts) + documentation: this.mapDisplayParts(details.documentation, project2), + tags: this.mapJSDocTagInfo(details.tags, project2, useDisplayParts) })); } getCompileOnSaveAffectedFileList(args) { @@ -229291,32 +230217,32 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter info, (path) => this.projectService.getScriptInfoForPath(path), projects, - (project, info2) => { - if (!project.compileOnSaveEnabled || !project.languageServiceEnabled || project.isOrphan()) { + (project2, info2) => { + if (!project2.compileOnSaveEnabled || !project2.languageServiceEnabled || project2.isOrphan()) { return void 0; } - const compilationSettings = project.getCompilationSettings(); + const compilationSettings = project2.getCompilationSettings(); if (!!compilationSettings.noEmit || isDeclarationFileName(info2.fileName) && !dtsChangeCanAffectEmit(compilationSettings)) { return void 0; } return { - projectFileName: project.getProjectName(), - fileNames: project.getCompileOnSaveAffectedFileList(info2), + projectFileName: project2.getProjectName(), + fileNames: project2.getCompileOnSaveAffectedFileList(info2), projectUsesOutFile: !!compilationSettings.outFile }; } ); } emitFile(args) { - const { file: file2, project } = this.getFileAndProject(args); - if (!project) { + const { file: file2, project: project2 } = this.getFileAndProject(args); + if (!project2) { Errors.ThrowNoProject(); } - if (!project.languageServiceEnabled) { + if (!project2.languageServiceEnabled) { return args.richResponse ? { emitSkipped: true, diagnostics: [] } : false; } - const scriptInfo = project.getScriptInfo(file2); - const { emitSkipped, diagnostics } = project.emitFile(scriptInfo, (path, data, writeByteOrderMark) => this.host.writeFile(path, data, writeByteOrderMark)); + const scriptInfo = project2.getScriptInfo(file2); + const { emitSkipped, diagnostics } = project2.emitFile(scriptInfo, (path, data, writeByteOrderMark) => this.host.writeFile(path, data, writeByteOrderMark)); return args.richResponse ? { emitSkipped, diagnostics: args.includeLinePosition ? this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(diagnostics) : diagnostics.map((d) => formatDiagnosticToProtocol( @@ -229327,10 +230253,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } : !emitSkipped; } getSignatureHelpItems(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); const position = this.getPosition(args, scriptInfo); - const helpItems = project.getLanguageService().getSignatureHelpItems(file2, position, args); + const helpItems = project2.getLanguageService().getSignatureHelpItems(file2, position, args); const useDisplayParts = !!this.getPreferences(file2).displayPartsForJSDoc; if (helpItems && simplifiedResult) { const span = helpItems.applicableSpan; @@ -229340,7 +230266,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter start: scriptInfo.positionToLineOffset(span.start), end: scriptInfo.positionToLineOffset(span.start + span.length) }, - items: this.mapSignatureHelpItems(helpItems.items, project, useDisplayParts) + items: this.mapSignatureHelpItems(helpItems.items, project2, useDisplayParts) }; } else if (useDisplayParts || !helpItems) { return helpItems; @@ -229349,7 +230275,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter ...helpItems, items: helpItems.items.map((item) => ({ ...item, tags: this.mapJSDocTagInfo( item.tags, - project, + project2, /*richResponse*/ false ) })) @@ -229358,8 +230284,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } toPendingErrorCheck(uncheckedFileName) { const fileName = toNormalizedPath(uncheckedFileName); - const project = this.projectService.tryGetDefaultProjectForFile(fileName); - return project && { fileName, project }; + const project2 = this.projectService.tryGetDefaultProjectForFile(fileName); + return project2 && { fileName, project: project2 }; } getDiagnostics(next, delay, fileArgs) { if (this.suppressDiagnosticEvents) { @@ -229443,8 +230369,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter const full = this.getFullNavigateToItems(args); return !simplifiedResult ? flatMap(full, ({ navigateToItems }) => navigateToItems) : flatMap( full, - ({ project, navigateToItems }) => navigateToItems.map((navItem) => { - const scriptInfo = project.getScriptInfo(navItem.fileName); + ({ project: project2, navigateToItems }) => navigateToItems.map((navItem) => { + const scriptInfo = project2.getScriptInfo(navItem.fileName); const bakedItem = { name: navItem.name, kind: navItem.kind, @@ -229472,39 +230398,39 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter const { currentFileOnly, searchValue, maxResultCount, projectFileName } = args; if (currentFileOnly) { Debug.assertIsDefined(args.file); - const { file: file2, project } = this.getFileAndProject(args); - return [{ project, navigateToItems: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file2) }]; + const { file: file2, project: project2 } = this.getFileAndProject(args); + return [{ project: project2, navigateToItems: project2.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file2) }]; } const preferences = this.getHostPreferences(); const outputs = []; const seenItems = /* @__PURE__ */ new Map(); if (!args.file && !projectFileName) { this.projectService.loadAncestorProjectTree(); - this.projectService.forEachEnabledProject((project) => addItemsForProject(project)); + this.projectService.forEachEnabledProject((project2) => addItemsForProject(project2)); } else { const projects = this.getProjects(args); forEachProjectInProjects( projects, /*path*/ void 0, - (project) => addItemsForProject(project) + (project2) => addItemsForProject(project2) ); } return outputs; - function addItemsForProject(project) { - const projectItems = project.getLanguageService().getNavigateToItems( + function addItemsForProject(project2) { + const projectItems = project2.getLanguageService().getNavigateToItems( searchValue, maxResultCount, /*fileName*/ void 0, /*excludeDts*/ - project.isNonTsProject(), + project2.isNonTsProject(), /*excludeLibFiles*/ preferences.excludeLibrarySymbolsInNavTo ); - const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project)); + const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project2)); if (unseenItems.length) { - outputs.push({ project, navigateToItems: unseenItems }); + outputs.push({ project: project2, navigateToItems: unseenItems }); } } function tryAddSeenItem(item) { @@ -229535,12 +230461,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter getSupportedCodeFixes(args) { if (!args) return getSupportedCodeFixes(); if (args.file) { - const { file: file2, project: project2 } = this.getFileAndProject(args); - return project2.getLanguageService().getSupportedCodeFixes(file2); + const { file: file2, project: project22 } = this.getFileAndProject(args); + return project22.getLanguageService().getSupportedCodeFixes(file2); } - const project = this.getProject(args.projectFileName); - if (!project) Errors.ThrowNoProject(); - return project.getLanguageService().getSupportedCodeFixes(); + const project2 = this.getProject(args.projectFileName); + if (!project2) Errors.ThrowNoProject(); + return project2.getLanguageService().getSupportedCodeFixes(); } isLocation(locationOrSpan) { return locationOrSpan.line !== void 0; @@ -229563,15 +230489,15 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return { pos: startPosition, end: endPosition }; } getApplicableRefactors(args) { - const { file: file2, project } = this.getFileAndProject(args); - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); - const result = project.getLanguageService().getApplicableRefactors(file2, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file2), args.triggerReason, args.kind, args.includeInteractiveActions); + const { file: file2, project: project2 } = this.getFileAndProject(args); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); + const result = project2.getLanguageService().getApplicableRefactors(file2, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file2), args.triggerReason, args.kind, args.includeInteractiveActions); return result.map((result2) => ({ ...result2, actions: result2.actions.map((action) => ({ ...action, range: action.range ? { start: convertToLocation({ line: action.range.start.line, character: action.range.start.offset }), end: convertToLocation({ line: action.range.end.line, character: action.range.end.offset }) } : void 0 })) })); } getEditsForRefactor(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); - const result = project.getLanguageService().getEditsForRefactor( + const { file: file2, project: project2 } = this.getFileAndProject(args); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); + const result = project2.getLanguageService().getEditsForRefactor( file2, this.getFormatOptions(file2), this.extractPositionOrRange(args, scriptInfo), @@ -229589,7 +230515,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter const { renameFilename, renameLocation, edits } = result; let mappedRenameLocation; if (renameFilename !== void 0 && renameLocation !== void 0) { - const renameScriptInfo = project.getScriptInfoForNormalizedPath(toNormalizedPath(renameFilename)); + const renameScriptInfo = project2.getScriptInfoForNormalizedPath(toNormalizedPath(renameFilename)); mappedRenameLocation = getLocationInNewDocument(getSnapshotText(renameScriptInfo.getSnapshot()), renameFilename, renameLocation, edits); } return { @@ -229602,23 +230528,23 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return result; } getMoveToRefactoringFileSuggestions(args) { - const { file: file2, project } = this.getFileAndProject(args); - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); - return project.getLanguageService().getMoveToRefactoringFileSuggestions(file2, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file2)); + const { file: file2, project: project2 } = this.getFileAndProject(args); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); + return project2.getLanguageService().getMoveToRefactoringFileSuggestions(file2, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file2)); } preparePasteEdits(args) { - const { file: file2, project } = this.getFileAndProject(args); - return project.getLanguageService().preparePasteEditsForFile(file2, args.copiedTextSpan.map((copies) => this.getRange({ file: file2, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, this.projectService.getScriptInfoForNormalizedPath(file2)))); + const { file: file2, project: project2 } = this.getFileAndProject(args); + return project2.getLanguageService().preparePasteEditsForFile(file2, args.copiedTextSpan.map((copies) => this.getRange({ file: file2, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, this.projectService.getScriptInfoForNormalizedPath(file2)))); } getPasteEdits(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); if (isDynamicFileName(file2)) return void 0; - const copiedFrom = args.copiedFrom ? { file: args.copiedFrom.file, range: args.copiedFrom.spans.map((copies) => this.getRange({ file: args.copiedFrom.file, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, project.getScriptInfoForNormalizedPath(toNormalizedPath(args.copiedFrom.file)))) } : void 0; - const result = project.getLanguageService().getPasteEdits( + const copiedFrom = args.copiedFrom ? { file: args.copiedFrom.file, range: args.copiedFrom.spans.map((copies) => this.getRange({ file: args.copiedFrom.file, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, project2.getScriptInfoForNormalizedPath(toNormalizedPath(args.copiedFrom.file)))) } : void 0; + const result = project2.getLanguageService().getPasteEdits( { targetFile: file2, pastedText: args.pastedText, - pasteLocations: args.pasteLocations.map((paste) => this.getRange({ file: file2, startLine: paste.start.line, startOffset: paste.start.offset, endLine: paste.end.line, endOffset: paste.end.offset }, project.getScriptInfoForNormalizedPath(file2))), + pasteLocations: args.pasteLocations.map((paste) => this.getRange({ file: file2, startLine: paste.start.line, startOffset: paste.start.offset, endLine: paste.end.line, endOffset: paste.end.offset }, project2.getScriptInfoForNormalizedPath(file2))), copiedFrom, preferences: this.getPreferences(file2) }, @@ -229628,8 +230554,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter } organizeImports(args, simplifiedResult) { Debug.assert(args.scope.type === "file"); - const { file: file2, project } = this.getFileAndProject(args.scope.args); - const changes = project.getLanguageService().organizeImports( + const { file: file2, project: project2 } = this.getFileAndProject(args.scope.args); + const changes = project2.getLanguageService().organizeImports( { fileName: file2, mode: args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" : void 0), @@ -229652,8 +230578,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter const seenFiles = /* @__PURE__ */ new Set(); const textChanges2 = []; this.projectService.loadAncestorProjectTree(); - this.projectService.forEachEnabledProject((project) => { - const projectTextChanges = project.getLanguageService().getEditsForFileRename(oldPath, newPath, formatOptions, preferences); + this.projectService.forEachEnabledProject((project2) => { + const projectTextChanges = project2.getLanguageService().getEditsForFileRename(oldPath, newPath, formatOptions, preferences); const projectFiles = []; for (const textChange of projectTextChanges) { if (!seenFiles.has(textChange.fileName)) { @@ -229668,15 +230594,15 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter return simplifiedResult ? textChanges2.map((c) => this.mapTextChangeToCodeEdit(c)) : textChanges2; } getCodeFixes(args, simplifiedResult) { - const { file: file2, project } = this.getFileAndProject(args); - const scriptInfo = project.getScriptInfoForNormalizedPath(file2); + const { file: file2, project: project2 } = this.getFileAndProject(args); + const scriptInfo = project2.getScriptInfoForNormalizedPath(file2); const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo); let codeActions; try { - codeActions = project.getLanguageService().getCodeFixesAtPosition(file2, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file2), this.getPreferences(file2)); + codeActions = project2.getLanguageService().getCodeFixesAtPosition(file2, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file2), this.getPreferences(file2)); } catch (e) { const error210 = e instanceof Error ? e : new Error(e); - const ls = project.getLanguageService(); + const ls = project2.getLanguageService(); const existingDiagCodes = [ ...ls.getSyntacticDiagnostics(file2), ...ls.getSemanticDiagnostics(file2), @@ -229693,8 +230619,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range } getCombinedCodeFix({ scope, fixId: fixId56 }, simplifiedResult) { Debug.assert(scope.type === "file"); - const { file: file2, project } = this.getFileAndProject(scope.args); - const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file2 }, fixId56, this.getFormatOptions(file2), this.getPreferences(file2)); + const { file: file2, project: project2 } = this.getFileAndProject(scope.args); + const res = project2.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file2 }, fixId56, this.getFormatOptions(file2), this.getPreferences(file2)); if (simplifiedResult) { return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands }; } else { @@ -229704,8 +230630,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range applyCodeActionCommand(args) { const commands = args.command; for (const command of toArray(commands)) { - const { file: file2, project } = this.getFileAndProject(command); - project.getLanguageService().applyCodeActionCommand(command, this.getFormatOptions(file2)).then( + const { file: file2, project: project2 } = this.getFileAndProject(command); + project2.getLanguageService().applyCodeActionCommand(command, this.getFormatOptions(file2)).then( (_result) => { }, (_error) => { @@ -229789,7 +230715,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range const lowPriorityFiles = []; const veryLowPriorityFiles = []; const normalizedFileName = toNormalizedPath(fileName); - const project = this.projectService.ensureDefaultProjectForFile(normalizedFileName); + const project2 = this.projectService.ensureDefaultProjectForFile(normalizedFileName); for (const fileNameInProject of fileNamesInProject) { if (this.getCanonicalFileName(fileNameInProject) === this.getCanonicalFileName(fileName)) { highPriorityFiles.push(fileNameInProject); @@ -229807,7 +230733,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range } } const sortedFiles = [...highPriorityFiles, ...mediumPriorityFiles, ...lowPriorityFiles, ...veryLowPriorityFiles]; - const checkList = sortedFiles.map((fileName2) => ({ fileName: fileName2, project })); + const checkList = sortedFiles.map((fileName2) => ({ fileName: fileName2, project: project2 })); this.updateErrorCheck( next, checkList, @@ -229917,25 +230843,25 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range }; } prepareCallHierarchy(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file2); if (scriptInfo) { const position = this.getPosition(args, scriptInfo); - const result = project.getLanguageService().prepareCallHierarchy(file2, position); + const result = project2.getLanguageService().prepareCallHierarchy(file2, position); return result && mapOneOrMany(result, (item) => this.toProtocolCallHierarchyItem(item)); } return void 0; } provideCallHierarchyIncomingCalls(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.getScriptInfoFromProjectService(file2); - const incomingCalls = project.getLanguageService().provideCallHierarchyIncomingCalls(file2, this.getPosition(args, scriptInfo)); + const incomingCalls = project2.getLanguageService().provideCallHierarchyIncomingCalls(file2, this.getPosition(args, scriptInfo)); return incomingCalls.map((call) => this.toProtocolCallHierarchyIncomingCall(call)); } provideCallHierarchyOutgoingCalls(args) { - const { file: file2, project } = this.getFileAndProject(args); + const { file: file2, project: project2 } = this.getFileAndProject(args); const scriptInfo = this.getScriptInfoFromProjectService(file2); - const outgoingCalls = project.getLanguageService().provideCallHierarchyOutgoingCalls(file2, this.getPosition(args, scriptInfo)); + const outgoingCalls = project2.getLanguageService().provideCallHierarchyOutgoingCalls(file2, this.getPosition(args, scriptInfo)); return outgoingCalls.map((call) => this.toProtocolCallHierarchyOutgoingCall(call, scriptInfo)); } getCanonicalFileName(fileName) { @@ -230972,8 +231898,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((resolve4, reject) => { - (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve4, reject }); + const promise2 = new Promise((resolve9, reject) => { + (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve9, reject }); }); this.installer.send(request); return promise2; @@ -230985,8 +231911,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range onProjectClosed(p) { this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" }); } - enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports) { - const request = createInstallTypingsRequest(project, typeAcquisition, unresolvedImports); + enqueueInstallTypingsRequest(project2, typeAcquisition, unresolvedImports) { + const request = createInstallTypingsRequest(project2, typeAcquisition, unresolvedImports); if (this.logger.hasLevel( 3 /* verbose */ @@ -231245,9 +232171,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range }; } })({ get exports() { - return ts33; + return ts34; }, set exports(v) { - ts33 = v; + ts34 = v; if (typeof module !== "undefined" && module.exports) { module.exports = v; } @@ -231256,7 +232182,15 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range }); // node_modules/@intentius/chant/src/fold/foldable-helpers.ts -var FOLDABLE_AUTHORING_HELPERS, HELPER_NAMES; +function isFoldableHelperName(name) { + return HELPER_NAMES.has(name); +} +function isChantOwnedSpecifier(specifier) { + return CHANT_PACKAGE_SPECIFIERS.some( + (prefix) => specifier === prefix || specifier.startsWith(prefix.endsWith("-") ? prefix : `${prefix}/`) + ); +} +var FOLDABLE_AUTHORING_HELPERS, HELPER_NAMES, CHANT_PACKAGE_SPECIFIERS; var init_foldable_helpers = __esm({ "node_modules/@intentius/chant/src/fold/foldable-helpers.ts"() { FOLDABLE_AUTHORING_HELPERS = [ @@ -231268,7 +232202,7 @@ var init_foldable_helpers = __esm({ { name: "gate", module: "components/component.ts, op/builders.ts", - note: "Returns a plain `{ kind: 'gate', signalName, ... }` object literal built from its arguments." + note: "Returns a plain `{ kind: 'gate', gate, ... }` object literal built from its arguments." }, { name: "activity", @@ -231284,14 +232218,116 @@ var init_foldable_helpers = __esm({ name: "output", module: "lexicon-output.ts", note: "Constructs a `LexiconOutput` from a real `AttrRef`/`Intrinsic` and a name. Pure, but identity-sensitive: it reads through the ref's `WeakRef` to its parent entity. Only folds when the ref argument revives to a REAL live reference (see fold-import.ts's `requireLiveRefs`); a symbolic `{ __attrRef }` envelope is rejected, not silently wrapped." + }, + // chant #2171. The ConvergeOp rule language (`op/converge-rule.ts`). Its own + // module doc is the admission argument: a rule is evaluated per tick against + // freshly observed data inside an activity, so it must be plain JSON, and + // every builder below is one statement returning an object literal built from + // its arguments. `when()` additionally validates `id`, `why` and + // `flapThreshold` and throws on a bad rule, which is the same build-time + // refusal the run path performs, at the same point in the build. + // + // These are authoring surface in the same sense `phase`/`activity` are: a + // `ConvergeOp`'s `rules` table cannot be written without them, so before this + // every file declaring a converge rule fell back to run whatever else it did. + { + name: "when", + module: "op/converge-rule.ts", + note: "Returns a plain `{ id, when, then, why, flapThreshold? }` rule record built from its arguments. Throws at construction on a missing `id`/`why` or a non-positive `flapThreshold`, which is the build-time refusal the run path performs too, so a bad rule fails identically either way." + }, + { + name: "eq", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'eq', value }` literal built from its arguments." + }, + { + name: "neq", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'neq', value }` literal built from its arguments." + }, + { + name: "gt", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'gt', value }` literal built from its arguments." + }, + { + name: "gte", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'gte', value }` literal built from its arguments." + }, + { + name: "lt", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'lt', value }` literal built from its arguments." + }, + { + name: "lte", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-comparison', field, op: 'lte', value }` literal built from its arguments." + }, + { + name: "truthy", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-truthiness', field, op: 'truthy' }` literal built from its argument." + }, + { + name: "falsy", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'field-truthiness', field, op: 'falsy' }` literal built from its argument." + }, + { + name: "allOf", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'all-of', predicates }` literal over its already-folded predicate arguments." + }, + { + name: "anyOf", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'any-of', predicates }` literal over its already-folded predicate arguments." + }, + { + name: "run", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'run', op }` action literal. Names an Op for a later tick to dispatch; it runs nothing at fold time, or at any other time." + }, + { + name: "report", + module: "op/converge-rule.ts", + note: "Returns a plain `{ kind: 'report', reason }` action literal built from its argument." } ]; HELPER_NAMES = new Set(FOLDABLE_AUTHORING_HELPERS.map((h) => h.name)); + CHANT_PACKAGE_SPECIFIERS = ["@intentius/chant", "@intentius/chant-lexicon-"]; } }); // node_modules/@intentius/chant/src/fold/subset.ts -var ts, SUPPORTED_BINARY_OPERATORS, SUPPORTED_UNARY_OPERATORS; +function isLiteralPropertyName(node) { + return ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node); +} +function isLiteralElementKey(node) { + return ts.isStringLiteral(node) || ts.isNumericLiteral(node); +} +function briefNodeText(node, maxLength = 60) { + const collapsed = node.getText().replace(/\s+/g, " ").trim(); + return collapsed.length > maxLength ? `${collapsed.slice(0, maxLength - 3)}...` : collapsed; +} +function computedPropertyNameMessage(node) { + return `computed/dynamic property name not foldable: ${briefNodeText(node)}`; +} +function dynamicElementAccessMessage(keyNode) { + return `dynamic property access \u2014 computed key must be a string or numeric literal: ${briefNodeText(keyNode)}`; +} +function unsupportedBinaryMessage(opKind) { + return `unsupported binary operator: ${ts.SyntaxKind[opKind]}`; +} +function callExpressionMessage(node) { + return `function call as a value is not foldable: ${briefNodeText(node.expression)}(...)`; +} +function unsupportedExpressionMessage(node) { + return `unsupported expression: ${ts.SyntaxKind[node.kind]}`; +} +var ts, SUPPORTED_BINARY_OPERATORS, SUPPORTED_UNARY_OPERATORS, UNSUPPORTED_OBJECT_MEMBER_MESSAGE, UNSUPPORTED_UNARY_MESSAGE; var init_subset = __esm({ "node_modules/@intentius/chant/src/fold/subset.ts"() { ts = __toESM(require_typescript(), 1); @@ -231316,21 +232352,821 @@ var init_subset = __esm({ ts.SyntaxKind.ExclamationToken, ts.SyntaxKind.MinusToken ]); + UNSUPPORTED_OBJECT_MEMBER_MESSAGE = "unsupported object member"; + UNSUPPORTED_UNARY_MESSAGE = "unsupported unary"; } }); // node_modules/@intentius/chant/src/fold/fold.ts -var ts2; +import { relative as relative3 } from "node:path"; +function symbolicEnvelopeKind(value) { + if (typeof value !== "object" || value === null) return void 0; + const v = value; + if ("__attrRef" in v) { + const ref = v.__attrRef; + const named = typeof ref?.entity === "string" && typeof ref?.attribute === "string" ? ` (${ref.entity}.${ref.attribute})` : ""; + return `a resource attribute reference${named}`; + } + if ("__intrinsic" in v && typeof v.__intrinsic === "string") return `the intrinsic \`${v.__intrinsic}\``; + if ("__helper" in v && typeof v.__helper === "string") return `the helper \`${v.__helper}\``; + if ("__resource" in v && typeof v.__resource === "string") return `a nested \`new ${v.__resource}\``; + if ("__compositeStep" in v && typeof v.__compositeStep === "string") { + return `the composite step \`${v.__compositeStep}(\u2026).step\``; + } + return void 0; +} +function carriesLiveObject(value, seen = /* @__PURE__ */ new Set()) { + if (value === null || typeof value !== "object") return typeof value === "function"; + if (seen.has(value)) return false; + seen.add(value); + const proto = Object.getPrototypeOf(value); + if (proto !== Object.prototype && proto !== Array.prototype && proto !== null) return true; + for (const inner2 of Object.values(value)) { + if (carriesLiveObject(inner2, seen)) return true; + } + return false; +} +function isFoldableFunction(value) { + return value instanceof FoldableFunction; +} +function plainBindingKey(el) { + if (el.dotDotDotToken || el.initializer || !ts2.isIdentifier(el.name)) return void 0; + const key = el.propertyName ?? el.name; + if (ts2.isIdentifier(key) || ts2.isStringLiteral(key) || ts2.isNumericLiteral(key)) return key.text; + return void 0; +} +function findFunctionSubsetViolation(fn) { + if (fn.asteriskToken) return "a generator function is not foldable"; + if (fn.modifiers?.some((m) => m.kind === ts2.SyntaxKind.AsyncKeyword)) return "an async function is not foldable"; + if (!fn.body) return "a function without a body (an overload signature) is not foldable"; + for (const param of fn.parameters) { + if (param.dotDotDotToken) return "a rest parameter is not foldable"; + if (ts2.isIdentifier(param.name)) continue; + if (ts2.isObjectBindingPattern(param.name)) { + for (const el of param.name.elements) { + if (plainBindingKey(el) === void 0) { + return "a destructured parameter with a rest, default, or nested element is not foldable"; + } + } + continue; + } + return "an array-destructured parameter is not foldable"; + } + if (!ts2.isBlock(fn.body)) return void 0; + const statements = fn.body.statements; + for (let i = 0; i < statements.length; i += 1) { + const statement = statements[i]; + const last = i === statements.length - 1; + if (ts2.isReturnStatement(statement)) { + if (!last) return "an early `return` is not foldable"; + continue; + } + if (!ts2.isVariableStatement(statement)) { + return `\`${ts2.SyntaxKind[statement.kind]}\` in a function body is not foldable \u2014 only \`const\` declarations and a final \`return\` are`; + } + if ((statement.declarationList.flags & ts2.NodeFlags.Const) === 0) { + return "`let`/`var` in a function body is not foldable"; + } + for (const decl of statement.declarationList.declarations) { + if (!decl.initializer) return "an uninitialized `const` in a function body is not foldable"; + if (ts2.isIdentifier(decl.name)) continue; + if (ts2.isObjectBindingPattern(decl.name)) { + for (const el of decl.name.elements) { + if (plainBindingKey(el) === void 0) { + return "a destructured `const` with a rest, default, or nested element is not foldable"; + } + } + 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`); +} +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 = (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; + } + 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 + ); + } 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") { + 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); + } + } + } + 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 (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, 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; + }; + functionBodyDepth = 0; + MAX_FUNCTION_CALL_DEPTH = 32; + CHAIN_SHORT_CIRCUIT = /* @__PURE__ */ Symbol("chant.fold.optional-chain-short-circuit"); } }); // 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; + return void 0; +} +function unwrap(expr) { + let current = expr; + for (; ; ) { + if (ts3.isParenthesizedExpression(current) || ts3.isAsExpression(current) || ts3.isNonNullExpression(current)) { + current = current.expression; + continue; + } + return current; + } +} +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)) { + 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); + } else { + visit(node.expression); + } + visit(node.argumentExpression); + return; + } + if (ts3.isIdentifier(node)) { + if (paramLocals.has(node.text)) return; + const initializer3 = consts.get(node.text); + if (initializer3 && !followed.has(node.text)) { + followed.add(node.text); + visit(initializer3); + } + return; + } + if (ts3.isPropertyAssignment(node)) { + visit(node.initializer); + return; + } + ts3.forEachChild(node, visit); + }; + visit(expr); +} +function collectParamDependencies(props, consts, paramLocals) { + const out = {}; + if (paramLocals.size === 0) return out; + const record2 = (path, expr) => { + const found = /* @__PURE__ */ new Set(); + readParams(expr, consts, paramLocals, found); + if (found.size === 0) return; + const existing = out[path]; + const merged = existing && existing.kind === "build-param" ? /* @__PURE__ */ new Set([...existing.params, ...found]) : found; + out[path] = { kind: "build-param", params: [...merged].sort() }; + }; + const walk = (object2, prefix) => { + for (const member of object2.properties) { + if (ts3.isSpreadAssignment(member)) { + record2(prefix, member.expression); + continue; + } + if (ts3.isShorthandPropertyAssignment(member)) { + const key2 = member.name.text; + record2(prefix ? `${prefix}.${key2}` : key2, member.name); + continue; + } + if (!ts3.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)) { + walk(initializer3, path); + continue; + } + record2(path, member.initializer); + } + }; + walk(props, ""); + return out; +} +function parameterPathOf(node, scope) { + const segments = []; + let current = node; + for (; ; ) { + if (ts3.isPropertyAccessExpression(current)) { + segments.unshift(current.name.text); + current = current.expression; + continue; + } + if (ts3.isElementAccessExpression(current) && ts3.isStringLiteralLike(current.argumentExpression)) { + segments.unshift(current.argumentExpression.text); + current = current.expression; + continue; + } + break; + } + if (!ts3.isIdentifier(current)) return void 0; + if (scope.whole.has(current.text)) { + return segments.length === 0 ? void 0 : segments.join("."); + } + const base = scope.destructured.get(current.text); + if (base === void 0) return void 0; + return segments.length === 0 ? base : `${base}.${segments.join(".")}`; +} +function isEntityBinding(initializer3) { + const expr = unwrap(initializer3); + return ts3.isNewExpression(expr) || ts3.isCallExpression(expr); +} +function readCompositeParameters(expr, consts, scope, out) { + const followed = /* @__PURE__ */ new Set(); + const visit = (node) => { + if (ts3.isPropertyAccessExpression(node) || ts3.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); + return; + } + if (ts3.isIdentifier(node)) { + const path = parameterPathOf(node, scope); + if (path !== void 0) { + out.add(path); + return; + } + if (scope.whole.has(node.text)) return; + const initializer3 = consts.get(node.text); + if (initializer3 && !followed.has(node.text) && !isEntityBinding(initializer3)) { + followed.add(node.text); + visit(initializer3); + } + return; + } + if (ts3.isPropertyAssignment(node)) { + visit(node.initializer); + return; + } + ts3.forEachChild(node, visit); + }; + visit(expr); +} +function collectCompositeOrigins(props, consts, scope, composite) { + const out = {}; + const parametersOf = (expr) => { + const found = /* @__PURE__ */ new Set(); + readCompositeParameters(expr, consts, scope, found); + return [...found].sort(); + }; + const record2 = (path, expr, spread) => { + const parameters = parametersOf(expr); + if (parameters.length > 0) { + const existing = out[path]; + const merged = existing && existing.kind === "composite-parameter" ? [.../* @__PURE__ */ new Set([...existing.parameters, ...parameters])].sort() : parameters; + out[path] = { kind: "composite-parameter", composite, parameters: merged }; + return; + } + if (spread) return; + out[path] ??= { kind: "composite-literal", composite }; + }; + const walk = (object2, prefix) => { + for (const member of object2.properties) { + if (ts3.isSpreadAssignment(member)) { + record2(prefix, member.expression, true); + continue; + } + if (ts3.isShorthandPropertyAssignment(member)) { + const key2 = member.name.text; + record2(prefix ? `${prefix}.${key2}` : key2, member.name, false); + continue; + } + if (!ts3.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)) { + walk(initializer3, path); + continue; + } + record2(path, member.initializer, false); + } + }; + walk(props, ""); + return out; +} var ts3; var init_param_deps = __esm({ "node_modules/@intentius/chant/src/discovery/param-deps.ts"() { @@ -231339,7 +233175,1562 @@ var init_param_deps = __esm({ }); // node_modules/@intentius/chant/src/discovery/fold-import.ts -var ts4; +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"; +function lexiconPackageName(lexiconName) { + return `@intentius/chant-lexicon-${lexiconName}`; +} +function createFoldSession(intrinsics = [], buildParams, lexicons = [], sandbox = false) { + return { + intrinsics, + cache: /* @__PURE__ */ new Map(), + stack: [], + importCache: /* @__PURE__ */ new Map(), + resolvePathCache: /* @__PURE__ */ new Map(), + buildParams, + lexiconPackages: new Set(lexicons.map(lexiconPackageName)), + sandbox, + factoryModules: /* @__PURE__ */ new Map() + }; +} +function resolveModulePathMemoized(specifier, fromFile, resolvePathCache) { + const isBare = !specifier.startsWith(".") && !isAbsolute(specifier); + if (isBare) { + const cached3 = bareSpecifierPathCache.get(specifier); + if (cached3 !== void 0) return cached3; + const resolved2 = resolveModulePath(specifier, fromFile); + bareSpecifierPathCache.set(specifier, resolved2); + return resolved2; + } + const key = `${dirname8(fromFile)}\0${specifier}`; + const cached2 = resolvePathCache.get(key); + if (cached2 !== void 0) return cached2; + const resolved = resolveModulePath(specifier, fromFile); + resolvePathCache.set(key, resolved); + return resolved; +} +function cheapError(message) { + const prevStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + try { + return new Error(message); + } finally { + Error.stackTraceLimit = prevStackTraceLimit; + } +} +function importModuleMemoized(modulePath, importCache) { + const cached2 = importCache.get(modulePath); + if (cached2) return cached2; + const promise2 = importModule(modulePath); + importCache.set(modulePath, promise2); + return promise2; +} +function hasExportModifier(node) { + return node.modifiers?.some((m) => m.kind === ts4.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.propertyName) return el.name.text; + return ts4.isIdentifier(el.propertyName) ? el.propertyName.text : void 0; +} +function scanExports(sourceFile) { + const declarators = []; + for (const statement of sourceFile.statements) { + if (ts4.isExportAssignment(statement)) { + return { declarators, unfoldableReason: "`export default` is not foldable" }; + } + if (ts4.isExportDeclaration(statement)) { + if (statement.isTypeOnly) continue; + if (statement.moduleSpecifier) { + if (!ts4.isStringLiteral(statement.moduleSpecifier)) { + return { declarators, unfoldableReason: "re-export declaration is not foldable" }; + } + if (!statement.exportClause || !ts4.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)) { + return { declarators, unfoldableReason: "re-export declaration is not foldable" }; + } + elements2.push({ imported: importedNameNode.text, exportedName: el.name.text }); + } + declarators.push({ + kind: "re-export", + specifier: statement.moduleSpecifier.text, + specifierNode: statement.moduleSpecifier, + elements: elements2 + }); + continue; + } + if (!statement.exportClause || !ts4.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)) { + return { declarators, unfoldableReason: "export declaration is not foldable" }; + } + elements.push({ localNameNode, exportedName: el.name.text }); + } + 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) { + 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)) { + 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) { + 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)) { + 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)) { + const elements = []; + let allSupported = true; + for (const el of decl.name.elements) { + const propKey = bindingElementPropKey(el); + if (propKey === void 0) { + allSupported = false; + break; + } + elements.push({ propKey, bindingName: el.name.getText() }); + } + if (!allSupported) { + return { declarators, unfoldableReason: "exported destructured or uninitialized declaration is not foldable" }; + } + declarators.push({ kind: "destructure", node: decl.initializer, elements }); + continue; + } + return { declarators, unfoldableReason: "exported destructured or uninitialized declaration is not foldable" }; + } + } + return { declarators }; +} +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; + for (const decl of statement.declarationList.declarations) { + if (!decl.initializer) continue; + if (ts4.isIdentifier(decl.name)) { + bindings.set(decl.name.text, { source: decl.initializer }); + } else if (ts4.isObjectBindingPattern(decl.name)) { + for (const el of decl.name.elements) { + const propKey = bindingElementPropKey(el); + if (propKey === void 0) continue; + bindings.set(el.name.getText(), { source: decl.initializer, propKey }); + } + } + } + } + return bindings; +} +function unwrapFunctionInitializer(node) { + let current = node; + while (ts4.isParenthesizedExpression(current) || ts4.isAsExpression(current) || ts4.isSatisfiesExpression(current)) { + current = current.expression; + } + return ts4.isArrowFunction(current) || ts4.isFunctionExpression(current) ? current : void 0; +} +function collectLocalFunctions(sourceFile, ctx) { + const consts = new Map(ctx.consts); + for (const [name] of [...consts]) { + if (constResolvesToResource(ctx.consts, name, /* @__PURE__ */ new Set())) consts.delete(name); + } + const functions = /* @__PURE__ */ new Map(); + const add = (name, fn) => { + functions.set(name, new FoldableFunction(name, fn, ctx.file, consts, ctx.externals, ctx.crossFileFailures)); + }; + for (const statement of sourceFile.statements) { + if (ts4.isFunctionDeclaration(statement)) { + if (statement.name && statement.body) add(statement.name.text, statement); + continue; + } + if (!ts4.isVariableStatement(statement)) continue; + if ((statement.declarationList.flags & ts4.NodeFlags.Const) === 0) continue; + for (const decl of statement.declarationList.declarations) { + if (!ts4.isIdentifier(decl.name) || !decl.initializer) continue; + const fn = unwrapFunctionInitializer(decl.initializer); + if (fn) add(decl.name.text, fn); + } + } + return functions; +} +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; + const clause = statement.importClause; + if (!clause) continue; + if (clause.isTypeOnly) continue; + const specifier = statement.moduleSpecifier.text; + const specifierNode = statement.moduleSpecifier; + if (clause.name) { + named.set(clause.name.text, { specifier, imported: "default", specifierNode }); + } + if (clause.namedBindings) { + if (ts4.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)) { + namespaces.set(clause.namedBindings.name.text, { specifier, specifierNode }); + } + } + } + return { named, namespaces }; +} +function fastResolveBareSpecifier(specifier, fromFile) { + let dir = dirname8(fromFile); + for (; ; ) { + const packageDir = join7(dir, "node_modules", specifier); + if (existsSync5(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; + try { + return realpathSync3(resolved); + } catch { + return void 0; + } + } + const parent = dirname8(dir); + if (parent === dir) return void 0; + dir = parent; + } +} +function fastResolvePackageEntry(packageDir) { + const pkgJsonPath = join7(packageDir, "package.json"); + if (!existsSync5(pkgJsonPath)) return void 0; + let pkg; + try { + pkg = JSON.parse(readFileSync4(pkgJsonPath, "utf-8")); + } catch { + return void 0; + } + if (typeof pkg !== "object" || pkg === null) return void 0; + const exportsField = pkg.exports; + if (exportsField !== void 0) { + if (typeof exportsField === "string") return exportsField; + if (typeof exportsField !== "object" || exportsField === null || Array.isArray(exportsField)) { + return void 0; + } + const exportsObj = exportsField; + const hasSubpathKeys = Object.keys(exportsObj).some((k) => k.startsWith(".") && k !== "."); + const target = "." in exportsObj ? exportsObj["."] : hasSubpathKeys ? void 0 : exportsObj; + if (target === void 0) return void 0; + if (typeof target === "string") return target; + if (typeof target !== "object" || target === null || Array.isArray(target)) return void 0; + const conditions = target; + for (const key of ["default", "node", "import"]) { + const val = conditions[key]; + if (typeof val === "string") return val; + } + return void 0; + } + const main3 = pkg.main; + if (main3 !== void 0) return typeof main3 === "string" ? main3 : void 0; + return "index.js"; +} +function resolveModulePath(specifier, fromFile) { + if (specifier.startsWith(".") || isAbsolute(specifier)) { + const base = specifier.startsWith(".") ? resolvePath2(dirname8(fromFile), specifier) : specifier; + const candidates = [ + base, + `${base}.ts`, + `${base}.tsx`, + `${base}.js`, + `${base}.mjs`, + join7(base, "index.ts"), + join7(base, "index.js") + ]; + for (const candidate of candidates) { + if (existsSync5(candidate) && statSync2(candidate).isFile()) return candidate; + } + return base; + } + const fast = fastResolveBareSpecifier(specifier, fromFile); + if (fast !== void 0) return fast; + return createRequire2(fromFile).resolve(specifier); +} +function paramsModulePath() { + if (paramsModulePathMemo === void 0) { + try { + paramsModulePathMemo = resolveModulePath("../params", fileURLToPath(import.meta.url)); + } catch { + paramsModulePathMemo = null; + } + } + return paramsModulePathMemo; +} +function activeLexiconPackage(specifier, lexiconPackages) { + return lexiconPackages.has(specifier) ? specifier : void 0; +} +function bareSpecifierPackageRoot(specifier) { + if (specifier.startsWith(".") || isAbsolute(specifier)) return void 0; + const segments = specifier.split("/"); + if (specifier.startsWith("@")) { + return segments.length > 2 ? `${segments[0]}/${segments[1]}` : void 0; + } + 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; + } + let mod; + try { + mod = await importModuleMemoized(modulePath, session.importCache); + } catch { + return void 0; + } + if (!(binding.imported in mod)) return void 0; + const value = mod[binding.imported]; + if (typeof value === "function") { + const eager = session.intrinsics.some((i) => i.name === binding.imported && intrinsicCallFoldsEagerly(i)); + if (!eager) return void 0; + } + return { value }; +} +function resolveMemoized(node, ctx) { + const cached2 = ctx.memo.get(node); + if (cached2) return cached2; + const promise2 = resolveLiveValue(node, ctx); + ctx.memo.set(node, promise2); + return promise2; +} +async function resolveLiveValue(node, ctx) { + if (ts4.isParenthesizedExpression(node) || ts4.isNonNullExpression(node) || ts4.isAsExpression(node) || ts4.isSatisfiesExpression(node)) { + return resolveLiveValue(node.expression, ctx); + } + if (ts4.isIdentifier(node)) { + const binding = ctx.locals.get(node.text); + if (!binding) { + if (ctx.externals.has(node.text)) { + const external = ctx.externals.get(node.text); + if (isFoldableFunction(external)) { + throw cheapError(`function "${node.text}" used as a value is not foldable`); + } + return { value: external }; + } + return void 0; + } + const resolvedSource = await resolveMemoized(binding.source, ctx); + if (resolvedSource === void 0) return void 0; + if (binding.propKey === void 0) return resolvedSource; + if (!isIndexableObject(resolvedSource.value)) { + throw cheapError(`destructured member "${binding.propKey}" is not on a composite value`); + } + return { value: resolvedSource.value[binding.propKey] }; + } + if (ts4.isCallExpression(node)) { + return { value: await resolveCallExpression(node, ctx) }; + } + if (ts4.isPropertyAccessExpression(node)) { + const base = await resolveLiveValue(node.expression, ctx); + if (base === void 0) return void 0; + const key = node.name.text; + if (!isIndexableObject(base.value)) { + throw cheapError(`property access ".${key}" on a non-composite value is not foldable`); + } + return { value: base.value[key] }; + } + return void 0; +} +async function resolveCallExpression(node, ctx) { + if (!ts4.isIdentifier(node.expression)) { + throw cheapError(callExpressionMessage(node)); + } + const calleeName = node.expression.text; + const binding = ctx.imports.get(calleeName); + const local = ctx.externals.get(calleeName); + if (isFoldableFunction(local)) { + let foldFailure; + try { + const folded = fold(node, ctx.consts, ctx.intrinsics, ctx.externals); + return await reviveFoldedValue(folded, ctx, false); + } catch (err) { + if (!(err instanceof Error)) throw err; + foldFailure = err; + } + if (!binding) throw foldFailure; + 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) { + throw cheapError(callExpressionMessage(node)); + } + return resolveImportedCall(node, calleeName, binding, ctx); +} +async function resolveImportedCall(node, calleeName, binding, ctx) { + const factory = await resolveInterpretableFactory(binding, ctx); + if (factory) { + const args = await resolveCallArguments(node, calleeName, ctx); + const interpreted = await interpretCompositeFactory(factory, args, ctx); + if (interpreted) return interpreted.value; + return invokeImportedCallee(node, calleeName, binding, ctx, args); + } + return invokeImportedCallee(node, calleeName, binding, ctx); +} +async function invokeResolvedCallee(calleeName, binding, ctx, args) { + const refusal = sandboxedExecutionRefusal(binding, ctx, calleeName, "composite factory"); + if (refusal) throw cheapError(refusal); + let modulePath; + try { + modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch (err) { + throw cheapError( + `could not resolve import "${binding.specifier}" for "${calleeName}": ${err instanceof Error ? err.message : String(err)}` + ); + } + let mod; + try { + mod = await importModuleMemoized(modulePath, ctx.importCache); + } catch (err) { + throw cheapError( + `could not import "${binding.specifier}" to resolve "${calleeName}": ${err instanceof Error ? err.message : String(err)}` + ); + } + const Fn = mod[binding.imported]; + if (typeof Fn !== "function") { + throw cheapError(`"${binding.imported}" from "${binding.specifier}" is not a function`); + } + executionCounts.factoryInvocations += 1; + if (isProjectFileSpecifier(binding.specifier)) executionCounts.projectFactoryInvocations += 1; + return Fn(...args); +} +async function invokeImportedCallee(node, calleeName, binding, ctx, args) { + const callArgs = args ?? await resolveCallArguments(node, calleeName, ctx); + return invokeResolvedCallee(calleeName, binding, ctx, callArgs); +} +async function resolveCompositeCall(calleeName, args, ctx) { + const binding = ctx.imports.get(calleeName); + if (!binding) throw cheapError(`unresolved identifier: ${calleeName}`); + const factory = await resolveInterpretableFactory(binding, ctx); + if (factory) { + const interpreted = await interpretCompositeFactory(factory, args, ctx); + if (interpreted) return interpreted.value; + } + return invokeResolvedCallee(calleeName, binding, ctx, args); +} +async function resolveCallArguments(node, calleeName, ctx) { + const helperArgs = isFoldableHelperName(calleeName); + const args = []; + for (const argNode of node.arguments) { + const live = await resolveLiveValue(argNode, ctx); + args.push( + live !== void 0 ? live.value : await reviveFoldedValue(fold(argNode, ctx.consts, ctx.intrinsics, ctx.externals), ctx, helperArgs) + ); + } + return args; +} +function readFactoryModule(modulePath, session) { + const cached2 = session.factoryModules.get(modulePath); + if (cached2) return cached2; + const promise2 = readFactoryModuleCore(modulePath); + session.factoryModules.set(modulePath, promise2); + return promise2; +} +async function readFactoryModuleCore(modulePath) { + let sourceFile; + try { + const source = await readFile(modulePath, "utf-8"); + sourceFile = ts4.createSourceFile( + modulePath, + source, + ts4.ScriptTarget.Latest, + /* setParentNodes */ + true + ); + } catch { + return void 0; + } + const collected = collectImports(sourceFile); + const consts = collectConsts(sourceFile); + for (const [name] of [...consts]) { + if (constResolvesToResource(consts, name, /* @__PURE__ */ new Set())) consts.delete(name); + } + return { + file: modulePath, + sourceFile, + consts, + imports: collected.named, + namespaceImports: collected.namespaces + }; +} +function factoryModuleScopeResolved(scope, session) { + if (scope.resolved) return scope.resolved; + if (session.stack.includes(scope.file) || session.stack.length >= MAX_RESOLUTION_DEPTH) { + return Promise.resolve({ externals: /* @__PURE__ */ new Map(), failures: /* @__PURE__ */ new Map() }); + } + session.stack.push(scope.file); + scope.resolved = buildExternals(scope.file, scope.imports, scope.namespaceImports, session).finally(() => { + const idx = session.stack.lastIndexOf(scope.file); + if (idx !== -1) session.stack.splice(idx, 1); + }); + return scope.resolved; +} +function constResolvesToResource(consts, name, seen) { + if (seen.has(name)) return false; + seen.add(name); + const init = consts.get(name); + if (init === void 0) return false; + if (ts4.isNewExpression(init)) return true; + if (ts4.isIdentifier(init)) return constResolvesToResource(consts, init.text, seen); + return false; +} +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; + for (const decl of statement.declarationList.declarations) { + if (!ts4.isIdentifier(decl.name) || decl.name.text !== exportName) continue; + const init = decl.initializer; + if (!init || !ts4.isCallExpression(init) || !ts4.isIdentifier(init.expression)) return void 0; + const compositeBinding = scope.imports.get(init.expression.text); + if (!compositeBinding || compositeBinding.imported !== "Composite") return void 0; + if (!isChantOwnedHelperBinding(compositeBinding, { ...ctx, file: scope.file })) 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; + return { fn: fnArg, compositeName: nameArg ? nameArg.text : "anonymous" }; + } + } + return void 0; +} +async function resolveInterpretableFactory(binding, ctx) { + if (!isProjectFileSpecifier(binding.specifier)) return void 0; + if (ctx.interpretDepth >= MAX_INTERPRETATION_DEPTH) { + throw new InterpretationDepthError( + `interpretation depth exceeded ${MAX_INTERPRETATION_DEPTH} at "${binding.imported}" \u2014 a composite chain this deep is almost certainly recursive. Falling back to run rather than invoking the factory, which would have reported this file as folded while evaluating it a different way.`, + 0, + 0 + ); + } + let modulePath; + try { + modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch { + return void 0; + } + const scope = await readFactoryModule(modulePath, ctx.session); + if (!scope) return void 0; + const definition = findCompositeDefinition(scope, binding.imported, ctx); + if (!definition) return void 0; + if (findFactorySubsetViolation(definition.fn) !== void 0) return void 0; + return { scope, fn: definition.fn, compositeName: definition.compositeName }; +} +function findFactorySubsetViolation(fn) { + if (fn.parameters.length > 1) return "a composite factory takes a single props parameter"; + const param = fn.parameters[0]; + 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)) { + 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)) { + return "an array-destructured props parameter is not interpretable"; + } + } + if (!ts4.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 (!last) return "an early `return` is not interpretable"; + if (!statement.expression) return "a composite factory must return its members"; + const violation = checkFactoryExpression(statement.expression); + if (violation) return violation; + 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 ((statement.declarationList.flags & ts4.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)) { + 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)) { + return "an array-destructured `const` is not interpretable"; + } + const violation = checkFactoryExpression(decl.initializer); + if (violation) return violation; + } + } + return void 0; +} +function checkFactoryExpression(node) { + if (ts4.isParenthesizedExpression(node) || ts4.isAsExpression(node) || ts4.isSatisfiesExpression(node) || ts4.isNonNullExpression(node) || ts4.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) { + 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); + } + for (const arg of node.arguments ?? []) { + const violation = checkFactoryExpression(arg); + if (violation) return violation; + } + return void 0; + } + if (ts4.isTaggedTemplateExpression(node)) { + if (!ts4.isIdentifier(node.tag)) return unsupportedExpressionMessage(node); + if (ts4.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)) { + for (const span of node.templateSpans) { + const violation = checkFactoryExpression(span.expression); + if (violation) return violation; + } + return void 0; + } + if (ts4.isObjectLiteralExpression(node)) { + for (const prop of node.properties) { + if (ts4.isPropertyAssignment(prop)) { + if (!isLiteralPropertyNameNode(prop.name)) return computedPropertyNameMessage(prop.name); + const violation = checkFactoryExpression(prop.initializer); + if (violation) return violation; + } else if (ts4.isShorthandPropertyAssignment(prop)) { + if (prop.objectAssignmentInitializer) return UNSUPPORTED_OBJECT_MEMBER_MESSAGE; + } else if (ts4.isSpreadAssignment(prop)) { + const violation = checkFactoryExpression(prop.expression); + if (violation) return violation; + } else { + return UNSUPPORTED_OBJECT_MEMBER_MESSAGE; + } + } + return void 0; + } + if (ts4.isArrayLiteralExpression(node)) { + for (const el of node.elements) { + const violation = checkFactoryExpression(ts4.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 (!isLiteralElementKey(node.argumentExpression)) { + return `dynamic element access [${briefNodeText(node.argumentExpression)}] is not interpretable`; + } + return checkFactoryExpression(node.expression); + } + if (ts4.isPrefixUnaryExpression(node)) { + if (!SUPPORTED_UNARY_OPERATORS.has(node.operator)) return UNSUPPORTED_UNARY_MESSAGE; + return checkFactoryExpression(node.operand); + } + if (ts4.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)) { + 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); +} +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)) { + whole.add(param.name.text); + } else if (ts4.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); + } + } + } + const consts = new Map(moduleConsts); + const body = factory.fn.body; + if (ts4.isBlock(body)) { + for (const statement of body.statements) { + if (!ts4.isVariableStatement(statement)) continue; + for (const decl of statement.declarationList.declarations) { + if (ts4.isIdentifier(decl.name) && decl.initializer) consts.set(decl.name.text, decl.initializer); + } + } + } + return { composite: factory.compositeName, scope: { whole, destructured }, consts }; +} +function stampCompositeOrigins(entity, node, ctx) { + const recorder = ctx.compositeParams; + if (!recorder) return; + if (typeof entity !== "object" || entity === null) return; + let propsArg; + for (const argument of node.arguments ?? []) { + if (ts4.isObjectLiteralExpression(argument)) { + propsArg = argument; + break; + } + } + if (!propsArg) return; + const origins = collectCompositeOrigins(propsArg, recorder.consts, recorder.scope, recorder.composite); + for (const [path, origin] of Object.entries(origins)) setPathProvenance(entity, path, origin); +} +async function interpretCompositeFactory(factory, args, ctx) { + if (args.length > 1) return void 0; + const { scope, fn } = factory; + const resolved = await factoryModuleScopeResolved(scope, ctx.session); + const consts = new Map(scope.consts); + const externals = new Map(resolved.externals); + const bodyCtx = { + file: scope.file, + consts, + locals: /* @__PURE__ */ new Map(), + imports: scope.imports, + namespaceImports: scope.namespaceImports, + memo: /* @__PURE__ */ new Map(), + intrinsics: ctx.intrinsics, + externals, + crossFileFailures: resolved.failures, + importCache: ctx.importCache, + resolvePathCache: ctx.resolvePathCache, + lexiconPackages: ctx.lexiconPackages, + sandbox: ctx.sandbox, + session: ctx.session, + interpretDepth: ctx.interpretDepth + 1, + // chant #2161 — set unconditionally, and NOT inherited from `ctx`: a nested + // composite records its own parameters, never the enclosing one's. + compositeParams: compositeParamRecorder(factory, scope.consts) + }; + const bind = (name, value) => { + consts.delete(name); + externals.set(name, value); + }; + try { + const param = fn.parameters[0]; + if (param) { + const props = args[0]; + if (ts4.isIdentifier(param.name)) { + bind(param.name.text, props); + } else if (ts4.isObjectBindingPattern(param.name)) { + if (!isIndexableObject(props)) return void 0; + for (const el of param.name.elements) { + const key = bindingElementPropKey(el); + if (key === void 0) return void 0; + bind(el.name.getText(), props[key]); + } + } + } + const members = await interpretFactoryBody(fn, bodyCtx, bind); + if (!isIndexableObject(members)) return void 0; + const definition = Composite(() => members, factory.compositeName); + const instance = definition(); + executionCounts.factoryInterpretations += 1; + return { value: instance }; + } catch (err) { + if (err instanceof InterpretationDepthError) throw err; + return void 0; + } +} +async function interpretFactoryBody(fn, ctx, bind) { + if (!ts4.isBlock(fn.body)) return interpretExpression(fn.body, ctx); + for (const statement of fn.body.statements) { + if (ts4.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)) { + bind(decl.name.text, value); + continue; + } + if (!isIndexableObject(value)) { + throw cheapError(`destructured \`const\` source in "${briefNodeText(decl.name)}" is not an object`); + } + for (const el of decl.name.elements) { + bind(el.name.getText(), value[bindingElementPropKey(el)]); + } + } + } + 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)) { + return interpretExpression(node.expression, ctx); + } + if (ts4.isNewExpression(node)) return interpretNewExpression(node, ctx); + if (ts4.isObjectLiteralExpression(node)) { + const obj = {}; + for (const prop of node.properties) { + if (ts4.isPropertyAssignment(prop)) { + obj[propName(prop.name)] = await interpretExpression(prop.initializer, ctx); + } else if (ts4.isShorthandPropertyAssignment(prop)) { + obj[prop.name.text] = await interpretExpression(prop.name, ctx); + } else { + const src = await interpretExpression(prop.expression, ctx); + if (src === null || typeof src !== "object") throw cheapError("spread source not an object"); + Object.assign(obj, src); + } + } + return obj; + } + if (ts4.isArrayLiteralExpression(node)) { + const arr = []; + for (const el of node.elements) { + if (ts4.isSpreadElement(el)) { + const src = await interpretExpression(el.expression, ctx); + if (!Array.isArray(src)) throw cheapError("spread source not an array"); + arr.push(...src); + } else { + arr.push(await interpretExpression(el, ctx)); + } + } + return arr; + } + if (ts4.isConditionalExpression(node)) { + return await interpretExpression(node.condition, ctx) ? interpretExpression(node.whenTrue, ctx) : interpretExpression(node.whenFalse, ctx); + } + if (ts4.isBinaryExpression(node)) { + const S = ts4.SyntaxKind; + const opKind = node.operatorToken.kind; + if (opKind === S.AmpersandAmpersandToken) { + const left = await interpretExpression(node.left, ctx); + return left ? interpretExpression(node.right, ctx) : left; + } + if (opKind === S.BarBarToken) { + const left = await interpretExpression(node.left, ctx); + return left ? left : interpretExpression(node.right, ctx); + } + if (opKind === S.QuestionQuestionToken) { + const left = await interpretExpression(node.left, ctx); + return left === null || left === void 0 ? interpretExpression(node.right, ctx) : left; + } + } + return (await resolveDeclaratorValue(node, ctx)).value; +} +async function interpretNewExpression(node, ctx) { + if (!ts4.isIdentifier(node.expression)) { + throw cheapError(`\`new ${briefNodeText(node.expression)}(...)\` needs a plain imported constructor`); + } + const typeName = node.expression.text; + const binding = ctx.imports.get(typeName); + if (!binding) throw cheapError(`constructor "${typeName}" is not a resolvable import`); + const refusal = sandboxedExecutionRefusal(binding, ctx, typeName, "constructor"); + if (refusal) throw cheapError(refusal); + const modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + const mod = await importModuleMemoized(modulePath, ctx.importCache); + const Ctor = mod[binding.imported]; + if (typeof Ctor !== "function") { + throw cheapError(`"${binding.imported}" from "${binding.specifier}" is not a constructor`); + } + const ctorArgs = []; + for (const arg of node.arguments ?? []) ctorArgs.push(await interpretExpression(arg, ctx)); + const instance = new Ctor(...ctorArgs); + stampCompositeOrigins(instance, node, ctx); + return instance; +} +function applyResolvedValue(name, value, entities, exportedValues) { + exportedValues.set(name, value); + if (isDeclarable(value) || isCompositeInstance(value)) { + entities.push([name, value]); + } +} +async function resolveImportedExport(name, ctx) { + const binding = ctx.imports.get(name); + if (!binding) { + throw cheapError(`"${name}" is not a resolvable import`); + } + const refusal = sandboxedExecutionRefusal(binding, ctx, name, "import"); + if (refusal) throw cheapError(refusal); + let modulePath; + try { + modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch (err) { + throw cheapError( + `could not resolve import "${binding.specifier}" for "${name}": ${err instanceof Error ? err.message : String(err)}` + ); + } + let mod; + try { + mod = await importModuleMemoized(modulePath, ctx.importCache); + } catch (err) { + throw cheapError( + `could not import "${binding.specifier}" to resolve "${name}": ${err instanceof Error ? err.message : String(err)}` + ); + } + return mod[binding.imported]; +} +async function resolveSymbolicValue(text, ctx) { + if (!SIMPLE_DOTTED_CHAIN.test(text)) { + throw cheapError(`symbol "${text}" is not a simple dotted import reference`); + } + const [root, ...path] = text.split("."); + let value = await resolveImportedExport(root, ctx); + for (const key of path) { + if (value === null || value === void 0) { + throw cheapError(`symbol "${text}": "${root}" has no "${key}"`); + } + value = value[key]; + } + return value; +} +async function reviveFoldedValue(value, ctx, requireLiveRefs) { + if (value === null || typeof value !== "object") return value; + if (isAttrRefLike(value) || isDeclarable(value) || isCompositeInstance(value) || isIntrinsic(value)) { + return value; + } + if (Array.isArray(value)) { + const revived2 = []; + for (const el of value) revived2.push(await reviveFoldedValue(el, ctx, requireLiveRefs)); + return revived2; + } + if ("__symbol" in value) { + const symbolic = value; + return resolveSymbolicValue(symbolic.__symbol, ctx); + } + if ("__intrinsic" in value) { + const intrinsic = value; + const Fn = await resolveImportedExport(intrinsic.__intrinsic, ctx); + if (typeof Fn !== "function") { + throw cheapError(`intrinsic "${intrinsic.__intrinsic}" did not resolve to a function`); + } + const revived2 = []; + if ("args" in intrinsic) { + for (const a of intrinsic.args) revived2.push(await reviveFoldedValue(a, ctx, true)); + return Fn(...revived2); + } + for (const v of intrinsic.values) revived2.push(await reviveFoldedValue(v, ctx, true)); + return Fn(intrinsic.strings, ...revived2); + } + if ("__helper" in value) { + return reviveHelperCall(value, ctx); + } + if ("__compositeStep" in value) { + const call = value; + const revivedArgs = []; + for (const a of call.args) revivedArgs.push(await reviveFoldedValue(a, ctx, false)); + const result = await resolveCompositeCall(call.__compositeStep, revivedArgs, ctx); + if (!isIndexableObject(result)) { + throw cheapError(`composite call \`${call.__compositeStep}(...)\` did not resolve to an object with a "step" member`); + } + return result.step; + } + if ("__attrRef" in value) { + if (requireLiveRefs) { + throw cheapError( + "a same-file resource reference passed to a folded intrinsic or authoring helper is not foldable yet" + ); + } + return value; + } + if ("__resource" in value) { + return constructFoldedResource(value, ctx, requireLiveRefs); + } + const revived = {}; + for (const [key, v] of Object.entries(value)) { + revived[key] = await reviveFoldedValue(v, ctx, requireLiveRefs); + } + return revived; +} +async function reviveHelperCall(call, ctx) { + const name = call.__helper; + const binding = ctx.imports.get(name); + if (!binding) { + throw cheapError(`authoring helper "${name}(...)" is not a resolvable import`); + } + if (!isChantOwnedHelperBinding(binding, ctx)) { + throw cheapError( + `"${name}" is imported from "${binding.specifier}", which is not chant's own \u2014 only chant's registered authoring helpers fold as calls` + ); + } + const Fn = await resolveImportedExport(name, ctx); + if (typeof Fn !== "function") { + throw cheapError(`authoring helper "${name}" did not resolve to a function`); + } + const args = []; + for (const arg of call.args) args.push(await reviveFoldedValue(arg, ctx, true)); + return Fn(...args); +} +function isChantOwnedHelperBinding(binding, ctx) { + if (isChantOwnedSpecifier(binding.specifier)) return true; + if (!isProjectFileSpecifier(binding.specifier)) return false; + let targetPath; + try { + targetPath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch { + return false; + } + const root = chantCoreRoot(); + return targetPath === root || targetPath.startsWith(root + sep); +} +function isTrustedExecutableBinding(binding, ctx) { + if (activeLexiconPackage(binding.specifier, ctx.lexiconPackages) !== void 0) return true; + const subpathRoot = bareSpecifierPackageRoot(binding.specifier); + if (subpathRoot !== void 0 && activeLexiconPackage(subpathRoot, ctx.lexiconPackages) !== void 0) return true; + if (!isProjectFileSpecifier(binding.specifier) && !isChantOwnedSpecifier(binding.specifier)) return false; + let targetPath; + try { + targetPath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch { + return false; + } + const root = chantCoreRoot(); + return targetPath === root || targetPath.startsWith(root + sep); +} +function sandboxedExecutionRefusal(binding, ctx, name, what) { + if (!ctx.sandbox) return void 0; + if (isTrustedExecutableBinding(binding, ctx)) return void 0; + 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))); + return chantCoreRootMemo; +} +async function reviveFoldedProps(props, ctx, requireLiveRefs) { + const revived = {}; + for (const [key, value] of Object.entries(props)) { + revived[key] = await reviveFoldedValue(value, ctx, requireLiveRefs); + } + return revived; +} +async function reviveResourceCtorArgs(spec, ctx, requireLiveRefs) { + if (spec.args) { + const revived = []; + for (const arg of spec.args) revived.push(await reviveFoldedValue(arg, ctx, requireLiveRefs)); + return revived; + } + const props = await reviveFoldedProps(spec.props, ctx, requireLiveRefs); + return [props, spec.attributes ? await reviveFoldedProps(spec.attributes, ctx, requireLiveRefs) : void 0]; +} +async function instantiateFoldedResource(typeName, ctorArgs, ctx, forClause) { + const binding = ctx.imports.get(typeName); + if (!binding) { + throw cheapError(`constructor "${typeName}"${forClause} is not a resolvable import`); + } + const refusal = sandboxedExecutionRefusal(binding, ctx, typeName, "constructor"); + if (refusal) throw cheapError(refusal); + let modulePath; + try { + modulePath = resolveModulePathMemoized(binding.specifier, ctx.file, ctx.resolvePathCache); + } catch (err) { + throw cheapError( + `could not resolve import "${binding.specifier}" for "${typeName}": ${err instanceof Error ? err.message : String(err)}` + ); + } + let mod; + try { + mod = await importModuleMemoized(modulePath, ctx.importCache); + } catch (err) { + throw cheapError( + `could not import "${binding.specifier}" to resolve "${typeName}": ${err instanceof Error ? err.message : String(err)}` + ); + } + const Ctor = mod[binding.imported]; + if (typeof Ctor !== "function") { + throw cheapError(`"${binding.imported}" from "${binding.specifier}" is not a constructor`); + } + return new Ctor(...ctorArgs); +} +async function constructFoldedResource(spec, ctx, requireLiveRefs) { + const ctorArgs = await reviveResourceCtorArgs(spec, ctx, requireLiveRefs); + return instantiateFoldedResource(spec.__resource, ctorArgs, ctx, ""); +} +function paramLocalNames(ctx) { + const out = /* @__PURE__ */ new Set(); + const buildParams = ctx.session.buildParams; + if (!buildParams) return out; + for (const [name, value] of ctx.externals) { + if (value === buildParams) out.add(name); + } + return out; +} +function stampParamDependencies(entity, node, ctx) { + if (typeof entity !== "object" || entity === null) return; + const paramLocals = paramLocalNames(ctx); + if (paramLocals.size === 0) return; + let propsArg; + for (const argument of node.arguments ?? []) { + if (ts4.isObjectLiteralExpression(argument)) { + propsArg = argument; + break; + } + } + if (!propsArg) return; + for (const [path, origin] of Object.entries(collectParamDependencies(propsArg, ctx.consts, paramLocals))) { + setPathProvenance(entity, path, origin); + } +} +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; + try { + const spec = foldResource(initializer3, ctx.consts, ctx.intrinsics, ctx.externals); + const instance = await constructFoldedResource(spec, ctx, false); + stampParamDependencies(instance, initializer3, ctx); + built.set(initializer3, instance); + ctx.externals.set(name, instance); + } catch (err) { + ctx.prebuildFailures?.set(name, describeFoldFailure(err, ctx)); + } + } + return built; +} +async function resolveResourceEntity(name, node, ctx) { + let spec; + try { + spec = foldResource(node, ctx.consts, ctx.intrinsics, ctx.externals); + } catch (err) { + if (err instanceof FoldError) { + return { ok: false, reason: `"${name}" is not foldable: ${describeFoldFailure(err, ctx)}` }; + } + throw err; + } + let ctorArgs; + try { + ctorArgs = await reviveResourceCtorArgs(spec, ctx, false); + } catch (err) { + return { + ok: false, + reason: `"${name}" is not foldable: ${describeFoldFailure(err, ctx)}` + }; + } + try { + const entity = await instantiateFoldedResource(spec.__resource, ctorArgs, ctx, ` for "${name}"`); + stampParamDependencies(entity, node, ctx); + return { ok: true, entity }; + } catch (err) { + return { ok: false, reason: err instanceof Error ? err.message : String(err) }; + } +} +function describeFoldFailure(err, ctx) { + if (!(err instanceof Error)) return String(err); + const match = UNRESOLVED_IDENTIFIER_RE.exec(err.message); + if (match) { + const reason = ctx.crossFileFailures.get(match[1]); + if (reason) return `${err.message} (${reason})`; + } + const sameFile = SAME_FILE_RESOURCE_RE.exec(err.message); + if (sameFile) { + const cause = ctx.prebuildFailures?.get(sameFile[1]); + if (cause) return `${err.message} (${cause})`; + } + return err.message; +} +function describeDestructureSource(node) { + return ts4.isCallExpression(node) ? `${briefNodeText(node.expression)}(...)` : briefNodeText(node); +} +function locatedMessage(node, message) { + const { line, column } = locate(node); + return new FoldError(message, line, column).message; +} +function foldFileMemoized(file2, session) { + const cycleStart = session.stack.indexOf(file2); + if (cycleStart !== -1) { + const cycle = [...session.stack.slice(cycleStart), file2].map((f) => basename2(f)); + return Promise.resolve({ ok: false, reason: `import cycle: ${cycle.join(" -> ")}` }); + } + const cached2 = session.cache.get(file2); + if (cached2) return cached2; + if (session.stack.length >= MAX_RESOLUTION_DEPTH) { + const chain = [...session.stack.slice(-5), file2].map((f) => basename2(f)); + return Promise.resolve({ + ok: false, + reason: `cross-file resolution depth exceeded ${MAX_RESOLUTION_DEPTH} (...-> ${chain.join(" -> ")}) \u2014 this is almost certainly a resolution bug (memoization not taking effect), not a genuinely thousand-file-deep import chain` + }); + } + session.stack.push(file2); + const promise2 = tryFoldFileCore(file2, session).finally(() => { + const idx = session.stack.lastIndexOf(file2); + if (idx !== -1) session.stack.splice(idx, 1); + }); + session.cache.set(file2, promise2); + return promise2; +} +function isProjectFileSpecifier(specifier) { + return specifier.startsWith(".") || isAbsolute(specifier); +} +async function buildExternals(file2, imports, namespaceImports, session) { + const externals = /* @__PURE__ */ new Map(); + const failures = /* @__PURE__ */ new Map(); + const liveSources = /* @__PURE__ */ new Set(); + for (const [localName, binding] of imports) { + if (session.buildParams && binding.imported === "params") { + if (binding.specifier === PARAMS_BARE_SPECIFIER) { + externals.set(localName, session.buildParams); + continue; + } + if (isProjectFileSpecifier(binding.specifier)) { + try { + const targetPath2 = resolveModulePathMemoized(binding.specifier, file2, session.resolvePathCache); + if (targetPath2 === paramsModulePath()) { + externals.set(localName, session.buildParams); + continue; + } + } catch { + } + } + } + if (!isProjectFileSpecifier(binding.specifier)) { + const lexiconExport = await resolveActiveLexiconExport(binding, file2, session); + if (lexiconExport) { + externals.set(localName, lexiconExport.value); + continue; + } + continue; + } + let targetPath; + try { + targetPath = resolveModulePathMemoized(binding.specifier, file2, session.resolvePathCache); + } catch { + continue; + } + const result = await foldFileMemoized(targetPath, session); + if (!result.ok) { + failures.set(localName, locatedMessage(binding.specifierNode, result.reason)); + continue; + } + if (result.exportedValues.has(binding.imported)) { + const value = result.exportedValues.get(binding.imported); + externals.set(localName, value); + if (hasObjectIdentity(value)) liveSources.add(targetPath); + } else { + failures.set( + localName, + locatedMessage(binding.specifierNode, `"${binding.imported}" is not exported by "${binding.specifier}"`) + ); + } + } + for (const [localName, binding] of namespaceImports) { + if (!isProjectFileSpecifier(binding.specifier)) continue; + let targetPath; + try { + targetPath = resolveModulePathMemoized(binding.specifier, file2, session.resolvePathCache); + } catch { + continue; + } + const result = await foldFileMemoized(targetPath, session); + if (!result.ok) { + failures.set(localName, locatedMessage(binding.specifierNode, result.reason)); + continue; + } + externals.set(localName, Object.fromEntries(result.exportedValues)); + for (const value of result.exportedValues.values()) { + if (hasObjectIdentity(value)) { + liveSources.add(targetPath); + break; + } + } + } + return { externals, failures, liveSources }; +} +function hasObjectIdentity(value) { + if (isFoldableFunction(value)) return false; + return value !== null && (typeof value === "object" || typeof value === "function"); +} +async function resolveDeclaratorValue(node, ctx) { + const live = await resolveLiveValue(node, ctx); + if (live !== void 0) return live; + const folded = fold(node, ctx.consts, ctx.intrinsics, ctx.externals); + return { value: await reviveFoldedValue(folded, ctx, false) }; +} +async function tryFoldFileCore(file2, session) { + { + const root = chantCoreRoot(); + if (file2 === root || file2.startsWith(root + sep)) { + return { ok: false, reason: "chant's own module is not project source" }; + } + } + try { + const source = await readFile(file2, "utf-8"); + const sourceFile = ts4.createSourceFile( + file2, + source, + ts4.ScriptTarget.Latest, + /* setParentNodes */ + true + ); + const scan = scanExports(sourceFile); + if (scan.unfoldableReason) return { ok: false, reason: scan.unfoldableReason }; + if (scan.declarators.length === 0) return { ok: false, reason: "no foldable resource exports" }; + const collected = collectImports(sourceFile); + const { externals, failures, liveSources } = await buildExternals(file2, collected.named, collected.namespaces, session); + const ctx = { + file: file2, + consts: collectConsts(sourceFile), + locals: collectLocalBindings(sourceFile), + imports: collected.named, + namespaceImports: collected.namespaces, + memo: /* @__PURE__ */ new Map(), + intrinsics: session.intrinsics, + externals, + crossFileFailures: failures, + importCache: session.importCache, + resolvePathCache: session.resolvePathCache, + lexiconPackages: session.lexiconPackages, + sandbox: session.sandbox, + session, + interpretDepth: 0, + // chant#2423 — filled by the pre-build below, read by + // `describeFoldFailure` when a reference rejects for a const it could + // not build. + prebuildFailures: /* @__PURE__ */ new Map() + }; + const prebuiltResources = await preresolveResourceConsts(ctx); + const localFunctions = collectLocalFunctions(sourceFile, ctx); + for (const [name, marker] of localFunctions) { + if (!ctx.externals.has(name)) ctx.externals.set(name, marker); + } + const entities = []; + const exportedValues = /* @__PURE__ */ new Map(); + for (const decl of scan.declarators) { + if (decl.kind === "function") { + applyResolvedValue(decl.name, localFunctions.get(decl.name), entities, exportedValues); + continue; + } + if (decl.kind === "resource") { + const prebuilt = prebuiltResources.get(decl.node); + if (prebuilt !== void 0) { + applyResolvedValue(decl.name, prebuilt, entities, exportedValues); + continue; + } + const result2 = await resolveResourceEntity(decl.name, decl.node, ctx); + if (!result2.ok) return result2; + applyResolvedValue(decl.name, result2.entity, entities, exportedValues); + continue; + } + if (decl.kind === "single") { + const aliased = ts4.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); + continue; + } + let value; + try { + value = (await resolveDeclaratorValue(decl.node, ctx)).value; + } catch (err) { + return { ok: false, reason: `"${decl.name}" is not foldable: ${describeFoldFailure(err, ctx)}` }; + } + applyResolvedValue(decl.name, value, entities, exportedValues); + continue; + } + if (decl.kind === "destructure") { + let value; + const boundNames = decl.elements.map((el) => el.bindingName).join(", "); + const source2 = describeDestructureSource(decl.node); + try { + value = (await resolveDeclaratorValue(decl.node, ctx)).value; + } catch (err) { + return { + ok: false, + reason: `"${boundNames}" (destructured from ${source2}) is not foldable: ${describeFoldFailure(err, ctx)}` + }; + } + if (!isIndexableObject(value)) { + return { + ok: false, + reason: `"${boundNames}" (destructured from ${source2}) is not foldable: not a composite call or object` + }; + } + for (const { propKey, bindingName } of decl.elements) { + applyResolvedValue(bindingName, value[propKey], entities, exportedValues); + } + continue; + } + if (decl.kind === "named-export") { + for (const { localNameNode, exportedName } of decl.elements) { + const marker = localFunctions.get(localNameNode.text); + if (marker) { + applyResolvedValue(exportedName, marker, entities, exportedValues); + continue; + } + let value; + try { + value = (await resolveDeclaratorValue(localNameNode, ctx)).value; + } catch (err) { + return { ok: false, reason: `exported "${exportedName}" is not foldable: ${describeFoldFailure(err, ctx)}` }; + } + applyResolvedValue(exportedName, value, entities, exportedValues); + } + continue; + } + let targetPath; + try { + targetPath = resolveModulePathMemoized(decl.specifier, file2, session.resolvePathCache); + } catch (err) { + return { + ok: false, + reason: `could not resolve re-export "${decl.specifier}": ${err instanceof Error ? err.message : String(err)}` + }; + } + const result = await foldFileMemoized(targetPath, session); + if (!result.ok) { + return { + ok: false, + reason: `re-export from "${decl.specifier}" is not foldable: ${locatedMessage(decl.specifierNode, result.reason)}` + }; + } + for (const { imported, exportedName } of decl.elements) { + if (!result.exportedValues.has(imported)) { + return { + ok: false, + reason: locatedMessage(decl.specifierNode, `"${imported}" is not exported by "${decl.specifier}"`) + }; + } + const value = result.exportedValues.get(imported); + if (hasObjectIdentity(value)) liveSources.add(targetPath); + applyResolvedValue(exportedName, value, entities, exportedValues); + } + } + return { ok: true, entities, exportedValues, liveSources }; + } catch (err) { + return { ok: false, reason: err instanceof Error ? err.message : String(err) }; + } +} +async function tryFoldFile(file2, intrinsics = [], session) { + return foldFileMemoized(file2, session ?? createFoldSession(intrinsics)); +} +async function buildProjectImportEdges(files) { + const fileSet = new Set(files); + const edges = /* @__PURE__ */ new Map(); + for (const file2 of files) { + const targets = /* @__PURE__ */ new Set(); + const addTarget = (specifier) => { + if (!isProjectFileSpecifier(specifier)) return; + let resolved; + try { + resolved = resolveModulePath(specifier, file2); + } catch { + return; + } + if (fileSet.has(resolved)) targets.add(resolved); + }; + try { + const source = await readFile(file2, "utf-8"); + const sourceFile = ts4.createSourceFile(file2, source, ts4.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)) { + addTarget(statement.moduleSpecifier.text); + } + } + } catch { + } + edges.set(file2, targets); + } + return edges; +} +async function planFoldTaintWithEdges(files, wouldFold, liveSources) { + const fileSet = new Set(files); + const edges = await buildProjectImportEdges(files); + const reverse = /* @__PURE__ */ new Map(); + for (const [consumer, sources] of liveSources ?? []) { + if (!fileSet.has(consumer)) continue; + for (const source of sources) { + if (!fileSet.has(source)) continue; + let back = edges.get(source); + if (!back) { + back = /* @__PURE__ */ new Set(); + edges.set(source, back); + } + back.add(consumer); + let mine = reverse.get(source); + if (!mine) { + mine = /* @__PURE__ */ new Set(); + reverse.set(source, mine); + } + mine.add(consumer); + } + } + const tainted = new Set(files.filter((f) => wouldFold.get(f) !== true)); + const reachedBy = /* @__PURE__ */ new Map(); + const queue = [...tainted]; + while (queue.length > 0) { + const current = queue.shift(); + for (const target of edges.get(current) ?? []) { + if (!tainted.has(target)) { + tainted.add(target); + const forward = !reverse.get(current)?.has(target); + reachedBy.set(target, { from: current, kind: forward ? "importer" : "capture" }); + queue.push(target); + } + } + } + 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 init_fold_import = __esm({ "node_modules/@intentius/chant/src/discovery/fold-import.ts"() { ts4 = __toESM(require_typescript(), 1); @@ -231354,10 +234745,430 @@ var init_fold_import = __esm({ init_param_deps(); init_provenance(); init_lexicon(); + bareSpecifierPathCache = /* @__PURE__ */ new Map(); + executionCounts = { + factoryInvocations: 0, + projectFactoryInvocations: 0, + factoryInterpretations: 0 + }; + PARAMS_BARE_SPECIFIER = "@intentius/chant/params"; + MAX_INTERPRETATION_DEPTH = 16; + InterpretationDepthError = class extends FoldError { + }; + SIMPLE_DOTTED_CHAIN = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/; + UNRESOLVED_IDENTIFIER_RE = /unresolved identifier: (\S+)$/; + SAME_FILE_RESOURCE_RE = /same-file resource `([^`]+)` used as a value is not foldable/; + MAX_RESOLUTION_DEPTH = 200; + } +}); + +// node_modules/@intentius/chant/src/child-project.ts +function isChildProject(value) { + return typeof value === "object" && value !== null && CHILD_PROJECT_MARKER in value && value[CHILD_PROJECT_MARKER] === true; +} +var CHILD_PROJECT_MARKER; +var init_child_project = __esm({ + "node_modules/@intentius/chant/src/child-project.ts"() { + CHILD_PROJECT_MARKER = /* @__PURE__ */ Symbol.for("chant.childProject"); + } +}); + +// node_modules/@intentius/chant/src/discovery/entity-wire-codec.ts +function decodeValue(wire, registry2) { + if (wire === null || typeof wire !== "object") return wire; + if (Array.isArray(wire)) { + return wire.map((item) => decodeValue(item, registry2)); + } + const asRecord = wire; + if ("__attrRef" in asRecord) { + const { entity, attribute } = asRecord.__attrRef; + const parent = registry2.get(entity); + if (!parent) throw new Error(`decodeEntitySet: __attrRef refers to unknown entity "${entity}"`); + const ref = new AttrRef(parent, attribute); + ref._setLogicalName(entity); + return ref; + } + if ("__entityRef" in asRecord) { + const { entity } = asRecord.__entityRef; + const target = registry2.get(entity); + if (!target) throw new Error(`decodeEntitySet: __entityRef refers to unknown entity "${entity}"`); + return target; + } + if ("__property" in asRecord) { + const { lexicon, entityType, props } = asRecord.__property; + const obj = {}; + Object.defineProperty(obj, DECLARABLE_MARKER, { value: true, enumerable: false }); + Object.defineProperty(obj, "lexicon", { value: lexicon, enumerable: false, configurable: true }); + Object.defineProperty(obj, "entityType", { value: entityType, enumerable: false, configurable: true }); + Object.defineProperty(obj, "kind", { value: "property", enumerable: false, configurable: true }); + if (props !== void 0) { + Object.defineProperty(obj, "props", { value: decodeValue(props, registry2), enumerable: false, configurable: true }); + } + return obj; + } + if ("__intrinsic" in asRecord) { + const intrinsicWire = asRecord.__intrinsic; + const decodedValue = decodeValue(intrinsicWire.value, registry2); + const decodedRefs = intrinsicWire.refs.map((ref) => decodeValue(ref, registry2)); + const wrapper = { + [INTRINSIC_MARKER]: true, + __chantWireRefs: decodedRefs, + toJSON() { + return decodedValue; + } + }; + if ("yaml" in intrinsicWire) { + const decodedYaml = decodeValue(intrinsicWire.yaml, registry2); + wrapper.toYAML = () => decodedYaml; + } + return wrapper; + } + const result = {}; + for (const [key, val] of Object.entries(asRecord)) { + result[key] = decodeValue(val, registry2); + } + return result; +} +function decodeDeclarableShell(wire) { + const obj = {}; + for (const marker of wire.markers) { + Object.defineProperty(obj, Symbol.for(marker), { value: true, enumerable: false, configurable: true }); + } + if (!(DECLARABLE_MARKER in obj)) { + Object.defineProperty(obj, DECLARABLE_MARKER, { value: true, enumerable: false }); + } + Object.defineProperty(obj, "lexicon", { value: wire.lexicon, enumerable: false, configurable: true }); + Object.defineProperty(obj, "entityType", { value: wire.entityType, enumerable: false, configurable: true }); + if (wire.kind !== void 0) { + Object.defineProperty(obj, "kind", { value: wire.kind, enumerable: false, configurable: true }); + } + return obj; +} +function decodeEntitySet(wire) { + const registry2 = /* @__PURE__ */ new Map(); + for (const entry of wire.entities) { + if (entry.form === "declarable") { + registry2.set(entry.name, decodeDeclarableShell(entry)); + } + } + const result = /* @__PURE__ */ new Map(); + for (const entry of wire.entities) { + if (entry.form === "declarable") { + const obj = registry2.get(entry.name); + if (entry.props !== void 0) { + Object.defineProperty(obj, "props", { value: decodeValue(entry.props, registry2), enumerable: false, configurable: true }); + } + if (entry.attributes !== void 0) { + Object.defineProperty(obj, "attributes", { value: decodeValue(entry.attributes, registry2), enumerable: false, configurable: true }); + } + for (const [key, val] of Object.entries(entry.extra ?? {})) { + obj[key] = decodeValue(val, registry2); + } + result.set(entry.name, obj); + continue; + } + const ref = decodeValue(entry.ref, registry2); + const output = new LexiconOutput(ref, entry.outputName); + registry2.set(entry.name, output); + result.set(entry.name, output); + } + return result; +} +var init_entity_wire_codec = __esm({ + "node_modules/@intentius/chant/src/discovery/entity-wire-codec.ts"() { + init_declarable(); + init_attrref(); + init_intrinsic(); + init_utils(); + init_lexicon_output(); + init_child_project(); + } +}); + +// node_modules/@intentius/chant/src/discovery/sandbox/child-errors.ts +function isPermissionDenied(err) { + return typeof err === "object" && err !== null && err.code === "ERR_ACCESS_DENIED"; +} +function classifyChildError(file2, err, fallbackType = "import") { + if (isPermissionDenied(err)) { + const operation = typeof err.permission === "string" ? err.permission : "an unrecognized sandboxed operation"; + const resource = typeof err.resource === "string" ? ` (${err.resource})` : ""; + const where = file2 ? `"${file2}"` : "sandboxed run-fallback code"; + return new DiscoveryError( + file2, + `sandbox denied ${operation}${resource}: ${where} attempted an operation outside the sandbox's allowlist`, + "permission" + ); + } + const message = err instanceof Error ? err.message : String(err); + return new DiscoveryError(file2, message, fallbackType); +} +var init_child_errors = __esm({ + "node_modules/@intentius/chant/src/discovery/sandbox/child-errors.ts"() { + init_errors3(); + } +}); + +// node_modules/@intentius/chant/src/discovery/sandbox/run.ts +var run_exports = {}; +__export(run_exports, { + runFallbackFilesSandboxed: () => runFallbackFilesSandboxed +}); +import { realpathSync as realpathSync4, rmSync as rmSync3 } from "node:fs"; +import { resolve as resolve4 } from "node:path"; +function isChildResponse(value) { + return typeof value === "object" && value !== null && "entitySet" in value && "errors" in value; +} +async function runFallbackFilesSandboxed(files, buildRoot) { + if (files.length === 0) { + return { entities: /* @__PURE__ */ new Map(), errors: [], bundleMs: 0, bundleBytes: 0, provenanceByName: {} }; + } + const driverSource = generateDriverSource({ files, buildRoot }); + const { bundlePath, bundleDir, externalReadPaths, durationMs, bytes } = await bundleDriver(driverSource); + try { + let projectRealpath; + try { + projectRealpath = realpathSync4(resolve4(buildRoot)); + } catch { + projectRealpath = resolve4(buildRoot); + } + const response = await forkSandboxed( + { + bundlePath, + bundleDir, + projectRealpath, + externalReadPaths, + // chant #1045 Phase 2 — Node's Permission Model does not gate + // `process.env`; scrubbing it at spawn is the only way to keep the + // ambient environment out of untrusted project source's reach. `PATH` + // is kept only because some platforms' module resolution/dynamic + // linking consults it; it carries no project secrets. + env: { PATH: process.env.PATH ?? "" }, + timeoutMs: CHILD_TIMEOUT_MS, + label: "sandboxed run", + // chant #1148 — a run-fallback file's own console.log/error no + // longer goes nowhere; see `./fork.ts`'s `outputPrefix` doc. + outputPrefix: "[sandbox:run]" + }, + isChildResponse + ); + const errors = (response.errors ?? []).map( + (e) => new DiscoveryError(e.file, e.message, e.type) + ); + const provenanceByName = response.provenanceByName ?? {}; + if (response.fatal) { + return { entities: /* @__PURE__ */ new Map(), errors, bundleMs: durationMs, bundleBytes: bytes, provenanceByName }; + } + const entities = decodeEntitySet(response.entitySet ?? { entities: [] }); + return { entities, errors, bundleMs: durationMs, bundleBytes: bytes, provenanceByName }; + } catch (err) { + return { + entities: /* @__PURE__ */ new Map(), + errors: [classifyChildError("", err, "import")], + provenanceByName: {}, + bundleMs: durationMs, + bundleBytes: bytes + }; + } finally { + rmSync3(bundleDir, { recursive: true, force: true }); + } +} +var CHILD_TIMEOUT_MS; +var init_run = __esm({ + "node_modules/@intentius/chant/src/discovery/sandbox/run.ts"() { + init_errors3(); + init_entity_wire_codec(); + init_bundle(); + init_child_errors(); + init_driver(); + init_fork(); + CHILD_TIMEOUT_MS = 12e4; } }); // 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"; +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")); + if (pkg.type === "module") return; + const found = pkg.type ? `"type": "${pkg.type}"` : "no `type` field"; + const names = Object.keys(values).sort().join(", "); + console.error( + `warning: ${pkgPath} has ${found}, but chant is ESM \u2014 build parameters (${names}) will read as empty in project source on the run path, so declarations conditioned on them take their default branch. Set "type": "module". (chant #1421)` + ); + } catch { + } +} +function findPackageJsonUpward(startDir) { + let dir = startDir; + const { root } = parse3(dir); + for (; ; ) { + const candidate = join8(dir, "package.json"); + if (existsSync6(candidate)) return candidate; + if (dir === root) return void 0; + const parent = dirname9(dir); + if (parent === dir) return void 0; + dir = parent; + } +} +async function discover(path, options) { + const errors = []; + const sourceFiles = []; + const foldDecisions = []; + const buildParamValuesMap = buildParamValues(options?.buildParams ?? []); + setBuildParams(buildParamValuesMap); + warnIfParamsCannotReachProject(path, buildParamValuesMap); + const files = await findInfraFiles(path); + sourceFiles.push(...files); + 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?.fold) { + for (const file2 of files) { + foldAttempts.set(file2, await tryFoldFile(file2, options.intrinsics, foldSession)); + } + } + const taintPlan = options?.fold ? await planFoldTaintWithEdges( + files, + new Map(files.map((file2) => [file2, foldAttempts.get(file2)?.ok === true])), + // chant #1044 — which files' OBJECTS each successful fold captured, + // so a file forced back to run also invalidates the folds that + // already hold its instances (see planFoldTaint's doc). + new Map( + files.flatMap((file2) => { + const attempt = foldAttempts.get(file2); + return attempt?.ok === true ? [[file2, attempt.liveSources]] : []; + }) + ) + ) : { tainted: /* @__PURE__ */ new Set(), reachedBy: /* @__PURE__ */ new Map() }; + const taintedFiles = taintPlan.tainted; + for (const file2 of files) { + if (options?.fold) { + const folded = foldAttempts.get(file2); + if (folded.ok && !taintedFiles.has(file2)) { + modules.push({ file: file2, exports: Object.fromEntries(folded.exportedValues) }); + foldDecisions.push({ file: file2, mode: "fold", resourceCount: folded.entities.length }); + 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`; + foldDecisions.push({ file: file2, mode: "run", reason, reverseTainted: folded.ok }); + } + if (options?.sandbox) { + sandboxFiles.push(file2); + continue; + } + try { + const exports = await importModule(file2); + modules.push({ file: file2, exports }); + } catch (error51) { + if (error51 instanceof Error && error51.name === "DiscoveryError") { + errors.push(error51); + } else { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + errors.push( + new DiscoveryErrorClass( + file2, + error51 instanceof Error ? error51.message : String(error51), + "import" + ) + ); + } + } + } + let entities = /* @__PURE__ */ new Map(); + try { + entities = collectEntities(modules, path); + } catch (error51) { + if (error51 instanceof Error && error51.name === "DiscoveryError") { + errors.push(error51); + } else { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + errors.push( + new DiscoveryErrorClass( + "", + error51 instanceof Error ? error51.message : String(error51), + "resolution" + ) + ); + } + return { + entities: /* @__PURE__ */ new Map(), + dependencies: /* @__PURE__ */ new Map(), + sourceFiles, + errors, + foldDecisions + }; + } + if (options?.sandbox && sandboxFiles.length > 0) { + try { + const { runFallbackFilesSandboxed: runFallbackFilesSandboxed2 } = await Promise.resolve().then(() => (init_run(), run_exports)); + const sandboxResult = await runFallbackFilesSandboxed2(sandboxFiles, path); + errors.push(...sandboxResult.errors); + for (const [name, entity] of sandboxResult.entities) { + if (entities.has(name)) { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + const file2 = sandboxResult.provenanceByName[name] ?? path; + errors.push(new DiscoveryErrorClass(file2, `Duplicate export name "${name}" found`, "resolution")); + continue; + } + entities.set(name, entity); + } + const fileOrder = new Map(files.map((file2, i) => [file2, i])); + const withIndex = [...entities.entries()].map(([name, entity]) => { + const sourceFile = getProvenance(entity)?.sourceFile ?? sandboxResult.provenanceByName[name]; + const index = sourceFile !== void 0 ? fileOrder.get(sourceFile) : void 0; + return { name, entity, index: index ?? Number.MAX_SAFE_INTEGER }; + }); + withIndex.sort((a, b) => a.index - b.index); + entities = new Map(withIndex.map(({ name, entity }) => [name, entity])); + } catch (error51) { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + errors.push( + new DiscoveryErrorClass(path, error51 instanceof Error ? error51.message : String(error51), "resolution") + ); + } + } + try { + resolveAttrRefs(entities); + } catch (error51) { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + errors.push( + new DiscoveryErrorClass( + "", + error51 instanceof Error ? error51.message : String(error51), + "resolution" + ) + ); + } + let dependencies = /* @__PURE__ */ new Map(); + try { + dependencies = buildDependencyGraph(entities); + } catch (error51) { + const { DiscoveryError: DiscoveryErrorClass } = await Promise.resolve().then(() => (init_errors3(), errors_exports2)); + errors.push( + new DiscoveryErrorClass( + "", + error51 instanceof Error ? error51.message : String(error51), + "resolution" + ) + ); + } + return { + entities, + dependencies, + sourceFiles, + errors, + foldDecisions + }; +} var init_discovery = __esm({ "node_modules/@intentius/chant/src/discovery/index.ts"() { init_files(); @@ -231378,28 +235189,133 @@ var init_cache = __esm({ } }); +// node_modules/@intentius/chant/src/fold-provenance.ts +function isPlainObject2(value) { + if (value === null || typeof value !== "object" || Array.isArray(value)) return false; + const proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; +} +function emittedFieldPaths(props) { + const out = []; + const walk = (value, prefix) => { + if (value === void 0) return; + if (isPlainObject2(value)) { + const keys = Object.keys(value).sort(); + if (keys.length === 0) { + if (prefix) out.push(prefix); + return; + } + for (const key of keys) walk(value[key], prefix ? `${prefix}.${key}` : key); + return; + } + if (prefix) out.push(prefix); + }; + walk(props, ""); + return out; +} +function classifyFieldOrigin(origin, provenance) { + if (!provenance) return { kind: "unknown", reason: "no-provenance" }; + const instance = provenance.compositeInstance; + switch (origin?.kind) { + case "composite-parameter": + return { + kind: "composite-parameter", + composite: origin.composite, + ...instance ? { instance } : {}, + parameters: [...origin.parameters] + }; + case "composite-literal": + return { kind: "composite-literal", composite: origin.composite, ...instance ? { instance } : {} }; + case "composite": + return { kind: "unknown", reason: "composite-not-interpreted" }; + case "authored": + case "build-param": + return { kind: "direct" }; + case void 0: + return provenance.composite ? { kind: "unknown", reason: "composite-not-interpreted" } : { kind: "direct" }; + } +} +function foldProvenanceOfEntity(entity, provenance) { + if (!isResourceDeclarable(entity)) return void 0; + const paths = emittedFieldPaths(entity.props); + if (paths.length === 0) return void 0; + const fields = {}; + for (const path of paths) { + fields[path] = classifyFieldOrigin(originOfPath(provenance?.paths, path), provenance); + } + return { + ...provenance?.sourceFile ? { sourceFile: provenance.sourceFile } : {}, + ...provenance?.composite ? { composite: provenance.composite } : {}, + ...provenance?.compositeInstance ? { instance: provenance.compositeInstance } : {}, + fields + }; +} +function foldProvenanceOfEntities(entities, provenanceOf) { + const out = {}; + for (const name of [...entities.keys()].sort()) { + const entity = entities.get(name); + const record2 = foldProvenanceOfEntity(entity, provenanceOf(entity)); + if (record2) out[name] = record2; + } + return out; +} +var init_fold_provenance = __esm({ + "node_modules/@intentius/chant/src/fold-provenance.ts"() { + init_declarable(); + init_provenance(); + } +}); + // node_modules/@intentius/chant/src/lifecycle/scenario.ts +function isScenario(value) { + return typeof value === "object" && value !== null && SCENARIO_MARKER in value && value[SCENARIO_MARKER] === true; +} +var SCENARIO_MARKER; var init_scenario = __esm({ "node_modules/@intentius/chant/src/lifecycle/scenario.ts"() { init_declarable(); + SCENARIO_MARKER = /* @__PURE__ */ Symbol.for("chant.scenario"); } }); -// node_modules/@intentius/chant/src/child-project.ts -var init_child_project = __esm({ - "node_modules/@intentius/chant/src/child-project.ts"() { +// node_modules/@intentius/chant/src/runtime.ts +function createResource(type, lexicon, attrMap) { + const ResourceClass = function(props, attributes) { + Object.defineProperty(this, DECLARABLE_MARKER, { value: true, enumerable: false }); + Object.defineProperty(this, "lexicon", { value: lexicon, enumerable: false }); + Object.defineProperty(this, "entityType", { value: type, enumerable: false }); + Object.defineProperty(this, "kind", { value: "resource", enumerable: false }); + Object.defineProperty(this, "props", { value: props ?? {}, enumerable: false, configurable: true }); + Object.defineProperty(this, "attributes", { value: attributes ?? {}, enumerable: false, configurable: true }); + Object.defineProperty(this, "Ref", { value: this, enumerable: false }); + for (const [camelName, attrName] of Object.entries(attrMap)) { + Object.defineProperty(this, camelName, { + value: new AttrRef(this, attrName), + enumerable: true, + writable: false + }); + } + }; + Object.defineProperty(ResourceClass, "name", { value: type.split("::").pop() ?? type }); + return ResourceClass; +} +var init_runtime = __esm({ + "node_modules/@intentius/chant/src/runtime.ts"() { + init_declarable(); + init_attrref(); } }); -// node_modules/@intentius/chant/src/discovery/entity-wire-codec.ts -var init_entity_wire_codec = __esm({ - "node_modules/@intentius/chant/src/discovery/entity-wire-codec.ts"() { - init_declarable(); - init_attrref(); - init_intrinsic(); - init_utils(); - init_lexicon_output(); - init_child_project(); +// node_modules/@intentius/chant/src/op/resource.ts +function isOpEntity(entity) { + return entity?.entityType === OP_ENTITY_TYPE; +} +var OP_ENTITY_TYPE, OpResource; +var init_resource = __esm({ + "node_modules/@intentius/chant/src/op/resource.ts"() { + init_runtime(); + OP_ENTITY_TYPE = "Chant::Op"; + OpResource = createResource(OP_ENTITY_TYPE, "chant", {}); } }); @@ -231413,13 +235329,435 @@ var init_entity_wire = __esm({ }); // node_modules/@intentius/chant/src/build.ts +var build_exports = {}; +__export(build_exports, { + build: () => build2, + buildFromEntitiesJson: () => buildFromEntitiesJson, + collectLexiconOutputs: () => collectLexiconOutputs, + computeStackGraph: () => computeStackGraph, + detectCrossLexiconRefs: () => detectCrossLexiconRefs, + mergeBuildRootEntities: () => mergeBuildRootEntities, + partitionByLexicon: () => partitionByLexicon +}); +import { resolve as resolve5 } from "node:path"; +function computeStackGraph(entities, lexiconNames) { + const edges = []; + const edgeSet = /* @__PURE__ */ new Set(); + const addEdge = (from, to) => { + if (from === to) return; + const key = `${from}\0${to}`; + if (edgeSet.has(key)) return; + edgeSet.add(key); + edges.push({ from, to }); + }; + const walk = (value, consumer, visited) => { + if (value === null || value === void 0 || typeof value !== "object") return; + if (visited.has(value)) return; + visited.add(value); + if (isAttrRefLike(value)) { + const parent = value.parent.deref(); + const producer = parent ? parent.lexicon : void 0; + if (typeof producer === "string" && producer !== consumer) addEdge(consumer, producer); + return; + } + if (isLexiconOutput(value)) return; + if (Array.isArray(value)) { + for (const item of value) walk(item, consumer, visited); + return; + } + for (const val of Object.values(value)) walk(val, consumer, visited); + }; + for (const [, entity] of entities) { + const consumer = entity.lexicon; + const visited = /* @__PURE__ */ new Set(); + for (const val of Object.values(entity)) { + walk(val, consumer, visited); + } + if ("props" in entity && typeof entity.props === "object" && entity.props !== null) { + 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 deps = /* @__PURE__ */ new Map(); + for (const n of nodes) deps.set(n, /* @__PURE__ */ new Set()); + for (const { from, to } of edges) { + if (!deps.has(from)) deps.set(from, /* @__PURE__ */ new Set()); + if (!deps.has(to)) deps.set(to, /* @__PURE__ */ new Set()); + deps.get(from).add(to); + } + const remaining = new Set(deps.keys()); + const waves = []; + const order = []; + while (remaining.size > 0) { + const wave = [...remaining].filter((n) => [...deps.get(n)].every((d) => !remaining.has(d))).sort(); + if (wave.length === 0) break; + for (const n of wave) { + remaining.delete(n); + order.push(n); + } + waves.push(wave); + } + const cycles = remaining.size > 0 ? [[...remaining].sort()] : []; + edges.sort((a, b) => `${a.from}\0${a.to}`.localeCompare(`${b.from}\0${b.to}`)); + return { nodes: [...nodes].sort(), edges, order, waves, cycles }; +} +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; + const lexicon = entity.lexicon; + if (!partitions.has(lexicon)) { + partitions.set(lexicon, /* @__PURE__ */ new Map()); + } + partitions.get(lexicon).set(name, entity); + } + return partitions; +} +function collectLexiconOutputs(entities) { + const outputs = []; + const visited = /* @__PURE__ */ new Set(); + function walk(value) { + if (value === null || value === void 0 || typeof value !== "object") { + return; + } + if (visited.has(value)) return; + visited.add(value); + if (isLexiconOutput(value)) { + outputs.push(value); + return; + } + if (Array.isArray(value)) { + for (const item of value) { + walk(item); + } + return; + } + for (const val of Object.values(value)) { + walk(val); + } + } + for (const [name, entity] of entities) { + if (isLexiconOutput(entity)) { + const lexiconOutput = entity; + if (lexiconOutput._literalValue === null) { + const parent = lexiconOutput._sourceParent?.deref(); + let sourceName = name; + if (parent) { + for (const [entityName, e] of entities) { + if (e === parent) { + sourceName = entityName; + break; + } + } + } + lexiconOutput._setSourceEntity(sourceName); + } + outputs.push(lexiconOutput); + continue; + } + if ("props" in entity && typeof entity.props === "object" && entity.props !== null) { + const prevLength = outputs.length; + walk(entity.props); + for (let i = prevLength; i < outputs.length; i++) { + if (!outputs[i].sourceEntity && outputs[i]._literalValue === null) { + outputs[i]._setSourceEntity(name); + } + } + } + } + return outputs; +} +function detectCrossLexiconRefs(entities) { + const outputs = []; + const seen = /* @__PURE__ */ new Set(); + const objectToName = /* @__PURE__ */ new Map(); + for (const [name, entity] of entities) { + objectToName.set(entity, name); + } + function walk(value, consumingLexicon, visited) { + if (value === null || value === void 0 || typeof value !== "object") { + return; + } + if (visited.has(value)) return; + visited.add(value); + if (isAttrRefLike(value)) { + const parent = value.parent.deref(); + if (!parent) return; + const parentLexicon = parent.lexicon; + if (typeof parentLexicon !== "string") return; + if (parentLexicon !== consumingLexicon) { + const parentName = objectToName.get(parent); + if (!parentName) return; + const key = `${parentName}_${value.attribute}`; + if (!seen.has(key)) { + seen.add(key); + outputs.push(LexiconOutput.auto(value, parentName)); + } + } + return; + } + if (isLexiconOutput(value)) return; + if (objectToName.has(value)) return; + if (Array.isArray(value)) { + for (const item of value) { + walk(item, consumingLexicon, visited); + } + return; + } + for (const val of Object.values(value)) { + walk(val, consumingLexicon, visited); + } + } + for (const [, entity] of entities) { + const visited = /* @__PURE__ */ new Set(); + const consumingLexicon = entity.lexicon; + for (const val of Object.values(entity)) { + walk(val, consumingLexicon, visited); + } + if ("props" in entity && typeof entity.props === "object" && entity.props !== null) { + walk(entity.props, consumingLexicon, visited); + } + } + return outputs; +} +function computeDeployOrder(lexiconNames, lexiconOutputs) { + const deps = /* @__PURE__ */ new Map(); + for (const name of lexiconNames) { + deps.set(name, /* @__PURE__ */ new Set()); + } + for (const output of lexiconOutputs) { + for (const name of lexiconNames) { + if (name !== output.sourceLexicon) { + deps.get(name)?.add(output.sourceLexicon); + } + } + } + const sorted = []; + const visited = /* @__PURE__ */ new Set(); + const visiting = /* @__PURE__ */ new Set(); + function visit(name) { + if (visited.has(name)) return; + if (visiting.has(name)) return; + visiting.add(name); + for (const dep of deps.get(name) ?? []) { + visit(dep); + } + visiting.delete(name); + visited.add(name); + sorted.push(name); + } + for (const name of lexiconNames) { + visit(name); + } + return sorted; +} +function generateManifest(lexiconNames, lexiconOutputs, entities) { + const outputsRecord = {}; + for (const output of lexiconOutputs) { + outputsRecord[output.outputName] = { + source: output.sourceLexicon, + entity: output.sourceEntity, + attribute: output.sourceAttribute ?? "" + }; + } + return { + lexicons: lexiconNames, + outputs: outputsRecord, + deployOrder: computeDeployOrder(lexiconNames, lexiconOutputs), + stackGraph: computeStackGraph(entities, lexiconNames) + }; +} +async function mergeBuildRootEntities(entities, contributors) { + const warnings = []; + const errors = []; + for (const contribute of contributors) { + try { + const contribution = await contribute({ entities }); + warnings.push(...contribution.warnings ?? []); + for (const [name, entity] of contribution.entities) { + if (entities.has(name)) { + errors.push(`Build-root entity "${name}" collides with a discovered entity of the same name`); + continue; + } + entities.set(name, entity); + } + } catch (error51) { + errors.push(error51 instanceof Error ? error51.message : String(error51)); + } + } + return { warnings, errors }; +} +async function build2(path, serializers, parentBuildStack, options) { + const discoveryResult = await discover(path, { + fold: options?.fold, + intrinsics: options?.intrinsics, + lexicons: options?.lexicons, + sandbox: options?.sandbox, + buildParams: options?.buildParams + }); + return buildFromDiscoveryResult(discoveryResult, path, serializers, parentBuildStack, options); +} +async function buildFromDiscoveryResult(discoveryResult, resolvedPathForChildStack, serializers, parentBuildStack, options) { + const warnings = []; + const errors = []; + errors.push(...discoveryResult.errors); + const dependenciesRecord = {}; + for (const [entityName, deps] of discoveryResult.dependencies) { + dependenciesRecord[entityName] = Array.from(deps); + } + try { + topologicalSort(dependenciesRecord); + } catch (error51) { + if (error51 instanceof Error && error51.name === "BuildError") { + errors.push(error51); + } else { + errors.push( + new BuildError( + "", + error51 instanceof Error ? error51.message : String(error51) + ) + ); + } + } + const resolvedPath = resolve5(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); + if (buildStack.has(childPath)) { + errors.push( + new BuildError( + childPath, + `Circular nested stack: ${[...buildStack].join(" \u2192 ")} \u2192 ${childPath}` + ) + ); + continue; + } + const childResult = await build2(childPath, serializers, buildStack, options); + entity.buildResult = childResult; + if (childResult.errors.length > 0) { + for (const err of childResult.errors) { + errors.push(err); + } + } + } + } + if (!parentBuildStack && options?.buildRoots) { + const merged = await mergeBuildRootEntities(discoveryResult.entities, options.buildRoots); + warnings.push(...merged.warnings); + for (const message of merged.errors) { + errors.push(new BuildError("", message)); + } + } + const partitions = partitionByLexicon(discoveryResult.entities); + const serializersByName = /* @__PURE__ */ new Map(); + for (const serializer of serializers) { + serializersByName.set(serializer.name, serializer); + } + const explicitOutputs = collectLexiconOutputs(discoveryResult.entities); + const autoOutputs = detectCrossLexiconRefs(discoveryResult.entities); + const explicitRefs = explicitOutputs.map((o) => ({ + parent: o._sourceParent?.deref(), + attribute: o.sourceAttribute + })); + const lexiconOutputs = [ + ...explicitOutputs, + ...autoOutputs.filter((auto) => { + const autoParent = auto._sourceParent?.deref(); + return !explicitRefs.some( + (e) => e.parent === autoParent && e.attribute === auto.sourceAttribute + ); + }) + ]; + const outputsByLexicon = /* @__PURE__ */ new Map(); + const unassignedOutputs = []; + for (const output of lexiconOutputs) { + if (!output.sourceLexicon) { + unassignedOutputs.push(output); + continue; + } + if (!outputsByLexicon.has(output.sourceLexicon)) { + outputsByLexicon.set(output.sourceLexicon, []); + } + outputsByLexicon.get(output.sourceLexicon).push(output); + } + const outputs = /* @__PURE__ */ new Map(); + for (const [lexiconName, lexiconEntities] of partitions) { + const serializer = serializersByName.get(lexiconName); + const { applyBound, receipts } = splitReceiptEntities(lexiconEntities); + if (serializer) { + const lexiconLexiconOutputs = [ + ...outputsByLexicon.get(lexiconName) ?? [], + ...unassignedOutputs + ]; + const serialized = serializer.serialize(applyBound, lexiconLexiconOutputs, { + ownership: options?.ownership, + config: options?.config, + ...receipts.size > 0 ? { receipts } : {} + }); + if (typeof serialized !== "string" && serialized.warnings) { + for (const w of serialized.warnings) warnings.push(w); + } + outputs.set(lexiconName, serialized); + } else if (applyBound.size === 0 && receipts.size > 0) { + } else { + warnings.push(`No serializer found for lexicon "${lexiconName}"`); + } + } + const lexiconNames = Array.from(partitions.keys()); + const manifest = generateManifest(lexiconNames, lexiconOutputs, discoveryResult.entities); + return { + outputs, + entities: discoveryResult.entities, + dependencies: discoveryResult.dependencies, + warnings, + errors, + manifest, + sourceFileCount: discoveryResult.sourceFiles.length, + foldDecisions: discoveryResult.foldDecisions, + lexiconVersions: { ...options?.lexiconVersions ?? {} }, + buildParams: options?.buildParams ?? [], + // chant #2161 — read off the entities AFTER every step that can change + // them (the shared-props merge in `expandComposite`, the build-root merge + // above), and deliberately after Step 7, so nothing about computing it can + // reach a serializer. + foldProvenance: foldProvenanceOfEntities(discoveryResult.entities, getProvenance) + }; +} +async function buildFromEntitiesJson(json2, serializers, label = "", parentBuildStack, options) { + const entities = decodeEntitySet(json2.entitySet); + const dependencies = buildDependencyGraph(entities); + const errors = json2.errors.map( + (e) => new DiscoveryError(e.file, e.message, e.type) + ); + const discoveryResult = { + entities, + dependencies, + sourceFiles: json2.sourceFiles, + errors, + foldDecisions: json2.foldDecisions + }; + return buildFromDiscoveryResult(discoveryResult, label, serializers, parentBuildStack, options); +} var init_build = __esm({ "node_modules/@intentius/chant/src/build.ts"() { + init_provenance(); + init_fold_provenance(); init_errors3(); init_lexicon_output(); init_secret_provenance(); init_effect_receipt(); init_scenario(); + init_resource(); init_utils(); init_child_project(); init_discovery(); @@ -231430,6 +235768,350 @@ var init_build = __esm({ }); // node_modules/@intentius/chant/src/graph-ir.ts +var graph_ir_exports = {}; +__export(graph_ir_exports, { + buildGraphIr: () => buildGraphIr, + buildLiveGraphIr: () => buildLiveGraphIr, + collectUnobserved: () => collectUnobserved, + entityReferences: () => entityReferences, + entityStack: () => entityStack, + overlayGraphs: () => overlayGraphs, + sourceOverlayGraphs: () => sourceOverlayGraphs +}); +import { relative as relative5, isAbsolute as isAbsolute2 } from "node:path"; +function isEntityReference(value) { + return typeof value === "object" && value !== null && typeof value.to === "string"; +} +function entityReferences(entity) { + const declared = entity.references; + if (!Array.isArray(declared)) return []; + return declared.filter(isEntityReference); +} +function entityStack(entity) { + const stack = entity.stack; + return typeof stack === "string" && stack.length > 0 ? stack : void 0; +} +function isNodeEntity(entity) { + if (isLexiconOutput(entity)) return false; + if (entity.kind === "property") return false; + return true; +} +function relFile(file2, projectPath) { + if (!file2) return void 0; + if (projectPath && isAbsolute2(file2)) { + const rel = relative5(projectPath, file2); + return rel.startsWith("..") ? file2 : rel; + } + return file2; +} +function refIntrinsicTarget(value) { + try { + const json2 = value.toJSON?.(); + if (json2 && typeof json2 === "object" && typeof json2.Ref === "string") { + return json2.Ref; + } + } catch { + } + return void 0; +} +function refTarget(ref, reverse) { + const parent = ref.parent.deref(); + return ref.getLogicalName() ?? (parent ? reverse.get(parent) : void 0); +} +function project(value, seen, reverse, nodeIds) { + if (value === null) return null; + const t = typeof value; + if (t === "string" || t === "number" || t === "boolean") return value; + if (t !== "object") return void 0; + if (isAttrRefLike(value)) { + const to = refTarget(value, reverse); + return { $ref: to ? `${to}.${value.attribute}` : value.attribute }; + } + if (value[INTRINSIC_MARKER] === true) { + const to = refIntrinsicTarget(value); + if (to && nodeIds.has(to)) return { $ref: to }; + return { $intrinsic: true }; + } + if (seen.has(value)) return void 0; + seen.add(value); + if (isDeclarable(value)) { + const out2 = projectConfig(value, seen, reverse, nodeIds); + seen.delete(value); + return out2; + } + if (Array.isArray(value)) { + const out2 = value.map((v) => project(v, seen, reverse, nodeIds)).filter((v) => v !== void 0); + seen.delete(value); + return out2; + } + const out = {}; + for (const [k, v] of Object.entries(value)) { + const p = project(v, seen, reverse, nodeIds); + if (p !== void 0) out[k] = p; + } + seen.delete(value); + return out; +} +function configRoots(entity) { + const out = []; + for (const [k, v] of Object.entries(entity)) { + if (SKIP_KEYS.has(k) || k === "props") continue; + out.push([k, v]); + } + const props = entity.props; + if (props && typeof props === "object" && !Array.isArray(props)) { + for (const [k, v] of Object.entries(props)) out.push([k, v]); + } + return out; +} +function projectConfig(entity, seen, reverse, nodeIds) { + const out = {}; + for (const [k, v] of configRoots(entity)) { + const p = project(v, seen, reverse, nodeIds); + if (p !== void 0) out[k] = p; + } + return out; +} +function collectEdges(entity, from, nodeIds, reverse) { + const edges = []; + for (const ref of entityReferences(entity)) { + if (ref.to === from || !nodeIds.has(ref.to)) continue; + edges.push({ + from, + to: ref.to, + kind: "ref", + ...ref.viaAttr ? { viaAttr: ref.viaAttr } : {}, + ...ref.toAttr ? { toAttr: ref.toAttr } : {} + }); + } + const seen = /* @__PURE__ */ new Set(); + const visit = (value, viaAttr) => { + if (value === null || typeof value !== "object") return; + if (isAttrRefLike(value)) { + const to = refTarget(value, reverse); + if (to && to !== from && nodeIds.has(to)) { + edges.push({ from, to, kind: "ref", viaAttr }); + } + return; + } + if (value[INTRINSIC_MARKER] === true) { + const to = refIntrinsicTarget(value); + if (to && to !== from && nodeIds.has(to)) edges.push({ from, to, kind: "ref", viaAttr }); + return; + } + if (seen.has(value)) return; + seen.add(value); + if (isDeclarable(value)) { + for (const [, v] of configRoots(value)) visit(v, viaAttr); + return; + } + if (Array.isArray(value)) { + for (const item of value) visit(item, viaAttr); + return; + } + for (const v of Object.values(value)) visit(v, viaAttr); + }; + for (const [k, v] of configRoots(entity)) visit(v, k); + return edges; +} +function edgeKey(e) { + return `${e.from}\0${e.to}\0${e.viaAttr ?? ""}`; +} +function buildGraphIr(entities, projectPath) { + const reverse = /* @__PURE__ */ new Map(); + for (const [name, entity] of entities) reverse.set(entity, name); + const nodeIds = /* @__PURE__ */ new Set(); + for (const [name, entity] of entities) { + if (isNodeEntity(entity)) nodeIds.add(name); + } + const nodes = []; + const byLexicon = {}; + const byComposite = {}; + const byStack = {}; + for (const [name, entity] of entities) { + if (!nodeIds.has(name)) continue; + const prov = getProvenance(entity); + const node = { + id: name, + kind: entity.entityType, + lexicon: entity.lexicon, + attrs: projectConfig(entity, /* @__PURE__ */ new Set(), reverse, nodeIds) + }; + if (prov?.composite) node.compositeParent = prov.composite; + if (prov?.compositeInstance) node.compositeInstance = prov.compositeInstance; + const file2 = relFile(prov?.sourceFile, projectPath); + if (file2) node.sourceLoc = { file: file2 }; + nodes.push(node); + (byLexicon[entity.lexicon] ??= []).push(name); + (byStack[entityStack(entity) ?? entity.lexicon] ??= []).push(name); + if (prov?.composite) (byComposite[prov.composite] ??= []).push(name); + } + const edgeMap = /* @__PURE__ */ new Map(); + for (const [name, entity] of entities) { + if (!nodeIds.has(name)) continue; + for (const e of collectEdges(entity, name, nodeIds, reverse)) { + edgeMap.set(edgeKey(e), e); + } + } + nodes.sort((a, b) => a.id.localeCompare(b.id)); + const edges = [...edgeMap.values()].sort((a, b) => edgeKey(a).localeCompare(edgeKey(b))); + for (const ids of Object.values(byLexicon)) ids.sort(); + for (const ids of Object.values(byComposite)) ids.sort(); + for (const ids of Object.values(byStack)) ids.sort(); + const groups = {}; + if (Object.keys(byLexicon).length) groups.byLexicon = sortKeys(byLexicon); + if (Object.keys(byComposite).length) groups.byComposite = sortKeys(byComposite); + if (Object.keys(byStack).length) groups.byStack = sortKeys(byStack); + const exports = []; + for (const entity of entities.values()) { + if (!isLexiconOutput(entity)) continue; + const lo = entity; + if (!lo.outputName) continue; + const parent = lo._sourceParent?.deref(); + const node = (parent ? reverse.get(parent) : void 0) ?? (lo.sourceEntity || void 0); + exports.push({ name: lo.outputName, ...node ? { node } : {}, ...lo.sourceAttribute ? { attr: lo.sourceAttribute } : {} }); + } + exports.sort((a, b) => a.name.localeCompare(b.name)); + const imports = nodes.filter((n) => /(^|::)Parameter$/i.test(n.kind)).map((n) => ({ name: n.id, node: n.id })).sort((a, b) => a.name.localeCompare(b.name)); + const ir = { nodes, edges, groups }; + if (exports.length) ir.exports = exports; + if (imports.length) ir.imports = imports; + return ir; +} +function sortKeys(rec) { + const out = {}; + for (const k of Object.keys(rec).sort()) out[k] = rec[k]; + return out; +} +function buildLiveGraphIr(observations) { + const nodes = []; + const byLexicon = {}; + const byStack = {}; + for (const { lexicon, resources } of observations) { + for (const [name, meta4] of Object.entries(resources)) { + const node = { + id: name, + kind: meta4.type, + lexicon, + attrs: meta4.attributes ?? {} + }; + if (meta4.physicalId) node.physicalId = meta4.physicalId; + if (meta4.ownership === "owned" || meta4.ownership === "foreign") node.ownership = meta4.ownership; + if (meta4.ownerChain?.root === "declared") node.runtimeOwner = meta4.ownerChain.entity; + nodes.push(node); + (byLexicon[lexicon] ??= []).push(name); + (byStack[lexicon] ??= []).push(name); + } + } + nodes.sort((a, b) => a.id.localeCompare(b.id)); + for (const ids of Object.values(byLexicon)) ids.sort(); + for (const ids of Object.values(byStack)) ids.sort(); + const groups = {}; + if (Object.keys(byLexicon).length) groups.byLexicon = sortKeys(byLexicon); + if (Object.keys(byStack).length) groups.byStack = sortKeys(byStack); + const observedIds = new Set(nodes.map((n) => n.id)); + const seen = /* @__PURE__ */ new Set(); + const edges = []; + for (const observation of observations) { + for (const edge of observation.edges ?? []) { + if (!observedIds.has(edge.from) || !observedIds.has(edge.to)) continue; + const key = `${edge.from}\0${edge.to}\0${edge.viaAttr ?? ""}\0${edge.toAttr ?? ""}`; + if (seen.has(key)) continue; + seen.add(key); + edges.push(edge); + } + } + edges.sort( + (a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || (a.viaAttr ?? "").localeCompare(b.viaAttr ?? "") + ); + const exports = []; + for (const observation of observations) { + for (const [stack, values] of Object.entries(observation.stackExports ?? {})) { + for (const [name, value] of Object.entries(values)) exports.push({ name, value, stack }); + } + } + exports.sort((a, b) => a.name.localeCompare(b.name) || (a.stack ?? "").localeCompare(b.stack ?? "")); + return { nodes, edges, groups, ...exports.length > 0 ? { exports } : {} }; +} +function collectUnobserved(observations) { + const out = {}; + for (const o of observations) Object.assign(out, o.unobserved ?? {}); + return out; +} +function tagStatus(n, status, unobserved) { + return { + ...n, + attrs: { + ...n.attrs, + _status: status, + ...unobserved ? { _unobserved: unobserved.reason } : {} + } + }; +} +function overlayGraphs(live, declared, opts) { + const declaredIds = new Set(declared.nodes.map((n) => n.id)); + const liveIds = new Set(live.nodes.map((n) => n.id)); + const unobserved = opts?.unobserved ?? {}; + const nodes = live.nodes.map( + (n) => tagStatus(n, declaredIds.has(n.id) ? "good" : n.runtimeOwner ? "runtime" : "warn") + ); + for (const n of declared.nodes) { + if (liveIds.has(n.id)) continue; + const u = unobserved[n.id]; + nodes.push(u ? tagStatus(n, "neutral", u) : tagStatus(n, "accent")); + } + nodes.sort((a, b) => a.id.localeCompare(b.id)); + return { ...live, nodes }; +} +function sourceOverlayGraphs(declared, live, opts) { + const liveById = new Map(live.nodes.map((n) => [n.id, n])); + const declaredIds = new Set(declared.nodes.map((n) => n.id)); + const foreignIds = new Set(live.nodes.filter((n) => !declaredIds.has(n.id)).map((n) => n.id)); + const unobserved = opts?.unobserved ?? {}; + const nodes = declared.nodes.map((n) => { + const obs = liveById.get(n.id); + if (!obs) { + const u = unobserved[n.id]; + return u ? tagStatus(n, "neutral", u) : tagStatus(n, "accent"); + } + const merged = { ...n }; + if (obs.physicalId) merged.physicalId = obs.physicalId; + if (obs.ownership) merged.ownership = obs.ownership; + if (obs.attrs && Object.keys(obs.attrs).length > 0) merged.attrs = { ...n.attrs, ...obs.attrs }; + return tagStatus(merged, "good"); + }); + for (const n of live.nodes) { + if (!foreignIds.has(n.id)) continue; + nodes.push(tagStatus(n, n.runtimeOwner ? "runtime" : "warn")); + } + nodes.sort((a, b) => a.id.localeCompare(b.id)); + const seen = new Set(declared.edges.map(edgeKey)); + const edges = [...declared.edges]; + for (const e of live.edges) { + if (!(foreignIds.has(e.from) || foreignIds.has(e.to))) continue; + const k = edgeKey(e); + if (seen.has(k)) continue; + seen.add(k); + edges.push(e); + } + edges.sort((a, b) => edgeKey(a).localeCompare(edgeKey(b))); + const liveExports = live.exports ?? []; + let exports = declared.exports; + if (liveExports.length > 0) { + const byName = new Map(liveExports.map((e) => [e.name, e])); + const merged = (declared.exports ?? []).map((e) => { + const obs = byName.get(e.name); + if (!obs) return e; + byName.delete(e.name); + return { ...e, value: obs.value, ...obs.stack ? { stack: obs.stack } : {} }; + }); + for (const e of byName.values()) merged.push(e); + merged.sort((a, b) => a.name.localeCompare(b.name)); + exports = merged; + } + return { ...declared, nodes, edges, ...exports ? { exports } : {} }; +} +var SKIP_KEYS; var init_graph_ir = __esm({ "node_modules/@intentius/chant/src/graph-ir.ts"() { init_utils(); @@ -231437,6 +236119,7 @@ var init_graph_ir = __esm({ init_lexicon_output(); init_provenance(); init_intrinsic(); + SKIP_KEYS = /* @__PURE__ */ new Set(["lexicon", "entityType", "kind", "attributes", "Ref", "references", "stack"]); } }); @@ -231471,13 +236154,13 @@ var init_graph_lens = __esm({ }); // node_modules/@intentius/chant/src/detectLexicon.ts -import { readFile } from "node:fs/promises"; +import { readFile as readFile2 } from "node:fs/promises"; async function detectLexicons(files) { const detectedLexicons = /* @__PURE__ */ new Set(); for (const file2 of files) { let content; try { - content = await readFile(file2, "utf-8"); + content = await readFile2(file2, "utf-8"); } catch (error51) { continue; } @@ -231487,12 +236170,14 @@ async function detectLexicons(files) { } } if (detectedLexicons.size === 0) { - throw new Error("No lexicon detected in infrastructure files"); + throw new Error(NO_LEXICON_DETECTED_MESSAGE); } return Array.from(detectedLexicons); } +var NO_LEXICON_DETECTED_MESSAGE; var init_detectLexicon = __esm({ "node_modules/@intentius/chant/src/detectLexicon.ts"() { + NO_LEXICON_DETECTED_MESSAGE = "No lexicon detected in infrastructure files"; } }); @@ -231686,45 +236371,53 @@ var init_evl010_composite_no_transform = __esm({ } }); -// node_modules/@intentius/chant/src/lint/rules/cor017-composite-name-match.ts +// node_modules/@intentius/chant/src/lint/rules/evl011-symbolic-in-template.ts var ts26; +var init_evl011_symbolic_in_template = __esm({ + "node_modules/@intentius/chant/src/lint/rules/evl011-symbolic-in-template.ts"() { + ts26 = __toESM(require_typescript(), 1); + } +}); + +// node_modules/@intentius/chant/src/lint/rules/cor017-composite-name-match.ts +var ts27; var init_cor017_composite_name_match = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor017-composite-name-match.ts"() { - ts26 = __toESM(require_typescript(), 1); + ts27 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/cor018-composite-prefer-lexicon-type.ts -var ts27; +var ts28; var init_cor018_composite_prefer_lexicon_type = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor018-composite-prefer-lexicon-type.ts"() { - ts27 = __toESM(require_typescript(), 1); + ts28 = __toESM(require_typescript(), 1); init_composite_scope(); } }); // node_modules/@intentius/chant/src/lint/rules/cor021-env-literal-name.ts -var ts28; +var ts29; var init_cor021_env_literal_name = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor021-env-literal-name.ts"() { - ts28 = __toESM(require_typescript(), 1); + ts29 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/cor022-receipt-leaf.ts -var ts29; +var ts30; var init_cor022_receipt_leaf = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor022-receipt-leaf.ts"() { - ts29 = __toESM(require_typescript(), 1); + ts30 = __toESM(require_typescript(), 1); } }); // node_modules/@intentius/chant/src/lint/rules/cor024-receipt-secret-pointer.ts -var ts30; +var ts31; var init_cor024_receipt_secret_pointer = __esm({ "node_modules/@intentius/chant/src/lint/rules/cor024-receipt-secret-pointer.ts"() { - ts30 = __toESM(require_typescript(), 1); + ts31 = __toESM(require_typescript(), 1); init_cor022_receipt_leaf(); } }); @@ -231751,6 +236444,7 @@ var init_rules = __esm({ init_evl007_invalid_siblings(); init_evl009_composite_no_constant(); init_evl010_composite_no_transform(); + init_evl011_symbolic_in_template(); init_cor017_composite_name_match(); init_cor018_composite_prefer_lexicon_type(); init_cor021_env_literal_name(); @@ -231776,6 +236470,7 @@ var init_rules = __esm({ init_evl007_invalid_siblings(); init_evl009_composite_no_constant(); init_evl010_composite_no_transform(); + init_evl011_symbolic_in_template(); init_cor017_composite_name_match(); init_cor018_composite_prefer_lexicon_type(); init_cor021_env_literal_name(); @@ -231791,45 +236486,45 @@ function collectNodes(root, predicate) { if (predicate(node)) { results.push(node); } - ts31.forEachChild(node, visit); + ts32.forEachChild(node, visit); } visit(root); return results; } function selectResource(sf) { - return collectNodes(sf, (node) => ts31.isNewExpression(node)); + return collectNodes(sf, (node) => ts32.isNewExpression(node)); } function selectAnyResource(sf) { return selectResource(sf); } function selectStringLiteral(sf) { - return collectNodes(sf, (node) => ts31.isStringLiteral(node)); + return collectNodes(sf, (node) => ts32.isStringLiteral(node)); } function selectExportName(sf) { return collectNodes(sf, (node) => { - if (ts31.isVariableStatement(node)) { - return node.modifiers?.some((m) => m.kind === ts31.SyntaxKind.ExportKeyword) ?? false; + if (ts32.isVariableStatement(node)) { + return node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; } - if (ts31.isFunctionDeclaration(node) || ts31.isClassDeclaration(node)) { - return node.modifiers?.some((m) => m.kind === ts31.SyntaxKind.ExportKeyword) ?? false; + if (ts32.isFunctionDeclaration(node) || ts32.isClassDeclaration(node)) { + return node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; } return false; }); } function selectImportSource(sf) { return collectNodes(sf, (node) => { - if (ts31.isImportDeclaration(node)) { + if (ts32.isImportDeclaration(node)) { return true; } return false; }); } function selectProperty(sf) { - return collectNodes(sf, (node) => ts31.isPropertyAssignment(node)); + return collectNodes(sf, (node) => ts32.isPropertyAssignment(node)); } function selectResourceType(sf) { return collectNodes(sf, (node) => { - if (ts31.isNewExpression(node) && node.typeArguments && node.typeArguments.length > 0) { + if (ts32.isNewExpression(node) && node.typeArguments && node.typeArguments.length > 0) { return true; } return false; @@ -231837,16 +236532,16 @@ function selectResourceType(sf) { } function selectExportedConst(sf) { return collectNodes(sf, (node) => { - if (!ts31.isVariableStatement(node)) return false; - const hasExport = node.modifiers?.some((m) => m.kind === ts31.SyntaxKind.ExportKeyword) ?? false; + if (!ts32.isVariableStatement(node)) return false; + const hasExport = node.modifiers?.some((m) => m.kind === ts32.SyntaxKind.ExportKeyword) ?? false; if (!hasExport) return false; - return node.declarationList.flags === ts31.NodeFlags.Const || (node.declarationList.flags & ts31.NodeFlags.Const) !== 0; + return node.declarationList.flags === ts32.NodeFlags.Const || (node.declarationList.flags & ts32.NodeFlags.Const) !== 0; }); } -var ts31, selectorRegistry, builtins; +var ts32, selectorRegistry, builtins; var init_selectors = __esm({ "node_modules/@intentius/chant/src/lint/selectors.ts"() { - ts31 = __toESM(require_typescript(), 1); + ts32 = __toESM(require_typescript(), 1); selectorRegistry = /* @__PURE__ */ new Map(); builtins = [ ["resource", selectResource], @@ -231911,16 +236606,352 @@ var init_format = __esm({ }); // node_modules/@intentius/chant/src/runtime-adapter.ts -import { dirname as dirname7 } from "path"; -import { fileURLToPath } from "url"; +import { dirname as dirname10 } from "path"; +import { fileURLToPath as fileURLToPath2 } from "url"; function moduleDir(importMetaUrl) { - return dirname7(fileURLToPath(importMetaUrl)); + return dirname10(fileURLToPath2(importMetaUrl)); } var init_runtime_adapter = __esm({ "node_modules/@intentius/chant/src/runtime-adapter.ts"() { } }); +// node_modules/@intentius/chant/src/audit/prior-art.ts +function applyLineage(catalog, lineage) { + for (const [id, entries] of Object.entries(lineage)) { + const rule = catalog[id]; + if (!rule) throw new Error(`audit lineage names ${id}, which this catalog does not define`); + if (entries.length > 0) rule.lineage = entries; + } +} +var init_prior_art = __esm({ + "node_modules/@intentius/chant/src/audit/prior-art.ts"() { + } +}); + +// node_modules/@intentius/chant/src/audit/lineage.ts +var coreAuditLineage; +var init_lineage = __esm({ + "node_modules/@intentius/chant/src/audit/lineage.ts"() { + coreAuditLineage = { + AGT002: [ + { tool: "agent-audit", rule: "auth-bypass/env-secret-in-config", url: "https://raw.githubusercontent.com/piiiico/agent-audit/main/README.md", relation: "equivalent" }, + { tool: "mcp-audit", rule: "Secrets Detection", url: "https://raw.githubusercontent.com/apisec-inc/mcp-audit/main/README.md", relation: "overlaps" }, + { tool: "agent-scan", rule: "W008", url: "https://raw.githubusercontent.com/invariantlabs-ai/mcp-scan/main/docs/issue-codes.md", relation: "overlaps" } + ], + COR020: [ + { tool: "cfn-lint", rule: "E3004", url: "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md#E3004", relation: "equivalent" } + ], + EXT001: [ + { tool: "cfn-lint", url: "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#extending-the-schemas-with-new-keywords", relation: "equivalent" }, + { tool: "cfn-lint", rule: "E3014", url: "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md#E3014", relation: "equivalent" }, + { tool: "cfn-lint", rule: "E3021", url: "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md#E3021", relation: "equivalent" } + ], + NGX001: [ + { tool: "gixy-ng", rule: "weak_ssl_tls", url: "https://gixy.getpagespeed.com/plugins/weak_ssl_tls/", relation: "overlaps" } + ], + NGX002: [ + { tool: "gixy-ng", rule: "weak_ssl_tls", url: "https://gixy.getpagespeed.com/plugins/weak_ssl_tls/", relation: "overlaps" } + ], + NGX004: [ + { tool: "gixy", rule: "alias_traversal", url: "https://github.com/yandex/gixy", relation: "equivalent" }, + { tool: "gixy-ng", rule: "alias_traversal", url: "https://gixy.getpagespeed.com/plugins/aliastraversal/", relation: "equivalent" } + ], + NGX005: [ + { tool: "gixy-ng", rule: "status_page_exposed", url: "https://gixy.getpagespeed.com/checks/status-page-exposed/", relation: "overlaps" } + ], + NGX006: [ + { tool: "gixy-ng", rule: "version_disclosure", url: "https://gixy.getpagespeed.com/plugins/version_disclosure/", relation: "equivalent" } + ], + SEC001: [ + { tool: "gitleaks", rule: "aws-access-token", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "equivalent" }, + { tool: "trufflehog", rule: "aws", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/aws/access_keys/accesskey.go", relation: "overlaps" }, + { tool: "detect-secrets", rule: "AWSKeyDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/aws.py", relation: "equivalent" } + ], + SEC002: [ + { tool: "gitleaks", rule: "generic-api-key", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" }, + { tool: "trufflehog", rule: "aws", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/aws/access_keys/accesskey.go", relation: "overlaps" }, + { tool: "detect-secrets", rule: "AWSKeyDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/aws.py", relation: "overlaps" } + ], + SEC003: [ + { tool: "gitleaks", rule: "github-pat", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" }, + { tool: "trufflehog", rule: "github", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/github/v2/github.go", relation: "equivalent" }, + { tool: "detect-secrets", rule: "GitHubTokenDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/github_token.py", relation: "overlaps" } + ], + SEC004: [ + { tool: "gitleaks", rule: "slack-bot-token", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" }, + { tool: "trufflehog", rule: "slack", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/slack/slack.go", relation: "overlaps" }, + { tool: "detect-secrets", rule: "SlackDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/slack.py", relation: "overlaps" } + ], + SEC005: [ + { tool: "gitleaks", rule: "gcp-api-key", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "equivalent" }, + { tool: "trufflehog", rule: "googlegemini", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/googlegemini/googlegemini.go", relation: "overlaps" } + ], + SEC006: [ + { tool: "gitleaks", rule: "stripe-access-token", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" }, + { tool: "trufflehog", rule: "stripe", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/stripe/stripe.go", relation: "overlaps" }, + { tool: "detect-secrets", rule: "StripeDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/stripe.py", relation: "overlaps" } + ], + SEC007: [ + { tool: "gitleaks", rule: "private-key", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "equivalent" }, + { tool: "trufflehog", rule: "privatekey", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/privatekey/privatekey.go", relation: "equivalent" }, + { tool: "detect-secrets", rule: "PrivateKeyDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/private_key.py", relation: "equivalent" } + ], + SEC008: [ + { tool: "gitleaks", rule: "curl-auth-header", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" } + ], + SEC009: [ + { tool: "detect-secrets", rule: "BasicAuthDetector", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/basic_auth.py", relation: "equivalent" }, + { tool: "trufflehog", rule: "uri", url: "https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/uri/uri.go", relation: "overlaps" }, + { tool: "gitleaks", rule: "curl-auth-user", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" } + ], + SEC010: [ + { tool: "detect-secrets", rule: "Base64HighEntropyString", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/high_entropy_strings.py", relation: "overlaps" }, + { tool: "detect-secrets", rule: "HexHighEntropyString", url: "https://github.com/Yelp/detect-secrets/blob/master/detect_secrets/plugins/high_entropy_strings.py", relation: "overlaps" }, + { tool: "gitleaks", rule: "generic-api-key", url: "https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml", relation: "overlaps" } + ], + // TF023 is the one TF id core owns (./terraform-state.ts); the rest of the + // family credits its prior art from lexicons/terraform/src/lint/audit-lineage.ts. + // No linter or scanner in #2107's survey checks for committed state, but the + // style guide's .gitignore section names the exact files, so the document is + // both the authority and the first written statement of the rule. + TF023: [ + { + tool: "hashicorp-style-guide", + rule: ".gitignore: do not commit terraform.tfstate, terraform.tfstate.* backups, or the .terraform directory", + url: "https://developer.hashicorp.com/terraform/language/style#gitignore", + relation: "equivalent" + } + ] + }; + } +}); + +// node_modules/@intentius/chant/src/audit/catalog.ts +function meta3(id, tier, fixKind, title, remediation, authority, lineage) { + const category = authority && authority.length > 0 ? "security" : RULE_CATEGORY[id] ?? "best-practice"; + return { id, tier, fixKind, category, title, remediation, authority, ...lineage?.length ? { lineage } : {}, yamlBased: true }; +} +function agentMeta(id, tier, title, remediation, authority) { + const category = authority && authority.length > 0 ? "security" : RULE_CATEGORY[id] ?? "best-practice"; + return { id, tier, fixKind: G, category, title, remediation, authority, yamlBased: false }; +} +var SCORECARD_PINNED, GH_SECRET_SCANNING, CF_WORKERS_DEV, CF_SECRETS, CF_ROUTES, CF_ENVIRONMENTS, CF_STATIC_ASSETS, MOZILLA_TLS, CWE_DIR_LISTING, GIXY_ALIAS, NGINX_STUB_STATUS, CWE_HARDCODED_CREDS, HASHICORP_STYLE_GITIGNORE, CWE_CLEARTEXT, M, R, G, RULE_CATEGORY, RULE_CATALOG; +var init_catalog = __esm({ + "node_modules/@intentius/chant/src/audit/catalog.ts"() { + init_prior_art(); + init_lineage(); + init_prior_art(); + SCORECARD_PINNED = { + name: "OSSF Scorecard \u2014 Pinned-Dependencies", + url: "https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies" + }; + GH_SECRET_SCANNING = { + name: "GitHub \u2014 About secret scanning", + url: "https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning" + }; + CF_WORKERS_DEV = { + name: "Cloudflare Workers \u2014 workers.dev", + url: "https://developers.cloudflare.com/workers/configuration/routing/workers-dev/" + }; + CF_SECRETS = { + name: "Cloudflare Workers \u2014 Secrets", + url: "https://developers.cloudflare.com/workers/configuration/secrets/" + }; + CF_ROUTES = { + name: "Cloudflare Workers \u2014 Routes", + url: "https://developers.cloudflare.com/workers/configuration/routing/routes/" + }; + CF_ENVIRONMENTS = { + name: "Cloudflare Workers \u2014 Wrangler environments", + url: "https://developers.cloudflare.com/workers/wrangler/configuration/#environments" + }; + CF_STATIC_ASSETS = { + name: "Cloudflare Workers \u2014 Static assets", + url: "https://developers.cloudflare.com/workers/static-assets/" + }; + MOZILLA_TLS = { + name: "Mozilla \u2014 Server Side TLS", + url: "https://wiki.mozilla.org/Security/Server_Side_TLS" + }; + CWE_DIR_LISTING = { + name: "CWE-548 \u2014 Exposure of Information Through Directory Listing", + url: "https://cwe.mitre.org/data/definitions/548.html" + }; + GIXY_ALIAS = { + name: "Gixy \u2014 alias traversal", + url: "https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md" + }; + NGINX_STUB_STATUS = { + name: "nginx \u2014 ngx_http_stub_status_module", + url: "https://nginx.org/en/docs/http/ngx_http_stub_status_module.html" + }; + CWE_HARDCODED_CREDS = { + name: "CWE-798 \u2014 Use of Hard-coded Credentials", + url: "https://cwe.mitre.org/data/definitions/798.html" + }; + HASHICORP_STYLE_GITIGNORE = { + name: "HashiCorp Terraform style guide \u2014 .gitignore", + url: "https://developer.hashicorp.com/terraform/language/style#gitignore" + }; + CWE_CLEARTEXT = { + name: "CWE-319 \u2014 Cleartext Transmission of Sensitive Information", + url: "https://cwe.mitre.org/data/definitions/319.html" + }; + M = "merge-worthy"; + R = "report-only"; + G = "guidance"; + RULE_CATEGORY = { + COR020: "correctness", + EXT001: "correctness", + SEC001: "security", + SEC002: "security", + SEC003: "security", + SEC004: "security", + SEC005: "security", + SEC006: "security", + SEC007: "security", + SEC008: "security", + SEC009: "security", + SEC010: "security", + WRG001: "security", + WRG002: "security", + WRG003: "best-practice", + WRG004: "security", + WRG005: "security", + WRG006: "security", + // NGX — nginx config audit (#1979), lexicon-independent like SEC/WRG. + NGX001: "security", + NGX002: "security", + NGX003: "security", + NGX004: "security", + NGX005: "security", + NGX006: "best-practice", + NGX007: "best-practice", + // TF023 — Terraform state committed to the repository. Core-owned for the + // same reason SEC/WRG/NGX are: it reads the discovered file list, not a + // parsed root module. See ./terraform-state.ts. + TF023: "security", + // AGT — agent configuration (`chant audit --agents`). Core-owned like COR/EXT: + // these run against the machine's own agent config, not against any one + // lexicon's emitted output, so no lexicon ships them. + AGT001: "security", + AGT002: "security", + AGT003: "security", + AGT004: "security", + AGT005: "security", + AGT006: "best-practice", + AGT007: "correctness", + AGT008: "best-practice" + }; + RULE_CATALOG = { + COR020: meta3("COR020", M, G, "Circular resource dependency", "Break the dependency cycle between resources."), + EXT001: meta3("EXT001", M, G, "Extension constraint violation", "Fix the cross-property constraint flagged by the cfn-lint extension schema."), + // Secrets & credentials (#443) — lexicon-independent: `secrets.ts` scans the + // raw text of every candidate file, so these ids apply regardless of which + // (if any) audit lexicons are installed. `fixKind` is `guidance`: removing + // a hardcoded credential and rotating it needs a human, never an auto-fix. + SEC001: meta3("SEC001", M, G, "AWS access key ID found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]), + SEC002: meta3("SEC002", M, G, "AWS secret access key found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]), + SEC003: meta3("SEC003", M, G, "GitHub token found", "Remove the token from source and revoke it at github.com/settings/tokens; use a GitHub Actions secret instead.", [GH_SECRET_SCANNING]), + SEC004: meta3("SEC004", M, G, "Slack token found", "Remove the token from source and revoke it in the Slack app's OAuth settings.", [GH_SECRET_SCANNING]), + SEC005: meta3("SEC005", M, G, "Google API key found", "Remove the key from source and regenerate it in the Google Cloud Console credentials page.", [GH_SECRET_SCANNING]), + SEC006: meta3("SEC006", M, G, "Stripe live secret key found", "Remove the key from source and roll it in the Stripe dashboard immediately \u2014 this is a live-mode key.", [GH_SECRET_SCANNING]), + SEC007: meta3("SEC007", M, G, "Private key block found", "Remove the private key from source, rotate the keypair, and load the key from a secret store instead.", [GH_SECRET_SCANNING]), + SEC008: meta3("SEC008", M, G, "Bearer/authorization token found", "Remove the token from source; if it's long-lived, revoke and reissue it via the issuing service.", [GH_SECRET_SCANNING]), + SEC009: meta3("SEC009", M, G, "Credentials embedded in a connection string", "Move the username/password out of the URI into a secret store, and rotate the credential.", [GH_SECRET_SCANNING]), + SEC010: meta3("SEC010", M, G, "High-entropy string \u2014 possible secret", "Confirm whether this is a live credential; if so, remove it from source and rotate it. If it's a false positive, suppress with a `chant-audit-ignore` comment or an allowlist entry.", [GH_SECRET_SCANNING]), + // Wrangler config audit (#446) — lexicon-independent, same shape as the SEC + // family above: `wrangler.ts` scans every `wrangler.toml` it finds + // regardless of which (if any) audit lexicons are installed. + WRG001: meta3("WRG001", M, G, "Production environment exposed on *.workers.dev", "Remove workers_dev (or set it to false) for this environment and rely on its custom domain/route instead of the shared public subdomain.", [CF_WORKERS_DEV]), + WRG002: meta3("WRG002", M, G, "Credential-shaped key stored in [vars]", "Move the value out of [vars] and into `wrangler secret put ` so it isn't committed to source or visible in `wrangler dev`/the dashboard.", [CF_SECRETS]), + WRG003: meta3("WRG003", R, G, "Observability explicitly disabled", "Set observability.enabled = true (or remove the override) so Workers Logs are recorded for this deployment."), + WRG004: meta3("WRG004", M, G, "Unscoped wildcard route", 'Scope the route pattern to the intended zone (e.g. "example.com/*") instead of a bare "*" or "*/*" that matches every zone on the account.', [CF_ROUTES]), + WRG005: meta3("WRG005", M, G, "Non-production environment shares a data store with production", "Give the non-production environment its own KV namespace/R2 bucket/D1 database id instead of reusing production's.", [CF_ENVIRONMENTS]), + WRG006: meta3("WRG006", M, G, "Static assets served from the project root", "Point [site].bucket / [assets].directory at a dedicated public output folder, not the project root, so non-public files (config, source maps, .git) aren't served.", [CF_STATIC_ASSETS]), + // nginx config audit (#1979, the #446 follow-up) — lexicon-independent, + // same shape as SEC/WRG: `nginx.ts` scans every nginx config it detects + // regardless of which (if any) audit lexicons are installed. + NGX001: meta3("NGX001", M, G, "Deprecated TLS protocol enabled", "Remove SSLv2/SSLv3/TLSv1/TLSv1.1 from ssl_protocols and serve TLSv1.2 and TLSv1.3 only.", [MOZILLA_TLS]), + NGX002: meta3("NGX002", M, G, "Weak cipher suite enabled", "Remove the RC4/DES/MD5/NULL/EXPORT-class entries from ssl_ciphers and use a modern cipher list (e.g. Mozilla's intermediate configuration).", [MOZILLA_TLS]), + NGX003: meta3("NGX003", M, G, "Directory listing enabled", "Remove `autoindex on` (or scope it to a directory that is genuinely meant to be enumerated) so file listings aren't served to anyone who asks.", [CWE_DIR_LISTING]), + NGX004: meta3("NGX004", M, G, "alias path traversal", 'End the location prefix with "/" so it matches the trailing slash of the alias target \u2014 without it, a request for "../" escapes the aliased directory.', [GIXY_ALIAS]), + NGX005: meta3("NGX005", M, G, "Status endpoint with no access restriction", "Restrict the stub_status location with allow/deny (or auth_basic/auth_request) so connection metrics aren't public reconnaissance.", [NGINX_STUB_STATUS]), + NGX006: meta3("NGX006", R, G, "Server version disclosure", "Add `server_tokens off;` in the http block so nginx stops advertising its exact version in the Server header and error pages."), + NGX007: meta3("NGX007", R, G, "Access logging disabled at server scope", "Re-enable access_log at http/server scope (silencing a single noisy location is fine) so requests are recorded for incident investigation."), + // TF023 (#2110) — Terraform state, or the `.terraform/` working directory, + // committed to the repository. The one TF rule core owns: every other TF id + // is a post-synth check over a parsed root module (the terraform lexicon's + // `auditCatalog()`), while this one reads the discovered file list and never + // runs during `chant build`. Same shape as SEC/WRG/NGX above, and the same + // reason it lives here: `terraform-state.ts` needs no lexicon installed. + TF023: meta3( + "TF023", + M, + G, + "Terraform state committed to the repository", + "Delete the state file (or `.terraform/`) from version control, add it to .gitignore, move the state to a remote backend, and rotate every credential the file held.", + [HASHICORP_STYLE_GITIGNORE] + ), + // ── Agent configuration (`chant audit --agents`) ────────────────── + AGT001: agentMeta( + "AGT001", + M, + "MCP server runs an unpinned package", + "Pin the package spec to an exact version (`server@1.2.3`), so a new upstream release can't execute on this machine unreviewed.", + [SCORECARD_PINNED] + ), + AGT002: agentMeta( + "AGT002", + M, + "Literal credential in agent config", + "Replace the value with an environment reference (`${TOKEN}`) and keep the secret in a secret store \u2014 agent config files sync, back up, and get shared.", + [CWE_HARDCODED_CREDS] + ), + AGT003: agentMeta( + "AGT003", + M, + "MCP server reached over cleartext HTTP", + "Use an https:// endpoint. Tool arguments and results \u2014 including data the agent read locally \u2014 otherwise cross the network in the clear.", + [CWE_CLEARTEXT] + ), + AGT004: agentMeta( + "AGT004", + M, + "Remote skill or plugin is unpinned", + "Pin the source to a tag or commit sha, so the instructions the agent follows can't change upstream without a local edit.", + [SCORECARD_PINNED] + ), + AGT005: agentMeta( + "AGT005", + M, + "Tool permission granted without constraint", + "Scope the grant to the specific commands you run (`Bash(git status:*)`), and re-enable the confirmation prompt for dangerous operations." + ), + AGT006: agentMeta( + "AGT006", + R, + "User-scope config applies to every project", + "Move project-specific instructions, MCP servers, and skills to that project's own config so they don't follow you into unrelated repos." + ), + AGT007: agentMeta( + "AGT007", + R, + "MCP server declared in multiple files", + "Delete the shadowed declarations. The harness silently picks one, so the file you read may not be the one that decides what runs." + ), + AGT008: agentMeta( + "AGT008", + R, + "Instruction file exceeds the attention budget", + "Move situational guidance into skills that load on demand, so the always-on instructions stay short enough to be followed reliably." + ) + }; + applyLineage(RULE_CATALOG, coreAuditLineage); + } +}); + // node_modules/@intentius/chant/src/lint/presets/strict.json var strict_default; var init_strict = __esm({ @@ -231955,18 +236986,19 @@ var init_strict = __esm({ }); // node_modules/@intentius/chant/src/lint/config.ts -import { join as join7, dirname as dirname8, resolve as resolve3 } from "path"; +import { join as join9, dirname as dirname11, resolve as resolve6 } from "path"; var BUILTIN_PRESETS, SeveritySchema, RuleConfigSchema, LintConfigSchema, DEFAULT_CONFIG; var init_config2 = __esm({ "node_modules/@intentius/chant/src/lint/config.ts"() { init_zod(); init_config_sandbox(); init_runtime_adapter(); + init_catalog(); init_strict(); init_project_root(); BUILTIN_PRESETS = { - "@intentius/chant/lint/presets/strict": resolve3(moduleDir(import.meta.url), "presets/strict.json"), - "@intentius/chant/lint/presets/relaxed": resolve3(moduleDir(import.meta.url), "presets/relaxed.json") + "@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") }; SeveritySchema = external_exports.enum(["off", "error", "warning", "info"]); RuleConfigSchema = external_exports.union([ @@ -231981,7 +237013,8 @@ var init_config2 = __esm({ rules: external_exports.record(external_exports.string(), RuleConfigSchema) })).optional(), plugins: external_exports.array(external_exports.string()).optional(), - policies: external_exports.array(external_exports.string()).optional() + policies: external_exports.array(external_exports.string()).optional(), + presets: external_exports.record(external_exports.string(), external_exports.string()).optional() }); DEFAULT_CONFIG = { rules: { ...strict_default.rules }, @@ -232039,8 +237072,8 @@ function contentDigest(input) { } function computeManifestDigest(contents) { const sorted = [...contents].sort((a, b) => a.path.localeCompare(b.path)); - const canonical = sorted.map((e) => `${e.kind}:${e.path}:${e.digest}`).join("\n"); - return contentDigest(canonical); + const canonical2 = sorted.map((e) => `${e.kind}:${e.path}:${e.digest}`).join("\n"); + return contentDigest(canonical2); } function createBuildArchiveManifest(component, opts) { const createdAt = (opts?.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(); @@ -232076,7 +237109,7 @@ var init_build_archive = __esm({ import { exec } from "node:child_process"; import { createConnection } from "node:net"; import { promisify } from "node:util"; -import { isAbsolute, join as join8 } from "node:path"; +import { isAbsolute as isAbsolute3, join as join10 } from "node:path"; function run(command) { return execFileAsync(command, { maxBuffer: 64 * 1024 * 1024 }); } @@ -232086,11 +237119,11 @@ function q(value) { function probeBoltPort(endpoint, timeoutMs = 5e3) { const [host, portStr] = endpoint.split(":"); const port = Number(portStr ?? 7687); - return new Promise((resolve4) => { + return new Promise((resolve9) => { const socket = createConnection({ host, port, timeout: timeoutMs }); const finish = (healthy) => { socket.destroy(); - resolve4(healthy); + resolve9(healthy); }; socket.once("connect", () => finish(true)); socket.once("timeout", () => finish(false)); @@ -232105,7 +237138,7 @@ function defaultCloudExecutor() { return defaultExecutor; } function sleep(ms) { - return new Promise((resolve4) => setTimeout(resolve4, ms)); + return new Promise((resolve9) => setTimeout(resolve9, ms)); } var execFileAsync, realDocker, realNeo4j, defaultExecutor; var init_cloud_executor = __esm({ @@ -232115,7 +237148,7 @@ var init_cloud_executor = __esm({ async build(args) { const parts = [`docker build`, `-t ${q(args.tag)}`]; if (args.dockerfile) { - const dockerfilePath = isAbsolute(args.dockerfile) ? args.dockerfile : join8(args.context, args.dockerfile); + const dockerfilePath = isAbsolute3(args.dockerfile) ? args.dockerfile : join10(args.context, args.dockerfile); parts.push(`-f ${q(dockerfilePath)}`); } if (args.target) parts.push(`--target ${q(args.target)}`); @@ -232208,7 +237241,7 @@ var init_process_runner = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/build.ts -import { readFileSync as readFileSync4 } from "node:fs"; +import { readFileSync as readFileSync6 } from "node:fs"; import { createHash } from "node:crypto"; function createDockerBuildCapability(executor = defaultCloudExecutor()) { return { @@ -232241,7 +237274,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(readFileSync4(input.into)).digest("hex")}`; + const digest = `sha256:${createHash("sha256").update(readFileSync6(input.into)).digest("hex")}`; return { archivePath: input.into, digest }; } }; @@ -232261,7 +237294,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(readFileSync4(input.into)).digest("hex")}`; + const digest = `sha256:${createHash("sha256").update(readFileSync6(input.into)).digest("hex")}`; return { archivePath: input.into, digest }; } }; @@ -232327,8 +237360,8 @@ var init_sbom = __esm({ }); // node_modules/@intentius/chant/src/components/verbs/tool-sbom-generator.ts -import { basename, dirname as dirname9, join as join9 } from "node:path"; -import { existsSync as existsSync5 } from "node:fs"; +import { basename as basename3, dirname as dirname12, join as join11 } from "node:path"; +import { existsSync as existsSync7 } from "node:fs"; function countPackages(format, bytes) { try { const doc = JSON.parse(bytes); @@ -232340,8 +237373,8 @@ function countPackages(format, bytes) { } function scratchPath(workDir, subject, format) { const dir = workDir ?? "/tmp/chant-sbom"; - const safeName = basename(subject).replace(/[^a-zA-Z0-9_.-]/g, "_"); - return join9(dir, `${safeName}.${Date.now()}.${format}.json`); + const safeName = basename3(subject).replace(/[^a-zA-Z0-9_.-]/g, "_"); + return join11(dir, `${safeName}.${Date.now()}.${format}.json`); } function createToolSbomGenerator(options = {}) { const runner = options.runner ?? defaultProcessRunner(); @@ -232355,14 +237388,14 @@ function createToolSbomGenerator(options = {}) { return { async forImage(input) { const format = input.format ?? DEFAULT_SBOM_FORMAT; - const buildContext = dirname9(input.imagePath); - const hasDockerfile = existsSync5(join9(buildContext, "Dockerfile")); + const buildContext = dirname12(input.imagePath); + const hasDockerfile = existsSync7(join11(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(join9(out, "sbom.spdx.json"))}`); + const { stdout } = await runner.run(`cat ${q2(join11(out, "sbom.spdx.json"))}`); return { format, mediaType: SBOM_MEDIA_TYPES[format], @@ -232376,13 +237409,13 @@ function createToolSbomGenerator(options = {}) { }, async forJar(input) { const format = input.format ?? DEFAULT_SBOM_FORMAT; - const projectDir = dirname9(input.jarPath); - const hasPom = existsSync5(join9(projectDir, "pom.xml")); + const projectDir = dirname12(input.jarPath); + const hasPom = existsSync7(join11(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(join9(projectDir, "pom.xml"))} org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom -DoutputFormat=json -DoutputName=${q2(basename(out, ".json"))}`, + `mvn -f ${q2(join11(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)}`); @@ -232926,7 +237959,7 @@ var init_r2_sync = __esm({ // node_modules/@intentius/chant/src/components/verbs/vuln-scan.ts import { writeFileSync as writeFileSync3 } from "node:fs"; import { tmpdir as tmpdir2 } from "node:os"; -import { join as join10 } from "node:path"; +import { join as join12 } from "node:path"; import { createHash as createHash3 } from "node:crypto"; function normalizeSeverity(raw) { const s = (raw ?? "").toLowerCase(); @@ -232982,7 +238015,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 = join10(tmpdir2(), `chant-scan-${hash2}.${ext}`); + const path = join12(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)}`); @@ -233473,11 +238506,11 @@ var init_rule_loader = __esm({ }); // node_modules/@intentius/chant/src/lint/discover.ts -import { createRequire as createRequire2 } from "module"; +import { createRequire as createRequire3 } from "module"; var init_discover = __esm({ "node_modules/@intentius/chant/src/lint/discover.ts"() { try { - const _req = createRequire2(import.meta.url); + const _req = createRequire3(import.meta.url); const { register } = _req("tsx/cjs/api"); register(); } catch { @@ -233504,8 +238537,44 @@ var init_observation = __esm({ }); // node_modules/@intentius/chant/src/identity.ts +function redactCredentialMaterial(value, env2 = process.env) { + let out = value; + for (const [name, secret] of Object.entries(env2)) { + if (!secret || secret.length < MIN_CREDENTIAL_LENGTH) continue; + if (!CREDENTIAL_ENV_NAME.test(name)) continue; + if (!out.includes(secret)) continue; + out = out.split(secret).join(REDACTED2); + } + for (const shape of CREDENTIAL_SHAPES) out = out.replace(shape, REDACTED2); + for (const { re } of CREDENTIAL_TOKEN_SHAPES) out = out.replace(re, REDACTED2); + return out; +} +var REDACTED2, CREDENTIAL_ENV_NAME, MIN_CREDENTIAL_LENGTH, CREDENTIAL_SHAPES, CREDENTIAL_TOKEN_SHAPES; var init_identity = __esm({ "node_modules/@intentius/chant/src/identity.ts"() { + REDACTED2 = "[redacted]"; + CREDENTIAL_ENV_NAME = /(SECRET|TOKEN|PASSWORD|PASSWD|CREDENTIAL|PRIVATE_KEY|APIKEY|API_KEY|ACCESS_KEY|SESSION_KEY|AUTH)/i; + MIN_CREDENTIAL_LENGTH = 8; + CREDENTIAL_SHAPES = [ + // A PEM block of any key type. + /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, + // A JWT: three base64url segments, the first starting with the `{"` header. + /\beyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]*/g, + // An `Authorization`-style scheme plus its value. + /\b(?:Bearer|Basic)\s+[A-Za-z0-9\-._~+/]{16,}={0,2}/g + ]; + CREDENTIAL_TOKEN_SHAPES = [ + { name: "a GitHub token", re: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{6,}\b/g }, + { name: "a GitHub fine-grained token", re: /\bgithub_pat_[A-Za-z0-9_]{6,}\b/g }, + { name: "a GitLab personal access token", re: /\bglpat-[A-Za-z0-9_-]{3,}\b/g }, + { name: "an OpenAI-style secret key", re: /\bsk-(?:live-|proj-|test-)?[A-Za-z0-9]{6,}\b/g }, + { name: "a Stripe key", re: /\b[rs]k_(?:live|test)_[A-Za-z0-9]{6,}\b/g }, + { name: "a Slack token", re: /\bxox[abposr]-[A-Za-z0-9-]{6,}\b/g }, + { name: "an AWS access key id", re: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g }, + { name: "a Google API key", re: /\bAIza[0-9A-Za-z_-]{20,}\b/g }, + { name: "a Google OAuth token", re: /\bya29\.[0-9A-Za-z_-]{10,}/g }, + { name: "an npm token", re: /\bnpm_[A-Za-z0-9]{10,}\b/g } + ]; } }); @@ -233518,6 +238587,1049 @@ var init_apply = __esm({ // node_modules/@intentius/chant/src/deep-observation.ts var init_deep_observation = __esm({ "node_modules/@intentius/chant/src/deep-observation.ts"() { + init_held_elsewhere(); + } +}); + +// node_modules/@intentius/chant/src/behaviour.ts +function isBehaviourBasis(value) { + return typeof value === "string" && BEHAVIOUR_BASES.includes(value); +} +function predictedRate(perHour, currency) { + return { rate: "per-hour", perHour, currency }; +} +function isResilienceVerdict(value) { + return typeof value === "string" && RESILIENCE_VERDICTS.includes(value); +} +function isBehaviourUnpredictedReason(value) { + return typeof value === "string" && BEHAVIOUR_UNPREDICTED_REASONS.includes(value); +} +function isBehaviourRefusalReport(value) { + return typeof value === "object" && value !== null && "refusal" in value; +} +function isBehaviourResult(value) { + if (typeof value !== "object" || value === null) return false; + const v = value; + if (v.behaviour !== "v1") return false; + if (typeof v.refusal === "object" && v.refusal !== null) return true; + return typeof v.entities === "object" && v.entities !== null && typeof v.meta === "object" && v.meta !== null; +} +function statesNothing(value) { + return STATES_NOTHING.includes(value.trim().toLowerCase().replace(/\.$/, "")); +} +function validateBehaviourBlock(name, block2) { + const bad = (why) => { + throw new Error( + `predictBehaviour produced an invalid block for "${name}": ${why}. behold's own validator (behold/src/behaviour.ts) drops a block failing this, so it would render nothing rather than render wrong \u2014 which is worse to debug, because everything here looked legal.` + ); + }; + if (!isFilled(block2.at?.traffic)) bad("at.traffic is missing \u2014 name the traffic level you priced"); + const perHour = block2.cost?.perHour; + if (typeof perHour !== "number" || !Number.isFinite(perHour)) bad("cost.perHour is not a finite number"); + if (perHour < 0) bad("cost.perHour is negative"); + if (!isFilled(block2.cost?.currency)) bad("cost.currency is missing"); + const headroom = block2.headroom; + if (!headroom || typeof headroom !== "object") bad("headroom is missing"); + const h = headroom; + if (h.cpu !== void 0 && !isFraction(h.cpu)) bad("headroom.cpu is not a fraction 0..1"); + if (h.latency !== void 0 && !isFraction(h.latency)) bad("headroom.latency is not a fraction 0..1"); + if (h.cpu === void 0 && h.latency === void 0) { + bad("headroom carries neither cpu nor latency \u2014 an axis you did not model is absent, and a block with no axis at all says nothing"); + } + if (!isFraction(block2.errorRate)) bad("errorRate is not a fraction 0..1"); + if (!isFilled(block2.resilience?.failure)) { + bad("resilience.failure is missing \u2014 a verdict with no named failure says nothing"); + } + if (statesNothing(block2.resilience.failure)) { + bad( + `resilience.failure ${JSON.stringify(block2.resilience.failure)} names no failure. behold takes any non-empty string here, so this passes its validator and renders a confident verdict about nothing. Name the event: "one zone lost", "primary database failover"` + ); + } + if (!isResilienceVerdict(block2.resilience?.verdict)) { + bad(`resilience.verdict ${JSON.stringify(block2.resilience?.verdict)} is not survives/degrades/fails`); + } + if (block2.rightSize !== void 0 && !isFilled(block2.rightSize.suggestion)) { + bad("rightSize is present without a suggestion"); + } + const p = block2.provenance; + if (!p || typeof p !== "object") bad("provenance is missing"); + if (!isFilled(p?.engine)) bad("provenance.engine is missing"); + if (!isFilled(p?.version)) bad("provenance.version is missing"); + if (!isFilled(p?.tolerance)) { + bad("provenance.tolerance is missing \u2014 a figure without a stated tolerance is not a prediction"); + } + if (statesNothing(p.tolerance)) { + bad( + `provenance.tolerance ${JSON.stringify(p.tolerance)} states no tolerance. An engine with nothing to say about its own error bars has no business publishing a figure; say the number, however wide` + ); + } + if (!isBehaviourBasis(p?.basis)) { + bad(`provenance.basis ${JSON.stringify(p?.basis)} is not modeled/validated`); + } +} +function behaviourReport(request, stamp, entities, unpredicted) { + if (!isFilled(stamp?.engine)) throw new Error("predictBehaviour: meta.engine is missing"); + if (!isFilled(stamp?.version)) throw new Error("predictBehaviour: meta.version is missing"); + if (!isFilled(request?.traffic)) throw new Error("predictBehaviour: meta.at.traffic is missing"); + if (stamp.total && (!Number.isFinite(stamp.total.perHour) || stamp.total.perHour < 0)) { + throw new Error("predictBehaviour: meta.total.perHour is not a non-negative finite number"); + } + validateEdgeCoverage(request.edgeCoverage); + const meta4 = { + engine: stamp.engine, + version: stamp.version, + at: { traffic: request.traffic }, + ...stamp.total ? { total: stamp.total } : {}, + // Copied, not aliased. `readonly` is erased at runtime, so assigning the + // request's object by reference let a caller mutate + // `request.edgeCoverage.unresolvedKinds` after construction and change what + // the report claims it was computed over — the one field whose whole job is + // to be the report's honest account of its own inputs. + edgeCoverage: copyEdgeCoverage(request.edgeCoverage) + }; + const entityNames = request.entityNames; + const asked = new Set(entityNames); + const holes = new Set(Object.keys(unpredicted ?? {})); + for (const name of Object.keys(entities)) { + if (holes.has(name)) { + throw new Error( + `predictBehaviour reported "${name}" as both priced and unpriced. An entity has one verdict.` + ); + } + if (!asked.has(name)) { + throw new Error( + `predictBehaviour returned a figure for "${name}", which was not in entityNames. An engine answering about entities nobody asked about is answering about the wrong estate.` + ); + } + validateBehaviourBlock(name, entities[name]); + if (entities[name].at.traffic !== meta4.at.traffic) { + throw new Error( + `predictBehaviour priced "${name}" at ${JSON.stringify(entities[name].at.traffic)} in a run whose meta.at.traffic is ${JSON.stringify(meta4.at.traffic)}. One run, one level.` + ); + } + } + for (const name of holes) { + if (!asked.has(name)) { + throw new Error(`predictBehaviour reported "${name}" unpredicted, and it was not in entityNames.`); + } + if (!isBehaviourUnpredictedReason(unpredicted[name]?.reason)) { + throw new Error( + `predictBehaviour gave "${name}" the reason ${JSON.stringify(unpredicted[name]?.reason)}, which is not one of ${BEHAVIOUR_UNPREDICTED_REASONS.join(", ")}.` + ); + } + } + const missing = entityNames.filter( + (name) => !Object.prototype.hasOwnProperty.call(entities, name) && !holes.has(name) + ); + if (missing.length > 0) { + throw new Error( + `predictBehaviour gave no verdict at all for ${missing.map((n) => `"${n}"`).join(", ")}. Every entity asked about lands in \`entities\` or in \`unpredicted\` \u2014 there is no third position, because a prediction has no equivalent of "the provider says it is not there". An entity you could not price is \`unsupported-kind\`, not an omission.` + ); + } + return { + behaviour: "v1", + meta: meta4, + entities, + ...unpredicted && Object.keys(unpredicted).length > 0 ? { unpredicted } : {} + }; +} +function behaviourRefusal(refusal) { + return { behaviour: "v1", refusal }; +} +function compareProvenance(a, b) { + if (a.engine !== b.engine || a.version !== b.version || a.tolerance !== b.tolerance) { + return "mixed-engine"; + } + return a.basis === b.basis ? "comparable" : "mixed-basis"; +} +function compareFigures(a, b) { + const out = /* @__PURE__ */ new Set(); + if (compareProvenance(a.provenance, b.provenance) === "mixed-engine") out.add("mixed-engine"); + if (a.at.traffic !== b.at.traffic) out.add("mixed-level"); + if (a.cost.currency !== b.cost.currency) out.add("mixed-currency"); + if (a.provenance.basis !== b.provenance.basis) out.add("mixed-basis"); + if (a.resilience.failure !== b.resilience.failure) out.add("mixed-failure"); + return out; +} +function behaviourEngineVariables(lexicon) { + const scope = lexicon.toUpperCase().replace(/[^A-Z0-9]+/g, "_"); + return [`CHANT_BEHAVIOUR_ENGINE_${scope}`, "CHANT_BEHAVIOUR_ENGINE", "BEHAVIOUR_ENGINE"]; +} +function behaviourEngineFrom(lexicon, env2) { + for (const source of behaviourEngineVariables(lexicon)) { + const value = env2[source]?.trim(); + if (value) return { value, source }; + } + return void 0; +} +function noBehaviourEngineMessage(lexicon) { + const [scoped, chantWide, bare] = behaviourEngineVariables(lexicon); + return `predictBehaviour has the ${lexicon} estate to predict and no engine to predict it with. Set a ${chantWide} environment variable to the engine's address \u2014 a URL, a socket path, or a command on PATH \u2014 or ${bare} where nothing else in the environment is chant's. ${scoped} is read first, for an estate whose lexicons are priced by different engines. The address is not a credential: the engine is never handed one and never writes.`; +} +function behaviourTokenVariables(lexicon) { + const scope = lexicon.toUpperCase().replace(/[^A-Z0-9]+/g, "_"); + return [`CHANT_BEHAVIOUR_TOKEN_${scope}`, "CHANT_BEHAVIOUR_TOKEN", "BEHAVIOUR_TOKEN"]; +} +function behaviourTokenFrom(lexicon, env2) { + for (const source of behaviourTokenVariables(lexicon)) { + const value = env2[source]?.trim(); + if (value) return { value, source }; + } + return void 0; +} +function noBehaviourTokenMessage(lexicon, endpoint) { + const [scoped, chantWide, bare] = behaviourTokenVariables(lexicon); + return `predictBehaviour has the ${lexicon} behaviour engine at ${redactEngineAddress(endpoint.value)}, named by ${endpoint.source}, and no token to authenticate to it with, so nothing was sent. Set a ${chantWide} environment variable to the bearer token the engine issued \u2014 or ${bare} where nothing else in the environment is chant's. ${scoped} is read first, for an estate whose lexicons are priced by different engines on different accounts. The token goes in a header the engine reads and nowhere else; it is never in the request body and never in a message.`; +} +function noBehaviourTokenRefusal(lexicon, endpoint) { + const [, chantWide] = behaviourTokenVariables(lexicon); + return behaviourRefusal({ + cause: "no-engine", + reason: noBehaviourTokenMessage(lexicon, endpoint), + remedy: `Set ${chantWide} to the bearer token the engine at ${redactEngineAddress(endpoint.value)} issued.` + }); +} +function rejectedBehaviourTokenRefusal(lexicon, endpoint, token, detail) { + return behaviourRefusal({ + cause: "no-engine", + reason: `The ${lexicon} behaviour engine at ${redactEngineAddress(endpoint.value)}, named by ${endpoint.source}, answered and rejected the token ${token.source} holds (${scrubEngineDetail(detail)}). The address is reachable and the account is not the problem; the token is not one this engine accepts. No overlay is drawn and no figure is guessed locally.`, + remedy: `Set ${token.source} to a bearer token the engine at ${redactEngineAddress(endpoint.value)} accepts.`, + source: token.source + }); +} +function unreachableBehaviourEngineMessage(lexicon, endpoint, detail) { + return `predictBehaviour reached for the ${lexicon} behaviour engine at ${redactEngineAddress(endpoint.value)}, named by ${endpoint.source}, and it did not answer: ${scrubEngineDetail(detail)}. No overlay is drawn and no figure is guessed locally. Check the engine is up and that ${endpoint.source} names the address this environment can reach.`; +} +function noBehaviourEngineRefusal(lexicon) { + const [, chantWide] = behaviourEngineVariables(lexicon); + return behaviourRefusal({ + cause: "no-engine", + reason: noBehaviourEngineMessage(lexicon), + remedy: `Set ${chantWide} to the engine's address.` + }); +} +function unreachableBehaviourEngineRefusal(lexicon, endpoint, detail) { + return behaviourRefusal({ + cause: "engine-unreachable", + reason: unreachableBehaviourEngineMessage(lexicon, endpoint, detail), + remedy: `Check the engine at ${redactEngineAddress(endpoint.value)} is reachable, or repoint ${endpoint.source}.`, + source: endpoint.source + }); +} +function outOfCreditBehaviourEngineMessage(lexicon, endpoint, detail) { + return `The ${lexicon} behaviour engine at ${redactEngineAddress(endpoint.value)}, named by ${endpoint.source}, answered and refused: the account behind it is out of credit (${scrubEngineDetail(detail)}). The address is reachable and nothing here is a networking problem. Add credit to the account this engine bills, or point ${endpoint.source} at an engine on an account that has some. No overlay is drawn and no figure is guessed locally.`; +} +function overQuotaBehaviourEngineMessage(lexicon, endpoint, detail) { + return `The ${lexicon} behaviour engine at ${redactEngineAddress(endpoint.value)}, named by ${endpoint.source}, answered and refused: a rate or volume limit is spent (${scrubEngineDetail(detail)}). The account has credit and the address is reachable, so this usually clears when the engine's window rolls over. Wait for it, raise the limit on the account, or point ${endpoint.source} at an engine with its own budget. No overlay is drawn and no figure is guessed locally.`; +} +function outOfCreditBehaviourEngineRefusal(lexicon, endpoint, detail) { + return behaviourRefusal({ + cause: "engine-out-of-credit", + reason: outOfCreditBehaviourEngineMessage(lexicon, endpoint, detail), + remedy: `Add credit to the account behind ${endpoint.source}, or repoint it at a funded engine.`, + source: endpoint.source + }); +} +function overQuotaBehaviourEngineRefusal(lexicon, endpoint, detail) { + return behaviourRefusal({ + cause: "engine-over-quota", + reason: overQuotaBehaviourEngineMessage(lexicon, endpoint, detail), + remedy: `Wait for the engine's window to roll over, or raise the limit on the account behind ${endpoint.source}.`, + source: endpoint.source + }); +} +function behaviourWireRefusal(lexicon, endpoint, cause, detail) { + switch (cause) { + case "engine-out-of-credit": + return outOfCreditBehaviourEngineRefusal(lexicon, endpoint, detail); + case "engine-over-quota": + return overQuotaBehaviourEngineRefusal(lexicon, endpoint, detail); + case "engine-unreachable": + return unreachableBehaviourEngineRefusal(lexicon, endpoint, detail); + } +} +function behaviourEngineChildEnvironment(env2 = process.env) { + return { PATH: env2.PATH ?? "" }; +} +function renderBehaviourRefusal(refusal, options = {}) { + const color = options.color ?? (!process.env.NO_COLOR && process.stdout.isTTY !== false); + const body = `behaviour: refused (${refusal.cause}) \u2014 ${refusal.reason} + ${refusal.remedy}`; + return color ? `${RED}${body}${RESET}` : body; +} +function hasUrlPassword(value) { + if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) { + try { + if (new URL(value).password !== "") return true; + } catch { + } + } + return /^[^\s:@/]+:[^\s:@/]+@[A-Za-z0-9._-]+(?::\d+)?(?:[/?#]|$)/.test(value.trim()); +} +function isCredentialKey(key) { + const squashed = key.toLowerCase().replace(/[^a-z0-9]/g, ""); + if (REFERENCE_KEY_NAMES.includes(squashed)) return false; + if (REFERENCE_KEY_SUFFIXES.some((s) => squashed.endsWith(s))) return false; + if (EXTRA_CREDENTIAL_KEYS.includes(squashed)) return true; + return CREDENTIAL_ENV_NAME.test(key) || CREDENTIAL_ENV_NAME_SQUASHED.test(squashed); +} +function looksLikeSecretReference(value) { + return /^\{\{[^}]+\}\}$/.test(value.trim()) || /^\$\{[^}]+\}$/.test(value.trim()) || /^!(?:Ref|GetAtt|Sub|ImportValue)\b/.test(value.trim()) || /^arn:[a-z0-9-]*:secretsmanager:/i.test(value.trim()) || /^projects\/[^/]+\/secrets\/[^/]+/.test(value.trim()); +} +function credentialValueShape(value) { + for (const re of CREDENTIAL_SHAPES) { + re.lastIndex = 0; + if (re.test(value)) return "a literal credential shape (PEM key, JWT or Authorization value)"; + } + for (const { name, re } of CREDENTIAL_TOKEN_SHAPES) { + re.lastIndex = 0; + if (re.test(value)) return name; + } + if (hasUrlPassword(value)) return "a password in a URL's userinfo"; + return void 0; +} +function stripUrlSecrets(value) { + if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) return value; + try { + const url2 = new URL(value); + const hadUserinfo = url2.username !== "" || url2.password !== ""; + const hadQuery = url2.search !== ""; + const hadFragment = url2.hash !== ""; + url2.username = ""; + url2.password = ""; + url2.search = ""; + url2.hash = ""; + let out = url2.toString(); + if (hadUserinfo) out = out.replace("://", `://${REDACTED2}@`); + if (hadQuery) out += `?${REDACTED2}`; + if (hadFragment) out += `#${REDACTED2}`; + return out; + } catch { + return 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}` + ).replace(/(^|\s)(-[pPkK])(\s+)(\S+)/g, (_m, lead, flag, sp) => `${lead}${flag}${sp}${REDACTED2}`); +} +function redactEngineAddress(value, env2 = process.env) { + return redactCredentialMaterial(stripFlagSecrets(stripUrlSecrets(value)), env2); +} +function scrubEngineDetail(detail, env2 = process.env) { + const withoutUrls = detail.replace(/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi, (match) => { + try { + return new URL(match).host || REDACTED2; + } catch { + return REDACTED2; + } + }); + const scrubbed = redactCredentialMaterial(withoutUrls, env2).replace(/\s+/g, " ").trim(); + return scrubbed.length > MAX_ENGINE_DETAIL ? `${scrubbed.slice(0, MAX_ENGINE_DETAIL)}\u2026` : scrubbed; +} +function isEdgeCoverageVerdict(value) { + return typeof value === "string" && EDGE_COVERAGE_VERDICTS.includes(value); +} +function copyEdgeCoverage(coverage) { + const copy = { + verdict: coverage.verdict, + ...coverage.dangling ? { dangling: Object.freeze(coverage.dangling.map((d) => Object.freeze({ ...d }))) } : {}, + ...coverage.unresolvedKinds ? { unresolvedKinds: Object.freeze([...coverage.unresolvedKinds]) } : {}, + ...coverage.containmentEdges ? { containmentEdges: Object.freeze(coverage.containmentEdges.map((e) => Object.freeze({ ...e }))) } : {} + }; + return Object.freeze(copy); +} +function validateEdgeCoverage(coverage) { + if (!isEdgeCoverageVerdict(coverage?.verdict)) { + throw new Error( + `predictBehaviour: edgeCoverage.verdict ${JSON.stringify(coverage?.verdict)} is not ${EDGE_COVERAGE_VERDICTS.join("/")}.` + ); + } + if (coverage.verdict === "partial" && (coverage.dangling?.length ?? 0) === 0 && (coverage.unresolvedKinds?.length ?? 0) === 0) { + throw new Error( + 'predictBehaviour: edgeCoverage is "partial" and names nothing missing. Populate `dangling` or `unresolvedKinds`, or say "unknown" \u2014 a partial that lists no gap is an unknown with a more confident word on it.' + ); + } +} +function findCredentialsInOptions(options) { + const findings = []; + const seen = /* @__PURE__ */ new WeakSet(); + const walk = (value, path, depth) => { + if (depth > CREDENTIAL_WALK_DEPTH) { + findings.push({ + path, + rule: "walk-depth", + what: `a structure deeper than ${CREDENTIAL_WALK_DEPTH} levels, which the credential walk did not read` + }); + return; + } + if (typeof value === "string") { + const shape = credentialValueShape(value); + if (shape) findings.push({ path, rule: "value-shape", what: shape }); + return; + } + if (value === null || typeof value !== "object") return; + if (seen.has(value)) return; + seen.add(value); + if (Array.isArray(value)) { + value.forEach((item, i) => walk(item, `${path}[${i}]`, depth + 1)); + return; + } + if (value instanceof Map) { + for (const [key, item] of value) { + const label = typeof key === "string" ? key : String(key); + const child = `${path}.get(${label})`; + if (typeof key === "string") checkKey(key, child, item); + walk(item, child, depth + 1); + } + return; + } + if (value instanceof Set) { + let i = 0; + for (const item of value) walk(item, `${path}.item[${i++}]`, depth + 1); + return; + } + for (const [key, item] of Object.entries(value)) { + const child = `${path}.${key}`; + checkKey(key, child, item); + walk(item, child, depth + 1); + } + }; + function checkKey(key, path, item) { + if (typeof item !== "string") return; + if (item.length < MIN_CREDENTIAL_LENGTH2) return; + if (looksLikeSecretReference(item)) return; + if (!isCredentialKey(key)) return; + findings.push({ path, rule: "key-name", what: `a credential-shaped field name ("${key}")` }); + } + walk(options, "options", 0); + return findings; +} +function assertNoCredentialInOptions(options) { + const found = findCredentialsInOptions(options).filter((f) => f.rule === "value-shape"); + if (found.length === 0) return; + const [first] = found; + throw new Error( + `predictBehaviour was passed ${first.what} at ${first.path}. The behaviour engine is never handed a credential: it is given the resource graph and a traffic level, and nothing it receives can reach the account. Remove it \u2014 a lexicon that needs authenticated access to its own engine resolves that on its own transport, not through this contract.` + ); +} +function screenBehaviourRequest(lexicon, options) { + assertNoCredentialInOptions(options); + const findings = findCredentialsInOptions(options); + if (findings.length === 0) return void 0; + const [first] = findings; + const more = findings.length > 1 ? ` (and ${findings.length - 1} more)` : ""; + return behaviourRefusal({ + cause: "credential-in-request", + reason: `The ${lexicon} behaviour request carries ${first.what} at ${first.path}${more}, so it was not sent. The engine is a third party and this contract hands it the resource graph and a traffic level only. No overlay is drawn and no figure is guessed locally.`, + remedy: "Remove the value from the declaration, or hold it in a secret reference the build does not expand. If the field is a false positive, it still leaves the process in this request." + }); +} +var BEHAVIOUR_BASIS_WITNESS, BEHAVIOUR_BASES, RESILIENCE_VERDICT_WITNESS, RESILIENCE_VERDICTS, BEHAVIOUR_UNPREDICTED_REASON_WITNESS, BEHAVIOUR_UNPREDICTED_REASONS, STATES_NOTHING, isFraction, isFilled, FIGURE_MISMATCH_WITNESS, FIGURE_MISMATCHES, RED, RESET, EXTRA_CREDENTIAL_KEYS, MIN_CREDENTIAL_LENGTH2, REFERENCE_KEY_SUFFIXES, REFERENCE_KEY_NAMES, CREDENTIAL_ENV_NAME_SQUASHED, MAX_ENGINE_DETAIL, EDGE_COVERAGE_WITNESS, EDGE_COVERAGE_VERDICTS, CREDENTIAL_WALK_DEPTH; +var init_behaviour = __esm({ + "node_modules/@intentius/chant/src/behaviour.ts"() { + init_identity(); + BEHAVIOUR_BASIS_WITNESS = { + modeled: true, + validated: true + }; + BEHAVIOUR_BASES = Object.keys( + BEHAVIOUR_BASIS_WITNESS + ); + RESILIENCE_VERDICT_WITNESS = { + survives: true, + degrades: true, + fails: true + }; + RESILIENCE_VERDICTS = Object.keys( + RESILIENCE_VERDICT_WITNESS + ); + BEHAVIOUR_UNPREDICTED_REASON_WITNESS = { + "read-failed": true, + "no-binding": true, + "unsupported-kind": true, + filtered: true, + "no-engine": true, + "engine-unreachable": true, + "engine-out-of-credit": true, + "engine-over-quota": true, + "credential-in-request": true + }; + BEHAVIOUR_UNPREDICTED_REASONS = Object.keys( + BEHAVIOUR_UNPREDICTED_REASON_WITNESS + ); + STATES_NOTHING = ["n/a", "na", "none", "unknown", "-", "?", "tbd", "null"]; + isFraction = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <= 1; + isFilled = (v) => typeof v === "string" && v.trim() !== ""; + FIGURE_MISMATCH_WITNESS = { + "mixed-engine": 0, + "mixed-level": 1, + "mixed-currency": 2, + "mixed-basis": 3, + "mixed-failure": 4 + }; + FIGURE_MISMATCHES = Object.keys(FIGURE_MISMATCH_WITNESS).sort((a, b) => FIGURE_MISMATCH_WITNESS[a] - FIGURE_MISMATCH_WITNESS[b]); + RED = "\x1B[31m"; + RESET = "\x1B[0m"; + EXTRA_CREDENTIAL_KEYS = ["pat", "cookie"]; + MIN_CREDENTIAL_LENGTH2 = 8; + REFERENCE_KEY_SUFFIXES = [ + "ref", + "refs", + "name", + "names", + "id", + "ids", + "arn", + "arns", + "count", + "validity", + "mode", + "modes", + "policy", + "policies", + "scope", + "scopes", + "network", + "networks", + "type", + "types", + "enabled", + "required", + "version", + "uri", + "url", + "urls", + "config", + "configs", + "settings", + "options" + ]; + REFERENCE_KEY_NAMES = [ + "imagepullsecrets", + "clienttoken", + // A Kubernetes boolean: "mount the service account's token into this pod". + // It holds no token and never did. + "automountserviceaccounttoken", + "author", + "authors", + "authority", + "secretsmanager" + ]; + CREDENTIAL_ENV_NAME_SQUASHED = new RegExp(CREDENTIAL_ENV_NAME.source.replace(/_/g, ""), "i"); + MAX_ENGINE_DETAIL = 200; + EDGE_COVERAGE_WITNESS = { + complete: true, + partial: true, + unknown: true + }; + EDGE_COVERAGE_VERDICTS = Object.keys( + EDGE_COVERAGE_WITNESS + ); + CREDENTIAL_WALK_DEPTH = 32; + } +}); + +// node_modules/@intentius/chant/src/behaviour-http.ts +function isHttpBehaviourAddress(value) { + return /^https?:\/\//i.test(value.trim()); +} +function concealing(token, text) { + if (token.value.length < 4 || !text.includes(token.value)) return text; + return text.split(token.value).join(REDACTED2); +} +function httpStatusRefusal(lexicon, endpoint, token, status, detail, retryAfter) { + if (status >= 200 && status < 300) return void 0; + const said = detail.trim().length > 0 ? `: ${detail.trim()}` : ""; + if (status === 401 || status === 403) { + return rejectedBehaviourTokenRefusal(lexicon, endpoint, token, `HTTP ${status}${said}`); + } + if (status === 402) { + return behaviourWireRefusal( + lexicon, + endpoint, + "engine-out-of-credit", + `the account ${token.source} authenticates answered HTTP 402${said}` + ); + } + if (status === 429) { + const window = retryAfter && retryAfter.trim().length > 0 ? `, retry after ${retryAfter.trim()}` : ""; + return behaviourWireRefusal( + lexicon, + endpoint, + "engine-over-quota", + `the account ${token.source} authenticates answered HTTP 429${window}${said}` + ); + } + return behaviourWireRefusal( + lexicon, + endpoint, + "engine-unreachable", + `HTTP ${status}${said || " with no body"}` + ); +} +function firstLine(text) { + const line = text.split("\n").find((l) => l.trim().length > 0)?.trim() ?? ""; + return line.length > MAX_BODY_IN_DETAIL ? `${line.slice(0, MAX_BODY_IN_DETAIL)}\u2026` : line; +} +function httpBehaviourTransport(lexicon, endpoint, env2, deps = {}) { + const token = behaviourTokenFrom(lexicon, env2); + const send = deps.fetch ?? globalThis.fetch; + const timeoutMs = deps.timeoutMs ?? HTTP_BEHAVIOUR_TIMEOUT_MS; + if (!token) { + const refusal = noBehaviourTokenRefusal(lexicon, endpoint); + return { async send() { + return { ok: false, refusal }; + } }; + } + return { + async send(body) { + let response; + try { + response = await send(endpoint.value.trim(), { + method: "POST", + headers: { + "content-type": "application/json", + accept: "application/json", + authorization: `Bearer ${token.value}` + }, + body, + // A redirect would carry the header above to whatever host the + // engine named. Refused here, reported as unreachable below. + redirect: "error", + signal: AbortSignal.timeout(timeoutMs) + }); + } catch (err) { + return { + ok: false, + refusal: behaviourWireRefusal( + lexicon, + endpoint, + "engine-unreachable", + concealing(token, describeFetchError(err, timeoutMs)) + ) + }; + } + const text = await response.text().catch(() => ""); + const refusal = httpStatusRefusal( + lexicon, + endpoint, + token, + response.status, + concealing(token, firstLine(text)), + response.headers.get("retry-after") ?? void 0 + ); + if (refusal) return { ok: false, refusal }; + return { ok: true, body: concealing(token, text) }; + } + }; +} +function describeFetchError(err, timeoutMs) { + if (err instanceof Error) { + if (err.name === "TimeoutError" || err.name === "AbortError") { + return `no answer within ${timeoutMs} ms`; + } + const cause = err.cause; + const code = typeof cause?.code === "string" ? cause.code : void 0; + if (code) return `${code}: ${err.message}`; + return err.message; + } + return String(err); +} +var HTTP_BEHAVIOUR_TIMEOUT_MS, MAX_BODY_IN_DETAIL; +var init_behaviour_http = __esm({ + "node_modules/@intentius/chant/src/behaviour-http.ts"() { + init_behaviour(); + init_identity(); + HTTP_BEHAVIOUR_TIMEOUT_MS = 3e4; + MAX_BODY_IN_DETAIL = 300; + } +}); + +// node_modules/@intentius/chant/src/behaviour-kinds.ts +function coverageFor(contributors, entityType, props) { + if (entityType.startsWith(CHANT_PSEUDO_PREFIX)) { + return { + status: "declared-unmapped", + reason: "one of chant's own build-time entities rather than something an account holds \u2014 a declared output, or a default that rides onto the resources beside it. It is never created and never billed" + }; + } + const owner = contributors.find((c) => c.prefixes.some((p) => entityType.startsWith(p))); + if (!owner) return { status: "unknown-type" }; + if (owner.nothingPriced) return { status: "provider-not-modelled", substrate: owner.nothingPriced }; + const type = owner.resolveType ? owner.resolveType(entityType, props) : entityType; + if (type === void 0) return { status: "unknown-type" }; + if (owner.mapped && Object.prototype.hasOwnProperty.call(owner.mapped, type)) { + const row = owner.mapped[type]; + return { status: "mapped", mapping: { ...row, provider: row.provider ?? owner.provider } }; + } + if (owner.unmapped && Object.prototype.hasOwnProperty.call(owner.unmapped, type)) { + return { status: "declared-unmapped", reason: owner.unmapped[type] }; + } + const elsewhere = owner.notModelledWhen?.(type); + if (elsewhere !== void 0) return { status: "provider-not-modelled", substrate: elsewhere }; + const late = owner.unmappedWhen?.(type); + if (late !== void 0) return { status: "declared-unmapped", reason: late }; + return { status: "unknown-type" }; +} +function ownerOf(contributors, entityType) { + return contributors.find((c) => c.prefixes.some((p) => entityType.startsWith(p))); +} +function coverageLabel(contributors, entityType, props) { + const owner = ownerOf(contributors, entityType); + if (!owner?.resolveType) return entityType; + const type = owner.resolveType(entityType, props); + return type === void 0 || type === entityType ? entityType : `${type} (${entityType})`; +} +function unmappedDetail(label, verdict, owner) { + if (verdict.status === "declared-unmapped") { + return `${label} is declared unmapped by the ${owner?.provider ?? "declaring"} coverage rows: ${verdict.reason}.`; + } + if (verdict.status === "provider-not-modelled") { + 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}.`; +} +var ENGINE_KIND_WITNESS, ENGINE_KINDS, CHANT_PSEUDO_PREFIX, byCodeUnit; +var init_behaviour_kinds = __esm({ + "node_modules/@intentius/chant/src/behaviour-kinds.ts"() { + ENGINE_KIND_WITNESS = { + compute: true, + serverless: true, + "control-plane": true, + database: true, + cache: true, + queue: true, + "object-store": true, + "block-store": true, + "load-balancer": true, + cdn: true + }; + ENGINE_KINDS = Object.keys(ENGINE_KIND_WITNESS); + CHANT_PSEUDO_PREFIX = "chant:"; + byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0; + } +}); + +// node_modules/@intentius/chant/src/behaviour-delta.ts +function validateBehaviourResult(result, askedFor) { + if (!isBehaviourResult(result)) { + throw new Error( + 'behaviour result is neither a report nor a refusal: expected `behaviour: "v1"` with either `refusal` or both `meta` and `entities`.' + ); + } + if (isBehaviourRefusalReport(result)) { + const r = result.refusal; + if (!isBehaviourUnpredictedReason(r.cause)) { + throw new Error(`behaviour refusal carries the cause ${JSON.stringify(r.cause)}, which is not a legal reason.`); + } + if (typeof r.reason !== "string" || r.reason.trim() === "") { + throw new Error("behaviour refusal states no reason \u2014 the sentence a consumer prints is missing."); + } + if (typeof r.remedy !== "string" || r.remedy.trim() === "") { + throw new Error("behaviour refusal states no remedy \u2014 a refusal exists to be acted on."); + } + return result; + } + const report2 = result; + validateEdgeCoverage(report2.meta.edgeCoverage); + if (typeof report2.meta.at?.traffic !== "string" || report2.meta.at.traffic.trim() === "") { + throw new Error("behaviour report states no traffic level in meta.at \u2014 a figure without its question is a bill in waiting."); + } + const asked = new Set(askedFor); + const unpredicted = report2.unpredicted ?? {}; + const holes = new Set(Object.keys(unpredicted)); + for (const name of Object.keys(report2.entities)) { + if (holes.has(name)) throw new Error(`behaviour report names "${name}" as both predicted and unpredicted.`); + if (!asked.has(name)) { + throw new Error(`behaviour report carries a figure for "${name}", which was not asked about.`); + } + validateBehaviourBlock(name, report2.entities[name]); + if (report2.entities[name].at.traffic !== report2.meta.at.traffic) { + throw new Error( + `behaviour report priced "${name}" at ${JSON.stringify(report2.entities[name].at.traffic)} in a run whose meta.at.traffic is ${JSON.stringify(report2.meta.at.traffic)}.` + ); + } + } + for (const name of holes) { + if (!asked.has(name)) throw new Error(`behaviour report names "${name}" unpredicted, and it was not asked about.`); + if (!isBehaviourUnpredictedReason(unpredicted[name]?.reason)) { + throw new Error( + `behaviour report gives "${name}" the reason ${JSON.stringify(unpredicted[name]?.reason)}, which is not a legal one.` + ); + } + } + const missing = askedFor.filter( + (name) => !Object.prototype.hasOwnProperty.call(report2.entities, name) && !holes.has(name) + ); + if (missing.length > 0) { + throw new Error( + `behaviour report gives no verdict at all for ${missing.map((n) => `"${n}"`).join(", ")}. Every entity asked about lands in \`entities\` or in \`unpredicted\`; there is no third position.` + ); + } + return report2; +} +function byCodeUnit2(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} +function has(map2, key) { + return map2 !== void 0 && Object.prototype.hasOwnProperty.call(map2, key); +} +function behaviourDelta(base, head) { + const baseRefused = isBehaviourRefusalReport(base.result); + const headRefused = isBehaviourRefusalReport(head.result); + if (baseRefused || headRefused) { + return { + kind: "no-prediction", + base: { + label: base.label, + ...base.ref ? { ref: base.ref } : {}, + ...baseRefused ? { refusal: base.result.refusal } : {} + }, + head: { + label: head.label, + ...head.ref ? { ref: head.ref } : {}, + ...headRefused ? { refusal: head.result.refusal } : {} + } + }; + } + const b = base.result; + const h = head.result; + const names = /* @__PURE__ */ new Set([ + ...Object.keys(b.entities), + ...Object.keys(b.unpredicted ?? {}), + ...Object.keys(h.entities), + ...Object.keys(h.unpredicted ?? {}) + ]); + const rows = []; + const sumsByCurrency = /* @__PURE__ */ new Map(); + for (const name of [...names].sort(byCodeUnit2)) { + const baseFigure = has(b.entities, name) ? b.entities[name] : void 0; + const headFigure = has(h.entities, name) ? h.entities[name] : void 0; + const baseDeclined = has(b.unpredicted, name) ? b.unpredicted[name] : void 0; + const headDeclined = has(h.unpredicted, name) ? h.unpredicted[name] : void 0; + const type = baseDeclined?.type ?? headDeclined?.type; + const row = { + name, + ...type ? { type } : {}, + kind: "comparable", + ...baseFigure ? { base: baseFigure } : {}, + ...headFigure ? { head: headFigure } : {}, + ...baseDeclined ? { baseDeclined } : {}, + ...headDeclined ? { headDeclined } : {} + }; + if (baseDeclined || headDeclined) { + row.kind = "declined"; + } else if (baseFigure && headFigure) { + const found = compareFigures(baseFigure, headFigure); + if (found.size > 0) { + row.kind = "marked"; + row.mismatches = FIGURE_MISMATCHES.filter((m) => found.has(m)); + } else { + row.kind = "comparable"; + row.deltaPerHour = headFigure.cost.perHour - baseFigure.cost.perHour; + row.currency = headFigure.cost.currency; + const sum = sumsByCurrency.get(row.currency) ?? { currency: row.currency, perHour: 0, pairs: 0 }; + sum.perHour += row.deltaPerHour; + sum.pairs += 1; + sumsByCurrency.set(row.currency, sum); + } + } else if (baseFigure) { + row.kind = "only-base"; + } else { + row.kind = "only-head"; + } + rows.push(row); + } + return { + kind: "delta", + base: { label: base.label, ...base.ref ? { ref: base.ref } : {}, meta: b.meta }, + head: { label: head.label, ...head.ref ? { ref: head.ref } : {}, meta: h.meta }, + rows, + sums: [...sumsByCurrency.values()].sort((x, y) => byCodeUnit2(x.currency, y.currency)), + resilienceComparable: b.meta.edgeCoverage.verdict === "complete" && h.meta.edgeCoverage.verdict === "complete" + }; +} +function formatPerHour(n) { + const fixed = n.toFixed(4); + return fixed.includes(".") ? fixed.replace(/0+$/, "").replace(/\.$/, "") : fixed; +} +function renderRate(rate) { + return `${formatPerHour(rate.perHour)} ${rate.currency}/hour`; +} +function renderDelta(perHour, currency) { + const sign = perHour > 0 ? "+" : ""; + return `${sign}${formatPerHour(perHour)} ${currency}/hour`; +} +function renderProvenance(p) { + return `${p.engine} ${p.version} \xB7 ${p.tolerance} \xB7 ${p.basis}`; +} +function renderCoverage(c) { + const gaps = []; + if (c.unresolvedKinds && c.unresolvedKinds.length > 0) gaps.push(`unresolved kinds: ${c.unresolvedKinds.join(", ")}`); + if (c.dangling && c.dangling.length > 0) gaps.push(`${c.dangling.length} dangling reference(s)`); + if (c.containmentEdges && c.containmentEdges.length > 0) gaps.push(`${c.containmentEdges.length} containment edge(s)`); + return gaps.length > 0 ? `${c.verdict} (${gaps.join("; ")})` : c.verdict; +} +function renderAxis(name, before, after) { + const b = before === void 0 ? "\u2014" : formatPerHour(before); + const a = after === void 0 ? "\u2014" : formatPerHour(after); + return `${name} ${b} \u2192 ${a}`; +} +function renderHeadroom(base, head) { + const b = base?.headroom ?? {}; + const h = head?.headroom ?? {}; + return [renderAxis("cpu", b.cpu, h.cpu), renderAxis("latency", b.latency, h.latency)].join(" \xB7 "); +} +function renderVerdict(f) { + return f ? `${f.resilience.verdict} (${f.resilience.failure})` : "\u2014"; +} +function renderResilience(row, comparable) { + const { base, head } = row; + if (!base || !head) return base ? `base ${renderVerdict(base)}` : head ? `head ${renderVerdict(head)}` : "\u2014"; + if (comparable && base.resilience.failure === head.resilience.failure) { + const arrow = base.resilience.verdict === head.resilience.verdict ? "=" : "\u2192"; + return `${base.resilience.verdict} ${arrow} ${head.resilience.verdict} (${base.resilience.failure})`; + } + return `base ${renderVerdict(base)}; head ${renderVerdict(head)}`; +} +function renderRowProvenance(row) { + const { base, head } = row; + if (base && head) { + const b = renderProvenance(base.provenance); + const h = renderProvenance(head.provenance); + return b === h ? b : `base: ${b}; head: ${h}`; + } + return base ? renderProvenance(base.provenance) : head ? renderProvenance(head.provenance) : "\u2014"; +} +function cell(s) { + return s.replace(/\|/g, "\\|").replace(/\r?\n/g, " "); +} +function figureCell(f, declined) { + if (declined) return `declined: ${declined.reason}`; + if (f) return renderRate(f.cost); + return "\u2014"; +} +function deltaCell(row) { + switch (row.kind) { + case "comparable": + return renderDelta(row.deltaPerHour, row.currency); + case "marked": + return `marked: ${(row.mismatches ?? []).join(", ")}`; + case "declined": + return "no delta (declined)"; + case "only-base": + return "removed"; + case "only-head": + return "added"; + } +} +function renderBehaviourFinding(delta, ctx) { + const lines = []; + if (delta.kind === "no-prediction") { + lines.push(`## Predicted behaviour for \`${ctx.env}\` \u2014 no prediction (Op \`${ctx.op}\`)`, ""); + lines.push( + "No delta is shown and no figure is guessed locally. A prediction refused on one side is not a prediction of zero on that side, so there is nothing to difference the other side against.", + "" + ); + for (const side of [delta.base, delta.head]) { + if (!side.refusal) continue; + const title = side.ref ? `${side.label} (${side.ref})` : side.label; + lines.push(`**${title}**`, "", "```", renderBehaviourRefusal(side.refusal, { color: false }), "```", ""); + } + return lines.join("\n").trimEnd() + "\n"; + } + const traffic = delta.head.meta.at.traffic; + lines.push(`## Predicted behaviour for \`${ctx.env}\` at \`${traffic}\` (Op \`${ctx.op}\`)`, ""); + lines.push( + "A prediction, not a measurement. Every figure below is one engine's modeled rate for one hypothetical hour at the stated traffic level, shown with that engine's name, version, stated tolerance and basis (`modeled` from list prices, or `validated`). Nothing here is an amount owed for an hour that happened.", + "" + ); + lines.push("| Side | Predicted from | Engine | Traffic level | Edge coverage | Engine's own estate total |"); + lines.push("|---|---|---|---|---|---|"); + for (const side of [delta.base, delta.head]) { + const total = side.meta.total ? renderRate(side.meta.total) : "not stated"; + lines.push( + `| ${side.label} | ${cell(side.ref ?? "\u2014")} | ${cell(`${side.meta.engine} ${side.meta.version}`)} | ${cell(side.meta.at.traffic)} | ${cell(renderCoverage(side.meta.edgeCoverage))} | ${total} |` + ); + } + lines.push(""); + if (delta.base.meta.at.traffic !== delta.head.meta.at.traffic) { + lines.push( + `The two sides were predicted at different traffic levels (\`${delta.base.meta.at.traffic}\` and \`${delta.head.meta.at.traffic}\`), so every pair below is marked \`mixed-level\` and none is differenced.`, + "" + ); + } + if (!delta.resilienceComparable) { + lines.push( + `Resilience verdicts are shown per side and **not compared**: edge coverage is \`${delta.base.meta.edgeCoverage.verdict}\` on ${delta.base.label} and \`${delta.head.meta.edgeCoverage.verdict}\` on ${delta.head.label}, so the two verdicts were computed over graphs of different completeness, and a difference between them is not a difference in the estate.`, + "" + ); + } + lines.push( + `| Entity | Type | ${delta.base.label} | ${delta.head.label} | Delta per hour | Headroom (${delta.base.label} \u2192 ${delta.head.label}) | Resilience | Provenance |` + ); + lines.push("|---|---|---|---|---|---|---|---|"); + for (const row of delta.rows) { + lines.push( + `| ${cell(row.name)} | ${cell(row.type ?? "")} | ${cell(figureCell(row.base, row.baseDeclined))} | ${cell(figureCell(row.head, row.headDeclined))} | ${cell(deltaCell(row))} | ${cell(renderHeadroom(row.base, row.head))} | ${cell(renderResilience(row, delta.resilienceComparable))} | ${cell(renderRowProvenance(row))} |` + ); + } + lines.push(""); + const marked = delta.rows.filter((r) => r.kind === "marked").length; + const declined = delta.rows.filter((r) => r.kind === "declined").length; + const oneSided = delta.rows.filter((r) => r.kind === "only-base" || r.kind === "only-head").length; + if (delta.sums.length > 0) { + for (const sum of delta.sums) { + lines.push( + `Sum of the comparable deltas: **${renderDelta(sum.perHour, sum.currency)}** over ${sum.pairs} pair(s). This is chant's own arithmetic over the comparable rows above and not an engine figure; it excludes ${marked} marked pair(s), ${declined} declined entit${declined === 1 ? "y" : "ies"} and ${oneSided} entit` + (oneSided === 1 ? "y" : "ies") + " present on one side only." + ); + } + lines.push(""); + } else { + lines.push("No pair is comparable, so no delta is summed.", ""); + } + const declinedRows = delta.rows.filter((r) => r.kind === "declined"); + if (declinedRows.length > 0) { + lines.push("### Declined entities", ""); + lines.push( + "An entity the engine could not price is reported, not priced at nothing. It carries no delta on either side; the reason is the lexicon's own.", + "" + ); + for (const row of declinedRows) { + for (const [label, d] of [ + [delta.base.label, row.baseDeclined], + [delta.head.label, row.headDeclined] + ]) { + if (!d) continue; + lines.push(`- \`${row.name}\` on ${label}: \`${d.reason}\`${d.detail ? ` \u2014 ${d.detail}` : ""}`); + } + } + lines.push(""); + } + const hints = delta.rows.filter((r) => r.head?.rightSize); + if (hints.length > 0) { + lines.push(`### Right-size hints on ${delta.head.label}`, ""); + for (const row of hints) { + const rs = row.head.rightSize; + lines.push(`- \`${row.name}\`: ${rs.suggestion}${rs.reason ? ` \u2014 ${rs.reason}` : ""}`); + } + lines.push(""); + } + return lines.join("\n").trimEnd() + "\n"; +} +var init_behaviour_delta = __esm({ + "node_modules/@intentius/chant/src/behaviour-delta.ts"() { + init_behaviour(); + } +}); + +// node_modules/@intentius/chant/src/claimed-fields.ts +var init_claimed_fields = __esm({ + "node_modules/@intentius/chant/src/claimed-fields.ts"() { + init_deep_observation(); } }); @@ -233674,10 +239786,10 @@ var init_okf = __esm({ }); // node_modules/@intentius/chant/src/codegen/okf-lexicon.ts -var ts32; +var ts33; var init_okf_lexicon = __esm({ "node_modules/@intentius/chant/src/codegen/okf-lexicon.ts"() { - ts32 = __toESM(require_typescript(), 1); + ts33 = __toESM(require_typescript(), 1); init_okf(); } }); @@ -233778,34 +239890,6 @@ var init_pinned_upgrade = __esm({ } }); -// node_modules/@intentius/chant/src/runtime.ts -function createResource(type, lexicon, attrMap) { - const ResourceClass = function(props, attributes) { - Object.defineProperty(this, DECLARABLE_MARKER, { value: true, enumerable: false }); - Object.defineProperty(this, "lexicon", { value: lexicon, enumerable: false }); - Object.defineProperty(this, "entityType", { value: type, enumerable: false }); - Object.defineProperty(this, "kind", { value: "resource", enumerable: false }); - Object.defineProperty(this, "props", { value: props ?? {}, enumerable: false, configurable: true }); - Object.defineProperty(this, "attributes", { value: attributes ?? {}, enumerable: false, configurable: true }); - Object.defineProperty(this, "Ref", { value: this, enumerable: false }); - for (const [camelName, attrName] of Object.entries(attrMap)) { - Object.defineProperty(this, camelName, { - value: new AttrRef(this, attrName), - enumerable: true, - writable: false - }); - } - }; - Object.defineProperty(ResourceClass, "name", { value: type.split("::").pop() ?? type }); - return ResourceClass; -} -var init_runtime = __esm({ - "node_modules/@intentius/chant/src/runtime.ts"() { - init_declarable(); - init_attrref(); - } -}); - // node_modules/@intentius/chant/src/resource-attributes.ts var init_resource_attributes = __esm({ "node_modules/@intentius/chant/src/resource-attributes.ts"() { @@ -233873,6 +239957,8 @@ var init_observation_baseline = __esm({ var init_deep_diff = __esm({ "node_modules/@intentius/chant/src/lifecycle/deep-diff.ts"() { init_deep_observation(); + init_claimed_fields(); + init_held_elsewhere(); init_provenance(); init_observation_baseline(); } @@ -233882,6 +239968,7 @@ var init_deep_diff = __esm({ var init_deep_observe = __esm({ "node_modules/@intentius/chant/src/lifecycle/deep-observe.ts"() { init_deep_observation(); + init_claimed_fields(); init_observation(); init_deep_diff(); } @@ -234059,12 +240146,30 @@ var init_converge_ledger = __esm({ } }); +// node_modules/@intentius/chant/src/lifecycle/run-ledger.ts +var init_run_ledger = __esm({ + "node_modules/@intentius/chant/src/lifecycle/run-ledger.ts"() { + init_utils(); + init_git(); + } +}); + // node_modules/@intentius/chant/src/lifecycle/scenario-eval.ts var init_scenario_eval = __esm({ "node_modules/@intentius/chant/src/lifecycle/scenario-eval.ts"() { init_change_set(); init_unobserved_gate(); init_observation(); + init_behaviour(); + init_behaviour_delta(); + } +}); + +// 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(); } }); @@ -234093,17 +240198,10 @@ var init_lifecycle = __esm({ init_assert_live(); init_symptoms(); init_converge_ledger(); + init_run_ledger(); init_scenario(); init_scenario_eval(); - } -}); - -// node_modules/@intentius/chant/src/op/resource.ts -var OpResource; -var init_resource = __esm({ - "node_modules/@intentius/chant/src/op/resource.ts"() { - init_runtime(); - OpResource = createResource("Temporal::Op", "temporal", {}); + init_plan_digest(); } }); @@ -234114,9 +240212,119 @@ var init_receipt_store = __esm({ } }); +// 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/activity-profiles.ts +var ACTIVITY_PROFILES, ACTIVITY_PROFILE_NAMES; +var init_activity_profiles = __esm({ + "node_modules/@intentius/chant/src/op/activity-profiles.ts"() { + ACTIVITY_PROFILES = { + /** + * Fast, idempotent operations: `chant build`, `kubectl apply` without `--wait`, + * fetching nameservers, reading cluster status. + */ + fastIdempotent: { + timeout: "5m", + retry: { maximumAttempts: 3, initialInterval: "5s", backoffCoefficient: 2 } + }, + /** + * Long-running infra: GKE cluster creation via Config Connector (~10-20 min), + * `kubectl apply --wait` for large resource sets, Helm installs. + */ + longInfra: { + timeout: "20m", + retry: { maximumAttempts: 3, initialInterval: "30s", backoffCoefficient: 2 } + }, + /** + * K8s wait loops: polling for StatefulSet rollout, ExternalDNS A-records, + * DNS propagation. + */ + k8sWait: { + timeout: "15m", + // A terminal-state resource (waitForReady's ReadinessFailedError) will never + // become ready — fail fast instead of exhausting retries. + retry: { + maximumAttempts: 3, + initialInterval: "10s", + backoffCoefficient: 2, + nonRetryableErrorTypes: ["ReadinessFailedError"] + } + }, + /** + * A command chant did not write and cannot know is safe to repeat (#2411). + * + * `shellCmd` is the escape hatch: its whole purpose is to run something + * outside the model, so nothing here can judge whether a second attempt is + * harmless or a second deployment. Every other activity carrying a retrying + * profile is one chant authored and knows the shape of. + * + * Twenty minutes, because a shell step is as likely to be a long build as a + * quick script, and one attempt, because retrying is the claim that needs + * evidence. An author who knows their command is idempotent names + * `fastIdempotent` or `longInfra` and gets retries back. + */ + atMostOnce: { + timeout: "20m", + retry: { maximumAttempts: 1 } + }, + /** + * Human-gate steps: waiting for an operator action (DNS delegation, approval). + * Very long timeout, single attempt — no retry on human-gate timeouts. + */ + humanGate: { + timeout: "48h", + retry: { maximumAttempts: 1 } + }, + /** + * Argo CD sync waits: poll an Application until `health=Healthy && sync=Synced` + * (`waitForArgoSync`). Long timeout for slow first syncs, cheap idempotent + * retries — re-polling is free. A terminal-unhealthy Application fails fast + * via `ArgoSyncFailedError` (non-retryable). + */ + argoSync: { + timeout: "30m", + retry: { + maximumAttempts: 5, + initialInterval: "10s", + backoffCoefficient: 2, + maximumInterval: "1m", + nonRetryableErrorTypes: ["ArgoSyncFailedError"] + } + }, + /** + * Organizational policy gate (`policyGate`): build the project and evaluate + * `lint.policies`. Deterministic — a violation is the same on every attempt — + * so a single attempt, short timeout, no retry. + */ + policyCheck: { + timeout: "5m", + retry: { maximumAttempts: 1 } + } + }; + ACTIVITY_PROFILE_NAMES = Object.keys(ACTIVITY_PROFILES); + } +}); + // node_modules/@intentius/chant/src/op/activity-contract.ts +function activityContract(name, args, returns, opts) { + return { + [CONTRACT_BRAND]: true, + name, + args, + ...returns ? { returns } : {}, + ...opts?.entities && opts.entities.length > 0 ? { entities: opts.entities } : {} + }; +} +var CONTRACT_BRAND; var init_activity_contract = __esm({ "node_modules/@intentius/chant/src/op/activity-contract.ts"() { + init_types5(); + init_activity_profiles(); + CONTRACT_BRAND = /* @__PURE__ */ Symbol.for("chant.op.activityContract"); } }); @@ -234127,6 +240335,14 @@ var init_step_output_ref = __esm({ } }); +// node_modules/@intentius/chant/src/op/cron.ts +var MAX_SCAN_MINUTES; +var init_cron = __esm({ + "node_modules/@intentius/chant/src/op/cron.ts"() { + MAX_SCAN_MINUTES = 2 * 24 * 60; + } +}); + // node_modules/@intentius/chant/src/op/builders.ts var init_builders = __esm({ "node_modules/@intentius/chant/src/op/builders.ts"() { @@ -234134,6 +240350,7 @@ var init_builders = __esm({ init_effect_receipt(); init_receipt_store(); init_step_output_ref(); + init_cron(); } }); @@ -234143,6 +240360,105 @@ var init_emulator_freshness = __esm({ } }); +// 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"() { + init_builders(); + init_receipt_store(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/reconcile-op.ts +var init_reconcile_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/reconcile-op.ts"() { + init_builders(); + } +}); + +// node_modules/@intentius/chant/src/op/gate-name.ts +var init_gate_name = __esm({ + "node_modules/@intentius/chant/src/op/gate-name.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/activities/apply.ts +import { exec as exec4 } from "node:child_process"; +import { promisify as promisify5 } from "node:util"; +var execAsync3; +var init_apply2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/apply.ts"() { + init_apply(); + execAsync3 = promisify5(exec4); + } +}); + +// node_modules/@intentius/chant/src/op/composites/apply-op.ts +var init_apply_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/apply-op.ts"() { + init_builders(); + init_step_output_ref(); + init_gate_name(); + init_apply2(); + } +}); + +// node_modules/@intentius/chant/src/op/converge-rule.ts +var init_converge_rule = __esm({ + "node_modules/@intentius/chant/src/op/converge-rule.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/composites/converge-op.ts +var init_converge_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/converge-op.ts"() { + init_builders(); + init_converge_rule(); + init_symptoms(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/workflow-audit-op.ts +var init_workflow_audit_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/workflow-audit-op.ts"() { + init_builders(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/pipeline-audit-op.ts +var init_pipeline_audit_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/pipeline-audit-op.ts"() { + init_builders(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/lexicon-upgrade-op.ts +var init_lexicon_upgrade_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/lexicon-upgrade-op.ts"() { + init_builders(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/behaviour-op.ts +var init_behaviour_op = __esm({ + "node_modules/@intentius/chant/src/op/composites/behaviour-op.ts"() { + init_builders(); + } +}); + +// node_modules/@intentius/chant/src/op/composites/index.ts +var init_composites = __esm({ + "node_modules/@intentius/chant/src/op/composites/index.ts"() { + init_watch_op(); + init_reconcile_op(); + init_apply_op(); + init_converge_op(); + init_workflow_audit_op(); + init_pipeline_audit_op(); + init_lexicon_upgrade_op(); + init_behaviour_op(); + } +}); + // node_modules/@intentius/chant/src/op/discover.ts var init_discover2 = __esm({ "node_modules/@intentius/chant/src/op/discover.ts"() { @@ -234158,9 +240474,1298 @@ var init_generate_pipeline = __esm({ } }); +// node_modules/@intentius/chant/src/op/activities/build.ts +import { exec as exec5 } from "node:child_process"; +import { promisify as promisify6 } from "node:util"; +var execAsync4; +var init_build3 = __esm({ + "node_modules/@intentius/chant/src/op/activities/build.ts"() { + execAsync4 = promisify6(exec5); + } +}); + +// node_modules/@intentius/chant/src/op/activities/util.ts +var init_util2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/util.ts"() { + init_activity_runtime(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/wait.ts +import { exec as exec6 } from "node:child_process"; +import { promisify as promisify7 } from "node:util"; +var execAsync5; +var init_wait = __esm({ + "node_modules/@intentius/chant/src/op/activities/wait.ts"() { + init_util2(); + execAsync5 = promisify7(exec6); + } +}); + +// node_modules/@intentius/chant/src/op/activities/shell.ts +import { exec as exec7 } from "node:child_process"; +import { promisify as promisify8 } from "node:util"; +var execAsync6, MAX_STDOUT_BYTES; +var init_shell2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/shell.ts"() { + execAsync6 = promisify8(exec7); + MAX_STDOUT_BYTES = 64 * 1024 * 1024; + } +}); + +// node_modules/@intentius/chant/src/op/activities/http-check.ts +var init_http_check = __esm({ + "node_modules/@intentius/chant/src/op/activities/http-check.ts"() { + init_activity_runtime(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/lifecycle.ts +import { exec as exec8 } from "node:child_process"; +import { promisify as promisify9 } from "node:util"; +var execAsync7; +var init_lifecycle2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/lifecycle.ts"() { + init_plan_digest(); + execAsync7 = promisify9(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"; +var execAsync8; +var init_teardown2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/teardown.ts"() { + execAsync8 = promisify10(exec9); + } +}); + +// node_modules/@intentius/chant/src/op/activities/env-teardown.ts +var init_env_teardown = __esm({ + "node_modules/@intentius/chant/src/op/activities/env-teardown.ts"() { + init_config(); + init_env(); + init_live_endpoint(); + init_teardown(); + } +}); + +// 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"; +function reconcileBranchName(env2) { + const safe = env2.replace(/[^a-zA-Z0-9._-]+/g, "-"); + return `chant/reconcile-${safe}`; +} +function reconcileSummary(env2, entries) { + const lines = [ + `Reconcile from live environment \`${env2}\`.`, + "", + "This PR regenerates chant TypeScript from live state to close the gap between the cloud and source. It was triggered by the following change-set entries:", + "", + "| Entry | Action | Type |", + "|---|---|---|" + ]; + for (const e of entries) { + lines.push(`| ${e.name} | ${e.action} | ${e.type ?? ""} |`); + } + if (entries.length === 0) { + lines.push("| _(none)_ | | |"); + } + lines.push(""); + lines.push("Review the diff before merging \u2014 live import may surface values that need redaction."); + return lines.join("\n"); +} +function shellQuote(s) { + return `'${s.replace(/'/g, "'\\''")}'`; +} +function commentMarker(env2) { + return ``; +} +function issueMarker(op, env2) { + return ``; +} +function markerSlug(s) { + return s.replace(/[^a-zA-Z0-9._-]+/g, "-"); +} +function unsafeMarkerMessage(marker) { + return `reconcilePr was given the marker ${JSON.stringify(marker)}, which it cannot use. The marker goes into the \`--jq\` filter that finds this Op's own comment or issue, as \`startswith("")\`, so a double quote, a backslash or a control character in it either breaks that filter or changes what it matches. Markers this activity builds itself are slugified to letters, digits, dot, underscore and hyphen and cannot contain any of the three. Keep a supplied marker to printable text without \`"\` or \`\\\`, or drop \`marker\` and pass \`op\` instead.`; +} +function suppliedMarker(marker) { + const trimmed = marker?.trim(); + if (!trimmed) return void 0; + if (/["\\]|[\u0000-\u001f\u007f]/.test(trimmed)) throw new Error(unsafeMarkerMessage(trimmed)); + return trimmed; +} +function noIssueIdentityMessage(env2) { + return `reconcilePr mode "issue" edits the one OPEN issue carrying this Op's hidden marker in place, so the marker has to name the Op. This step supplies env "${env2}" and no identity, and an env alone is not unique: two Ops over one env \u2014 a stock terraform drift watch and a live one over the same root, or a terraform root and a chant environment that happen to share a name \u2014 resolve to the same marker, and each run then rewrites the other's issue title and body. Pass \`op\` with the Op's own name (every composite in tree does), or pass an explicit \`marker\` you keep unique yourself.`; +} +function noPullRequestContextMessage() { + return 'reconcilePr mode "comment" posts the finding on the pull request or merge request that triggered the run, and this run has none. On GitHub Actions it needs GITHUB_REPOSITORY plus a pull request number, read from the event payload at GITHUB_EVENT_PATH (`.number` / `.pull_request.number`) or from GITHUB_REF (`refs/pull//merge`), which a pull_request event sets and nothing else does. On GitLab CI it needs CI_MERGE_REQUEST_IID plus the project (CI_MERGE_REQUEST_PROJECT_ID or CI_PROJECT_ID) and the API base (CI_API_V4_URL, or CI_SERVER_URL to derive it), which a merge_request_event pipeline sets and nothing else does. Trigger this Op from a pull_request or merge_request pipeline, or give it findingMode "issue" or "report".'; +} +function prNumberFromPayload(payload) { + if (typeof payload !== "object" || payload === null) return void 0; + const p = payload; + if (typeof p.number === "number") return p.number; + if (typeof p.pull_request?.number === "number") return p.pull_request.number; + return void 0; +} +function pullRequestContextFrom(env2, eventPayload) { + const repo = env2.GITHUB_REPOSITORY; + if (!repo) return void 0; + const fromRef = /^refs\/pull\/(\d+)\//.exec(env2.GITHUB_REF ?? "")?.[1]; + const number4 = prNumberFromPayload(eventPayload) ?? (fromRef ? Number(fromRef) : void 0); + if (number4 === void 0 || !Number.isInteger(number4) || number4 <= 0) return void 0; + return { repo, number: number4 }; +} +async function resolvePullRequestContext(env2 = process.env) { + let payload; + const eventPath = env2.GITHUB_EVENT_PATH; + if (eventPath) { + try { + payload = JSON.parse(await readFile3(eventPath, "utf8")); + } catch { + payload = void 0; + } + } + const ctx = pullRequestContextFrom(env2, payload); + if (!ctx) throw new Error(noPullRequestContextMessage()); + return ctx; +} +function githubApiBaseFrom(env2) { + return env2.GITHUB_API_URL?.trim().replace(/\/+$/, "") || "https://api.github.com"; +} +function commentTokenFrom(env2) { + for (const source of ["CHANT_FORGEJO_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"]) { + const value = env2[source]?.trim(); + if (value) return { value, source }; + } + return void 0; +} +function ghCredentialEnv(base, token) { + return { ...base, GH_TOKEN: token.value, GH_ENTERPRISE_TOKEN: token.value }; +} +function noCommentTokenMessage(repo, number4) { + return `reconcilePr mode "comment" has pull request ${repo}#${number4} to post its finding on and no token to post it with. GH_TOKEN or GITHUB_TOKEN, set from github.token, already covers this on a GitHub Actions or Forgejo Actions run \u2014 set CHANT_FORGEJO_TOKEN to post against a different instance than the one the job runs on. CHANT_FORGEJO_TOKEN is read first where the two must differ.`; +} +function noIssueTokenMessage(repo) { + return `reconcilePr mode "issue" has repository ${repo} to open or edit its finding in and no token to do it with. GH_TOKEN or GITHUB_TOKEN, set from github.token, already covers this on a GitHub Actions or Forgejo Actions run \u2014 set CHANT_FORGEJO_TOKEN to post against a different instance than the one the job runs on. CHANT_FORGEJO_TOKEN is read first where the two must differ.`; +} +async function postOrUpdateComment(ctx, marker, body, signal) { + const token = commentTokenFrom(process.env); + if (!token) throw new Error(noCommentTokenMessage(ctx.repo, ctx.number)); + const env2 = ghCredentialEnv(process.env, token); + const base = githubApiBaseFrom(process.env); + const listUrl = `${base}/repos/${ctx.repo}/issues/${ctx.number}/comments`; + const jq = `map(select(.body | startswith("${marker}"))) | .[0].id // empty`; + const { stdout: found } = await execAsync9( + `gh api ${shellQuote(listUrl)} --paginate --jq ${shellQuote(jq)}`, + { signal, env: env2 } + ); + const existing = found.split("\n").map((l) => l.trim()).find((l) => /^\d+$/.test(l)); + const field = `body=${marker} + +${body}`; + if (existing) { + const { stdout: stdout2 } = await execAsync9( + `gh api --method PATCH ${shellQuote(`${base}/repos/${ctx.repo}/issues/comments/${existing}`)} -f ${shellQuote(field)} --jq .html_url`, + { signal, env: env2 } + ); + return stdout2.trim(); + } + const { stdout } = await execAsync9( + `gh api --method POST ${shellQuote(listUrl)} -f ${shellQuote(field)} --jq .html_url`, + { signal, env: env2 } + ); + return stdout.trim(); +} +async function postOrUpdateGithubIssue(repo, marker, title, body, exec14) { + const token = commentTokenFrom(process.env); + if (!token) throw new Error(noIssueTokenMessage(repo)); + const env2 = ghCredentialEnv(process.env, token); + const base = githubApiBaseFrom(process.env); + const listUrl = `${base}/repos/${repo}/issues?state=open`; + const jq = `map(select((.pull_request == null) and ((.body // "") | startswith("${marker}")))) | .[0].number // empty`; + const { stdout: found } = await exec14( + `gh api ${shellQuote(listUrl)} --paginate --jq ${shellQuote(jq)}`, + { env: env2 } + ); + const existing = found.split("\n").map((l) => l.trim()).find((l) => /^\d+$/.test(l)); + const titleField = shellQuote(`title=${title}`); + const bodyField = shellQuote(`body=${marker} + +${body}`); + if (existing) { + const { stdout: stdout2 } = await exec14( + `gh api --method PATCH ${shellQuote(`${base}/repos/${repo}/issues/${existing}`)} -f ${titleField} -f ${bodyField} --jq .html_url`, + { env: env2 } + ); + return stdout2.trim(); + } + const { stdout } = await exec14( + `gh api --method POST ${shellQuote(`${base}/repos/${repo}/issues`)} -f ${titleField} -f ${bodyField} --jq .html_url`, + { env: env2 } + ); + return stdout.trim(); +} +function mergeRequestContextFrom(env2) { + const rawIid = env2.CI_MERGE_REQUEST_IID?.trim(); + if (!rawIid) return void 0; + const iid = Number(rawIid); + if (!Number.isInteger(iid) || iid <= 0) return void 0; + const server2 = env2.CI_SERVER_URL?.trim().replace(/\/+$/, ""); + const api = env2.CI_API_V4_URL?.trim().replace(/\/+$/, "") || (server2 ? `${server2}/api/v4` : ""); + if (!api) return void 0; + const project2 = env2.CI_MERGE_REQUEST_PROJECT_ID?.trim() || env2.CI_PROJECT_ID?.trim() || env2.CI_MERGE_REQUEST_PROJECT_PATH?.trim() || env2.CI_PROJECT_PATH?.trim() || ""; + if (!project2) return void 0; + const path = env2.CI_MERGE_REQUEST_PROJECT_PATH?.trim() || env2.CI_PROJECT_PATH?.trim(); + const webUrl = env2.CI_MERGE_REQUEST_PROJECT_URL?.trim() || env2.CI_PROJECT_URL?.trim(); + return { + api, + project: project2, + iid, + ...path ? { path } : {}, + ...webUrl ? { webUrl } : {} + }; +} +function gitlabProjectContextFrom(env2) { + const project2 = env2.CI_PROJECT_ID?.trim(); + if (!project2) return void 0; + const server2 = env2.CI_SERVER_URL?.trim().replace(/\/+$/, ""); + const api = env2.CI_API_V4_URL?.trim().replace(/\/+$/, "") || (server2 ? `${server2}/api/v4` : ""); + if (!api) return void 0; + const path = env2.CI_PROJECT_PATH?.trim(); + const webUrl = env2.CI_PROJECT_URL?.trim(); + return { + api, + project: project2, + ...path ? { path } : {}, + ...webUrl ? { webUrl } : {} + }; +} +function gitlabNoteTokenFrom(env2) { + for (const source of ["CHANT_GITLAB_TOKEN", "GITLAB_TOKEN"]) { + const value = env2[source]?.trim(); + if (value) return { header: "PRIVATE-TOKEN", value, source }; + } + const jobToken = env2.CI_JOB_TOKEN?.trim(); + if (jobToken) return { header: "JOB-TOKEN", value: jobToken, source: "CI_JOB_TOKEN" }; + return void 0; +} +function noGitlabNoteTokenMessage(iid) { + return `reconcilePr mode "comment" has merge request !${iid} to post its finding on and no token to post it with. Set a GITLAB_TOKEN CI/CD variable (masked, scope: api) on the project \u2014 a project access token is enough \u2014 or, on an instance whose job-token allowlist covers the notes API, make CI_JOB_TOKEN available to the job. CHANT_GITLAB_TOKEN is read first where the two must differ.`; +} +function noGitlabIssueTokenMessage(project2) { + return `reconcilePr mode "issue" wants to open or update an issue on GitLab project ${project2} and has no token to do it with. Set a GITLAB_TOKEN CI/CD variable (masked, scope: api) on the project \u2014 a project access token is enough \u2014 or, on an instance whose job-token allowlist covers the issues API, make CI_JOB_TOKEN available to the job. CHANT_GITLAB_TOKEN is read first where the two must differ.`; +} +function notesEndpoint(ctx) { + return `${ctx.api}/projects/${encodeURIComponent(ctx.project)}/merge_requests/${ctx.iid}/notes`; +} +async function gitlabRequest(url2, token, init, signal) { + const res = await fetch(url2, { + ...init, + ...signal ? { signal } : {}, + headers: { [token.header]: token.value, "content-type": "application/json" } + }); + if (!res.ok) { + const detail = (await res.text().catch(() => "")).slice(0, 500); + throw new Error( + `GitLab API ${init.method ?? "GET"} ${url2} answered ${res.status}${detail ? `: ${detail}` : ""} (token from ${token.source}, sent as ${token.header}).` + ); + } + return res; +} +async function findOwnedNote(ctx, token, marker, signal) { + const endpoint = notesEndpoint(ctx); + const MAX_PAGES = 50; + for (let page = 1; page <= MAX_PAGES; page++) { + const res = await gitlabRequest(`${endpoint}?per_page=100&page=${page}`, token, { method: "GET" }, signal); + const notes = await res.json(); + const owned = notes.find((note) => !note.system && (note.body ?? "").startsWith(marker)); + if (owned) return owned.id; + const next = res.headers.get("x-next-page")?.trim(); + if (!next) return void 0; + } + return void 0; +} +async function postOrUpdateNote(ctx, token, marker, body, signal) { + const endpoint = notesEndpoint(ctx); + const existing = await findOwnedNote(ctx, token, marker, signal); + const payload = JSON.stringify({ body: `${marker} + +${body}` }); + const res = existing ? await gitlabRequest(`${endpoint}/${existing}`, token, { method: "PUT", body: payload }, signal) : await gitlabRequest(endpoint, token, { method: "POST", body: payload }, signal); + const note = await res.json(); + return ctx.webUrl ? `${ctx.webUrl}/-/merge_requests/${ctx.iid}#note_${note.id}` : `${endpoint}/${note.id}`; +} +function issuesEndpoint(ctx) { + return `${ctx.api}/projects/${encodeURIComponent(ctx.project)}/issues`; +} +async function findOwnedIssue(ctx, token, marker, signal) { + const endpoint = issuesEndpoint(ctx); + const MAX_PAGES = 50; + for (let page = 1; page <= MAX_PAGES; page++) { + const res = await gitlabRequest( + `${endpoint}?per_page=100&page=${page}&search=${encodeURIComponent(marker)}&in=description`, + token, + { method: "GET" }, + signal + ); + const issues = await res.json(); + const owned = issues.find((issue2) => (issue2.description ?? "").startsWith(marker)); + if (owned) return owned.iid; + const next = res.headers.get("x-next-page")?.trim(); + if (!next) return void 0; + } + return void 0; +} +async function postOrUpdateIssue(ctx, token, marker, title, body, signal) { + const endpoint = issuesEndpoint(ctx); + const existing = await findOwnedIssue(ctx, token, marker, signal); + const payload = JSON.stringify({ title, description: `${marker} + +${body}` }); + const res = existing ? await gitlabRequest(`${endpoint}/${existing}`, token, { method: "PUT", body: payload }, signal) : await gitlabRequest(endpoint, token, { method: "POST", body: payload }, signal); + const issue2 = await res.json(); + return ctx.webUrl ? `${ctx.webUrl}/-/issues/${issue2.iid}` : `${endpoint}/${issue2.iid}`; +} +function entriesFromPlan(planJson) { + const cs = JSON.parse(planJson); + return (cs.entries ?? []).filter((e) => e.action !== "noop").map((e) => ({ name: e.name, action: e.action, type: e.type })); +} +async function derivePlanEntries(env2, owned, signal) { + const ownedFlag = owned ? " --owned" : ""; + const { stdout } = await execAsync9( + `chant lifecycle plan ${shellQuote(env2)}${ownedFlag} --json`, + { signal } + ); + return entriesFromPlan(stdout); +} +function resolveMarker(mode, args) { + if (mode === "issue") { + const supplied = suppliedMarker(args.marker); + const op = args.op?.trim(); + if (!supplied && !op) throw new Error(noIssueIdentityMessage(args.env)); + return supplied ?? issueMarker(op, args.env); + } + if (mode === "comment") { + return suppliedMarker(args.marker) ?? commentMarker(args.env); + } + return void 0; +} +async function reconcilePr(args, signal) { + const mode = args.mode ?? "pull-request"; + const owned = args.owned ?? false; + const resolvedMarker = resolveMarker(mode, args); + const entries = args.entries ?? (args.body !== void 0 ? [] : await derivePlanEntries(args.env, owned, signal)); + const summary = args.body ?? reconcileSummary(args.env, entries); + const title = args.title ?? `Reconcile ${args.env}: ${entries.length} change(s) from live`; + if (mode === "report") { + return { mode, summary, entries }; + } + if (mode === "issue") { + const marker = resolvedMarker; + const project2 = gitlabProjectContextFrom(process.env); + if (project2) { + const token = gitlabNoteTokenFrom(process.env); + if (!token) throw new Error(noGitlabIssueTokenMessage(project2.project)); + const issueUrl = await postOrUpdateIssue(project2, token, marker, title, summary, signal); + return { mode, summary, entries, issueUrl }; + } + const repo = process.env.GITHUB_REPOSITORY; + if (repo) { + const issueUrl = await postOrUpdateGithubIssue( + repo, + marker, + title, + summary, + (cmd, opts) => execAsync9(cmd, { signal, ...opts }) + ); + return { mode, summary, entries, issueUrl }; + } + const { stdout: stdout2 } = await execAsync9( + `gh issue create --title ${shellQuote(title)} --body ${shellQuote(`${marker} + +${summary}`)}`, + { signal } + ); + return { mode, summary, entries, issueUrl: stdout2.trim() }; + } + if (mode === "comment") { + const marker = resolvedMarker; + const mr = mergeRequestContextFrom(process.env); + if (mr) { + const token = gitlabNoteTokenFrom(process.env); + if (!token) throw new Error(noGitlabNoteTokenMessage(mr.iid)); + const commentUrl2 = await postOrUpdateNote(mr, token, marker, summary, signal); + return { + mode, + summary, + entries, + commentUrl: commentUrl2, + mergeRequest: `${mr.path ?? mr.project}!${mr.iid}` + }; + } + const ctx = await resolvePullRequestContext(); + const commentUrl = await postOrUpdateComment(ctx, marker, summary, signal); + return { mode, summary, entries, commentUrl, pullRequest: `${ctx.repo}#${ctx.number}` }; + } + const branch = args.branch ?? reconcileBranchName(args.env); + const output = args.output ?? "./infra"; + const ownedFlag = owned ? " --owned" : ""; + await execAsync9(`git checkout -b ${shellQuote(branch)}`, { signal }); + await execAsync9( + `chant import --from ${shellQuote(args.env)}${ownedFlag} --output ${shellQuote(output)} --force`, + { signal } + ); + await execAsync9(`git add ${shellQuote(output)}`, { signal }); + await execAsync9(`git commit -m ${shellQuote(title)}`, { signal }); + await execAsync9(`git push -u origin ${shellQuote(branch)}`, { signal }); + const { stdout } = await execAsync9( + `gh pr create --title ${shellQuote(title)} --body ${shellQuote(summary)} --head ${shellQuote(branch)}`, + { signal } + ); + return { mode, branch, summary, entries, prUrl: stdout.trim() }; +} +var execAsync9; +var init_reconcile2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/reconcile.ts"() { + execAsync9 = promisify11(exec10); + } +}); + +// node_modules/@intentius/chant/src/op/activity-failure.ts +var init_activity_failure = __esm({ + "node_modules/@intentius/chant/src/op/activity-failure.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/activities/policy.ts +var init_policy2 = __esm({ + "node_modules/@intentius/chant/src/op/activities/policy.ts"() { + init_activity_failure(); + init_policy(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/guard-validate.ts +var init_guard_validate = __esm({ + "node_modules/@intentius/chant/src/op/activities/guard-validate.ts"() { + init_activity_failure(); + } +}); + +// 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"() { + } +}); + +// node_modules/@intentius/chant/src/op/activities/pipeline-audit.ts +var init_pipeline_audit = __esm({ + "node_modules/@intentius/chant/src/op/activities/pipeline-audit.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/op-verb-class.ts +var init_op_verb_class = __esm({ + "node_modules/@intentius/chant/src/op/op-verb-class.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_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"; +var execAsync10; +var init_converge = __esm({ + "node_modules/@intentius/chant/src/op/activities/converge.ts"() { + init_converge_rule(); + init_op_verb_class(); + init_discover2(); + init_symptoms(); + init_converge_ledger(); + init_gate_ledger(); + init_git(); + execAsync10 = promisify12(exec11); + } +}); + +// node_modules/@intentius/chant/src/codegen/version-bump.ts +var init_version_bump = __esm({ + "node_modules/@intentius/chant/src/codegen/version-bump.ts"() { + } +}); + +// 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"; +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); + } +}); + +// node_modules/@intentius/chant/src/behaviour-request.ts +function readPath(props, path) { + let cursor = props; + for (const segment of path.split(".")) { + if (typeof cursor !== "object" || cursor === null) return void 0; + cursor = cursor[segment]; + } + return cursor; +} +function sizeOf(props, sizeProp, sizeType) { + if (!sizeProp) return void 0; + const raw = readPath(props, sizeProp); + if (sizeType === "number") { + return typeof raw === "number" && Number.isFinite(raw) ? String(raw) : void 0; + } + return isLiteral(raw) ? raw : void 0; +} +function isLiteral(raw) { + return typeof raw === "string" && raw.length > 0 && !raw.includes("${"); +} +function buildEngineRequest(options, kinds) { + const nodes = []; + const withheld = []; + for (const name of [...options.entityNames].sort(byCodeUnit)) { + const declared = options.entities.get(name); + if (!declared) { + withheld.push({ + name, + entityType: "(undeclared)", + status: "unknown-type", + detail: `${name} was named in entityNames and is not in the entities map, so this lexicon has nothing to translate. It is reported rather than dropped: an entity that vanished between the build and the request is a defect in the caller, and a silent omission hides it behind an estate that looks smaller.` + }); + continue; + } + const verdict = coverageFor(kinds, declared.entityType, declared.props); + const owner = ownerOf(kinds, declared.entityType); + const resolved = owner?.resolveType?.(declared.entityType, declared.props); + const resourceType = resolved && resolved !== declared.entityType ? resolved : void 0; + if (verdict.status !== "mapped") { + withheld.push({ + name, + entityType: declared.entityType, + ...resourceType ? { resourceType } : {}, + status: verdict.status, + detail: unmappedDetail( + coverageLabel(kinds, declared.entityType, declared.props), + verdict, + owner + ) + }); + continue; + } + const { mapping } = verdict; + const declaredRegion = mapping.regionProp ? readPath(declared.props, mapping.regionProp) : void 0; + const region = isLiteral(declaredRegion) ? declaredRegion : options.region; + const size = sizeOf(declared.props, mapping.sizeProp, mapping.sizeType); + nodes.push({ + name, + entityType: declared.entityType, + ...resourceType ? { resourceType } : {}, + kind: mapping.kind, + provider: mapping.provider, + ...region ? { region } : {}, + ...size ? { size } : {} + }); + } + const edges = options.edges.map((edge) => ({ + from: edge.from, + to: edge.to, + ...edge.viaAttr ? { via: edge.viaAttr } : {}, + ...edge.toAttr ? { toAttr: edge.toAttr } : {} + })).sort( + (a, b) => byCodeUnit(a.from, b.from) || byCodeUnit(a.to, b.to) || byCodeUnit(a.via ?? "", b.via ?? "") || byCodeUnit(a.toAttr ?? "", b.toAttr ?? "") + ); + return { + request: BEHAVIOUR_REQUEST_VERSION, + traffic: options.traffic, + ...options.region ? { region: options.region } : {}, + nodes, + edges, + coverage: options.edgeCoverage, + withheld + }; +} +function renderEngineRequest(request) { + return `${JSON.stringify(canonical(request), null, 2)} +`; +} +function canonical(value) { + if (Array.isArray(value)) return value.map(canonical); + if (typeof value === "object" && value !== null) { + const out = {}; + for (const key of Object.keys(value).sort()) { + const inner2 = value[key]; + if (inner2 === void 0) continue; + out[key] = canonical(inner2); + } + return out; + } + return value; +} +var BEHAVIOUR_REQUEST_VERSION; +var init_behaviour_request = __esm({ + "node_modules/@intentius/chant/src/behaviour-request.ts"() { + init_behaviour_kinds(); + BEHAVIOUR_REQUEST_VERSION = "behaviour/v1"; + } +}); + +// node_modules/@intentius/chant/src/behaviour-engine.ts +import { execFile as execFile2 } from "node:child_process"; +function transportEngine(transport, endpoint) { + return { + async predict(request) { + const sent = await transport.send(renderEngineRequest(request)); + if (!sent.ok) return { ok: false, refusal: sent.refusal }; + const parsed = parseEngineAnswer(sent.body); + if (!parsed.ok) { + const said = causeFromEngineWords(sent.body); + if (said) { + return { + ok: false, + refusal: behaviourWireRefusal(BEHAVIOUR_SCOPE, endpoint, said, `the engine answered ${firstLine2(sent.body)}`) + }; + } + return { ok: false, refusal: unreachableBehaviourEngineRefusal(BEHAVIOUR_SCOPE, endpoint, parsed.detail) }; + } + return { ok: true, answer: parsed.answer }; + } + }; +} +function commandTransport(endpoint) { + const [program, ...args] = endpoint.value.trim().split(/\s+/); + return { + async send(body) { + const raw = await new Promise( + (resolve9) => { + const child = execFile2( + program, + args, + { + timeout: COMMAND_TIMEOUT_MS, + maxBuffer: COMMAND_MAX_BUFFER, + // Not `process.env`. The contract's rule, and its reason, are on + // `behaviourEngineChildEnvironment`; the test below pins it. + env: behaviourEngineChildEnvironment() + }, + (error51, stdout, stderr) => { + resolve9({ stdout: String(stdout), stderr: String(stderr), ...error51 ? { error: error51 } : {} }); + } + ); + child.stdin?.end(body); + } + ); + if (raw.error) { + return { + ok: false, + refusal: behaviourWireRefusal( + BEHAVIOUR_SCOPE, + endpoint, + causeFromEngineWords(raw.stderr) ?? "engine-unreachable", + firstLine2(raw.stderr) || raw.error.message + ) + }; + } + return { ok: true, body: raw.stdout }; + } + }; +} +function commandEngine(endpoint) { + return transportEngine(commandTransport(endpoint), endpoint); +} +function causeFromEngineWords(said) { + const text = said.toLowerCase(); + if (/\b(out of credit|insufficient (funds|balance)|no balance|payment required)\b/.test(text)) { + return "engine-out-of-credit"; + } + if (/\b(over quota|quota exceeded|rate limit|too many requests|throttl)/.test(text)) { + return "engine-over-quota"; + } + return void 0; +} +function firstLine2(text) { + return text.split("\n").find((line) => line.trim().length > 0)?.trim() ?? ""; +} +function figureProblems(name, figure) { + const at = (field) => `figures.${name}.${field}`; + if (typeof figure !== "object" || figure === null || Array.isArray(figure)) { + return [`${at("")} is ${Array.isArray(figure) ? "an array" : typeof figure}, not an object`]; + } + const f = figure; + const out = []; + const fraction = (field, value) => { + if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) { + out.push(`${at(field)} is not a number in 0..1`); + } + }; + if (typeof f.perHour !== "number" || !Number.isFinite(f.perHour) || f.perHour < 0) { + out.push(`${at("perHour")} is not a non-negative finite number`); + } + if (typeof f.currency !== "string" || f.currency.trim().length === 0) { + out.push(`${at("currency")} is empty`); + } + fraction("errorRate", f.errorRate); + const headroom = f.headroom; + if (typeof headroom !== "object" || headroom === null || Array.isArray(headroom)) { + out.push(`${at("headroom")} is missing`); + } else { + const h = headroom; + if (h.cpu === void 0 && h.latency === void 0) { + out.push(`${at("headroom")} carries neither cpu nor latency`); + } + for (const axis of ["cpu", "latency"]) { + if (h[axis] !== void 0) fraction(`headroom.${axis}`, h[axis]); + } + } + const resilience = f.resilience; + if (typeof resilience !== "object" || resilience === null || Array.isArray(resilience)) { + out.push(`${at("resilience")} is missing`); + } else { + const r = resilience; + if (typeof r.failure !== "string" || r.failure.trim().length === 0) { + out.push(`${at("resilience.failure")} names no failure`); + } + if (!isResilienceVerdict(r.verdict)) { + out.push(`${at("resilience.verdict")} is not survives/degrades/fails`); + } + if (r.note !== void 0 && typeof r.note !== "string") { + out.push(`${at("resilience.note")} is not a string`); + } + } + const rightSize = f.rightSize; + if (rightSize !== void 0) { + if (typeof rightSize !== "object" || rightSize === null || Array.isArray(rightSize)) { + out.push(`${at("rightSize")} is not an object`); + } else if (typeof rightSize.suggestion !== "string") { + out.push(`${at("rightSize.suggestion")} is missing`); + } + } + return out; +} +function malformed(detail) { + return { ok: false, detail }; +} +function parseEngineAnswer(text) { + let parsed; + try { + parsed = JSON.parse(text); + } catch { + return malformed(`the engine wrote ${text.length} byte(s) that are not JSON`); + } + if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) { + return malformed("the engine's answer is not an object"); + } + const answer = parsed; + const missing = ["engine", "version", "tolerance"].filter( + (key) => typeof answer[key] !== "string" || answer[key].trim().length === 0 + ); + if (missing.length > 0) { + return malformed( + `the engine's answer states no ${missing.join(", ")}. Every figure carries provenance, so an answer that cannot say who produced it is not a usable answer` + ); + } + if (!isBehaviourBasis(answer.basis)) { + return malformed( + `the engine's answer states a basis of ${JSON.stringify(answer.basis)}, which is not modeled or validated` + ); + } + if (typeof answer.figures !== "object" || answer.figures === null || Array.isArray(answer.figures)) { + return malformed("the engine's answer carries no figures map"); + } + if (answer.total !== void 0) { + const total = answer.total; + if (typeof total !== "object" || total === null || typeof total.perHour !== "number" || !Number.isFinite(total.perHour) || total.perHour < 0 || typeof total.currency !== "string" || total.currency.trim().length === 0) { + return malformed("the engine's answer states a total that is not a non-negative rate in a named currency"); + } + } + if (answer.declined !== void 0) { + const declined = answer.declined; + if (typeof declined !== "object" || declined === null || Array.isArray(declined)) { + return malformed("the engine's answer carries a declined list that is not a map"); + } + for (const [name, reason] of Object.entries(declined)) { + if (typeof reason !== "string") { + return malformed(`the engine declined ${name} with a reason that is not a string`); + } + } + } + const problems = []; + for (const [name, figure] of Object.entries(answer.figures)) { + problems.push(...figureProblems(name, figure)); + if (problems.length >= 5) break; + } + if (problems.length > 0) { + return malformed( + `the engine's answer is malformed: ${problems.slice(0, 5).join("; ")}` + (problems.length >= 5 ? " (and possibly more)" : "") + ); + } + return { ok: true, answer }; +} +function connectWith(deps = {}) { + return (endpoint, env2) => { + const address = endpoint.value.trim(); + if (address.length === 0) return void 0; + if (isHttpBehaviourAddress(address)) { + return transportEngine(httpBehaviourTransport(BEHAVIOUR_SCOPE, endpoint, env2, deps), endpoint); + } + if (/^[a-z][a-z0-9+.-]*:\/\//i.test(address)) return void 0; + return commandEngine(endpoint); + }; +} +var BEHAVIOUR_SCOPE, COMMAND_TIMEOUT_MS, COMMAND_MAX_BUFFER, defaultConnect; +var init_behaviour_engine = __esm({ + "node_modules/@intentius/chant/src/behaviour-engine.ts"() { + init_behaviour(); + init_behaviour_http(); + init_behaviour_request(); + BEHAVIOUR_SCOPE = "chant"; + COMMAND_TIMEOUT_MS = 3e4; + COMMAND_MAX_BUFFER = 8 * 1024 * 1024; + defaultConnect = connectWith(); + } +}); + +// node_modules/@intentius/chant/src/behaviour-predict.ts +function createBehaviourPredict(deps = {}) { + const env2 = deps.env ?? process.env; + const kinds = deps.kinds ?? []; + const connect = deps.connect ?? defaultConnect; + return async function predictBehaviour2(options) { + const unsafe = screenBehaviourRequest(BEHAVIOUR_SCOPE, options); + if (unsafe) return unsafe; + const endpoint = behaviourEngineFrom(BEHAVIOUR_SCOPE, env2); + if (!endpoint) return noBehaviourEngineRefusal(BEHAVIOUR_SCOPE); + const engine = connect(endpoint, env2); + if (!engine) { + return unreachableBehaviourEngineRefusal( + BEHAVIOUR_SCOPE, + endpoint, + "no transport speaks that address \u2014 a http(s) URL is dialled with a bearer token, and a bare address is run as a command on PATH; any other scheme has no transport yet" + ); + } + const request = buildEngineRequest(options, kinds); + const outcome = await engine.predict(request); + if (!outcome.ok) return outcome.refusal; + const { answer } = outcome; + const entities = /* @__PURE__ */ Object.create(null); + const unpredicted = /* @__PURE__ */ Object.create(null); + for (const held of request.withheld) { + unpredicted[held.name] = { + ...held.entityType === "(undeclared)" ? {} : { type: held.entityType }, + reason: "unsupported-kind", + detail: held.detail + }; + } + for (const node of request.nodes) { + const declined = has2(answer.declined, node.name) ? answer.declined[node.name] : void 0; + if (declined !== void 0) { + unpredicted[node.name] = { + type: node.entityType, + reason: "read-failed", + detail: `${answer.engine} was sent ${node.name} as a ${node.kind} and declined it: ${declined}` + }; + continue; + } + const figure = has2(answer.figures, node.name) ? answer.figures[node.name] : void 0; + if (figure === void 0) { + unpredicted[node.name] = { + type: node.entityType, + reason: "read-failed", + detail: `${answer.engine} was sent ${node.name} and its answer names it in neither its figures nor its declined list. An engine that loses a node is reported, not rendered as an estate one node smaller.` + }; + continue; + } + entities[node.name] = block(options.traffic, figure, answer); + } + return behaviourReport( + options, + { + engine: answer.engine, + version: answer.version, + ...answer.total ? { total: predictedRate(answer.total.perHour, answer.total.currency) } : {} + }, + entities, + unpredicted + ); + }; +} +function has2(map2, key) { + return map2 !== void 0 && Object.prototype.hasOwnProperty.call(map2, key); +} +function block(traffic, figure, answer) { + const cpu = figure.headroom?.cpu; + const latency = figure.headroom?.latency; + const headroom = cpu !== void 0 ? { cpu, ...latency !== void 0 ? { latency } : {} } : { latency }; + if (cpu === void 0 && latency === void 0) { + throw new Error( + `predictBehaviour: the engine's figure for this entity carries neither a cpu nor a latency headroom axis, and parseEngineAnswer should have refused it.` + ); + } + return { + at: { traffic }, + cost: predictedRate(figure.perHour, figure.currency), + headroom, + errorRate: figure.errorRate, + resilience: { + failure: figure.resilience.failure, + verdict: figure.resilience.verdict, + ...figure.resilience.note ? { note: figure.resilience.note } : {} + }, + ...figure.rightSize ? { rightSize: figure.rightSize } : {}, + provenance: { + engine: answer.engine, + version: answer.version, + tolerance: answer.tolerance, + basis: answer.basis + } + }; +} +var init_behaviour_predict = __esm({ + "node_modules/@intentius/chant/src/behaviour-predict.ts"() { + init_behaviour(); + init_behaviour_request(); + init_behaviour_engine(); + } +}); + +// 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"; +function shellQuote2(s) { + return `'${s.replace(/'/g, "'\\''")}'`; +} +function declaredEdgeCoverage() { + return { verdict: "unknown" }; +} +async function predictDeclared(projectPath, args) { + const { loadChantConfigUpward: loadChantConfigUpward2 } = await Promise.resolve().then(() => (init_config(), config_exports)); + const { loadPlugins: loadPlugins2, resolveProjectLexicons: resolveProjectLexicons2 } = await Promise.resolve().then(() => (init_plugins(), plugins_exports)); + const { build: build4 } = await Promise.resolve().then(() => (init_build(), build_exports)); + const { buildGraphIr: buildGraphIr2 } = await Promise.resolve().then(() => (init_graph_ir(), graph_ir_exports)); + const { config: config2 } = await loadChantConfigUpward2(projectPath); + 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 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)); + throw new Error(`predictBehaviour: the project under ${projectPath} did not build: ${messages.join("; ")}`); + } + const entities = /* @__PURE__ */ new Map(); + for (const [name, entity] of result.entities) { + const declarable = entity; + if (typeof declarable.entityType !== "string") continue; + entities.set(name, { + entityType: declarable.entityType, + props: declarable.props != null ? declarable.props : {} + }); + } + const edges = buildGraphIr2(result.entities, sourceDir).edges; + const raw = [...result.outputs.values()][0]; + const buildOutput = raw === void 0 ? "" : typeof raw === "string" ? raw : raw.primary; + const options = { + environment: args.environment, + buildOutput, + entityNames: [...entities.keys()], + entities, + ...args.stack ? { stack: args.stack } : {}, + ...args.region ? { region: args.region } : {}, + ...args.owned !== void 0 ? { owned: args.owned } : {}, + traffic: args.traffic, + edges, + edgeCoverage: declaredEdgeCoverage() + }; + const answer = await createBehaviourPredict({ kinds })(options); + return validateBehaviourResult(answer, options.entityNames); +} +function behaviourFindingMarker(op, env2) { + return ``; +} +function noBaseRefMessage() { + return "behaviourFinding predicts the pull request's declared estate against its base branch's, and this run names no base branch. On GitHub Actions and Forgejo Actions a pull_request event sets GITHUB_BASE_REF; on GitLab CI a merge_request_event pipeline sets CI_MERGE_REQUEST_TARGET_BRANCH_NAME. Trigger the Op from one of those, or pass `base` with the branch name."; +} +function baseRefFrom(env2, explicit) { + const fromArgs = explicit?.trim(); + if (fromArgs) return fromArgs; + for (const source of ["GITHUB_BASE_REF", "CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]) { + const value = env2[source]?.trim(); + if (value) return value; + } + return void 0; +} +function headRefFrom(env2, shortSha) { + for (const source of ["GITHUB_HEAD_REF", "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"]) { + const value = env2[source]?.trim(); + if (value) return value; + } + return shortSha?.trim() || "head"; +} +async function checkoutBase(base, signal) { + const { stdout: rootOut } = await execAsync12("git rev-parse --show-toplevel", { signal }); + const { stdout: prefixOut } = await execAsync12("git rev-parse --show-prefix", { signal }); + const root = rootOut.trim(); + const prefix = prefixOut.trim(); + let commitish = "FETCH_HEAD"; + try { + await execAsync12(`git fetch --depth=1 origin ${shellQuote2(base)}`, { signal }); + } catch { + commitish = base; + } + const dir = await mkdtemp(join13(root, ".chant-behaviour-base-")); + try { + await execAsync12(`git worktree add --detach ${shellQuote2(dir)} ${shellQuote2(commitish)}`, { signal }); + } catch (err) { + await rm(dir, { recursive: true, force: true }); + throw new Error( + `behaviourFinding could not check out base branch ${JSON.stringify(base)}: ${err.message}` + ); + } + return { + projectPath: prefix ? join13(dir, prefix) : dir, + async cleanup() { + try { + await execAsync12(`git worktree remove --force ${shellQuote2(dir)}`); + } catch { + await rm(dir, { recursive: true, force: true }); + } + } + }; +} +async function defaultShortSha() { + try { + const { stdout } = await execAsync12("git rev-parse --short HEAD"); + return stdout.trim(); + } catch { + return void 0; + } +} +function createBehaviourFinding(deps = {}) { + const predict = deps.predict ?? predictDeclared; + const checkout = deps.checkout ?? checkoutBase; + const post = deps.post ?? reconcilePr; + const env2 = deps.env ?? process.env; + const shortSha = deps.shortSha ?? defaultShortSha; + return async function behaviourFinding2(args, signal) { + const mode = args.mode ?? "comment"; + if (typeof args.op !== "string" || args.op.trim() === "") { + throw new Error( + "behaviourFinding needs `op`, the name of the Op this step belongs to: it keys the comment's marker together with `environment`, and an env alone is not unique across Ops (#2319)." + ); + } + const base = baseRefFrom(env2, args.base); + if (!base) throw new Error(noBaseRefMessage()); + const head = headRefFrom(env2, await shortSha()); + const predictArgs = { + environment: args.environment, + traffic: args.traffic, + ...args.stack ? { stack: args.stack } : {}, + ...args.region ? { region: args.region } : {}, + ...args.owned !== void 0 ? { owned: args.owned } : {} + }; + const headResult = await predict(resolve7("."), predictArgs); + const baseCheckout = await checkout(base, signal); + let baseResult; + try { + baseResult = await predict(baseCheckout.projectPath, predictArgs); + } finally { + await baseCheckout.cleanup(); + } + const finding = behaviourDelta( + { label: "base", ref: base, result: baseResult }, + { label: "head", ref: head, result: headResult } + ); + const summary = renderBehaviourFinding(finding, { env: args.environment, op: args.op }); + const refused = isBehaviourRefusalReport(baseResult) || isBehaviourRefusalReport(headResult); + const result = { mode, base, head, finding, refused, summary }; + if (mode === "report") return result; + const posted = await post( + { + env: args.environment, + op: args.op, + mode: "comment", + marker: suppliedMarker(behaviourFindingMarker(args.op, args.environment)), + body: summary, + title: args.title ?? `Predicted behaviour for ${args.environment} at ${args.traffic}` + }, + signal + ); + return { + ...result, + ...posted.commentUrl ? { commentUrl: posted.commentUrl } : {}, + ...posted.pullRequest ? { pullRequest: posted.pullRequest } : {}, + ...posted.mergeRequest ? { mergeRequest: posted.mergeRequest } : {} + }; + }; +} +var execAsync12, behaviourFinding; +var init_predict_behaviour = __esm({ + "node_modules/@intentius/chant/src/op/activities/predict-behaviour.ts"() { + init_behaviour(); + init_behaviour_delta(); + init_behaviour_predict(); + init_reconcile2(); + execAsync12 = promisify14(exec13); + behaviourFinding = createBehaviourFinding(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/index.ts +var init_activities = __esm({ + "node_modules/@intentius/chant/src/op/activities/index.ts"() { + init_build3(); + init_wait(); + init_shell2(); + init_http_check(); + init_lifecycle2(); + init_teardown2(); + init_env_teardown(); + init_reconcile2(); + init_apply2(); + init_policy2(); + init_guard_validate(); + init_workflow_audit(); + init_pipeline_audit(); + init_converge(); + init_lexicon_upgrade(); + init_predict_behaviour(); + } +}); + // node_modules/@intentius/chant/src/op/activity-registry.ts var init_activity_registry = __esm({ "node_modules/@intentius/chant/src/op/activity-registry.ts"() { + init_activities(); + init_activity_profiles(); + } +}); + +// node_modules/@intentius/chant/src/op/activities/activity-contracts.ts +var lifecycleSnapshotContract, lifecycleDiffContract, shellCmdContract, httpCheckContract, chantTeardownContract, predictBehaviourContract, behaviourFindingContract; +var init_activity_contracts = __esm({ + "node_modules/@intentius/chant/src/op/activities/activity-contracts.ts"() { + init_zod(); + init_activity_contract(); + lifecycleSnapshotContract = activityContract( + "lifecycleSnapshot", + external_exports.strictObject({ env: external_exports.string() }) + ); + lifecycleDiffContract = activityContract( + "lifecycleDiff", + external_exports.strictObject({ env: external_exports.string(), live: external_exports.boolean().optional() }), + external_exports.object({ output: external_exports.string(), exitCode: external_exports.number(), drifted: external_exports.boolean() }) + ); + shellCmdContract = activityContract( + "shellCmd", + external_exports.strictObject({ + 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() + }), + external_exports.object({ stdout: external_exports.string(), stderr: external_exports.string(), exitCode: external_exports.number() }) + ); + httpCheckContract = activityContract( + "httpCheck", + external_exports.strictObject({ + url: external_exports.string(), + method: external_exports.string().optional(), + status: external_exports.number().optional(), + contains: external_exports.string().optional(), + retries: external_exports.number().optional(), + intervalMs: external_exports.number().optional() + }), + external_exports.object({ status: external_exports.number() }), + // The check's effect is entity-scoped (#2022): `url` names the service the + // step probes, so op.json resolves it into the step's `entities` — the join + // a renderer draws to the estate node it targets. The scope-ish args + // (retries, interval) stay mechanics. + { entities: ["url"] } + ); + chantTeardownContract = activityContract( + "chantTeardown", + external_exports.strictObject({ path: external_exports.string() }) + ); + predictBehaviourContract = activityContract( + "predictBehaviour", + external_exports.strictObject({ + environment: external_exports.string(), + traffic: external_exports.string(), + stack: external_exports.string().optional(), + region: external_exports.string().optional(), + owned: external_exports.boolean().optional() + }), + external_exports.object({ behaviour: external_exports.literal("v1"), refusal: external_exports.unknown().optional() }) + ); + behaviourFindingContract = activityContract( + "behaviourFinding", + external_exports.strictObject({ + environment: external_exports.string(), + traffic: external_exports.string(), + op: external_exports.string(), + mode: external_exports.enum(["comment", "report"]).optional(), + base: external_exports.string().optional(), + title: external_exports.string().optional(), + stack: external_exports.string().optional(), + region: external_exports.string().optional(), + owned: external_exports.boolean().optional() + }), + external_exports.object({ + mode: external_exports.enum(["comment", "report"]), + base: external_exports.string(), + head: external_exports.string(), + refused: external_exports.boolean(), + summary: external_exports.string(), + commentUrl: external_exports.string().optional(), + pullRequest: external_exports.string().optional(), + mergeRequest: external_exports.string().optional() + }) + ); + } +}); + +// node_modules/@intentius/chant/src/op/activity-contract-registry.ts +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"() { + } +}); + +// node_modules/@intentius/chant/src/op/gate.ts +var EPOCH; +var init_gate = __esm({ + "node_modules/@intentius/chant/src/op/gate.ts"() { + init_gate_ledger(); + init_plan_digest(); + init_git(); + init_duration(); + EPOCH = (/* @__PURE__ */ new Date(0)).toISOString(); } }); @@ -234168,21 +241773,110 @@ var init_activity_registry = __esm({ var FALLBACK_TIMEOUT_MS; var init_local_executor = __esm({ "node_modules/@intentius/chant/src/op/local-executor.ts"() { + init_types5(); init_activity_registry(); init_step_output_ref(); + init_duration(); + init_gate(); + init_gate_name(); + init_run_ledger(); + init_duration(); FALLBACK_TIMEOUT_MS = 5 * 6e4; } }); -// node_modules/@intentius/chant/src/op/local-output.ts -var init_local_output = __esm({ - "node_modules/@intentius/chant/src/op/local-output.ts"() { +// node_modules/@intentius/chant/src/components/component.ts +var init_component = __esm({ + "node_modules/@intentius/chant/src/components/component.ts"() { } }); -// node_modules/@intentius/chant/src/op/converge-rule.ts -var init_converge_rule = __esm({ - "node_modules/@intentius/chant/src/op/converge-rule.ts"() { +// node_modules/@intentius/chant/src/components/discover.ts +var init_discover3 = __esm({ + "node_modules/@intentius/chant/src/components/discover.ts"() { + init_errors3(); + init_component(); + init_build_params(); + init_params(); + } +}); + +// node_modules/@intentius/chant/src/codegen/topo-sort.ts +var init_topo_sort = __esm({ + "node_modules/@intentius/chant/src/codegen/topo-sort.ts"() { + } +}); + +// 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(); + } +}); + +// node_modules/@intentius/chant/src/components/capability-plugin-loader.ts +var init_capability_plugin_loader = __esm({ + "node_modules/@intentius/chant/src/components/capability-plugin-loader.ts"() { + init_capability(); + init_capability_plugin(); + init_starter_plugin(); + } +}); + +// node_modules/@intentius/chant/src/components/config-defaults.ts +var init_config_defaults = __esm({ + "node_modules/@intentius/chant/src/components/config-defaults.ts"() { + init_config(); + } +}); + +// node_modules/@intentius/chant/src/components/cli-support.ts +var init_cli_support = __esm({ + "node_modules/@intentius/chant/src/components/cli-support.ts"() { + init_discover3(); + init_component(); + init_driver2(); + init_gate_name(); + init_lexicon(); + init_capability_plugin_loader(); + init_config_defaults(); + init_config(); + } +}); + +// node_modules/@intentius/chant/src/op/runtime.ts +var init_runtime2 = __esm({ + "node_modules/@intentius/chant/src/op/runtime.ts"() { + } +}); + +// node_modules/@intentius/chant/src/op/runtimes/local.ts +var init_local = __esm({ + "node_modules/@intentius/chant/src/op/runtimes/local.ts"() { + init_config(); + init_activity_registry(); + init_local_executor(); + init_cli_support(); + init_discover2(); + init_run_ledger(); + init_runtime2(); + } +}); + +// node_modules/@intentius/chant/src/op/op-ir.ts +var init_op_ir = __esm({ + "node_modules/@intentius/chant/src/op/op-ir.ts"() { + init_activity_profiles(); + init_gate_name(); + } +}); + +// node_modules/@intentius/chant/src/op/local-output.ts +var init_local_output = __esm({ + "node_modules/@intentius/chant/src/op/local-output.ts"() { + init_gate(); } }); @@ -234195,6 +241889,12 @@ var init_lease = __esm({ } }); +// node_modules/@intentius/chant/src/op/change-signal.ts +var init_change_signal = __esm({ + "node_modules/@intentius/chant/src/op/change-signal.ts"() { + } +}); + // node_modules/@intentius/chant/src/op/operator.ts var init_operator = __esm({ "node_modules/@intentius/chant/src/op/operator.ts"() { @@ -234202,13 +241902,8 @@ var init_operator = __esm({ init_local_executor(); init_lease(); init_git(); - } -}); - -// node_modules/@intentius/chant/src/op/op-verb-class.ts -var init_op_verb_class = __esm({ - "node_modules/@intentius/chant/src/op/op-verb-class.ts"() { - init_local_executor(); + init_cron(); + init_change_signal(); } }); @@ -234220,16 +241915,29 @@ var init_op = __esm({ init_activity_runtime(); init_emulator_lifecycle(); init_emulator_freshness(); + init_types5(); + init_cron(); + init_composites(); init_receipt_store(); init_discover2(); init_generate_pipeline(); init_activity_registry(); + init_activity_contract_registry(); + init_activity_profiles(); + init_activity_failure(); init_local_executor(); + init_gate(); + init_plan_digest(); + init_gate_name(); + init_local(); + init_runtime2(); + init_op_ir(); init_local_output(); init_activity_contract(); init_step_output_ref(); init_converge_rule(); init_operator(); + init_change_signal(); init_op_verb_class(); init_builders(); } @@ -234239,6 +241947,7 @@ var init_op = __esm({ var init_src = __esm({ "node_modules/@intentius/chant/src/index.ts"() { init_declarable(); + init_held_elsewhere(); init_composite(); init_provenance(); init_secret_provenance(); @@ -234272,6 +241981,9 @@ var init_src = __esm({ init_graph_lens(); init_detectLexicon(); init_fold(); + init_subset(); + init_subset(); + init_fold_import(); init_parser(); init_rule(); init_rules(); @@ -234290,6 +242002,12 @@ var init_src = __esm({ init_identity(); init_apply(); init_deep_observation(); + init_behaviour(); + init_behaviour_http(); + init_behaviour_kinds(); + init_behaviour_delta(); + init_claimed_fields(); + init_fold_provenance(); init_owner_chain(); init_lexicon_integrity(); init_lexicon_manifest(); @@ -234438,14 +242156,15 @@ var init_conflict_check = __esm({ var plugins_exports = {}; __export(plugins_exports, { collectBuildRootContributors: () => collectBuildRootContributors, + collectChangeSubscribers: () => collectChangeSubscribers, loadPlugin: () => loadPlugin, loadPlugins: () => loadPlugins, resolveLexiconVersions: () => resolveLexiconVersions, resolveProjectLexicons: () => resolveProjectLexicons }); -import { createRequire as createRequire3 } from "node:module"; -import { dirname as dirname10, join as join11 } from "node:path"; -import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs"; +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"; async function loadPlugin(lexiconName) { const packageName = `@intentius/chant-lexicon-${lexiconName}`; const mod = await import(packageName); @@ -234471,22 +242190,22 @@ async function loadPlugin(lexiconName) { throw new Error(`Package ${packageName} does not export a LexiconPlugin or Serializer`); } function resolveLexiconVersions(lexiconNames) { - const require_ = createRequire3(import.meta.url); + const require_ = createRequire4(import.meta.url); const versions = {}; for (const name of lexiconNames) { const packageName = `@intentius/chant-lexicon-${name}`; try { - let dir = dirname10(require_.resolve(packageName)); + let dir = dirname13(require_.resolve(packageName)); for (let depth = 0; depth < 10; depth++) { - const candidate = join11(dir, "package.json"); - if (existsSync6(candidate)) { - const pkg = JSON.parse(readFileSync5(candidate, "utf-8")); + const candidate = join14(dir, "package.json"); + if (existsSync8(candidate)) { + const pkg = JSON.parse(readFileSync7(candidate, "utf-8")); if (pkg.name === packageName && pkg.version) { versions[name] = pkg.version; break; } } - const parent = dirname10(dir); + const parent = dirname13(dir); if (parent === dir) break; dir = parent; } @@ -234498,6 +242217,19 @@ function resolveLexiconVersions(lexiconNames) { function collectBuildRootContributors(plugins, config2, projectRoot) { return (plugins ?? []).filter((plugin) => typeof plugin.buildRoots === "function").map((plugin) => (ctx) => plugin.buildRoots({ projectRoot, config: config2, entities: ctx?.entities })); } +function collectChangeSubscribers(plugins, options) { + return (plugins ?? []).filter((plugin) => typeof plugin.subscribeChanges === "function").filter((plugin) => (options.entities.get(plugin.name)?.size ?? 0) > 0).map((plugin) => ({ + lexicon: plugin.name, + subscribe: (ctx) => plugin.subscribeChanges({ + environment: options.environment, + ...options.cwd ? { cwd: options.cwd } : {}, + entities: options.entities.get(plugin.name), + onChange: ctx.onChange, + onError: ctx.onError, + signal: ctx.signal + }) + })); +} async function loadPlugins(lexiconNames) { const plugins = []; for (const name of lexiconNames) { @@ -234552,8 +242284,8 @@ __export(discover_exports, { loadAuditPlugins: () => loadAuditPlugins, unclaimedFiles: () => unclaimedFiles }); -import { readdirSync, readFileSync as readFileSync6, statSync as statSync2 } from "fs"; -import { basename as basename2, join as join12, relative as relative2 } from "path"; +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"; async function loadAuditPlugins(names = AUDIT_LEXICONS) { const { loadPlugin: loadPlugin2 } = await Promise.resolve().then(() => (init_plugins(), plugins_exports)); const plugins = []; @@ -234575,17 +242307,20 @@ function walkFiles(dir, out) { } 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)) continue; + 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 = join12(dir, e.name); + const full = join15(dir, e.name); if (e.isDirectory()) walkFiles(full, out); else out.push(full); } } function readSafe(full) { try { - if (statSync2(full).size > MAX_FILE_BYTES) return void 0; - return readFileSync6(full, "utf-8"); + if (statSync3(full).size > MAX_FILE_BYTES) return void 0; + return readFileSync8(full, "utf-8"); } catch { return void 0; } @@ -234596,6 +242331,9 @@ function isYaml(name) { function isDockerfileName(name) { return name === "Dockerfile" || name.startsWith("Dockerfile.") || name.endsWith(".Dockerfile") || name.endsWith(".dockerfile"); } +function isTerraformFileName(name) { + return /\.tf$/i.test(name); +} function isSecretBearingName(name) { if (/^\.env(\..+)?$/i.test(name)) return true; return /\.(pem|key|crt|cer|pfx|p12)$/i.test(name); @@ -234639,7 +242377,7 @@ function ciLexiconForPath(path) { return void 0; } function isCandidatePath(path) { - const name = basename2(path); + const name = basename4(path); if (ciLexiconForPath(path)) return true; if (isDockerfileName(name)) return true; if (name === "Chart.yaml") return true; @@ -234649,12 +242387,12 @@ function isCandidatePath(path) { return /\.(ya?ml|json|template)$/i.test(name); } function hintLexiconForFile(path, content) { - const name = basename2(path); + const name = basename4(path); const ci = ciLexiconForPath(path); if (ci) return ci; if (isDockerfileName(name)) return "docker"; if (name === "Chart.yaml") return "helm"; - if (/\.tf$/i.test(name)) return "terraform"; + if (isTerraformFileName(name)) return "terraform"; const head = content.slice(0, 64 * 1024); if (/cnrm\.cloud\.google\.com/.test(head)) return "gcp"; if (/fountain\.dev\/v1/.test(head)) return "fountain"; @@ -234704,14 +242442,86 @@ function classifyHelm(files, plugin) { } return { inputs, prefixes }; } -function classifyFiles(files, plugins) { +function resolveRepoDir(dir, rel) { + const parts = dir === "" ? [] : dir.split("/"); + for (const segment of rel.split("/")) { + if (segment === "" || segment === ".") continue; + if (segment === "..") { + if (parts.length === 0) return void 0; + parts.pop(); + continue; + } + parts.push(segment); + } + return parts.join("/"); +} +function calledAsLocalModule(byDir) { + const callees = /* @__PURE__ */ new Map(); + const called = /* @__PURE__ */ new Set(); + for (const [dir, bundle] of byDir) { + const targets = /* @__PURE__ */ new Set(); + for (const source of Object.values(bundle)) { + for (const match of source.matchAll(LOCAL_MODULE_SOURCE)) { + const target = resolveRepoDir(dir, match[1]); + if (target === void 0 || target === dir || !byDir.has(target)) continue; + targets.add(target); + called.add(target); + } + } + callees.set(dir, targets); + } + const queue = [...byDir.keys()].filter((dir) => !called.has(dir)); + const reached = new Set(queue); + while (queue.length > 0) { + for (const target of callees.get(queue.shift()) ?? []) { + if (reached.has(target)) continue; + reached.add(target); + queue.push(target); + } + } + return new Set([...called].filter((dir) => reached.has(dir))); +} +function classifyTerraform(files, plugin, baseDir) { + const inputs = []; + const claimed = /* @__PURE__ */ new Set(); + if (!plugin) return { inputs, claimed }; + const byDir = /* @__PURE__ */ new Map(); + for (const f of files) { + if (!isTerraformFileName(basename4(f.path))) continue; + const slash = f.path.lastIndexOf("/"); + const dir = slash === -1 ? "" : f.path.slice(0, slash); + const name = slash === -1 ? f.path : f.path.slice(slash + 1); + const bundle = byDir.get(dir) ?? {}; + bundle[name] = f.content; + byDir.set(dir, bundle); + claimed.add(f.path); + } + const childModules = baseDir === void 0 ? /* @__PURE__ */ new Set() : calledAsLocalModule(byDir); + for (const [dir, bundle] of byDir) { + if (childModules.has(dir)) continue; + const content = Object.keys(bundle).sort().map((name) => `# file: ${name} +${bundle[name]}`).join("\n"); + inputs.push({ + path: dir === "" ? "." : dir, + content, + lexicon: "terraform", + files: bundle, + ...baseDir === void 0 ? {} : { dir: resolve8(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 helm = classifyHelm(files, byName.get("helm")); const underChart = (p) => helm.prefixes.some((pre) => pre === "" ? true : p.startsWith(pre)); - const inputs = [...helm.inputs]; + const terraform = classifyTerraform(files, byName.get("terraform"), baseDir); + const inputs = [...helm.inputs, ...terraform.inputs]; for (const { path, content } of files) { if (underChart(path)) continue; - const name = basename2(path); + if (terraform.claimed.has(path)) continue; + const name = basename4(path); const ci = ciLexiconForPath(path); if (ci) { if (byName.has(ci)) inputs.push({ path, content, lexicon: ci }); @@ -234734,16 +242544,22 @@ function classifyFiles(files, plugins) { return inputs; } function discoverByDetection(root, plugins) { - return classifyFiles(collectCandidates(root), plugins); + return classifyFiles(collectCandidates(root), plugins, { baseDir: root }); } function collectCandidates(root) { const all = []; walkFiles(root, all); + const gitignore = readSafe(join15(root, ".gitignore")) ?? ""; const files = []; for (const full of all) { - const path = relative2(root, full); - if (/\.tf$/i.test(path)) { - files.push({ path, content: "" }); + const path = relative6(root, full); + if (isTerraformStatePath(path)) { + if (!gitignoreCoversTerraformState(gitignore, path)) files.push({ path, content: "" }); + continue; + } + if (isTerraformFileName(basename4(path))) { + const content2 = readSafe(full); + if (content2 !== void 0) files.push({ path, content: content2 }); continue; } if (!isCandidatePath(path)) continue; @@ -234752,13 +242568,15 @@ function collectCandidates(root) { } return files; } -var AUDIT_LEXICONS, WALK_SKIP, WALK_DOT_DIRS, MAX_WALK_FILES, MAX_FILE_BYTES, CONTENT_DETECTORS; -var init_discover3 = __esm({ +var AUDIT_LEXICONS, WALK_SKIP, TERRAFORM_WORK_DIR, WALK_DOT_DIRS, 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(); - AUDIT_LEXICONS = ["github", "gitlab", "forgejo", "k8s", "docker", "aws", "azure", "gcp", "helm", "fountain"]; + 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; MAX_FILE_BYTES = 2 * 1024 * 1024; @@ -234811,6 +242629,7 @@ var init_discover3 = __esm({ } } ]; + LOCAL_MODULE_SOURCE = /(?:^|[\s{,])source\s*=\s*"(\.{1,2}\/[^"]*)"/g; } }); @@ -234999,7 +242818,7 @@ async function listTreeGitHubLike(host, owner, repo, ref, doFetch, headers, ms) const blobs = tree.filter((e) => e.type === "blob").map((e) => ({ path: e.path, type: "blob", size: e.size })); const isLarge = blobs.length > LARGE_REPO_TREE_ENTRIES || treeBody?.truncated === true; if (!isLarge) return blobs; - const { ciLexiconForPath: ciLexiconForPath2 } = await Promise.resolve().then(() => (init_discover3(), discover_exports)); + const { ciLexiconForPath: ciLexiconForPath2 } = await Promise.resolve().then(() => (init_discover4(), discover_exports)); const known = blobs.filter((e) => ciLexiconForPath2(e.path)); try { const hits = host.kind === "github" ? await githubCodeSearch(host, owner, repo, doFetch, headers, ms) : await forgejoCodeSearch(host, owner, repo, doFetch, headers, ms); @@ -235056,7 +242875,7 @@ async function fetchFileContent(host, owner, repo, path, ref, doFetch, headers, return Buffer.from(file2.content, file2.encoding ?? "base64").toString("utf-8"); } async function fetchRepoFiles(url2, opts = {}) { - const { isCandidatePath: isCandidatePath2 } = await Promise.resolve().then(() => (init_discover3(), discover_exports)); + const { isCandidatePath: isCandidatePath2 } = await Promise.resolve().then(() => (init_discover4(), discover_exports)); const { host, owner, repo } = parseRepoUrl(url2); const doFetch = opts.fetchImpl ?? fetch; const cfg = { @@ -235122,8 +242941,87 @@ var init_fetch2 = __esm({ } }); +// node_modules/@intentius/chant/src/lint/suppressions.ts +function entitySuppressions(entity) { + if (!entity) return []; + const s = entity.suppressions; + return Array.isArray(s) ? s : []; +} +function isIgnorable(rules, id) { + const cfg = rules?.[id]; + if (!Array.isArray(cfg)) return true; + const options = cfg[1]; + return options?.ignorable !== false; +} +function namesId(ids, checkId) { + return ids === "all" || ids.has(checkId); +} +function isExpired(expires, today) { + if (!expires) return false; + const parsed = /* @__PURE__ */ new Date(`${expires}T00:00:00Z`); + if (Number.isNaN(parsed.getTime())) return false; + return parsed.getTime() < today.getTime(); +} +function applyInlineSuppressions(diagnostics, entities, rules, today = /* @__PURE__ */ new Date()) { + const kept = []; + const suppressed = []; + const meta4 = []; + const reported = /* @__PURE__ */ new Set(); + const reportMeta = (d, checkId, message) => { + const dedupeKey = `${checkId}:${d.key}`; + if (reported.has(dedupeKey)) return; + reported.add(dedupeKey); + meta4.push({ checkId, severity: "warning", file: d.file, line: d.line, message }); + }; + for (const entity of entities.values()) { + for (const d of entitySuppressions(entity)) { + if (d.misplaced) { + reportMeta( + d, + SUPPRESSION_MISPLACED_FILE_ID, + `chant-ignore-file at ${d.file}:${d.line} is not the first non-blank line of the file, so it has no effect. Move it to the top.` + ); + continue; + } + if (isExpired(d.expires, today)) { + reportMeta(d, SUPPRESSION_EXPIRED_ID, `Suppression at ${d.file}:${d.line} expired ${d.expires} and no longer applies.`); + } + } + } + for (const diag of diagnostics) { + const entity = diag.entity ? entities.get(diag.entity) : void 0; + let matched; + for (const d of entitySuppressions(entity)) { + if (d.misplaced) continue; + if (isExpired(d.expires, today)) continue; + if (!namesId(d.ids, diag.checkId)) continue; + if (d.ids !== "all" && !isIgnorable(rules, diag.checkId)) { + reportMeta( + d, + SUPPRESSION_UNIGNORABLE_ID, + `${diag.checkId} is configured \`ignorable: false\`; the ${d.form} at ${d.file}:${d.line} naming it has no effect.` + ); + continue; + } + matched = d; + break; + } + if (matched) suppressed.push(diag); + else kept.push(diag); + } + return { diagnostics: kept, suppressed, meta: meta4 }; +} +var SUPPRESSION_EXPIRED_ID, SUPPRESSION_MISPLACED_FILE_ID, SUPPRESSION_UNIGNORABLE_ID; +var init_suppressions = __esm({ + "node_modules/@intentius/chant/src/lint/suppressions.ts"() { + SUPPRESSION_EXPIRED_ID = "SUPP001"; + SUPPRESSION_MISPLACED_FILE_ID = "SUPP002"; + SUPPRESSION_UNIGNORABLE_ID = "SUPP003"; + } +}); + // node_modules/@intentius/chant/src/audit/core.ts -import { basename as basename3 } from "path"; +import { basename as basename5 } from "path"; function dedupeById(checks) { const byId = /* @__PURE__ */ new Map(); for (const check2 of checks) { @@ -235165,8 +243063,8 @@ async function defaultEntitiesProvider(lexicon) { let parser; try { const [plugin] = await load([lexicon]); - const parse3 = plugin?.auditEntities?.bind(plugin); - if (parse3) parser = parse3; + const parse4 = plugin?.auditEntities?.bind(plugin); + if (parse4) parser = parse4; } catch { parser = void 0; } @@ -235187,14 +243085,14 @@ async function auditFiles(inputs, opts = {}) { const checks = await provider(lexicon); if (checks.length === 0) continue; const parseEntities = await entitiesProvider(lexicon); - findings.push(...auditLexicon(lexicon, files, checks, parseEntities)); + findings.push(...await auditLexicon(lexicon, files, checks, parseEntities, opts.suppressionStats)); } return findings; } function toOutput(file2) { if (file2.files) return { primary: file2.content, files: file2.files }; if (file2.lexicon === "gcp") return file2.content; - return { primary: file2.content, files: { [basename3(file2.path)]: file2.content } }; + return { primary: file2.content, files: { [basename5(file2.path)]: file2.content } }; } function runChecks(checks, outputs, entities = /* @__PURE__ */ new Map()) { const buildResult = { outputs, entities, warnings: [], errors: [], sourceFileCount: outputs.size }; @@ -235206,7 +243104,7 @@ function runChecks(checks, outputs, entities = /* @__PURE__ */ new Map()) { } catch { } } - return diags; + return applyInlineSuppressions(diags, entities); } function diagKey(d) { return `${d.checkId}\0${d.entity ?? ""}\0${d.message}`; @@ -235222,39 +243120,49 @@ function mergeEntities(maps) { } return merged; } -function auditLexicon(lexicon, files, checks, parseEntities) { - const entitiesFor = (file2) => { +async function auditLexicon(lexicon, files, checks, parseEntities, suppressionStats) { + const entitiesFor = async (file2) => { if (!parseEntities) return /* @__PURE__ */ new Map(); try { - return parseEntities(file2.content); + return await parseEntities(file2.content, { + path: file2.path, + ...file2.dir !== void 0 ? { dir: file2.dir } : {}, + ...file2.baseDir !== void 0 ? { baseDir: file2.baseDir } : {} + }); } catch { return /* @__PURE__ */ new Map(); } }; - const perEntities = new Map(files.map((f) => [f.path, entitiesFor(f)])); + const perEntities = new Map(await Promise.all(files.map(async (f) => [f.path, await entitiesFor(f)]))); const perFindings = []; const perKeys = /* @__PURE__ */ new Set(); + const metaFindings = []; for (const file2 of files) { - const diags = runChecks(checks, /* @__PURE__ */ new Map([[file2.path, toOutput(file2)]]), perEntities.get(file2.path)); + const { diagnostics: diags, suppressed, meta: meta4 } = runChecks(checks, /* @__PURE__ */ new Map([[file2.path, toOutput(file2)]]), perEntities.get(file2.path)); + if (suppressionStats) suppressionStats.count += suppressed.length; + for (const m of meta4) { + metaFindings.push({ checkId: m.checkId, severity: m.severity, message: m.message, file: m.file, lexicon, line: m.line }); + } for (const d of diags) { - perFindings.push({ checkId: d.checkId, severity: d.severity, message: d.message, file: file2.path, lexicon: d.lexicon ?? lexicon, entity: d.entity }); + perFindings.push({ checkId: d.checkId, severity: d.severity, message: d.message, file: file2.path, lexicon: d.lexicon ?? lexicon, entity: d.entity, missing: d.missing }); perKeys.add(diagKey(d)); } } const allOutputs = new Map(files.map((f) => [f.path, toOutput(f)])); - const allDiags = runChecks(checks, allOutputs, mergeEntities([...perEntities.values()])); + const { diagnostics: allDiags } = runChecks(checks, allOutputs, mergeEntities([...perEntities.values()])); const allKeys = new Set(allDiags.map(diagKey)); const out = perFindings.filter((f) => allKeys.has(diagKey(f))); for (const d of allDiags) { if (!perKeys.has(diagKey(d))) { - out.push({ checkId: d.checkId, severity: d.severity, message: d.message, file: CROSS_FILE, lexicon: d.lexicon ?? lexicon, entity: d.entity }); + out.push({ checkId: d.checkId, severity: d.severity, message: d.message, file: CROSS_FILE, lexicon: d.lexicon ?? lexicon, entity: d.entity, missing: d.missing }); } } - return out; + return [...out, ...metaFindings]; } var checksCache, entitiesParserCache, MissingLexiconError, CROSS_FILE; var init_core4 = __esm({ "node_modules/@intentius/chant/src/audit/core.ts"() { + init_suppressions(); checksCache = /* @__PURE__ */ new Map(); entitiesParserCache = /* @__PURE__ */ new Map(); MissingLexiconError = class extends Error { @@ -235263,205 +243171,6 @@ var init_core4 = __esm({ } }); -// node_modules/@intentius/chant/src/audit/catalog.ts -function meta3(id, tier, fixKind, title, remediation, authority) { - const category = authority && authority.length > 0 ? "security" : RULE_CATEGORY[id] ?? "best-practice"; - return { id, tier, fixKind, category, title, remediation, authority, yamlBased: true }; -} -function agentMeta(id, tier, title, remediation, authority) { - const category = authority && authority.length > 0 ? "security" : RULE_CATEGORY[id] ?? "best-practice"; - return { id, tier, fixKind: G, category, title, remediation, authority, yamlBased: false }; -} -var SCORECARD_PINNED, GH_SECRET_SCANNING, CF_WORKERS_DEV, CF_SECRETS, CF_ROUTES, CF_ENVIRONMENTS, CF_STATIC_ASSETS, MOZILLA_TLS, CWE_DIR_LISTING, GIXY_ALIAS, NGINX_STUB_STATUS, CWE_HARDCODED_CREDS, CWE_CLEARTEXT, M, R, G, RULE_CATEGORY, RULE_CATALOG; -var init_catalog = __esm({ - "node_modules/@intentius/chant/src/audit/catalog.ts"() { - SCORECARD_PINNED = { - name: "OSSF Scorecard \u2014 Pinned-Dependencies", - url: "https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies" - }; - GH_SECRET_SCANNING = { - name: "GitHub \u2014 About secret scanning", - url: "https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning" - }; - CF_WORKERS_DEV = { - name: "Cloudflare Workers \u2014 workers.dev", - url: "https://developers.cloudflare.com/workers/configuration/routing/workers-dev/" - }; - CF_SECRETS = { - name: "Cloudflare Workers \u2014 Secrets", - url: "https://developers.cloudflare.com/workers/configuration/secrets/" - }; - CF_ROUTES = { - name: "Cloudflare Workers \u2014 Routes", - url: "https://developers.cloudflare.com/workers/configuration/routing/routes/" - }; - CF_ENVIRONMENTS = { - name: "Cloudflare Workers \u2014 Wrangler environments", - url: "https://developers.cloudflare.com/workers/wrangler/configuration/#environments" - }; - CF_STATIC_ASSETS = { - name: "Cloudflare Workers \u2014 Static assets", - url: "https://developers.cloudflare.com/workers/static-assets/" - }; - MOZILLA_TLS = { - name: "Mozilla \u2014 Server Side TLS", - url: "https://wiki.mozilla.org/Security/Server_Side_TLS" - }; - CWE_DIR_LISTING = { - name: "CWE-548 \u2014 Exposure of Information Through Directory Listing", - url: "https://cwe.mitre.org/data/definitions/548.html" - }; - GIXY_ALIAS = { - name: "Gixy \u2014 alias traversal", - url: "https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md" - }; - NGINX_STUB_STATUS = { - name: "nginx \u2014 ngx_http_stub_status_module", - url: "https://nginx.org/en/docs/http/ngx_http_stub_status_module.html" - }; - CWE_HARDCODED_CREDS = { - name: "CWE-798 \u2014 Use of Hard-coded Credentials", - url: "https://cwe.mitre.org/data/definitions/798.html" - }; - CWE_CLEARTEXT = { - name: "CWE-319 \u2014 Cleartext Transmission of Sensitive Information", - url: "https://cwe.mitre.org/data/definitions/319.html" - }; - M = "merge-worthy"; - R = "report-only"; - G = "guidance"; - RULE_CATEGORY = { - COR020: "correctness", - EXT001: "correctness", - SEC001: "security", - SEC002: "security", - SEC003: "security", - SEC004: "security", - SEC005: "security", - SEC006: "security", - SEC007: "security", - SEC008: "security", - SEC009: "security", - SEC010: "security", - WRG001: "security", - WRG002: "security", - WRG003: "best-practice", - WRG004: "security", - WRG005: "security", - WRG006: "security", - // NGX — nginx config audit (#1979), lexicon-independent like SEC/WRG. - NGX001: "security", - NGX002: "security", - NGX003: "security", - NGX004: "security", - NGX005: "security", - NGX006: "best-practice", - NGX007: "best-practice", - // AGT — agent configuration (`chant audit --agents`). Core-owned like COR/EXT: - // these run against the machine's own agent config, not against any one - // lexicon's emitted output, so no lexicon ships them. - AGT001: "security", - AGT002: "security", - AGT003: "security", - AGT004: "security", - AGT005: "security", - AGT006: "best-practice", - AGT007: "correctness", - AGT008: "best-practice" - }; - RULE_CATALOG = { - COR020: meta3("COR020", M, G, "Circular resource dependency", "Break the dependency cycle between resources."), - EXT001: meta3("EXT001", M, G, "Extension constraint violation", "Fix the cross-property constraint flagged by the cfn-lint extension schema."), - // Secrets & credentials (#443) — lexicon-independent: `secrets.ts` scans the - // raw text of every candidate file, so these ids apply regardless of which - // (if any) audit lexicons are installed. `fixKind` is `guidance`: removing - // a hardcoded credential and rotating it needs a human, never an auto-fix. - SEC001: meta3("SEC001", M, G, "AWS access key ID found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]), - SEC002: meta3("SEC002", M, G, "AWS secret access key found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]), - SEC003: meta3("SEC003", M, G, "GitHub token found", "Remove the token from source and revoke it at github.com/settings/tokens; use a GitHub Actions secret instead.", [GH_SECRET_SCANNING]), - SEC004: meta3("SEC004", M, G, "Slack token found", "Remove the token from source and revoke it in the Slack app's OAuth settings.", [GH_SECRET_SCANNING]), - SEC005: meta3("SEC005", M, G, "Google API key found", "Remove the key from source and regenerate it in the Google Cloud Console credentials page.", [GH_SECRET_SCANNING]), - SEC006: meta3("SEC006", M, G, "Stripe live secret key found", "Remove the key from source and roll it in the Stripe dashboard immediately \u2014 this is a live-mode key.", [GH_SECRET_SCANNING]), - SEC007: meta3("SEC007", M, G, "Private key block found", "Remove the private key from source, rotate the keypair, and load the key from a secret store instead.", [GH_SECRET_SCANNING]), - SEC008: meta3("SEC008", M, G, "Bearer/authorization token found", "Remove the token from source; if it's long-lived, revoke and reissue it via the issuing service.", [GH_SECRET_SCANNING]), - SEC009: meta3("SEC009", M, G, "Credentials embedded in a connection string", "Move the username/password out of the URI into a secret store, and rotate the credential.", [GH_SECRET_SCANNING]), - SEC010: meta3("SEC010", M, G, "High-entropy string \u2014 possible secret", "Confirm whether this is a live credential; if so, remove it from source and rotate it. If it's a false positive, suppress with a `chant-audit-ignore` comment or an allowlist entry.", [GH_SECRET_SCANNING]), - // Wrangler config audit (#446) — lexicon-independent, same shape as the SEC - // family above: `wrangler.ts` scans every `wrangler.toml` it finds - // regardless of which (if any) audit lexicons are installed. - WRG001: meta3("WRG001", M, G, "Production environment exposed on *.workers.dev", "Remove workers_dev (or set it to false) for this environment and rely on its custom domain/route instead of the shared public subdomain.", [CF_WORKERS_DEV]), - WRG002: meta3("WRG002", M, G, "Credential-shaped key stored in [vars]", "Move the value out of [vars] and into `wrangler secret put ` so it isn't committed to source or visible in `wrangler dev`/the dashboard.", [CF_SECRETS]), - WRG003: meta3("WRG003", R, G, "Observability explicitly disabled", "Set observability.enabled = true (or remove the override) so Workers Logs are recorded for this deployment."), - WRG004: meta3("WRG004", M, G, "Unscoped wildcard route", 'Scope the route pattern to the intended zone (e.g. "example.com/*") instead of a bare "*" or "*/*" that matches every zone on the account.', [CF_ROUTES]), - WRG005: meta3("WRG005", M, G, "Non-production environment shares a data store with production", "Give the non-production environment its own KV namespace/R2 bucket/D1 database id instead of reusing production's.", [CF_ENVIRONMENTS]), - WRG006: meta3("WRG006", M, G, "Static assets served from the project root", "Point [site].bucket / [assets].directory at a dedicated public output folder, not the project root, so non-public files (config, source maps, .git) aren't served.", [CF_STATIC_ASSETS]), - // nginx config audit (#1979, the #446 follow-up) — lexicon-independent, - // same shape as SEC/WRG: `nginx.ts` scans every nginx config it detects - // regardless of which (if any) audit lexicons are installed. - NGX001: meta3("NGX001", M, G, "Deprecated TLS protocol enabled", "Remove SSLv2/SSLv3/TLSv1/TLSv1.1 from ssl_protocols and serve TLSv1.2 and TLSv1.3 only.", [MOZILLA_TLS]), - NGX002: meta3("NGX002", M, G, "Weak cipher suite enabled", "Remove the RC4/DES/MD5/NULL/EXPORT-class entries from ssl_ciphers and use a modern cipher list (e.g. Mozilla's intermediate configuration).", [MOZILLA_TLS]), - NGX003: meta3("NGX003", M, G, "Directory listing enabled", "Remove `autoindex on` (or scope it to a directory that is genuinely meant to be enumerated) so file listings aren't served to anyone who asks.", [CWE_DIR_LISTING]), - NGX004: meta3("NGX004", M, G, "alias path traversal", 'End the location prefix with "/" so it matches the trailing slash of the alias target \u2014 without it, a request for "../" escapes the aliased directory.', [GIXY_ALIAS]), - NGX005: meta3("NGX005", M, G, "Status endpoint with no access restriction", "Restrict the stub_status location with allow/deny (or auth_basic/auth_request) so connection metrics aren't public reconnaissance.", [NGINX_STUB_STATUS]), - NGX006: meta3("NGX006", R, G, "Server version disclosure", "Add `server_tokens off;` in the http block so nginx stops advertising its exact version in the Server header and error pages."), - NGX007: meta3("NGX007", R, G, "Access logging disabled at server scope", "Re-enable access_log at http/server scope (silencing a single noisy location is fine) so requests are recorded for incident investigation."), - // ── Agent configuration (`chant audit --agents`) ────────────────── - AGT001: agentMeta( - "AGT001", - M, - "MCP server runs an unpinned package", - "Pin the package spec to an exact version (`server@1.2.3`), so a new upstream release can't execute on this machine unreviewed.", - [SCORECARD_PINNED] - ), - AGT002: agentMeta( - "AGT002", - M, - "Literal credential in agent config", - "Replace the value with an environment reference (`${TOKEN}`) and keep the secret in a secret store \u2014 agent config files sync, back up, and get shared.", - [CWE_HARDCODED_CREDS] - ), - AGT003: agentMeta( - "AGT003", - M, - "MCP server reached over cleartext HTTP", - "Use an https:// endpoint. Tool arguments and results \u2014 including data the agent read locally \u2014 otherwise cross the network in the clear.", - [CWE_CLEARTEXT] - ), - AGT004: agentMeta( - "AGT004", - M, - "Remote skill or plugin is unpinned", - "Pin the source to a tag or commit sha, so the instructions the agent follows can't change upstream without a local edit.", - [SCORECARD_PINNED] - ), - AGT005: agentMeta( - "AGT005", - M, - "Tool permission granted without constraint", - "Scope the grant to the specific commands you run (`Bash(git status:*)`), and re-enable the confirmation prompt for dangerous operations." - ), - AGT006: agentMeta( - "AGT006", - R, - "User-scope config applies to every project", - "Move project-specific instructions, MCP servers, and skills to that project's own config so they don't follow you into unrelated repos." - ), - AGT007: agentMeta( - "AGT007", - R, - "MCP server declared in multiple files", - "Delete the shadowed declarations. The harness silently picks one, so the file you read may not be the one that decides what runs." - ), - AGT008: agentMeta( - "AGT008", - R, - "Instruction file exceeds the attention budget", - "Move situational guidance into skills that load on demand, so the always-on instructions stay short enough to be followed reliably." - ) - }; - } -}); - // node_modules/@intentius/chant/src/audit/proof.ts function notApplied(checkId, reason, note) { return { checkId, applied: false, reason, note }; @@ -235520,6 +243229,28 @@ function narrowWriteAll(content) { if (!re.test(content)) return { patched: content, changed: false }; return { patched: content.replace(re, "permissions:\n contents: read"), changed: true }; } +function dropRedundantDefaults(content) { + const kept = content.split("\n").filter((line) => !REDUNDANT_DEFAULT_RE.test(line)); + const patched = kept.join("\n"); + return { patched, changed: patched !== content }; +} +function interpolationOnlyLine(line) { + const m = INTERPOLATION_ONLY_RE.exec(line); + if (!m) return void 0; + const expr = m[4]; + if (expr.includes("${") || expr.includes("}")) return void 0; + return { name: m[2], expr, unwrapped: `${m[1]}${m[2]}${m[3]}${expr}${m[5]}` }; +} +function unwrapInterpolations(content) { + let changed = false; + const lines = content.split("\n").map((line) => { + const parsed = interpolationOnlyLine(line); + if (!parsed) return line; + changed = true; + return parsed.unwrapped; + }); + return { patched: lines.join("\n"), changed }; +} function proveFix(checkId, content, opts = {}) { const cat = (opts.catalog ?? RULE_CATALOG)[checkId]; if (cat && cat.fixKind !== "deterministic") { @@ -235549,6 +243280,12 @@ function proveFix(checkId, content, opts = {}) { case "GHA033": result = narrowWriteAll(content); break; + case "TF016": + result = unwrapInterpolations(content); + break; + case "TF019": + result = dropRedundantDefaults(content); + break; default: return notApplied(checkId, "needs-input", cat?.remediation || "No deterministic fix implemented for this rule yet."); } @@ -235645,13 +243382,15 @@ function unifiedDiff(oldStr, newStr, context = 3) { } return lines.join("\n"); } -var SHA_RE, USES_RE, IMAGE_RE; +var SHA_RE, USES_RE, IMAGE_RE, REDUNDANT_DEFAULT_RE, INTERPOLATION_ONLY_RE; var init_proof = __esm({ "node_modules/@intentius/chant/src/audit/proof.ts"() { init_catalog(); SHA_RE = /^[0-9a-f]{40}$/; USES_RE = /^(\s*-?\s*uses:\s*)([^@\s'"]+)@([^\s'"#]+)(.*)$/; IMAGE_RE = /^(\s*image:\s*)(["']?)([^\s"'#]+)\2(.*)$/; + REDUNDANT_DEFAULT_RE = /^[ \t]*(?:sensitive|ephemeral|prevent_destroy|create_before_destroy)[ \t]*=[ \t]*false[ \t]*$/; + INTERPOLATION_ONLY_RE = /^([ \t]*)([A-Za-z_][A-Za-z0-9_-]*)([ \t]*=[ \t]*)"\$\{([^"]+)\}"([ \t]*(?:#.*)?)$/; } }); @@ -235744,11 +243483,12 @@ function buildReportModel(findings, opts = {}) { const enriched = findings.map((f) => ({ ...f, meta: metaFor(f.checkId, catalog) })); const contents = new Map((opts.files ?? []).map((f) => [f.path, f.content])); const mergeWorthy = enriched.filter((f) => f.meta.tier === "merge-worthy"); - const quickWinFindings = mergeWorthy.filter((f) => f.meta.fixKind === "deterministic"); + const quickWinFindings = enriched.filter((f) => f.meta.fixKind === "deterministic"); const needsReviewFindings = mergeWorthy.filter((f) => f.meta.fixKind === "guidance"); const mwOnEntity = new Set(mergeWorthy.filter((f) => f.entity).map((f) => `${f.file}:${f.entity}:${f.checkId}`)); const reportOnly = enriched.filter((f) => { if (f.meta.tier !== "report-only") return false; + if (f.meta.fixKind === "deterministic") return false; const supers = SUPERSEDED_BY[f.checkId]; if (supers && f.entity && supers.some((id) => mwOnEntity.has(`${f.file}:${f.entity}:${id}`))) return false; return true; @@ -236642,8 +244382,8 @@ var init_gha027 = __esm({ if (!CLEANUP_PATTERN.test(stepName)) continue; const afterName = yaml.slice(match.index + match[0].length); const blockEnd = afterName.search(/\n\s{6}-\s|\n\s{2}[a-z]/); - const block = blockEnd === -1 ? afterName : afterName.slice(0, blockEnd); - if (!/^\s+if:/m.test(block)) { + const block2 = blockEnd === -1 ? afterName : afterName.slice(0, blockEnd); + if (!/^\s+if:/m.test(block2)) { const beforeStep = yaml.slice(0, match.index); const jobMatch = [...beforeStep.matchAll(/^\s{2}([a-z][a-z0-9-]*):/gm)]; const jobName = jobMatch.length > 0 ? jobMatch[jobMatch.length - 1][1] : "unknown"; @@ -237461,7 +245201,7 @@ var init_gha046 = __esm({ }); // node_modules/@intentius/chant-lexicon-github/src/lint/post-synth/gha047.ts -function isLiteral(arg) { +function isLiteral2(arg) { const t = arg.trim(); return t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"'); } @@ -237481,7 +245221,7 @@ var init_gha047 = __esm({ let m; REVERSED_CONTAINS.lastIndex = 0; while ((m = REVERSED_CONTAINS.exec(expr)) !== null) { - if (isLiteral(m[2])) continue; + if (isLiteral2(m[2])) continue; diagnostics.push({ checkId: "GHA047", severity: "warning", @@ -238764,7 +246504,7 @@ var init_engine = __esm({ "src/audit/engine.ts"() { "use strict"; init_fetch2(); - init_discover3(); + init_discover4(); init_core4(); init_report_model(); init_post_synth2(); @@ -238774,7 +246514,7 @@ var init_engine = __esm({ }); // src/cli.ts -import { readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs"; +import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs"; import { pathToFileURL } from "node:url"; // package.json @@ -238815,8 +246555,8 @@ var package_default = { prepublishOnly: "npm run build" }, dependencies: { - "@intentius/chant": "^0.56.0", - "@intentius/chant-lexicon-github": "^0.56.0" + "@intentius/chant": "^0.71.1", + "@intentius/chant-lexicon-github": "^0.71.1" }, devDependencies: { "@types/libsodium-wrappers": "^0.7.14", @@ -241361,7 +249101,7 @@ async function main(argv = process.argv.slice(2)) { } let rawConfig; try { - const text = readFileSync7(args.config, "utf-8"); + const text = readFileSync9(args.config, "utf-8"); rawConfig = parseConfigFile(args.config, text); } catch (err) { die(3, `failed to read config file "${args.config}": ${errMsg2(err)}`); @@ -241608,7 +249348,7 @@ async function runAudit(argv) { } let rawConfig; try { - const text = readFileSync7(auditArgs.config, "utf-8"); + const text = readFileSync9(auditArgs.config, "utf-8"); rawConfig = parseConfigFile(auditArgs.config, text); } catch (err) { die(3, `failed to read config file "${auditArgs.config}": ${errMsg2(err)}`); @@ -241676,7 +249416,7 @@ async function runReport(argv) { } let rawConfig; try { - const text = readFileSync7(reportArgs.config, "utf-8"); + const text = readFileSync9(reportArgs.config, "utf-8"); rawConfig = parseConfigFile(reportArgs.config, text); } catch (err) { die(3, `failed to read config file "${reportArgs.config}": ${errMsg2(err)}`); diff --git a/package-lock.json b/package-lock.json index 4b51eca..70286cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.5.0", "license": "Apache-2.0", "dependencies": { - "@intentius/chant": "^0.56.0", - "@intentius/chant-lexicon-github": "^0.56.0" + "@intentius/chant": "^0.71.1", + "@intentius/chant-lexicon-github": "^0.71.1" }, "bin": { "github-warden": "bin/github-warden.js" @@ -491,14 +491,15 @@ } }, "node_modules/@intentius/chant": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.56.0.tgz", - "integrity": "sha512-pPZx/S71tayDwQIgqx/2xPUM27yCw/tUfdDSoT3PIxJGLpOVC9JVzE2Z33mu2j/X25QgftFsyD8JVTPpdw39wg==", + "version": "0.71.1", + "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.71.1.tgz", + "integrity": "sha512-u7on1eNpETqdCBwuL/c7gbOCkMOUuzLJrQHHczCmbG9/RFrLOtGWunPp4GRtd6pHRwN0y7EQksMarWluvxa8yg==", "license": "Apache-2.0", "dependencies": { "@dagrejs/dagre": "^3.0.0", "esbuild": "^0.28.1", "fflate": "^0.8.2", + "js-yaml": "^4.3.1", "picomatch": "^4.0.3", "tsx": "^4.0.0", "typescript": "^5.5.0", @@ -509,12 +510,12 @@ } }, "node_modules/@intentius/chant-lexicon-github": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-github/-/chant-lexicon-github-0.56.0.tgz", - "integrity": "sha512-EK9kZgxvOPWSGHNfaf50FDFMhLow52Cyus8Cn9zMzZX1G+Rf8AMfUamKECEvY+lUTDzTzJlXt6dYcRYLurMtWA==", + "version": "0.71.1", + "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-github/-/chant-lexicon-github-0.71.1.tgz", + "integrity": "sha512-feMC5P2ssEqq87Tlm5Ok8RhQhqFwFJ0Pl/6EJtUsrqq6WwV3sSTTeOwgj31vaF6U0IWbk7V6FQC4J4DO286kaQ==", "license": "Apache-2.0", "peerDependencies": { - "@intentius/chant": "^0.56.0", + "@intentius/chant": "^0.71.1", "typescript": "^5.9.3" } }, @@ -991,6 +992,12 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1169,6 +1176,28 @@ "node": ">=8.0.0" } }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/libsodium": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.8.4.tgz", diff --git a/package.json b/package.json index 3f2452c..20b45ab 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@intentius/chant": "^0.56.0", - "@intentius/chant-lexicon-github": "^0.56.0" + "@intentius/chant": "^0.71.1", + "@intentius/chant-lexicon-github": "^0.71.1" }, "devDependencies": { "@types/libsodium-wrappers": "^0.7.14",