openapi-typesafe-migrate 1.0.0-rc.1 → 1.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +452 -0
- package/LICENSE +0 -1
- package/README.md +249 -23
- package/dist/cli/main.mjs +6804 -546
- package/dist/cli/main.mjs.map +1 -1
- package/package.json +6 -4
package/dist/cli/main.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.mjs","sources":["../../src/adapters/json-lines-logger/json-lines-logger.ts","../../src/adapters/node-project-files/node-project-files.ts","../../src/domain/migration-findings.ts","../../src/adapters/typescript-parser/file-names.ts","../../src/adapters/typescript-parser/factory-type-text.ts","../../src/adapters/typescript-parser/transform-returns.ts","../../src/adapters/typescript-parser/rewriter.ts","../../src/domain/package-names.ts","../../src/domain/command-migration.ts","../../src/domain/override-targets.ts","../../src/domain/version-spec.ts","../../src/domain/manifest-migration.ts","../../src/domain/source-migration.ts","../../src/domain/workspace-catalog-migration.ts","../../src/application/file-migrations.ts","../../src/application/migrate-project.ts","../../src/domain/assert-never.ts","../../src/application/messages.ts","../../src/application/report.ts","../../src/cli/cli-arguments.ts","../../src/cli/cli-text.ts","../../src/cli/run-cli.ts","../../src/cli/main.ts"],"sourcesContent":["import { appendFileSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport type { Logger } from \"../../application/ports.js\";\n\n/** The log file and the clock of the timestamps. */\nexport interface JsonLinesLoggerOptions {\n readonly path: string;\n readonly now: () => Date;\n}\n\ntype Level = \"info\" | \"warn\";\n\n/**\n * The Logger port as a JSON Lines file: one object per event with a UTC timestamp, the level and\n * the event's fields. Lines are appended synchronously, so the log is complete when the command\n * fails half way.\n */\nclass JsonLinesLogger implements Logger {\n readonly #options: JsonLinesLoggerOptions;\n\n constructor(options: JsonLinesLoggerOptions) {\n this.#options = options;\n mkdirSync(dirname(options.path), { recursive: true });\n }\n\n info(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"info\", event, fields);\n }\n\n warn(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"warn\", event, fields);\n }\n\n #append(level: Level, event: string, fields: Readonly<Record<string, unknown>>): void {\n const time = this.#options.now().toISOString();\n appendFileSync(this.#options.path, `${JSON.stringify({ time, level, event, ...fields })}\\n`);\n }\n}\n\n/** A logger that appends to the JSON Lines file at `options.path`, creating its directory. */\nexport function createJsonLinesLogger(options: JsonLinesLoggerOptions): Logger {\n return new JsonLinesLogger(options);\n}\n","import type { Dirent } from \"node:fs\";\nimport { readdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { ProjectFiles } from \"../../application/ports.js\";\n\n/**\n * Installed packages, git metadata, build output and the output folders of frameworks and test\n * tools are not the project's own files: rewriting them only adds noise to the dry run and the\n * diff.\n * `build` and `out` stay in, because some projects keep sources there. Links are not followed, so a\n * linked workspace package is migrated in its own project, not twice.\n */\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \".next\",\n \".nuxt\",\n \".output\",\n \".svelte-kit\",\n \".turbo\",\n \"coverage\",\n]);\n\nasync function listTree(root: string, relative: string): Promise<string[]> {\n const entries: Dirent[] = await readdir(join(root, relative), { withFileTypes: true });\n const nested = await Promise.all(\n entries.map((entry) => {\n const path = relative === \"\" ? entry.name : `${relative}/${entry.name}`;\n if (entry.isDirectory()) {\n return SKIPPED_DIRECTORIES.has(entry.name) ? [] : listTree(root, path);\n }\n return entry.isFile() ? [path] : [];\n }),\n );\n return nested.flat();\n}\n\nclass NodeProjectFiles implements ProjectFiles {\n readonly #root: string;\n\n constructor(root: string) {\n this.#root = root;\n }\n\n listFiles(): Promise<string[]> {\n return listTree(this.#root, \"\");\n }\n\n read(path: string): Promise<string> {\n return readFile(join(this.#root, path), \"utf8\");\n }\n\n write(path: string, text: string): Promise<void> {\n return writeFile(join(this.#root, path), text, \"utf8\");\n }\n}\n\n/** The files of the project in the directory `root`, by `/`-separated relative paths. */\nexport function createNodeProjectFiles(root: string): ProjectFiles {\n return new NodeProjectFiles(root);\n}\n","/**\n * What a migration found in one file: changes it made, and steps it leaves to the user. Both are\n * closed sets of facts, not text; the report turns them into messages (application/report.ts).\n */\n\nexport type Change =\n | {\n readonly kind: \"dependency-renamed\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n readonly spec: string;\n }\n | { readonly kind: \"catalog-entry-renamed\"; readonly from: string; readonly to: string }\n | { readonly kind: \"command-renamed\"; readonly location: string }\n | {\n readonly kind: \"flag-renamed\";\n readonly location: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"specifier-renamed\";\n readonly line: number;\n readonly from: string;\n readonly to: string;\n }\n | { readonly kind: \"transform-rewritten\"; readonly line: number };\n\nexport type ManualStep =\n | { readonly kind: \"manifest-unreadable\"; readonly reason: string }\n | { readonly kind: \"peer-dependency-renamed\"; readonly name: string }\n | { readonly kind: \"spec-kept\"; readonly name: string; readonly spec: string }\n | { readonly kind: \"override-names-package\"; readonly field: string; readonly name: string }\n | { readonly kind: \"versioned-command\"; readonly location: string }\n | { readonly kind: \"deep-import\"; readonly line: number; readonly specifier: string }\n | {\n readonly kind: \"transform-not-rewritten\";\n readonly line: number;\n readonly reason: TransformKeepReason;\n }\n | { readonly kind: \"legacy-callback\"; readonly line: number; readonly callback: string };\n\n/** Why a `transform` callback was left as it is. */\nexport type TransformKeepReason =\n | \"other-callbacks\"\n | \"not-a-function\"\n | \"shared-function\"\n | \"unknown-return\";\n\n/** A file's new text and what was found in it. Unchanged text means nothing to write. */\nexport interface FileMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** The result for a file that the migration does not touch. */\nexport function unchanged(text: string): FileMigration {\n return { text, changes: [], manualSteps: [] };\n}\n\n/** Line number (1-based) of a character offset. */\nexport function lineAt(text: string, offset: number): number {\n let line = 1;\n for (let index = text.indexOf(\"\\n\"); index !== -1 && index < offset; ) {\n line++;\n index = text.indexOf(\"\\n\", index + 1);\n }\n return line;\n}\n","import ts from \"@typescript/typescript6\";\nimport type { FactoryNames } from \"./factory-type-text.js\";\n\n/** What the rewriter needs to know about a file's imports and module-level constants. */\nexport interface FileNames extends FactoryNames {\n /** Local names of the generator's default export (`openapiTS` in `import openapiTS from …`). */\n readonly generatorFunctions: ReadonlySet<string>;\n /** Module-level function declarations, and `const` bindings of function expressions, by name. */\n readonly functions: ReadonlyMap<string, ts.FunctionLikeDeclaration>;\n}\n\n/** The generator after the specifier rename, and before it, for files the rename skipped. */\nconst GENERATOR_MODULES: ReadonlySet<string> = new Set([\"openapi-typesafe\", \"openapi-typescript\"]);\nconst TYPESCRIPT_MODULES: ReadonlySet<string> = new Set([\"typescript\", \"@typescript/typescript6\"]);\n\ninterface MutableNames {\n readonly typescriptModules: Set<string>;\n readonly typescriptImports: Map<string, string>;\n readonly helperImports: Map<string, string>;\n readonly constants: Map<string, ts.Expression>;\n readonly generatorFunctions: Set<string>;\n readonly functions: Map<string, ts.FunctionLikeDeclaration>;\n}\n\nfunction namedImports(clause: ts.ImportClause, into: Map<string, string>): void {\n const bindings = clause.namedBindings;\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n return;\n }\n for (const element of bindings.elements) {\n into.set(element.name.text, (element.propertyName ?? element.name).text);\n }\n}\n\nfunction addTypescriptImport(clause: ts.ImportClause, names: MutableNames): void {\n if (clause.name !== undefined) {\n names.typescriptModules.add(clause.name.text);\n }\n const bindings = clause.namedBindings;\n if (bindings !== undefined && ts.isNamespaceImport(bindings)) {\n names.typescriptModules.add(bindings.name.text);\n }\n namedImports(clause, names.typescriptImports);\n}\n\nfunction addGeneratorImport(clause: ts.ImportClause, names: MutableNames): void {\n if (clause.name !== undefined) {\n names.generatorFunctions.add(clause.name.text);\n }\n namedImports(clause, names.helperImports);\n}\n\nfunction addImport(statement: ts.ImportDeclaration, names: MutableNames): void {\n const clause = statement.importClause;\n if (clause === undefined || !ts.isStringLiteral(statement.moduleSpecifier)) {\n return;\n }\n const specifier = statement.moduleSpecifier.text;\n if (TYPESCRIPT_MODULES.has(specifier)) {\n addTypescriptImport(clause, names);\n } else if (GENERATOR_MODULES.has(specifier)) {\n addGeneratorImport(clause, names);\n }\n}\n\nfunction addConstants(statement: ts.VariableStatement, names: MutableNames): void {\n if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0) {\n return;\n }\n for (const declaration of statement.declarationList.declarations) {\n const initializer = declaration.initializer;\n if (!ts.isIdentifier(declaration.name) || initializer === undefined) {\n continue;\n }\n names.constants.set(declaration.name.text, initializer);\n if (ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer)) {\n names.functions.set(declaration.name.text, initializer);\n }\n }\n}\n\n/** The imports and module-level `const` declarations of a source file. */\nexport function collectFileNames(file: ts.SourceFile): FileNames {\n const names: MutableNames = {\n typescriptModules: new Set(),\n typescriptImports: new Map(),\n helperImports: new Map(),\n constants: new Map(),\n generatorFunctions: new Set(),\n functions: new Map(),\n };\n for (const statement of file.statements) {\n if (ts.isImportDeclaration(statement)) {\n addImport(statement, names);\n } else if (ts.isVariableStatement(statement)) {\n addConstants(statement, names);\n } else if (ts.isFunctionDeclaration(statement) && statement.name !== undefined) {\n names.functions.set(statement.name.text, statement);\n }\n }\n return names;\n}\n","import ts from \"@typescript/typescript6\";\n\n/**\n * TypeScript type text for the `ts.factory` expressions of the classic `transform` recipe\n * (`createTypeReferenceNode`, keywords, `null` and literal types, unions, intersections, arrays),\n * and for the openapi-typesafe helper constants and `tsUnion` / `tsIntersection`. Anything else\n * returns undefined, so the callback is left as it is. Module-level constants such as\n * `const DATE = ts.factory.createTypeReferenceNode(\"Date\")` are followed by name.\n */\n\n/** How the file refers to the TypeScript module and to the openapi-typesafe helpers. */\nexport interface FactoryNames {\n /** Local names of the `typescript` module (`ts` in `import ts from \"typescript\"`). */\n readonly typescriptModules: ReadonlySet<string>;\n /** Local name → imported name, for named imports from `typescript` (`factory`, `SyntaxKind`). */\n readonly typescriptImports: ReadonlyMap<string, string>;\n /** Local name → imported name, for named imports from `openapi-typesafe`. */\n readonly helperImports: ReadonlyMap<string, string>;\n /** Initializers of module-level `const` declarations, by name. */\n readonly constants: ReadonlyMap<string, ts.Expression>;\n}\n\nconst KEYWORDS: ReadonlyMap<string, string> = new Map([\n [\"AnyKeyword\", \"any\"],\n [\"BigIntKeyword\", \"bigint\"],\n [\"BooleanKeyword\", \"boolean\"],\n [\"NeverKeyword\", \"never\"],\n [\"NumberKeyword\", \"number\"],\n [\"ObjectKeyword\", \"object\"],\n [\"StringKeyword\", \"string\"],\n [\"SymbolKeyword\", \"symbol\"],\n [\"UndefinedKeyword\", \"undefined\"],\n [\"UnknownKeyword\", \"unknown\"],\n [\"VoidKeyword\", \"void\"],\n]);\n\nconst HELPER_CONSTANTS: ReadonlyMap<string, string> = new Map([\n [\"BOOLEAN\", \"boolean\"],\n [\"FALSE\", \"false\"],\n [\"NEVER\", \"never\"],\n [\"NULL\", \"null\"],\n [\"NUMBER\", \"number\"],\n [\"STRING\", \"string\"],\n [\"TRUE\", \"true\"],\n [\"UNDEFINED\", \"undefined\"],\n [\"UNKNOWN\", \"unknown\"],\n]);\n\n/** A type name the type text can hold as written: `Date`, `Foo.Bar`. */\nconst TYPE_NAME_RE = /^[A-Za-z_$][\\w$]*(\\.[A-Za-z_$][\\w$]*)*$/;\n\n/** A type with a `|` or `&` at the top needs parentheses inside `[]`, and a union inside `&`. */\ninterface TypeText {\n readonly text: string;\n readonly operator: \"|\" | \"&\" | null;\n}\n\nconst plain = (text: string): TypeText => ({ text, operator: null });\n\n/** `ts.factory.createX` or `factory.createX`: the factory method name, if that is the callee. */\nfunction factoryMethod(callee: ts.Expression, names: FactoryNames): string | undefined {\n if (!ts.isPropertyAccessExpression(callee)) {\n return undefined;\n }\n const target = callee.expression;\n const isFactory = ts.isIdentifier(target)\n ? names.typescriptImports.get(target.text) === \"factory\"\n : ts.isPropertyAccessExpression(target) &&\n target.name.text === \"factory\" &&\n ts.isIdentifier(target.expression) &&\n names.typescriptModules.has(target.expression.text);\n return isFactory ? callee.name.text : undefined;\n}\n\n/** `ts.SyntaxKind.StringKeyword` or `SyntaxKind.StringKeyword`: the member name. */\nfunction syntaxKindMember(expression: ts.Expression, names: FactoryNames): string | undefined {\n if (!ts.isPropertyAccessExpression(expression)) {\n return undefined;\n }\n const target = expression.expression;\n const isSyntaxKind = ts.isIdentifier(target)\n ? names.typescriptImports.get(target.text) === \"SyntaxKind\"\n : ts.isPropertyAccessExpression(target) &&\n target.name.text === \"SyntaxKind\" &&\n ts.isIdentifier(target.expression) &&\n names.typescriptModules.has(target.expression.text);\n return isSyntaxKind ? expression.name.text : undefined;\n}\n\nfunction typeName(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined) {\n return undefined;\n }\n if (ts.isStringLiteralLike(argument)) {\n return TYPE_NAME_RE.test(argument.text) ? argument.text : undefined;\n }\n if (\n ts.isCallExpression(argument) &&\n factoryMethod(argument.expression, names) === \"createIdentifier\"\n ) {\n return typeName(argument.arguments[0], names);\n }\n return undefined;\n}\n\nfunction literalText(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined || !ts.isCallExpression(argument)) {\n return undefined;\n }\n const method = factoryMethod(argument.expression, names);\n const [value] = argument.arguments;\n switch (method) {\n case \"createNull\":\n return \"null\";\n case \"createTrue\":\n return \"true\";\n case \"createFalse\":\n return \"false\";\n case \"createStringLiteral\":\n return value !== undefined && ts.isStringLiteralLike(value)\n ? JSON.stringify(value.text)\n : undefined;\n case \"createNumericLiteral\":\n return value !== undefined && (ts.isNumericLiteral(value) || ts.isStringLiteralLike(value))\n ? String(Number(value.text))\n : undefined;\n default:\n return undefined;\n }\n}\n\nfunction joined(\n elements: ts.Expression | undefined,\n operator: \"|\" | \"&\",\n names: FactoryNames,\n): TypeText | undefined {\n if (\n elements === undefined ||\n !ts.isArrayLiteralExpression(elements) ||\n elements.elements.length === 0\n ) {\n return undefined;\n }\n const parts = elements.elements.map((element) => typeTextOf(element, names));\n if (parts.some((part) => part === undefined)) {\n return undefined;\n }\n const texts = (parts as TypeText[]).map((part) =>\n operator === \"&\" && part.operator === \"|\" ? `(${part.text})` : part.text,\n );\n return { text: texts.join(` ${operator} `), operator: texts.length > 1 ? operator : null };\n}\n\nfunction factoryCallText(\n call: ts.CallExpression,\n method: string,\n names: FactoryNames,\n): TypeText | undefined {\n const [first, second] = call.arguments;\n switch (method) {\n case \"createTypeReferenceNode\": {\n const name = second === undefined ? typeName(first, names) : undefined;\n return name === undefined ? undefined : plain(name);\n }\n case \"createKeywordTypeNode\": {\n const keyword =\n first === undefined ? undefined : KEYWORDS.get(syntaxKindMember(first, names) ?? \"\");\n return keyword === undefined ? undefined : plain(keyword);\n }\n case \"createLiteralTypeNode\": {\n const literal = literalText(first, names);\n return literal === undefined ? undefined : plain(literal);\n }\n case \"createUnionTypeNode\":\n return joined(first, \"|\", names);\n case \"createIntersectionTypeNode\":\n return joined(first, \"&\", names);\n case \"createArrayTypeNode\": {\n const element = first === undefined ? undefined : typeTextOf(first, names);\n return element === undefined\n ? undefined\n : plain(element.operator ? `(${element.text})[]` : `${element.text}[]`);\n }\n default:\n return undefined;\n }\n}\n\nfunction helperCallText(call: ts.CallExpression, names: FactoryNames): TypeText | undefined {\n if (!ts.isIdentifier(call.expression)) {\n return undefined;\n }\n const helper = names.helperImports.get(call.expression.text);\n if (helper === \"tsUnion\") {\n return joined(call.arguments[0], \"|\", names);\n }\n return helper === \"tsIntersection\" ? joined(call.arguments[0], \"&\", names) : undefined;\n}\n\nfunction identifierText(identifier: ts.Identifier, names: FactoryNames): TypeText | undefined {\n const helper = names.helperImports.get(identifier.text);\n const constant = helper === undefined ? undefined : HELPER_CONSTANTS.get(helper);\n if (constant !== undefined) {\n return plain(constant);\n }\n const initializer = names.constants.get(identifier.text);\n return initializer === undefined ? undefined : typeTextOf(initializer, names);\n}\n\n/** The type text of an expression that builds a type, or undefined. */\nexport function typeTextOf(expression: ts.Expression, names: FactoryNames): TypeText | undefined {\n if (ts.isParenthesizedExpression(expression)) {\n return typeTextOf(expression.expression, names);\n }\n if (ts.isIdentifier(expression)) {\n return identifierText(expression, names);\n }\n if (!ts.isCallExpression(expression)) {\n return undefined;\n }\n const method = factoryMethod(expression.expression, names);\n return method === undefined\n ? helperCallText(expression, names)\n : factoryCallText(expression, method, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport { type FactoryNames, typeTextOf } from \"./factory-type-text.js\";\n\n/** A replacement of a source range by new text. */\nexport interface TextEdit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\n/** The returned expressions of a function, without those of functions nested in it. */\nexport function returnedExpressions(body: ts.ConciseBody): (ts.Expression | undefined)[] {\n if (!ts.isBlock(body)) {\n return [body];\n }\n const returned: (ts.Expression | undefined)[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isFunctionLike(node) || ts.isClassLike(node)) {\n return;\n }\n if (ts.isReturnStatement(node)) {\n returned.push(node.expression);\n }\n ts.forEachChild(node, visit);\n };\n ts.forEachChild(body, visit);\n return returned;\n}\n\nconst isUndefined = (expression: ts.Expression): boolean =>\n (ts.isIdentifier(expression) && expression.text === \"undefined\") ||\n ts.isVoidExpression(expression);\n\nfunction typeTextEdit(expression: ts.Expression, names: FactoryNames): TextEdit[] | undefined {\n const typeText = typeTextOf(expression, names);\n if (typeText === undefined) {\n return undefined;\n }\n const start = expression.getStart();\n return [{ start, end: expression.getEnd(), text: JSON.stringify(typeText.text) }];\n}\n\n/** `{ schema: <type>, questionToken: … }`: only the `schema` value changes. */\nfunction resultObjectEdits(\n object: ts.ObjectLiteralExpression,\n names: FactoryNames,\n): TextEdit[] | undefined {\n const schema = object.properties.find(\n (property) =>\n property.name !== undefined &&\n ts.isIdentifier(property.name) &&\n property.name.text === \"schema\",\n );\n const isPlain = object.properties.every(ts.isPropertyAssignment);\n if (schema === undefined || !isPlain || !ts.isPropertyAssignment(schema)) {\n return undefined;\n }\n return typeTextEdit(schema.initializer, names);\n}\n\n/**\n * The edits that turn one returned expression into type text, or undefined when it is not one of\n * the known type-building forms. `undefined` (keep the generated type) needs no edit.\n */\nexport function returnEdits(\n expression: ts.Expression | undefined,\n names: FactoryNames,\n): TextEdit[] | undefined {\n if (expression === undefined || isUndefined(expression)) {\n return [];\n }\n if (ts.isParenthesizedExpression(expression)) {\n return returnEdits(expression.expression, names);\n }\n if (ts.isConditionalExpression(expression)) {\n const whenTrue = returnEdits(expression.whenTrue, names);\n const whenFalse = returnEdits(expression.whenFalse, names);\n return whenTrue === undefined || whenFalse === undefined\n ? undefined\n : [...whenTrue, ...whenFalse];\n }\n if (ts.isObjectLiteralExpression(expression)) {\n return resultObjectEdits(expression, names);\n }\n return typeTextEdit(expression, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { CallbackRewriter } from \"../../application/ports.js\";\nimport {\n type Change,\n type FileMigration,\n lineAt,\n type ManualStep,\n type TransformKeepReason,\n unchanged,\n} from \"../../domain/migration-findings.js\";\nimport { collectFileNames, type FileNames } from \"./file-names.js\";\nimport { returnEdits, returnedExpressions, type TextEdit } from \"./transform-returns.js\";\n\n/**\n * The CallbackRewriter port on the TypeScript 6 parser (ADR-015). In each `openapiTS(source, {…})`\n * call where `transform` is the only callback and every value it returns builds a type with\n * `ts.factory` or the helpers, the returns become TypeScript type text and `irCallbacks: true` is\n * added. Every other legacy callback is reported, not changed: it still works, with a warning.\n */\n\nconst TRANSFORM = \"transform\";\nconst LEGACY_ONLY_CALLBACKS = [\"postTransform\", \"transformProperty\"] as const;\nconst IR_CALLBACKS_OPTION = \"irCallbacks\";\n\ninterface CallFindings {\n readonly edits: TextEdit[];\n readonly changes: Change[];\n readonly manualSteps: ManualStep[];\n}\n\nconst SCRIPT_KINDS: ReadonlyMap<string, ts.ScriptKind> = new Map([\n [\".ts\", ts.ScriptKind.TS],\n [\".mts\", ts.ScriptKind.TS],\n [\".cts\", ts.ScriptKind.TS],\n [\".tsx\", ts.ScriptKind.TSX],\n [\".js\", ts.ScriptKind.JS],\n [\".mjs\", ts.ScriptKind.JS],\n [\".cjs\", ts.ScriptKind.JS],\n [\".jsx\", ts.ScriptKind.JSX],\n]);\n\n/** Single-file components (`.vue`, `.svelte`, `.astro`) are not plain scripts; they are left. */\nfunction scriptKindOf(path: string): ts.ScriptKind | undefined {\n return SCRIPT_KINDS.get(path.slice(path.lastIndexOf(\".\")));\n}\n\nfunction propertyNamed(\n options: ts.ObjectLiteralExpression,\n name: string,\n): ts.ObjectLiteralElementLike | undefined {\n return options.properties.find((property) => {\n const key = property.name;\n return (\n key !== undefined && (ts.isIdentifier(key) || ts.isStringLiteral(key)) && key.text === name\n );\n });\n}\n\n/**\n * The function a `transform` property holds: a method, an arrow function or a function, inline or\n * by the name of a module-level function.\n */\nfunction callbackFunction(\n property: ts.ObjectLiteralElementLike,\n names: FileNames,\n): ts.FunctionLikeDeclaration | undefined {\n if (ts.isMethodDeclaration(property)) {\n return property;\n }\n if (!ts.isPropertyAssignment(property)) {\n return undefined;\n }\n const value = property.initializer;\n if (ts.isIdentifier(value)) {\n return names.functions.get(value.text);\n }\n return ts.isArrowFunction(value) || ts.isFunctionExpression(value) ? value : undefined;\n}\n\n/**\n * A function named by `transform` is rewritten only when its name appears just twice in the file\n * (where it is defined, and here): other callers would get type text where they expect nodes.\n */\nfunction isSharedFunction(property: ts.ObjectLiteralElementLike, text: string): boolean {\n if (!ts.isPropertyAssignment(property) || !ts.isIdentifier(property.initializer)) {\n return false;\n }\n const name = property.initializer.text.replaceAll(\"$\", \"\\\\$\");\n const uses = text.match(new RegExp(`(?<![\\\\w$])${name}(?![\\\\w$])`, \"g\")) ?? [];\n return uses.length > 2;\n}\n\n/**\n * A declared return type names TypeScript nodes (`ts.TypeNode`), which type text does not match,\n * so it is removed and the type is inferred from the new returns.\n */\nfunction returnTypeEdits(callback: ts.FunctionLikeDeclaration, text: string): TextEdit[] {\n const type = callback.type;\n if (type === undefined) {\n return [];\n }\n const colon = text.lastIndexOf(\":\", type.getStart());\n return [{ start: colon, end: type.getEnd(), text: \"\" }];\n}\n\n/** The edits for the returns of `transform`, or the reason to keep it. */\nfunction transformEdits(\n property: ts.ObjectLiteralElementLike,\n names: FileNames,\n text: string,\n): TextEdit[] | TransformKeepReason {\n const callback = callbackFunction(property, names);\n if (callback?.body === undefined) {\n return \"not-a-function\";\n }\n if (isSharedFunction(property, text)) {\n return \"shared-function\";\n }\n const edits = returnTypeEdits(callback, text);\n for (const returned of returnedExpressions(callback.body)) {\n const returnEditList = returnEdits(returned, names);\n if (returnEditList === undefined) {\n return \"unknown-return\";\n }\n edits.push(...returnEditList);\n }\n return edits;\n}\n\n/**\n * The `irCallbacks: true` option, placed before `transform`: on its own line with the same\n * indentation when `transform` starts a line, else on the same line.\n */\nfunction irCallbacksOption(text: string, transformStart: number): string {\n const lineStart = text.lastIndexOf(\"\\n\", transformStart - 1) + 1;\n const before = text.slice(lineStart, transformStart);\n const option = `${IR_CALLBACKS_OPTION}: true,`;\n return /^\\s*$/.test(before) ? `${option}\\n${before}` : `${option} `;\n}\n\nfunction keepReason(options: ts.ObjectLiteralExpression): TransformKeepReason | undefined {\n const hasOther = LEGACY_ONLY_CALLBACKS.some((name) => propertyNamed(options, name) !== undefined);\n return hasOther ? \"other-callbacks\" : undefined;\n}\n\nfunction legacyCallbackSteps(options: ts.ObjectLiteralExpression, text: string): ManualStep[] {\n return LEGACY_ONLY_CALLBACKS.flatMap((callback) => {\n const property = propertyNamed(options, callback);\n return property === undefined\n ? []\n : [{ kind: \"legacy-callback\" as const, line: lineAt(text, property.getStart()), callback }];\n });\n}\n\n/** The findings of one `openapiTS(source, options)` call with an options object literal. */\nfunction migrateOptions(\n options: ts.ObjectLiteralExpression,\n text: string,\n names: FileNames,\n): CallFindings {\n // With irCallbacks set, the callbacks already use the IR form: nothing to migrate.\n if (propertyNamed(options, IR_CALLBACKS_OPTION) !== undefined) {\n return { edits: [], changes: [], manualSteps: [] };\n }\n const findings: CallFindings = {\n edits: [],\n changes: [],\n manualSteps: legacyCallbackSteps(options, text),\n };\n const transform = propertyNamed(options, TRANSFORM);\n if (transform === undefined) {\n return findings;\n }\n const start = transform.getStart();\n const line = lineAt(text, start);\n const result = keepReason(options) ?? transformEdits(transform, names, text);\n if (typeof result === \"string\") {\n findings.manualSteps.push({ kind: \"transform-not-rewritten\", line, reason: result });\n return findings;\n }\n findings.edits.push({ start, end: start, text: irCallbacksOption(text, start) }, ...result);\n findings.changes.push({ kind: \"transform-rewritten\", line });\n return findings;\n}\n\n/** The options object of a generator call, if it is written in place. */\nfunction generatorOptions(node: ts.Node, names: FileNames): ts.ObjectLiteralExpression | undefined {\n if (!ts.isCallExpression(node) || !ts.isIdentifier(node.expression)) {\n return undefined;\n }\n const options = node.arguments[1];\n const isGenerator = names.generatorFunctions.has(node.expression.text);\n return isGenerator && options !== undefined && ts.isObjectLiteralExpression(options)\n ? options\n : undefined;\n}\n\n/** Apply edits from the end of the text, so earlier offsets stay valid. */\nfunction applyEdits(text: string, edits: readonly TextEdit[]): string {\n return [...edits]\n .sort((left, right) => right.start - left.start)\n .reduce(\n (result, edit) => result.slice(0, edit.start) + edit.text + result.slice(edit.end),\n text,\n );\n}\n\nfunction findCallFindings(file: ts.SourceFile, text: string, names: FileNames): CallFindings {\n const all: CallFindings = { edits: [], changes: [], manualSteps: [] };\n const visit = (node: ts.Node): void => {\n const options = generatorOptions(node, names);\n if (options !== undefined) {\n const found = migrateOptions(options, text, names);\n all.edits.push(...found.edits);\n all.changes.push(...found.changes);\n all.manualSteps.push(...found.manualSteps);\n }\n ts.forEachChild(node, visit);\n };\n visit(file);\n return all;\n}\n\nclass TypescriptCallbackRewriter implements CallbackRewriter {\n rewrite(text: string, path: string): FileMigration {\n const scriptKind = scriptKindOf(path);\n if (scriptKind === undefined) {\n return unchanged(text);\n }\n const file = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, scriptKind);\n const names = collectFileNames(file);\n if (names.generatorFunctions.size === 0) {\n return unchanged(text);\n }\n const { edits, changes, manualSteps } = findCallFindings(file, text, names);\n return { text: applyEdits(text, edits), changes, manualSteps };\n }\n}\n\n/** A callback rewriter that parses each file with the TypeScript 6 parser. */\nexport function createTypescriptCallbackRewriter(): CallbackRewriter {\n return new TypescriptCallbackRewriter();\n}\n","/**\n * What the migration renames (ENGINEERING_PLAN 10.1). openapi-typesafe is a drop-in successor, so\n * moving a project is a matter of names: packages, the CLI command and a few renamed CLI flags.\n */\n\n/** Original package name → openapi-typesafe package name. */\nexport const PACKAGE_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"openapi-typescript\", \"openapi-typesafe\"],\n [\"openapi-fetch\", \"openapi-typesafe-fetch\"],\n [\"openapi-react-query\", \"openapi-typesafe-react-query\"],\n [\"openapi-typescript-helpers\", \"openapi-typesafe-helpers\"],\n]);\n\n/** The generator's command, as package.json scripts and shell lines run it. */\nexport const GENERATOR_COMMAND = \"openapi-typescript\";\nexport const MIGRATED_GENERATOR_COMMAND = \"openapi-typesafe\";\n\n/**\n * Flags that openapi-typescript 6 and 7 renamed; the openapi-typesafe CLI rejects the old spelling\n * with CLI_FLAG_REMOVED, so the migration writes the new one.\n */\nexport const FLAG_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"--immutable-types\", \"--immutable\"],\n [\"-it\", \"--immutable\"],\n [\"--support-array-length\", \"--array-length\"],\n [\"--redoc\", \"--redocly\"],\n [\"-ap\", \"--additional-properties\"],\n]);\n\n/** The dependency fields of package.json that install packages, in the order npm documents them. */\nexport const DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"peerDependencies\",\n \"optionalDependencies\",\n] as const;\n\nexport type DependencyField = (typeof DEPENDENCY_FIELDS)[number];\n\n/** Fields that can name a package without installing it; they are reported, not rewritten. */\nexport const OVERRIDE_FIELDS = [\"overrides\", \"resolutions\", \"pnpm\"] as const;\n","import type { Change, ManualStep } from \"./migration-findings.js\";\nimport { FLAG_RENAMES, GENERATOR_COMMAND, MIGRATED_GENERATOR_COMMAND } from \"./package-names.js\";\n\n/**\n * The generator command in a script or shell line. It counts only as a whole word that starts a\n * command or follows white space or shell punctuation, so `node_modules/openapi-typescript/...`\n * and `openapi-typescript-helpers` are left alone.\n */\nconst COMMAND_RE = new RegExp(`(?<=^|[\\\\s\"'\\`;&|(])${GENERATOR_COMMAND}(?=$|[\\\\s\"'\\`;&|)])`, \"g\");\n/** `openapi-typescript@7` pins the old package for npx; a new version cannot be guessed. */\nconst VERSIONED_COMMAND_RE = new RegExp(`(?<=^|[\\\\s\"'\\`;&|(])${GENERATOR_COMMAND}@`);\nconst MIGRATED_COMMAND_RE = new RegExp(\n `(?<=^|[\\\\s\"'\\`;&|(])${MIGRATED_GENERATOR_COMMAND}(?=$|[\\\\s\"'\\`;&|)])`,\n);\nconst FLAG_RE = new RegExp(`(?<=\\\\s)(${[...FLAG_RENAMES.keys()].join(\"|\")})(?=$|[\\\\s=])`, \"g\");\n\n/** One command line or script after the migration. */\nexport interface CommandMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\nfunction renameFlags(text: string, location: string, changes: Change[]): string {\n if (!MIGRATED_COMMAND_RE.test(text)) {\n return text;\n }\n return text.replace(FLAG_RE, (flag) => {\n const renamed = FLAG_RENAMES.get(flag) as string;\n changes.push({ kind: \"flag-renamed\", location, from: flag, to: renamed });\n return renamed;\n });\n}\n\n/**\n * Rename the generator command in one script or line, and then the renamed flags of that command.\n * `location` names the place for the report (a script name, or `file:line`).\n */\nexport function migrateCommand(text: string, location: string): CommandMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n if (VERSIONED_COMMAND_RE.test(text)) {\n manualSteps.push({ kind: \"versioned-command\", location });\n }\n const renamed = text.replace(COMMAND_RE, () => {\n changes.push({ kind: \"command-renamed\", location });\n return MIGRATED_GENERATOR_COMMAND;\n });\n return { text: renameFlags(renamed, location, changes), changes, manualSteps };\n}\n\n/** Every line of a shell script, CI workflow or Makefile, through `migrateCommand`. */\nexport function migrateCommandLines(text: string, file: string): CommandMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n const lines = text.split(\"\\n\").map((line, index) => {\n const migrated = migrateCommand(line, `${file}:${index + 1}`);\n changes.push(...migrated.changes);\n manualSteps.push(...migrated.manualSteps);\n return migrated.text;\n });\n return { text: lines.join(\"\\n\"), changes, manualSteps };\n}\n","import { PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * Override, resolution and patch keys name a package with a path or a version around it:\n * `app>openapi-fetch` (pnpm), `**\\/openapi-fetch` (Yarn), `openapi-fetch@0.13` (pnpm, npm).\n * Matching the name as a substring took `openapi-typescript-helpers` for `openapi-typescript` too.\n */\n\nconst PARENT_SEPARATOR = \">\";\nconst PATH_SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\n\n/** The package a key targets: the last parent and path segment, without a version. */\nexport function overrideTarget(key: string): string {\n const child = key.split(PARENT_SEPARATOR).at(-1) ?? key;\n const segments = child.split(PATH_SEPARATOR);\n const isScoped = segments.length > 1 && segments.at(-2)?.startsWith(SCOPE_PREFIX) === true;\n const name = isScoped ? segments.slice(-2).join(PATH_SEPARATOR) : (segments.at(-1) ?? child);\n const versionAt = name.indexOf(SCOPE_PREFIX, 1);\n return versionAt === -1 ? name : name.slice(0, versionAt);\n}\n\nfunction keysOf(value: unknown): string[] {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return [];\n }\n return Object.entries(value).flatMap(([key, nested]) => [key, ...keysOf(nested)]);\n}\n\n/** The original packages that keys of `value`, at any depth, target; each once, in key order. */\nexport function overriddenPackages(value: unknown): string[] {\n const targets = keysOf(value).map(overrideTarget);\n return [...new Set(targets.filter((target) => PACKAGE_RENAMES.has(target)))];\n}\n","/**\n * The version spec a renamed dependency gets. A plain version or range keeps its style (`^`, `~`\n * or exact) and gets the openapi-typesafe version; `catalog:` and `workspace:` stay, because they\n * point elsewhere; anything else (a tag, a URL, a file or an npm alias) is kept and reported.\n */\n\nconst VERSION_STYLE_RE = /^([\\^~]|>=)?\\d/;\nconst KEPT_PROTOCOLS = [\"catalog:\", \"workspace:\"] as const;\n\nexport type SpecDecision =\n | { readonly kind: \"replaced\"; readonly spec: string }\n | { readonly kind: \"kept\"; readonly spec: string; readonly isReported: boolean };\n\n/** The new spec for a renamed dependency whose old spec was `spec`. */\nexport function migrateVersionSpec(spec: string, version: string): SpecDecision {\n if (KEPT_PROTOCOLS.some((protocol) => spec.startsWith(protocol))) {\n return { kind: \"kept\", spec, isReported: false };\n }\n const style = VERSION_STYLE_RE.exec(spec);\n if (style === null) {\n return { kind: \"kept\", spec, isReported: true };\n }\n // `>=` means \"this or newer\"; with a new package line, a caret range says the same safely.\n const prefix = style[1] === \">=\" ? \"^\" : (style[1] ?? \"\");\n return { kind: \"replaced\", spec: `${prefix}${version}` };\n}\n","import { migrateCommand } from \"./command-migration.js\";\nimport {\n type Change,\n type FileMigration,\n type ManualStep,\n unchanged,\n} from \"./migration-findings.js\";\nimport { overriddenPackages } from \"./override-targets.js\";\nimport { DEPENDENCY_FIELDS, OVERRIDE_FIELDS, PACKAGE_RENAMES } from \"./package-names.js\";\nimport { migrateVersionSpec } from \"./version-spec.js\";\n\ntype JsonObject = Record<string, unknown>;\n\ninterface Findings {\n readonly changes: Change[];\n readonly manualSteps: ManualStep[];\n}\n\nconst INDENT_RE = /^[ \\t]+(?=\")/m;\nconst DEFAULT_INDENT = \" \";\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** The manifest as written again: same indentation, and a final newline only if it had one. */\nfunction formatLike(original: string, manifest: JsonObject): string {\n const indent = INDENT_RE.exec(original)?.[0] ?? DEFAULT_INDENT;\n const ending = original.endsWith(\"\\n\") ? \"\\n\" : \"\";\n return `${JSON.stringify(manifest, null, indent)}${ending}`;\n}\n\nfunction renameDependencies(\n field: string,\n dependencies: JsonObject,\n version: string,\n findings: Findings,\n): JsonObject {\n // Rebuilt key by key, so a renamed dependency keeps its place in the list.\n return Object.fromEntries(\n Object.entries(dependencies).map(([name, spec]) => {\n const renamed = PACKAGE_RENAMES.get(name);\n if (renamed === undefined || typeof spec !== \"string\") {\n return [name, spec];\n }\n const decision = migrateVersionSpec(spec, version);\n findings.changes.push({\n kind: \"dependency-renamed\",\n field,\n from: name,\n to: renamed,\n spec: decision.spec,\n });\n if (decision.kind === \"kept\" && decision.isReported) {\n findings.manualSteps.push({ kind: \"spec-kept\", name: renamed, spec });\n }\n if (field === \"peerDependencies\") {\n findings.manualSteps.push({ kind: \"peer-dependency-renamed\", name: renamed });\n }\n return [renamed, decision.spec];\n }),\n );\n}\n\nfunction migrateScripts(scripts: JsonObject, findings: Findings): JsonObject {\n return Object.fromEntries(\n Object.entries(scripts).map(([name, script]) => {\n if (typeof script !== \"string\") {\n return [name, script];\n }\n const migrated = migrateCommand(script, `scripts.${name}`);\n findings.changes.push(...migrated.changes);\n findings.manualSteps.push(...migrated.manualSteps);\n return [name, migrated.text];\n }),\n );\n}\n\n/** Overrides and resolutions can pin the old packages; changing them needs the user's intent. */\nfunction reportOverrides(manifest: JsonObject, findings: Findings): void {\n for (const field of OVERRIDE_FIELDS) {\n for (const name of overriddenPackages(manifest[field])) {\n findings.manualSteps.push({ kind: \"override-names-package\", field, name });\n }\n }\n}\n\nfunction migrateFields(manifest: JsonObject, version: string, findings: Findings): JsonObject {\n const migrated: JsonObject = { ...manifest };\n for (const field of DEPENDENCY_FIELDS) {\n const dependencies = manifest[field];\n if (isObject(dependencies)) {\n migrated[field] = renameDependencies(field, dependencies, version, findings);\n }\n }\n if (isObject(manifest.scripts)) {\n migrated.scripts = migrateScripts(manifest.scripts, findings);\n }\n reportOverrides(manifest, findings);\n return migrated;\n}\n\n/**\n * Migrate a package.json: rename the original packages in the dependency fields (with\n * `version` as the new version), rename the generator command and its renamed flags in scripts,\n * and report overrides that name the original packages. Text that is not a JSON object is left.\n */\nexport function migratePackageManifest(text: string, version: string): FileMigration {\n let manifest: unknown;\n try {\n manifest = JSON.parse(text);\n } catch (error) {\n // A package.json that does not parse is not ours to fix; the user is told where it is.\n const reason = error instanceof Error ? error.message : String(error);\n return { ...unchanged(text), manualSteps: [{ kind: \"manifest-unreadable\", reason }] };\n }\n if (!isObject(manifest)) {\n return unchanged(text);\n }\n const findings: Findings = { changes: [], manualSteps: [] };\n const migrated = migrateFields(manifest, version, findings);\n const isChanged = findings.changes.length > 0;\n return { text: isChanged ? formatLike(text, migrated) : text, ...findings };\n}\n","import { type Change, type FileMigration, lineAt, type ManualStep } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * Module specifiers in source files: `\"openapi-fetch\"` and `'openapi-fetch/subpath'` in\n * imports, `require()`, `import()`, `vi.mock()`, `declare module` and tool configs alike. Only a\n * whole quoted string that is exactly a package name, or a name and a subpath, is renamed, so\n * text that merely mentions a package (comments, `@scope/openapi-fetch`, `openapi-fetch-gen`)\n * stays.\n */\nconst SPECIFIER_RE = new RegExp(\n `([\"'\\`])(${[...PACKAGE_RENAMES.keys()].join(\"|\")})(/[^\"'\\`\\\\s]*)?\\\\1`,\n \"g\",\n);\n\n/** Source file extensions whose text can hold module specifiers. */\nexport const SOURCE_EXTENSIONS: ReadonlySet<string> = new Set([\n \".ts\",\n \".tsx\",\n \".mts\",\n \".cts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".vue\",\n \".svelte\",\n \".astro\",\n]);\n\n/** Rename the original packages in the module specifiers of one source file. */\nexport function migrateModuleSpecifiers(text: string): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n let migrated = \"\";\n let copiedUpTo = 0;\n for (const match of text.matchAll(SPECIFIER_RE)) {\n const [whole, quote, name, subpath] = match as unknown as [string, string, string, string?];\n const line = lineAt(text, match.index);\n const to = `${PACKAGE_RENAMES.get(name) as string}${subpath ?? \"\"}`;\n changes.push({ kind: \"specifier-renamed\", line, from: whole.slice(1, -1), to });\n // A deep import reaches into the package's files, whose layout is not part of the contract.\n if (subpath !== undefined) {\n manualSteps.push({ kind: \"deep-import\", line, specifier: to });\n }\n migrated += `${text.slice(copiedUpTo, match.index)}${quote}${to}${quote}`;\n copiedUpTo = match.index + whole.length;\n }\n return { text: migrated + text.slice(copiedUpTo), changes, manualSteps };\n}\n","import {\n type Change,\n type FileMigration,\n type ManualStep,\n unchanged,\n} from \"./migration-findings.js\";\nimport { overriddenPackages } from \"./override-targets.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { migrateVersionSpec } from \"./version-spec.js\";\n\n/**\n * pnpm catalogs (`pnpm-workspace.yaml`): a project whose package.json says `\"openapi-fetch\":\n * \"catalog:\"` keeps its version here. The file is edited line by line, not parsed and written\n * again, so comments and formatting stay. Only entries under `catalog:` or `catalogs:` are renamed;\n * `overrides:` and `patchedDependencies:` entries that name an original package are reported, like\n * the same fields of package.json.\n */\n\n/** ` openapi-fetch: ^0.13.1`, ` \"openapi-fetch\": \"0.13\"`; groups: indent, quote, name, spec. */\nconst ENTRY_RE = /^(\\s+)([\"']?)([\\w@./-]+)\\2:\\s*([\"']?)([^\"'#\\s]+)\\4(.*)$/;\nconst TOP_LEVEL_KEY_RE = /^([\\w-]+):/;\n/** ` \"app>openapi-fetch\": 1.0.0`; groups: quote, key. */\nconst KEY_RE = /^\\s+([\"']?)(.+?)\\1:(?:\\s|$)/;\nconst CATALOG_SECTIONS: ReadonlySet<string> = new Set([\"catalog\", \"catalogs\"]);\nconst REPORTED_SECTIONS: ReadonlySet<string> = new Set([\"overrides\", \"patchedDependencies\"]);\n\ninterface LineResult {\n readonly line: string;\n readonly change?: Change;\n readonly manualStep?: ManualStep;\n}\n\nfunction migrateEntry(line: string, version: string): LineResult {\n const entry = ENTRY_RE.exec(line);\n const renamed = entry === null ? undefined : PACKAGE_RENAMES.get(entry[3] as string);\n if (entry === null || renamed === undefined) {\n return { line };\n }\n const [, indent, keyQuote, name, specQuote, spec, rest] = entry as unknown as string[];\n const decision = migrateVersionSpec(spec as string, version);\n const key = `${keyQuote}${renamed}${keyQuote}`;\n const migrated = `${indent}${key}: ${specQuote}${decision.spec}${specQuote}${rest}`;\n const change: Change = { kind: \"catalog-entry-renamed\", from: name as string, to: renamed };\n if (decision.kind === \"kept\" && decision.isReported) {\n return {\n line: migrated,\n change,\n manualStep: { kind: \"spec-kept\", name: renamed, spec: spec as string },\n };\n }\n return { line: migrated, change };\n}\n\n/** The manual step for an override or patch entry that names an original package. */\nfunction reportEntry(line: string, field: string): ManualStep[] {\n const key = KEY_RE.exec(line)?.[2];\n return key === undefined\n ? []\n : overriddenPackages({ [key]: null }).map((name) => ({\n kind: \"override-names-package\",\n field,\n name,\n }));\n}\n\n/** Rename the original packages in the catalogs of a pnpm-workspace.yaml; report its overrides. */\nexport function migrateWorkspaceCatalogs(text: string, version: string): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n let section: string | undefined;\n const lines = text.split(\"\\n\").map((line) => {\n const topLevelKey = TOP_LEVEL_KEY_RE.exec(line)?.[1];\n if (topLevelKey !== undefined) {\n section = topLevelKey;\n return line;\n }\n if (section !== undefined && REPORTED_SECTIONS.has(section)) {\n manualSteps.push(...reportEntry(line, section));\n return line;\n }\n if (section === undefined || !CATALOG_SECTIONS.has(section)) {\n return line;\n }\n const result = migrateEntry(line, version);\n changes.push(...(result.change ? [result.change] : []));\n manualSteps.push(...(result.manualStep ? [result.manualStep] : []));\n return result.line;\n });\n return changes.length === 0\n ? { ...unchanged(text), manualSteps }\n : { text: lines.join(\"\\n\"), changes, manualSteps };\n}\n","import { migrateCommandLines } from \"../domain/command-migration.js\";\nimport { migratePackageManifest } from \"../domain/manifest-migration.js\";\nimport type { Change, FileMigration, ManualStep } from \"../domain/migration-findings.js\";\nimport { migrateModuleSpecifiers, SOURCE_EXTENSIONS } from \"../domain/source-migration.js\";\nimport { migrateWorkspaceCatalogs } from \"../domain/workspace-catalog-migration.js\";\nimport type { CallbackRewriter } from \"./ports.js\";\n\n/** What a migration of one kind of file needs besides the text. */\nexport interface MigrationContext {\n readonly version: string;\n readonly rewriter: CallbackRewriter;\n}\n\n/** One kind of file the migration knows, and how to migrate it. */\ninterface FileKind {\n readonly matches: (path: string) => boolean;\n readonly migrate: (text: string, path: string, context: MigrationContext) => FileMigration;\n}\n\nconst SCRIPT_EXTENSIONS: ReadonlySet<string> = new Set([\".sh\", \".bash\", \".zsh\", \".yml\", \".yaml\"]);\nconst SCRIPT_NAMES: ReadonlySet<string> = new Set([\"Makefile\", \"justfile\", \"Dockerfile\"]);\nconst WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst MANIFEST_FILE = \"package.json\";\n/** The package manager writes these again on install; their entries are not commands. */\nconst LOCK_FILES: ReadonlySet<string> = new Set([\"pnpm-lock.yaml\", \"yarn.lock\", \"bun.lock\"]);\n\nfunction baseName(path: string): string {\n return path.slice(path.lastIndexOf(\"/\") + 1);\n}\n\nfunction extensionOf(path: string): string {\n const name = baseName(path);\n const dot = name.lastIndexOf(\".\");\n return dot <= 0 ? \"\" : name.slice(dot);\n}\n\n/** Two migrations of the same text, one after the other, with their findings joined. */\nfunction chain(first: FileMigration, next: (text: string) => FileMigration): FileMigration {\n const second = next(first.text);\n const changes: Change[] = [...first.changes, ...second.changes];\n const manualSteps: ManualStep[] = [...first.manualSteps, ...second.manualSteps];\n return { text: second.text, changes, manualSteps };\n}\n\n/** The kinds in order; the first that matches a path migrates it. */\nconst FILE_KINDS: readonly FileKind[] = [\n {\n matches: (path) => baseName(path) === MANIFEST_FILE,\n migrate: (text, _path, context) => migratePackageManifest(text, context.version),\n },\n {\n matches: (path) => baseName(path) === WORKSPACE_FILE,\n migrate: (text, _path, context) => migrateWorkspaceCatalogs(text, context.version),\n },\n {\n matches: (path) => SOURCE_EXTENSIONS.has(extensionOf(path)),\n migrate: (text, path, context) =>\n chain(migrateModuleSpecifiers(text), (renamed) => context.rewriter.rewrite(renamed, path)),\n },\n {\n matches: (path) => SCRIPT_EXTENSIONS.has(extensionOf(path)) || SCRIPT_NAMES.has(baseName(path)),\n migrate: (text, path) => migrateCommandLines(text, path),\n },\n];\n\n/** The migration for a file, or undefined when the migration does not read that kind of file. */\nexport function fileMigrationFor(path: string): FileKind[\"migrate\"] | undefined {\n if (LOCK_FILES.has(baseName(path))) {\n return undefined;\n }\n return FILE_KINDS.find((kind) => kind.matches(path))?.migrate;\n}\n","import type { Change, ManualStep } from \"../domain/migration-findings.js\";\nimport { fileMigrationFor, type MigrationContext } from \"./file-migrations.js\";\nimport type { CallbackRewriter, Logger, ProjectFiles } from \"./ports.js\";\n\nexport interface MigrateProjectDependencies {\n readonly files: ProjectFiles;\n readonly rewriter: CallbackRewriter;\n readonly logger: Logger;\n}\n\nexport interface MigrateProjectInput {\n /** The openapi-typesafe version that renamed dependencies get. */\n readonly version: string;\n /** Write the changed files; without it the migration only reports (dry run). */\n readonly isWrite: boolean;\n}\n\n/** What the migration found in one file. */\nexport interface FileReport {\n readonly path: string;\n readonly isChanged: boolean;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\nasync function migrateFile(\n path: string,\n dependencies: MigrateProjectDependencies,\n input: MigrateProjectInput,\n): Promise<FileReport | undefined> {\n const migrate = fileMigrationFor(path);\n if (migrate === undefined) {\n return undefined;\n }\n const text = await dependencies.files.read(path);\n const context: MigrationContext = { version: input.version, rewriter: dependencies.rewriter };\n const migration = migrate(text, path, context);\n const isChanged = migration.text !== text;\n if (isChanged && input.isWrite) {\n await dependencies.files.write(path, migration.text);\n }\n const { changes, manualSteps } = migration;\n if (isChanged || manualSteps.length > 0) {\n dependencies.logger.info(\"file_migrated\", { path, isChanged, changes, manualSteps });\n }\n return { path, isChanged, changes, manualSteps };\n}\n\n/**\n * Migrate every file of a project (ENGINEERING_PLAN 10.1): package.json files, pnpm catalogs,\n * module specifiers and `transform` callbacks in sources, and the generator command in scripts.\n * Writes only with `isWrite`. Returns the files with changes or manual steps, in path order.\n */\nexport async function migrateProject(\n dependencies: MigrateProjectDependencies,\n input: MigrateProjectInput,\n): Promise<FileReport[]> {\n const paths = (await dependencies.files.listFiles()).sort();\n dependencies.logger.info(\"migration_started\", { fileCount: paths.length, ...input });\n const reports: FileReport[] = [];\n for (const path of paths) {\n const report = await migrateFile(path, dependencies, input);\n if (report !== undefined && (report.isChanged || report.manualSteps.length > 0)) {\n reports.push(report);\n }\n }\n dependencies.logger.info(\"migration_finished\", { changedFiles: reports.length });\n return reports;\n}\n","/** Compile-time proof that a switch over a closed union handled every variant. */\nexport function assertNever(value: never): never {\n throw new Error(`Unexpected variant: ${JSON.stringify(value)}`);\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { Change, ManualStep, TransformKeepReason } from \"../domain/migration-findings.js\";\n\n/** The user-facing text of the report (CODING_PRINCIPLES 7.8: kept apart from the logic). */\n\n// The same guide the generator links in its deprecation warning.\nconst IR_CALLBACKS_GUIDE =\n \"https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks\";\n\nexport function changeMessage(change: Change): string {\n switch (change.kind) {\n case \"dependency-renamed\":\n return `${change.field}: ${change.from} → ${change.to}@${change.spec}`;\n case \"catalog-entry-renamed\":\n return `catalog: ${change.from} → ${change.to}`;\n case \"command-renamed\":\n return `${change.location}: openapi-typescript → openapi-typesafe`;\n case \"flag-renamed\":\n return `${change.location}: ${change.from} → ${change.to}`;\n case \"specifier-renamed\":\n return `line ${change.line}: \"${change.from}\" → \"${change.to}\"`;\n case \"transform-rewritten\":\n return `line ${change.line}: transform returns type text; irCallbacks: true added`;\n default:\n return assertNever(change);\n }\n}\n\nconst KEEP_REASONS: Readonly<Record<TransformKeepReason, string>> = {\n \"other-callbacks\":\n \"postTransform or transformProperty are set too, and they need TypeScript nodes\",\n \"not-a-function\": \"it is not an inline function or a function of this file\",\n \"shared-function\": \"the function it names is used elsewhere too\",\n \"unknown-return\": \"a return value is not a plain ts.factory type\",\n};\n\nconst PEER_NOTE = \"users of this package must switch too (a breaking change for them)\";\nconst PINNED_NOTE = \"change it to openapi-typesafe@<version>\";\nconst DEEP_IMPORT_NOTE = \"imports a file inside the package; check that it exists\";\nconst KEPT_NOTE = `it works, with a deprecation warning. See ${IR_CALLBACKS_GUIDE}`;\nconst LEGACY_CALLBACK_NOTE = `receives TypeScript nodes (deprecated). See ${IR_CALLBACKS_GUIDE}`;\n\nexport function manualStepMessage(step: ManualStep): string {\n switch (step.kind) {\n case \"manifest-unreadable\":\n return `package.json is not valid JSON (${step.reason}); migrate it by hand`;\n case \"peer-dependency-renamed\":\n return `${step.name} is a peer dependency: ${PEER_NOTE}`;\n case \"spec-kept\":\n return `${step.name} kept the spec \"${step.spec}\": point it at an openapi-typesafe version`;\n case \"override-names-package\":\n return `\"${step.field}\" names ${step.name}: update or remove that override`;\n case \"versioned-command\":\n return `${step.location} runs a pinned openapi-typescript@<version>: ${PINNED_NOTE}`;\n case \"deep-import\":\n return `line ${step.line}: \"${step.specifier}\" ${DEEP_IMPORT_NOTE}`;\n case \"transform-not-rewritten\":\n return `line ${step.line}: transform kept (${KEEP_REASONS[step.reason]}); ${KEPT_NOTE}`;\n case \"legacy-callback\":\n return `line ${step.line}: ${step.callback} ${LEGACY_CALLBACK_NOTE}`;\n default:\n return assertNever(step);\n }\n}\n\nexport const NEXT_STEPS: readonly string[] = [\n \"Install: run your package manager's install, so the lockfile has the new packages.\",\n \"Regenerate your types and commit them once: the file header names openapi-typesafe now, \" +\n \"so `--check` fails until you do.\",\n \"Run your type check and tests.\",\n];\n\nexport const DRY_RUN_NOTE = \"Dry run: nothing was written. Run again with --write to apply.\";\nexport const WRITTEN_NOTE = \"Files were written.\";\nexport const NOTHING_FOUND =\n \"Nothing to migrate: no openapi-typescript, openapi-fetch, openapi-react-query \" +\n \"or openapi-typescript-helpers found.\";\n","import {\n changeMessage,\n DRY_RUN_NOTE,\n manualStepMessage,\n NEXT_STEPS,\n NOTHING_FOUND,\n WRITTEN_NOTE,\n} from \"./messages.js\";\nimport type { FileReport } from \"./migrate-project.js\";\n\nfunction changesSection(reports: readonly FileReport[]): string[] {\n const changed = reports.filter((report) => report.changes.length > 0);\n if (changed.length === 0) {\n return [];\n }\n return [\n \"Changes:\",\n ...changed.flatMap((report) => [\n ` ${report.path}`,\n ...report.changes.map((change) => ` ${changeMessage(change)}`),\n ]),\n \"\",\n ];\n}\n\nfunction manualStepsSection(reports: readonly FileReport[]): string[] {\n const steps = reports.flatMap((report) =>\n report.manualSteps.map((step) => ` ${report.path}: ${manualStepMessage(step)}`),\n );\n return steps.length === 0 ? [] : [\"Manual steps:\", ...steps, \"\"];\n}\n\n/** The summary the command prints: changes per file, manual steps, and what to do next. */\nexport function renderReport(reports: readonly FileReport[], isWrite: boolean): string {\n if (reports.length === 0) {\n return `${NOTHING_FOUND}\\n`;\n }\n const lines = [\n ...changesSection(reports),\n ...manualStepsSection(reports),\n \"Next steps:\",\n ...NEXT_STEPS.map((step, index) => ` ${index + 1}. ${step}`),\n \"\",\n isWrite ? WRITTEN_NOTE : DRY_RUN_NOTE,\n ];\n return `${lines.join(\"\\n\")}\\n`;\n}\n","import { parseArgs } from \"node:util\";\n\n/** What the command was asked to do. */\nexport type CliRequest =\n | { readonly kind: \"help\" }\n | { readonly kind: \"version\" }\n | {\n readonly kind: \"migrate\";\n readonly isWrite: boolean;\n readonly root: string | undefined;\n readonly logPath: string | undefined;\n };\n\nconst OPTIONS = {\n write: { type: \"boolean\" },\n root: { type: \"string\" },\n log: { type: \"string\" },\n help: { type: \"boolean\", short: \"h\" },\n version: { type: \"boolean\", short: \"v\" },\n} as const;\n\n/** Parse the arguments; unknown options and positionals throw a TypeError with Node's message. */\nexport function parseCliArguments(argv: readonly string[]): CliRequest {\n const { values } = parseArgs({ args: [...argv], options: OPTIONS, strict: true });\n if (values.help === true) {\n return { kind: \"help\" };\n }\n if (values.version === true) {\n return { kind: \"version\" };\n }\n return {\n kind: \"migrate\",\n isWrite: values.write === true,\n root: values.root,\n logPath: values.log,\n };\n}\n","/** The command's own text: help, usage errors and the closing notes. */\n\nexport const HELP_TEXT = `Usage\n openapi-typesafe-migrate [options]\n\nMove a project from openapi-typescript, openapi-fetch, openapi-react-query and\nopenapi-typescript-helpers to the openapi-typesafe packages. Without --write it only reports.\n\nOptions\n --write Write the changes (default: dry run)\n --root <dir> The project directory (default: the current directory)\n --log <file> The JSON Lines log file (default: a new file in the temporary directory)\n --help, -h Show this help\n --version, -v Show the version\n\nExit codes\n 0 Done\n 1 The migration failed (the message and the log say why)\n 2 Unknown option or argument\n`;\n\nexport const usageError = (message: string): string =>\n `${message}\\nRun openapi-typesafe-migrate --help for the options.\\n`;\n\nexport const logNote = (path: string): string => `Log: ${path}\\n`;\n","import { migrateProject } from \"../application/migrate-project.js\";\nimport type { CallbackRewriter, Logger, ProjectFiles } from \"../application/ports.js\";\nimport { renderReport } from \"../application/report.js\";\nimport { type CliRequest, parseCliArguments } from \"./cli-arguments.js\";\nimport { HELP_TEXT, logNote, usageError } from \"./cli-text.js\";\n\n/** Everything the command takes from the process, so tests run it with fakes. */\nexport interface CliDependencies {\n readonly version: string;\n readonly cwd: string;\n readonly writeStdout: (text: string) => void;\n readonly writeStderr: (text: string) => void;\n readonly createFiles: (root: string) => ProjectFiles;\n readonly createLogger: (path: string | undefined) => {\n readonly logger: Logger;\n readonly path: string;\n };\n readonly rewriter: CallbackRewriter;\n readonly resolvePath: (cwd: string, path: string) => string;\n}\n\nexport const EXIT_CODES = { success: 0, failure: 1, usage: 2 } as const;\n\nfunction parseRequest(\n argv: readonly string[],\n dependencies: CliDependencies,\n): CliRequest | undefined {\n try {\n return parseCliArguments(argv);\n } catch (error) {\n // parseArgs reports unknown options and stray positionals as a TypeError.\n if (error instanceof TypeError) {\n dependencies.writeStderr(usageError(error.message));\n return undefined;\n }\n throw error;\n }\n}\n\nasync function runMigration(\n request: Extract<CliRequest, { kind: \"migrate\" }>,\n dependencies: CliDependencies,\n): Promise<number> {\n const root = dependencies.resolvePath(dependencies.cwd, request.root ?? \".\");\n const { logger, path } = dependencies.createLogger(request.logPath);\n try {\n const files = dependencies.createFiles(root);\n const input = { version: dependencies.version, isWrite: request.isWrite };\n const reports = await migrateProject({ files, rewriter: dependencies.rewriter, logger }, input);\n dependencies.writeStdout(renderReport(reports, request.isWrite));\n return EXIT_CODES.success;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.warn(\"migration_failed\", { root, message });\n dependencies.writeStderr(`${message}\\n`);\n return EXIT_CODES.failure;\n } finally {\n dependencies.writeStdout(logNote(path));\n }\n}\n\n/** Run the command; resolves to the exit code. */\nexport async function runCli(\n argv: readonly string[],\n dependencies: CliDependencies,\n): Promise<number> {\n const request = parseRequest(argv, dependencies);\n if (request === undefined) {\n return EXIT_CODES.usage;\n }\n if (request.kind === \"help\") {\n dependencies.writeStdout(HELP_TEXT);\n return EXIT_CODES.success;\n }\n if (request.kind === \"version\") {\n dependencies.writeStdout(`${dependencies.version}\\n`);\n return EXIT_CODES.success;\n }\n return runMigration(request, dependencies);\n}\n","import { readFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\nimport { createJsonLinesLogger } from \"../adapters/json-lines-logger/json-lines-logger.js\";\nimport { createNodeProjectFiles } from \"../adapters/node-project-files/node-project-files.js\";\nimport { createTypescriptCallbackRewriter } from \"../adapters/typescript-parser/rewriter.js\";\nimport { type CliDependencies, runCli } from \"./run-cli.js\";\n\n/**\n * The composition root: the only module that touches the process. `bin/migrate.js` imports the\n * built copy of this module.\n */\n\n/** The same path from `src/cli/` and from the built `dist/cli/`. */\nconst PACKAGE_JSON = new URL(\"../../package.json\", import.meta.url);\nconst LOG_DIRECTORY = \"openapi-typesafe-migrate\";\n\nfunction readVersion(): string {\n const packageJson: { version: string } = JSON.parse(readFileSync(PACKAGE_JSON, \"utf8\"));\n return packageJson.version;\n}\n\nconst now = (): Date => new Date();\n\n/** Without `--log`, a new file per run in the temporary directory, named by its UTC start time. */\nfunction createLogger(path: string | undefined): ReturnType<CliDependencies[\"createLogger\"]> {\n const logPath =\n path === undefined\n ? join(tmpdir(), LOG_DIRECTORY, `${now().toISOString().replaceAll(\":\", \"-\")}.jsonl`)\n : resolve(path);\n return { logger: createJsonLinesLogger({ path: logPath, now }), path: logPath };\n}\n\nconst dependencies: CliDependencies = {\n version: readVersion(),\n cwd: process.cwd(),\n writeStdout: (text) => process.stdout.write(text),\n writeStderr: (text) => process.stderr.write(text),\n createFiles: createNodeProjectFiles,\n createLogger,\n rewriter: createTypescriptCallbackRewriter(),\n resolvePath: resolve,\n};\n\nrunCli(process.argv.slice(2), dependencies).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"names":[],"mappings":";;;;;;;AAiBA,MAAM,eAAA,CAAkC;AAAA,EAC7B,QAAA;AAAA,EAET,YAAY,OAAA,EAAiC;AAC3C,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAChB,IAAA,SAAA,CAAU,QAAQ,OAAA,CAAQ,IAAI,GAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAAA,EACtD;AAAA,EAEA,IAAA,CAAK,KAAA,EAAe,MAAA,GAA4C,EAAC,EAAS;AACxE,IAAA,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,KAAA,EAAO,MAAM,CAAA;AAAA,EACpC;AAAA,EAEA,IAAA,CAAK,KAAA,EAAe,MAAA,GAA4C,EAAC,EAAS;AACxE,IAAA,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,KAAA,EAAO,MAAM,CAAA;AAAA,EACpC;AAAA,EAEA,OAAA,CAAQ,KAAA,EAAc,KAAA,EAAe,MAAA,EAAiD;AACpF,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,QAAA,CAAS,GAAA,GAAM,WAAA,EAAY;AAC7C,IAAA,cAAA,CAAe,IAAA,CAAK,QAAA,CAAS,IAAA,EAAM,CAAA,EAAG,IAAA,CAA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SAAS,WAAA,EAAY;AAAA,EACrB,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,EACjB,aAAa,CAAC,IAAA,KAAS,OAAA,CAAQ,MAAA,CAAO,MAAM,IAAI,CAAA;AAAA,EAChD,aAAa,CAAC,IAAA,KAAS,OAAA,CAAQ,MAAA,CAAO,MAAM,IAAI,CAAA;AAAA,EAChD,WAAA,EAAa,sBAAA;AAAA,EACb,YAAA;AAAA,EACA,UAAU,gCAAA,EAAiC;AAAA,EAC3C,WAAA,EAAa;AACf,CAAA;AAEA,MAAA,CAAO,OAAA,CAAQ,KAAK,KAAA,CAAM,CAAC,GAAG,YAAY,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,KAAa;AAC7D,EAAA,OAAA,CAAQ,QAAA,GAAW,QAAA;AACrB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"main.mjs","sources":["../../src/adapters/git-file-list/git-locations.ts","../../src/adapters/git-file-list/git-process.ts","../../src/adapters/git-file-list/git-file-list.ts","../../src/adapters/json-lines-logger/json-lines-logger.ts","../../src/adapters/json-text/json-text.ts","../../src/adapters/node-project-files/paths-in-root.ts","../../src/adapters/node-project-files/node-project-files.ts","../../src/adapters/pipe-safe-writer/pipe-safe-writer.ts","../../src/domain/migration-findings.ts","../../src/domain/migration-bug.ts","../../src/domain/text-edits.ts","../../src/adapters/typescript-parser/declared-types.ts","../../src/adapters/typescript-parser/file-bindings.ts","../../src/adapters/typescript-parser/generator-calls.ts","../../src/adapters/typescript-parser/option-properties.ts","../../src/adapters/typescript-parser/options-type.ts","../../src/adapters/typescript-parser/script-regions.ts","../../src/adapters/typescript-parser/spread-options.ts","../../src/adapters/typescript-parser/transform-callback.ts","../../src/adapters/typescript-parser/factory-type-text.ts","../../src/adapters/typescript-parser/transform-returns.ts","../../src/adapters/typescript-parser/unused-declarations.ts","../../src/adapters/typescript-parser/rewriter.ts","../../src/adapters/typescript-parser/source-strings.ts","../../src/adapters/yaml-text/yaml-text.ts","../../src/domain/package-names.ts","../../src/domain/config-documents.ts","../../src/domain/relative-references.ts","../../src/domain/api-descriptions.ts","../../src/domain/command-launchers.ts","../../src/domain/workflow-expressions.ts","../../src/domain/shell-word-parts.ts","../../src/domain/shell-assignments.ts","../../src/domain/command-roles.ts","../../src/domain/old-package-words.ts","../../src/domain/file-variables.ts","../../src/domain/compound-commands.ts","../../src/domain/here-documents.ts","../../src/domain/inline-code.ts","../../src/domain/parameter-expansions.ts","../../src/domain/shell-words.ts","../../src/domain/assert-never.ts","../../src/domain/variable-programs.ts","../../src/domain/appended-assignments.ts","../../src/domain/argument-findings.ts","../../src/domain/program-paths.ts","../../src/domain/shell-variables.ts","../../src/domain/command-migration.ts","../../src/domain/command-paths.ts","../../src/domain/command-strings.ts","../../src/domain/version-spec.ts","../../src/domain/declared-packages.ts","../../src/domain/entrypoint-arguments.ts","../../src/domain/dockerfile-entrypoints.ts","../../src/domain/dockerfile-migration.ts","../../src/domain/catalog-plan.ts","../../src/domain/npm-alias.ts","../../src/domain/url-credentials.ts","../../src/domain/dependency-map.ts","../../src/domain/tree-entries.ts","../../src/domain/import-map-migration.ts","../../src/domain/import-map-reference.ts","../../src/domain/source-migration.ts","../../src/domain/jest-config.ts","../../src/domain/json-command-migration.ts","../../src/domain/just-concatenations.ts","../../src/domain/just-expressions.ts","../../src/domain/just-recipe-parameters.ts","../../src/domain/step-shells.ts","../../src/domain/just-shebang-recipes.ts","../../src/domain/justfile-migration.ts","../../src/domain/make-expansions.ts","../../src/domain/makefile-migration.ts","../../src/domain/override-targets.ts","../../src/domain/catalogs.ts","../../src/domain/successor-aliases.ts","../../src/domain/settings-sections.ts","../../src/domain/specifier-maps.ts","../../src/domain/manifest-migration.ts","../../src/domain/patch-files.ts","../../src/domain/input-defaults.ts","../../src/domain/yaml-entrypoints.ts","../../src/domain/yaml-command-keys.ts","../../src/domain/yaml-includes.ts","../../src/domain/yaml-list-items.ts","../../src/domain/yaml-parameters.ts","../../src/domain/yaml-environments.ts","../../src/domain/yaml-environment-entries.ts","../../src/domain/yaml-shell-text.ts","../../src/domain/yaml-scoped-variables.ts","../../src/domain/yaml-migration.ts","../../src/domain/pre-commit-migration.ts","../../src/domain/tsconfig-migration.ts","../../src/domain/workspace-catalog-migration.ts","../../src/domain/yaml-generator-variables.ts","../../src/application/config-steps.ts","../../src/application/project-file-names.ts","../../src/application/named-import-maps.ts","../../src/application/yaml-file-kinds.ts","../../src/application/yaml-file-reach.ts","../../src/application/file-migrations.ts","../../src/application/api-description-parts.ts","../../src/application/plan-sources.ts","../../src/application/project-target.ts","../../src/application/migrate-project.ts","../../src/domain/terminal-text.ts","../../src/application/command-step-messages.ts","../../src/application/source-step-messages.ts","../../src/application/manual-step-messages.ts","../../src/application/messages.ts","../../src/application/report.ts","../../src/cli/cli-arguments.ts","../../src/cli/cli-text.ts","../../src/cli/run-cli.ts","../../src/cli/main.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { access, lstat, realpath, stat } from \"node:fs/promises\";\nimport { posix, win32 } from \"node:path\";\nimport type { GitEnvironment } from \"./git-process.js\";\n\n/** What the git adapter reads from the file system to find git and the repository of a folder. */\nexport interface GitFileSystem {\n /** Whether `path` is a file that this process may execute. */\n isExecutableFile(path: string): Promise<boolean>;\n /** Whether anything (a file, a folder, a link) is at `path`. */\n hasEntry(path: string): Promise<boolean>;\n /** The path with every link resolved, or undefined when nothing usable is at `path`. */\n realPath(path: string): Promise<string | undefined>;\n}\n\n/** Where git is looked for: the process environment, its platform and its file system. */\nexport interface GitHost {\n readonly environment: GitEnvironment;\n readonly platform: NodeJS.Platform;\n readonly fileSystem: GitFileSystem;\n /** The folder the tool migrates. It is not trusted, so no git in it or under it runs. */\n readonly projectRoot: string;\n}\n\nconst WINDOWS = \"win32\";\nconst PATH_VARIABLE = \"PATH\";\nconst GIT_NAME = \"git\";\n/**\n * Git for Windows puts `git.exe` on PATH. A `.cmd` or `.bat` file runs only through a shell, and\n * the tool never starts one, so executables are the only candidates.\n */\nconst WINDOWS_EXECUTABLE_EXTENSION = \".exe\";\nconst GIT_FOLDER = \".git\";\nconst PARENT_FOLDER = \"..\";\n/**\n * The folder where package managers install packages and link their bins. npx puts the\n * `node_modules/.bin` of the project and of every folder above it on PATH, so a workspace root\n * above the migrated package, or any package of it, could plant a `git` there.\n */\nconst PACKAGES_FOLDER = \"node_modules\";\n/**\n * Errors that mean \"nothing usable is there\": a missing path, a parent that is not a folder, or\n * no permission. Any other error is a fault of the file system and is passed on.\n */\nconst ABSENT_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\", \"EACCES\", \"EPERM\"]);\n\nfunction isAbsent(error: unknown): boolean {\n return ABSENT_CODES.has((error as NodeJS.ErrnoException | undefined)?.code ?? \"\");\n}\n\n/** What `check` gives, or `absent` when it fails because nothing usable is at the path. */\nasync function unlessAbsent<T>(check: () => Promise<T>, absent: T): Promise<T> {\n try {\n return await check();\n } catch (error) {\n if (isAbsent(error)) {\n return absent;\n }\n throw error;\n }\n}\n\nconst pathsOf = (platform: NodeJS.Platform) => (platform === WINDOWS ? win32 : posix);\n\n/** The PATH variable; Windows spells its name in any case (`Path`). */\nfunction pathVariable({ environment, platform }: GitHost): string {\n const name =\n platform === WINDOWS\n ? Object.keys(environment).find((key) => key.toUpperCase() === PATH_VARIABLE)\n : PATH_VARIABLE;\n return name === undefined ? \"\" : (environment[name] ?? \"\");\n}\n\n/** Whether the real path `target` is the real folder `folder` or lies under it. */\nfunction isAtOrUnder(paths: typeof posix, folder: string, target: string): boolean {\n const path = paths.relative(folder, target);\n return (\n !(path === PARENT_FOLDER || path.startsWith(`${PARENT_FOLDER}${paths.sep}`)) &&\n !paths.isAbsolute(path)\n );\n}\n\n/**\n * Whether `path` has a `node_modules` segment, in any case. The file systems of macOS and Windows\n * ignore case, so a `NODE_MODULES` folder is the `node_modules` that npx puts on PATH, and a real\n * path keeps the case the folder was created with. Where case matters, this passes over more.\n */\nfunction isInPackagesFolder(host: GitHost, path: string): boolean {\n const separator = host.platform === WINDOWS ? /[\\\\/]/ : posix.sep;\n return path.split(separator).some((segment) => segment.toLowerCase() === PACKAGES_FOLDER);\n}\n\n/**\n * Whether a PATH entry is a folder git may run from. An empty or relative entry names a folder\n * relative to the working directory, a folder in the project is the project's, and a folder in a\n * `node_modules` holds the bins of packages, which npx puts on PATH for the project and every\n * folder above it; each can hold a planted git, so each is passed over. The entry is checked as\n * written and as its real path: a `node_modules` can be a link to a folder with another name.\n */\nasync function isTrustedFolder(host: GitHost, project: string, folder: string): Promise<boolean> {\n const paths = pathsOf(host.platform);\n if (!paths.isAbsolute(folder) || isInPackagesFolder(host, folder)) {\n return false;\n }\n const real = await host.fileSystem.realPath(folder);\n return (\n real !== undefined && !isAtOrUnder(paths, project, real) && !isInPackagesFolder(host, real)\n );\n}\n\n/**\n * The absolute path of the first git on PATH outside the project and outside every `node_modules`,\n * or undefined when there is none. The absolute path also keeps Windows from looking in the\n * working directory first, as it does for a bare program name: a `git.exe` planted at the project\n * root never runs.\n */\nexport async function findGitExecutable(host: GitHost): Promise<string | undefined> {\n const paths = pathsOf(host.platform);\n const name = host.platform === WINDOWS ? `${GIT_NAME}${WINDOWS_EXECUTABLE_EXTENSION}` : GIT_NAME;\n const root = paths.resolve(host.projectRoot);\n const project = (await host.fileSystem.realPath(root)) ?? root;\n for (const folder of pathVariable(host).split(paths.delimiter)) {\n const candidate = paths.join(folder, name);\n const isTrusted = await isTrustedFolder(host, project, folder);\n if (isTrusted && (await host.fileSystem.isExecutableFile(candidate))) {\n return candidate;\n }\n }\n return undefined;\n}\n\n/**\n * Whether git takes `folder` as the root of a repository when it looks no higher than `ceiling`\n * (the parent of `folder`, or `folder` itself at the root of the file system).\n */\nexport type RepositoryCheck = (folder: string, ceiling: string) => Promise<boolean>;\n\n/**\n * The nearest folder at or above `directory` whose `.git` entry (a folder, or the file of a\n * submodule or a linked work tree) git takes as a repository, or undefined. Git takes that folder\n * as the work tree unless `core.worktree` names another one; a planted `core.worktree` made git\n * list another folder, and the project looked empty, so the tool gives git this folder as the\n * work tree. Git passes over a `.git` that is no repository (an empty folder) and finds the one\n * above it, so `isRepository` asks git about each folder that has a `.git` entry.\n */\nexport async function findWorkTree(\n directory: string,\n { platform, fileSystem }: GitHost,\n isRepository: RepositoryCheck,\n): Promise<string | undefined> {\n const paths = pathsOf(platform);\n let folder = paths.resolve(directory);\n for (;;) {\n const parent = paths.dirname(folder);\n const hasGit = await fileSystem.hasEntry(paths.join(folder, GIT_FOLDER));\n if (hasGit && (await isRepository(folder, parent))) {\n return folder;\n }\n if (parent === folder) {\n return undefined;\n }\n folder = parent;\n }\n}\n\n/** The git file system on `node:fs`. */\nexport function createNodeGitFileSystem(): GitFileSystem {\n return {\n isExecutableFile: (path) =>\n unlessAbsent(async () => {\n const isFile = (await stat(path)).isFile();\n await access(path, constants.X_OK);\n return isFile;\n }, false),\n hasEntry: (path) =>\n unlessAbsent(async () => {\n await lstat(path);\n return true;\n }, false),\n realPath: (path) => unlessAbsent<string | undefined>(() => realpath(path), undefined),\n };\n}\n","import { spawn } from \"node:child_process\";\n\n/** The environment variables git inherits, as `process.env` holds them. */\nexport type GitEnvironment = Readonly<Record<string, string | undefined>>;\n\n/** One git command: the git program by its absolute path, where it runs, and with what. */\nexport interface GitInvocation {\n readonly executable: string;\n readonly directory: string;\n readonly gitArguments: readonly string[];\n readonly environment: GitEnvironment;\n}\n\n/** How a git command ended: its exit code and output, or why it did not start. */\nexport type GitRun =\n | {\n readonly kind: \"exited\";\n readonly exitCode: number | null;\n readonly output: string;\n readonly errors: string;\n }\n | { readonly kind: \"failed\"; readonly reason: string };\n\n/** Runs one git command exactly as given; the hardening is part of the invocation. */\nexport type GitProcess = (invocation: GitInvocation) => Promise<GitRun>;\n\n/** A git process in a child process, with the invocation's environment and nothing else. */\nexport const spawnGitProcess: GitProcess = ({ executable, directory, gitArguments, environment }) =>\n new Promise((resolve) => {\n // spawn, not execFile: the output of a large repository has no buffer limit this way.\n const child = spawn(executable, [...gitArguments], { cwd: directory, env: environment });\n const output: Buffer[] = [];\n const errors: Buffer[] = [];\n child.stdout.on(\"data\", (chunk: Buffer) => output.push(chunk));\n child.stderr.on(\"data\", (chunk: Buffer) => errors.push(chunk));\n // Git is gone since it was found, or the directory does not exist.\n child.on(\"error\", (error) => resolve({ kind: \"failed\", reason: error.message }));\n child.on(\"close\", (exitCode) => {\n resolve({\n kind: \"exited\",\n exitCode,\n output: Buffer.concat(output).toString(\"utf8\"),\n errors: Buffer.concat(errors).toString(\"utf8\").trim(),\n });\n });\n });\n\n/**\n * Settings that win over every config file, because the tool runs git in folders it did not\n * create: a nested repository unpacked from an archive, or a bare repository committed inside a\n * cloned one. Their config is not trusted.\n *\n * - `core.fsmonitor=false`: the fsmonitor hook is a command from config that `ls-files` and\n * `check-ignore` run on every call.\n * - `protocol.allow=never`: refuses every transport that no `protocol.<name>.allow` key allows.\n * A repository's own config can still allow one by name, so the environment below refuses\n * them all for real.\n * - `safe.bareRepository=explicit`: a bare repository found by walking up from the folder is\n * refused, so its config is not read at all; the folder is then walked as a tree.\n *\n * These two commands write no index, so no hook runs, and they start no filter or pager.\n */\nconst HARDENED_CONFIG = [\n \"-c\",\n \"core.fsmonitor=false\",\n \"-c\",\n \"protocol.allow=never\",\n \"-c\",\n \"safe.bareRepository=explicit\",\n] as const;\n\n/**\n * A partial clone fetches a missing object from its promisor remote while it reads the index (a\n * sparse directory entry, for example), and a fetch runs commands from config (`core.sshCommand`,\n * `remote.<name>.uploadpack`, `ext::` URLs, credential helpers).\n *\n * - `GIT_ALLOW_PROTOCOL` set to an empty list: git then allows only the transports in the list,\n * whatever any `protocol.*` key says (git 2.12 and newer), so no fetch starts. It is the\n * guarantee on every git the tool supports; git reports the missing object on stderr and\n * lists the files it can read.\n * - `GIT_NO_LAZY_FETCH=1`: git 2.45 and newer do not even try a fetch. Older git ignores it.\n * - `GIT_TERMINAL_PROMPT=0`: git never waits on a password prompt.\n */\nconst HARDENED_ENVIRONMENT = {\n GIT_ALLOW_PROTOCOL: \"\",\n GIT_NO_LAZY_FETCH: \"1\",\n GIT_TERMINAL_PROMPT: \"0\",\n} as const;\n\n/**\n * Variables that name a repository or a part of it. A git hook sets `GIT_DIR` and\n * `GIT_INDEX_FILE` for the commands it runs, so a run from a hook would list that repository\n * for every folder. The tool lists each folder by the repository the folder is in.\n */\nconst REPOSITORY_VARIABLES: readonly string[] = [\n \"GIT_DIR\",\n \"GIT_WORK_TREE\",\n \"GIT_COMMON_DIR\",\n \"GIT_INDEX_FILE\",\n \"GIT_OBJECT_DIRECTORY\",\n \"GIT_ALTERNATE_OBJECT_DIRECTORIES\",\n];\n/** Makes git use this folder as the work tree, whatever `core.worktree` says. */\nconst WORK_TREE_VARIABLE = \"GIT_WORK_TREE\";\n/** Keeps git from looking for a repository above this folder. */\nconst CEILING_VARIABLE = \"GIT_CEILING_DIRECTORIES\";\n\n/** The environment of a hardened git command, from the environment the process has. */\nfunction hardenedEnvironment(command: HardenedGitCommand): GitEnvironment {\n const kept = Object.entries(command.environment).filter(\n ([name]) => !REPOSITORY_VARIABLES.includes(name.toUpperCase()),\n );\n const { workTree, ceiling } = command;\n const forced = {\n ...(workTree === undefined ? {} : { [WORK_TREE_VARIABLE]: workTree }),\n ...(ceiling === undefined ? {} : { [CEILING_VARIABLE]: ceiling }),\n };\n return { ...Object.fromEntries(kept), ...forced, ...HARDENED_ENVIRONMENT };\n}\n\n/** What a hardened git command needs besides its arguments. */\nexport interface HardenedGitCommand {\n readonly executable: string;\n readonly directory: string;\n readonly environment: GitEnvironment;\n /** The folder that holds the `.git` of the repository, or undefined when there is none. */\n readonly workTree: string | undefined;\n /** The folder above which git looks for no repository; git's own rule when undefined. */\n readonly ceiling?: string;\n}\n\n/** The invocation of `gitArguments` with the hardening above. */\nexport function hardenedInvocation(\n command: HardenedGitCommand,\n gitArguments: readonly string[],\n): GitInvocation {\n return {\n executable: command.executable,\n directory: command.directory,\n gitArguments: [...HARDENED_CONFIG, ...gitArguments],\n environment: hardenedEnvironment(command),\n };\n}\n","import {\n findGitExecutable,\n findWorkTree,\n type GitFileSystem,\n type GitHost,\n type RepositoryCheck,\n} from \"./git-locations.js\";\nimport {\n type GitEnvironment,\n type GitProcess,\n type GitRun,\n type HardenedGitCommand,\n hardenedInvocation,\n spawnGitProcess,\n} from \"./git-process.js\";\n\nexport type { GitEnvironment } from \"./git-process.js\";\n\n/** The paths git lists for a directory, or why it could not list them. */\nexport type GitListing =\n | { readonly kind: \"listed\"; readonly paths: readonly string[] }\n | { readonly kind: \"unavailable\"; readonly reason: string };\n\n/**\n * Lists a directory the way git sees it: tracked files, and untracked files that are not ignored.\n * A submodule or a nested repository is one path: the directory, without a trailing slash.\n */\nexport interface GitFileList {\n list(directory: string): Promise<GitListing>;\n}\n\n/**\n * Tracked files, and untracked files that `.gitignore`, `.git/info/exclude` and the global\n * excludes file do not ignore, under the working directory, relative to it, NUL-separated. A file\n * in a merge conflict is in the index once per side; `--deduplicate` (git 2.31) lists it once.\n */\nconst LS_FILES_ARGUMENTS = [\n \"ls-files\",\n \"--cached\",\n \"--others\",\n \"--exclude-standard\",\n \"--deduplicate\",\n \"-z\",\n] as const;\n/**\n * Exit code 0 when the working directory is ignored by the repository it is in, 1 when not. Git\n * lists nothing in an ignored directory, so its listing would look like an empty project.\n */\nconst CHECK_IGNORE_ARGUMENTS = [\"check-ignore\", \"--quiet\", \".\"] as const;\n/** Exit code 0 when git finds a repository in the working directory. */\nconst REPOSITORY_CHECK_ARGUMENTS = [\"rev-parse\", \"--git-dir\"] as const;\nconst IGNORED_EXIT_CODE = 0;\nconst NOT_IGNORED_EXIT_CODE = 1;\nconst IGNORED_REASON = \"the git repository around the folder ignores it\";\nconst NO_GIT_REASON = \"no git executable in an absolute folder of PATH\";\n/** An untracked nested repository is listed with a slash, and the directory itself as `./`. */\nconst TRAILING_SLASH_RE = /\\/$/;\nconst SELF_PATHS: ReadonlySet<string> = new Set([\"\", \".\"]);\n\nfunction failureReason(run: GitRun): string {\n if (run.kind === \"failed\") {\n return run.reason;\n }\n return run.errors || `exit code ${run.exitCode}`;\n}\n\nfunction listedPaths(output: string): string[] {\n return output\n .split(\"\\0\")\n .map((path) => path.replace(TRAILING_SLASH_RE, \"\"))\n .filter((path) => !SELF_PATHS.has(path));\n}\n\nasync function listWith(command: HardenedGitCommand, run: GitProcess): Promise<GitListing> {\n const ignored = await run(hardenedInvocation(command, CHECK_IGNORE_ARGUMENTS));\n if (ignored.kind === \"exited\" && ignored.exitCode === IGNORED_EXIT_CODE) {\n return { kind: \"unavailable\", reason: IGNORED_REASON };\n }\n if (ignored.kind === \"failed\" || ignored.exitCode !== NOT_IGNORED_EXIT_CODE) {\n return { kind: \"unavailable\", reason: failureReason(ignored) };\n }\n const listed = await run(hardenedInvocation(command, LS_FILES_ARGUMENTS));\n if (listed.kind === \"failed\" || listed.exitCode !== 0) {\n return { kind: \"unavailable\", reason: failureReason(listed) };\n }\n return { kind: \"listed\", paths: listedPaths(listed.output) };\n}\n\n/** What the git file list runs git with. */\nexport interface GitFileListOptions {\n /** The process environment: `PATH`, `HOME` and git's own variables. */\n readonly environment: GitEnvironment;\n readonly platform: NodeJS.Platform;\n readonly fileSystem: GitFileSystem;\n /** The folder the tool migrates; no git in it or under it runs. */\n readonly projectRoot: string;\n /** Runs one git command; a child process unless a test wraps it. */\n readonly process?: GitProcess;\n}\n\nclass HardenedGitFileList implements GitFileList {\n readonly #host: GitHost;\n readonly #process: GitProcess;\n /** PATH is searched once, on the first listing. */\n #executable: Promise<string | undefined> | undefined;\n\n constructor(options: GitFileListOptions) {\n this.#host = options;\n this.#process = options.process ?? spawnGitProcess;\n }\n\n async list(directory: string): Promise<GitListing> {\n this.#executable ??= findGitExecutable(this.#host);\n const executable = await this.#executable;\n if (executable === undefined) {\n return { kind: \"unavailable\", reason: NO_GIT_REASON };\n }\n const { environment } = this.#host;\n const isRepository: RepositoryCheck = async (folder, ceiling) => {\n const command = { executable, directory: folder, environment, workTree: undefined, ceiling };\n const run = await this.#process(hardenedInvocation(command, REPOSITORY_CHECK_ARGUMENTS));\n return run.kind === \"exited\" && run.exitCode === 0;\n };\n const workTree = await findWorkTree(directory, this.#host, isRepository);\n return listWith({ executable, directory, environment, workTree }, this.#process);\n }\n}\n\n/**\n * A git file list that runs `git check-ignore` and `git ls-files` (git-process.ts has the\n * hardening): git by its absolute path from a PATH folder outside the project, with the folder\n * whose `.git` git takes as the repository of the listed directory as the work tree.\n */\nexport function createGitFileList(options: GitFileListOptions): GitFileList {\n return new HardenedGitFileList(options);\n}\n","import { appendFileSync, closeSync, fstatSync, mkdirSync, mkdtempSync, openSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Logger } from \"../../application/ports.js\";\n\n/** The log file, the clock of the timestamps, and whether the file must be new. */\nexport interface JsonLinesLoggerOptions {\n readonly path: string;\n readonly now: () => Date;\n /**\n * The file must not exist yet: it is created with `O_CREAT | O_EXCL`, which also refuses a\n * link at the path instead of following it. Used for the default log in the temporary folder.\n * Without it, an existing file (the user's `--log`) gets the new lines appended.\n * Either way the file is opened when the logger is created, so a path that cannot be a log\n * file (a folder, a read-only place) fails before the migration starts.\n */\n readonly isExclusive: boolean;\n}\n\ntype Level = \"info\" | \"warn\";\n\n/** The log can name files and changes of a private project, so only its owner can read it. */\nconst LOG_FILE_MODE = 0o600;\nconst TEMPORARY_FOLDER_PREFIX = \"openapi-typesafe-migrate-\";\nconst LOG_EXTENSION = \".jsonl\";\nconst TIME_SEPARATOR = \":\";\n/** `:` is not allowed in Windows file names. */\nconst FILE_NAME_TIME_SEPARATOR = \"-\";\n\n/** The path names a folder, so lines cannot be appended to it. */\nexport class LogPathIsFolderError extends Error {\n override readonly name = \"LogPathIsFolderError\";\n\n constructor(path: string) {\n super(`${path} is a folder; --log takes a file path`);\n }\n}\n\nconst EXCLUSIVE_CREATE_FLAG = \"wx\";\nconst APPEND_FLAG = \"a\";\nconst IS_A_DIRECTORY_CODE = \"EISDIR\";\n\n/**\n * Create or open the log file once, to fail early. POSIX refuses to open a folder for writing\n * (EISDIR), but Windows opens it and accepts empty writes, so the opened file is also checked.\n */\nfunction openLogFile(path: string, isExclusive: boolean): void {\n let descriptor: number;\n try {\n descriptor = openSync(path, isExclusive ? EXCLUSIVE_CREATE_FLAG : APPEND_FLAG, LOG_FILE_MODE);\n } catch (error) {\n throw isDirectoryError(error) ? new LogPathIsFolderError(path) : error;\n }\n try {\n if (fstatSync(descriptor).isDirectory()) {\n throw new LogPathIsFolderError(path);\n }\n } finally {\n closeSync(descriptor);\n }\n}\n\nconst isDirectoryError = (error: unknown): boolean =>\n error instanceof Error && \"code\" in error && error.code === IS_A_DIRECTORY_CODE;\n\n/**\n * The Logger port as a JSON Lines file: one object per event with a UTC timestamp, the level and\n * the event's fields. Lines are appended synchronously, so the log is complete when the command\n * fails half way.\n */\nclass JsonLinesLogger implements Logger {\n readonly #options: JsonLinesLoggerOptions;\n\n constructor(options: JsonLinesLoggerOptions) {\n this.#options = options;\n if (!options.isExclusive) {\n mkdirSync(dirname(options.path), { recursive: true });\n }\n openLogFile(options.path, options.isExclusive);\n }\n\n info(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"info\", event, fields);\n }\n\n warn(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"warn\", event, fields);\n }\n\n #append(level: Level, event: string, fields: Readonly<Record<string, unknown>>): void {\n const time = this.#options.now().toISOString();\n const line = `${JSON.stringify({ time, level, event, ...fields })}\\n`;\n appendFileSync(this.#options.path, line, { mode: LOG_FILE_MODE });\n }\n}\n\n/** A logger that appends to the JSON Lines file at `options.path`, creating its directory. */\nexport function createJsonLinesLogger(options: JsonLinesLoggerOptions): Logger {\n return new JsonLinesLogger(options);\n}\n\n/**\n * The path of a run's log in a new folder under `parent` (the system temporary folder), named by\n * the run's UTC start time. `mkdtemp` gives the folder a name no other user can guess and mode\n * 0700, so on a shared host nobody else can plant a file or a link in it.\n */\nexport function createTemporaryLogPath(parent: string, startTime: Date): string {\n const folder = mkdtempSync(join(parent, TEMPORARY_FOLDER_PREFIX));\n const name = startTime.toISOString().replaceAll(TIME_SEPARATOR, FILE_NAME_TIME_SEPARATOR);\n return join(folder, `${name}${LOG_EXTENSION}`);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { JsonDocumentReader } from \"../../application/ports.js\";\nimport type { DocumentRead, TreeEntry, TreeNode } from \"../../domain/config-documents.js\";\n\n/**\n * The JsonDocumentReader port on the TypeScript 6 JSON parser (ADR-015), the one tsc reads\n * `tsconfig.json` with: it accepts comments and trailing commas, as `deno.jsonc` and Nx\n * `project.json` do, and gives every node its offsets in the text. A byte order mark is allowed\n * before the value.\n */\n\n/** The parser names the file in its diagnostics only. */\nconst FILE_NAME = \"document.json\";\n/** The length of the quote on each side of a JSON string. */\nconst QUOTE_LENGTH = 1;\nconst JSON_ESCAPE = \"\\\\\";\n\nconst encode = (value: string): string => JSON.stringify(value);\n\nfunction spanOf(node: ts.Node, file: ts.SourceFile): { start: number; end: number } {\n return { start: node.getStart(file), end: node.end };\n}\n\nfunction convertString(node: ts.StringLiteral, file: ts.SourceFile): TreeNode {\n const span = spanOf(node, file);\n const content = { start: span.start + QUOTE_LENGTH, end: span.end - QUOTE_LENGTH };\n const isEscaped = file.text.slice(content.start, content.end).includes(JSON_ESCAPE);\n return { kind: \"scalar\", value: node.text, content, isFolded: false, isEscaped, encode, ...span };\n}\n\nfunction convertObject(node: ts.ObjectLiteralExpression, file: ts.SourceFile): TreeNode {\n // A valid document has only quoted keys (see firstError); the check narrows the node type.\n const entries = node.properties.filter(ts.isPropertyAssignment).map(\n (property): TreeEntry => ({\n key: ts.isStringLiteral(property.name)\n ? convertString(property.name, file)\n : { kind: \"other\", ...spanOf(property.name, file) },\n value: convert(property.initializer, file),\n }),\n );\n return { kind: \"map\", entries, ...spanOf(node, file) };\n}\n\nfunction convert(node: ts.Expression, file: ts.SourceFile): TreeNode {\n if (ts.isObjectLiteralExpression(node)) {\n return convertObject(node, file);\n }\n if (ts.isArrayLiteralExpression(node)) {\n const items = node.elements.map((item) => convert(item, file));\n return { kind: \"list\", items, ...spanOf(node, file) };\n }\n if (ts.isStringLiteral(node)) {\n return convertString(node, file);\n }\n return { kind: \"other\", ...spanOf(node, file) };\n}\n\n/**\n * `parseJsonText` keeps its syntax errors internal. This public reader of the same grammar\n * reports the first of them, and rejects what JSON forbids and the parser allows: unquoted or\n * single-quoted keys, and a root value that is not an object.\n */\nfunction firstError(text: string): number | undefined {\n const { error } = ts.parseConfigFileTextToJson(FILE_NAME, text);\n return error === undefined ? undefined : (error.start ?? 0);\n}\n\nfunction readTree(text: string): DocumentRead {\n const errorAt = firstError(text);\n if (errorAt !== undefined) {\n return { kind: \"unreadable\", offset: errorAt };\n }\n const file = ts.parseJsonText(FILE_NAME, text);\n const documents = file.statements.map((statement) => convert(statement.expression, file));\n return { kind: \"read\", documents };\n}\n\nfunction read(text: string): DocumentRead {\n try {\n return readTree(text);\n } catch (error) {\n // The parser and the conversion recurse per level of nesting: a crafted file (about a\n // thousand levels) exhausts the stack, and the error gives no place.\n if (error instanceof RangeError) {\n return { kind: \"unreadable\", offset: undefined };\n }\n throw error;\n }\n}\n\nexport function createJsonTextReader(): JsonDocumentReader {\n return { read };\n}\n","import { lstat, realpath } from \"node:fs/promises\";\nimport { isAbsolute, join, relative, sep } from \"node:path\";\n\nconst PARENT_DIRECTORY = \"..\";\n/**\n * Errors of a listed path that leads to no file: a tracked file deleted from the working tree\n * (ENOENT), a path through a file (ENOTDIR), and a link that is dangling or loops (ELOOP).\n */\nconst UNRESOLVED_PATH_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\", \"ELOOP\"]);\n\n/** What a path that git lists is on disk. */\nexport type ListedEntry = \"file\" | \"directory\" | \"other\" | \"outside\";\n\n/**\n * Whether `path` stays under the folder it is relative to, by its text. Git checks a path when it\n * adds it to the index, but it prints an index that it did not write (one in a planted `.git`) as\n * it is, with `../` or a leading `/`. Links are checked by the real path.\n */\nexport function isRelativeDownward(path: string): boolean {\n return !isAbsolute(path) && !path.split(\"/\").includes(PARENT_DIRECTORY);\n}\n\n/** Whether the real path `target` is in the real folder `folder`, not the folder itself. */\nexport function isInFolder(folder: string, target: string): boolean {\n const path = relative(folder, target);\n return (\n path !== \"\" &&\n path !== PARENT_DIRECTORY &&\n !path.startsWith(`${PARENT_DIRECTORY}${sep}`) &&\n !isAbsolute(path)\n );\n}\n\n/**\n * Git also lists links and tracked files deleted from the working tree; only regular files that\n * exist are the project's files. A directory is a submodule or a nested repository. A path whose\n * real path is outside the root (by `..`, a linked parent folder, or a link itself) is \"outside\",\n * so the report names it. A link inside the root is \"other\": links are not followed, and what it\n * points at is listed on its own. A path that leads to no file, a broken link included, is \"other\".\n */\nexport async function entryAt(root: string, realRoot: string, path: string): Promise<ListedEntry> {\n if (!isRelativeDownward(path)) {\n return \"outside\";\n }\n try {\n const stats = await lstat(join(root, path));\n const isListable = stats.isFile() || stats.isDirectory();\n if (!isListable && !stats.isSymbolicLink()) {\n return \"other\";\n }\n // A link to the root itself (`self -> .`) is in the project, like a link to a folder in it.\n const realPath = await realpath(join(root, path));\n if (realPath !== realRoot && !isInFolder(realRoot, realPath)) {\n return \"outside\";\n }\n if (!isListable) {\n return \"other\";\n }\n return stats.isFile() ? \"file\" : \"directory\";\n } catch (error) {\n if (UNRESOLVED_PATH_CODES.has((error as NodeJS.ErrnoException).code ?? \"\")) {\n return \"other\";\n }\n throw error;\n }\n}\n","import type { Dirent } from \"node:fs\";\nimport {\n chmod,\n lstat,\n readdir,\n readFile,\n realpath,\n rename,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { basename, dirname, join } from \"node:path\";\nimport type {\n FileProblem,\n FileRead,\n FileWrite,\n Logger,\n ProjectFileList,\n ProjectFiles,\n ProjectRootState,\n SkippedFile,\n} from \"../../application/ports.js\";\nimport type { GitFileList } from \"../git-file-list/git-file-list.js\";\nimport { entryAt, isInFolder, isRelativeDownward, type ListedEntry } from \"./paths-in-root.js\";\n\n/**\n * Installed packages, git metadata, build output and the output folders of frameworks and test\n * tools are not the project's own files: rewriting them only adds noise to the dry run and the\n * diff. They are skipped even when git tracks them.\n * `build` and `out` stay in, because some projects keep sources there. Links are not followed, so a\n * linked workspace package is migrated in its own project, not twice.\n */\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \".next\",\n \".nuxt\",\n \".output\",\n \".svelte-kit\",\n \".turbo\",\n \"coverage\",\n]);\n\nconst CURRENT_DIRECTORY = \".\";\n/** The new text is written next to the file under this suffix, then renamed over it. */\nconst TEMPORARY_SUFFIX = \".openapi-typesafe-migrate.tmp\";\nconst PERMISSION_BITS = 0o7777;\n/** Only the owner can read the new text until it has the mode of the file it replaces. */\nconst TEMPORARY_MODE = 0o600;\nconst OUTSIDE_ROOT: FileProblem = { kind: \"outside-root\" };\nconst NOT_UTF_8: FileProblem = { kind: \"not-utf-8\" };\nconst UTF_8 = \"utf-8\";\n\n/**\n * The text of a file's bytes, or \"not-utf-8\". Decoding replaces invalid bytes with U+FFFD by\n * default, and writing that text back would destroy them (a Latin-1 `é` became `�`). A fatal\n * decoder refuses them instead. The byte order mark stays in the text, so it is written back.\n */\nfunction decodeUtf8(bytes: Uint8Array): FileRead {\n try {\n const text = new TextDecoder(UTF_8, { fatal: true, ignoreBOM: true }).decode(bytes);\n return { kind: \"read\", text };\n } catch (error) {\n // The fatal decoder reports invalid bytes as a TypeError; anything else is a bug.\n if (error instanceof TypeError) {\n return { kind: \"skipped\", reason: NOT_UTF_8 };\n }\n throw error;\n }\n}\n\n/** The problem of a failed file system call; an error without an error code is passed on. */\nfunction ioProblem(error: unknown): FileProblem {\n const code = (error as NodeJS.ErrnoException | undefined)?.code;\n if (typeof code !== \"string\") {\n throw error;\n }\n return { kind: \"io-error\", code };\n}\n\n/** What the project files read besides the file system. */\nexport interface NodeProjectFilesOptions {\n readonly git: GitFileList;\n readonly logger: Logger;\n}\n\nfunction isInSkippedDirectory(path: string): boolean {\n return path\n .split(\"/\")\n .slice(0, -1)\n .some((directory) => SKIPPED_DIRECTORIES.has(directory));\n}\n\nasync function listTree(root: string, relative: string): Promise<string[]> {\n const entries: Dirent[] = await readdir(join(root, relative), { withFileTypes: true });\n const nested = await Promise.all(\n entries.map((entry) => {\n const path = relative === \"\" ? entry.name : `${relative}/${entry.name}`;\n if (entry.isDirectory()) {\n return SKIPPED_DIRECTORIES.has(entry.name) ? [] : listTree(root, path);\n }\n return entry.isFile() ? [path] : [];\n }),\n );\n return nested.flat();\n}\n\ninterface ListedPaths {\n readonly files: readonly string[];\n readonly directories: readonly string[];\n readonly skipped: readonly SkippedFile[];\n}\n\n/** The files, the nested repositories and the paths outside the root of a git listing. */\nasync function listedPaths(\n root: string,\n realRoot: string,\n paths: readonly string[],\n): Promise<ListedPaths> {\n const candidates = paths.filter((path) => !isInSkippedDirectory(path));\n const entries = await Promise.all(candidates.map((path) => entryAt(root, realRoot, path)));\n const withEntry = (entry: ListedEntry) =>\n candidates.filter((_path, index) => entries[index] === entry);\n return {\n files: withEntry(\"file\"),\n directories: withEntry(\"directory\").filter((path) => !SKIPPED_DIRECTORIES.has(baseName(path))),\n skipped: withEntry(\"outside\").map((path): SkippedFile => ({ path, reason: OUTSIDE_ROOT })),\n };\n}\n\nfunction baseName(path: string): string {\n return path.slice(path.lastIndexOf(\"/\") + 1);\n}\n\nfunction joinRelative(directory: string, path: string): string {\n return directory === \"\" ? path : `${directory}/${path}`;\n}\n\nconst NO_FILES: ProjectFileList = { files: [], skipped: [] };\n\nfunction joinLists(lists: readonly ProjectFileList[]): ProjectFileList {\n return lists.reduce(\n (joined, list) => ({\n files: [...joined.files, ...list.files],\n skipped: [...joined.skipped, ...list.skipped],\n }),\n NO_FILES,\n );\n}\n\nclass NodeProjectFiles implements ProjectFiles {\n readonly #root: string;\n readonly #options: NodeProjectFilesOptions;\n\n constructor(root: string, options: NodeProjectFilesOptions) {\n this.#root = root;\n this.#options = options;\n }\n\n /** Git's view of the project when it is in a git repository, so ignored files stay out. */\n async listFiles(): Promise<ProjectFileList> {\n return this.#listDirectory(await realpath(this.#root), \"\");\n }\n\n /**\n * One directory, by the git repository it is in. Git lists a submodule or a nested repository\n * as one entry, so each of those is listed the same way, by its own repository and ignore rules.\n */\n async #listDirectory(realRoot: string, directory: string): Promise<ProjectFileList> {\n const { git, logger } = this.#options;\n const listing = await git.list(join(this.#root, directory));\n const logged = { directory: directory === \"\" ? CURRENT_DIRECTORY : directory };\n if (listing.kind === \"unavailable\") {\n // Not a git repository, no git, or ignored by the repository around it: walk the tree; only\n // the skipped folders stay out.\n const files = await listTree(this.#root, directory);\n logger.info(\"files_listed\", {\n ...logged,\n source: \"tree\",\n fileCount: files.length,\n reason: listing.reason,\n });\n return { files, skipped: [] };\n }\n const paths = listing.paths.map((path) => joinRelative(directory, path));\n const { files, directories, skipped } = await listedPaths(this.#root, realRoot, paths);\n logger.info(\"files_listed\", { ...logged, source: \"git\", fileCount: files.length });\n for (const file of skipped) {\n logger.warn(\"file_skipped\", { ...file });\n }\n const nested = await Promise.all(\n directories.map((path) => this.#listDirectory(realRoot, path)),\n );\n return joinLists([{ files, skipped }, ...nested]);\n }\n\n async read(path: string): Promise<FileRead> {\n try {\n const target = await this.#pathInRoot(path);\n return target === undefined\n ? { kind: \"skipped\", reason: OUTSIDE_ROOT }\n : decodeUtf8(await readFile(target));\n } catch (error) {\n return { kind: \"skipped\", reason: ioProblem(error) };\n }\n }\n\n async write(path: string, text: string): Promise<FileWrite> {\n try {\n const target = await this.#pathInRoot(path);\n if (target === undefined) {\n return { kind: \"failed\", reason: OUTSIDE_ROOT };\n }\n await this.#replace(target, text, path);\n return { kind: \"written\" };\n } catch (error) {\n return { kind: \"failed\", reason: ioProblem(error) };\n }\n }\n\n /**\n * Writes a new file and renames it over the old one, so the write never goes through a link: a\n * hard link to a file outside the root keeps its old text, and is reported in the log. The new\n * file keeps the mode of the old one.\n */\n async #replace(target: string, text: string, path: string): Promise<void> {\n const { mode, nlink } = await lstat(target);\n // `wx`: a leftover of a failed run is not overwritten; the error names it.\n const temporary = join(dirname(target), `.${basename(target)}${TEMPORARY_SUFFIX}`);\n await writeFile(temporary, text, { encoding: \"utf8\", flag: \"wx\", mode: TEMPORARY_MODE });\n try {\n // The mode is set after the write, because `writeFile`'s mode is reduced by the umask.\n await chmod(temporary, mode & PERMISSION_BITS);\n await rename(temporary, target);\n } catch (error) {\n await rm(temporary, { force: true });\n throw error;\n }\n if (nlink > 1) {\n this.#options.logger.warn(\"hard_link_separated\", { path, linkCount: nlink });\n }\n }\n\n /** The real path of a project file, or undefined for one that resolves outside the root. */\n async #pathInRoot(path: string): Promise<string | undefined> {\n const realPath = isRelativeDownward(path) ? await realpath(join(this.#root, path)) : undefined;\n if (realPath === undefined || !isInFolder(await realpath(this.#root), realPath)) {\n return undefined;\n }\n return realPath;\n }\n}\n\n/** The files of the project in the directory `root`, by `/`-separated relative paths. */\nexport function createNodeProjectFiles(\n root: string,\n options: NodeProjectFilesOptions,\n): ProjectFiles {\n return new NodeProjectFiles(root, options);\n}\n\nconst MISSING_PATH_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\"]);\n\n/**\n * Whether `root` is a folder the migration can list, by its real path (a link to a folder is\n * one). Asked before anything is listed, so `--root` naming a file or nothing fails with a clear\n * message instead of git's or the file system's.\n */\nexport async function inspectProjectRoot(root: string): Promise<ProjectRootState> {\n try {\n return (await stat(root)).isDirectory() ? \"directory\" : \"not-a-directory\";\n } catch (error) {\n if (MISSING_PATH_CODES.has((error as NodeJS.ErrnoException).code ?? \"\")) {\n return \"missing\";\n }\n throw error;\n }\n}\n","import type { Writable } from \"node:stream\";\n\n/**\n * A writer for the CLI's stdout and stderr that stops when the reader closes the pipe (`| head`):\n * the write fails with `EPIPE`, which Node raises as an unhandled `error` event and a crash with\n * exit code 1. The reader has all it wanted, so the rest is dropped and the run ends as it would\n * have: the files are written before the report. Every other write error is thrown again. The\n * generator CLI has the same writer; the tool does not depend on the generator package.\n */\n\nconst BROKEN_PIPE = \"EPIPE\";\n\nfunction isBrokenPipe(error: Error): boolean {\n return (error as NodeJS.ErrnoException).code === BROKEN_PIPE;\n}\n\n/**\n * The text writer of the stream. After `EPIPE` the stream is destroyed, so later writes are\n * dropped by the stream itself and raise no second error.\n */\nexport function createPipeSafeWriter(stream: Writable): (text: string) => void {\n stream.on(\"error\", (error: Error) => {\n if (!isBrokenPipe(error)) {\n throw error;\n }\n });\n return (text) => {\n stream.write(text);\n };\n}\n","/**\n * What a migration found in one file: changes it made, and steps it leaves to the user. Both are\n * closed sets of facts, not text; the report turns them into messages (application/report.ts).\n * They go to the report and the log, so a version spec in them has its URL credentials hidden\n * (domain/url-credentials.ts).\n */\n\n/** A place in a text, 1-based. */\nexport interface TextPosition {\n readonly line: number;\n readonly column: number;\n}\n\nexport type Change =\n | {\n readonly kind: \"dependency-renamed\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n readonly spec: string;\n }\n | {\n readonly kind: \"catalog-entry-renamed\";\n readonly catalog: string;\n readonly from: string;\n readonly to: string;\n readonly spec: string;\n }\n | {\n readonly kind: \"import-renamed\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n readonly target: string;\n }\n | {\n readonly kind: \"alias-renamed\";\n readonly field: string;\n readonly name: string;\n readonly spec: string;\n }\n | { readonly kind: \"command-renamed\"; readonly location: string }\n | {\n readonly kind: \"package-name-renamed\";\n readonly location: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"flag-renamed\";\n readonly location: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"specifier-renamed\";\n readonly line: number;\n readonly from: string;\n readonly to: string;\n }\n | { readonly kind: \"transform-rewritten\"; readonly line: number }\n | { readonly kind: \"declaration-removed\"; readonly line: number; readonly name: string };\n\nexport type ManualStep =\n | { readonly kind: \"entry-not-edited\"; readonly field: string; readonly name: string }\n | {\n readonly kind: \"name-collision\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"catalog-reference-kept\";\n readonly field: string;\n readonly name: string;\n readonly catalog: string;\n }\n | {\n readonly kind: \"catalog-entry-outside\";\n readonly field: string;\n readonly name: string;\n readonly catalog: string;\n }\n /** A dependency on a catalog entry that no catalog of the workspace has. */\n | {\n readonly kind: \"catalog-entry-missing\";\n readonly field: string;\n readonly name: string;\n readonly catalog: string;\n }\n | { readonly kind: \"catalog-entry-in-use\"; readonly catalog: string; readonly name: string }\n | { readonly kind: \"peer-dependency-renamed\"; readonly name: string }\n | { readonly kind: \"spec-kept\"; readonly name: string; readonly spec: string }\n /** A dependency under an original name whose spec points at a local package. */\n | {\n readonly kind: \"local-package\";\n readonly field: string;\n readonly name: string;\n readonly spec: string;\n }\n | { readonly kind: \"override-names-package\"; readonly field: string; readonly name: string }\n /** A pattern of a config (Jest's `moduleNameMapper`) that names an old package. */\n | {\n readonly kind: \"pattern-names-package\";\n readonly location: string;\n readonly value: string;\n readonly name: string;\n readonly to: string;\n }\n /** A package manager setting (not an override) that names an old package. */\n | { readonly kind: \"setting-names-package\"; readonly field: string; readonly name: string }\n | { readonly kind: \"versioned-command\"; readonly location: string }\n | {\n readonly kind: \"flags-in-variable\";\n readonly location: string;\n readonly variable: string;\n /** The old flags in the variable's value. */\n readonly flags: readonly string[];\n }\n | {\n readonly kind: \"variable-not-only-generator\";\n readonly location: string;\n readonly variable: string;\n /** The old flags of the generator after the variable, or in a variable's value there. */\n readonly flags: readonly string[];\n }\n | { readonly kind: \"pinned-package\"; readonly location: string; readonly name: string }\n | { readonly kind: \"old-package-file\"; readonly location: string; readonly path: string }\n | { readonly kind: \"old-name-in-command\"; readonly location: string; readonly word: string }\n /** A CI step whose `shell` is a program the tool does not read (`shell: python`). */\n | { readonly kind: \"script-not-shell\"; readonly location: string; readonly shell: string }\n | { readonly kind: \"command-string\"; readonly line: number; readonly to: string }\n | { readonly kind: \"config-unreadable\"; readonly position: TextPosition | undefined }\n | { readonly kind: \"manifest-not-read\" }\n /** A patch file (patch-package, pnpm, Yarn) of an old package's code. */\n | { readonly kind: \"old-package-patch\"; readonly name: string; readonly to: string }\n /** A Deno config names an import map by a URL or a path outside the project. */\n | { readonly kind: \"import-map-not-editable\"; readonly reference: string }\n | { readonly kind: \"options-not-inspected\"; readonly line: number }\n /** A spread in the options (`...base`) of an object the tool cannot read. */\n | { readonly kind: \"options-spread-not-inspected\"; readonly line: number }\n | { readonly kind: \"deep-import\"; readonly line: number; readonly specifier: string }\n /** A module specifier that is a path into the installed files of an old package. */\n | {\n readonly kind: \"old-package-import\";\n readonly line: number;\n readonly specifier: string;\n readonly name: string;\n readonly to: string;\n }\n /** A specifier of a config (`imports`, `browser`) that reaches into a renamed package. */\n | { readonly kind: \"deep-target\"; readonly location: string; readonly specifier: string }\n /** A config path into the installed files of an old package, which the new one does not have. */\n | {\n readonly kind: \"old-package-path\";\n readonly location: string;\n readonly path: string;\n readonly to: string;\n }\n | {\n readonly kind: \"dynamic-specifier\";\n readonly line: number;\n readonly value: string;\n /** The new name of the package the specifier starts with. */\n readonly to: string;\n }\n | {\n readonly kind: \"string-names-package\";\n readonly line: number;\n readonly value: string;\n readonly to: string;\n }\n | {\n readonly kind: \"old-peer-needed\";\n readonly dependent: string;\n readonly peer: string;\n readonly range: string;\n }\n | {\n readonly kind: \"transform-not-rewritten\";\n readonly line: number;\n readonly reason: TransformKeepReason;\n }\n | { readonly kind: \"legacy-callback\"; readonly line: number; readonly callback: string }\n | {\n readonly kind: \"package-not-declared\";\n readonly line: number;\n readonly name: string;\n /** The original packages that installed it as their own dependency. */\n readonly installers: readonly string[];\n };\n\n/** Why a `transform` callback was left as it is. */\nexport type TransformKeepReason =\n | \"other-callbacks\"\n | \"not-a-function\"\n | \"shared-function\"\n | \"shared-options\"\n | \"unknown-return\"\n | \"typed-options\"\n | \"spread-options\"\n | \"declared-type\"\n | \"in-spread\";\n\n/** A file's new text and what was found in it. Unchanged text means nothing to write. */\nexport interface FileMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** The result for a file that the migration does not touch. */\nexport function unchanged(text: string): FileMigration {\n return { text, changes: [], manualSteps: [] };\n}\n\n/** Line number (1-based) of a character offset. */\nexport function lineAt(text: string, offset: number): number {\n let line = 1;\n for (let index = text.indexOf(\"\\n\"); index !== -1 && index < offset; ) {\n line++;\n index = text.indexOf(\"\\n\", index + 1);\n }\n return line;\n}\n\n/**\n * Line numbers (1-based) of character offsets in `text`, for a migration that names many places\n * of one text. The line starts are found once and searched by halves, so naming every command of\n * a large file stays linear in its size (`lineAt` for each one was quadratic: 57 s on 4 MB).\n */\nexport function lineLocator(text: string): (offset: number) => number {\n const lineStarts = [0];\n for (let index = text.indexOf(\"\\n\"); index !== -1; index = text.indexOf(\"\\n\", index + 1)) {\n lineStarts.push(index + 1);\n }\n return (offset) => {\n // The last line start at or before `offset`; a break at `offset` itself ends that line.\n let low = 0;\n let high = lineStarts.length - 1;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n if ((lineStarts[middle] as number) <= offset) {\n low = middle;\n } else {\n high = middle - 1;\n }\n }\n return low + 1;\n };\n}\n\n/** Column number (1-based) of a character offset. */\nexport function columnAt(text: string, offset: number): number {\n return offset - text.lastIndexOf(\"\\n\", offset - 1);\n}\n","/**\n * A migration that would corrupt a file: two edits or two strings of one file overlap, which\n * only a bug of the tool can cause. The file is left as it was and reported, and the other files\n * are still migrated: the bug of one reader must not hide the changes of all the others.\n */\nexport class MigrationBugError extends Error {\n override readonly name = \"MigrationBugError\";\n}\n","import { MigrationBugError } from \"./migration-bug.js\";\n\n/**\n * Edits by offset into the original text. A migration changes only the names, specs and command\n * words it renames, so everything else stays byte for byte: formatting, comments, key order,\n * number spellings, escapes and duplicate keys.\n */\nexport interface TextEdit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\n/**\n * The text with the edits applied. Edits that overlap cannot both apply: that is a bug of the\n * migration that made them, and applying them would corrupt the file.\n */\nexport function applyTextEdits(text: string, edits: readonly TextEdit[]): string {\n const sorted = [...edits].sort((left, right) => left.start - right.start);\n let edited = \"\";\n let copiedUpTo = 0;\n for (const edit of sorted) {\n if (edit.start < copiedUpTo) {\n throw new MigrationBugError(`edits overlap at offset ${edit.start}`);\n }\n edited += `${text.slice(copiedUpTo, edit.start)}${edit.text}`;\n copiedUpTo = edit.end;\n }\n return edited + text.slice(copiedUpTo);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport type { FileBindings } from \"./file-bindings.js\";\n\n/**\n * The types a `transform` declares outside its own return type: the type of the `const` that\n * holds it (`const transform: (s: SchemaObject) => ts.TypeNode = …`, or JSDoc `@type` there and\n * on the option), and a JSDoc `@returns`. Each names TypeScript nodes, which the rewritten\n * returns no longer are, so the file stopped compiling. A TypeScript node type in them becomes\n * `string`, the type text the returns are now; a type the tool cannot map keeps the `transform`.\n */\n\n/** The text that replaces a TypeScript node type: the returns are type text strings. */\nconst TYPE_TEXT = \"string\";\nconst TYPESCRIPT_MODULES: ReadonlySet<string> = new Set([\"typescript\", \"@typescript/typescript6\"]);\n\n/** What the declared types need: edits, or undefined when one of them cannot be mapped. */\nexport type DeclaredTypeEdits = TextEdit[] | undefined;\n\n/** Whether a type reference names a TypeScript node type: `ts.TypeNode`, a named import of it. */\nfunction isTypescriptReference(node: ts.TypeReferenceNode, bindings: FileBindings): boolean {\n const name = node.typeName;\n if (ts.isIdentifier(name)) {\n return bindings.bindingOf(name)?.kind === \"typescript-import\";\n }\n return ts.isIdentifier(name.left) && bindings.bindingOf(name.left)?.kind === \"typescript-module\";\n}\n\n/** Whether an import type names the TypeScript module: `import(\"typescript\").TypeNode`. */\nfunction isTypescriptImportType(node: ts.ImportTypeNode): boolean {\n const { argument } = node;\n return (\n !node.isTypeOf &&\n ts.isLiteralTypeNode(argument) &&\n ts.isStringLiteral(argument.literal) &&\n TYPESCRIPT_MODULES.has(argument.literal.text)\n );\n}\n\n/** The edits of every part, or undefined when one part cannot be mapped. */\nfunction joined(found: readonly DeclaredTypeEdits[]): DeclaredTypeEdits {\n const edits: TextEdit[] = [];\n for (const part of found) {\n if (part === undefined) {\n return undefined;\n }\n edits.push(...part);\n }\n return edits;\n}\n\n/** The edits for the members of a type literal (`{ schema: ts.TypeNode; questionToken: … }`). */\nconst memberEdits = (node: ts.TypeLiteralNode, bindings: FileBindings): DeclaredTypeEdits =>\n joined(\n node.members.map((member) =>\n ts.isPropertySignature(member) ? typeEdits(member.type, bindings) : undefined,\n ),\n );\n\nconst replaced = (node: ts.Node): TextEdit[] => [\n { start: node.getStart(), end: node.getEnd(), text: TYPE_TEXT },\n];\n\nconst isKeyword = (node: ts.Node): boolean =>\n node.kind >= ts.SyntaxKind.FirstKeyword && node.kind <= ts.SyntaxKind.LastKeyword;\n\n/**\n * The edits that make a declared return type fit type text: each TypeScript node type becomes\n * `string`; keywords and literal types stay. Undefined for any other type (a local alias,\n * `TransformObject`, an array), whose meaning the tool does not map.\n */\nfunction typeEdits(node: ts.TypeNode | undefined, bindings: FileBindings): DeclaredTypeEdits {\n if (node === undefined) {\n return undefined;\n }\n if (ts.isLiteralTypeNode(node) || isKeyword(node)) {\n return [];\n }\n if (ts.isUnionTypeNode(node) || ts.isIntersectionTypeNode(node)) {\n return joined(node.types.map((part) => typeEdits(part, bindings)));\n }\n if (ts.isParenthesizedTypeNode(node)) {\n return typeEdits(node.type, bindings);\n }\n if (ts.isTypeLiteralNode(node)) {\n return memberEdits(node, bindings);\n }\n const isNodeType = ts.isTypeReferenceNode(node)\n ? isTypescriptReference(node, bindings)\n : ts.isImportTypeNode(node) && isTypescriptImportType(node);\n return isNodeType ? replaced(node) : undefined;\n}\n\n/** The return type of a function type (`(s) => R`, JSDoc `function(s): R`), or undefined. */\nfunction functionReturnType(node: ts.TypeNode): ts.TypeNode | undefined {\n return ts.isFunctionTypeNode(node) || ts.isJSDocFunctionType(node) ? node.type : undefined;\n}\n\n/**\n * The declared type of the `const` or the option that holds `transform`, as TypeScript reads it:\n * the annotation, or the JSDoc `@type` in a JavaScript file.\n */\nexport function declaredType(node: ts.Node): ts.TypeNode | undefined {\n const annotation = ts.isVariableDeclaration(node) ? node.type : undefined;\n const isJavaScript = (node.flags & ts.NodeFlags.JavaScriptFile) !== 0;\n return annotation ?? (isJavaScript ? ts.getJSDocType(node) : undefined);\n}\n\n/**\n * The edits for one declared type of the callback: the return type of a function type. The\n * options member (`OpenAPITSOptions[\"transform\"]`) is retargeted with the options type\n * (options-type.ts), and `any` takes type text; any other type is not mapped (undefined).\n */\nfunction annotationEdits(type: ts.TypeNode, bindings: FileBindings): DeclaredTypeEdits {\n const returned = functionReturnType(type);\n if (returned !== undefined) {\n return typeEdits(returned, bindings);\n }\n return ts.isIndexedAccessTypeNode(type) || isKeyword(type) ? [] : undefined;\n}\n\n/**\n * The edits that make the declared types of a callback fit type text: its `const` or option\n * types and its JSDoc `@returns`. Undefined when one of them cannot be mapped, so the\n * `transform` is kept and reported.\n */\nexport function callbackTypeEdits(\n annotations: readonly ts.TypeNode[],\n callback: ts.FunctionLikeDeclaration,\n bindings: FileBindings,\n): DeclaredTypeEdits {\n const returnsTag = ts.getJSDocReturnTag(callback)?.typeExpression?.type;\n return joined([\n ...annotations.map((type) => annotationEdits(type, bindings)),\n returnsTag === undefined ? [] : typeEdits(returnsTag, bindings),\n ]);\n}\n","import ts from \"@typescript/typescript6\";\n\n/**\n * The module-level names of a file that the rewriter follows: the TypeScript module and its named\n * imports, the generator and its helpers, module-level `const`s and functions. Identifiers are\n * resolved by scope with the TypeScript checker, so a local `const DATE` inside a callback is not\n * the module's `DATE`, however it is spelled.\n */\n\nexport type Binding =\n /** `ts` in `import ts from \"typescript\"` or `import * as ts from \"typescript\"`. */\n | { readonly kind: \"typescript-module\" }\n /** `factory` in `import { factory } from \"typescript\"`, by its imported name. */\n | { readonly kind: \"typescript-import\"; readonly name: string }\n /** A named import from the generator (`tsUnion`, `NULL`), by its imported name. */\n | { readonly kind: \"helper-import\"; readonly name: string }\n /** The generator function: the default import of the generator module. */\n | { readonly kind: \"generator-function\" }\n /** A namespace import of the generator module; `ns.default` is the generator function. */\n | { readonly kind: \"generator-module\" }\n /** A module-level `const` with an initializer. */\n | { readonly kind: \"constant\"; readonly initializer: ts.Expression }\n /** A module-level function declaration. */\n | { readonly kind: \"function\"; readonly declaration: ts.FunctionDeclaration }\n /** A module-level type: an alias, an interface or a JSDoc `@typedef`. */\n | { readonly kind: \"local-type\"; readonly declaration: LocalTypeDeclaration };\n\nexport type LocalTypeDeclaration =\n | ts.TypeAliasDeclaration\n | ts.InterfaceDeclaration\n | ts.JSDocTypedefTag;\n\nexport interface FileBindings {\n /** Every binding of the file, by its declaration node. */\n readonly declarations: ReadonlyMap<ts.Node, Binding>;\n /** The declaration node an identifier refers to, if it is a binding of this file. */\n declarationOf(identifier: ts.Identifier): ts.Node | undefined;\n bindingOf(identifier: ts.Identifier): Binding | undefined;\n /** The identifiers that refer to a declaration, without the name it declares. */\n usesOf(declaration: ts.Node): readonly ts.Identifier[];\n /** True when the file imports the generator, so it may call it. */\n readonly hasGenerator: boolean;\n}\n\n/** True for a declaration with an `export` modifier (`export const`, `export function`). */\nexport const hasExportModifier = (declaration: ts.Node): boolean =>\n (ts.getCombinedModifierFlags(declaration as ts.Declaration) & ts.ModifierFlags.Export) !== 0;\n\n/** The generator after the specifier rename, and before it, for files the rename skipped. */\nexport const GENERATOR_MODULES: ReadonlySet<string> = new Set([\n \"openapi-typesafe\",\n \"openapi-typescript\",\n]);\nconst TYPESCRIPT_MODULES: ReadonlySet<string> = new Set([\"typescript\", \"@typescript/typescript6\"]);\nconst DEFAULT_EXPORT = \"default\";\n\ntype BindingMap = Map<ts.Node, Binding>;\n\nfunction addNamedImports(clause: ts.ImportClause, isGenerator: boolean, into: BindingMap): void {\n const bindings = clause.namedBindings;\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n return;\n }\n for (const element of bindings.elements) {\n const name = (element.propertyName ?? element.name).text;\n const binding: Binding = isGenerator\n ? name === DEFAULT_EXPORT\n ? { kind: \"generator-function\" }\n : { kind: \"helper-import\", name }\n : { kind: \"typescript-import\", name };\n into.set(element, binding);\n }\n}\n\n/** An `import` statement, or a JSDoc `@import` tag of a JavaScript file, which has its parts. */\ntype ImportForm = Pick<ts.ImportDeclaration, \"importClause\" | \"moduleSpecifier\">;\n\nfunction addImport(statement: ImportForm, into: BindingMap): void {\n const clause = statement.importClause;\n const specifier = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : \"\";\n const isGenerator = GENERATOR_MODULES.has(specifier);\n if (clause === undefined || (!isGenerator && !TYPESCRIPT_MODULES.has(specifier))) {\n return;\n }\n if (clause.name !== undefined) {\n into.set(clause, isGenerator ? { kind: \"generator-function\" } : { kind: \"typescript-module\" });\n }\n const namespace = clause.namedBindings;\n if (namespace !== undefined && ts.isNamespaceImport(namespace)) {\n const kind = isGenerator ? \"generator-module\" : \"typescript-module\";\n into.set(namespace, { kind });\n }\n addNamedImports(clause, isGenerator, into);\n}\n\nfunction addConstants(statement: ts.VariableStatement, into: BindingMap): void {\n if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0) {\n return;\n }\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer !== undefined) {\n into.set(declaration, { kind: \"constant\", initializer: declaration.initializer });\n }\n }\n}\n\nfunction addStatement(statement: ts.Statement, into: BindingMap): void {\n if (ts.isImportDeclaration(statement)) {\n addImport(statement, into);\n } else if (ts.isVariableStatement(statement)) {\n addConstants(statement, into);\n } else if (ts.isFunctionDeclaration(statement) && statement.name !== undefined) {\n into.set(statement, { kind: \"function\", declaration: statement });\n } else if (ts.isTypeAliasDeclaration(statement) || ts.isInterfaceDeclaration(statement)) {\n into.set(statement, { kind: \"local-type\", declaration: statement });\n }\n}\n\nfunction collectBindings(file: ts.SourceFile): BindingMap {\n const bindings: BindingMap = new Map();\n for (const statement of file.statements) {\n addStatement(statement, bindings);\n }\n return bindings;\n}\n\n/** A compiler host that knows only the parsed file, so the file system is never read. */\nexport function singleFileHost(file: ts.SourceFile): ts.CompilerHost {\n return {\n getSourceFile: (name) => (name === file.fileName ? file : undefined),\n getDefaultLibFileName: () => \"lib.d.ts\",\n writeFile: () => undefined,\n getCurrentDirectory: () => \"\",\n getCanonicalFileName: (name) => name,\n useCaseSensitiveFileNames: () => true,\n getNewLine: () => \"\\n\",\n fileExists: (name) => name === file.fileName,\n readFile: () => undefined,\n };\n}\n\n/**\n * A checker for this one file: no default library and no module resolution, which binding names\n * by scope does not need.\n */\nfunction createChecker(file: ts.SourceFile): ts.TypeChecker {\n const options: ts.CompilerOptions = { noLib: true, noResolve: true, allowJs: true, types: [] };\n const host = singleFileHost(file);\n return ts.createProgram({ rootNames: [file.fileName], options, host }).getTypeChecker();\n}\n\n/**\n * The symbol of an identifier; `{ DATE }` refers to the variable, not to the new property, and\n * `export { DATE }` to the variable, not to the export alias, so an export counts as a use.\n */\nfunction symbolOf(checker: ts.TypeChecker, identifier: ts.Identifier): ts.Symbol | undefined {\n const parent = identifier.parent;\n if (ts.isShorthandPropertyAssignment(parent) && parent.name === identifier) {\n return checker.getShorthandAssignmentValueSymbol(parent);\n }\n if (ts.isExportSpecifier(parent)) {\n return checker.getExportSpecifierLocalTargetSymbol(parent);\n }\n return checker.getSymbolAtLocation(identifier);\n}\n\n/** True for the name that a declaration of this file declares, and for names in imports. */\nfunction isDeclaredName(identifier: ts.Identifier, declaration: ts.Node): boolean {\n const declaredName = (declaration as ts.NamedDeclaration).name;\n return (\n declaredName === identifier || ts.findAncestor(identifier, ts.isImportDeclaration) !== undefined\n );\n}\n\n/**\n * The binding of a JSDoc declaration of a JavaScript file: a `@typedef`, or a name of an\n * `@import`. The checker finds them in any JSDoc comment, so they are bound when a name refers to\n * one; TypeScript's API lists only the last JSDoc comment of a node.\n */\nfunction addJSDocBinding(declaration: ts.Node, into: BindingMap): void {\n if (ts.isJSDocTypedefTag(declaration)) {\n into.set(declaration, { kind: \"local-type\", declaration });\n return;\n }\n const importTag = ts.findAncestor(declaration, ts.isJSDocImportTag);\n if (importTag !== undefined) {\n addImport(importTag, into);\n }\n}\n\n/**\n * The uses of each binding, JSDoc included: `@param {ts.TypeNode}` types a JavaScript file, and\n * `{@link ts.factory}` refers to the import. `getChildren` lists the JSDoc blocks of a node,\n * which `forEachChild` skips.\n */\nfunction indexUses(file: ts.SourceFile, bindings: FileBindings): Map<ts.Node, ts.Identifier[]> {\n const uses = new Map<ts.Node, ts.Identifier[]>();\n const visit = (node: ts.Node): void => {\n const declaration = ts.isIdentifier(node) ? bindings.declarationOf(node) : undefined;\n if (declaration !== undefined && !isDeclaredName(node as ts.Identifier, declaration)) {\n uses.set(declaration, [...(uses.get(declaration) ?? []), node as ts.Identifier]);\n }\n for (const child of node.getChildren(file)) {\n visit(child);\n }\n };\n visit(file);\n return uses;\n}\n\nclass CheckedFileBindings implements FileBindings {\n readonly hasGenerator: boolean;\n readonly #file: ts.SourceFile;\n readonly #bindings: BindingMap;\n readonly declarations: ReadonlyMap<ts.Node, Binding>;\n #checker: ts.TypeChecker | undefined;\n #uses: Map<ts.Node, ts.Identifier[]> | undefined;\n\n constructor(file: ts.SourceFile) {\n this.#file = file;\n this.#bindings = collectBindings(file);\n this.declarations = this.#bindings;\n this.hasGenerator = [...this.#bindings.values()].some(\n (binding) => binding.kind === \"generator-function\" || binding.kind === \"generator-module\",\n );\n }\n\n declarationOf(identifier: ts.Identifier): ts.Node | undefined {\n // The checker is built on first use: most files never call the generator.\n this.#checker ??= createChecker(this.#file);\n const declaration = symbolOf(this.#checker, identifier)?.declarations?.[0];\n if (declaration !== undefined && !this.#bindings.has(declaration)) {\n addJSDocBinding(declaration, this.#bindings);\n }\n return declaration !== undefined && this.#bindings.has(declaration) ? declaration : undefined;\n }\n\n bindingOf(identifier: ts.Identifier): Binding | undefined {\n const declaration = this.declarationOf(identifier);\n return declaration === undefined ? undefined : this.#bindings.get(declaration);\n }\n\n usesOf(declaration: ts.Node): readonly ts.Identifier[] {\n this.#uses ??= indexUses(this.#file, this);\n return this.#uses.get(declaration) ?? [];\n }\n}\n\n/** The bindings of a parsed file (parsed with parent pointers). */\nexport function createFileBindings(file: ts.SourceFile): FileBindings {\n return new CheckedFileBindings(file);\n}\n","import ts from \"@typescript/typescript6\";\nimport { type FileBindings, hasExportModifier } from \"./file-bindings.js\";\n\n/**\n * The `openapiTS(source, options)` calls of a file, and where their options object is: written in\n * the call, in a module-level `const` (`openapiTS(source, options)`), or somewhere the rewriter\n * cannot see. The generator is the default import of the generator module, by any local name,\n * or `ns.default` of a namespace import (`import * as ns from \"openapi-typescript\"`).\n */\n\nexport type GeneratorOptions =\n /**\n * An object literal that only this call uses: it may be rewritten. `annotations` are the types\n * it is declared with: the type of its `const`, and `satisfies` or `as` around it, also as a\n * JSDoc `@type` or `@satisfies` of a JavaScript file. `isContextuallyTyped` is false for an\n * object in a `const` with none of these: its `true` values widen to `boolean`.\n */\n | {\n readonly kind: \"own\";\n readonly options: ts.ObjectLiteralExpression;\n readonly annotations: readonly ts.TypeNode[];\n readonly isContextuallyTyped: boolean;\n }\n /** An object literal in a `const` that other code uses too: it is only reported. */\n | { readonly kind: \"shared\"; readonly options: ts.ObjectLiteralExpression }\n /** An expression that is not an object literal of this file. */\n | { readonly kind: \"unknown\"; readonly expression: ts.Expression };\n\nexport interface GeneratorCall {\n readonly call: ts.CallExpression;\n /** Undefined when the call passes no options. */\n readonly options: GeneratorOptions | undefined;\n}\n\nconst DEFAULT_EXPORT = \"default\";\n\nfunction isGenerator(callee: ts.Expression, bindings: FileBindings): boolean {\n if (ts.isIdentifier(callee)) {\n return bindings.bindingOf(callee)?.kind === \"generator-function\";\n }\n return (\n ts.isPropertyAccessExpression(callee) &&\n callee.name.text === DEFAULT_EXPORT &&\n ts.isIdentifier(callee.expression) &&\n bindings.bindingOf(callee.expression)?.kind === \"generator-module\"\n );\n}\n\n/**\n * The types of the JSDoc `@type` and `@satisfies` tags of a node of a JavaScript file, which\n * TypeScript checks it with as with an annotation: `@type {T}` on `(value)` is `value as T`. In a\n * TypeScript file such a tag checks nothing.\n */\nfunction jsDocTypes(node: ts.Node): ts.TypeNode[] {\n if ((node.flags & ts.NodeFlags.JavaScriptFile) === 0) {\n return [];\n }\n return ts\n .getJSDocTags(node)\n .filter((tag) => ts.isJSDocTypeTag(tag) || ts.isJSDocSatisfiesTag(tag))\n .map((tag) => (tag as ts.JSDocTypeTag | ts.JSDocSatisfiesTag).typeExpression.type);\n}\n\n/**\n * The expression without parentheses, `as` and `satisfies`, which do not change the value, and\n * the types of the `as` and `satisfies` around it.\n */\nexport function unwrapped(\n expression: ts.Expression,\n types: ts.TypeNode[] = [],\n): { value: ts.Expression; types: ts.TypeNode[] } {\n if (ts.isParenthesizedExpression(expression)) {\n return unwrapped(expression.expression, [...types, ...jsDocTypes(expression)]);\n }\n if (ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression)) {\n return unwrapped(expression.expression, [...types, expression.type]);\n }\n return { value: expression, types };\n}\n\n/** The options object a `const` holds, owned by this call when the call is its only use. */\nfunction constantOptions(\n name: ts.Identifier,\n bindings: FileBindings,\n outerTypes: readonly ts.TypeNode[],\n): GeneratorOptions {\n const binding = bindings.bindingOf(name);\n const declaration = bindings.declarationOf(name) as ts.Node;\n const found = binding?.kind === \"constant\" ? unwrapped(binding.initializer) : undefined;\n if (found === undefined || !ts.isObjectLiteralExpression(found.value)) {\n return { kind: \"unknown\", expression: name };\n }\n const isOwn = bindings.usesOf(declaration).length === 1 && !hasExportModifier(declaration);\n if (!isOwn) {\n return { kind: \"shared\", options: found.value };\n }\n const declared = (declaration as ts.VariableDeclaration).type;\n // A type around the name in the call (`options as T`) does not type the object.\n const ownTypes = [\n ...found.types,\n ...(declared === undefined ? [] : [declared]),\n ...jsDocTypes(declaration),\n ];\n const annotations = [...outerTypes, ...ownTypes];\n return {\n kind: \"own\",\n options: found.value,\n annotations,\n isContextuallyTyped: ownTypes.length > 0,\n };\n}\n\nfunction optionsOf(argument: ts.Expression, bindings: FileBindings): GeneratorOptions {\n const { value, types } = unwrapped(argument);\n if (ts.isObjectLiteralExpression(value)) {\n return { kind: \"own\", options: value, annotations: types, isContextuallyTyped: true };\n }\n return ts.isIdentifier(value)\n ? constantOptions(value, bindings, types)\n : { kind: \"unknown\", expression: argument };\n}\n\n/** Every generator call of the file, in source order. */\nexport function generatorCalls(file: ts.SourceFile, bindings: FileBindings): GeneratorCall[] {\n const calls: GeneratorCall[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isCallExpression(node) && isGenerator(node.expression, bindings)) {\n const argument = node.arguments[1];\n const options = argument === undefined ? undefined : optionsOf(argument, bindings);\n calls.push({ call: node, options });\n }\n ts.forEachChild(node, visit);\n };\n visit(file);\n return calls;\n}\n","import ts from \"@typescript/typescript6\";\nimport { lineAt, type ManualStep } from \"../../domain/migration-findings.js\";\n\n/** The properties of an `openapiTS` options object that the rewriter looks for. */\n\nexport const TRANSFORM = \"transform\";\n/** The legacy callbacks that are only reported: they have no IR form the tool can write. */\nexport const LEGACY_ONLY_CALLBACKS = [\"postTransform\", \"transformProperty\"] as const;\nexport const IR_CALLBACKS_OPTION = \"irCallbacks\";\n\n/** The property of an object literal with the name `name`, written as a name or a string. */\nexport function propertyNamed(\n options: ts.ObjectLiteralExpression,\n name: string,\n): ts.ObjectLiteralElementLike | undefined {\n return options.properties.find((property) => {\n const key = property.name;\n return (\n key !== undefined && (ts.isIdentifier(key) || ts.isStringLiteral(key)) && key.text === name\n );\n });\n}\n\n/** One step for each `postTransform` and `transformProperty` of the options. */\nexport function legacyCallbackSteps(\n options: ts.ObjectLiteralExpression,\n text: string,\n): ManualStep[] {\n return LEGACY_ONLY_CALLBACKS.flatMap((callback) => {\n const property = propertyNamed(options, callback);\n return property === undefined\n ? []\n : [{ kind: \"legacy-callback\" as const, line: lineAt(text, property.getStart()), callback }];\n });\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport { type FileBindings, GENERATOR_MODULES } from \"./file-bindings.js\";\n\n/**\n * The options type of a rewritten `transform`. `OpenAPITSOptions` types the TypeScript-node\n * callbacks, so options declared with it (`const options: OpenAPITSOptions`, `satisfies\n * OpenAPITSOptions`) stopped compiling once `irCallbacks: true` and type text were in them. The\n * annotations of rewritten options name `OpenAPITSIrOptions`, the type of the IR callbacks.\n */\n\nconst TS_NODE_OPTIONS = \"OpenAPITSOptions\";\nconst IR_OPTIONS = \"OpenAPITSIrOptions\";\nconst TYPE_MODIFIER = \"type \";\n\n/** `import(\"openapi-typescript\").OpenAPITSOptions`: its `OpenAPITSOptions`, or undefined. */\nfunction importTypeName(node: ts.ImportTypeNode): ts.Identifier | undefined {\n const { argument, qualifier } = node;\n const isGeneratorModule =\n ts.isLiteralTypeNode(argument) &&\n ts.isStringLiteral(argument.literal) &&\n GENERATOR_MODULES.has(argument.literal.text);\n const isOptions =\n !node.isTypeOf &&\n qualifier !== undefined &&\n ts.isIdentifier(qualifier) &&\n qualifier.text === TS_NODE_OPTIONS;\n return isGeneratorModule && isOptions ? qualifier : undefined;\n}\n\n/** The name a type reference or an `extends` names (`A`, `ns.A`), or undefined. */\nfunction referencedName(node: ts.Node): ts.Node | undefined {\n if (ts.isTypeReferenceNode(node)) {\n return node.typeName;\n }\n return ts.isExpressionWithTypeArguments(node) ? node.expression : undefined;\n}\n\n/** The two parts of `ns.A`: a qualified type name, or the expression of an `extends`. */\nfunction qualifiedParts(name: ts.Node): { left: ts.Node; right: ts.Node } | undefined {\n if (ts.isQualifiedName(name)) {\n return { left: name.left, right: name.right };\n }\n return ts.isPropertyAccessExpression(name)\n ? { left: name.expression, right: name.name }\n : undefined;\n}\n\n/**\n * The identifier of `OpenAPITSOptions` that a type reference or an `extends` names, by any local\n * name of its import, as `ns.OpenAPITSOptions` of a namespace import or as an import type, or\n * undefined.\n */\nfunction optionsTypeName(node: ts.Node, bindings: FileBindings): ts.Identifier | undefined {\n if (ts.isImportTypeNode(node)) {\n return importTypeName(node);\n }\n const name = referencedName(node);\n if (name !== undefined && ts.isIdentifier(name)) {\n const binding = bindings.bindingOf(name);\n return binding?.kind === \"helper-import\" && binding.name === TS_NODE_OPTIONS ? name : undefined;\n }\n const parts = name === undefined ? undefined : qualifiedParts(name);\n if (parts === undefined || !ts.isIdentifier(parts.left) || !ts.isIdentifier(parts.right)) {\n return undefined;\n }\n const isGeneratorModule = bindings.bindingOf(parts.left)?.kind === \"generator-module\";\n return isGeneratorModule && parts.right.text === TS_NODE_OPTIONS ? parts.right : undefined;\n}\n\n/**\n * The declaration of a type of this file that a type reference or an `extends` names: an alias,\n * an interface or a JSDoc `@typedef`, or undefined.\n */\nfunction localTypeOf(node: ts.Node, bindings: FileBindings): ts.Node | undefined {\n const name = referencedName(node);\n const binding =\n name !== undefined && ts.isIdentifier(name) ? bindings.bindingOf(name) : undefined;\n return binding?.kind === \"local-type\" ? binding.declaration : undefined;\n}\n\n/**\n * Whether a type names `OpenAPITSOptions` anywhere in it (`Partial<OpenAPITSOptions>`), also\n * through a type of this file (`type Opts = OpenAPITSOptions`), which the rewrite does not change.\n */\nfunction mentionsOptionsType(\n node: ts.Node,\n bindings: FileBindings,\n seen: Set<ts.Node> = new Set(),\n): boolean {\n const local = localTypeOf(node, bindings);\n const isNewLocal = local !== undefined && !seen.has(local);\n if (isNewLocal) {\n seen.add(local);\n }\n const mentions = (child: ts.Node) => mentionsOptionsType(child, bindings, seen) || undefined;\n return (\n (isNewLocal && mentionsOptionsType(local, bindings, seen)) ||\n optionsTypeName(node, bindings) !== undefined ||\n (ts.forEachChild(node, mentions) ?? false)\n );\n}\n\n/**\n * The `OpenAPITSOptions` names to retarget in the annotations of rewritten options: an annotation\n * that is the type (`OpenAPITSOptions`) or a member of it (`OpenAPITSOptions[\"transform\"]`).\n * Undefined when one names it otherwise (`Partial<OpenAPITSOptions>`): the tool cannot tell the IR\n * type of that, so the `transform` is not rewritten.\n */\nexport function optionsTypeReferences(\n annotations: readonly ts.TypeNode[],\n bindings: FileBindings,\n): ts.Identifier[] | undefined {\n const references: ts.Identifier[] = [];\n for (const annotation of annotations) {\n const target = ts.isIndexedAccessTypeNode(annotation) ? annotation.objectType : annotation;\n const reference = optionsTypeName(target, bindings);\n if (reference !== undefined) {\n references.push(reference);\n } else if (mentionsOptionsType(annotation, bindings)) {\n return undefined;\n }\n }\n return references;\n}\n\nconst renamed = (identifier: ts.Identifier, text: string): TextEdit => ({\n start: identifier.getStart(),\n end: identifier.getEnd(),\n text,\n});\n\n/** The local name of an import of `OpenAPITSIrOptions` that the file has, or undefined. */\nfunction importedIrOptions(bindings: FileBindings): string | undefined {\n for (const [declaration, binding] of bindings.declarations) {\n if (binding.kind === \"helper-import\" && binding.name === IR_OPTIONS) {\n return (declaration as ts.ImportSpecifier).name.text;\n }\n }\n return undefined;\n}\n\n/**\n * The edits for the references of one import of `OpenAPITSOptions`. When the rewritten options\n * are its only uses, the import names `OpenAPITSIrOptions` instead; else it is imported too. A\n * JavaScript file imports it with a JSDoc `@import` and names it in JSDoc comments, whose uses\n * TypeScript's API does not all list, so there it is always imported too.\n */\nfunction importEdits(\n specifier: ts.ImportSpecifier,\n references: readonly ts.Identifier[],\n bindings: FileBindings,\n): TextEdit[] {\n const isJavaScript = (specifier.flags & ts.NodeFlags.JavaScriptFile) !== 0;\n const isOnlyUse =\n !isJavaScript && bindings.usesOf(specifier).every((use) => references.includes(use));\n if (isOnlyUse && specifier.propertyName !== undefined) {\n return [renamed(specifier.propertyName as ts.Identifier, IR_OPTIONS)];\n }\n const uses = references.map((reference) => renamed(reference, IR_OPTIONS));\n if (isOnlyUse) {\n return [renamed(specifier.name, IR_OPTIONS), ...uses];\n }\n const isTypeImport = specifier.parent.parent.isTypeOnly;\n const added = `, ${isTypeImport ? \"\" : TYPE_MODIFIER}${IR_OPTIONS}`;\n return [{ start: specifier.getEnd(), end: specifier.getEnd(), text: added }, ...uses];\n}\n\n/** The edits that make the references name `OpenAPITSIrOptions`, with its import. */\nexport function optionsTypeEdits(\n references: readonly ts.Identifier[],\n bindings: FileBindings,\n): TextEdit[] {\n const edits: TextEdit[] = [];\n const byImport = new Map<ts.ImportSpecifier, ts.Identifier[]>();\n const existing = importedIrOptions(bindings);\n for (const reference of new Set(references)) {\n const specifier = bindings.declarationOf(reference);\n if (specifier === undefined || !ts.isImportSpecifier(specifier)) {\n edits.push(renamed(reference, IR_OPTIONS));\n } else if (existing !== undefined) {\n edits.push(renamed(reference, existing));\n } else {\n byImport.set(specifier, [...(byImport.get(specifier) ?? []), reference]);\n }\n }\n for (const [specifier, found] of byImport) {\n edits.push(...importEdits(specifier, found, bindings));\n }\n return edits;\n}\n","import ts from \"@typescript/typescript6\";\n\n/** A part of a file that is a script, and where it starts in the file. */\nexport interface ScriptRegion {\n readonly offset: number;\n readonly text: string;\n readonly kind: ts.ScriptKind;\n}\n\nconst SCRIPT_KINDS: ReadonlyMap<string, ts.ScriptKind> = new Map([\n [\".ts\", ts.ScriptKind.TS],\n [\".mts\", ts.ScriptKind.TS],\n [\".cts\", ts.ScriptKind.TS],\n [\".tsx\", ts.ScriptKind.TSX],\n [\".js\", ts.ScriptKind.JS],\n [\".mjs\", ts.ScriptKind.JS],\n [\".cjs\", ts.ScriptKind.JS],\n [\".jsx\", ts.ScriptKind.JSX],\n]);\n\nconst ASTRO_EXTENSION = \".astro\";\nconst MDX_EXTENSION = \".mdx\";\n/** An MDX ESM block starts with `import` or `export` at the start of a line. */\nconst MDX_ESM_START_RE = /^(?:import|export)\\b/;\n/** A Markdown code fence: three or more backticks or tildes, indented by at most 3 spaces. */\nconst CODE_FENCE_RE = /^ {0,3}(`{3,}|~{3,})/;\nconst MDX_KIND = ts.ScriptKind.JSX;\nconst SCRIPT_OPEN_TAG = \"<script\";\nconst TAG_END = \">\";\n/** Astro's component script: the fenced block at the top of the file. */\nconst ASTRO_FRONTMATTER_RE = /^(\\s*---\\r?\\n)([\\s\\S]*?)\\r?\\n---/;\nconst LANG_RE = /\\blang\\s*=\\s*[\"']?([a-z]+)/i;\nconst LANG_KINDS: ReadonlyMap<string, ts.ScriptKind> = new Map([\n [\"ts\", ts.ScriptKind.TS],\n [\"typescript\", ts.ScriptKind.TS],\n [\"tsx\", ts.ScriptKind.TSX],\n [\"jsx\", ts.ScriptKind.JSX],\n]);\n\nfunction extensionOf(path: string): string {\n return path.slice(path.lastIndexOf(\".\"));\n}\n\n/** The script kind of a plain script file, or undefined for anything else. */\nexport function plainScriptKind(path: string): ts.ScriptKind | undefined {\n return SCRIPT_KINDS.get(extensionOf(path));\n}\n\n/** Astro scripts are TypeScript; Vue and Svelte scripts are JavaScript unless `lang` says not. */\nfunction blockKind(attributes: string, isAstro: boolean): ts.ScriptKind {\n const lang = LANG_RE.exec(attributes)?.[1]?.toLowerCase();\n const fallback = isAstro ? ts.ScriptKind.TS : ts.ScriptKind.JS;\n return (lang === undefined ? undefined : LANG_KINDS.get(lang)) ?? fallback;\n}\n\n/** Astro's frontmatter, and where the markup after it starts; the markup is the whole text else. */\nfunction astroFrontmatter(text: string): { region?: ScriptRegion; markupStart: number } {\n const frontmatter = ASTRO_FRONTMATTER_RE.exec(text);\n if (frontmatter === null) {\n return { markupStart: 0 };\n }\n const [whole, fence, content] = frontmatter as unknown as [string, string, string];\n const region = { offset: fence.length, text: content, kind: ts.ScriptKind.TS };\n return { region, markupStart: whole.length };\n}\n\n/** A `<script>` block of component markup: its attributes, and its content and where it starts. */\ninterface ScriptBlock {\n readonly attributes: string;\n readonly contentStart: number;\n readonly content: string;\n}\n\n/**\n * The `<script>` blocks of a Vue, Svelte or Astro component, each up to the first closing tag\n * after it. Searches from left to right that never go back, not one regular expression with a\n * lazy body: that one scanned the rest of the file again from every unclosed tag, which took\n * seconds on a crafted file. When a tag or a block is not closed, no later one is either.\n */\nfunction scriptBlocks(markup: string): ScriptBlock[] {\n const openTag = /<script\\b/gi;\n const closeTag = /<\\/script\\s*>/gi;\n const blocks: ScriptBlock[] = [];\n for (let opening = openTag.exec(markup); opening !== null; opening = openTag.exec(markup)) {\n const tagEnd = markup.indexOf(TAG_END, opening.index);\n closeTag.lastIndex = tagEnd + 1;\n const closing = tagEnd === -1 ? null : closeTag.exec(markup);\n if (closing === null) {\n break;\n }\n const attributes = markup.slice(opening.index + SCRIPT_OPEN_TAG.length, tagEnd);\n blocks.push({\n attributes,\n contentStart: tagEnd + 1,\n content: markup.slice(tagEnd + 1, closing.index),\n });\n openTag.lastIndex = closeTag.lastIndex;\n }\n return blocks;\n}\n\nfunction componentRegions(text: string, isAstro: boolean): ScriptRegion[] {\n const { region, markupStart } = isAstro ? astroFrontmatter(text) : { markupStart: 0 };\n const regions: ScriptRegion[] = region === undefined ? [] : [region];\n // Script blocks are read in the markup only: a \"<script>\" string in the frontmatter is code, and\n // a block found there would overlap the frontmatter, so its strings would be edited twice.\n for (const block of scriptBlocks(text.slice(markupStart))) {\n const offset = markupStart + block.contentStart;\n regions.push({ offset, text: block.content, kind: blockKind(block.attributes, isAstro) });\n }\n return regions;\n}\n\n/** Whether a line closes the code fence `fence` opened: the same mark, at least as long. */\nfunction closesFence(line: string, fence: string): boolean {\n const mark = CODE_FENCE_RE.exec(line)?.[1];\n return mark !== undefined && mark[0] === fence[0] && mark.length >= fence.length;\n}\n\n/**\n * The ESM blocks of an MDX file: from a line that starts with `import` or `export`, outside a\n * code fence, up to the next blank line (MDX reads them as JavaScript, JSX allowed).\n */\nfunction mdxRegions(text: string): ScriptRegion[] {\n const regions: ScriptRegion[] = [];\n let fence: string | undefined;\n let block: { start: number; end: number } | undefined;\n let offset = 0;\n for (const line of text.split(\"\\n\")) {\n const end = offset + line.length;\n if (block !== undefined && line.trim() === \"\") {\n regions.push({\n offset: block.start,\n text: text.slice(block.start, block.end),\n kind: MDX_KIND,\n });\n block = undefined;\n } else if (block !== undefined) {\n block.end = end;\n } else if (fence !== undefined) {\n fence = closesFence(line, fence) ? undefined : fence;\n } else if (MDX_ESM_START_RE.test(line)) {\n block = { start: offset, end };\n } else {\n fence = CODE_FENCE_RE.exec(line)?.[1];\n }\n offset = end + 1;\n }\n if (block !== undefined) {\n regions.push({ offset: block.start, text: text.slice(block.start, block.end), kind: MDX_KIND });\n }\n return regions;\n}\n\n/**\n * The scripts of a file: the whole file for a plain script, the `<script>` blocks (and Astro's\n * frontmatter) for a single-file component, the ESM blocks of MDX. Markup is not a script and is\n * left out.\n */\nexport function scriptRegions(text: string, path: string): ScriptRegion[] {\n const kind = plainScriptKind(path);\n if (kind !== undefined) {\n return [{ offset: 0, text, kind }];\n }\n const extension = extensionOf(path);\n if (extension === MDX_EXTENSION) {\n return mdxRegions(text);\n }\n return componentRegions(text, extension === ASTRO_EXTENSION);\n}\n","import ts from \"@typescript/typescript6\";\nimport { lineAt, type ManualStep } from \"../../domain/migration-findings.js\";\nimport type { FileBindings } from \"./file-bindings.js\";\nimport { unwrapped } from \"./generator-calls.js\";\nimport {\n IR_CALLBACKS_OPTION,\n legacyCallbackSteps,\n propertyNamed,\n TRANSFORM,\n} from \"./option-properties.js\";\n\n/**\n * The objects that `openapiTS` options take keys from (`{ ...base }`). An object literal, also in\n * a `const` of the file, is read like the options themselves: its legacy callbacks are reported,\n * and a `transform` in it is kept, since the call it reaches is not where it is written. Any other\n * spread (an import, a call, a parameter) may bring callbacks the tool cannot see, so it is\n * reported.\n */\n\n/** The object literal a spread takes its keys from, when the file writes it. */\nfunction spreadObject(\n expression: ts.Expression,\n bindings: FileBindings,\n): ts.ObjectLiteralExpression | undefined {\n const { value } = unwrapped(expression);\n if (ts.isObjectLiteralExpression(value)) {\n return value;\n }\n const binding = ts.isIdentifier(value) ? bindings.bindingOf(value) : undefined;\n const initializer =\n binding?.kind === \"constant\" ? unwrapped(binding.initializer).value : undefined;\n return initializer !== undefined && ts.isObjectLiteralExpression(initializer)\n ? initializer\n : undefined;\n}\n\n/** The steps of an object that options take with a spread, and of the spreads inside it. */\nfunction spreadObjectSteps(\n source: ts.ObjectLiteralExpression,\n text: string,\n bindings: FileBindings,\n seen: Set<ts.Node>,\n): ManualStep[] {\n if (seen.has(source) || propertyNamed(source, IR_CALLBACKS_OPTION) !== undefined) {\n return [];\n }\n seen.add(source);\n const transform = propertyNamed(source, TRANSFORM);\n const kept: ManualStep[] =\n transform === undefined\n ? []\n : [\n {\n kind: \"transform-not-rewritten\",\n line: lineAt(text, transform.getStart()),\n reason: \"in-spread\",\n },\n ];\n return [\n ...legacyCallbackSteps(source, text),\n ...kept,\n ...spreadSteps(source, text, bindings, seen),\n ];\n}\n\n/** The manual steps of the spreads of an options object (`{ ...base, alphabetize: true }`). */\nexport function spreadSteps(\n options: ts.ObjectLiteralExpression,\n text: string,\n bindings: FileBindings,\n seen: Set<ts.Node> = new Set(),\n): ManualStep[] {\n return options.properties.filter(ts.isSpreadAssignment).flatMap((spread) => {\n const source = spreadObject(spread.expression, bindings);\n return source === undefined\n ? [{ kind: \"options-spread-not-inspected\", line: lineAt(text, spread.getStart()) } as const]\n : spreadObjectSteps(source, text, bindings, seen);\n });\n}\n","import ts from \"@typescript/typescript6\";\nimport { declaredType } from \"./declared-types.js\";\nimport type { FactoryNames } from \"./factory-type-text.js\";\nimport { hasExportModifier } from \"./file-bindings.js\";\n\n/**\n * The function a `transform` option holds, and what else knows that function: other uses of a\n * module-level function, and the type its `const` is declared with.\n */\n\n/** The function a `const` or a function declaration of this file holds. */\nfunction namedFunction(\n name: ts.Identifier,\n names: FactoryNames,\n): ts.FunctionLikeDeclaration | undefined {\n const binding = names.bindings.bindingOf(name);\n if (binding?.kind === \"function\") {\n return binding.declaration;\n }\n const value = binding?.kind === \"constant\" ? binding.initializer : undefined;\n return value !== undefined && (ts.isArrowFunction(value) || ts.isFunctionExpression(value))\n ? value\n : undefined;\n}\n\n/** The name a `transform` property gives its value: `transform: name`, or `{ transform }`. */\nfunction namedValue(property: ts.ObjectLiteralElementLike): ts.Identifier | undefined {\n if (ts.isShorthandPropertyAssignment(property)) {\n return property.name;\n }\n return ts.isPropertyAssignment(property) && ts.isIdentifier(property.initializer)\n ? property.initializer\n : undefined;\n}\n\n/**\n * The function a `transform` property holds: a method, an arrow function or a function, inline or\n * by the name of a module-level function.\n */\nexport function callbackFunction(\n property: ts.ObjectLiteralElementLike,\n names: FactoryNames,\n): ts.FunctionLikeDeclaration | undefined {\n if (ts.isMethodDeclaration(property)) {\n return property;\n }\n const name = namedValue(property);\n if (name !== undefined) {\n return namedFunction(name, names);\n }\n const value = ts.isPropertyAssignment(property) ? property.initializer : undefined;\n return value !== undefined && (ts.isArrowFunction(value) || ts.isFunctionExpression(value))\n ? value\n : undefined;\n}\n\n/**\n * The type declared for the function of a `transform` option: the type of the `const` it names\n * (`OpenAPITSOptions[\"transform\"]`, a function type), or a JSDoc `@type` of an inline option.\n */\nexport function callbackAnnotations(\n property: ts.ObjectLiteralElementLike,\n names: FactoryNames,\n): ts.TypeNode[] {\n const name = namedValue(property);\n const declaration = name === undefined ? undefined : names.bindings.declarationOf(name);\n const type = declaredType(declaration ?? property);\n return type === undefined ? [] : [type];\n}\n\n/**\n * A function named by `transform` is rewritten only when this is its only use and it is not\n * exported: other callers, in this file or in the modules that import it, would get type text\n * where they expect nodes.\n */\nexport function isSharedFunction(\n property: ts.ObjectLiteralElementLike,\n names: FactoryNames,\n): boolean {\n const name = namedValue(property);\n const declaration = name === undefined ? undefined : names.bindings.declarationOf(name);\n return (\n declaration !== undefined &&\n (names.bindings.usesOf(declaration).length > 1 || hasExportModifier(declaration))\n );\n}\n","import ts from \"@typescript/typescript6\";\n\nimport type { FileBindings } from \"./file-bindings.js\";\n\n/**\n * TypeScript type text for the `ts.factory` expressions of the classic `transform` recipe\n * (`createTypeReferenceNode`, keywords, `null` and literal types, unions, intersections, arrays),\n * and for the openapi-typesafe helper constants and `tsUnion` / `tsIntersection`. Anything else\n * returns undefined, so the callback is left as it is. A name such as `DATE` is followed to the\n * module-level `const` it refers to by scope, never by spelling.\n */\n\n/** How to read names: the file's bindings, and the constants being followed (to stop cycles). */\nexport interface FactoryNames {\n readonly bindings: FileBindings;\n readonly following: ReadonlySet<ts.Node>;\n}\n\nconst KEYWORDS: ReadonlyMap<string, string> = new Map([\n [\"AnyKeyword\", \"any\"],\n [\"BigIntKeyword\", \"bigint\"],\n [\"BooleanKeyword\", \"boolean\"],\n [\"NeverKeyword\", \"never\"],\n [\"NumberKeyword\", \"number\"],\n [\"ObjectKeyword\", \"object\"],\n [\"StringKeyword\", \"string\"],\n [\"SymbolKeyword\", \"symbol\"],\n [\"UndefinedKeyword\", \"undefined\"],\n [\"UnknownKeyword\", \"unknown\"],\n [\"VoidKeyword\", \"void\"],\n]);\n\nconst HELPER_CONSTANTS: ReadonlyMap<string, string> = new Map([\n [\"BOOLEAN\", \"boolean\"],\n [\"FALSE\", \"false\"],\n [\"NEVER\", \"never\"],\n [\"NULL\", \"null\"],\n [\"NUMBER\", \"number\"],\n [\"STRING\", \"string\"],\n [\"TRUE\", \"true\"],\n [\"UNDEFINED\", \"undefined\"],\n [\"UNKNOWN\", \"unknown\"],\n]);\n\n/** A type name the type text can hold as written: `Date`, `Foo.Bar`. */\nconst TYPE_NAME_RE = /^[A-Za-z_$][\\w$]*(\\.[A-Za-z_$][\\w$]*)*$/;\n\n/** A type with a `|` or `&` at the top needs parentheses inside `[]`, and a union inside `&`. */\ninterface TypeText {\n readonly text: string;\n readonly operator: \"|\" | \"&\" | null;\n}\n\nconst plain = (text: string): TypeText => ({ text, operator: null });\n\n/**\n * True when `target` is the TypeScript export `member`: `factory` imported by name, or\n * `ts.factory` on the TypeScript module.\n */\nfunction isTypescriptMember(target: ts.Expression, member: string, names: FactoryNames): boolean {\n if (ts.isIdentifier(target)) {\n const binding = names.bindings.bindingOf(target);\n return binding?.kind === \"typescript-import\" && binding.name === member;\n }\n return (\n ts.isPropertyAccessExpression(target) &&\n target.name.text === member &&\n ts.isIdentifier(target.expression) &&\n names.bindings.bindingOf(target.expression)?.kind === \"typescript-module\"\n );\n}\n\n/** `ts.factory.createX` or `factory.createX`: the factory method name, if that is the callee. */\nfunction factoryMethod(callee: ts.Expression, names: FactoryNames): string | undefined {\n return ts.isPropertyAccessExpression(callee) &&\n isTypescriptMember(callee.expression, \"factory\", names)\n ? callee.name.text\n : undefined;\n}\n\n/** `ts.SyntaxKind.StringKeyword` or `SyntaxKind.StringKeyword`: the member name. */\nfunction syntaxKindMember(expression: ts.Expression, names: FactoryNames): string | undefined {\n return ts.isPropertyAccessExpression(expression) &&\n isTypescriptMember(expression.expression, \"SyntaxKind\", names)\n ? expression.name.text\n : undefined;\n}\n\nfunction typeName(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined) {\n return undefined;\n }\n if (ts.isStringLiteralLike(argument)) {\n return TYPE_NAME_RE.test(argument.text) ? argument.text : undefined;\n }\n if (\n ts.isCallExpression(argument) &&\n factoryMethod(argument.expression, names) === \"createIdentifier\"\n ) {\n return typeName(argument.arguments[0], names);\n }\n return undefined;\n}\n\n/** Digits with optional `_` separators between them, as in `1_000`. */\nconst digits = (digit: string): string => `${digit}(?:_?${digit})*`;\nconst DECIMAL_LITERAL =\n `(?:(?:0|[1-9](?:_?\\\\d)*)(?:\\\\.(?:${digits(\"\\\\d\")})?)?|\\\\.${digits(\"\\\\d\")})` +\n `(?:[eE][+-]?${digits(\"\\\\d\")})?`;\n/** A numeric literal as TypeScript writes it: decimal, hex, octal or binary. */\nconst NUMERIC_LITERAL_RE = new RegExp(\n `^(?:0[xX]${digits(\"[\\\\da-fA-F]\")}|0[oO]${digits(\"[0-7]\")}|0[bB]${digits(\"[01]\")}|` +\n `${DECIMAL_LITERAL})$`,\n);\n\n/**\n * The text that `createNumericLiteral(value)` prints. A string prints as given, so it is kept as\n * written (`1_000`, `1e999`) when it is a numeric literal. A number prints as JavaScript writes\n * it, and one beyond the range of a number prints `Infinity`, which is no type: that is left.\n */\nfunction numericLiteralText(value: ts.Expression): string | undefined {\n if (ts.isNumericLiteral(value)) {\n const number = Number(value.text);\n return Number.isFinite(number) ? String(number) : undefined;\n }\n return ts.isStringLiteralLike(value) && NUMERIC_LITERAL_RE.test(value.text)\n ? value.text\n : undefined;\n}\n\nfunction literalText(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined || !ts.isCallExpression(argument)) {\n return undefined;\n }\n const method = factoryMethod(argument.expression, names);\n const [value] = argument.arguments;\n switch (method) {\n case \"createNull\":\n return \"null\";\n case \"createTrue\":\n return \"true\";\n case \"createFalse\":\n return \"false\";\n case \"createStringLiteral\":\n return value !== undefined && ts.isStringLiteralLike(value)\n ? JSON.stringify(value.text)\n : undefined;\n case \"createNumericLiteral\":\n return value === undefined ? undefined : numericLiteralText(value);\n default:\n return undefined;\n }\n}\n\nfunction joined(\n elements: ts.Expression | undefined,\n operator: \"|\" | \"&\",\n names: FactoryNames,\n): TypeText | undefined {\n if (\n elements === undefined ||\n !ts.isArrayLiteralExpression(elements) ||\n elements.elements.length === 0\n ) {\n return undefined;\n }\n const parts = elements.elements.map((element) => typeTextOf(element, names));\n if (parts.some((part) => part === undefined)) {\n return undefined;\n }\n const members = (parts as TypeText[]).map(\n (part): TypeText =>\n operator === \"&\" && part.operator === \"|\" ? plain(`(${part.text})`) : part,\n );\n // A union or intersection of one member prints that member as it is, so the member's own\n // operator decides where it needs parentheses: `(Date | null)[]`, not `Date | null[]`.\n const [only] = members;\n if (members.length === 1 && only !== undefined) {\n return only;\n }\n return { text: members.map((member) => member.text).join(` ${operator} `), operator };\n}\n\nfunction factoryCallText(\n call: ts.CallExpression,\n method: string,\n names: FactoryNames,\n): TypeText | undefined {\n const [first, second] = call.arguments;\n switch (method) {\n case \"createTypeReferenceNode\": {\n const name = second === undefined ? typeName(first, names) : undefined;\n return name === undefined ? undefined : plain(name);\n }\n case \"createKeywordTypeNode\": {\n const keyword =\n first === undefined ? undefined : KEYWORDS.get(syntaxKindMember(first, names) ?? \"\");\n return keyword === undefined ? undefined : plain(keyword);\n }\n case \"createLiteralTypeNode\": {\n const literal = literalText(first, names);\n return literal === undefined ? undefined : plain(literal);\n }\n case \"createUnionTypeNode\":\n return joined(first, \"|\", names);\n case \"createIntersectionTypeNode\":\n return joined(first, \"&\", names);\n case \"createArrayTypeNode\": {\n const element = first === undefined ? undefined : typeTextOf(first, names);\n return element === undefined\n ? undefined\n : plain(element.operator ? `(${element.text})[]` : `${element.text}[]`);\n }\n default:\n return undefined;\n }\n}\n\nfunction helperCallText(call: ts.CallExpression, names: FactoryNames): TypeText | undefined {\n if (!ts.isIdentifier(call.expression)) {\n return undefined;\n }\n const binding = names.bindings.bindingOf(call.expression);\n const helper = binding?.kind === \"helper-import\" ? binding.name : undefined;\n if (helper === \"tsUnion\") {\n return joined(call.arguments[0], \"|\", names);\n }\n return helper === \"tsIntersection\" ? joined(call.arguments[0], \"&\", names) : undefined;\n}\n\nfunction identifierText(identifier: ts.Identifier, names: FactoryNames): TypeText | undefined {\n const declaration = names.bindings.declarationOf(identifier);\n const binding = names.bindings.bindingOf(identifier);\n if (binding?.kind === \"helper-import\") {\n const constant = HELPER_CONSTANTS.get(binding.name);\n return constant === undefined ? undefined : plain(constant);\n }\n if (binding?.kind !== \"constant\" || names.following.has(declaration as ts.Node)) {\n return undefined;\n }\n const following = new Set([...names.following, declaration as ts.Node]);\n return typeTextOf(binding.initializer, { ...names, following });\n}\n\n/** The type text of an expression that builds a type, or undefined. */\nexport function typeTextOf(expression: ts.Expression, names: FactoryNames): TypeText | undefined {\n if (ts.isParenthesizedExpression(expression)) {\n return typeTextOf(expression.expression, names);\n }\n if (ts.isIdentifier(expression)) {\n return identifierText(expression, names);\n }\n if (!ts.isCallExpression(expression)) {\n return undefined;\n }\n const method = factoryMethod(expression.expression, names);\n return method === undefined\n ? helperCallText(expression, names)\n : factoryCallText(expression, method, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport { type FactoryNames, typeTextOf } from \"./factory-type-text.js\";\n\n/** The returned expressions of a function, without those of functions nested in it. */\nexport function returnedExpressions(body: ts.ConciseBody): (ts.Expression | undefined)[] {\n if (!ts.isBlock(body)) {\n return [body];\n }\n const returned: (ts.Expression | undefined)[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isFunctionLike(node) || ts.isClassLike(node)) {\n return;\n }\n if (ts.isReturnStatement(node)) {\n returned.push(node.expression);\n }\n ts.forEachChild(node, visit);\n };\n ts.forEachChild(body, visit);\n return returned;\n}\n\nconst isUndefined = (expression: ts.Expression): boolean =>\n (ts.isIdentifier(expression) && expression.text === \"undefined\") ||\n ts.isVoidExpression(expression);\n\nfunction typeTextEdit(expression: ts.Expression, names: FactoryNames): TextEdit[] | undefined {\n const typeText = typeTextOf(expression, names);\n if (typeText === undefined) {\n return undefined;\n }\n const start = expression.getStart();\n return [{ start, end: expression.getEnd(), text: JSON.stringify(typeText.text) }];\n}\n\n/** `{ schema: <type>, questionToken: … }`: only the `schema` value changes. */\nfunction resultObjectEdits(\n object: ts.ObjectLiteralExpression,\n names: FactoryNames,\n): TextEdit[] | undefined {\n const schema = object.properties.find(\n (property) =>\n property.name !== undefined &&\n ts.isIdentifier(property.name) &&\n property.name.text === \"schema\",\n );\n const isPlain = object.properties.every(ts.isPropertyAssignment);\n if (schema === undefined || !isPlain || !ts.isPropertyAssignment(schema)) {\n return undefined;\n }\n return typeTextEdit(schema.initializer, names);\n}\n\n/**\n * The edits that turn one returned expression into type text, or undefined when it is not one of\n * the known type-building forms. `undefined` (keep the generated type) needs no edit.\n */\nexport function returnEdits(\n expression: ts.Expression | undefined,\n names: FactoryNames,\n): TextEdit[] | undefined {\n if (expression === undefined || isUndefined(expression)) {\n return [];\n }\n if (ts.isParenthesizedExpression(expression)) {\n return returnEdits(expression.expression, names);\n }\n if (ts.isConditionalExpression(expression)) {\n const whenTrue = returnEdits(expression.whenTrue, names);\n const whenFalse = returnEdits(expression.whenFalse, names);\n return whenTrue === undefined || whenFalse === undefined\n ? undefined\n : [...whenTrue, ...whenFalse];\n }\n if (ts.isObjectLiteralExpression(expression)) {\n return resultObjectEdits(expression, names);\n }\n return typeTextEdit(expression, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport { type FactoryNames, typeTextOf } from \"./factory-type-text.js\";\nimport { type Binding, hasExportModifier } from \"./file-bindings.js\";\n\n/**\n * After the `transform` returns become type text, the module-level constants that built the old\n * nodes (`const DATE = ts.factory…`), and the TypeScript and helper imports that only they used,\n * are no longer read. Left in place they fail `noUnusedLocals` (TS6133), so they are removed.\n * Only declarations that the rewrite made unused go: each had uses, and all of them were in\n * replaced text or in other removed declarations. A constant goes only when its initializer is a\n * type-building expression, so no side effect is lost; an exported one always stays.\n */\n\n/** A removed declaration, for the report. */\nexport interface RemovedDeclaration {\n readonly node: ts.Node;\n readonly name: string;\n}\n\ninterface Range {\n readonly start: number;\n readonly end: number;\n}\n\nfunction isRemovable(node: ts.Node, binding: Binding, names: FactoryNames): boolean {\n switch (binding.kind) {\n case \"typescript-module\":\n case \"typescript-import\":\n case \"helper-import\":\n return true;\n case \"constant\":\n return !hasExportModifier(node) && typeTextOf(binding.initializer, names) !== undefined;\n default:\n return false;\n }\n}\n\nconst isInside = (node: ts.Node, ranges: readonly Range[]): boolean =>\n ranges.some((range) => node.getStart() >= range.start && node.getEnd() <= range.end);\n\n/** The declarations that the replaced ranges leave without a use, until nothing changes. */\nexport function unusedDeclarations(\n names: FactoryNames,\n replaced: readonly TextEdit[],\n): RemovedDeclaration[] {\n const ranges: Range[] = replaced.filter((edit) => edit.end > edit.start);\n const removed: RemovedDeclaration[] = [];\n for (let isChanged = true; isChanged; ) {\n isChanged = false;\n for (const [node, binding] of names.bindings.declarations) {\n const uses = names.bindings.usesOf(node);\n const isUnused = uses.length > 0 && uses.every((use) => isInside(use, ranges));\n const isNew = removed.every((found) => found.node !== node);\n if (isNew && isUnused && isRemovable(node, binding, names)) {\n const name = (node as ts.NamedDeclaration).name?.getText() ?? \"\";\n removed.push({ node, name });\n ranges.push({ start: node.getStart(), end: node.getEnd() });\n isChanged = true;\n }\n }\n }\n return removed;\n}\n\n/** The edit that removes a whole statement, with its line when nothing else is on it. */\nfunction statementRemoval(statement: ts.Statement, text: string): TextEdit {\n const start = statement.getStart(undefined, true);\n const end = statement.getEnd();\n const lineStart = text.lastIndexOf(\"\\n\", start - 1) + 1;\n const lineBreak = text.indexOf(\"\\n\", end);\n const lineEnd = lineBreak === -1 ? text.length : lineBreak + 1;\n const isAlone =\n text.slice(lineStart, start).trim() === \"\" && text.slice(end, lineEnd).trim() === \"\";\n return isAlone ? { start: lineStart, end: lineEnd, text: \"\" } : { start, end, text: \"\" };\n}\n\n/**\n * The edits that remove some elements of a comma-separated list. An element before the last kept\n * one goes with the comma after it; the elements after the last kept one go with the comma before\n * them, in one edit.\n */\nfunction listRemovals(\n elements: readonly ts.Node[],\n isRemoved: (node: ts.Node) => boolean,\n): TextEdit[] {\n const lastKept = elements.findLastIndex((element) => !isRemoved(element));\n const edits: TextEdit[] = [];\n elements.forEach((element, index) => {\n const next = elements[index + 1];\n if (index < lastKept && isRemoved(element) && next !== undefined) {\n edits.push({ start: element.getStart(), end: next.getStart(), text: \"\" });\n }\n });\n const last = elements.at(-1);\n if (lastKept !== -1 && last !== undefined && lastKept < elements.length - 1) {\n edits.push({ start: (elements[lastKept] as ts.Node).getEnd(), end: last.getEnd(), text: \"\" });\n }\n return edits;\n}\n\ntype IsRemoved = (node: ts.Node) => boolean;\n\n/** The edits for an import some of whose bindings were removed. */\nfunction importEdits(\n statement: ts.ImportDeclaration,\n isRemoved: IsRemoved,\n text: string,\n): TextEdit[] {\n const clause = statement.importClause as ts.ImportClause;\n const bindings = clause.namedBindings;\n const named = bindings !== undefined && ts.isNamedImports(bindings) ? bindings : undefined;\n const namespace = bindings !== undefined && ts.isNamespaceImport(bindings) ? bindings : undefined;\n const parts: ts.Node[] = [\n ...(clause.name === undefined ? [] : [clause]),\n ...(namespace === undefined ? [] : [namespace]),\n ...(named?.elements ?? []),\n ];\n if (parts.every(isRemoved)) {\n return [statementRemoval(statement, text)];\n }\n // Not every part is removed, so a removed default import has a named or namespace one after it.\n const defaultEnd = clause.name?.getEnd() ?? 0;\n const edits: TextEdit[] = [];\n if (clause.name !== undefined && isRemoved(clause)) {\n edits.push({ start: clause.name.getStart(), end: (bindings as ts.Node).getStart(), text: \"\" });\n }\n if (namespace !== undefined && isRemoved(namespace)) {\n edits.push({ start: defaultEnd, end: namespace.getEnd(), text: \"\" });\n }\n if (named !== undefined && named.elements.length > 0 && named.elements.every(isRemoved)) {\n edits.push({ start: defaultEnd, end: named.getEnd(), text: \"\" });\n } else if (named !== undefined) {\n edits.push(...listRemovals(named.elements, isRemoved));\n }\n return edits;\n}\n\nfunction statementEdits(statement: ts.Statement, isRemoved: IsRemoved, text: string): TextEdit[] {\n if (ts.isImportDeclaration(statement)) {\n return importEdits(statement, isRemoved, text);\n }\n const declarations = (statement as ts.VariableStatement).declarationList.declarations;\n return declarations.every(isRemoved)\n ? [statementRemoval(statement, text)]\n : listRemovals(declarations, isRemoved);\n}\n\n/** The edits that remove the declarations, grouped by the statement each belongs to. */\nexport function removalEdits(removed: readonly RemovedDeclaration[], text: string): TextEdit[] {\n const nodes = new Set(removed.map((found) => found.node));\n const isRemoved: IsRemoved = (node) => nodes.has(node);\n const statements = new Set(\n removed.map(\n (found) =>\n ts.findAncestor(\n found.node,\n (node) => ts.isVariableStatement(node) || ts.isImportDeclaration(node),\n ) as ts.Statement,\n ),\n );\n return [...statements].flatMap((statement) => statementEdits(statement, isRemoved, text));\n}\n","import ts from \"@typescript/typescript6\";\nimport type { CallbackRewriter } from \"../../application/ports.js\";\nimport {\n type Change,\n type FileMigration,\n lineAt,\n type ManualStep,\n type TransformKeepReason,\n unchanged,\n} from \"../../domain/migration-findings.js\";\nimport { applyTextEdits, type TextEdit } from \"../../domain/text-edits.js\";\nimport { callbackTypeEdits } from \"./declared-types.js\";\nimport type { FactoryNames } from \"./factory-type-text.js\";\nimport { createFileBindings, type FileBindings } from \"./file-bindings.js\";\nimport { type GeneratorCall, type GeneratorOptions, generatorCalls } from \"./generator-calls.js\";\nimport {\n IR_CALLBACKS_OPTION,\n LEGACY_ONLY_CALLBACKS,\n legacyCallbackSteps,\n propertyNamed,\n TRANSFORM,\n} from \"./option-properties.js\";\nimport { optionsTypeEdits, optionsTypeReferences } from \"./options-type.js\";\nimport { plainScriptKind } from \"./script-regions.js\";\nimport { spreadSteps } from \"./spread-options.js\";\nimport { callbackAnnotations, callbackFunction, isSharedFunction } from \"./transform-callback.js\";\nimport { returnEdits, returnedExpressions } from \"./transform-returns.js\";\nimport { removalEdits, unusedDeclarations } from \"./unused-declarations.js\";\n\n/**\n * The CallbackRewriter port on the TypeScript 6 parser (ADR-015). In each `openapiTS(source, {…})`\n * call where `transform` is the only callback and every value it returns builds a type with\n * `ts.factory` or the helpers, the returns become TypeScript type text and `irCallbacks: true` is\n * added; the module-level constants and imports that only the old returns used are removed. Every\n * other legacy callback is reported, not changed: it still works, with a warning.\n */\n\n/** The value of `irCallbacks` in an object that the call types: the literal `true` stays `true`. */\nconst IR_CALLBACKS_TRUE = \"true\";\n/** In an untyped `const`, `true` widens to `boolean`, which no signature of `openapiTS` takes. */\nconst IR_CALLBACKS_TRUE_CONST = \"true as const\";\n/** The same assertion in a JavaScript file, where `as const` is not syntax. */\nconst IR_CALLBACKS_TRUE_CONST_JS = \"/** @type {const} */ (true)\";\n\ninterface CallFindings {\n readonly edits: TextEdit[];\n readonly changes: Change[];\n readonly manualSteps: ManualStep[];\n /** The `OpenAPITSOptions` names of rewritten options, retargeted once per file. */\n readonly typeReferences: ts.Identifier[];\n}\n\ntype OwnOptions = Extract<GeneratorOptions, { kind: \"own\" }>;\n\nconst noFindings = (): CallFindings => ({\n edits: [],\n changes: [],\n manualSteps: [],\n typeReferences: [],\n});\n\n/**\n * A declared return type names TypeScript nodes (`ts.TypeNode`), which type text does not match,\n * so it is removed and the type is inferred from the new returns.\n */\nfunction returnTypeEdits(callback: ts.FunctionLikeDeclaration, text: string): TextEdit[] {\n const type = callback.type;\n if (type === undefined) {\n return [];\n }\n const colon = text.lastIndexOf(\":\", type.getStart());\n return [{ start: colon, end: type.getEnd(), text: \"\" }];\n}\n\n/** The edits for the returns of `transform`, or the reason to keep it. */\nfunction transformEdits(\n property: ts.ObjectLiteralElementLike,\n names: FactoryNames,\n text: string,\n): TextEdit[] | TransformKeepReason {\n const callback = callbackFunction(property, names);\n if (callback?.body === undefined) {\n return \"not-a-function\";\n }\n if (isSharedFunction(property, names)) {\n return \"shared-function\";\n }\n const declared = callbackTypeEdits(\n callbackAnnotations(property, names),\n callback,\n names.bindings,\n );\n if (declared === undefined) {\n return \"declared-type\";\n }\n const edits = [...returnTypeEdits(callback, text), ...declared];\n for (const returned of returnedExpressions(callback.body)) {\n const returnEditList = returnEdits(returned, names);\n if (returnEditList === undefined) {\n return \"unknown-return\";\n }\n edits.push(...returnEditList);\n }\n return edits;\n}\n\n/** The value of the added `irCallbacks`, which must keep the type `true` (TS2769 otherwise). */\nfunction irCallbacksValue(options: OwnOptions): string {\n if (options.isContextuallyTyped) {\n return IR_CALLBACKS_TRUE;\n }\n const isJavaScript = (options.options.flags & ts.NodeFlags.JavaScriptFile) !== 0;\n return isJavaScript ? IR_CALLBACKS_TRUE_CONST_JS : IR_CALLBACKS_TRUE_CONST;\n}\n\n/**\n * The `irCallbacks` option, placed before `transform`: on its own line with the same\n * indentation when `transform` starts a line, else on the same line.\n */\nfunction irCallbacksOption(text: string, transformStart: number, value: string): string {\n const lineStart = text.lastIndexOf(\"\\n\", transformStart - 1) + 1;\n const before = text.slice(lineStart, transformStart);\n const option = `${IR_CALLBACKS_OPTION}: ${value},`;\n return /^\\s*$/.test(before) ? `${option}\\n${before}` : `${option} `;\n}\n\n/**\n * Why the options keep their `transform`, or undefined. A spread (`...base`) may bring callbacks\n * that need TypeScript nodes, `irCallbacks`, or a type of `OpenAPITSOptions` that the IR return\n * does not fit, and the tool cannot see them.\n */\nfunction keepReason(options: ts.ObjectLiteralExpression): TransformKeepReason | undefined {\n const hasOther = LEGACY_ONLY_CALLBACKS.some((name) => propertyNamed(options, name) !== undefined);\n if (hasOther) {\n return \"other-callbacks\";\n }\n return options.properties.some(ts.isSpreadAssignment) ? \"spread-options\" : undefined;\n}\n\n/** The rewrite of `transform` with the options types to retarget, or the reason to keep it. */\nfunction transformRewrite(\n transform: ts.ObjectLiteralElementLike,\n options: OwnOptions,\n names: FactoryNames,\n text: string,\n) {\n const edits = keepReason(options.options) ?? transformEdits(transform, names, text);\n if (typeof edits === \"string\") {\n return edits;\n }\n const annotations = [...options.annotations, ...callbackAnnotations(transform, names)];\n const typeReferences = optionsTypeReferences(annotations, names.bindings);\n return typeReferences === undefined ? \"typed-options\" : { edits, typeReferences };\n}\n\n/** The findings of one `openapiTS(source, options)` call with an options object literal. */\nfunction migrateOptions(options: OwnOptions, text: string, names: FactoryNames): CallFindings {\n // With irCallbacks set, the callbacks already use the IR form: nothing to migrate.\n if (propertyNamed(options.options, IR_CALLBACKS_OPTION) !== undefined) {\n return noFindings();\n }\n const findings = noFindings();\n findings.manualSteps.push(...legacyCallbackSteps(options.options, text));\n findings.manualSteps.push(...spreadSteps(options.options, text, names.bindings));\n const transform = propertyNamed(options.options, TRANSFORM);\n if (transform === undefined) {\n return findings;\n }\n const start = transform.getStart();\n const line = lineAt(text, start);\n const result = transformRewrite(transform, options, names, text);\n if (typeof result === \"string\") {\n findings.manualSteps.push({ kind: \"transform-not-rewritten\", line, reason: result });\n return findings;\n }\n // Before the JSDoc of `transform`, which documents (and in JavaScript types) `transform`.\n const at = transform.getStart(undefined, true);\n const option = irCallbacksOption(text, at, irCallbacksValue(options));\n findings.edits.push({ start: at, end: at, text: option }, ...result.edits);\n findings.typeReferences.push(...result.typeReferences);\n findings.changes.push({ kind: \"transform-rewritten\", line });\n return findings;\n}\n\n/** Options that other code uses too: the callbacks are reported, never changed. */\nfunction sharedOptionsFindings(\n options: ts.ObjectLiteralExpression,\n text: string,\n bindings: FileBindings,\n): CallFindings {\n const findings = noFindings();\n if (propertyNamed(options, IR_CALLBACKS_OPTION) !== undefined) {\n return findings;\n }\n findings.manualSteps.push(...legacyCallbackSteps(options, text));\n findings.manualSteps.push(...spreadSteps(options, text, bindings));\n const transform = propertyNamed(options, TRANSFORM);\n if (transform !== undefined) {\n const line = lineAt(text, transform.getStart());\n findings.manualSteps.push({ kind: \"transform-not-rewritten\", line, reason: \"shared-options\" });\n }\n return findings;\n}\n\nfunction callFindings(found: GeneratorCall, text: string, names: FactoryNames): CallFindings {\n const options = found.options;\n switch (options?.kind) {\n case undefined:\n return noFindings();\n case \"own\":\n return migrateOptions(options, text, names);\n case \"shared\":\n return sharedOptionsFindings(options.options, text, names.bindings);\n case \"unknown\": {\n const line = lineAt(text, options.expression.getStart());\n return { ...noFindings(), manualSteps: [{ kind: \"options-not-inspected\", line }] };\n }\n }\n}\n\n/** The findings of every generator call; options that several calls share are read once. */\nfunction findCallFindings(file: ts.SourceFile, text: string, names: FactoryNames): CallFindings {\n const all = noFindings();\n const seen = new Set<ts.Node>();\n for (const found of generatorCalls(file, names.bindings)) {\n const options = found.options?.kind === \"unknown\" ? undefined : found.options?.options;\n if (options !== undefined && seen.has(options)) {\n continue;\n }\n if (options !== undefined) {\n seen.add(options);\n }\n const findings = callFindings(found, text, names);\n all.edits.push(...findings.edits);\n all.changes.push(...findings.changes);\n all.manualSteps.push(...findings.manualSteps);\n all.typeReferences.push(...findings.typeReferences);\n }\n return all;\n}\n\n/** The rewrite of a file that calls the generator, with the declarations it leaves unused. */\nfunction rewriteFile(file: ts.SourceFile, names: FactoryNames): FileMigration {\n const text = file.text;\n const { edits, changes, manualSteps, typeReferences } = findCallFindings(file, text, names);\n // The options type edits rename uses of an import, which leaves it in use, not unused.\n const removed = unusedDeclarations(names, edits);\n for (const found of removed) {\n changes.push({\n kind: \"declaration-removed\",\n line: lineAt(text, found.node.getStart()),\n name: found.name,\n });\n }\n const typeEdits = optionsTypeEdits(typeReferences, names.bindings);\n const allEdits = [...edits, ...typeEdits, ...removalEdits(removed, text)];\n return { text: applyTextEdits(text, allEdits), changes, manualSteps };\n}\n\nclass TypescriptCallbackRewriter implements CallbackRewriter {\n rewrite(text: string, path: string): FileMigration {\n // Single-file components (`.vue`, `.svelte`, `.astro`) are not plain scripts; they are left.\n const scriptKind = plainScriptKind(path);\n if (scriptKind === undefined) {\n return unchanged(text);\n }\n const file = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, scriptKind);\n const bindings = createFileBindings(file);\n if (!bindings.hasGenerator) {\n return unchanged(text);\n }\n return rewriteFile(file, { bindings, following: new Set() });\n }\n}\n\n/** A callback rewriter that parses each file with the TypeScript 6 parser. */\nexport function createTypescriptCallbackRewriter(): CallbackRewriter {\n return new TypescriptCallbackRewriter();\n}\n","import ts from \"@typescript/typescript6\";\nimport type { SourceStringScanner } from \"../../application/ports.js\";\nimport type { SourceString } from \"../../domain/source-migration.js\";\nimport { type ScriptRegion, scriptRegions } from \"./script-regions.js\";\n\n/**\n * The SourceStringScanner port on the TypeScript 6 parser (ADR-015). It finds every string\n * literal of a file's scripts, JSDoc types included, and the `/// <reference types>` directives,\n * and tells module specifiers from other strings by the syntax around them.\n */\n\nconst REQUIRE = \"require\";\nconst RESOLVE = \"resolve\";\n/** Methods of vitest's `vi` whose first argument is a module. */\nconst VITEST_METHODS: ReadonlySet<string> = new Set([\n \"mock\",\n \"doMock\",\n \"unmock\",\n \"doUnmock\",\n \"importActual\",\n \"importMock\",\n]);\n/** Methods of `jest` whose first argument is a module, older names included. */\nconst JEST_METHODS: ReadonlySet<string> = new Set([\n \"mock\",\n \"doMock\",\n \"unmock\",\n \"dontMock\",\n \"deepUnmock\",\n \"setMock\",\n \"requireActual\",\n \"requireMock\",\n \"createMockFromModule\",\n \"genMockFromModule\",\n \"unstable_mockModule\",\n \"unstable_unmockModule\",\n]);\n/** `vi.mock`, `jest.setMock`, bun's `mock.module` and `require.resolve`, by object. */\nconst MODULE_METHODS: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [\"vi\", VITEST_METHODS],\n [\"jest\", JEST_METHODS],\n [\"mock\", new Set([\"module\"])],\n [REQUIRE, new Set([RESOLVE])],\n]);\n\nfunction isIdentifierNamed(node: ts.Node, name: string): boolean {\n return ts.isIdentifier(node) && node.text === name;\n}\n\n/** The module methods, and `import.meta.resolve`. */\nfunction isModuleMethod(callee: ts.PropertyAccessExpression): boolean {\n const object = callee.expression;\n const method = callee.name.text;\n if (ts.isIdentifier(object)) {\n return MODULE_METHODS.get(object.text)?.has(method) ?? false;\n }\n return method === RESOLVE && ts.isMetaProperty(object);\n}\n\n/** Calls whose first argument is a module: `import()`, `require()` and the module methods. */\nfunction isModuleCall(call: ts.CallExpression): boolean {\n const callee = call.expression;\n if (callee.kind === ts.SyntaxKind.ImportKeyword || isIdentifierNamed(callee, REQUIRE)) {\n return true;\n }\n return ts.isPropertyAccessExpression(callee) && isModuleMethod(callee);\n}\n\nfunction isModuleSpecifier(literal: ts.StringLiteralLike | ts.TemplateExpression): boolean {\n const parent = literal.parent;\n if (\n ts.isImportDeclaration(parent) ||\n ts.isExportDeclaration(parent) ||\n ts.isJSDocImportTag(parent)\n ) {\n return parent.moduleSpecifier === literal;\n }\n if (ts.isCallExpression(parent)) {\n return parent.arguments[0] === literal && isModuleCall(parent);\n }\n if (ts.isModuleDeclaration(parent)) {\n return parent.name === literal;\n }\n // `import(\"openapi-fetch\").Client` in a type, also in a JSDoc type of a JavaScript file.\n if (ts.isLiteralTypeNode(parent)) {\n return ts.isImportTypeNode(parent.parent);\n }\n return ts.isExternalModuleReference(parent);\n}\n\ntype FoundStrings = Map<number, SourceString>;\n\n/** The value of a string literal; the text between the backticks of a template with `${…}`. */\nfunction stringValue(node: ts.StringLiteralLike | ts.TemplateExpression, file: ts.SourceFile) {\n return ts.isTemplateExpression(node)\n ? file.text.slice(node.getStart(file) + 1, node.getEnd() - 1)\n : node.text;\n}\n\n/** Adds the string literals under `root` to `found`; `file` starts at `offset` in the file. */\nfunction collectStrings(\n root: ts.Node,\n file: ts.SourceFile,\n offset: number,\n found: FoundStrings,\n): void {\n const visit = (node: ts.Node): void => {\n // A template with substitutions (`npx openapi-typescript ${spec}`) gives its text as written,\n // `${…}` included: the specifier rename then keeps the substitutions, and a command in it is\n // reported with them.\n if (ts.isStringLiteralLike(node) || ts.isTemplateExpression(node)) {\n // The value starts after the opening quote and ends before the closing one.\n const start = offset + node.getStart(file) + 1;\n const end = offset + node.getEnd() - 1;\n found.set(start, {\n start,\n end,\n value: stringValue(node, file),\n isModuleSpecifier: isModuleSpecifier(node),\n });\n }\n ts.forEachChild(node, visit);\n };\n visit(root);\n}\n\n/**\n * Every comment of a parsed file. Comments are the trivia in front of tokens, so the ranges in\n * front of each token cover them all, also where no node owns a JSDoc block. A trailing range\n * ends at the first line break and a leading one starts after it, so a token needs both. JSX text\n * is not trivia, and the JSDoc nodes are read from their comments, so neither is walked.\n */\nfunction commentRanges(file: ts.SourceFile): ts.CommentRange[] {\n const ranges = new Map<number, ts.CommentRange>();\n const add = (found: ts.CommentRange[] | undefined): void => {\n for (const range of found ?? []) {\n ranges.set(range.pos, range);\n }\n };\n const visit = (node: ts.Node): void => {\n if (node.kind === ts.SyntaxKind.JsxText) {\n return;\n }\n const children = node.getChildren(file).filter((child) => !ts.isJSDoc(child));\n if (children.length === 0) {\n add(ts.getTrailingCommentRanges(file.text, node.pos));\n add(ts.getLeadingCommentRanges(file.text, node.pos));\n }\n children.forEach(visit);\n };\n visit(file);\n return [...ranges.values()];\n}\n\nconst JSDOC_START = \"/**\";\nconst EMPTY_BLOCK_COMMENT = \"/**/\";\n/** A statement for an isolated JSDoc block to belong to, so that the parser reads the block. */\nconst JSDOC_HOST = \"\\nvar host;\";\nconst JSDOC_FILE_NAME = \"jsdoc.js\";\n\n/**\n * Adds the strings of one JSDoc block. The parser reads only the last block before a node it\n * keeps JSDoc for, so each block is parsed on its own, in front of a statement of its own.\n */\nfunction collectJsDocStrings(comment: string, offset: number, found: FoundStrings): void {\n const text = `${comment}${JSDOC_HOST}`;\n const file = ts.createSourceFile(JSDOC_FILE_NAME, text, ts.ScriptTarget.Latest, true);\n const host = file.statements[0] as ts.Statement;\n for (const doc of ts.getJSDocCommentsAndTags(host)) {\n collectStrings(doc, file, offset, found);\n }\n}\n\nfunction literalStrings(file: ts.SourceFile, offset: number): FoundStrings {\n const found: FoundStrings = new Map();\n collectStrings(file, file, offset, found);\n for (const range of commentRanges(file)) {\n const comment = file.text.slice(range.pos, range.end);\n if (comment.startsWith(JSDOC_START) && comment !== EMPTY_BLOCK_COMMENT) {\n collectJsDocStrings(comment, offset + range.pos, found);\n }\n }\n return found;\n}\n\nfunction regionStrings(region: ScriptRegion, path: string): SourceString[] {\n const file = ts.createSourceFile(path, region.text, ts.ScriptTarget.Latest, true, region.kind);\n const found = literalStrings(file, region.offset);\n for (const reference of file.typeReferenceDirectives) {\n const start = region.offset + reference.pos;\n const end = region.offset + reference.end;\n found.set(start, { start, end, value: reference.fileName, isModuleSpecifier: true });\n }\n return [...found.values()];\n}\n\nclass TypescriptSourceStringScanner implements SourceStringScanner {\n scan(text: string, path: string): SourceString[] {\n return scriptRegions(text, path)\n .flatMap((region) => regionStrings(region, path))\n .sort((left, right) => left.start - right.start);\n }\n}\n\n/** A source string scanner that parses each script with the TypeScript 6 parser. */\nexport function createTypescriptStringScanner(): SourceStringScanner {\n return new TypescriptSourceStringScanner();\n}\n","import { CST, isAlias, isMap, isNode, isScalar, isSeq, parseAllDocuments, Scalar } from \"yaml\";\nimport type { YamlDocumentReader } from \"../../application/ports.js\";\nimport type { DocumentRead, TreeNode } from \"../../domain/config-documents.js\";\n\n/**\n * The YamlDocumentReader port on the `yaml` package (ADR-015). It keeps the source tokens, so\n * each scalar has the offsets of its text as written, in block and flow style alike, and reads\n * every document of a stream.\n */\n\ninterface Conversion {\n /** Inside a flow collection (`{ … }`, `[ … ]`), where `,` and brackets end a plain scalar. */\n readonly isFlow: boolean;\n}\n\ninterface TextRange {\n readonly start: number;\n readonly end: number;\n}\n\ntype Quoting = (value: string) => string;\n\nconst plain: Quoting = (value) => value;\nconst singleQuoted: Quoting = (value) => `'${value.replaceAll(\"'\", \"''\")}'`;\n// JSON is YAML: a JSON string is a valid double-quoted scalar for every value.\nconst doubleQuoted: Quoting = (value) => JSON.stringify(value);\n\n/** The quotings a new value may take, the old scalar's first; block scalars take none. */\nconst QUOTINGS: Readonly<Record<string, readonly Quoting[]>> = {\n [Scalar.PLAIN]: [plain, singleQuoted, doubleQuoted],\n [Scalar.QUOTE_SINGLE]: [singleQuoted, doubleQuoted],\n [Scalar.QUOTE_DOUBLE]: [doubleQuoted],\n};\n\n/** Whether `written`, at a place like the old scalar's, reads back as the string `value`. */\nfunction readsBack(written: string, value: string, isFlow: boolean): boolean {\n const [document] = parseAllDocuments(isFlow ? `[${written}]` : `- ${written}`);\n const list = document?.contents;\n const item = isSeq(list) && list.items.length === 1 ? list.items[0] : undefined;\n return document?.errors.length === 0 && isScalar(item) && item.value === value;\n}\n\n/**\n * The old scalar's quoting, or the next one that can hold the new value: a value that plain text\n * would read as another type or cut short (`true`, `a: b`, `x #y`) is quoted.\n */\nfunction encoderFor(quotings: readonly Quoting[], isFlow: boolean): (value: string) => string {\n return (value) =>\n quotings.map((quoting) => quoting(value)).find((text) => readsBack(text, value, isFlow)) ??\n doubleQuoted(value);\n}\n\n/** The content lines of a block scalar follow its header line, which its props make up. */\nfunction blockContent(token: CST.BlockScalar): TextRange {\n const headerLength = token.props.reduce((length, prop) => length + CST.stringify(prop).length, 0);\n const start = token.offset + headerLength;\n return { start, end: start + token.source.trimEnd().length };\n}\n\n/** The text of a scalar as written: without quotes, and without the header of a block scalar. */\nfunction contentRange(token: CST.Token | undefined, node: TextRange): TextRange {\n switch (token?.type) {\n case \"scalar\":\n return { start: token.offset, end: token.offset + token.source.length };\n case \"single-quoted-scalar\":\n case \"double-quoted-scalar\":\n return { start: token.offset + 1, end: token.offset + token.source.length - 1 };\n case \"block-scalar\":\n return blockContent(token);\n default:\n return node;\n }\n}\n\nfunction spanOf(node: { range?: [number, number, number] | null }): TextRange {\n const [start, end] = node.range ?? [0, 0];\n return { start, end };\n}\n\n/** A plain scalar that YAML reads as a number or boolean keeps its text as written. */\nfunction scalarText(node: Scalar): string | undefined {\n if (typeof node.value === \"string\") {\n return node.value;\n }\n const isWritten = node.type === Scalar.PLAIN && node.value !== null;\n return isWritten ? node.source : undefined;\n}\n\n/** The text that starts an escape in a quoted scalar, by the type of its token. */\nconst ESCAPES: Readonly<Partial<Record<string, string>>> = {\n \"single-quoted-scalar\": \"''\",\n \"double-quoted-scalar\": \"\\\\\",\n};\n\n/** Whether a quoted scalar has an escape in its text as written. */\nfunction isEscaped(token: CST.Token | undefined): boolean {\n const escapeStart = token === undefined ? undefined : ESCAPES[token.type];\n return escapeStart !== undefined && token !== undefined && \"source\" in token\n ? token.source.includes(escapeStart)\n : false;\n}\n\nfunction convertScalar(node: Scalar, isFlow: boolean): TreeNode {\n const span = spanOf(node);\n const value = scalarText(node);\n if (value === undefined) {\n return { kind: \"other\", ...span };\n }\n const quotings = node.type === undefined ? undefined : QUOTINGS[node.type];\n const isReplaceable =\n quotings !== undefined && node.anchor === undefined && node.tag === undefined;\n return {\n kind: \"scalar\",\n ...anchorOf(node),\n value,\n content: contentRange(node.srcToken, span),\n isFolded: node.type !== Scalar.BLOCK_LITERAL,\n isEscaped: isEscaped(node.srcToken),\n encode: isReplaceable ? encoderFor(quotings, isFlow) : undefined,\n ...span,\n };\n}\n\n/** The anchor of a node (`&scripts`), as a property only where the node has one. */\nconst anchorOf = (node: { anchor?: string }): { anchor?: string } =>\n node.anchor === undefined ? {} : { anchor: node.anchor };\n\nconst flowOf = (conversion: Conversion, node: { flow?: boolean }): Conversion => ({\n isFlow: conversion.isFlow || node.flow === true,\n});\n\nfunction convert(node: unknown, conversion: Conversion): TreeNode {\n if (isScalar(node)) {\n return convertScalar(node, conversion.isFlow);\n }\n if (isSeq(node)) {\n const inner = flowOf(conversion, node);\n const items = node.items.map((item) => convert(item, inner));\n return { kind: \"list\", items, ...anchorOf(node), ...spanOf(node) };\n }\n if (isMap(node)) {\n const inner = flowOf(conversion, node);\n const entries = node.items.map((pair) => ({\n key: convert(pair.key, inner),\n value: convert(pair.value, inner),\n }));\n return { kind: \"map\", entries, ...anchorOf(node), ...spanOf(node) };\n }\n if (isAlias(node)) {\n return { kind: \"other\", alias: node.source, ...spanOf(node) };\n }\n // No value at all (`key:` with nothing after it).\n return { kind: \"other\", ...spanOf(isNode(node) ? node : {}) };\n}\n\n/**\n * The offset of the first key that repeats an earlier scalar key of the same map, under `node`.\n * YAML forbids such a key. The `yaml` package checks it by comparing each key with every key\n * before it, which took 25 s on a 6 MB OpenAPI document; this check is linear and finds the same\n * keys: scalar keys with the same value.\n */\nfunction duplicateKeyOffset(node: unknown): number | undefined {\n if (isSeq(node)) {\n return firstOffset(node.items);\n }\n if (!isMap(node)) {\n return undefined;\n }\n const keys = new Set<unknown>();\n for (const pair of node.items) {\n if (isScalar(pair.key) && keys.has(pair.key.value)) {\n return spanOf(pair.key).start;\n }\n keys.add(isScalar(pair.key) ? pair.key.value : pair.key);\n }\n return firstOffset(node.items.flatMap((pair) => [pair.key, pair.value]));\n}\n\nfunction firstOffset(nodes: readonly unknown[]): number | undefined {\n for (const node of nodes) {\n const offset = duplicateKeyOffset(node);\n if (offset !== undefined) {\n return offset;\n }\n }\n return undefined;\n}\n\n/**\n * How the `yaml` package parses a config. Its own duplicate key check compares each key with every\n * key before it, so it is turned off (`uniqueKeys: false`) for the linear one above; the source\n * tokens give the offsets of the strings the migrations edit.\n */\nexport const YAML_PARSE_OPTIONS = { keepSourceTokens: true, uniqueKeys: false } as const;\n\n/**\n * The `yaml` package stops at nesting deeper than the stack allows and reports it as an error, so\n * a tree it gives is shallow enough for the migrations to walk.\n */\nfunction read(text: string): DocumentRead {\n const documents = parseAllDocuments(text, YAML_PARSE_OPTIONS);\n const error = documents.flatMap((document) => document.errors)[0];\n if (error !== undefined) {\n return { kind: \"unreadable\", offset: error.pos[0] };\n }\n const duplicate = firstOffset(documents.map((document) => document.contents));\n if (duplicate !== undefined) {\n return { kind: \"unreadable\", offset: duplicate };\n }\n const roots = documents.flatMap((document) =>\n document.contents === null ? [] : [convert(document.contents, { isFlow: false })],\n );\n return { kind: \"read\", documents: roots };\n}\n\nexport function createYamlTextReader(): YamlDocumentReader {\n return { read };\n}\n","/**\n * What the migration renames (ENGINEERING_PLAN 10.1). openapi-typesafe is a drop-in successor, so\n * moving a project is a matter of names: packages, the CLI command and a few renamed CLI flags.\n */\n\n/** Original package name → openapi-typesafe package name. */\nexport const PACKAGE_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"openapi-typescript\", \"openapi-typesafe\"],\n [\"openapi-fetch\", \"openapi-typesafe-fetch\"],\n [\"openapi-react-query\", \"openapi-typesafe-react-query\"],\n [\"openapi-typescript-helpers\", \"openapi-typesafe-helpers\"],\n]);\n\n/**\n * Whether `text` names an original package as written. Every rename and every report starts at\n * such a name, so a text without one has nothing to migrate. The generator command is one of the\n * names. A name written with escapes (`\"openapi\\x2dfetch\"` in YAML) is not found, so a file that\n * names a package only that way is left as it is.\n */\nexport function namesOriginalPackage(text: string): boolean {\n return [...PACKAGE_RENAMES.keys()].some((name) => text.includes(name));\n}\n\n/** The generator's command, as package.json scripts and shell lines run it. */\nexport const GENERATOR_COMMAND = \"openapi-typescript\";\nexport const MIGRATED_GENERATOR_COMMAND = \"openapi-typesafe\";\n\n/**\n * Flags that openapi-typescript 6 and 7 renamed; the openapi-typesafe CLI rejects the old spelling\n * with CLI_FLAG_REMOVED, so the migration writes the new one.\n */\nexport const FLAG_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"--immutable-types\", \"--immutable\"],\n [\"-it\", \"--immutable\"],\n [\"--support-array-length\", \"--array-length\"],\n [\"--redoc\", \"--redocly\"],\n [\"-ap\", \"--additional-properties\"],\n]);\n\n/** The dependency fields of package.json that install packages, in the order npm documents them. */\nexport const DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"peerDependencies\",\n \"optionalDependencies\",\n] as const;\n\nexport type DependencyField = (typeof DEPENDENCY_FIELDS)[number];\n\n/**\n * Fields keyed by the name of a dependency: `peerDependenciesMeta` (npm, its `optional` flag),\n * `dependenciesMeta` (pnpm and Yarn). A key left with the old name loses its meaning: an optional\n * peer becomes required (finding M3).\n */\nexport const NAME_KEYED_FIELDS = [\"peerDependenciesMeta\", \"dependenciesMeta\"] as const;\n\n/** Fields that list the names of dependencies to bundle (npm reads both spellings). */\nexport const NAME_LIST_FIELDS = [\"bundleDependencies\", \"bundledDependencies\"] as const;\n\n/**\n * Catalogs in package.json: bun reads `catalog` and `catalogs` at the top level and under\n * `workspaces`. Their names are what `catalog:` dependencies point at.\n */\nexport const CATALOG_FIELD = \"catalog\";\nexport const NAMED_CATALOGS_FIELD = \"catalogs\";\nexport const WORKSPACES_FIELD = \"workspaces\";\n\n/** Fields that can name a package without installing it; they are reported, not rewritten. */\nexport const OVERRIDE_FIELDS = [\"overrides\", \"resolutions\"] as const;\n\n/** The pnpm settings of package.json; `pnpm.overrides` is one of them. */\nexport const PNPM_SETTINGS_FIELD = \"pnpm\";\n\n/** An original package that another package still needs as a peer dependency. */\nexport interface OldPeer {\n readonly peer: string;\n readonly range: string;\n}\n\n/**\n * Packages that keep a peer dependency on an original package after the migration. swr-openapi 5\n * takes its client type from openapi-fetch (`peerDependencies: { \"openapi-fetch\": \">=0.15\" }`).\n * TypeScript infers the paths of that generic type only from the same declaration, so the\n * project must alias openapi-fetch to openapi-typesafe-fetch (ADR-030).\n */\nexport const OLD_PEER_DEPENDENTS: ReadonlyMap<string, OldPeer> = new Map([\n [\"swr-openapi\", { peer: \"openapi-fetch\", range: \">=0.15\" }],\n]);\n\nconst PATH_SEPARATOR = \"/\";\n/** Bundlers read a query after a specifier (`?url`, `?raw`) as how to load the module. */\nconst QUERY_START = \"?\";\n\n/** A module specifier with the package renamed, and whether it reaches into the package. */\nexport interface RenamedSpecifier {\n readonly to: string;\n readonly isDeep: boolean;\n}\n\n/**\n * The new name of a whole package name, or of a name and a subpath (`openapi-fetch/x`, and the\n * `openapi-fetch/` prefix of an import map), with any query of a bundler kept as written\n * (`openapi-fetch?url`, `openapi-fetch/x.js?raw`); undefined for other specifiers.\n */\nexport function renamedSpecifier(value: string): RenamedSpecifier | undefined {\n const ends = [value.indexOf(PATH_SEPARATOR), value.indexOf(QUERY_START)].filter(\n (at) => at !== -1,\n );\n const name = value.slice(0, ends.length === 0 ? value.length : Math.min(...ends));\n const renamed = PACKAGE_RENAMES.get(name);\n if (renamed === undefined) {\n return undefined;\n }\n const rest = value.slice(name.length);\n const subpath = rest.split(QUERY_START, 1)[0] ?? rest;\n return { to: `${renamed}${rest}`, isDeep: subpath !== \"\" && subpath !== PATH_SEPARATOR };\n}\n\nconst NODE_MODULES_FOLDER = \"node_modules/\";\n\n/**\n * The old package whose installed files a path points into (`../node_modules/openapi-fetch/x.js`,\n * `node_modules/openapi-typescript/bin/cli.js`) or whose folder it names\n * (`./node_modules/openapi-fetch`), or undefined.\n */\nexport function oldPackageInNodeModules(path: string): string | undefined {\n return [...PACKAGE_RENAMES.keys()].find(\n (name) =>\n path.includes(`${NODE_MODULES_FOLDER}${name}${PATH_SEPARATOR}`) ||\n path.endsWith(`${NODE_MODULES_FOLDER}${name}`),\n );\n}\n","import { columnAt, type FileMigration, lineAt, unchanged } from \"./migration-findings.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\n\n/**\n * A JSON, JSONC or YAML config as a parser adapter reads it: a tree per document with the offsets\n * of its nodes in the text, so a migration replaces one key, value or word and keeps the rest of\n * the file byte for byte (comments, formatting, number literals, key order, duplicate keys).\n * Migrations that look for values by key path read the string values of the tree.\n */\n\ninterface Span {\n readonly start: number;\n readonly end: number;\n}\n\n/** A node that a YAML anchor names (`&scripts`), so an alias (`*scripts`) can use it elsewhere. */\ninterface Anchorable {\n readonly anchor?: string;\n}\n\n/**\n * A text value: a JSON string, a YAML scalar. `start` and `end` cover the node with its quotes;\n * `content` covers its text as written: inside the quotes, and the content lines of a block\n * scalar without its `|` or `>` line. A YAML plain scalar that YAML reads as a number or a\n * boolean has its text as written as `value` (`1.10`, not 1.1).\n */\nexport interface TreeScalar extends Span, Anchorable {\n readonly kind: \"scalar\";\n readonly value: string;\n readonly content: Span;\n /** Line breaks fold to spaces in every YAML scalar but a literal block scalar (`|`). */\n readonly isFolded: boolean;\n /**\n * Whether the value differs from its text as written by more than folding: a JSON string or a\n * double-quoted YAML scalar with an escape (`\\\"`, `\\n`), a single-quoted one with `''`.\n */\n readonly isEscaped: boolean;\n /**\n * Writes a new value as the format needs it at this place, in the quoting of the old one when\n * that quoting can hold it. Undefined where a whole new value could change other places or the\n * type: a YAML block scalar, an anchored or a tagged scalar.\n */\n readonly encode: ((value: string) => string) | undefined;\n}\n\nexport interface TreeEntry {\n readonly key: TreeNode;\n readonly value: TreeNode;\n}\n\n/** A JSON object or YAML mapping, every entry as written, duplicate keys included, in order. */\nexport interface TreeMap extends Span, Anchorable {\n readonly kind: \"map\";\n readonly entries: readonly TreeEntry[];\n}\n\nexport interface TreeList extends Span, Anchorable {\n readonly kind: \"list\";\n readonly items: readonly TreeNode[];\n}\n\n/** A number, boolean or null in JSON, a YAML alias (with the anchor it names), an empty value. */\nexport interface TreeOther extends Span {\n readonly kind: \"other\";\n readonly alias?: string;\n}\n\nexport type TreeNode = TreeMap | TreeList | TreeScalar | TreeOther;\n\n/**\n * The documents of a config (a YAML stream can hold several), or where the text stops being\n * valid. `offset` is undefined when the parser gives no place (it gave up on nesting deeper than\n * it can follow).\n */\nexport type DocumentRead =\n | { readonly kind: \"read\"; readonly documents: readonly TreeNode[] }\n | { readonly kind: \"unreadable\"; readonly offset: number | undefined };\n\n/** A key path: mapping keys and list indexes, from the root of the document. */\nexport type DocumentPath = readonly (string | number)[];\n\n/** A string value of a document with its key path. */\nexport interface DocumentString extends TreeScalar {\n readonly path: DocumentPath;\n}\n\nexport const isMap = (node: TreeNode | undefined): node is TreeMap => node?.kind === \"map\";\n\nexport const isScalar = (node: TreeNode): node is TreeScalar => node.kind === \"scalar\";\n\n/** The entries of `map` with a text key, as key and value. */\nexport function textEntries(map: TreeMap): { key: TreeScalar; value: TreeNode }[] {\n return map.entries.flatMap(({ key, value }) => (isScalar(key) ? [{ key, value }] : []));\n}\n\n/** The values of the entries of `map` whose key is `key`, in order. */\nexport function valuesAt(map: TreeMap, key: string): TreeNode[] {\n return textEntries(map)\n .filter((entry) => entry.key.value === key)\n .map((entry) => entry.value);\n}\n\n/** The maps at `key` of `map`, all of them if the key is there more than once. */\nexport function mapsAt(map: TreeMap, key: string): TreeMap[] {\n return valuesAt(map, key).filter(isMap);\n}\n\n/** The node an alias uses, or undefined for none. */\ntype AliasTarget = (alias: TreeOther) => TreeNode | undefined;\n\nconst NO_ALIASES: AliasTarget = () => undefined;\n\n/**\n * The string values below `node` in document order; none below a key that is not text. An alias\n * gives the strings of the node it uses at its own path, with the offsets where they are written.\n */\nfunction stringsBelow(node: TreeNode, path: DocumentPath, targetOf: AliasTarget): DocumentString[] {\n switch (node.kind) {\n case \"scalar\":\n return [{ ...node, path }];\n case \"list\":\n return node.items.flatMap((item, index) => stringsBelow(item, [...path, index], targetOf));\n case \"map\":\n return textEntries(node).flatMap(({ key, value }) =>\n stringsBelow(value, [...path, key.value], targetOf),\n );\n default: {\n const target = targetOf(node);\n return target === undefined ? [] : stringsBelow(target, path, targetOf);\n }\n }\n}\n\n/** Every string value of the documents (not the keys), with its key path, in document order. */\nexport function documentStrings(documents: readonly TreeNode[]): DocumentString[] {\n return documents.flatMap((document) => stringsBelow(document, [], NO_ALIASES));\n}\n\n/** `node` and every node below it, in document order. */\nfunction nodesBelow(node: TreeNode): TreeNode[] {\n const children =\n node.kind === \"list\"\n ? node.items\n : node.kind === \"map\"\n ? node.entries.flatMap(({ key, value }) => [key, value])\n : [];\n return [node, ...children.flatMap(nodesBelow)];\n}\n\n/**\n * The node each alias of a document uses: the last node before the alias with its anchor that\n * does not hold the alias, as YAML reads it. A target ends before its alias, so the aliases in\n * it come earlier in the text, and following them always ends.\n */\nfunction aliasTargets(document: TreeNode): AliasTarget {\n const anchored = nodesBelow(document).filter(\n (node) => node.kind !== \"other\" && node.anchor !== undefined,\n );\n return (alias) =>\n anchored.findLast(\n (node) => node.kind !== \"other\" && node.anchor === alias.alias && node.end <= alias.start,\n );\n}\n\n/**\n * Every string value of the documents where it is used: once where it is written, and again at\n * the path of each alias that uses it (`script: [*gen_scripts]`), with the same offsets.\n */\nexport function usedDocumentStrings(documents: readonly TreeNode[]): DocumentString[] {\n return documents.flatMap((document) => stringsBelow(document, [], aliasTargets(document)));\n}\n\n/**\n * The key a value belongs to: the last key of its path, past list indexes, so the items of a list\n * (also of a nested list) belong to the key that holds the list.\n */\nexport function ownerKey(path: DocumentPath): string | undefined {\n return path.findLast((part): part is string => typeof part === \"string\");\n}\n\n/**\n * The migration of a config that the parser could not read. A broken config that names no\n * original package is not this migration's concern; one that does is left to the user, with the\n * place where it stops being valid.\n */\nexport function unreadableConfig(text: string, offset: number | undefined): FileMigration {\n if (!namesOriginalPackage(text)) {\n return unchanged(text);\n }\n const position =\n offset === undefined\n ? undefined\n : { line: lineAt(text, offset), column: columnAt(text, offset) };\n return { ...unchanged(text), manualSteps: [{ kind: \"config-unreadable\", position }] };\n}\n","/**\n * A file of the project that names another one by a relative reference (`./deps.json`,\n * `../schemas/Job.yaml`), which its tool resolves against the folder of the file.\n */\n\nconst SEPARATOR = \"/\";\nconst CURRENT_FOLDER = \".\";\nconst PARENT_FOLDER = \"..\";\n// A URL scheme (`https:`, `file:`): the tool fetches or reads such a file from where it says.\nconst URL_SCHEME = /^[a-z][a-z\\d+.-]*:/i;\n\n/** The project-relative path of `reference` from the folder of `fromPath`, or undefined. */\nfunction resolvedPath(fromPath: string, reference: string): string | undefined {\n const parts = fromPath.split(SEPARATOR).slice(0, -1);\n for (const part of reference.split(SEPARATOR)) {\n if (part === PARENT_FOLDER) {\n if (parts.pop() === undefined) {\n return undefined;\n }\n } else if (part !== CURRENT_FOLDER && part !== \"\") {\n parts.push(part);\n }\n }\n return parts.join(SEPARATOR);\n}\n\n/**\n * The project-relative path that `reference` in the file at `fromPath` names, or undefined for a\n * URL, an absolute path, a path outside the project, or the project folder itself.\n */\nexport function referencedProjectPath(fromPath: string, reference: string): string | undefined {\n const isOutside = URL_SCHEME.test(reference) || reference.startsWith(SEPARATOR);\n const path = isOutside ? undefined : resolvedPath(fromPath, reference);\n return path === \"\" ? undefined : path;\n}\n","import {\n documentStrings,\n isMap,\n isScalar,\n type TreeNode,\n textEntries,\n} from \"./config-documents.js\";\nimport { referencedProjectPath } from \"./relative-references.js\";\n\n/**\n * API descriptions are data: an example `command`, a `default`, a `script` in them is not a\n * command that anything runs, and a change to it reaches the generated JSDoc. They are not\n * migrated: the documents with a top-level key of their format, and the files that such a\n * document reaches by `$ref` (a split layout keeps a schema in `components/schemas/Job.yaml`,\n * which has no such key).\n */\n\n/**\n * The top-level keys of an API description: OpenAPI 3, Swagger 2, AsyncAPI, and the OpenAPI\n * Overlay and Arazzo documents that are written next to them.\n */\nconst API_DESCRIPTION_KEYS: readonly string[] = [\n \"openapi\",\n \"swagger\",\n \"asyncapi\",\n \"overlay\",\n \"arazzo\",\n];\nconst API_DESCRIPTION_KEY_SET: ReadonlySet<string> = new Set(API_DESCRIPTION_KEYS);\n\n/**\n * A line that can start such a key, in YAML (`openapi: 3.1.0`) or JSON (`\"openapi\": \"3.1.0\"`).\n * It only tells which texts to parse: the parsed keys decide.\n */\nconst DESCRIPTION_KEY_LINE_RE = new RegExp(\n `^[ \\\\t{]*[\"']?(?:${API_DESCRIPTION_KEYS.join(\"|\")})[\"']?[ \\\\t]*:`,\n \"m\",\n);\n\n/** Whether a text may be an API description, so it is worth parsing to tell. */\nexport const mayBeApiDescription = (text: string): boolean => DESCRIPTION_KEY_LINE_RE.test(text);\n\n/**\n * The version that each of these specs writes under its key (`openapi: 3.1.0`,\n * `swagger: \"2.0\"`, `asyncapi: 3.0.0`, `overlay: 1.0.0`, `arazzo: 1.0.1`): major and minor, an\n * optional patch and pre-release. A map there (a GitLab job named `openapi`) is no API\n * description.\n */\nconst SPEC_VERSION_RE = /^\\d+\\.\\d+(?:\\.\\d+)?(?:-[0-9A-Za-z.-]+)?$/;\n\n/** True when a document of the stream has a top-level key of an API description with a version. */\nexport const isApiDescription = (documents: readonly TreeNode[]): boolean =>\n documents.some(\n (root) =>\n isMap(root) &&\n textEntries(root).some(\n ({ key, value }) =>\n API_DESCRIPTION_KEY_SET.has(key.value) &&\n isScalar(value) &&\n SPEC_VERSION_RE.test(value.value),\n ),\n );\n\nconst REF_KEY = \"$ref\";\nconst FRAGMENT_START = \"#\";\n\n/**\n * The project files that the `$ref` values of the document at `path` name, without their\n * fragment (`./schemas/Job.yaml#/Job`). A reference inside the document (`#/components/…`), a URL\n * and a path outside the project name no file of it.\n */\nexport function referencedFiles(path: string, documents: readonly TreeNode[]): string[] {\n return documentStrings(documents)\n .filter((string) => string.path.at(-1) === REF_KEY)\n .flatMap(({ value }) => {\n // `#/components/…` leaves no file part, which names the folder of the document: no file.\n const file = value.split(FRAGMENT_START)[0] ?? \"\";\n const referenced = referencedProjectPath(path, file);\n return referenced === undefined ? [] : [referenced];\n });\n}\n","/**\n * The programs that run another program or install packages, so the migration can tell the\n * generator command and package names from the words of other commands. `docker run -it` keeps\n * its flag, `npm run openapi-typescript` names a script, and `npm i openapi-fetch` a package.\n */\n\n/** A program that runs the program named by its first argument that is not an option. */\nexport interface Launcher {\n /** The words that start it: `npx`, or `pnpm dlx`. */\n readonly words: readonly string[];\n /** Options whose value is the next word, so that word is not the program. */\n readonly valueOptions: ReadonlySet<string>;\n /** Options whose value is a package to install first (`npx -p <package>`). */\n readonly packageOptions: ReadonlySet<string>;\n /** Arguments before the program that are not options: the image of `docker run <image>`. */\n readonly operands: number;\n}\n\nconst NONE: ReadonlySet<string> = new Set();\n/** `npx -p`, `pnpm dlx --package`, `yarn dlx -p`, `bunx -p`. */\nconst PACKAGE_OPTIONS: ReadonlySet<string> = new Set([\"-p\", \"--package\"]);\n/** Options of npm, pnpm and yarn that take a value and may come before the subcommand. */\nconst PACKAGE_MANAGER_OPTIONS: ReadonlySet<string> = new Set([\n \"--filter\",\n \"-F\",\n \"--dir\",\n \"-C\",\n \"--prefix\",\n \"--cwd\",\n \"--workspace\",\n]);\n\nconst launcher = (\n words: readonly string[],\n packageOptions: ReadonlySet<string> = NONE,\n valueOptions: ReadonlySet<string> = NONE,\n): Launcher => {\n const allValueOptions = new Set([...valueOptions, ...packageOptions]);\n return { words, packageOptions, valueOptions: allValueOptions, operands: 0 };\n};\n\n/** Options of `docker run` and `docker exec` that take a value. */\nconst CONTAINER_OPTIONS: ReadonlySet<string> = new Set([\n \"-e\",\n \"--env\",\n \"--env-file\",\n \"-v\",\n \"--volume\",\n \"--mount\",\n \"-p\",\n \"--publish\",\n \"-w\",\n \"--workdir\",\n \"-u\",\n \"--user\",\n \"--name\",\n \"--network\",\n \"--entrypoint\",\n \"--platform\",\n \"-l\",\n \"--label\",\n \"-h\",\n \"--hostname\",\n \"--add-host\",\n]);\n\n/** `docker run <image> <command>`: the image comes first, then the command run in it. */\nconst container = (words: readonly string[]): Launcher => ({\n ...launcher(words, NONE, CONTAINER_OPTIONS),\n operands: 1,\n});\n\n/** A launcher with arguments before the program: the duration of `timeout 60 <command>`. */\nconst withOperands = (\n words: readonly string[],\n operands: number,\n valueOptions: ReadonlySet<string> = NONE,\n): Launcher => ({ ...launcher(words, NONE, valueOptions), operands });\n\n/** Options of `xargs` that take a value (GNU and BSD). */\nconst XARGS_OPTIONS: ReadonlySet<string> = new Set([\n \"-I\",\n \"-J\",\n \"-L\",\n \"-n\",\n \"-P\",\n \"-R\",\n \"-S\",\n \"-s\",\n \"-d\",\n \"-E\",\n \"-a\",\n \"--max-args\",\n \"--max-procs\",\n \"--max-lines\",\n \"--delimiter\",\n \"--arg-file\",\n]);\n\n/** Options of `node`, which `tsx` and `ts-node` take too, that are followed by a value. */\nconst NODE_OPTIONS: ReadonlySet<string> = new Set([\n \"-r\",\n \"--require\",\n \"--import\",\n \"--loader\",\n \"--env-file\",\n]);\n\n/**\n * The launchers, longest first, so `pnpm dlx` wins over `pnpm`. A bare `pnpm <name>`, `yarn\n * <name>` or `bun <name>` runs the binary `<name>` when no script has that name; `run` names a\n * script first, so `npm run`, `yarn run` and `bun run` are no launchers: a word after them that\n * names an old package is reported (command-migration.ts).\n */\nexport const LAUNCHERS: readonly Launcher[] = [\n launcher([\"npm\", \"exec\"], PACKAGE_OPTIONS),\n launcher([\"npm\", \"x\"], PACKAGE_OPTIONS),\n launcher([\"pnpm\", \"exec\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"pnpm\", \"dlx\"], new Set([\"--package\"])),\n launcher([\"yarn\", \"dlx\"], PACKAGE_OPTIONS),\n launcher([\"yarn\", \"exec\"]),\n launcher([\"bun\", \"x\"], PACKAGE_OPTIONS),\n withOperands([\"yarn\", \"workspace\"], 1),\n launcher([\"dotenvx\", \"run\"], NONE, new Set([\"-f\", \"--env-file\", \"-e\", \"--env\", \"--convention\"])),\n launcher(\n [\"doppler\", \"run\"],\n NONE,\n new Set([\"-p\", \"--project\", \"-c\", \"--config\", \"--token\", \"--mount\", \"--scope\"]),\n ),\n launcher([\"nx\", \"exec\"], NONE, new Set([\"--projects\", \"-p\", \"--exclude\"])),\n launcher([\"deno\", \"run\"], NONE, new Set([\"--config\", \"-c\", \"--import-map\", \"--location\"])),\n launcher([\"deno\", \"x\"]),\n launcher([\"npx\"], PACKAGE_OPTIONS, new Set([\"-c\", \"--call\"])),\n launcher([\"pnpx\"], PACKAGE_OPTIONS),\n launcher([\"bunx\"], PACKAGE_OPTIONS),\n // Like a bare `pnpm <name>`, a bare `bun <name>` runs the binary when no script has the name.\n launcher([\"bun\"], NONE, new Set([\"--cwd\", \"--filter\", \"-F\"])),\n launcher([\"corepack\"]),\n launcher([\"pnpm\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"yarn\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"node\"], NONE, NODE_OPTIONS),\n launcher([\"tsx\"], NONE, NODE_OPTIONS),\n launcher([\"ts-node\"], NONE, new Set([...NODE_OPTIONS, \"-P\", \"--project\", \"-O\", \"--compiler\"])),\n launcher([\"cross-env\"]),\n launcher([\"dotenv\"], NONE, new Set([\"-e\", \"-c\", \"-v\"])),\n launcher([\"env\"], NONE, new Set([\"-u\", \"--unset\", \"-C\", \"--chdir\"])),\n launcher([\"exec\"], NONE, new Set([\"-a\"])),\n launcher([\"command\"]),\n launcher([\"time\"]),\n launcher([\"nice\"], NONE, new Set([\"-n\", \"--adjustment\"])),\n withOperands([\"timeout\"], 1, new Set([\"-s\", \"--signal\", \"-k\", \"--kill-after\"])),\n launcher([\"xargs\"], NONE, XARGS_OPTIONS),\n launcher([\"nohup\"]),\n launcher([\"sudo\"], NONE, new Set([\"-u\", \"-g\"])),\n // The shell form of Dockerfile instructions runs the rest of the line in a shell.\n launcher([\"RUN\"], NONE, new Set([\"--mount\", \"--network\", \"--security\"])),\n launcher([\"CMD\"]),\n launcher([\"ENTRYPOINT\"]),\n container([\"docker\", \"run\"]),\n container([\"docker\", \"exec\"]),\n container([\"docker\", \"compose\", \"run\"]),\n container([\"docker\", \"compose\", \"exec\"]),\n container([\"podman\", \"run\"]),\n container([\"podman\", \"exec\"]),\n];\n\n/** A subcommand that installs, updates or removes the packages named by its other arguments. */\nexport interface Installer {\n readonly words: readonly string[];\n}\n\nconst installers = (manager: string, subcommands: readonly string[]): Installer[] =>\n subcommands.map((subcommand) => ({ words: [manager, subcommand] }));\n\nconst NPM_INSTALL = [\"install\", \"i\", \"add\", \"update\", \"up\", \"uninstall\", \"remove\", \"rm\", \"un\"];\n\nexport const INSTALLERS: readonly Installer[] = [\n ...installers(\"npm\", NPM_INSTALL),\n ...installers(\"pnpm\", [\"add\", \"update\", \"up\", \"remove\", \"rm\", \"uninstall\", \"un\"]),\n ...installers(\"yarn\", [\"add\", \"upgrade\", \"up\", \"remove\"]),\n // Yarn 1 installs global packages with `yarn global add`.\n { words: [\"yarn\", \"global\", \"add\"] },\n { words: [\"yarn\", \"global\", \"remove\"] },\n ...installers(\"bun\", [\"add\", \"a\", \"update\", \"remove\", \"rm\", \"install\", \"i\"]),\n ...installers(\"deno\", [\"add\", \"install\", \"i\", \"remove\", \"uninstall\"]),\n];\n\n/** `npm:` names a package in Deno commands (`deno run npm:openapi-typescript`). */\nexport const NPM_SPECIFIER_PREFIX = \"npm:\";\n","/**\n * GitHub Actions expressions in shell text (`${{ inputs.gen || 'npx openapi-typescript' }}`).\n * The runner puts the value of an expression into the script before the shell runs, so a string\n * literal of the expression is command text where it is written, the \"overridable command\" idiom\n * of reusable workflows. The rest of the expression (an input, a matrix value) is known only to\n * the run.\n */\n\n/** A string literal of an expression: its text between the quotes, and where that text starts. */\nexport interface ExpressionLiteral {\n readonly text: string;\n readonly start: number;\n}\n\n/** In shell text `${{` is a bad substitution, so no valid shell text holds one otherwise. */\nexport const EXPRESSION_OPEN = \"${{\";\nconst EXPRESSION_CLOSE = \"}}\";\nconst LITERAL_QUOTE = \"'\";\nconst SHELL_SINGLE_QUOTE = \"'\";\nconst BACKSLASH = \"\\\\\";\nconst DOUBLE_QUOTE = '\"';\n\n/**\n * The end of the expression at `start`, after the `}}` that closes it, or undefined when none\n * does. Its string literals are skipped whole; `''` in one reads as its end and a new start.\n */\nexport function expressionEnd(text: string, start: number): number | undefined {\n for (let index = start + EXPRESSION_OPEN.length; index < text.length; ) {\n if (text.startsWith(EXPRESSION_CLOSE, index)) {\n return index + EXPRESSION_CLOSE.length;\n }\n const close = text[index] === LITERAL_QUOTE ? text.indexOf(LITERAL_QUOTE, index + 1) : index;\n index = close === -1 ? text.length : close + 1;\n }\n return undefined;\n}\n\nconst INDEX_OPEN = \"[\";\nconst TRAILING_BLANKS_RE = /[ \\t]*$/;\n\n/** Whether the literal that opens at `open` is a key in an index (`inputs['flags']`). */\nconst isIndexKey = (raw: string, open: number): boolean =>\n raw.slice(0, open).replace(TRAILING_BLANKS_RE, \"\").endsWith(INDEX_OPEN);\n\n/**\n * The string literals between `start` and `end` of `raw`. A literal with an escaped quote (`''`)\n * is left out: its value is not the text as written, so its offsets would not map onto the text.\n * A key in an index (`inputs['flags']`) names a value, so it is no literal of the expression.\n */\nfunction literalsIn(raw: string, start: number, end: number): ExpressionLiteral[] {\n const found: ExpressionLiteral[] = [];\n let open = raw.indexOf(LITERAL_QUOTE, start);\n while (open !== -1 && open < end) {\n let close = raw.indexOf(LITERAL_QUOTE, open + 1);\n let isEscaped = false;\n while (close !== -1 && raw[close + 1] === LITERAL_QUOTE) {\n isEscaped = true;\n close = raw.indexOf(LITERAL_QUOTE, close + 2);\n }\n if (close === -1) {\n break;\n }\n const isValue = !isEscaped && !isIndexKey(raw, open);\n found.push(...(isValue ? [{ text: raw.slice(open + 1, close), start: open + 1 }] : []));\n open = raw.indexOf(LITERAL_QUOTE, close + 1);\n }\n return found;\n}\n\n/**\n * The string literals of the expressions in a word as written, outside shell single quotes: a\n * value put inside them is data for the program, not a command.\n */\nexport function expressionLiterals(raw: string): ExpressionLiteral[] {\n const found: ExpressionLiteral[] = [];\n for (let index = 0; index < raw.length; ) {\n if (raw[index] === SHELL_SINGLE_QUOTE) {\n const close = raw.indexOf(SHELL_SINGLE_QUOTE, index + 1);\n index = close === -1 ? raw.length : close + 1;\n } else if (raw[index] === BACKSLASH) {\n index += 2;\n } else if (raw.startsWith(EXPRESSION_OPEN, index)) {\n const end = expressionEnd(raw, index) ?? raw.length;\n found.push(...literalsIn(raw, index + EXPRESSION_OPEN.length, end));\n index = end;\n } else {\n index += 1;\n }\n }\n return found;\n}\n\n/** A text with each expression in it (to its `}}`, or to the end) replaced by what `map` gives. */\nexport function mapExpressions(text: string, map: (expression: string) => string): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (let open = text.indexOf(EXPRESSION_OPEN); open !== -1; ) {\n const end = expressionEnd(text, open) ?? text.length;\n parts.push(text.slice(copiedUpTo, open), map(text.slice(open, end)));\n copiedUpTo = end;\n open = text.indexOf(EXPRESSION_OPEN, end);\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** Whether a word is one expression as a whole, also in double quotes: `\"${{ inputs.gen }}\"`. */\nexport function isWholeExpression(raw: string): boolean {\n const isQuoted = raw.length > 1 && raw.startsWith(DOUBLE_QUOTE) && raw.endsWith(DOUBLE_QUOTE);\n const inner = isQuoted ? 1 : 0;\n return raw.startsWith(EXPRESSION_OPEN, inner) && expressionEnd(raw, inner) === raw.length - inner;\n}\n","import { EXPRESSION_OPEN, expressionEnd } from \"./workflow-expressions.js\";\n\n/**\n * The words of shell text: where a word ends, and its value after quote removal (POSIX 2.2, 2.3).\n * shell-words.ts splits a text into commands of these words.\n */\n\n/** One word of a command. `start` and `end` are offsets of the word as written, quotes included. */\nexport interface ShellWord {\n readonly start: number;\n readonly end: number;\n /** The word after quote removal: `\"a b\"` is `a b`. */\n readonly value: string;\n /** The word as written: `\"a b\"` is `\"a b\"`. */\n readonly raw: string;\n}\n\n/** A simple command: the words between two control operators. */\nexport type ShellCommand = readonly ShellWord[];\n\n/** Characters that end a command: `;`, `&`, `|`, subshells and command substitution. */\nexport const COMMAND_SEPARATORS: ReadonlySet<string> = new Set([\n \";\",\n \"&\",\n \"|\",\n \"(\",\n \")\",\n \"`\",\n \"\\n\",\n]);\n/** Characters that end a word without ending the command: blanks and redirections. */\nexport const WORD_BREAKS: ReadonlySet<string> = new Set([\" \", \"\\t\", \"\\r\", \"<\", \">\"]);\nconst BACKSLASH = \"\\\\\";\n/** Inside double quotes a backslash escapes only these characters (POSIX 2.2.3). */\nconst DOUBLE_QUOTE_ESCAPES: ReadonlySet<string> = new Set([\"$\", \"`\", '\"', BACKSLASH, \"\\n\"]);\n\n/** A quoted part of a word: where it ends (after the closing quote) and its value. */\ninterface QuotedPart {\n readonly end: number;\n readonly value: string;\n}\n\n/** A single-quoted part starting at `start`: everything up to the next `'` is literal. */\nfunction singleQuoted(text: string, start: number): QuotedPart {\n const close = text.indexOf(\"'\", start + 1);\n const end = close === -1 ? text.length : close + 1;\n return { end, value: text.slice(start + 1, close === -1 ? text.length : close) };\n}\n\n/** A double-quoted part starting at `start`, with its backslash escapes resolved. */\nfunction doubleQuoted(text: string, start: number): QuotedPart {\n let value = \"\";\n let index = start + 1;\n while (index < text.length && text[index] !== '\"') {\n const next = text[index + 1] ?? \"\";\n const isEscape = text[index] === BACKSLASH && DOUBLE_QUOTE_ESCAPES.has(next);\n value += isEscape ? (next === \"\\n\" ? \"\" : next) : text[index];\n index += isEscape ? 2 : 1;\n }\n return { end: Math.min(index + 1, text.length), value };\n}\n\nexport const isLineContinuation = (text: string, index: number): boolean =>\n text[index] === BACKSLASH && (text[index + 1] === \"\\n\" || text.startsWith(\"\\r\\n\", index + 1));\n\n/** `$((…))`: an arithmetic expansion (POSIX 2.6.4), whose `<<` is a shift, not a here-document. */\nconst ARITHMETIC_OPEN = \"$((\";\nconst NESTING_OPEN = \"(\";\nconst NESTING_CLOSE = \")\";\n/** The parentheses that `$((` opens and `))` closes. */\nconst ARITHMETIC_DEPTH = 2;\n\n/**\n * The arithmetic expansion at `start`, up to the `))` that closes it, as written: it holds an\n * expression, not commands, so its parentheses do not end the command. Undefined when it is not\n * closed, a syntax error that the shell reports.\n */\nfunction arithmeticExpansion(text: string, start: number): QuotedPart | undefined {\n let depth = ARITHMETIC_DEPTH;\n for (let index = start + ARITHMETIC_OPEN.length; index < text.length; index++) {\n depth += text[index] === NESTING_OPEN ? 1 : text[index] === NESTING_CLOSE ? -1 : 0;\n if (depth === 0) {\n return { end: index + 1, value: text.slice(start, index + 1) };\n }\n }\n return undefined;\n}\n\n/** `${…}`: a parameter expansion (POSIX 2.6.2), one part of a word up to its closing brace. */\nexport const PARAMETER_OPEN = \"${\";\nconst PARAMETER_CLOSE = \"}\";\n\n/**\n * The end of the parameter expansion at `start`, after the `}` that closes it, or undefined when\n * none does. A blank inside it does not end the word (`${GEN:-npx openapi-typescript}`), and a\n * quoted string, an escape or a nested expansion inside it is skipped whole. So is a workflow\n * expression inside it (`${GEN:-${{ inputs.gen }}}`), whose `}}` the runner reads, not the shell.\n */\nexport function parameterExpansionEnd(text: string, start: number): number | undefined {\n let depth = 1;\n for (let index = start + PARAMETER_OPEN.length; index < text.length; ) {\n if (text.startsWith(EXPRESSION_OPEN, index)) {\n index = expressionEnd(text, index) ?? text.length;\n } else if (text.startsWith(PARAMETER_OPEN, index)) {\n depth += 1;\n index += PARAMETER_OPEN.length;\n } else if (text[index] === PARAMETER_CLOSE) {\n depth -= 1;\n index += 1;\n if (depth === 0) {\n return index;\n }\n } else {\n index = quotedOrEscapedEnd(text, index) ?? index + 1;\n }\n }\n return undefined;\n}\n\n/** The end of a quoted string or an escape at `index`, or undefined for another character. */\nfunction quotedOrEscapedEnd(text: string, index: number): number | undefined {\n const char = text[index];\n if (char === \"'\") {\n return singleQuoted(text, index).end;\n }\n if (char === '\"') {\n return doubleQuoted(text, index).end;\n }\n return char === BACKSLASH ? index + 2 : undefined;\n}\n\n/** The expansion parts of a word that are read whole: `$((…))` and `${…}`, as written. */\nfunction expansionPart(text: string, index: number): QuotedPart | undefined {\n if (text.startsWith(ARITHMETIC_OPEN, index)) {\n return arithmeticExpansion(text, index);\n }\n const end = text.startsWith(PARAMETER_OPEN, index)\n ? parameterExpansionEnd(text, index)\n : undefined;\n return end === undefined ? undefined : { end, value: text.slice(index, end) };\n}\n\n/**\n * The part of a word that starts at `index`: a quoted string, an escape, an arithmetic or a\n * parameter expansion, or one character.\n */\nexport function wordPart(text: string, index: number): QuotedPart {\n const char = text[index] as string;\n const expansion = expansionPart(text, index);\n if (expansion !== undefined) {\n return expansion;\n }\n if (char === \"'\") {\n return singleQuoted(text, index);\n }\n if (char === '\"') {\n return doubleQuoted(text, index);\n }\n if (char === BACKSLASH && index + 1 < text.length) {\n return { end: index + 2, value: text[index + 1] as string };\n }\n return { end: index + 1, value: char };\n}\n\n/** A text after quote removal, with the offset in the text as written of each of its characters. */\nexport interface UnquotedText {\n readonly value: string;\n readonly offsets: readonly number[];\n}\n\n/** The offsets of the characters that a double-quoted part at `start` keeps. */\nfunction doubleQuotedOffsets(text: string, start: number, end: number): number[] {\n const offsets: number[] = [];\n for (let index = start + 1; index < end && text[index] !== '\"'; index++) {\n const isEscape = text[index] === BACKSLASH && DOUBLE_QUOTE_ESCAPES.has(text[index + 1] ?? \"\");\n index += isEscape ? 1 : 0;\n if (text[index] !== \"\\n\" || !isEscape) {\n offsets.push(index);\n }\n }\n return offsets;\n}\n\n/** The offsets of the characters of the part at `start`: what quotes and escapes keep. */\nfunction partOffsets(text: string, start: number, part: QuotedPart): number[] {\n const char = text[start];\n if (char === '\"') {\n return doubleQuotedOffsets(text, start, part.end);\n }\n // A quote or an escaping backslash is not a character of the value; a `\\` that ends the\n // text escapes nothing and stays.\n const isOpened = char === \"'\" || (char === BACKSLASH && part.end - start > 1);\n const first = isOpened ? start + 1 : start;\n return Array.from(part.value, (_, index) => first + index);\n}\n\n/**\n * A word (or a part of one) after quote removal, as `readWord` gives its value, with where each\n * character is written: `npx\\ a` and `\"npx \"a` are `npx a`, whose `a` is at offset 5. A value\n * read again as a command line (`GEN=\"npx \"openapi-typescript`, then `$GEN`) places its words\n * by these offsets, so a word written without quotes inside it is edited where it is written.\n */\nexport function unquotedText(text: string): UnquotedText {\n let value = \"\";\n const offsets: number[] = [];\n for (let index = 0; index < text.length; ) {\n const part = wordPart(text, index);\n value += part.value;\n offsets.push(...partOffsets(text, index, part));\n index = part.end;\n }\n return { value, offsets };\n}\n\n/** The head of a bash array assignment, `NAME=` or `NAME+=` right before its `(`. */\nconst ARRAY_HEAD_RE = /^[A-Za-z_][A-Za-z0-9_]*\\+?=$/;\n\n/**\n * The end of the list of a bash array assignment (`GEN=(npx openapi-typescript)`) at `index`,\n * after its `)`: bash reads it as part of the assignment word, not as a subshell. Quotes and\n * escapes in it are skipped whole. Undefined when no `)` closes it.\n */\nfunction arrayListEnd(text: string, index: number): number | undefined {\n let depth = 0;\n for (let at = index; at < text.length; ) {\n depth += text[at] === NESTING_OPEN ? 1 : text[at] === NESTING_CLOSE ? -1 : 0;\n if (depth === 0) {\n return at + 1;\n }\n at = quotedOrEscapedEnd(text, at) ?? at + 1;\n }\n return undefined;\n}\n\nconst endsWord = (text: string, index: number): boolean => {\n const char = text[index] as string;\n return WORD_BREAKS.has(char) || COMMAND_SEPARATORS.has(char) || isLineContinuation(text, index);\n};\n\n/** The word that starts at `start` (not a blank, separator or comment). */\nexport function readWord(text: string, start: number): ShellWord {\n let value = \"\";\n let index = start;\n while (index < text.length) {\n const isArrayList =\n text[index] === NESTING_OPEN && ARRAY_HEAD_RE.test(text.slice(start, index));\n const list = isArrayList ? arrayListEnd(text, index) : undefined;\n if (list === undefined && endsWord(text, index)) {\n break;\n }\n const part =\n list === undefined ? wordPart(text, index) : { end: list, value: text.slice(index, list) };\n value += part.value;\n index = part.end;\n }\n return { start, end: index, value, raw: text.slice(start, index) };\n}\n","import { type ShellCommand, type ShellWord, unquotedText } from \"./shell-word-parts.js\";\n\n/**\n * The variables a shell text sets itself: `GEN=\"npx openapi-typescript\"` alone or before a\n * command, and the arguments of `export`, `readonly`, `local`, `declare` and `typeset`. A later\n * `$GEN a.yaml -it` runs what the value holds, so the value is read as a command line where it is\n * set, and the commands that expand the variable know which program it runs. bash, ksh and zsh\n * also append to a value (`G+=\" -it\"`).\n */\n\n/** A word that assigns a variable (POSIX 2.9.1): a name, `=` or `+=`, then the value. */\nexport const ASSIGNMENT_RE = /^([A-Za-z_][A-Za-z0-9_]*)(\\+?=)/;\nconst APPEND_OPERATOR = \"+=\";\n\n/** Builtins whose `NAME=value` arguments set variables of the shell. */\nconst DECLARATION_BUILTINS: ReadonlySet<string> = new Set([\n \"export\",\n \"readonly\",\n \"local\",\n \"declare\",\n \"typeset\",\n]);\n\n/**\n * One assignment: the variable, its value after quote removal, its word, and whether it appends\n * the value to the one the variable has. `head` is the length of `NAME=` or `NAME+=`.\n */\nexport interface ShellAssignment {\n readonly name: string;\n readonly value: string;\n readonly word: ShellWord;\n readonly isAppend: boolean;\n readonly head: number;\n}\n\n/** How many words at the start of a command are assignments. */\nfunction leadingAssignments(command: ShellCommand): number {\n const index = command.findIndex((word) => !ASSIGNMENT_RE.test(word.raw));\n return index === -1 ? command.length : index;\n}\n\n/** The assignment that a word is written as, or none. */\nfunction assignmentOf(word: ShellWord): ShellAssignment[] {\n const match = ASSIGNMENT_RE.exec(word.raw);\n const name = match?.[1];\n if (match === null || name === undefined) {\n return [];\n }\n const head = match[0].length;\n const isAppend = match[2] === APPEND_OPERATOR;\n return [{ name, value: word.value.slice(head), word, isAppend, head }];\n}\n\n/** The assignments of one command, in order. */\nexport function shellAssignments(command: ShellCommand): ShellAssignment[] {\n const count = leadingAssignments(command);\n const isDeclaration = DECLARATION_BUILTINS.has(command[count]?.value ?? \"\");\n const words = [...command.slice(0, count), ...(isDeclaration ? command.slice(count + 1) : [])];\n return words.flatMap(assignmentOf);\n}\n\n/**\n * The words after the program of a command that are written as assignments: `cross-env\n * GEN=\"npx openapi-typescript -it\" node gen.js`, `env GEN=… make`, `make GEN=\"…\"`. The program\n * gets the variable and may run its value, but the shell sets nothing, so they define no\n * variable of the text.\n */\nexport function argumentAssignments(command: ShellCommand): ShellAssignment[] {\n const own = new Set(shellAssignments(command).map(({ word }) => word));\n return command\n .slice(leadingAssignments(command))\n .filter((word) => !own.has(word))\n .flatMap(assignmentOf);\n}\n\n/** A value with a blank or a command separator in it, which only a command line has. */\nconst COMMAND_LINE_RE = /[\\s;&|()`]/;\n\n/**\n * Whether the value of an argument assignment is a command line, as a quoted argument with\n * blanks is (`sh -c \"…\"`): one word (`make V=1`) may be anything, so it is not read as one.\n */\nexport const holdsCommandLine = (assignment: ShellAssignment): boolean =>\n COMMAND_LINE_RE.test(assignment.value);\n\nconst ARRAY_OPEN = \"(\";\n\n/**\n * Whether an assignment sets a bash array (`GEN=(npx openapi-typescript)`). Its items are read\n * as a command line where they are written, but what an expansion of it runs (`$GEN` is the first\n * item, `\"${GEN[@]}\"` all of them) is not read: the commands after it are reported.\n */\nexport const isArrayAssignment = (assignment: ShellAssignment): boolean =>\n assignment.word.raw.startsWith(ARRAY_OPEN, assignment.head);\n\n/**\n * The value of an assignment as the shell reads it (`GEN=npx\\ a`, `GEN=\"npx \"a` and `GEN=\"npx a\"`\n * are all `npx a`), and how to move a word read from it onto the text as written. A later `$GEN`\n * splits that value into words, so the value is read as a command line, the same text that\n * says which program the variable runs (shell-variables.ts), and each word is placed where its\n * characters are written. The items of an array are read as written.\n */\nexport interface AssignmentValue {\n readonly text: string;\n readonly place: (word: ShellWord) => ShellWord;\n}\n\n/**\n * The items of an array assignment as written, between its parentheses: a word is an array\n * assignment only up to the `)` that closes it (shell-word-parts.ts).\n */\nfunction arrayValue({ word, head }: ShellAssignment): AssignmentValue {\n const start = word.start + head + 1;\n const place = (found: ShellWord): ShellWord => ({\n ...found,\n start: found.start + start,\n end: found.end + start,\n });\n return { text: word.raw.slice(head + 1, -1), place };\n}\n\n/** The value of an assignment as a command line, with the places of its words. */\nexport function assignmentValue(assignment: ShellAssignment): AssignmentValue {\n if (isArrayAssignment(assignment)) {\n return arrayValue(assignment);\n }\n const { word, head } = assignment;\n const { value, offsets } = unquotedText(word.raw.slice(head));\n const written = (index: number): number => head + (offsets[index] as number);\n const place = (found: ShellWord): ShellWord => {\n const first = written(found.start);\n const end = written(found.end - 1) + 1;\n const raw = word.raw.slice(first, end);\n return { ...found, start: word.start + first, end: word.start + end, raw };\n };\n return { text: value, place };\n}\n","import { INSTALLERS, LAUNCHERS, type Launcher } from \"./command-launchers.js\";\nimport { ASSIGNMENT_RE } from \"./shell-assignments.js\";\nimport type { ShellCommand, ShellWord } from \"./shell-words.js\";\n\n/**\n * What the words of one shell command are: which word is the program it runs, after launchers\n * such as `npx`, `pnpm exec`, `cross-env` or `node`, and which words name packages to install.\n * The other words are arguments of whichever program owns them, and are never renamed for it.\n */\n\n/** A word that names a package, and the package part of it (`--package=x` names `x`). */\nexport interface PackageWord {\n readonly word: ShellWord;\n readonly value: string;\n}\n\nexport interface CommandRoles {\n /** The index of the program's word, or undefined for an install or an empty command. */\n readonly program: number | undefined;\n readonly packages: readonly PackageWord[];\n}\n\nconst END_OF_OPTIONS = \"--\";\n\nconst isOption = (word: ShellWord): boolean => word.value.startsWith(\"-\") && word.value.length > 1;\n\n/** The first word after the `NAME=value` assignments that may start a command. */\nfunction skipAssignments(words: ShellCommand, start: number): number {\n let index = start;\n while (index < words.length && ASSIGNMENT_RE.test((words[index] as ShellWord).raw)) {\n index++;\n }\n return index;\n}\n\n/**\n * The Windows file suffixes of a program that npm, pnpm and yarn install (`npx.cmd`), for the\n * launchers and for the bins of packages (`openapi-typescript.cmd`) alike.\n */\nconst WINDOWS_PROGRAM_SUFFIX_RE = /\\.(?:cmd|exe|ps1)$/i;\n\n/** The Windows suffix of a program word (`.cmd` of `npx.cmd`), or \"\" for none. */\nexport const windowsSuffix = (value: string): string =>\n WINDOWS_PROGRAM_SUFFIX_RE.exec(value)?.[0] ?? \"\";\n\n/** The program a word names without its Windows suffix: `npx` of `npx.cmd`. */\nexport const withoutWindowsSuffix = (value: string): string =>\n value.slice(0, value.length - windowsSuffix(value).length);\n\n/** The name of a word of a launcher or installer: `npx` of `npx.cmd`. */\nconst entryWord = (word: ShellWord | undefined): string | undefined =>\n word === undefined ? undefined : withoutWindowsSuffix(word.value);\n\n/** The first entry whose words start the command at `index`. */\nfunction matchingPrefix<T extends { readonly words: readonly string[] }>(\n entries: readonly T[],\n words: ShellCommand,\n index: number,\n): T | undefined {\n return entries.find((entry) =>\n entry.words.every((name, offset) => entryWord(words[index + offset]) === name),\n );\n}\n\n/** An option with its value in the same word (`--package=x`): the package it names, if any. */\nfunction inlineOptionPackage(word: ShellWord, launcher: Launcher): PackageWord | undefined {\n const equals = word.value.indexOf(\"=\");\n const name = word.value.slice(0, equals);\n return launcher.packageOptions.has(name)\n ? { word, value: word.value.slice(equals + 1) }\n : undefined;\n}\n\n/**\n * The index of the program a launcher runs: the first word after its options. Options that take\n * a value skip it, and the values of package options are collected into `packages`.\n */\nfunction launchedProgram(\n words: ShellCommand,\n start: number,\n launcher: Launcher,\n packages: PackageWord[],\n): number {\n let index = start;\n while (index < words.length && isOption(words[index] as ShellWord)) {\n const option = words[index++] as ShellWord;\n if (option.value === END_OF_OPTIONS) {\n break;\n }\n const inline = option.value.includes(\"=\") ? inlineOptionPackage(option, launcher) : undefined;\n if (inline !== undefined) {\n packages.push(inline);\n }\n const value = words[index];\n if (!option.value.includes(\"=\") && launcher.valueOptions.has(option.value) && value) {\n if (launcher.packageOptions.has(option.value)) {\n packages.push({ word: value, value: value.value });\n }\n index++;\n }\n }\n return index;\n}\n\n/** The package arguments of an install command: every word that is not an option. */\nconst installArguments = (words: ShellCommand, start: number): PackageWord[] =>\n words\n .slice(start)\n .filter((word) => !isOption(word))\n .map((word) => ({ word, value: word.value }));\n\n/** The roles of the words of one simple command. */\nexport function commandRoles(words: ShellCommand): CommandRoles {\n const packages: PackageWord[] = [];\n let index = skipAssignments(words, 0);\n while (index < words.length) {\n const installer = matchingPrefix(INSTALLERS, words, index);\n if (installer !== undefined) {\n packages.push(...installArguments(words, index + installer.words.length));\n return { program: undefined, packages };\n }\n const launcher = matchingPrefix(LAUNCHERS, words, index);\n if (launcher === undefined) {\n return { program: index, packages };\n }\n const start = index + launcher.words.length;\n const afterOptions = launchedProgram(words, start, launcher, packages);\n index = skipAssignments(words, afterOptions + launcher.operands);\n }\n return { program: undefined, packages };\n}\n","import { NPM_SPECIFIER_PREFIX } from \"./command-launchers.js\";\nimport type { ManualStep } from \"./migration-findings.js\";\nimport { GENERATOR_COMMAND, oldPackageInNodeModules, PACKAGE_RENAMES } from \"./package-names.js\";\nimport { argumentAssignments, holdsCommandLine } from \"./shell-assignments.js\";\nimport type { ShellCommand, ShellWord } from \"./shell-words.js\";\n\n/** The words of a command that name the original packages, apart from the roles they have. */\n\n/** A package name with an optional `npm:` prefix and `@version`. */\nexport function packageReference(value: string): { name: string; isPinned: boolean } {\n const bare = value.startsWith(NPM_SPECIFIER_PREFIX)\n ? value.slice(NPM_SPECIFIER_PREFIX.length)\n : value;\n const at = bare.indexOf(\"@\", 1);\n return { name: at === -1 ? bare : bare.slice(0, at), isPinned: at !== -1 };\n}\n\n/**\n * Whether a word names an original package: its name (`openapi-fetch`, `npm:x@1`), a file of it\n * in `node_modules`, or a path to the generator's binary (`$(npm bin)/openapi-typescript`).\n */\nfunction namesOldPackage(value: string): boolean {\n return (\n PACKAGE_RENAMES.has(packageReference(value).name) ||\n oldPackageInNodeModules(value) !== undefined ||\n value.endsWith(`/${GENERATOR_COMMAND}`)\n );\n}\n\n/** A manual step at an offset of the text. */\nexport interface WordStep {\n readonly offset: number;\n readonly manualStep: ManualStep;\n}\n\n/**\n * The values of the words that a command passes as variables (`make GEN=openapi-typescript`) and\n * that are not read as command lines (shell-assignments.ts), by word.\n */\nconst unreadArgumentValues = (words: ShellCommand): Map<ShellWord, string> =>\n new Map(\n argumentAssignments(words)\n .filter((assignment) => !holdsCommandLine(assignment))\n .map(({ word, value }) => [word, value]),\n );\n\n/**\n * The words that name an original package at offsets no finding renamed or reported: an argument\n * of a program the tool does not know (`chronic openapi-typescript`), a script name of `npm run`,\n * or the one-word value of a variable passed to a program (`make GEN=openapi-typescript`). The\n * tool cannot tell what runs them, so each is a manual step, never silence.\n */\nexport function unmigratedWordFindings(\n words: ShellCommand,\n handledOffsets: ReadonlySet<number>,\n locate: (offset: number) => string,\n): WordStep[] {\n const values = unreadArgumentValues(words);\n const namesOld = (word: ShellWord): boolean =>\n namesOldPackage(word.value) || namesOldPackage(values.get(word) ?? \"\");\n return words\n .filter((word) => !handledOffsets.has(word.start) && namesOld(word))\n .map((word) => ({\n offset: word.start,\n manualStep: { kind: \"old-name-in-command\", location: locate(word.start), word: word.value },\n }));\n}\n","import { commandRoles, withoutWindowsSuffix } from \"./command-roles.js\";\nimport { packageReference } from \"./old-package-words.js\";\nimport { GENERATOR_COMMAND } from \"./package-names.js\";\nimport type { ShellCommand, ShellWord } from \"./shell-words.js\";\nimport type { VariableProgram } from \"./variable-programs.js\";\n\n/**\n * What the commands of a file know about its variables, and which commands run the generator.\n * The command migration reads them; each file kind (a Makefile, a Dockerfile, a YAML `env`, the\n * assignments of a shell text) answers them from its own definitions (shell-variables.ts).\n */\n\nconst RECIPE_PREFIX_RE = /^[@+-]+(?=.)/;\n\n/**\n * The command with the recipe prefix taken off the value of its first word, so `@npx …` runs\n * `npx`. A shell command never starts with an option, so this changes nothing else.\n */\nexport function withoutRecipePrefix(words: ShellCommand): ShellCommand {\n const [first, ...rest] = words;\n if (first === undefined || !RECIPE_PREFIX_RE.test(first.value)) {\n return words;\n }\n return [{ ...first, value: first.value.replace(RECIPE_PREFIX_RE, \"\") }, ...rest];\n}\n\n/** A program word that expands one variable the file sets: as written, and what it runs. */\nexport interface VariableProgramUse {\n readonly written: string;\n readonly program: VariableProgram;\n}\n\n/** A whole word that expands one variable the file sets: as written, and the value it gets. */\nexport interface VariableReference {\n readonly written: string;\n readonly value: string;\n}\n\n/**\n * The variables of a file as its commands use them. A program word can run the generator through\n * a variable (`$(OAT)` in a Makefile with `OAT := openapi-typescript`): the variable's value is\n * migrated where it is set, the flags after it where it is used. An argument can expand a\n * variable that holds flags (`$(FLAGS)` with `FLAGS := -it`); the variable may serve other\n * commands too, so its old flags are reported, not changed.\n */\nexport interface FileVariables {\n /** What a program word runs through a variable, or undefined when it expands none. */\n programAt(program: ShellWord): VariableProgramUse | undefined;\n referenceAt(word: ShellWord): VariableReference | undefined;\n}\n\nexport const NO_VARIABLES: FileVariables = {\n programAt: () => undefined,\n referenceAt: () => undefined,\n};\n\n/**\n * Whether a command runs the generator by its old name, so a variable set to it holds the\n * generator command.\n */\nexport function runsGenerator(command: ShellCommand): boolean {\n const words = withoutRecipePrefix(command);\n const { program } = commandRoles(words);\n const word = program === undefined ? undefined : words[program];\n return (\n word !== undefined &&\n packageReference(withoutWindowsSuffix(word.value)).name === GENERATOR_COMMAND\n );\n}\n","import type { ShellWord } from \"./shell-word-parts.js\";\n\n/** The reserved words of the shell around a simple command (shell-words.ts reads commands). */\n\n/**\n * Reserved words (POSIX 2.4, and bash's `[[`) that open or close a compound command and are\n * followed by a command: `if a; then b; fi`, `while a; do b; done`, `! a`, `{ a; }`. They are\n * reserved only where a command name can stand, and only unquoted, so `echo then` and `\"if\"` stay\n * words. `time` is a launcher (domain/command-launchers.ts), as it takes options.\n */\nconst COMMAND_PREFIX_WORDS: ReadonlySet<string> = new Set([\n \"if\",\n \"then\",\n \"elif\",\n \"else\",\n \"fi\",\n \"while\",\n \"until\",\n \"do\",\n \"done\",\n \"!\",\n \"{\",\n \"}\",\n \"esac\",\n]);\n/**\n * Reserved words whose words up to the next separator are not a command: `for NAME in WORDS`,\n * `select NAME in WORDS`, `case WORD in`, and a `[[ … ]]` test.\n */\nconst CLAUSE_WORDS: ReadonlySet<string> = new Set([\"for\", \"select\", \"case\", \"[[\"]);\n/** `function NAME` (bash, ksh): the function's body, a compound command, follows the name. */\nconst FUNCTION_WORD = \"function\";\nconst FUNCTION_HEADER_LENGTH = 2;\n\nconst isReserved = (word: ShellWord | undefined, words: ReadonlySet<string>): boolean =>\n word !== undefined && word.raw === word.value && words.has(word.value);\n\n/** How many words at `index` are a reserved word or a function header, before a command. */\nfunction prefixLength(words: readonly ShellWord[], index: number): number {\n if (isReserved(words[index], COMMAND_PREFIX_WORDS)) {\n return 1;\n }\n const word = words[index];\n return word?.raw === FUNCTION_WORD ? FUNCTION_HEADER_LENGTH : 0;\n}\n\n/**\n * The simple command that a list of words between two separators holds, without the reserved\n * words in front of it: `then a b` is the command `a b`, and `for x in a b` is none.\n */\nexport function simpleCommand(words: readonly ShellWord[]): ShellWord[] {\n let first = 0;\n for (let length = prefixLength(words, 0); length > 0; length = prefixLength(words, first)) {\n first += length;\n }\n return isReserved(words[first], CLAUSE_WORDS) ? [] : words.slice(first);\n}\n","import { readWord } from \"./shell-word-parts.js\";\n\n/**\n * Here-documents (POSIX 2.7.4): the lines after a command line that are the input of a command.\n * Their body is data, so its quotes do not open a word (shell-words.ts reads the commands).\n */\n\n/** `<<WORD`, `<<'WORD'`, `<<-WORD`: a here-document (POSIX 2.7.4); `<<<` is a here-string. */\nconst HEREDOC_OPERATOR = \"<<\";\nconst HERE_STRING_OPERATOR = \"<<<\";\nconst STRIP_TABS = \"-\";\nconst LINE_BREAK = \"\\n\";\nconst LEADING_TABS_RE = /^\\t+/;\nconst CARRIAGE_RETURN_RE = /\\r$/;\n\n/** A here-document waiting for its body: the lines after the line of its operator. */\nexport interface PendingHeredoc {\n readonly delimiter: string;\n readonly isTabStripped: boolean;\n /** The index of the command whose input the body is. */\n readonly command: number;\n /** Spaces at the start of each line that the shell does not see (shellCommands). */\n readonly indent: number;\n}\n\n/** The body of a here-document, and the command whose input it is. */\nexport interface HeredocBody {\n readonly command: number;\n readonly start: number;\n readonly text: string;\n}\n\n/**\n * The here-document operator at `index` and where its delimiter word ends, or undefined. A\n * here-string operator gives no here-document, and ends where its `<<<` ends.\n */\nexport function heredocAt(\n text: string,\n index: number,\n where: { readonly command: number; readonly indent: number },\n): { pending?: PendingHeredoc; end: number } | undefined {\n if (text.startsWith(HERE_STRING_OPERATOR, index)) {\n return { end: index + HERE_STRING_OPERATOR.length };\n }\n if (!text.startsWith(HEREDOC_OPERATOR, index)) {\n return undefined;\n }\n let start = index + HEREDOC_OPERATOR.length;\n const isTabStripped = text[start] === STRIP_TABS;\n start += isTabStripped ? 1 : 0;\n while (text[start] === \" \" || text[start] === \"\\t\") {\n start++;\n }\n const word = readWord(text, start);\n // The quotes of the delimiter only turn off expansion in the body; its value ends the body.\n const pending: PendingHeredoc = { delimiter: word.value, isTabStripped, ...where };\n return word.value === \"\" ? undefined : { pending, end: word.end };\n}\n\n/** Whether the line from `lineStart` to `end` is the delimiter line of a here-document. */\nfunction isDelimiterLine(text: string, lineStart: number, end: number, heredoc: PendingHeredoc) {\n let first = lineStart;\n while (first < lineStart + heredoc.indent && text[first] === \" \") {\n first++;\n }\n const line = text.slice(first, end).replace(CARRIAGE_RETURN_RE, \"\");\n const compared = heredoc.isTabStripped ? line.replace(LEADING_TABS_RE, \"\") : line;\n return compared === heredoc.delimiter;\n}\n\n/** The body of one here-document from `start`, and where its delimiter line ends. */\nfunction readBody(text: string, start: number, heredoc: PendingHeredoc) {\n let lineStart = start;\n while (lineStart < text.length) {\n const lineEnd = text.indexOf(LINE_BREAK, lineStart);\n const end = lineEnd === -1 ? text.length : lineEnd;\n if (isDelimiterLine(text, lineStart, end, heredoc)) {\n const body = { command: heredoc.command, start, text: text.slice(start, lineStart) };\n return { body, end: Math.min(end + 1, text.length) };\n }\n lineStart = end + 1;\n }\n // No delimiter line: the body runs to the end of the text, as the shell reads it.\n return { body: { command: heredoc.command, start, text: text.slice(start) }, end: text.length };\n}\n\n/** The bodies of the pending here-documents from `start`, one after another, and their end. */\nexport function readBodies(text: string, start: number, pending: readonly PendingHeredoc[]) {\n const bodies: HeredocBody[] = [];\n let end = start;\n for (const heredoc of pending) {\n const read = readBody(text, end, heredoc);\n bodies.push(read.body);\n end = read.end;\n }\n return { bodies, end };\n}\n","import type { ShellCommand, ShellWord } from \"./shell-word-parts.js\";\n\n/**\n * Code given to an interpreter on the command line: `python3 -c '…'`, `node -e \"…\"`,\n * `ruby -e '…'`. The word after the option is code of that language, not a command line, so the\n * migration does not read it as commands; it reports the code when it names an old package.\n */\n\n/** The options whose next word is code, by interpreter. */\nconst CODE_OPTIONS: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [\"python\", new Set([\"-c\"])],\n [\"node\", new Set([\"-e\", \"--eval\", \"-p\", \"--print\"])],\n [\"bun\", new Set([\"-e\", \"--eval\", \"-p\", \"--print\"])],\n [\"ruby\", new Set([\"-e\"])],\n [\"perl\", new Set([\"-e\", \"-E\"])],\n]);\n/** A versioned Python program (`python3`, `python3.12`) and the Windows launcher `py`. */\nconst PYTHON_RE = /^(?:python[0-9.]*|py)$/;\nconst PYTHON = \"python\";\nconst PATH_SEPARATOR_RE = /[/\\\\]/;\nconst WINDOWS_EXECUTABLE_RE = /\\.exe$/i;\nconst OPTION_START = \"-\";\n\n/** The interpreter of a program word: `python` of `/usr/bin/python3.12`, `node` of `node.exe`. */\nfunction interpreterOf(word: ShellWord): string {\n const name = (word.value.split(PATH_SEPARATOR_RE).at(-1) ?? \"\").replace(\n WINDOWS_EXECUTABLE_RE,\n \"\",\n );\n return PYTHON_RE.test(name) ? PYTHON : name;\n}\n\n/** Inline code of a command: the word that holds it, and the program that runs it. */\nexport interface InlineCode {\n readonly code: ShellWord;\n readonly program: ShellWord;\n}\n\n/**\n * The code word after the options of the interpreter at `program`: the word after a code option\n * that comes before the first argument (`node -e '…'`, not `node a.js -e '…'`, where the option\n * goes to the script).\n */\nfunction codeAfter(command: ShellCommand, program: number): ShellWord | undefined {\n const options = CODE_OPTIONS.get(interpreterOf(command[program] as ShellWord));\n for (let index = program + 1; options !== undefined && index < command.length; index += 1) {\n const word = command[index] as ShellWord;\n if (!word.value.startsWith(OPTION_START)) {\n return undefined;\n }\n if (options.has(word.value)) {\n return command[index + 1];\n }\n }\n return undefined;\n}\n\n/**\n * The first inline code of a command. An interpreter is found at any word, since launchers run\n * one (`npx -p x node -e '…'`, `docker run python python3 -c '…'`), and `node` is a launcher too.\n */\nexport function inlineCode(command: ShellCommand): InlineCode | undefined {\n for (const [index, program] of command.entries()) {\n const code = codeAfter(command, index);\n if (code !== undefined) {\n return { code, program };\n }\n }\n return undefined;\n}\n","import { PARAMETER_OPEN, parameterExpansionEnd } from \"./shell-word-parts.js\";\n\n/**\n * The parameter expansions of a word that give a word of their own when the variable is unset or\n * empty (POSIX 2.6.2): `${GEN:-npx openapi-typescript}`, `${GEN:=…}`, and when it is set:\n * `${GEN:+…}`. That word is command text as written, the common \"overridable command\" idiom, so\n * it is read as a command line where it is written. The value is the variable's or that word,\n * which only the shell knows.\n */\n\n/** How an expansion uses its word: instead of an unset variable, as its value too, or if set. */\nexport type ExpansionUse = \"default\" | \"assign\" | \"alternative\";\n\n/** An expansion with a word: the variable, how it uses the word, the word and where it is. */\nexport interface WordExpansion {\n readonly name: string;\n readonly use: ExpansionUse;\n /** The word as written, between the operator and the closing brace. */\n readonly text: string;\n /** The offset of `text` in the text that was scanned. */\n readonly start: number;\n /** The offsets of the whole expansion, `${` to `}`. */\n readonly expansionStart: number;\n readonly expansionEnd: number;\n}\n\n/** `${NAME`, then an operator with a word: `-`, `=`, `+`, each also with `:` before it. */\nconst EXPANSION_HEAD_RE = /^\\$\\{([A-Za-z_][A-Za-z0-9_]*):?([-=+])/;\nconst USES: Readonly<Record<string, ExpansionUse>> = {\n \"-\": \"default\",\n \"=\": \"assign\",\n \"+\": \"alternative\",\n};\nconst SINGLE_QUOTE = \"'\";\nconst BACKSLASH = \"\\\\\";\n\n/** The expansion with a word at `start` of `text`, or undefined for any other expansion. */\nfunction expansionAt(text: string, start: number): WordExpansion | undefined {\n const head = EXPANSION_HEAD_RE.exec(text.slice(start));\n const end = head === null ? undefined : parameterExpansionEnd(text, start);\n if (head === null || end === undefined) {\n return undefined;\n }\n const wordStart = start + head[0].length;\n return {\n name: head[1] as string,\n use: USES[head[2] as string] as ExpansionUse,\n text: text.slice(wordStart, end - 1),\n start: wordStart,\n expansionStart: start,\n expansionEnd: end,\n };\n}\n\n/**\n * The expansions with a word in a word as written, outside single quotes (where `$` is a\n * character), in double quotes too. Nested ones are found when their word is read as commands.\n */\nexport function wordExpansions(raw: string): WordExpansion[] {\n const found: WordExpansion[] = [];\n for (let index = 0; index < raw.length; ) {\n const char = raw[index];\n if (char === SINGLE_QUOTE) {\n const close = raw.indexOf(SINGLE_QUOTE, index + 1);\n index = close === -1 ? raw.length : close + 1;\n } else if (char === BACKSLASH) {\n index += 2;\n } else if (raw.startsWith(PARAMETER_OPEN, index)) {\n const expansion = expansionAt(raw, index);\n found.push(...(expansion === undefined ? [] : [expansion]));\n index = expansion?.expansionEnd ?? index + PARAMETER_OPEN.length;\n } else {\n index += 1;\n }\n }\n return found;\n}\n\nconst DOUBLE_QUOTE = '\"';\n\n/** The expansion that is a whole word, also in double quotes: `${GEN:-…}`, `\"${GEN:-…}\"`. */\nexport function wholeWordExpansion(raw: string): WordExpansion | undefined {\n const isQuoted = raw.length > 1 && raw.startsWith(DOUBLE_QUOTE) && raw.endsWith(DOUBLE_QUOTE);\n const inner = isQuoted ? 1 : 0;\n const [expansion] = wordExpansions(raw);\n const isWhole =\n expansion?.expansionStart === inner && expansion.expansionEnd === raw.length - inner;\n return isWhole ? expansion : undefined;\n}\n","import { simpleCommand } from \"./compound-commands.js\";\nimport { type HeredocBody, heredocAt, type PendingHeredoc, readBodies } from \"./here-documents.js\";\nimport { inlineCode } from \"./inline-code.js\";\nimport { wordExpansions } from \"./parameter-expansions.js\";\nimport {\n argumentAssignments,\n assignmentValue,\n holdsCommandLine,\n type ShellAssignment,\n shellAssignments,\n} from \"./shell-assignments.js\";\nimport {\n COMMAND_SEPARATORS,\n isLineContinuation,\n readWord,\n type ShellCommand,\n type ShellWord,\n WORD_BREAKS,\n wordPart,\n} from \"./shell-word-parts.js\";\nimport { expressionLiterals } from \"./workflow-expressions.js\";\n\nexport type { ShellCommand, ShellWord } from \"./shell-word-parts.js\";\n\nconst COMMENT = \"#\";\nconst LINE_BREAK = \"\\n\";\n\n/**\n * Splits shell text (a package.json script, a line of a shell script, Makefile or CI step) into\n * simple commands, each a list of words with their offsets. It follows the POSIX shell rules that\n * decide where a word and a command end: quotes, backslash escapes, line continuations, comments\n * and the control operators. It does not expand anything, so it never runs or guesses a value.\n */\n\n/** Where the blank, continuation or comment at `index` ends, or `index` if there is none. */\nfunction skipTrivia(text: string, index: number): number {\n const char = text[index] as string;\n if (WORD_BREAKS.has(char)) {\n return index + 1;\n }\n if (isLineContinuation(text, index)) {\n return text.indexOf(\"\\n\", index) + 1;\n }\n if (char === COMMENT) {\n const lineEnd = text.indexOf(\"\\n\", index);\n return lineEnd === -1 ? text.length : lineEnd;\n }\n return index;\n}\n\n/**\n * The commands of a text without nested ones, the bodies of its here-documents, and the commands\n * whose output a pipe gives to the next one (`cat <<EOF | sh`).\n */\ninterface TopLevel {\n readonly commands: ShellWord[][];\n readonly heredocs: HeredocBody[];\n readonly pipes: ReadonlySet<number>;\n}\n\n/**\n * A pipe; the two `|` of `||` give an empty command between the two around them, which is no\n * command that a pipe gives a here-document.\n */\nconst PIPE = \"|\";\n\n/**\n * The commands of `text`, in order, without nested ones. The body of a here-document is input\n * data, not commands: a `'` in it (`Don't edit`) opened a quote to the end of the text, and\n * every command after it was lost.\n */\nfunction topLevelCommands(text: string, indent: number): TopLevel {\n const commands: ShellWord[][] = [[]];\n const heredocs: HeredocBody[] = [];\n const pipes = new Set<number>();\n let pending: PendingHeredoc[] = [];\n let index = 0;\n while (index < text.length) {\n const afterTrivia = skipTrivia(text, index);\n const heredoc = heredocAt(text, index, { command: commands.length - 1, indent });\n if (heredoc !== undefined) {\n pending.push(...(heredoc.pending === undefined ? [] : [heredoc.pending]));\n index = heredoc.end;\n } else if (afterTrivia !== index) {\n index = afterTrivia;\n } else if (text[index] === LINE_BREAK && pending.length > 0) {\n const read = readBodies(text, index + 1, pending);\n heredocs.push(...read.bodies);\n pending = [];\n commands.push([]);\n index = read.end;\n } else if (COMMAND_SEPARATORS.has(text[index] as string)) {\n if (text[index] === PIPE) {\n pipes.add(commands.length - 1);\n }\n commands.push([]);\n index++;\n } else {\n const word = readWord(text, index);\n commands.at(-1)?.push(word);\n index = word.end;\n }\n }\n return { commands, heredocs, pipes };\n}\n\nconst QUOTES: ReadonlySet<string> = new Set([\"'\", '\"']);\n/** A quoted word with more than one word in it may be a command (`sh -c \"…\"`, `concurrently`). */\nconst NESTED_COMMAND_RE = /[\\s;&|()`]/;\n\n/**\n * The text inside the quotes of a word that is one quoted string holding a command line. The\n * inner text is read as written, so its offsets map one to one onto the outer text.\n */\nfunction nestedCommandText(word: ShellWord): string | undefined {\n const quote = word.raw[0] as string;\n const isOneQuotedString =\n QUOTES.has(quote) &&\n word.raw.length > 1 &&\n word.raw.endsWith(quote) &&\n wordPart(word.raw, 0).end === word.raw.length;\n return isOneQuotedString && NESTED_COMMAND_RE.test(word.value)\n ? word.raw.slice(1, -1)\n : undefined;\n}\n\n/** Shells that run the script a here-document or a pipe gives them. */\nconst SHELLS: ReadonlySet<string> = new Set([\"sh\", \"bash\", \"dash\", \"ash\", \"zsh\", \"ksh\"]);\n/** Docker's `RUN <<EOF` runs the here-document, or gives it to the command after its options. */\nconst DOCKER_RUN = \"RUN\";\n/** A command that writes the here-document it reads as it is, so a pipe gives it on. */\nconst PASS_THROUGH = \"cat\";\nconst PATH_SEPARATOR = \"/\";\nconst OPTION_PREFIX = \"-\";\n\nconst programName = (command: ShellCommand): string =>\n command[0]?.value.split(PATH_SEPARATOR).at(-1) ?? \"\";\n\nconst isOption = (word: ShellWord): boolean => word.value.startsWith(OPTION_PREFIX);\n\n/** Whether a command is a shell with options only, which runs its input as a script. */\nconst isScriptShell = (command: ShellCommand): boolean =>\n SHELLS.has(programName(command)) && command.slice(1).every(isOption);\n\n/**\n * Whether a command runs the here-document it reads as a script: a shell with options only\n * (`bash -e <<EOF`), or `RUN` with options only or with such a shell after them (`RUN <<EOT\n * bash`). Any other command reads it as data (`cat`, `bash gen.sh`).\n */\nfunction readsScript(command: ShellCommand): boolean {\n if (programName(command) !== DOCKER_RUN) {\n return isScriptShell(command);\n }\n const after = command.slice(1);\n const shell = after.slice(after.findIndex((word) => !isOption(word)));\n return after.every(isOption) || isScriptShell(shell);\n}\n\n/** Whether a command writes its here-document unchanged, so the next command of a pipe reads it. */\nconst passesThrough = (command: ShellCommand): boolean =>\n programName(command) === PASS_THROUGH && command.slice(1).every(isOption);\n\n/**\n * The here-documents that the command at `index` runs as scripts: its own, when it reads them as\n * a script, and those of a `cat` whose output a pipe gives it, when it is a shell. Each is read\n * after the command that runs it, so the commands stay in the order of the text.\n */\nfunction scriptsRunBy(top: TopLevel, index: number, command: ShellCommand): HeredocBody[] {\n const previous = index - 1;\n const isPipedScript =\n top.pipes.has(previous) &&\n isScriptShell(command) &&\n passesThrough(simpleCommand(top.commands[previous] ?? []));\n return top.heredocs.filter(\n (body) =>\n (body.command === index && readsScript(command)) ||\n (body.command === previous && isPipedScript),\n );\n}\n\n/** Moves the offsets of words found in a part of a text to offsets in the whole text. */\nconst shifted = (words: readonly ShellWord[], offset: number): ShellWord[] =>\n words.map((word) => ({ ...word, start: word.start + offset, end: word.end + offset }));\n\n/** The commands of `text`, which starts at `offset` of a larger text, by offsets in that one. */\nexport function shellCommandsAt(text: string, offset: number, indent = 0): ShellCommand[] {\n return shellCommands(text, indent).map((words) => shifted(words, offset));\n}\n\n/**\n * The words of the parameter expansions of a word (`${GEN:-npx …}`) and the string literals of\n * its workflow expressions (`${{ inputs.gen || 'npx …' }}`), read as command lines. A literal\n * inside the word of an expansion (`${GEN:-${{ … }}}`) is found when that word is read, so each\n * one is read once.\n */\nfunction expansionCommands(word: ShellWord): ShellCommand[] {\n const expansions = wordExpansions(word.raw);\n const literals = expressionLiterals(word.raw).filter(({ start }) =>\n expansions.every((expansion) => start < expansion.start || start >= expansion.expansionEnd),\n );\n return [...expansions, ...literals].flatMap((part) =>\n shellCommandsAt(part.text, word.start + part.start),\n );\n}\n\n/**\n * The assignments of a command whose values are command lines: its own (`GEN=…`), and those\n * after its program that hold one (`cross-env GEN=\"npx openapi-typescript\" node gen.js`).\n */\nfunction commandLineAssignments(command: ShellCommand): Map<ShellWord, ShellAssignment> {\n const read = [\n ...shellAssignments(command),\n ...argumentAssignments(command).filter(holdsCommandLine),\n ];\n return new Map(read.map((assignment) => [assignment.word, assignment]));\n}\n\n/** The commands of an assignment's value, placed where their words are written. */\nfunction valueCommands(assignment: ShellAssignment): ShellCommand[] {\n const value = assignmentValue(assignment);\n return shellCommands(value.text).map((words) => words.map(value.place));\n}\n\n/**\n * The command lines inside the words of a command: a quoted word that holds one, the value of an\n * assignment (`GEN=\"npx openapi-typescript\"`), which runs where the variable is expanded, and\n * the word of a parameter expansion (`${GEN:-npx openapi-typescript}`). A text read as commands\n * is read once: its own expansions are found in it. The code of `python3 -c '…'` is no command\n * line.\n */\nfunction innerCommands(command: ShellCommand): ShellCommand[] {\n const assignments = commandLineAssignments(command);\n const code = inlineCode(command)?.code;\n return command.flatMap((word) => {\n const inner = word === code ? undefined : nestedCommandText(word);\n if (inner !== undefined) {\n return shellCommandsAt(inner, word.start + 1);\n }\n const assignment = assignments.get(word);\n return assignment === undefined ? expansionCommands(word) : valueCommands(assignment);\n });\n}\n\n/**\n * The commands of `text`, in order of their first word. A quoted word that holds a command line\n * is read as commands too, so `sh -c \"openapi-typescript a.yaml\"` and `concurrently \"…\"` count.\n * `indent` is the number of spaces at the start of each line that the shell does not see, such as\n * the indentation of a YAML block scalar: a here-document delimiter line may have them.\n */\nexport function shellCommands(text: string, indent = 0): ShellCommand[] {\n const top = topLevelCommands(text, indent);\n const commands: ShellCommand[] = [];\n for (const [index, words] of top.commands.entries()) {\n const command = simpleCommand(words);\n if (command.length > 0) {\n commands.push(command);\n }\n commands.push(...innerCommands(command));\n const scripts = scriptsRunBy(top, index, command);\n commands.push(...scripts.flatMap((body) => shellCommandsAt(body.text, body.start, indent)));\n }\n return commands;\n}\n","/** Compile-time proof that a switch over a closed union handled every variant. */\nexport function assertNever(value: never): never {\n throw new Error(`Unexpected variant: ${JSON.stringify(value)}`);\n}\n","/**\n * Which program a variable runs where a command starts with it (`$GEN …`, `$(GEN) …`). A file can\n * set one name in several places: two Dockerfile stages, a workflow and one of its steps, a\n * Makefile line and a later one that make reads before it runs any recipe. The tool does not\n * follow which definition reaches which command, so it changes the flags after a variable only\n * when every definition of the name runs the generator.\n */\n\nimport { assertNever } from \"./assert-never.js\";\n\n/**\n * `generator`: every definition runs the generator. `generator-or-other`: some definitions run it\n * and some run another program, so the flags after the variable are left to the user. `other`: no\n * definition runs it.\n */\nexport type VariableProgram = \"generator\" | \"generator-or-other\" | \"other\";\n\n/**\n * What one definition of a variable sets it to: a command (that runs the generator or not), a\n * reference to one variable (`GEN := $(OAT)`, `ENV GEN=$GEN`), no program of its own (an empty\n * value, or text appended to the value the variable has, `GEN += --flag`, which keeps its\n * program), or a value that only the run decides (a workflow expression, a make `?=` that the\n * environment can override, a value make computes), which can be the generator or another program.\n */\nexport type ProgramDefinition =\n | { readonly name: string; readonly kind: \"command\"; readonly runsGenerator: boolean }\n | { readonly name: string; readonly kind: \"reference\"; readonly target: string }\n | { readonly name: string; readonly kind: \"no-program\" }\n | { readonly name: string; readonly kind: \"run-time\" };\n\n/**\n * Where text appended to a variable's value (make `+=`, bash `+=`) is: at the start of the value,\n * when every earlier definition in the file is empty (`CMD =`, then `CMD += npx …`), so its own\n * program is the variable's; after a value the file sets, whose program it keeps; or after a\n * value from outside the file (the environment, an included file), when no earlier definition\n * sets the name.\n */\nexport type AppendedPlace = \"start\" | \"after-value\" | \"after-outside\";\n\n/** Where appended text is, from the values that earlier definitions of its name set. */\nexport function appendedPlace(earlierValues: readonly string[]): AppendedPlace {\n if (earlierValues.length === 0) {\n return \"after-outside\";\n }\n return earlierValues.every((value) => value.trim() === \"\") ? \"start\" : \"after-value\";\n}\n\n/** Whether a definition can run the generator, given the names found to run it so far. */\nfunction canRunGenerator(definition: ProgramDefinition, generators: ReadonlySet<string>): boolean {\n switch (definition.kind) {\n case \"command\":\n return definition.runsGenerator;\n case \"reference\":\n return generators.has(definition.target);\n case \"no-program\":\n return false;\n case \"run-time\":\n return true;\n default:\n return assertNever(definition);\n }\n}\n\n/**\n * Whether a definition can run another program. A reference to a variable the file never sets\n * gets its value from elsewhere (the environment, a base image), so it can run anything.\n */\nfunction canRunOther(\n definition: ProgramDefinition,\n others: ReadonlySet<string>,\n defined: ReadonlySet<string>,\n): boolean {\n switch (definition.kind) {\n case \"command\":\n return !definition.runsGenerator;\n case \"reference\":\n return others.has(definition.target) || !defined.has(definition.target);\n case \"no-program\":\n return false;\n case \"run-time\":\n return true;\n default:\n return assertNever(definition);\n }\n}\n\n/**\n * The program each defined variable runs. References are followed however long the chain, so\n * `GEN := $(OAT)` runs what `OAT` runs; a cycle adds nothing.\n */\nexport function variablePrograms(\n definitions: readonly ProgramDefinition[],\n): ReadonlyMap<string, VariableProgram> {\n const defined = new Set(definitions.map((definition) => definition.name));\n const generators = new Set<string>();\n const others = new Set<string>();\n for (let size = -1; size !== generators.size + others.size; ) {\n size = generators.size + others.size;\n for (const definition of definitions) {\n if (canRunGenerator(definition, generators)) {\n generators.add(definition.name);\n }\n if (canRunOther(definition, others, defined)) {\n others.add(definition.name);\n }\n }\n }\n const programOf = (name: string): VariableProgram => {\n if (!generators.has(name)) {\n return \"other\";\n }\n return others.has(name) ? \"generator-or-other\" : \"generator\";\n };\n return new Map([...defined].map((name) => [name, programOf(name)]));\n}\n","import type { AppendedValue } from \"./argument-findings.js\";\nimport { type FileVariables, runsGenerator, type VariableProgramUse } from \"./file-variables.js\";\nimport { assignmentValue, type ShellAssignment, shellAssignments } from \"./shell-assignments.js\";\nimport { type ShellCommand, shellCommands } from \"./shell-words.js\";\nimport { type AppendedPlace, appendedPlace } from \"./variable-programs.js\";\n\n/**\n * The `NAME+=value` assignments of a shell text (bash, ksh, zsh). A value appended after the value\n * a variable has (`G=\"npx openapi-typescript\"`, then `G+=\" -it\"`) holds arguments of the program\n * that value runs, so `$G c.yaml` runs the generator with `-it`: the appended words are read as\n * the arguments after `$G`, not as a command of their own.\n */\n\n/** An assignment, and for one that appends, where its text is in the variable's value. */\nexport interface PlacedAssignment {\n readonly assignment: ShellAssignment;\n readonly place: AppendedPlace | undefined;\n}\n\n/** The assignments of the commands in the order of the text, each with its place. */\nexport function placedAssignments(commands: readonly ShellCommand[]): PlacedAssignment[] {\n const all = commands.flatMap(shellAssignments).sort((left, right) => {\n return left.word.start - right.word.start;\n });\n return all.map((assignment, index) => {\n if (!assignment.isAppend) {\n return { assignment, place: undefined };\n }\n const earlier = all.slice(0, index).filter((found) => found.name === assignment.name);\n return { assignment, place: appendedPlace(earlier.map((found) => found.value)) };\n });\n}\n\n/** Whether appended text comes after a value, so its words are arguments of that value. */\nexport const isAfterValue = ({ place }: PlacedAssignment): boolean =>\n place === \"after-value\" || place === \"after-outside\";\n\n/** One appended value, and the command that the text reads where it is written, if any. */\ninterface ShellAppend {\n readonly value: AppendedValue;\n readonly command: ShellCommand | undefined;\n}\n\n/**\n * The appended text of an assignment, its words placed where they are written, also in a value\n * of several parts (`G+=\" -it \"$X`), whose characters each have their place in the text.\n */\nfunction shellAppend(assignment: ShellAssignment, variables: FileVariables): ShellAppend {\n const at = assignment.word.start;\n const written = `$${assignment.name}`;\n const found = variables.programAt({ raw: written, value: written, start: at, end: at });\n const program: VariableProgramUse = found ?? { written, program: \"generator-or-other\" };\n const [command] = appendedText(assignment);\n return { value: { words: command ?? [], program }, command };\n}\n\n/** The commands without those that appended text reads, and the appended values. */\nexport interface ShellAppends {\n readonly commands: readonly ShellCommand[];\n readonly appended: readonly AppendedValue[];\n}\n\n/**\n * Whether text appended after a value from outside the file is a command of its own: one that\n * runs the generator itself (`H+=\"npx openapi-typescript\"`, make's `GEN += npx …`). What comes\n * before it is then empty or a prefix (a launcher, `time`) of that command, so the generator in\n * it is migrated where it is written. Any other text holds arguments of a program the tool does\n * not know, whose old flags are reported.\n */\nexport const isOwnGeneratorCommand = (\n place: AppendedPlace | undefined,\n command: ShellCommand | undefined,\n): boolean => place === \"after-outside\" && command !== undefined && runsGenerator(command);\n\n/** The commands that the appended text of an assignment holds, placed where they are written. */\nfunction appendedText(assignment: ShellAssignment): ShellCommand[] {\n const value = assignmentValue(assignment);\n return shellCommands(value.text).map((words) => words.map(value.place));\n}\n\n/** The appended values of a shell text, read as the arguments after their variables. */\nexport function shellAppends(\n commands: readonly ShellCommand[],\n variables: FileVariables,\n): ShellAppends {\n const appends = placedAssignments(commands)\n .filter(isAfterValue)\n .filter(({ assignment, place }) => !isOwnGeneratorCommand(place, appendedText(assignment)[0]))\n .map(({ assignment }) => shellAppend(assignment, variables));\n const taken = new Set(appends.flatMap(({ command }) => (command === undefined ? [] : [command])));\n const isTaken = (command: ShellCommand): boolean =>\n [...taken].some(\n (found) => found.length === command.length && found[0]?.start === command[0]?.start,\n );\n return {\n commands: commands.filter((command) => !isTaken(command)),\n appended: appends.map(({ value }) => value),\n };\n}\n","import type { FileVariables, VariableProgramUse } from \"./file-variables.js\";\nimport type { Change, ManualStep } from \"./migration-findings.js\";\nimport { unmigratedWordFindings } from \"./old-package-words.js\";\nimport { FLAG_RENAMES } from \"./package-names.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport type { TextEdit } from \"./text-edits.js\";\n\n/**\n * The findings of the words that a program gets as arguments: renamed flags of the generator, old\n * flags in a variable they expand, and one step for the flags after a program that may be the\n * generator or another one. Text appended to a variable's value is such words too.\n */\n\n/** Names the place of an offset for the report: a script name, or `file:line`. */\nexport type Locate = (offset: number) => string;\n\n/** What the migration found at one offset of the text. */\nexport interface Finding {\n readonly offset: number;\n readonly edit?: TextEdit;\n readonly change?: Change;\n readonly manualStep?: ManualStep;\n}\n\n/** A renamed flag of the generator, alone (`-it`) or with its value (`--redoc=r.yaml`). */\nfunction flagFindings(word: ShellWord, locate: Locate): Finding[] {\n const flag = word.raw.split(\"=\", 1)[0] as string;\n const to = FLAG_RENAMES.get(flag);\n if (to === undefined) {\n return [];\n }\n const offset = word.start;\n const edit: TextEdit = { start: offset, end: offset + flag.length, text: to };\n return [\n { offset, edit, change: { kind: \"flag-renamed\", location: locate(offset), from: flag, to } },\n ];\n}\n\n/** The flags of a variable's value that the generator renamed, each once. */\nfunction renamedFlags(value: string): string[] {\n const flags = shellCommands(value)\n .flat()\n .map((word) => word.raw.split(\"=\", 1)[0] as string);\n return [...new Set(flags.filter((flag) => FLAG_RENAMES.has(flag)))];\n}\n\n/** The findings of one argument of the generator: a renamed flag, or a variable that holds one. */\nfunction argumentFindings(word: ShellWord, locate: Locate, variables: FileVariables): Finding[] {\n const reference = variables.referenceAt(word);\n if (reference === undefined) {\n return flagFindings(word, locate);\n }\n const flags = renamedFlags(reference.value);\n if (flags.length === 0) {\n return [];\n }\n const manualStep: ManualStep = {\n kind: \"flags-in-variable\",\n location: locate(word.start),\n variable: reference.written,\n flags,\n };\n return [{ offset: word.start, manualStep }];\n}\n\n/** The old flags that findings rename, or report in a variable's value. */\nconst oldFlagsOf = (findings: readonly Finding[]): string[] =>\n findings.flatMap(({ change, manualStep }) => {\n if (change?.kind === \"flag-renamed\") {\n return [change.from];\n }\n return manualStep?.kind === \"flags-in-variable\" ? [...manualStep.flags] : [];\n });\n\n/** Where the program of some arguments is: the offset its one step names. */\nexport interface ProgramPlace {\n readonly offset: number;\n readonly use: VariableProgramUse | undefined;\n}\n\n/**\n * The findings of the arguments that a program gets. After a program that may be the generator\n * or another one (some definitions of its variable, a default, a value set where the tool does not\n * read) they are one step at the program's place that names the old flags, since the tool cannot\n * tell which program runs there.\n */\nexport function programArgumentFindings(\n words: ShellCommand,\n { offset, use }: ProgramPlace,\n locate: Locate,\n variables: FileVariables,\n): Finding[] {\n const found = words.flatMap((word) => argumentFindings(word, locate, variables));\n if (use?.program !== \"generator-or-other\") {\n return found;\n }\n const flags = [...new Set(oldFlagsOf(found))];\n if (flags.length === 0) {\n return [];\n }\n const location = locate(offset);\n const manualStep: ManualStep = {\n kind: \"variable-not-only-generator\",\n location,\n variable: use.written,\n flags,\n };\n return [{ offset, manualStep }];\n}\n\n/**\n * Text appended to the value of a variable (`GEN += -it`, `G+=\" -it\"`, `\"npx …\" + \" -it\"`): its\n * words are arguments of the program that the value runs before them, so their old flags are\n * renamed where they are written when that program is the generator, and reported when it may be\n * another one.\n */\nexport interface AppendedValue {\n readonly words: ShellCommand;\n readonly program: VariableProgramUse;\n}\n\n/** The findings of appended text, and of the words in it that name an old package otherwise. */\nexport function appendedValueFindings(\n { words, program }: AppendedValue,\n locate: Locate,\n variables: FileVariables,\n): Finding[] {\n const place: ProgramPlace = { offset: words[0]?.start ?? 0, use: program };\n const found =\n program.program === \"other\" ? [] : programArgumentFindings(words, place, locate, variables);\n const handled = new Set(found.map((finding) => finding.offset));\n return [...found, ...unmigratedWordFindings(words, handled, locate)];\n}\n","import { windowsSuffix } from \"./command-roles.js\";\nimport type { ShellWord } from \"./shell-words.js\";\n\n/**\n * A program word as a path, and its Windows suffix (`.cmd`), or \"\" for none. `written` is the\n * path as the report names it: a Windows path with its `\\`, any other the word's value.\n */\nexport interface ProgramPath {\n readonly path: string;\n readonly suffix: string;\n readonly written: string;\n}\n\nconst PATH_SEPARATOR = \"/\";\nconst WINDOWS_SEPARATOR_RE = /\\\\/g;\nconst QUOTE_RE = /[\"']/g;\n/**\n * A `\\` between two path segments and no `/` (`node_modules\\.bin\\openapi-typescript`): a path\n * of cmd.exe, which finds the `.cmd` of a bin by itself. A POSIX shell would read each `\\` as an\n * escape and run a program that does not exist. A `\\` at the start of a word\n * (`\\openapi-typescript`, which skips an alias) or before a blank escapes a character, as the\n * shell reads it.\n */\nconst WINDOWS_PATH_RE = /^[^/]*[^\\\\/\\s]\\\\[^\\\\/\\s][^/]*$/;\n\n/**\n * The path of a program word. A program with a Windows suffix runs in cmd.exe or PowerShell,\n * where `\\` separates folders instead of escaping the next character, so its path is the word\n * as written, with `/` for each `\\` (`node_modules\\.bin\\openapi-typescript.cmd`); so is a word\n * written as a Windows path without a suffix.\n */\nexport function programPath(word: ShellWord): ProgramPath {\n const suffix = windowsSuffix(word.value);\n const written = word.raw.replace(QUOTE_RE, \"\");\n const isWindowsPath = suffix !== \"\" || WINDOWS_PATH_RE.test(written);\n if (!isWindowsPath) {\n return { path: word.value, suffix, written: word.value };\n }\n return { path: written.replace(WINDOWS_SEPARATOR_RE, PATH_SEPARATOR), suffix, written };\n}\n","import { isAfterValue, placedAssignments } from \"./appended-assignments.js\";\nimport { commandRoles } from \"./command-roles.js\";\nimport { type FileVariables, runsGenerator, type VariableProgramUse } from \"./file-variables.js\";\nimport { type WordExpansion, wholeWordExpansion, wordExpansions } from \"./parameter-expansions.js\";\nimport { isArrayAssignment } from \"./shell-assignments.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport {\n type ProgramDefinition,\n type VariableProgram,\n variablePrograms,\n} from \"./variable-programs.js\";\nimport { isWholeExpression } from \"./workflow-expressions.js\";\n\n/**\n * A shell variable as a file sets it: its name and its value, read as shell text. An appended\n * value (`G+=\" -it\"`) sets no program of its own: the variable keeps the one it has.\n */\nexport interface VariableDefinition {\n readonly name: string;\n readonly value: string;\n readonly isAppended?: boolean;\n}\n\n/** A whole word that expands one shell variable: `$NAME`, `${NAME}`, also in double quotes. */\nconst SHELL_VARIABLE_RE = /^\"?\\$(?:([A-Za-z_][A-Za-z0-9_]*)|\\{([A-Za-z_][A-Za-z0-9_]*)\\})\"?$/;\n\n/** The variable that `text` expands as a whole, or undefined. */\nfunction expandedName(text: string): string | undefined {\n const match = SHELL_VARIABLE_RE.exec(text);\n return match === null ? undefined : (match[1] ?? match[2]);\n}\n\n/**\n * Whether a command's program is a workflow expression (`${{ vars.GEN || 'npx …' }} a.yaml`):\n * the run puts its value there, so it may be the generator or another program.\n */\nfunction runsExpression(command: ShellCommand): boolean {\n const { program } = commandRoles(command);\n const word = program === undefined ? undefined : command[program];\n return word !== undefined && isWholeExpression(word.raw);\n}\n\n/**\n * What a text sets a variable to: a reference to one variable, a command, or a value that the\n * run decides, when a program of it is a workflow expression. The literals of the expression\n * are commands of the text too, so they must not make it the generator alone.\n */\nfunction textDefinition(name: string, text: string): ProgramDefinition {\n const target = expandedName(text.trim());\n if (target !== undefined) {\n return { name, kind: \"reference\", target };\n }\n const commands = shellCommands(text);\n return commands.some(runsExpression)\n ? { name, kind: \"run-time\" }\n : { name, kind: \"command\", runsGenerator: commands.some(runsGenerator) };\n}\n\n/**\n * What a value that is one expansion with a word (`GEN=\"${GEN:-npx openapi-typescript}\"`) can\n * set: the word, or the variable's own value. The variable's value before the assignment, and\n * the value of an alternative's unset variable, come from outside the text: another program.\n */\nfunction expansionDefinitions(name: string, expansion: WordExpansion): ProgramDefinition[] {\n const word = textDefinition(name, expansion.text);\n const isOutside = expansion.use === \"alternative\" || expansion.name === name;\n const variable: ProgramDefinition = isOutside\n ? { name, kind: \"command\", runsGenerator: false }\n : { name, kind: \"reference\", target: expansion.name };\n return [word, variable];\n}\n\n/** A definition as the programs it can set: references to variables, or commands. */\nfunction programDefinitions({ name, value, isAppended }: VariableDefinition): ProgramDefinition[] {\n if (isAppended === true) {\n return [{ name, kind: \"no-program\" }];\n }\n const expansion = wholeWordExpansion(value.trim());\n return expansion === undefined\n ? [textDefinition(name, value)]\n : expansionDefinitions(name, expansion);\n}\n\n/**\n * The variables that a file's shell commands expand: `$GEN` runs the generator when every\n * definition of `GEN` in the file sets it to the generator (see variable-programs.ts). The\n * values of one name are read as one (a workflow, a job and a step `env`), since any of them can\n * reach a command.\n */\nexport function shellVariables(definitions: readonly VariableDefinition[]): FileVariables {\n const values = new Map<string, string>();\n for (const { name, value } of definitions) {\n values.set(name, [values.get(name), value].filter((part) => part !== undefined).join(\" \"));\n }\n const programs = variablePrograms(definitions.flatMap(programDefinitions));\n // A word that expands no variable has no name, so no definition (not even of \"\") matches it.\n const nameAt = (word: ShellWord): string | undefined => expandedName(word.raw);\n return {\n programAt: (program) => {\n const name = nameAt(program);\n const found = name === undefined ? undefined : programs.get(name);\n return found === undefined ? undefined : { written: program.raw, program: found };\n },\n referenceAt: (word) => {\n const name = nameAt(word);\n const value = name === undefined ? undefined : values.get(name);\n return value === undefined ? undefined : { written: word.raw, value };\n },\n };\n}\n\n/** What two answers for one program word say together: one program, or not only the generator. */\nfunction combinedUse(\n left: VariableProgramUse | undefined,\n right: VariableProgramUse | undefined,\n): VariableProgramUse | undefined {\n if (left === undefined || right === undefined) {\n return left ?? right;\n }\n return left.program === right.program ? left : { ...left, program: \"generator-or-other\" };\n}\n\n/**\n * The variables that `${NAME:=word}` and `${NAME=word}` set: the word when the variable is unset,\n * else the value it had, which comes from outside the text.\n */\nfunction assignedByExpansions(commands: readonly ShellCommand[]): VariableDefinition[] {\n return commands\n .flat()\n .flatMap((word) => wordExpansions(word.raw))\n .filter((expansion) => expansion.use === \"assign\")\n .flatMap(({ name, text }) => [\n { name, value: text },\n { name, value: \"\" },\n ]);\n}\n\n/**\n * The variables of a file (a workflow `env`, a Makefile) and those that its shell commands set\n * themselves (`GEN=\"npx openapi-typescript\"; $GEN a.yaml -it`), read as one: a name both set\n * runs the generator only when both say so, as for the definitions of one file.\n */\nexport function withShellAssignments(\n commands: readonly ShellCommand[],\n file: FileVariables,\n): FileVariables {\n const assigned = placedAssignments(commands).flatMap((placed): VariableDefinition[] => {\n const { assignment, place } = placed;\n // A value appended to one from outside the text says nothing of the program: the file's\n // variables or the environment give it.\n if (isArrayAssignment(assignment) || place === \"after-outside\") {\n return [];\n }\n return [{ name: assignment.name, value: assignment.value, isAppended: isAfterValue(placed) }];\n });\n const definitions = [...assigned, ...assignedByExpansions(commands)];\n if (definitions.length === 0) {\n return file;\n }\n const own = shellVariables(definitions);\n return {\n programAt: (program) => combinedUse(own.programAt(program), file.programAt(program)),\n referenceAt: (word) => own.referenceAt(word) ?? file.referenceAt(word),\n };\n}\n\n/** Two programs as one: the same, or not only the generator when they differ. */\nconst joinedProgram = (left: VariableProgram, right: VariableProgram): VariableProgram =>\n left === right ? left : \"generator-or-other\";\n\n/**\n * What the word of an expansion runs as a command line: a workflow expression in it\n * (`${GEN:-${{ inputs.gen }}}`) is a value that the run decides, so it may be either.\n */\nfunction wordProgram(text: string): VariableProgram {\n const commands = shellCommands(text);\n if (commands.some(runsExpression)) {\n return \"generator-or-other\";\n }\n return commands.some(runsGenerator) ? \"generator\" : \"other\";\n}\n\n/**\n * What a program word that is one expansion with a word runs (`npx ${GEN:-openapi-typescript}`,\n * `\"${GEN:-npx openapi-typescript}\" a.yaml`): its word, or the variable's value, which the\n * variables of the text know or which comes from outside it. A variable that no definition the\n * tool reads sets may run the generator, as an unread `$GEN` may.\n */\nfunction expansionUse(word: ShellWord, variables: FileVariables): VariableProgramUse | undefined {\n const expansion = wholeWordExpansion(word.raw);\n if (expansion === undefined) {\n return undefined;\n }\n const programOf = (name: string): VariableProgram =>\n variables.programAt({ ...word, raw: `$${name}` })?.program ?? \"generator-or-other\";\n const target = expandedName(expansion.text.trim());\n const own = target === undefined ? wordProgram(expansion.text) : programOf(target);\n // An alternative gives its word only when the variable is set, and nothing else.\n const variable = expansion.use === \"alternative\" ? \"other\" : programOf(expansion.name);\n return { written: word.raw, program: joinedProgram(own, variable) };\n}\n\n/** The variables with the program words that are expansions with a word. */\nexport function withWordExpansions(variables: FileVariables): FileVariables {\n return {\n programAt: (program) => variables.programAt(program) ?? expansionUse(program, variables),\n referenceAt: (word) => variables.referenceAt(word),\n };\n}\n\n/**\n * A program word that expands one shell variable as a whole: `$GEN`, `${GEN}`, a bash array\n * `\"${GEN[@]}\"`, and in a Makefile recipe `$$GEN`.\n */\nconst VARIABLE_NAME = \"[A-Za-z_][A-Za-z0-9_]*\";\nconst VARIABLE_WORD_RE = new RegExp(\n `^\"?\\\\$\\\\$?(?:${VARIABLE_NAME}|\\\\{${VARIABLE_NAME}(?:\\\\[[^\\\\]]*\\\\])?\\\\})\"?$`,\n);\n\n/**\n * The variables with the program words that expand a variable no definition the tool reads sets:\n * one set by another `script` item, through `$GITHUB_ENV`, by a recipe line, as an array or\n * outside the file, and a workflow expression (`${{ inputs.gen }}`), whose value the run gives.\n * It may run the generator, so the old flags after it are reported, not kept without a word.\n */\nexport function withUnreadVariables(variables: FileVariables): FileVariables {\n return {\n programAt: (program) =>\n variables.programAt(program) ??\n (VARIABLE_WORD_RE.test(program.raw) || isWholeExpression(program.raw)\n ? { written: program.raw, program: \"generator-or-other\" }\n : undefined),\n referenceAt: (word) => variables.referenceAt(word),\n };\n}\n","import { shellAppends } from \"./appended-assignments.js\";\nimport {\n type AppendedValue,\n appendedValueFindings,\n type Finding,\n type Locate,\n programArgumentFindings,\n} from \"./argument-findings.js\";\nimport { commandRoles, type PackageWord } from \"./command-roles.js\";\nimport { type FileVariables, NO_VARIABLES, withoutRecipePrefix } from \"./file-variables.js\";\nimport { type InlineCode, inlineCode } from \"./inline-code.js\";\nimport { type Change, lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { packageReference, unmigratedWordFindings } from \"./old-package-words.js\";\nimport {\n GENERATOR_COMMAND,\n MIGRATED_GENERATOR_COMMAND,\n namesOriginalPackage,\n PACKAGE_RENAMES,\n} from \"./package-names.js\";\nimport { type ProgramPath, programPath } from \"./program-paths.js\";\nimport {\n withShellAssignments,\n withUnreadVariables,\n withWordExpansions,\n} from \"./shell-variables.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\n\nexport type { AppendedValue, Locate } from \"./argument-findings.js\";\n\n/** One command line or script after the migration. */\nexport interface CommandMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\nconst QUOTES: ReadonlySet<string> = new Set([\"'\", '\"']);\nconst PATH_SEPARATOR = \"/\";\nconst BIN_FOLDER = \"/.bin/\";\nconst OLD_PACKAGE_FOLDER = `node_modules/${GENERATOR_COMMAND}/`;\n\n/**\n * The edit that renames `name` at the end of a word (`x`, `\"x\"`, `npm:x`, `.bin/x`), before the\n * Windows `suffix` of a program (`x.cmd`), or undefined when the word is quoted in a way that\n * does not keep `name` in one piece.\n */\nfunction renameAtEnd(word: ShellWord, name: string, to: string, suffix = \"\"): TextEdit | undefined {\n const at = word.raw.lastIndexOf(name);\n const tail = word.raw.slice(at + name.length);\n // The suffix is taken from the word's value, which ends with it, so the tail starts with it.\n const quote = tail.slice(suffix.length);\n if (at === -1 || (quote !== \"\" && !QUOTES.has(quote))) {\n return undefined;\n }\n return { start: word.start + at, end: word.start + at + name.length, text: to };\n}\n\n/** A word of an install command or a `--package` option that names an original package. */\nfunction packageFindings(found: PackageWord, locate: Locate): Finding[] {\n const { name, isPinned } = packageReference(found.value);\n const to = PACKAGE_RENAMES.get(name);\n const offset = found.word.start;\n if (to === undefined) {\n return [];\n }\n const location = locate(offset);\n if (isPinned) {\n return [{ offset, manualStep: { kind: \"pinned-package\", location, name } }];\n }\n const edit = renameAtEnd(found.word, name, to);\n const change: Change = { kind: \"package-name-renamed\", location, from: name, to };\n return edit === undefined ? [] : [{ offset, edit, change }];\n}\n\n/**\n * The program given by a path: `node_modules/.bin/openapi-typescript` is renamed, a file of the\n * package or a generator installed elsewhere (`/usr/local/bin/openapi-typescript`,\n * `C:\\tools\\openapi-typescript.cmd`) is reported: the new one may not be there.\n */\nfunction programPathFindings(word: ShellWord, program: ProgramPath, location: string): Finding[] {\n const { path, suffix, written } = program;\n const offset = word.start;\n if (path.includes(OLD_PACKAGE_FOLDER)) {\n return [{ offset, manualStep: { kind: \"old-package-file\", location, path } }];\n }\n if (!path.endsWith(`${BIN_FOLDER}${GENERATOR_COMMAND}${suffix}`)) {\n const manualStep: ManualStep = { kind: \"old-name-in-command\", location, word: written };\n const isGenerator = path.endsWith(`${PATH_SEPARATOR}${GENERATOR_COMMAND}${suffix}`);\n return isGenerator ? [{ offset, manualStep }] : [];\n }\n const edit = renameAtEnd(word, GENERATOR_COMMAND, MIGRATED_GENERATOR_COMMAND, suffix);\n return edit === undefined\n ? []\n : [{ offset, edit, change: { kind: \"command-renamed\", location } }];\n}\n\n/** The findings for the program word of a command; renamed tells whether flags follow. */\nfunction programFindings(word: ShellWord, location: string): Finding[] {\n const program = programPath(word);\n if (program.path.includes(PATH_SEPARATOR)) {\n return programPathFindings(word, program, location);\n }\n const { path, suffix } = program;\n const { name, isPinned } = packageReference(path.slice(0, path.length - suffix.length));\n if (name !== GENERATOR_COMMAND) {\n return [];\n }\n if (isPinned) {\n return [{ offset: word.start, manualStep: { kind: \"versioned-command\", location } }];\n }\n const edit = renameAtEnd(word, GENERATOR_COMMAND, MIGRATED_GENERATOR_COMMAND, suffix);\n const change: Change = { kind: \"command-renamed\", location };\n return edit === undefined ? [] : [{ offset: word.start, edit, change }];\n}\n\nfunction commandFindings(\n command: ShellCommand,\n locate: Locate,\n variables: FileVariables,\n): Finding[] {\n const words = withoutRecipePrefix(command);\n const found = knownFindings(words, locate, variables);\n const handled = new Set(found.map((finding) => finding.offset));\n return [...found, ...unmigratedWordFindings(words, handled, locate)];\n}\n\n/** Inline code (`python3 -c '…'`) that names an old package: code the tool does not read. */\nfunction inlineCodeFindings({ code, program }: InlineCode, locate: Locate): Finding[] {\n if (!namesOriginalPackage(code.value)) {\n return [];\n }\n const location = locate(code.start);\n const manualStep: ManualStep = { kind: \"script-not-shell\", location, shell: program.value };\n return [{ offset: code.start, manualStep }];\n}\n\n/** The findings of the packages, the program and its flags in the roles the tool knows. */\nfunction knownFindings(words: ShellCommand, locate: Locate, variables: FileVariables): Finding[] {\n const roles = commandRoles(words);\n const findings = roles.packages.flatMap((found) => packageFindings(found, locate));\n const program = roles.program === undefined ? undefined : (words[roles.program] as ShellWord);\n if (program === undefined) {\n return findings;\n }\n const code = inlineCode(words);\n if (code !== undefined) {\n return [...findings, ...inlineCodeFindings(code, locate)];\n }\n const found = programFindings(program, locate(program.start));\n findings.push(...found);\n // Only a renamed command is ours to change; a pinned one still runs the old package.\n const isRenamed = found.some((finding) => finding.change?.kind === \"command-renamed\");\n const variable = variables.programAt(program);\n if (!isRenamed && (variable === undefined || variable.program === \"other\")) {\n return findings;\n }\n const flags = words.slice((roles.program as number) + 1);\n const place = { offset: program.start, use: variable };\n findings.push(...programArgumentFindings(flags, place, locate, variables));\n return findings;\n}\n\n/** The findings of a shell text as edits, without applying them. */\nexport interface ShellTextFindings {\n readonly edits: readonly TextEdit[];\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** Find what to migrate in every command of a shell text; `locate` names each place. */\nexport function shellTextFindings(text: string, locate: Locate): ShellTextFindings {\n return commandWordFindings(shellCommands(text), locate);\n}\n\n/**\n * Find what to migrate in commands already split into words, as an exec-form list is. Text that\n * the file appends to a variable's value (`GEN += -it` of a Makefile) is read after the program\n * of that value, as is the text that a shell text appends itself (`G+=\" -it\"`).\n */\nexport function commandWordFindings(\n commands: readonly ShellCommand[],\n locate: Locate,\n variables: FileVariables = NO_VARIABLES,\n appended: readonly AppendedValue[] = [],\n): ShellTextFindings {\n const known = withUnreadVariables(withWordExpansions(withShellAssignments(commands, variables)));\n const shell = shellAppends(commands, known);\n return textFindings([\n ...shell.commands.flatMap((words) => commandFindings(words, locate, known)),\n ...[...appended, ...shell.appended].flatMap((value) =>\n appendedValueFindings(value, locate, known),\n ),\n ]);\n}\n\n/** Findings as the edits, changes and steps of a text, in the order of their offsets. */\nexport function textFindings(found: readonly Finding[]): ShellTextFindings {\n const findings = [...found].sort((left, right) => left.offset - right.offset);\n return {\n edits: findings.flatMap((finding) => (finding.edit === undefined ? [] : [finding.edit])),\n changes: findings.flatMap((finding) => (finding.change === undefined ? [] : [finding.change])),\n manualSteps: findings.flatMap((finding) =>\n finding.manualStep === undefined ? [] : [finding.manualStep],\n ),\n };\n}\n\nfunction migrateShellText(text: string, locate: Locate): CommandMigration {\n const { edits, changes, manualSteps } = shellTextFindings(text, locate);\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n\n/**\n * Rename the generator command in one script, the renamed flags of that command only, and the\n * original packages that an install command or `npx -p` names. `location` names the script.\n */\nexport function migrateCommand(text: string, location: string): CommandMigration {\n return migrateShellText(text, () => location);\n}\n\n/**\n * Every command of a shell script, Makefile or Dockerfile, through `migrateCommand`. A command\n * continued with `\\` onto the next lines is one command. Each finding names its `file:line`.\n */\nexport function migrateCommandLines(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n return migrateShellText(text, (offset) => `${file}:${lineOf(offset)}`);\n}\n","import type { DocumentPath } from \"./config-documents.js\";\n\n/**\n * Where configs keep commands, as key path patterns: package.json scripts and the hook tools it\n * configures, Nx targets, Deno tasks and lint-staged. Only the strings at these paths are read as\n * commands, so the other values of a config stay as written.\n */\n\n/** A key path pattern; `*` matches any key or index. */\nexport type CommandPathPattern = readonly string[];\n\nconst ANY = \"*\";\n\n/** The `command` and `commands` of `nx:run-commands` options under `prefix`. */\nconst nxOptionPaths = (prefix: CommandPathPattern): CommandPathPattern[] => [\n [...prefix, \"command\"],\n [...prefix, \"commands\", ANY],\n [...prefix, \"commands\", ANY, \"command\"],\n];\n\n/**\n * `nx:run-commands` targets under `prefix`: `command`, the commands of `options`, and those of\n * each of its `configurations`, which replace the options they name (`nx run app:gen:ci`).\n */\nconst nxTargetPaths = (prefix: CommandPathPattern): CommandPathPattern[] => [\n [...prefix, ANY, \"command\"],\n ...nxOptionPaths([...prefix, ANY, \"options\"]),\n ...nxOptionPaths([...prefix, ANY, \"configurations\", ANY]),\n];\n\n/** lint-staged: each glob runs a command or a list of them. */\nconst lintStagedPaths = (prefix: CommandPathPattern): CommandPathPattern[] => [\n [...prefix, ANY],\n [...prefix, ANY, ANY],\n];\n\n/** simple-git-hooks: each git hook runs one command. */\nconst simpleGitHooksPaths = (prefix: CommandPathPattern): CommandPathPattern[] => [\n [...prefix, ANY],\n];\n\n/** Nx `project.json` targets. */\nexport const NX_PROJECT_COMMAND_PATHS: readonly CommandPathPattern[] = nxTargetPaths([\"targets\"]);\n\n/** `nx.json`: the defaults of the targets, by target name or executor. */\nexport const NX_WORKSPACE_COMMAND_PATHS: readonly CommandPathPattern[] = nxTargetPaths([\n \"targetDefaults\",\n]);\n\n/**\n * A manifest (package.json, package.yaml): the scripts, the configs of simple-git-hooks and\n * lint-staged, the `command` of each wireit script (the script itself is just `wireit`), and the\n * Nx targets of the project. Each finding names its place (`scripts.gen`).\n */\nexport const MANIFEST_COMMAND_PATHS: readonly CommandPathPattern[] = [\n [\"scripts\", ANY],\n [\"wireit\", ANY, \"command\"],\n ...simpleGitHooksPaths([\"simple-git-hooks\"]),\n ...lintStagedPaths([\"lint-staged\"]),\n ...nxTargetPaths([\"nx\", \"targets\"]),\n];\n\n/** A lint-staged config file (`.lintstagedrc`, `.lintstagedrc.json`, …). */\nexport const LINT_STAGED_COMMAND_PATHS: readonly CommandPathPattern[] = lintStagedPaths([]);\n\n/** A simple-git-hooks config file (`.simple-git-hooks.json`, …). */\nexport const SIMPLE_GIT_HOOKS_COMMAND_PATHS: readonly CommandPathPattern[] = simpleGitHooksPaths(\n [],\n);\n\n/** Deno tasks: a command string, or an object with a `command`. */\nexport const DENO_TASK_PATHS: readonly CommandPathPattern[] = [\n [\"tasks\", ANY],\n [\"tasks\", ANY, \"command\"],\n];\n\nconst matches = (path: DocumentPath, pattern: CommandPathPattern): boolean =>\n path.length === pattern.length &&\n pattern.every((part, index) => part === ANY || part === String(path[index]));\n\n/** Whether a value at `path` is a command by one of `patterns`. */\nexport const isCommandPath = (\n path: DocumentPath,\n patterns: readonly CommandPathPattern[],\n): boolean => patterns.some((pattern) => matches(path, pattern));\n","import { migrateCommand } from \"./command-migration.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport type { SourceString } from \"./source-migration.js\";\n\n/** No location: the step names the line of the string instead. */\nconst NO_LOCATION = \"\";\n\n/**\n * Strings of a source file that run the generator, such as `execSync(\"npx openapi-typescript …\")`\n * or the command of `spawn` with `shell: true`. They are reported with the migrated command, not\n * changed: a string is data, and only the author knows that it reaches a shell.\n */\nexport function commandStringSteps(text: string, strings: readonly SourceString[]): ManualStep[] {\n const lineOf = lineLocator(text);\n return strings.flatMap((found) => {\n // A string that is just a package name is reported by the specifier migration.\n if (found.isModuleSpecifier || PACKAGE_RENAMES.has(found.value)) {\n return [];\n }\n const migrated = migrateCommand(found.value, NO_LOCATION).text;\n return migrated === found.value\n ? []\n : [{ kind: \"command-string\" as const, line: lineOf(found.start), to: migrated }];\n });\n}\n","/**\n * The version spec a renamed dependency gets. A semver range keeps its style and gets the\n * openapi-typesafe version: `^` and `>=` give `^`, `~` gives `~`, an exact version stays exact,\n * and a partial version keeps what it fixes (`7` and `7.x` fix the major: `^`; `0.13` and\n * `0.13.x` fix the minor: `~`). A range of several comparators takes the style of its first one.\n * `catalog:` and `workspace:` stay, because they point elsewhere (a dependency on a local package\n * keeps its old name too, domain/dependency-map.ts); anything else (a tag, `*`, an\n * upper bound only, a URL, a file or an `npm:` alias of another package) is kept and reported.\n */\n\nconst KEPT_PROTOCOLS = [\"catalog:\", \"workspace:\"] as const;\n/**\n * The protocols of specs that point at a package on disk (pnpm, Yarn, npm, bun), not at the npm\n * registry: such a dependency is a local package that only shares an original package's name.\n */\nconst LOCAL_PROTOCOLS = [\"workspace:\", \"link:\", \"file:\", \"portal:\"] as const;\nconst RANGE_SEPARATOR = \"||\";\nconst HYPHEN = \"-\";\nconst WHITE_SPACE_RE = /\\s+/;\n/** node-semver allows white space between an operator and its version: `>= 1.2.3`. */\nconst SPACED_OPERATOR_RE = /(<=|>=|<|>|=|~>|~|\\^)\\s+/g;\nconst OPERATOR = String.raw`(<=|>=|<|>|=|~>|~|\\^)?`;\nconst VERSION_PART = String.raw`(\\d+|[xX*])`;\nconst LABELS = String.raw`(?:-[\\w.-]+)?(?:\\+[\\w.-]+)?`;\n/** A comparator: an operator, then a version whose parts can be `x` or `*` or left out. */\nconst COMPARATOR_RE = new RegExp(\n String.raw`^${OPERATOR}v?${VERSION_PART}(?:\\.${VERSION_PART})?(?:\\.${VERSION_PART})?${LABELS}$`,\n);\nconst NUMBER_RE = /^\\d+$/;\n\n/** The style a replaced spec keeps: `^`, `~` or exact (no operator). */\ntype RangeStyle = \"^\" | \"~\" | \"\";\n\nconst OPERATOR_STYLES: Readonly<Record<string, RangeStyle | undefined>> = {\n \"^\": \"^\",\n // `>=` means \"this or newer\"; with a new package line, a caret range says the same safely.\n \">=\": \"^\",\n \">\": \"^\",\n \"~\": \"~\",\n \"~>\": \"~\",\n};\n\nexport type SpecDecision =\n | { readonly kind: \"replaced\"; readonly spec: string }\n | { readonly kind: \"kept\"; readonly spec: string; readonly isReported: boolean };\n\nconst isNumber = (part: string | undefined): boolean => part !== undefined && NUMBER_RE.test(part);\n\n/** The style of a comparator without an operator (or `=`), by the parts it fixes. */\nfunction versionStyle(\n major: string | undefined,\n minor: string | undefined,\n patch: string | undefined,\n): RangeStyle | undefined {\n if (!isNumber(major)) {\n return undefined;\n }\n if (isNumber(minor) && isNumber(patch)) {\n return \"\";\n }\n return isNumber(minor) ? \"~\" : \"^\";\n}\n\n/** The style of the first comparator of a range, or undefined when the spec is not a range. */\nfunction rangeStyle(spec: string): RangeStyle | undefined {\n const sets = spec.replace(SPACED_OPERATOR_RE, \"$1\").split(RANGE_SEPARATOR);\n const tokens = sets.map((set) => set.trim().split(WHITE_SPACE_RE));\n const comparators = tokens.flat().filter((token) => token !== HYPHEN);\n const matches = comparators.map((comparator) => COMPARATOR_RE.exec(comparator));\n const first = matches[0];\n if (first === undefined || first === null || matches.includes(null)) {\n return undefined;\n }\n const operator = first[1];\n // `1.2.3 - 2.0.0` is `>=1.2.3 <=2.0.0`: a lower bound, as `>=` is.\n const isHyphenRange = tokens[0]?.[1] === HYPHEN;\n if (operator !== undefined && operator !== \"=\") {\n return OPERATOR_STYLES[operator];\n }\n return isHyphenRange ? \"^\" : versionStyle(first[2], first[3], first[4]);\n}\n\n/** True for a spec that points at a package on disk: `workspace:*`, `link:../fork`, `file:…`. */\nexport const isLocalPackageSpec = (spec: string): boolean =>\n LOCAL_PROTOCOLS.some((protocol) => spec.startsWith(protocol));\n\n/**\n * Yarn's `npm:` protocol before a bare range (`npm:^0.13.0`) names the entry's own package from\n * the registry, so the renamed entry gets the new range after the same protocol. An `npm:` spec\n * with a package name is an alias (domain/npm-alias.ts).\n */\nconst NPM_PROTOCOL = \"npm:\";\n\n/** The new spec for a renamed dependency whose old spec was `spec`. */\nexport function migrateVersionSpec(spec: string, version: string): SpecDecision {\n if (KEPT_PROTOCOLS.some((protocol) => spec.startsWith(protocol))) {\n return { kind: \"kept\", spec, isReported: false };\n }\n const protocol = spec.startsWith(NPM_PROTOCOL) ? NPM_PROTOCOL : \"\";\n const style = rangeStyle(spec.slice(protocol.length));\n if (style === undefined) {\n return { kind: \"kept\", spec, isReported: true };\n }\n return { kind: \"replaced\", spec: `${protocol}${style}${version}` };\n}\n","import { isScalar, mapsAt, type TreeMap, textEntries } from \"./config-documents.js\";\nimport type { ManualStep } from \"./migration-findings.js\";\nimport { DEPENDENCY_FIELDS, PACKAGE_RENAMES } from \"./package-names.js\";\nimport { isLocalPackageSpec } from \"./version-spec.js\";\n\n/**\n * What the manifests of a project declare, to tell whether a source file may import a package\n * without relying on another package to install it.\n */\n\n/**\n * One manifest of the project: its path in the listing and the names its dependency fields hold;\n * `names` is undefined when the manifest could not be read, and it then counts as declaring all.\n */\nexport interface ManifestDeclarations {\n readonly path: string;\n readonly names: ReadonlySet<string> | undefined;\n /** The original names it declares with a spec that points at a local package. */\n readonly localPackages?: ReadonlySet<string>;\n}\n\n/**\n * A package that an original package installed as its own dependency and its successor does not.\n * openapi-fetch and openapi-react-query depend on openapi-typescript-helpers, so code could import\n * it without a dependency of its own. openapi-typesafe-fetch declares the helper types itself and\n * the hooks name them through it, so nothing installs openapi-typesafe-helpers for such code.\n */\nexport const NO_LONGER_INSTALLED: ReadonlyMap<string, readonly string[]> = new Map([\n [\"openapi-typesafe-helpers\", [\"openapi-fetch\", \"openapi-react-query\"]],\n]);\n\n/** The original name of each successor package. */\nconst ORIGINAL_NAMES: ReadonlyMap<string, string> = new Map(\n [...PACKAGE_RENAMES].map(([original, successor]) => [successor, original]),\n);\n\nconst PATH_SEPARATOR = \"/\";\n\n/** Whether a manifest text can declare a package of NO_LONGER_INSTALLED, so it must be read. */\nexport function namesUninstalledPackage(text: string): boolean {\n return [...NO_LONGER_INSTALLED.keys()].some(\n (name) => text.includes(name) || text.includes(ORIGINAL_NAMES.get(name) ?? name),\n );\n}\n\nconst directoryOf = (path: string): string => path.slice(0, path.lastIndexOf(PATH_SEPARATOR) + 1);\n\n/** Whether the file at `path` is in the folder of `filePath` or in a folder above it. */\nexport const isAtOrAbove = (path: string, filePath: string): boolean =>\n filePath.startsWith(directoryOf(path));\n\n/** The names that the dependency fields of a parsed manifest hold. */\nexport function declaredNames(manifest: TreeMap): string[] {\n return DEPENDENCY_FIELDS.flatMap((field) => mapsAt(manifest, field))\n .flatMap(textEntries)\n .map(({ key }) => key.value);\n}\n\n/**\n * The names that a parsed manifest's dependency fields point at a local package\n * (`\"openapi-fetch\": \"workspace:*\"`): such a dependency keeps its name, so its imports do too.\n */\nexport function localPackageNames(manifest: TreeMap): string[] {\n return DEPENDENCY_FIELDS.flatMap((field) => mapsAt(manifest, field))\n .flatMap(textEntries)\n .flatMap(({ key, value }) =>\n isScalar(value) && isLocalPackageSpec(value.value) ? [key.value] : [],\n );\n}\n\n/**\n * The original packages that the imports of the file at `filePath` resolve to a local package.\n * Node looks in the `node_modules` folder of the file's folder first, then in each folder above,\n * so the nearest manifest that declares a name decides: a local package of a workspace root does\n * not count for a package that declares the npm package itself. A manifest that could not be\n * read tells nothing and is passed over.\n */\nexport function localPackagesFor(\n manifests: readonly ManifestDeclarations[],\n filePath: string,\n): ReadonlySet<string> {\n const nearestFirst = manifests\n .filter(({ path }) => isAtOrAbove(path, filePath))\n .sort((left, right) => directoryOf(right.path).length - directoryOf(left.path).length);\n const candidates = new Set(\n nearestFirst.flatMap(({ localPackages }) => [...(localPackages ?? [])]),\n );\n const isLocal = (name: string): boolean =>\n nearestFirst.find(({ names }) => names?.has(name) === true)?.localPackages?.has(name) === true;\n return new Set([...candidates].filter(isLocal));\n}\n\n/**\n * Whether a manifest at or above `filePath` declares `name`, under its old or its new name. Node\n * looks for a package in the `node_modules` folders of every directory above the file, so a\n * dependency of a workspace root counts for its packages. A file that no manifest contains is not\n * judged: it is not part of a package (a Deno module, a loose script).\n */\nfunction isDeclaredFor(\n manifests: readonly ManifestDeclarations[],\n filePath: string,\n name: string,\n): boolean {\n const original = ORIGINAL_NAMES.get(name);\n const containing = manifests.filter(({ path }) => isAtOrAbove(path, filePath));\n const declares = ({ names }: ManifestDeclarations): boolean =>\n names === undefined || names.has(name) || (original !== undefined && names.has(original));\n return containing.length === 0 || containing.some(declares);\n}\n\n/** The package that a module specifier names: `pkg` of `pkg/subpath`. */\nexport const packageOfSpecifier = (specifier: string): string => {\n const slash = specifier.indexOf(PATH_SEPARATOR);\n return slash === -1 ? specifier : specifier.slice(0, slash);\n};\n\n/** A module specifier of a source file, as the migration leaves it, and its line. */\nexport interface ImportedSpecifier {\n readonly specifier: string;\n readonly line: number;\n}\n\n/**\n * The imports of a source file, as the migration leaves them, of a package that no manifest or\n * import map at or above the file declares and that the original packages no longer install. An\n * import already renamed by an earlier run counts too, so a second run still reports it. A Deno\n * `npm:` specifier installs its package itself and is not a package name, so it is never reported.\n */\nexport function undeclaredImportSteps(\n imports: readonly ImportedSpecifier[],\n filePath: string,\n manifests: readonly ManifestDeclarations[],\n): ManualStep[] {\n return imports.flatMap(({ specifier, line }) => {\n const name = packageOfSpecifier(specifier);\n const installers = NO_LONGER_INSTALLED.get(name);\n return installers === undefined || isDeclaredFor(manifests, filePath, name)\n ? []\n : [{ kind: \"package-not-declared\", line, name, installers } as const];\n });\n}\n","import { type Finding, type Locate, programArgumentFindings } from \"./argument-findings.js\";\nimport { commandWordFindings } from \"./command-migration.js\";\nimport { NO_VARIABLES, runsGenerator } from \"./file-variables.js\";\nimport type { ShellCommand } from \"./shell-words.js\";\nimport { shellCommands } from \"./shell-words.js\";\nimport type { VariableProgram } from \"./variable-programs.js\";\n\n/**\n * A container runs its entrypoint with the command as its arguments: Docker appends the items of\n * an exec-form `CMD` to an exec-form `ENTRYPOINT`, Compose (and GitLab and CircleCI images) the\n * `command` to the `entrypoint`, Kubernetes the `args` to the `command`. When the entrypoint runs\n * the generator, the old flags of the command are its flags, written in another place. The\n * Dockerfile and the YAML migrations pair them by their own rules and read them here.\n */\n\n/**\n * Shells whose `-c` option takes a command line, as `SHELL`, the shell form and the exec forms of\n * Dockerfiles and YAML files use them.\n */\nconst SHELLS: ReadonlySet<string> = new Set([\"sh\", \"bash\", \"dash\", \"ash\", \"zsh\"]);\nconst OPTION_PREFIX = \"-\";\nconst LONG_OPTION_PREFIX = \"--\";\nconst COMMAND_OPTION = \"c\";\nconst SET_OPTION = \"-o\";\nconst PATH_SEPARATOR = \"/\";\n\n/**\n * The command line of `[\"sh\", \"-c\", \"…\"]` (also `/bin/bash -o pipefail -ec`): the word after the\n * first short option that holds `c`, before any word that is not an option.\n */\nexport function shellScript<Word extends { readonly value: string }>(\n words: readonly Word[],\n): Word | undefined {\n const program = words[0]?.value.split(PATH_SEPARATOR).at(-1) ?? \"\";\n if (!SHELLS.has(program)) {\n return undefined;\n }\n let index = 1;\n for (let option = words[index]?.value; option !== undefined; option = words[index]?.value) {\n if (!option.startsWith(OPTION_PREFIX)) {\n return undefined;\n }\n if (!option.startsWith(LONG_OPTION_PREFIX) && option.includes(COMMAND_OPTION)) {\n return words[index + 1];\n }\n // `-o pipefail` names a shell option in the next word.\n index += option === SET_OPTION ? 2 : 1;\n }\n return undefined;\n}\n\n/**\n * What an entrypoint gives its arguments to: the generator when it runs the generator under the\n * name the migration gives it (a pinned or unknown path keeps its arguments, as a command does);\n * a shell script that runs the generator gets them as `$1`… and may pass them on, so either.\n */\nexport function entrypointProgram(entrypoint: ShellCommand): VariableProgram {\n const script = shellScript(entrypoint);\n if (script !== undefined) {\n return shellCommands(script.value).some(runsGenerator) ? \"generator-or-other\" : \"other\";\n }\n const { changes } = commandWordFindings([entrypoint], () => \"\");\n return changes.some((change) => change.kind === \"command-renamed\") ? \"generator\" : \"other\";\n}\n\n/**\n * An entrypoint, the command that is its arguments, and how the report names the entrypoint.\n * `isPlaced` is false when the command's words are not where the text writes them (a YAML value\n * with an escape): their old flags are then reported, never edited at a wrong place.\n */\nexport interface EntrypointCommand {\n readonly entrypoint: ShellCommand;\n readonly command: ShellCommand;\n readonly written: string;\n readonly isPlaced?: boolean;\n}\n\n/**\n * The findings of the old flags in a command that an entrypoint gets as arguments: renamed after\n * the generator, one step after a script that may pass them on, none after another program. A\n * command that runs the generator itself is read as its own command, so it is left here.\n */\nexport function entrypointArgumentFindings(\n { entrypoint, command, written, isPlaced = true }: EntrypointCommand,\n locate: Locate,\n): Finding[] {\n const program = entrypointProgram(entrypoint);\n const first = command[0];\n if (program === \"other\" || first === undefined || entrypointProgram(command) !== \"other\") {\n return [];\n }\n const use = { written, program: isPlaced ? program : \"generator-or-other\" };\n return programArgumentFindings(command, { offset: first.start, use }, locate, NO_VARIABLES);\n}\n","import type { Finding, Locate } from \"./argument-findings.js\";\nimport { entrypointArgumentFindings } from \"./entrypoint-arguments.js\";\nimport type { ShellWord } from \"./shell-words.js\";\n\n/**\n * Which `CMD` of a Dockerfile gives its items to which `ENTRYPOINT` (Docker's rules): within a\n * stage the last of each counts; a stage `FROM` an earlier one inherits its entrypoint, and its\n * command too unless it sets an entrypoint of its own. Only exec forms pair: a shell-form\n * entrypoint ignores the command, and a shell-form command would give `/bin/sh -c …` as arguments.\n */\n\n/**\n * One exec-form array: where its instruction line starts, where the array starts (at the `[`)\n * and ends, and its words.\n */\nexport interface ExecForm {\n readonly lineStart: number;\n readonly start: number;\n readonly end: number;\n readonly words: readonly ShellWord[];\n}\n\n/** The instructions that set stages, entrypoints and commands, at the start of a line. */\nconst STAGE_INSTRUCTION_RE = /^[ \\t]*(FROM|CMD|ENTRYPOINT)\\b(.*)$/gm;\n/** `FROM [--platform=…] image [AS name]`; a stage name is matched without regard to case. */\nconst FROM_RE = /^[ \\t]+(?:--\\S+[ \\t]+)*(\\S+)(?:[ \\t]+AS[ \\t]+(\\S+))?/i;\nconst FROM = \"FROM\";\nconst CMD = \"CMD\";\n/** How the report names an entrypoint whose script may pass its arguments on. */\nconst ENTRYPOINT_WRITTEN = \"ENTRYPOINT\";\n\n/** An entrypoint or command instruction: its exec form, or undefined for the shell form. */\ninterface Instruction {\n readonly form: ExecForm | undefined;\n}\n\n/** One build stage: the image or stage it starts from, its name, and what it sets. */\ninterface Stage {\n readonly base: string;\n readonly name: string | undefined;\n entrypoint: Instruction | undefined;\n command: Instruction | undefined;\n}\n\n/** The stages of a Dockerfile with the last entrypoint and command each sets. */\nfunction dockerStages(text: string, forms: readonly ExecForm[]): Stage[] {\n const formAt = new Map(forms.map((form) => [form.lineStart, form]));\n const stages: Stage[] = [];\n for (const match of text.matchAll(STAGE_INSTRUCTION_RE)) {\n const [, keyword, rest] = match;\n const stage = stages.at(-1);\n if (keyword === FROM) {\n const from = FROM_RE.exec(rest ?? \"\");\n const name = from?.[2]?.toLowerCase();\n stages.push({ base: from?.[1] ?? \"\", name, entrypoint: undefined, command: undefined });\n } else if (stage !== undefined) {\n const instruction = { form: formAt.get(match.index) };\n stage[keyword === CMD ? \"command\" : \"entrypoint\"] = instruction;\n }\n }\n return stages;\n}\n\n/** The stage that `FROM` names by name or by number, among the stages before `index`. */\nfunction baseStage(stages: readonly Stage[], index: number): number {\n const base = stages[index]?.base.toLowerCase();\n return stages.findIndex((stage, at) => at < index && (stage.name === base || `${at}` === base));\n}\n\n/** The entrypoint a stage runs: its own, or the one of the stage it starts from. */\nfunction entrypointOf(stages: readonly Stage[], index: number): Instruction | undefined {\n const own = stages[index]?.entrypoint;\n const base = baseStage(stages, index);\n return own ?? (base === -1 ? undefined : entrypointOf(stages, base));\n}\n\n/**\n * The old flags in the exec-form `CMD` of each stage whose exec-form entrypoint runs the\n * generator: `ENTRYPOINT [\"openapi-typescript\"]` with `CMD [\"api.yaml\", \"-it\"]`.\n */\nexport function entrypointCommandFindings(\n text: string,\n forms: readonly ExecForm[],\n locate: Locate,\n): Finding[] {\n const stages = dockerStages(text, forms);\n return stages.flatMap((stage, index) => {\n const entrypoint = entrypointOf(stages, index)?.form;\n const command = stage.command?.form;\n if (entrypoint === undefined || command === undefined) {\n return [];\n }\n const pair = { entrypoint: entrypoint.words, command: command.words };\n return entrypointArgumentFindings({ ...pair, written: ENTRYPOINT_WRITTEN }, locate);\n });\n}\n","import {\n type CommandMigration,\n commandWordFindings,\n migrateCommand,\n textFindings,\n} from \"./command-migration.js\";\nimport { type ExecForm, entrypointCommandFindings } from \"./dockerfile-entrypoints.js\";\nimport { shellScript } from \"./entrypoint-arguments.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { shellVariables } from \"./shell-variables.js\";\nimport {\n type ShellCommand,\n type ShellWord,\n shellCommands,\n shellCommandsAt,\n} from \"./shell-words.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\n\n/**\n * Dockerfiles and Containerfiles. `RUN`, `CMD` and `ENTRYPOINT` take a command in shell form (a\n * line the shell splits) or in exec form: a JSON array of strings, each one word, which no shell\n * splits. Docker reads an instruction whose argument is not a valid JSON array as shell form, and\n * so does the migration.\n */\n\n/**\n * An instruction that takes a command, at the start of a line, before its `[`, after the flags of\n * `RUN` (`--mount=type=cache,target=/root/.npm`, `--network=none`). In capitals, as Dockerfiles\n * write them and as the launcher table reads the shell form (command-launchers.ts).\n */\nconst EXEC_FORM_START_RE = /^[ \\t]*(?:RUN|CMD|ENTRYPOINT)(?:[ \\t]+--\\S+)*[ \\t]+\\[/gm;\n/** Blanks between the items of the array; a `\\` at the end of a line continues the instruction. */\nconst ARRAY_BLANK_RE = /(?:[ \\t\\r\\n]|\\\\\\r?\\n)*/y;\n/** A double-quoted string on one line; `JSON.parse` decides whether it is a JSON string. */\nconst QUOTED_RE = /\"(?:[^\"\\\\\\n]|\\\\.)*\"/y;\nconst ITEM_SEPARATOR = \",\";\nconst NOT_LINE_BREAK_RE = /[^\\n]/g;\nconst ARRAY_END = \"]\";\n/** Instructions that set variables which later shell-form commands expand (`$GEN`). */\nconst VARIABLE_INSTRUCTIONS: ReadonlySet<string> = new Set([\"ARG\", \"ENV\"]);\nconst LEGACY_ENV_INSTRUCTION = \"ENV\";\nconst ASSIGNMENT = \"=\";\nconst QUOTES: ReadonlySet<string> = new Set(['\"', \"'\"]);\n\n/** Where a pattern with the sticky flag matches at `index`, or undefined. */\nfunction matchAt(pattern: RegExp, text: string, index: number): string | undefined {\n pattern.lastIndex = index;\n return pattern.exec(text)?.[0];\n}\n\n/** The value of a JSON string, or undefined when `raw` is not one (a bad escape, a raw tab). */\nfunction jsonString(raw: string): string | undefined {\n try {\n return JSON.parse(raw) as string;\n } catch (error) {\n // Docker reads an argument that is not valid JSON as shell form; so does the migration.\n if (error instanceof SyntaxError) {\n return undefined;\n }\n throw error;\n }\n}\n\n/** The words of the exec-form array whose `[` is at `start`, or undefined when it is not one. */\nfunction execFormAt(text: string, start: number): Omit<ExecForm, \"lineStart\"> | undefined {\n const words: ShellWord[] = [];\n let index = start + 1;\n for (;;) {\n index += matchAt(ARRAY_BLANK_RE, text, index)?.length ?? 0;\n const raw = matchAt(QUOTED_RE, text, index);\n if (raw === undefined) {\n const isEmpty = text[index] === ARRAY_END && words.length === 0;\n return isEmpty ? { start, end: index + 1, words } : undefined;\n }\n const value = jsonString(raw);\n if (value === undefined) {\n return undefined;\n }\n // A word is the text inside the quotes, as an exec-form item of a YAML file is.\n words.push({ start: index + 1, end: index + raw.length - 1, value, raw: raw.slice(1, -1) });\n index += raw.length;\n index += matchAt(ARRAY_BLANK_RE, text, index)?.length ?? 0;\n if (text[index] === ARRAY_END) {\n return { start, end: index + 1, words };\n }\n if (text[index] !== ITEM_SEPARATOR) {\n return undefined;\n }\n index++;\n }\n}\n\n/** The exec-form arrays of a Dockerfile, in order, each with the start of its instruction line. */\nfunction execForms(text: string): ExecForm[] {\n return [...text.matchAll(EXEC_FORM_START_RE)].flatMap((match) => {\n const form = execFormAt(text, match.index + match[0].length - 1);\n return form === undefined ? [] : [{ ...form, lineStart: match.index }];\n });\n}\n\n/** What the exec-form arrays run: the arrays, and the command lines of the shells they start. */\ninterface ExecCommands {\n readonly commands: readonly ShellCommand[];\n /** Command lines with JSON escapes, whose offsets do not map onto the file: reported only. */\n readonly escaped: readonly ShellWord[];\n}\n\nfunction execCommands(forms: readonly ExecForm[]): ExecCommands {\n const commands: ShellCommand[] = [];\n const escaped: ShellWord[] = [];\n for (const { words } of forms) {\n commands.push(words);\n const script = shellScript(words);\n if (script !== undefined && script.raw === script.value) {\n commands.push(...shellCommandsAt(script.value, script.start));\n } else if (script !== undefined) {\n escaped.push(script);\n }\n }\n return { commands, escaped };\n}\n\n/** The text with the arrays blanked out, line breaks kept, so the shell reads the rest. */\nfunction withoutExecForms(text: string, forms: readonly ExecForm[]): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, end } of forms) {\n parts.push(\n text.slice(copiedUpTo, start),\n text.slice(start, end).replace(NOT_LINE_BREAK_RE, \" \"),\n );\n copiedUpTo = end;\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** A command line that the migration would change but cannot edit in place, as a manual step. */\nfunction escapedScriptSteps(scripts: readonly ShellWord[], lineOf: (offset: number) => number) {\n return scripts.flatMap((script): ManualStep[] => {\n const migrated = migrateCommand(script.value, \"\").text;\n return migrated === script.value\n ? []\n : [{ kind: \"command-string\", line: lineOf(script.start), to: migrated }];\n });\n}\n\n/** A variable that `ARG` or `ENV` sets: its name, and its value as written at its offset. */\ninterface DockerVariable {\n readonly name: string;\n readonly value: string;\n readonly start: number;\n}\n\n/** The variable of one `NAME=value` word, its quotes taken off, or undefined. */\nfunction assignedVariable(word: ShellWord): DockerVariable | undefined {\n const at = word.raw.indexOf(ASSIGNMENT);\n if (at <= 0) {\n return undefined;\n }\n const raw = word.raw.slice(at + 1);\n const isQuoted = raw.length >= 2 && QUOTES.has(raw[0] as string) && raw.at(-1) === raw[0];\n const value = isQuoted ? raw.slice(1, -1) : raw;\n const start = word.start + at + 1 + (isQuoted ? 1 : 0);\n return { name: word.raw.slice(0, at), value, start };\n}\n\n/** An `ARG` or `ENV` instruction: where it is in the text, and the variables it sets. */\ninterface VariableInstruction {\n readonly start: number;\n readonly end: number;\n readonly variables: readonly DockerVariable[];\n}\n\n/**\n * The variables of one instruction: `ARG NAME=value`, `ENV NAME=value …`, and `ENV NAME value`,\n * the legacy form that sets one variable to the rest of the line.\n */\nfunction instructionVariables(text: string, words: readonly ShellWord[]): DockerVariable[] {\n const [instruction, first, ...rest] = words as [ShellWord, ShellWord, ...ShellWord[]];\n const last = rest.at(-1);\n if (instruction.value === LEGACY_ENV_INSTRUCTION && !first.raw.includes(ASSIGNMENT)) {\n const value = last === undefined ? \"\" : text.slice(rest[0]?.start, last.end);\n return [{ name: first.value, value, start: rest[0]?.start ?? first.end }];\n }\n return [first, ...rest].flatMap((word) => assignedVariable(word) ?? []);\n}\n\n/** The `ARG` and `ENV` instructions among the shell-form commands of a Dockerfile. */\nfunction variableInstructions(\n text: string,\n commands: readonly ShellCommand[],\n): VariableInstruction[] {\n return commands.flatMap((words): VariableInstruction[] => {\n const [instruction, first] = words;\n if (instruction === undefined || first === undefined) {\n return [];\n }\n if (!VARIABLE_INSTRUCTIONS.has(instruction.value)) {\n return [];\n }\n const end = (words.at(-1) as ShellWord).end;\n return [{ start: instruction.start, end, variables: instructionVariables(text, words) }];\n });\n}\n\n/**\n * The shell-form commands that are not `ARG` or `ENV` instructions, nor read inside one. Docker,\n * not a shell, reads those: their values are read once, as the commands that `$NAME` runs, so\n * no word of them (`ENV GEN=${GEN:-npx openapi-typescript}`) is edited twice.\n */\nfunction withoutVariableInstructions(\n commands: readonly ShellCommand[],\n instructions: readonly VariableInstruction[],\n): ShellCommand[] {\n const isInInstruction = (words: ShellCommand): boolean => {\n const start = words[0]?.start ?? -1;\n return instructions.some(\n (instruction) => start >= instruction.start && start < instruction.end,\n );\n };\n return commands.filter((words) => !isInInstruction(words));\n}\n\nconst valueCommands = ({ value, start }: DockerVariable): ShellCommand[] =>\n shellCommandsAt(value, start);\n\n/**\n * Migrate the commands of a Dockerfile: exec-form arrays word by word, everything else as shell\n * text, with the values of `ARG` and `ENV` variables as commands that `$NAME` runs. Each finding\n * names its `file:line`.\n */\nexport function migrateDockerfile(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const forms = execForms(text);\n const exec = execCommands(forms);\n const shellForm = shellCommands(withoutExecForms(text, forms));\n const instructions = variableInstructions(text, shellForm);\n // A value that runs the generator is migrated where it is set, its flags where it is used.\n const definitions = instructions.flatMap((instruction) => instruction.variables);\n const values = definitions.flatMap(valueCommands);\n const run = withoutVariableInstructions(shellForm, instructions);\n const commands = [...run, ...values, ...exec.commands];\n const found = commandWordFindings(commands, locate, shellVariables(definitions));\n // The items of a CMD are the arguments of the entrypoint, so their flags may be the generator's.\n const entry = textFindings(entrypointCommandFindings(text, forms, locate));\n const edits = [...found.edits, ...entry.edits];\n const changes = [...found.changes, ...entry.changes];\n const steps = [...found.manualSteps, ...entry.manualSteps];\n return {\n text: applyTextEdits(text, edits),\n changes,\n manualSteps: [...steps, ...escapedScriptSteps(exec.escaped, lineOf)],\n };\n}\n","/**\n * What the catalogs of a project keep under the old names (domain/catalogs.ts makes the plan).\n * It is apart from the catalogs so that dependency-map.ts can read a plan without importing the\n * catalog readers, which import it.\n */\n\nconst CATALOG_PROTOCOL = \"catalog:\";\n/** The name that `catalog:` gives the default catalog. */\nexport const DEFAULT_CATALOG = \"default\";\n\n/** The catalog that a spec points at (`catalog:` is the default one), or undefined. */\nexport function catalogOfSpec(spec: string): string | undefined {\n if (!spec.startsWith(CATALOG_PROTOCOL)) {\n return undefined;\n }\n // pnpm trims the name, so `catalog: ` is the default catalog too.\n return spec.slice(CATALOG_PROTOCOL.length).trim() || DEFAULT_CATALOG;\n}\n\n/** Entries of catalogs, by catalog and package name. */\nexport class CatalogEntries {\n readonly #keys = new Set<string>();\n\n add(catalog: string, name: string): void {\n this.#keys.add(JSON.stringify([catalog, name]));\n }\n\n has(catalog: string, name: string): boolean {\n return this.#keys.has(JSON.stringify([catalog, name]));\n }\n}\n\n/** What the catalogs of a project keep under the old names. */\nexport interface CatalogPlan {\n /** Entries that a dependency keeps using under the old name: they are not renamed. */\n readonly inUse: CatalogEntries;\n /** Entries that keep the old name, with no entry for the new one: a dependency stays. */\n readonly kept: CatalogEntries;\n /**\n * The entries of the project's catalogs. A dependency on an entry that is not among them points\n * at a catalog outside the root (`--root packages/api` of a pnpm workspace): that entry cannot\n * be renamed, so the dependency keeps its name.\n */\n readonly defined: CatalogEntries;\n /**\n * Whether the root is a workspace root: it holds the workspace's catalogs, so there is no\n * catalog above it, and an entry missing from the project is missing from the workspace.\n */\n readonly isWorkspaceRoot: boolean;\n}\n\n/** The plan for files with no dependencies on catalogs (import maps): nothing is kept. */\nexport const NO_CATALOG_PLAN: CatalogPlan = {\n inUse: new CatalogEntries(),\n kept: new CatalogEntries(),\n defined: new CatalogEntries(),\n isWorkspaceRoot: false,\n};\n","import { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { migrateVersionSpec } from \"./version-spec.js\";\n\n/**\n * `npm:` specs name a package from the registry under another name: an alias in package.json\n * (`\"my-fetch\": \"npm:openapi-fetch@^0.13\"`), and the npm specifiers of Deno (in `deno.json`\n * imports and in sources: `npm:openapi-fetch@0.13/path`, `npm:/openapi-fetch@0.13/`). The package\n * in them is renamed like any other, and the range gets the openapi-typesafe version.\n */\n\nconst NPM_PROTOCOL = \"npm:\";\nconst SCOPE_PREFIX = \"@\";\nconst PATH_SEPARATOR = \"/\";\nconst VERSION_SEPARATOR = \"@\";\n\n/** The parts of `npm:[/]<name>[@<range>][/<path>]`; `rest` is the `/<path>` after the range. */\ninterface NpmSpec {\n readonly lead: string;\n readonly name: string;\n readonly range: string | undefined;\n readonly rest: string;\n}\n\n/** The end of the package name in `text`: a scoped name has one `/` inside. */\nfunction nameEnd(text: string): number {\n const searchFrom = text.startsWith(SCOPE_PREFIX) ? text.indexOf(PATH_SEPARATOR) + 1 : 0;\n const ends = [VERSION_SEPARATOR, PATH_SEPARATOR]\n .map((separator) => text.indexOf(separator, Math.max(searchFrom, 1)))\n .filter((index) => index !== -1);\n return ends.length === 0 ? text.length : Math.min(...ends);\n}\n\nfunction parseNpmSpec(spec: string): NpmSpec | undefined {\n if (!spec.startsWith(NPM_PROTOCOL)) {\n return undefined;\n }\n const body = spec.slice(NPM_PROTOCOL.length);\n const lead = body.startsWith(PATH_SEPARATOR) ? PATH_SEPARATOR : \"\";\n const text = body.slice(lead.length);\n const end = nameEnd(text);\n const name = text.slice(0, end);\n if (!text.startsWith(VERSION_SEPARATOR, end)) {\n return { lead, name, range: undefined, rest: text.slice(end) };\n }\n const rangeEnd = text.indexOf(PATH_SEPARATOR, end);\n const restStart = rangeEnd === -1 ? text.length : rangeEnd;\n return { lead, name, range: text.slice(end + 1, restStart), rest: text.slice(restStart) };\n}\n\n/**\n * An `npm:` spec of an original package, renamed. `isReported` when its range was kept;\n * `isDeep` when it reaches into the package (`npm:openapi-fetch@0.13/dist/index.js`).\n */\nexport interface MigratedNpmSpec {\n readonly spec: string;\n readonly isReported: boolean;\n readonly isDeep: boolean;\n}\n\n/** Whether `spec` is an `npm:` specifier of an original package (`npm:openapi-fetch@^0.13`). */\nexport function isOldPackageNpmSpec(spec: string): boolean {\n const parsed = parseNpmSpec(spec);\n return parsed !== undefined && PACKAGE_RENAMES.has(parsed.name);\n}\n\n/**\n * The `npm:` spec with the openapi-typesafe package and version, or undefined when `spec` is not\n * an `npm:` spec of an original package. A spec without a range keeps none; a range that is not\n * a semver range (a tag) is kept and reported.\n */\nexport function migrateNpmSpec(spec: string, version: string): MigratedNpmSpec | undefined {\n const parsed = parseNpmSpec(spec);\n const renamed = parsed === undefined ? undefined : PACKAGE_RENAMES.get(parsed.name);\n if (parsed === undefined || renamed === undefined) {\n return undefined;\n }\n const head = `${NPM_PROTOCOL}${parsed.lead}${renamed}`;\n const isDeep = parsed.rest !== \"\" && parsed.rest !== PATH_SEPARATOR;\n if (parsed.range === undefined) {\n return { spec: `${head}${parsed.rest}`, isReported: false, isDeep };\n }\n const decision = migrateVersionSpec(parsed.range, version);\n const isReported = decision.kind === \"kept\" && decision.isReported;\n const migrated = `${head}${VERSION_SEPARATOR}${decision.spec}${parsed.rest}`;\n return { spec: migrated, isReported, isDeep };\n}\n","/**\n * Credentials in URLs (`https://user:password@host`, `git+https://token@host`) that the findings\n * would copy into the report and the log. The project files keep them; only the findings hide\n * them, because a CI log or a temporary log file is a new place for a secret.\n */\n\nconst SCHEME_SEPARATOR = \"://\";\nconst HIDDEN_USERINFO = \"***\";\nconst USERINFO_END = \"@\";\n/** The authority of a URL ends at a path, a query, a fragment, a quote or white space. */\nconst AUTHORITY_END_RE = /[/?#\"'`\\s]/;\n\n/** The index where the authority that starts at `start` ends, and its last `@` (or -1). */\nfunction scanAuthority(text: string, start: number): { end: number; userinfoEnd: number } {\n let userinfoEnd = -1;\n let end = start;\n for (; end < text.length && !AUTHORITY_END_RE.test(text.charAt(end)); end++) {\n if (text.charAt(end) === USERINFO_END) {\n userinfoEnd = end;\n }\n }\n return { end, userinfoEnd };\n}\n\n/** `text` with the userinfo of every URL in it replaced by `***`. Linear in the text length. */\nexport function hideUrlCredentials(text: string): string {\n let hidden = \"\";\n let copiedUpTo = 0;\n for (let found = text.indexOf(SCHEME_SEPARATOR); found !== -1; ) {\n const start = found + SCHEME_SEPARATOR.length;\n const { end, userinfoEnd } = scanAuthority(text, start);\n if (userinfoEnd !== -1) {\n hidden += `${text.slice(copiedUpTo, start)}${HIDDEN_USERINFO}`;\n copiedUpTo = userinfoEnd;\n }\n found = text.indexOf(SCHEME_SEPARATOR, end);\n }\n return `${hidden}${text.slice(copiedUpTo)}`;\n}\n","import { assertNever } from \"./assert-never.js\";\nimport { type CatalogPlan, catalogOfSpec } from \"./catalog-plan.js\";\nimport type { Change, ManualStep } from \"./migration-findings.js\";\nimport { migrateNpmSpec } from \"./npm-alias.js\";\nimport { PACKAGE_RENAMES, renamedSpecifier } from \"./package-names.js\";\nimport type { TextEdit } from \"./text-edits.js\";\nimport { hideUrlCredentials } from \"./url-credentials.js\";\nimport { isLocalPackageSpec, migrateVersionSpec } from \"./version-spec.js\";\n\n/**\n * Maps of package names: dependency fields and catalogs (`name: spec`), and lists or keys that\n * only name a package (`peerDependenciesMeta`, `bundleDependencies`). The file formats (JSON and\n * YAML) give their entries with edits that keep the format's quoting; the decisions are here, so\n * every format renames the same way.\n */\n\n/** The string value of an entry, and the edit that replaces it. */\nexport interface SpecValue {\n readonly value: string;\n readonly replace: (spec: string) => TextEdit;\n}\n\n/** One `name: spec` entry. `spec` is undefined when the value is not a string. */\nexport interface SpecEntry {\n readonly name: string;\n readonly spec: SpecValue | undefined;\n readonly renameKey: (name: string) => TextEdit;\n}\n\n/** One place that only names a package: a key of a meta field, an item of a list. */\nexport interface NameEntry {\n readonly name: string;\n readonly rename: (name: string) => TextEdit;\n}\n\n/** The edits a file gets, and what the migration found while making them. */\nexport interface Findings {\n readonly edits: TextEdit[];\n readonly changes: Change[];\n readonly manualSteps: ManualStep[];\n}\n\nexport const newFindings = (): Findings => ({ edits: [], changes: [], manualSteps: [] });\n\n/**\n * A dependency field (`dependencies`, …), a catalog (`catalog`, `catalogs.legacy`, …), or an\n * import map (Deno's `imports` and `scopes`), whose keys are module specifiers: a package name, a\n * subpath of it or a prefix (`openapi-fetch/`).\n */\nexport type SpecMap =\n | { readonly kind: \"dependencies\"; readonly field: string }\n | {\n readonly kind: \"catalog\";\n /** Where the catalog is in its file (`catalogs.legacy`), for the report. */\n readonly catalog: string;\n /** The name that `catalog:<name>` gives it (`default` for `catalog:`). */\n readonly name: string;\n }\n | { readonly kind: \"imports\"; readonly field: string };\n\n/** What renamed entries get: the version of the tool, and the plan of the project's catalogs. */\nexport interface RenameTarget {\n readonly version: string;\n readonly catalogs: CatalogPlan;\n}\n\n/** Where a map is, the version renamed entries get, and where the findings go. */\nexport interface MapContext {\n readonly map: SpecMap;\n readonly version: string;\n readonly findings: Findings;\n /** What the project's catalogs keep under the old names (domain/catalogs.ts). */\n readonly catalogs: CatalogPlan;\n}\n\nconst PEER_FIELD = \"peerDependencies\";\n\nconst mapLabel = (map: SpecMap): string => (map.kind === \"catalog\" ? map.catalog : map.field);\n\n/** The new key of an entry of `map`, or undefined when it names no original package. */\nconst renamedKey = (name: string, map: SpecMap): string | undefined =>\n map.kind === \"imports\" ? renamedSpecifier(name)?.to : PACKAGE_RENAMES.get(name);\n\n/** The spec a renamed entry gets; `isReported` when it was kept because it is not a range. */\nfunction migrateSpec(spec: string, version: string): { spec: string; isReported: boolean } {\n const npm = migrateNpmSpec(spec, version);\n if (npm !== undefined) {\n return { spec: npm.spec, isReported: npm.isReported };\n }\n const decision = migrateVersionSpec(spec, version);\n return { spec: decision.spec, isReported: decision.kind === \"kept\" && decision.isReported };\n}\n\n/** A rename of one key or name, where it is, and the other names of that place. */\nexport interface Rename {\n readonly from: string;\n readonly to: string;\n readonly field: string;\n readonly names: ReadonlySet<string>;\n}\n\n/**\n * Whether the rename can be made: not when the place already has the new name too. Renaming then\n * would give a map the same key twice, and one entry would be lost without a word (finding\n * M10), so the old entry is left and reported.\n */\nexport function isFree({ from, to, field, names }: Rename, findings: Findings): boolean {\n if (names.has(to)) {\n findings.manualSteps.push({ kind: \"name-collision\", field, from, to });\n return false;\n }\n return true;\n}\n\n/** An entry under another name whose spec is an `npm:` alias of an original package. */\nfunction migrateAlias(entry: SpecEntry, { map, version, findings }: MapContext): void {\n const migrated = entry.spec === undefined ? undefined : migrateNpmSpec(entry.spec.value, version);\n if (entry.spec === undefined || migrated === undefined) {\n return;\n }\n findings.edits.push(entry.spec.replace(migrated.spec));\n const spec = hideUrlCredentials(migrated.spec);\n findings.changes.push({ kind: \"alias-renamed\", field: mapLabel(map), name: entry.name, spec });\n if (migrated.isReported) {\n findings.manualSteps.push({ kind: \"spec-kept\", name: entry.name, spec });\n }\n}\n\nfunction renamedChange(map: SpecMap, from: string, to: string, spec: string): Change {\n switch (map.kind) {\n case \"dependencies\":\n return { kind: \"dependency-renamed\", field: map.field, from, to, spec };\n case \"catalog\":\n return { kind: \"catalog-entry-renamed\", catalog: map.catalog, from, to, spec };\n case \"imports\":\n return { kind: \"import-renamed\", field: map.field, from, to, target: spec };\n default:\n return assertNever(map);\n }\n}\n\nfunction migrateEntry(\n entry: SpecEntry,\n spec: SpecValue,\n to: string,\n { map, version, findings }: MapContext,\n): void {\n const old = spec.value;\n const migrated = migrateSpec(old, version);\n findings.edits.push(entry.renameKey(to));\n if (migrated.spec !== old) {\n findings.edits.push(spec.replace(migrated.spec));\n }\n findings.changes.push(renamedChange(map, entry.name, to, hideUrlCredentials(migrated.spec)));\n if (migrated.isReported) {\n findings.manualSteps.push({ kind: \"spec-kept\", name: to, spec: hideUrlCredentials(old) });\n }\n if (map.kind === \"dependencies\" && map.field === PEER_FIELD) {\n findings.manualSteps.push({ kind: \"peer-dependency-renamed\", name: to });\n }\n}\n\n/**\n * Why an entry keeps its old name to stay in step with a catalog, or undefined. A dependency on a\n * catalog entry that stays keeps the name it points at; a catalog entry that a dependency keeps\n * using stays too, so `catalog:` never points at a name the catalog does not have. A dependency\n * on an entry outside the project keeps its name too: the tool edits no file outside the root.\n */\nfunction catalogHold(entry: SpecEntry, spec: SpecValue, { map, catalogs }: MapContext) {\n if (map.kind === \"catalog\") {\n const isInUse = catalogs.inUse.has(map.name, entry.name);\n return isInUse\n ? ({ kind: \"catalog-entry-in-use\", catalog: map.catalog, name: entry.name } as const)\n : undefined;\n }\n const catalog = map.kind === \"dependencies\" ? catalogOfSpec(spec.value) : undefined;\n if (catalog === undefined) {\n return undefined;\n }\n const reference = { field: mapLabel(map), name: entry.name, catalog };\n if (!catalogs.defined.has(catalog, entry.name)) {\n const kind = catalogs.isWorkspaceRoot ? \"catalog-entry-missing\" : \"catalog-entry-outside\";\n return { kind, ...reference } as const;\n }\n return catalogs.kept.has(catalog, entry.name)\n ? ({ kind: \"catalog-reference-kept\", ...reference } as const)\n : undefined;\n}\n\n/**\n * A dependency on a local package (`workspace:*`, `link:`, `file:`) is that package, which only\n * shares the original name: under the new name it would point at a package the project lacks.\n */\nfunction localPackageHold(entry: SpecEntry, spec: SpecValue, { map }: MapContext) {\n return map.kind === \"dependencies\" && isLocalPackageSpec(spec.value)\n ? ({ kind: \"local-package\", field: map.field, name: entry.name, spec: spec.value } as const)\n : undefined;\n}\n\n/** Why an entry keeps its old name, or undefined when it is renamed. */\nconst holdOf = (entry: SpecEntry, spec: SpecValue, context: MapContext) =>\n localPackageHold(entry, spec, context) ?? catalogHold(entry, spec, context);\n\n/**\n * Rename the original packages of a dependency field or catalog, in place, with `version` as\n * the new version, and retarget `npm:` aliases of them. An entry whose value is not a string (a\n * YAML anchor or flow value) is not one the tool understands: it is left and reported.\n */\nexport function migrateSpecMap(entries: readonly SpecEntry[], context: MapContext): void {\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of entries) {\n const to = renamedKey(entry.name, context.map);\n const field = mapLabel(context.map);\n if (to === undefined) {\n migrateAlias(entry, context);\n continue;\n }\n if (!isFree({ from: entry.name, to, field, names }, context.findings)) {\n continue;\n }\n const hold = entry.spec === undefined ? undefined : holdOf(entry, entry.spec, context);\n if (entry.spec === undefined) {\n context.findings.manualSteps.push({ kind: \"entry-not-edited\", field, name: entry.name });\n } else if (hold !== undefined) {\n context.findings.manualSteps.push(hold);\n } else {\n migrateEntry(entry, entry.spec, to, context);\n }\n }\n}\n\n/** Rename the original packages where `field` only names them. */\nexport function renameNames(\n entries: readonly NameEntry[],\n field: string,\n findings: Findings,\n): void {\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of entries) {\n const to = PACKAGE_RENAMES.get(entry.name);\n if (to !== undefined && isFree({ from: entry.name, to, field, names }, findings)) {\n findings.edits.push(entry.rename(to));\n findings.changes.push({\n kind: \"package-name-renamed\",\n location: field,\n from: entry.name,\n to,\n });\n }\n }\n}\n","import {\n type TreeList,\n type TreeMap,\n type TreeNode,\n type TreeScalar,\n textEntries,\n} from \"./config-documents.js\";\nimport type { NameEntry, SpecEntry } from \"./dependency-map.js\";\nimport type { TextEdit } from \"./text-edits.js\";\n\n/**\n * The tree side of domain/dependency-map.ts: the entries of parsed maps and lists, with the edits\n * that replace their keys and values in place (domain/config-documents.ts).\n */\n\n/** A scalar that a whole new value can replace. */\ntype EditableScalar = TreeScalar & { readonly encode: (value: string) => string };\n\nconst isEditable = (node: TreeNode): node is EditableScalar =>\n node.kind === \"scalar\" && node.encode !== undefined;\n\n/** The edit that writes `value` where `scalar` is. */\nexport const replaceScalar = (scalar: EditableScalar, value: string): TextEdit => ({\n start: scalar.start,\n end: scalar.end,\n text: scalar.encode(value),\n});\n\n/**\n * The `name: spec` entries of a dependency map, catalog or import map. A key the tool cannot\n * replace is left out; a value it cannot replace gives an entry without a spec.\n */\nexport function specEntries(map: TreeMap): SpecEntry[] {\n return textEntries(map).flatMap(({ key, value }): SpecEntry[] => {\n if (!isEditable(key)) {\n return [];\n }\n const spec = isEditable(value)\n ? { value: value.value, replace: (to: string) => replaceScalar(value, to) }\n : undefined;\n return [{ name: key.value, spec, renameKey: (name) => replaceScalar(key, name) }];\n });\n}\n\n/** The keys of `map` that the tool can replace, as names. */\nexport function keyEntries(map: TreeMap): NameEntry[] {\n return textEntries(map)\n .map(({ key }) => key)\n .filter(isEditable)\n .map((key) => ({ name: key.value, rename: (name) => replaceScalar(key, name) }));\n}\n\n/** The text items of `list` that the tool can replace, as names. */\nexport function itemEntries(list: TreeList): NameEntry[] {\n return list.items\n .filter(isEditable)\n .map((item) => ({ name: item.value, rename: (name) => replaceScalar(item, name) }));\n}\n\n/**\n * The keys of `node` and of the maps in it, at any depth, in order. Override fields name\n * packages by their keys (domain/override-targets.ts).\n */\nexport function nestedKeys(node: TreeNode): string[] {\n if (node.kind !== \"map\") {\n return [];\n }\n return textEntries(node).flatMap(({ key, value }) => [key.value, ...nestedKeys(value)]);\n}\n","// Import maps point at no catalog, so no catalog plan applies to them.\nimport { NO_CATALOG_PLAN } from \"./catalog-plan.js\";\nimport {\n type DocumentRead,\n isMap,\n mapsAt,\n type TreeMap,\n textEntries,\n unreadableConfig,\n} from \"./config-documents.js\";\nimport { type Findings, migrateSpecMap, newFindings } from \"./dependency-map.js\";\nimport type { FileMigration } from \"./migration-findings.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { specEntries } from \"./tree-entries.js\";\n\n/**\n * Deno import maps: the `imports` and `scopes` of `deno.json` / `deno.jsonc`, and of a separate\n * `import_map.json`. Sources import the keys, and the migration renames the packages in sources,\n * so a key that names an original package (`openapi-fetch`, `openapi-fetch/`) gets the new name\n * too, and an `npm:` value gets the new package and version. A value it cannot replace (a URL) is\n * kept and reported. Deno reads these files as JSONC; they are edited in place\n * (domain/config-documents.ts).\n */\n\nconst IMPORTS_FIELD = \"imports\";\nconst SCOPES_FIELD = \"scopes\";\nconst FIELD_SEPARATOR = \".\";\n\nfunction migrateImports(config: TreeMap, version: string, findings: Findings): void {\n for (const imports of mapsAt(config, IMPORTS_FIELD)) {\n const map = { kind: \"imports\", field: IMPORTS_FIELD } as const;\n migrateSpecMap(specEntries(imports), { map, version, findings, catalogs: NO_CATALOG_PLAN });\n }\n for (const scopes of mapsAt(config, SCOPES_FIELD)) {\n for (const { key, value } of textEntries(scopes)) {\n if (isMap(value)) {\n const field = [SCOPES_FIELD, key.value].join(FIELD_SEPARATOR);\n const map = { kind: \"imports\", field } as const;\n migrateSpecMap(specEntries(value), { map, version, findings, catalogs: NO_CATALOG_PLAN });\n }\n }\n }\n}\n\nconst PATH_SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\n\n/** The keys of an import map, the module specifiers it maps. */\nfunction importMapKeys(config: TreeMap): string[] {\n const scoped = mapsAt(config, SCOPES_FIELD)\n .flatMap(textEntries)\n .flatMap(({ value }) => (isMap(value) ? [value] : []));\n return [...mapsAt(config, IMPORTS_FIELD), ...scoped]\n .flatMap(textEntries)\n .map(({ key }) => key.value);\n}\n\n/**\n * The package names that an import map declares for the sources that use it: `pkg` of the keys\n * `pkg`, `pkg/` and `pkg/subpath`, and `@scope/pkg` of scoped keys. Deno resolves a bare import\n * through the map, so such a package needs no `package.json` entry.\n */\nexport function importMapNames(config: TreeMap): string[] {\n return importMapKeys(config).map((key) => {\n const parts = key.split(PATH_SEPARATOR);\n return key.startsWith(SCOPE_PREFIX)\n ? parts.slice(0, 2).join(PATH_SEPARATOR)\n : (parts[0] ?? key);\n });\n}\n\n/** Migrate the import map of a Deno config or import map file (`read` is `text` parsed). */\nexport function migrateImportMap(text: string, read: DocumentRead, version: string): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const config of read.documents.filter(isMap)) {\n migrateImports(config, version, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import { type DocumentRead, isMap, isScalar, type TreeMap, valuesAt } from \"./config-documents.js\";\nimport type { ManualStep } from \"./migration-findings.js\";\nimport { referencedProjectPath } from \"./relative-references.js\";\n\n/**\n * A Deno config can keep its import map in another file and name it: `\"importMap\":\n * \"./deps.json\"`. Deno resolves the name against the folder of the config. A file in the project\n * is migrated as an import map; one the tool cannot edit (a URL, a path outside the project) is\n * reported, since the sources it maps get the new names.\n */\n\nconst IMPORT_MAP_FIELD = \"importMap\";\n\n/** Where the import map that a config names is, for a config at a project-relative path. */\nexport type ImportMapLocation =\n | { readonly kind: \"in-project\"; readonly path: string }\n | { readonly kind: \"not-editable\"; readonly reference: string };\n\n/** The `importMap` values of a config's roots, in order. */\nfunction importMapReferences(roots: readonly TreeMap[]): string[] {\n return roots\n .flatMap((root) => valuesAt(root, IMPORT_MAP_FIELD))\n .flatMap((value) => (isScalar(value) ? [value.value] : []));\n}\n\nexport function importMapLocation(configPath: string, reference: string): ImportMapLocation {\n const path = referencedProjectPath(configPath, reference);\n return path === undefined ? { kind: \"not-editable\", reference } : { kind: \"in-project\", path };\n}\n\n/** The import maps that the config at `configPath` names, read as `roots`. */\nexport const importMapLocations = (\n configPath: string,\n roots: readonly TreeMap[],\n): ImportMapLocation[] =>\n importMapReferences(roots).map((reference) => importMapLocation(configPath, reference));\n\n/** The manual steps for the import maps of a config that the tool cannot edit. */\nexport function importMapSteps(configPath: string, read: DocumentRead): ManualStep[] {\n const roots = read.kind === \"read\" ? read.documents.filter(isMap) : [];\n return importMapLocations(configPath, roots).flatMap((location) =>\n location.kind === \"not-editable\"\n ? [{ kind: \"import-map-not-editable\" as const, reference: location.reference }]\n : [],\n );\n}\n","import { type ImportedSpecifier, packageOfSpecifier } from \"./declared-packages.js\";\nimport { MigrationBugError } from \"./migration-bug.js\";\nimport {\n type Change,\n type FileMigration,\n lineLocator,\n type ManualStep,\n} from \"./migration-findings.js\";\nimport { isOldPackageNpmSpec, migrateNpmSpec } from \"./npm-alias.js\";\nimport {\n oldPackageInNodeModules,\n PACKAGE_RENAMES,\n type RenamedSpecifier,\n renamedSpecifier,\n} from \"./package-names.js\";\nimport { hideUrlCredentials } from \"./url-credentials.js\";\n\n/**\n * A string literal of a source file, as a parser finds it. `start` and `end` are the offsets of\n * its value, inside the quotes. `isModuleSpecifier` is true where the string names a module:\n * `import … from`, `export … from`, `import()`, `require()`, `import x = require()`,\n * `import(\"…\")` types and JSDoc `@import` tags, `declare module`, `/// <reference types>` and the\n * module mocks of vitest, jest and bun. Strings nest: a template with substitutions spans its\n * text as written, so the strings inside its `${…}` lie within it.\n */\nexport interface SourceString {\n readonly start: number;\n readonly end: number;\n readonly value: string;\n readonly isModuleSpecifier: boolean;\n}\n\n/** Source file extensions whose text can hold module specifiers. */\nexport const SOURCE_EXTENSIONS: ReadonlySet<string> = new Set([\n \".ts\",\n \".tsx\",\n \".mts\",\n \".cts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".vue\",\n \".svelte\",\n \".astro\",\n \".mdx\",\n]);\n\n/** A renamed specifier; `keptSpec` is the old spec when its range could not be replaced. */\ninterface RenamedValue extends RenamedSpecifier {\n readonly keptSpec?: string;\n}\n\n/**\n * The new specifier: a package name or subpath, or a Deno `npm:` specifier\n * (`npm:openapi-fetch@^0.13`), which gets the new package and version.\n */\nfunction renamedValue(value: string, version: string): RenamedValue | undefined {\n const npm = migrateNpmSpec(value, version);\n if (npm === undefined) {\n return renamedSpecifier(value);\n }\n const renamed = { to: npm.spec, isDeep: npm.isDeep };\n return npm.isReported ? { ...renamed, keptSpec: hideUrlCredentials(value) } : renamed;\n}\n\n/**\n * Whether the migration renames a string with this value, or reports it as one that names a\n * package: an old package name or subpath, or an `npm:` specifier of one.\n */\nexport const namesRenamedModule = (value: string): boolean =>\n isOldPackageNpmSpec(value) || renamedSpecifier(value) !== undefined;\n\nconst TEMPLATE_SUBSTITUTION = \"${\";\n\n/**\n * The new name of an original package that a template specifier ends its name with, right before\n * a substitution (`openapi-fetch${suffix}`). The substitution may go on with the name or start a\n * subpath, so only the user knows what to write; undefined for any other specifier.\n */\nfunction dynamicPackage(value: string): string | undefined {\n const at = value.indexOf(TEMPLATE_SUBSTITUTION);\n return at === -1 ? undefined : PACKAGE_RENAMES.get(value.slice(0, at));\n}\n\n/** Outer strings first: a string that holds another starts no later and ends no earlier. */\nconst byStartThenOuter = (left: SourceString, right: SourceString): number =>\n left.start - right.start || right.end - left.end;\n\n/**\n * The strings in file order, outer before inner, each span once. A span found twice (two scripts\n * of a component that overlap) is one string, and a module specifier if either finding says so.\n * Spans may nest, as a template holds the strings of its substitutions; spans that cross cannot\n * both be replaced: that is a scanner bug, and editing on would corrupt the file.\n */\nfunction distinctStrings(strings: readonly SourceString[]): SourceString[] {\n const distinct: SourceString[] = [];\n const enclosing: SourceString[] = [];\n for (const found of [...strings].sort(byStartThenOuter)) {\n const previous = distinct.at(-1);\n if (previous?.start === found.start && previous.end === found.end) {\n const isModuleSpecifier = previous.isModuleSpecifier || found.isModuleSpecifier;\n distinct[distinct.length - 1] = { ...previous, isModuleSpecifier };\n continue;\n }\n let outer = enclosing.at(-1);\n while (outer !== undefined && outer.end <= found.start) {\n enclosing.pop();\n outer = enclosing.at(-1);\n }\n if (outer !== undefined && found.end > outer.end) {\n throw new MigrationBugError(\n `source strings overlap at offsets ${outer.start}-${outer.end} and ` +\n `${found.start}-${found.end}`,\n );\n }\n enclosing.push(found);\n distinct.push(found);\n }\n return distinct;\n}\n\nconst dynamicStep = (line: number, value: string, to: string): ManualStep => ({\n kind: \"dynamic-specifier\",\n line,\n value,\n to,\n});\n\n/**\n * The steps for a string that is not renamed: a module name built at run time from an old\n * package name, or a path into the installed files of an old package, which the new package\n * does not have there.\n */\nfunction unrenamedSteps(found: SourceString, line: number, dynamic: string | undefined) {\n if (dynamic !== undefined) {\n return [dynamicStep(line, found.value, dynamic)];\n }\n const name = found.isModuleSpecifier ? oldPackageInNodeModules(found.value) : undefined;\n const to = name === undefined ? undefined : PACKAGE_RENAMES.get(name);\n return name === undefined || to === undefined\n ? []\n : [{ kind: \"old-package-import\" as const, line, specifier: found.value, name, to }];\n}\n\n/**\n * Rename the original packages where a source file names them as modules. A string that equals a\n * package name anywhere else (an object key, a label, a config value) may mean the package or\n * may not, so it is reported, not changed. Comments are not strings and stay as written. The\n * `kept` packages stay: the file's manifest points them at a local package of that name.\n */\nexport function migrateModuleSpecifiers(\n text: string,\n strings: readonly SourceString[],\n version: string,\n kept: ReadonlySet<string> = new Set(),\n): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n let migrated = \"\";\n let copiedUpTo = 0;\n const lineOf = lineLocator(text);\n for (const found of distinctStrings(strings)) {\n const isKept = kept.has(packageOfSpecifier(found.value));\n const renamed = isKept ? undefined : renamedValue(found.value, version);\n const line = lineOf(found.start);\n const dynamic = found.isModuleSpecifier ? dynamicPackage(found.value) : undefined;\n if (renamed === undefined) {\n manualSteps.push(...unrenamedSteps(found, line, dynamic));\n continue;\n }\n // A string inside a template that was replaced is part of the replacement, which keeps it as\n // written, so it can only be reported.\n if (!found.isModuleSpecifier || found.start < copiedUpTo) {\n manualSteps.push({ kind: \"string-names-package\", line, value: found.value, to: renamed.to });\n continue;\n }\n changes.push({ kind: \"specifier-renamed\", line, from: found.value, to: renamed.to });\n // A deep import reaches into the package's files, whose layout is not part of the contract.\n if (renamed.isDeep) {\n manualSteps.push({ kind: \"deep-import\", line, specifier: renamed.to });\n }\n if (renamed.keptSpec !== undefined) {\n manualSteps.push({ kind: \"spec-kept\", name: renamed.to, spec: renamed.keptSpec });\n }\n migrated += `${text.slice(copiedUpTo, found.start)}${renamed.to}`;\n copiedUpTo = found.end;\n }\n return { text: migrated + text.slice(copiedUpTo), changes, manualSteps };\n}\n\n/**\n * The module specifiers of a source file as the migration leaves them: an original package with\n * its new name, any other specifier as written, each with its line.\n */\nexport function importedSpecifiers(\n text: string,\n strings: readonly SourceString[],\n): ImportedSpecifier[] {\n const lineOf = lineLocator(text);\n return strings\n .filter((found) => found.isModuleSpecifier)\n .map((found) => ({\n specifier: renamedSpecifier(found.value)?.to ?? found.value,\n line: lineOf(found.start),\n }));\n}\n","import {\n type DocumentPath,\n type DocumentRead,\n isMap,\n type TreeNode,\n textEntries,\n} from \"./config-documents.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { namesRenamedModule, type SourceString } from \"./source-migration.js\";\n\n/**\n * Jest names packages inside patterns: `moduleNameMapper: { \"^openapi-fetch$\": … }`,\n * `transformIgnorePatterns: [\"node_modules/(?!(openapi-fetch)/)\"]`. A pattern is not a module\n * specifier, and whether it should match the new name is the user's call, so each one that names\n * an old package is reported, never changed: in `jest.config.*`, and in the `jest` field of\n * package.json.\n */\n\n/** The names Jest looks for its config under. */\nconst JEST_CONFIG_RE = /^jest\\.config\\.(?:[cm]?[jt]s|json)$/;\nexport const JEST_FIELD = \"jest\";\n/** A character that a package name can go on with; a name in a pattern is not followed by one. */\nconst NAME_CHARACTER_RE = /[\\w-]/;\nconst FIELD_SEPARATOR = \".\";\n\nexport const isJestConfig = (fileName: string): boolean => JEST_CONFIG_RE.test(fileName);\n\n/** Whether `name` is in `value` as a whole package name, not a part of a longer one. */\nfunction hasWholeName(value: string, name: string): boolean {\n for (let at = value.indexOf(name); at !== -1; at = value.indexOf(name, at + 1)) {\n const before = value[at - 1] ?? \"\";\n const after = value[at + name.length] ?? \"\";\n if (!NAME_CHARACTER_RE.test(before) && !NAME_CHARACTER_RE.test(after)) {\n return true;\n }\n }\n return false;\n}\n\n/** The old packages that a pattern names, in the order of PACKAGE_RENAMES. */\nexport const oldPackagesInPattern = (value: string): string[] =>\n [...PACKAGE_RENAMES.keys()].filter((name) => hasWholeName(value, name));\n\n/**\n * The steps for the old packages a pattern names. `isNameReported` is true where a string that is\n * a module name is reported already: the source migration reports such a string of a script\n * (`\"openapi-fetch\"`, `\"openapi-fetch/$1\"`) as a string that names the package. Nothing reports a\n * JSON value, so there it is a step too.\n */\nconst patternSteps = (value: string, location: string, isNameReported: boolean): ManualStep[] =>\n isNameReported && namesRenamedModule(value)\n ? []\n : oldPackagesInPattern(value).map((name) => ({\n kind: \"pattern-names-package\",\n location,\n value,\n name,\n to: PACKAGE_RENAMES.get(name) ?? name,\n }));\n\n/** The steps for the strings of a Jest config script that are not module specifiers. */\nexport function jestScriptSteps(text: string, strings: readonly SourceString[]): ManualStep[] {\n const lineOf = lineLocator(text);\n return strings\n .filter((string) => !string.isModuleSpecifier)\n .flatMap((string) => patternSteps(string.value, `line ${lineOf(string.start)}`, true));\n}\n\n/** The keys and string values of `node` with the key path they are at. */\nfunction textsAt(node: TreeNode, path: DocumentPath): { value: string; path: DocumentPath }[] {\n switch (node.kind) {\n case \"scalar\":\n return [{ value: node.value, path }];\n case \"list\":\n return node.items.flatMap((item, index) => textsAt(item, [...path, index]));\n case \"map\":\n return textEntries(node).flatMap(({ key, value }) => [\n { value: key.value, path },\n ...textsAt(value, [...path, key.value]),\n ]);\n default:\n return [];\n }\n}\n\n/** The steps for a Jest config in JSON: `node` at `path` (`[\"jest\"]` in package.json). */\nexport const jestConfigSteps = (node: TreeNode, path: DocumentPath): ManualStep[] =>\n textsAt(node, path).flatMap(({ value, path: at }) =>\n patternSteps(value, at.join(FIELD_SEPARATOR), false),\n );\n\n/** The steps for `jest.config.json`, read as `read`. */\nexport const jestJsonSteps = (read: DocumentRead): ManualStep[] =>\n read.kind === \"read\"\n ? read.documents.filter(isMap).flatMap((root) => jestConfigSteps(root, []))\n : [];\n","import { migrateCommand } from \"./command-migration.js\";\nimport { type CommandPathPattern, isCommandPath } from \"./command-paths.js\";\nimport type { DocumentString } from \"./config-documents.js\";\nimport type { Change, FileMigration, ManualStep } from \"./migration-findings.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\n\n/**\n * Commands in JSON configs, at the paths of domain/command-paths.ts. Only the strings at those\n * paths are migrated, and each is replaced in place, so the rest of the file keeps its formatting.\n */\n\n/** Migrate the command strings of a JSON config whose key paths match one of `patterns`. */\nexport function migrateJsonCommands(\n text: string,\n strings: readonly DocumentString[],\n patterns: readonly CommandPathPattern[],\n): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n const edits: TextEdit[] = [];\n for (const found of strings.filter((string) => isCommandPath(string.path, patterns))) {\n const migrated = migrateCommand(found.value, found.path.join(\".\"));\n changes.push(...migrated.changes);\n manualSteps.push(...migrated.manualSteps);\n if (migrated.text !== found.value) {\n edits.push({ start: found.start, end: found.end, text: JSON.stringify(migrated.text) });\n }\n }\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import type { AppendedValue } from \"./argument-findings.js\";\nimport type { VariableProgramUse } from \"./file-variables.js\";\nimport { runsGenerator } from \"./file-variables.js\";\nimport type { JustLiteral } from \"./just-expressions.js\";\nimport { type ShellCommand, shellCommands, shellCommandsAt } from \"./shell-words.js\";\nimport type { ProgramDefinition, VariableProgram } from \"./variable-programs.js\";\n\n/**\n * A justfile value that joins strings and variables with `+` (`gen := \"npx openapi-typescript\" +\n * \" -it\"`). just puts the joined value into a recipe line before the shell splits it, so the text\n * of each string after the first is appended to the command of the first: its words are arguments\n * of that program, not a command of their own. When every later part is a string joined at a\n * blank, the first part holds the program; a variable or a join inside a word can change the\n * program word, so the value is computed and the flags in its later strings are reported.\n */\n\n/** A part of a `+` concatenation: a string literal or the name of a variable. */\nexport type JustOperand =\n | { readonly kind: \"literal\"; readonly literal: JustLiteral }\n | { readonly kind: \"name\"; readonly name: string };\n\nconst NAME_RE = /[A-Za-z_][A-Za-z0-9_-]*/y;\nconst BLANK_RE = /[ \\t]*/y;\nconst BLANK_EDGE_RE = /^[ \\t]|[ \\t]$/;\nconst PLUS = \"+\";\n\n/** The offset after the blanks at `index`. */\nfunction afterBlanks(text: string, index: number): number {\n BLANK_RE.lastIndex = index;\n BLANK_RE.exec(text);\n return BLANK_RE.lastIndex;\n}\n\n/** The operand at `index` and the offset after it, or undefined for any other expression. */\nfunction operandAt(\n text: string,\n index: number,\n literals: readonly JustLiteral[],\n): { readonly operand: JustOperand; readonly end: number } | undefined {\n const literal = literals.find((found) => found.start === index);\n if (literal !== undefined) {\n return literal.kind === \"string\"\n ? { operand: { kind: \"literal\", literal }, end: literal.end }\n : undefined;\n }\n NAME_RE.lastIndex = index;\n const name = NAME_RE.exec(text)?.[0];\n return name === undefined\n ? undefined\n : { operand: { kind: \"name\", name }, end: index + name.length };\n}\n\n/** Where a value is in the text, and the literals the expression has. */\nexport interface JustValue {\n readonly start: number;\n readonly end: number;\n readonly literals: readonly JustLiteral[];\n}\n\n/**\n * The operands of a value that only joins strings and names with `+`, or undefined for one part\n * or any other expression (a function call, an `if`, a backtick), which just computes.\n */\nexport function concatenationOperands(text: string, value: JustValue): JustOperand[] | undefined {\n const operands: JustOperand[] = [];\n for (let index = afterBlanks(text, value.start); index < value.end; ) {\n const found = operandAt(text, index, value.literals);\n if (found === undefined) {\n return undefined;\n }\n operands.push(found.operand);\n index = afterBlanks(text, found.end);\n const isLast = index >= value.end;\n if (!isLast && text[index] !== PLUS) {\n return undefined;\n }\n index = isLast ? index : afterBlanks(text, index + 1);\n }\n return operands.length > 1 ? operands : undefined;\n}\n\n/** Whether a literal ends with a blank, so a part joined after it starts a new word. */\nconst isBlankEnd = (literal: JustLiteral): boolean => BLANK_EDGE_RE.test(literal.content.slice(-1));\n\n/**\n * Whether the first part of a concatenation holds the program: every later part is a string\n * joined at a blank, so no word spans a join and the program word stays the first part's.\n */\nexport function isFirstPartProgram(operands: readonly JustOperand[]): boolean {\n return operands.slice(1).every((operand, index) => {\n const previous = operands[index];\n if (operand.kind !== \"literal\") {\n return false;\n }\n const isBlankStart = BLANK_EDGE_RE.test(operand.literal.content.slice(0, 1));\n return isBlankStart || (previous?.kind === \"literal\" && isBlankEnd(previous.literal));\n });\n}\n\n/** Whether a literal is a string whose text, read as a command line, runs the generator. */\nexport const stringRunsGenerator = (literal: JustLiteral): boolean =>\n literal.kind === \"string\" && shellCommands(literal.content).some(runsGenerator);\n\n/** What the first part of a concatenation sets the variable to, when it holds the program. */\nexport function firstOperandDefinition(name: string, operand: JustOperand): ProgramDefinition {\n return operand.kind === \"name\"\n ? { name, kind: \"reference\", target: operand.name }\n : { name, kind: \"command\", runsGenerator: stringRunsGenerator(operand.literal) };\n}\n\n/** What the first part of a concatenation runs: a variable's program, or a string's. */\nfunction partProgram(\n operand: JustOperand,\n programs: ReadonlyMap<string, VariableProgram>,\n): VariableProgram {\n if (operand.kind === \"name\") {\n return programs.get(operand.name) ?? \"generator-or-other\";\n }\n return stringRunsGenerator(operand.literal) ? \"generator\" : \"other\";\n}\n\n/** The literals after the first part: text appended to the value. */\nconst appendedLiterals = (operands: readonly JustOperand[]): JustLiteral[] =>\n operands.slice(1).flatMap((operand) => (operand.kind === \"literal\" ? [operand.literal] : []));\n\n/** The value read as text: the contents of its strings, joined as just joins them. */\nexport const concatenationText = (operands: readonly JustOperand[]): string =>\n operands.map((operand) => (operand.kind === \"literal\" ? operand.literal.content : \"\")).join(\"\");\n\n/** A value of a justfile variable, with the parts of a concatenation. */\nexport interface ConcatenatedValue {\n readonly name: string;\n readonly literals: readonly JustLiteral[];\n readonly operands: readonly JustOperand[] | undefined;\n}\n\n/** The literals of values that are command lines where written: not appended text. */\nexport function commandLiterals(values: readonly ConcatenatedValue[]): JustLiteral[] {\n const appended = new Set(values.flatMap(({ operands }) => appendedLiterals(operands ?? [])));\n return values.flatMap(({ literals }) => literals).filter((found) => !appended.has(found));\n}\n\n/** The text appended in one concatenation, after the program `use` names. */\nfunction concatenationAppends(operands: readonly JustOperand[], use: VariableProgramUse) {\n const parts = appendedLiterals(operands).map((literal) =>\n shellCommandsAt(literal.content, literal.contentStart),\n );\n return {\n appended: parts.map(([words]): AppendedValue => ({ words: words ?? [], program: use })),\n // A later command (after a `;` in the string) is one of its own in the recipe line.\n commands: parts.flatMap((commands) => commands.slice(1)),\n };\n}\n\n/** The appended text of concatenations, and the commands after it. */\nexport interface Concatenations {\n readonly appended: readonly AppendedValue[];\n readonly commands: readonly ShellCommand[];\n}\n\n/**\n * The text appended in concatenations: after the program of the first part when it holds the\n * program, else after the program of the computed variable.\n */\nexport function concatenationsOf(\n values: readonly ConcatenatedValue[],\n programs: ReadonlyMap<string, VariableProgram>,\n): Concatenations {\n const parts = values.flatMap(({ name, operands }) => {\n const [first] = operands ?? [];\n if (operands === undefined || first === undefined) {\n return [];\n }\n const isFirst = isFirstPartProgram(operands);\n const program = isFirst\n ? partProgram(first, programs)\n : (programs.get(name) ?? \"generator-or-other\");\n return [concatenationAppends(operands, { written: name, program })];\n });\n return {\n appended: parts.flatMap((part) => part.appended),\n commands: parts.flatMap((part) => part.commands),\n };\n}\n","/**\n * The literals of just expressions: in a variable's value (`gen := env_var_or_default(\"GEN\",\n * \"npx openapi-typescript\")`), in a recipe parameter's default (`types gen=\"npx …\":`) and in an\n * interpolation (`{{ \"npx …\" }}`). A string can become command text of a recipe line, and a\n * backtick is a command that just runs, so their text is read as command lines where it is\n * written. Which literal an expression evaluates to (an `if`, a function call, the environment)\n * is known only when just runs.\n */\n\n/** A string literal or a backtick, with the place of its text between the delimiters. */\nexport interface JustLiteral {\n readonly kind: \"string\" | \"backtick\";\n /** The offset of the opening delimiter. */\n readonly start: number;\n /** The offset after the closing delimiter. */\n readonly end: number;\n readonly contentStart: number;\n /** The text between the delimiters as written: an escape (`\\\"`) stays two characters. */\n readonly content: string;\n}\n\n/** The delimiters of just, the indented (tripled) forms first. */\nconst DELIMITERS: readonly string[] = ['\"\"\"', \"'''\", \"```\", '\"', \"'\", \"`\"];\nconst BACKTICK = \"`\";\n/** The one delimiter in which just reads escapes, so `\\\"` does not end the string. */\nconst ESCAPING_DELIMITER = '\"';\nconst ESCAPE = \"\\\\\";\nconst COMMENT_START = \"#\";\nconst LINE_BREAK = \"\\n\";\n\n/** The end of the text that a delimiter at `from` closes, or undefined when it is not closed. */\nfunction closingOffset(text: string, delimiter: string, from: number): number | undefined {\n if (delimiter !== ESCAPING_DELIMITER) {\n const close = text.indexOf(delimiter, from);\n return close === -1 ? undefined : close;\n }\n for (let index = from; index < text.length; index += 1) {\n const char = text[index];\n if (char === ESCAPE) {\n index += 1;\n } else if (char === ESCAPING_DELIMITER || char === LINE_BREAK) {\n return char === ESCAPING_DELIMITER ? index : undefined;\n }\n }\n return undefined;\n}\n\n/** The literal that starts at `offset`, or undefined when none does. */\nexport function literalAt(text: string, offset: number): JustLiteral | undefined {\n const delimiter = DELIMITERS.find((candidate) => text.startsWith(candidate, offset));\n if (delimiter === undefined) {\n return undefined;\n }\n const contentStart = offset + delimiter.length;\n const close = closingOffset(text, delimiter, contentStart);\n if (close === undefined) {\n return undefined;\n }\n const kind = delimiter.startsWith(BACKTICK) ? \"backtick\" : \"string\";\n const content = text.slice(contentStart, close);\n return { kind, start: offset, end: close + delimiter.length, contentStart, content };\n}\n\n/** The literals of an expression and the offset where it ends. */\nexport interface JustExpression {\n readonly literals: readonly JustLiteral[];\n readonly end: number;\n}\n\n/**\n * The expression from `start` to the end of its line, before a comment: a literal that spans\n * lines (`\"\"\"…\"\"\"`) moves the end to the line where it closes.\n */\nexport function expressionAt(text: string, start: number): JustExpression {\n const literals: JustLiteral[] = [];\n let index = start;\n while (index < text.length && text[index] !== LINE_BREAK && text[index] !== COMMENT_START) {\n const literal = literalAt(text, index);\n literals.push(...(literal === undefined ? [] : [literal]));\n index = literal?.end ?? index + 1;\n }\n return { literals, end: index };\n}\n\n/** The literals between `start` and `end`, which no literal crosses (a parameter default). */\nexport function literalsBetween(text: string, start: number, end: number): JustLiteral[] {\n const literals: JustLiteral[] = [];\n for (let index = start; index < end; ) {\n const literal = literalAt(text, index);\n literals.push(...(literal === undefined ? [] : [literal]));\n index = literal?.end ?? index + 1;\n }\n return literals;\n}\n\n/** An interpolation of a recipe line, `{{…}}`, with the literals of its expression. */\nexport interface JustInterpolation {\n readonly start: number;\n readonly end: number;\n readonly literals: readonly JustLiteral[];\n}\n\nconst INTERPOLATION_OPEN = \"{{\";\nconst INTERPOLATION_CLOSE = \"}}\";\n\n/** The interpolation that opens at `start`, or undefined when its line does not close it. */\nfunction interpolationAt(text: string, start: number): JustInterpolation | undefined {\n const literals: JustLiteral[] = [];\n for (let index = start + INTERPOLATION_OPEN.length; index < text.length; ) {\n if (text.startsWith(INTERPOLATION_CLOSE, index)) {\n return { start, end: index + INTERPOLATION_CLOSE.length, literals };\n }\n if (text[index] === LINE_BREAK) {\n return undefined;\n }\n const literal = literalAt(text, index);\n literals.push(...(literal === undefined ? [] : [literal]));\n index = literal?.end ?? index + 1;\n }\n return undefined;\n}\n\n/** The interpolations of a text in order; a `}}` inside a literal does not close one. */\nexport function interpolationsOf(text: string): JustInterpolation[] {\n const found: JustInterpolation[] = [];\n for (let open = text.indexOf(INTERPOLATION_OPEN); open !== -1; ) {\n const interpolation = interpolationAt(text, open);\n found.push(...(interpolation === undefined ? [] : [interpolation]));\n const next = interpolation?.end ?? open + INTERPOLATION_OPEN.length;\n open = text.indexOf(INTERPOLATION_OPEN, next);\n }\n return found;\n}\n","import { type JustLiteral, literalAt, literalsBetween } from \"./just-expressions.js\";\n\n/**\n * The parameters of justfile recipes: `types gen=\"npx openapi-typescript\" *args:`. A parameter is\n * a variable of its recipe's lines (`{{gen}}`), set by its default or by the command line\n * (`just types other`), so its value can always be another program.\n */\n\n/** A parameter with a default: its name, the literals of the default, the variable it names. */\nexport interface ParameterDefault {\n readonly name: string;\n /** Whether the recipe exports it to its shell (`$name=…`), which reads it as `$name`. */\n readonly isExported: boolean;\n readonly literals: readonly JustLiteral[];\n /** The variable that the default is (`gen=other`), or undefined for another expression. */\n readonly target: string | undefined;\n}\n\n/** A recipe's header up to its colon, which just reads and no shell does. */\nexport interface RecipeHeader {\n readonly start: number;\n readonly end: number;\n readonly defaults: readonly ParameterDefault[];\n}\n\n/** The recipe name at the start of a line, with the quiet `@` prefix. */\nconst RECIPE_NAME_RE = /^@?[A-Za-z_][A-Za-z0-9_-]*(?=[ \\t:])/gm;\n/** One parameter: its kind prefix (`+`, `*`, `$`), its name and its default. */\nconst PARAMETER_RE = /^([+*$]*)([A-Za-z_][A-Za-z0-9_-]*)(?:=([\\s\\S]*))?$/;\nconst EXPORT_PREFIX = \"$\";\nconst NAME_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;\nconst COLON = \":\";\nconst EQUALS = \"=\";\nconst OPEN_PAREN = \"(\";\nconst CLOSE_PAREN = \")\";\nconst COMMENT_START = \"#\";\nconst LINE_BREAK = \"\\n\";\nconst BLANK_RE = /[ \\t]/;\n\n/** How a character changes the depth of parentheses. */\nconst depthChange = (char: string | undefined): number =>\n char === OPEN_PAREN ? 1 : char === CLOSE_PAREN ? -1 : 0;\n\n/** A word of the parameter list: its place, literals and parentheses kept whole. */\ninterface ParameterWord {\n readonly start: number;\n readonly end: number;\n}\n\n/**\n * The colon that ends the header that starts at `from`, or undefined when the line is not a\n * header: `:=` (a `set` or an `alias`) or a comment comes first, or the line has no colon.\n */\nfunction headerColon(text: string, from: number): number | undefined {\n for (let index = from; index < text.length && text[index] !== LINE_BREAK; ) {\n const literal = literalAt(text, index);\n const char = text[index];\n if (literal !== undefined) {\n index = literal.end;\n continue;\n }\n if (char === COMMENT_START || (char === COLON && text[index + 1] === EQUALS)) {\n return undefined;\n }\n if (char === COLON) {\n return index;\n }\n index += 1;\n }\n return undefined;\n}\n\n/** The words between `start` and `end`, split at blanks outside literals and parentheses. */\nfunction parameterWords(text: string, start: number, end: number): ParameterWord[] {\n const words: ParameterWord[] = [];\n let wordStart: number | undefined;\n let depth = 0;\n for (let index = start; index < end; ) {\n const isBreak = depth === 0 && BLANK_RE.test(text[index] ?? \"\");\n if (isBreak && wordStart !== undefined) {\n words.push({ start: wordStart, end: index });\n }\n wordStart = isBreak ? undefined : (wordStart ?? index);\n const literal = isBreak ? undefined : literalAt(text, index);\n depth += literal === undefined ? depthChange(text[index]) : 0;\n index = literal?.end ?? index + 1;\n }\n return wordStart === undefined ? words : [...words, { start: wordStart, end }];\n}\n\nfunction parameterDefault(text: string, word: ParameterWord): ParameterDefault[] {\n const written = text.slice(word.start, word.end);\n const match = PARAMETER_RE.exec(written);\n const value = match?.[3];\n if (match === null || value === undefined) {\n return [];\n }\n const defaultStart = word.end - value.length;\n const literals = literalsBetween(text, defaultStart, word.end);\n const target = NAME_RE.test(value) ? value : undefined;\n const isExported = (match[1] as string).includes(EXPORT_PREFIX);\n return [{ name: match[2] as string, isExported, literals, target }];\n}\n\n/** The recipe headers of a justfile with the defaults of their parameters. */\nexport function recipeHeaders(text: string): RecipeHeader[] {\n return [...text.matchAll(RECIPE_NAME_RE)].flatMap((match) => {\n const nameEnd = match.index + match[0].length;\n const colon = headerColon(text, nameEnd);\n if (colon === undefined) {\n return [];\n }\n const words = parameterWords(text, nameEnd, colon);\n const defaults = words.flatMap((word) => parameterDefault(text, word));\n return [{ start: match.index, end: colon, defaults }];\n });\n}\n","import type { Locate, ShellTextFindings } from \"./command-migration.js\";\nimport type { DocumentPath, DocumentString } from \"./config-documents.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\n\n/**\n * A CI step can name the program that runs its script: GitHub Actions `shell: python` next to\n * `run`, or as `defaults.run.shell` of the job or the workflow; CircleCI `shell` next to\n * `command`, of the job, or of the executor the job runs on. A script for a program other than a\n * shell is code of that language, so the command migration leaves it as it is and reports it\n * when it names an old package.\n */\n\n/** The key of a CI step or job that names the program its scripts go to. */\nconst STEP_SHELL_KEY = \"shell\";\n/** GitHub Actions' default shell of a job or a workflow: `defaults.run.shell`. */\nconst DEFAULT_SHELL_PATH: readonly string[] = [\"defaults\", \"run\", STEP_SHELL_KEY];\n/**\n * Shells whose scripts are command lines as the tool reads them: POSIX shells, PowerShell, cmd,\n * and the wrappers that run bash on Windows (`msys2 {0}` of setup-msys2, `wsl-bash {0}` of\n * setup-wsl).\n */\nconst COMMAND_LINE_SHELLS: ReadonlySet<string> = new Set([\n ...[\"sh\", \"bash\", \"dash\", \"ash\", \"zsh\", \"ksh\"],\n ...[\"pwsh\", \"powershell\", \"cmd\"],\n ...[\"msys2\", \"wsl-bash\"],\n]);\n/** `env` runs the program after its options and assignments (`/usr/bin/env bash -e {0}`). */\nconst ENV_PROGRAM = \"env\";\n/** The options of `env` that take the next word as their value. */\nconst ENV_OPTIONS_WITH_VALUE: ReadonlySet<string> = new Set([\"-u\", \"--unset\", \"-C\", \"--chdir\"]);\nconst OPTION_START = \"-\";\nconst ASSIGNMENT = \"=\";\nconst PATH_SEPARATOR_RE = /[/\\\\]/;\nconst WINDOWS_EXECUTABLE_RE = /\\.exe$/i;\nconst WHITESPACE_RE = /\\s+/;\n/** CircleCI's top-level map of executors, each of which may name a `shell`. */\nconst EXECUTORS_KEY = \"executors\";\n/** The keys of the path of an executor's shell: `executors`, the executor name, `shell`. */\nconst EXECUTOR_SHELL_PATH_LENGTH = 3;\n/** The key of a CircleCI job that names its executor: `executor: py`. */\nconst EXECUTOR_KEY = \"executor\";\n/** The key of the executor name in the map form: `executor: { name: py }`. */\nconst EXECUTOR_NAME_KEY = \"name\";\n\n/** The `shell` of the step that a script belongs to, when it is not a shell. */\nexport type StepShellOf = (value: DocumentString) => string | undefined;\n\n/** The name of a program word: `bash` of `/usr/bin/bash` and of `C:\\msys64\\bin\\bash.exe`. */\nconst programName = (word: string): string =>\n (word.split(PATH_SEPARATOR_RE).at(-1) ?? \"\").replace(WINDOWS_EXECUTABLE_RE, \"\");\n\n/** The number of words after `env` before its program: options, their values, assignments. */\nfunction envPrefixLength(words: readonly string[]): number {\n let index = 0;\n while (index < words.length) {\n const word = words[index] ?? \"\";\n if (ENV_OPTIONS_WITH_VALUE.has(word)) {\n index += 2;\n } else if (word.startsWith(OPTION_START) || word.includes(ASSIGNMENT)) {\n index += 1;\n } else {\n break;\n }\n }\n return index;\n}\n\n/** The program of a `shell` value (`python`, `bash -e {0}`, `/usr/bin/env bash -e {0}`). */\nfunction shellProgram(shell: string): string {\n const words = shell.trim().split(WHITESPACE_RE);\n const first = programName(words[0] ?? \"\");\n if (first !== ENV_PROGRAM) {\n return first;\n }\n const rest = words.slice(1);\n return programName(rest[envPrefixLength(rest)] ?? \"\");\n}\n\n/** Whether a `shell` value or a shebang runs a shell whose scripts the tool reads as commands. */\nexport const isCommandLineShell = (shell: string): boolean =>\n COMMAND_LINE_SHELLS.has(shellProgram(shell));\n\n/** Whether a document path ends with `keys`. */\nconst endsWith = (path: DocumentPath, keys: readonly string[]): boolean =>\n keys.every((key, index) => path[path.length - keys.length + index] === key);\n\nconst isDefaultShell = (value: DocumentString): boolean => endsWith(value.path, DEFAULT_SHELL_PATH);\n\n/**\n * The map whose scripts a `shell` value is for, as a key: the step or job of a `shell` key, the\n * job or workflow of `defaults.run.shell`.\n */\nfunction scopeOf(value: DocumentString): string {\n const keys = isDefaultShell(value) ? DEFAULT_SHELL_PATH.length : 1;\n return JSON.stringify(value.path.slice(0, -keys));\n}\n\n/** The `shell` of each CircleCI executor (`executors.py.shell`), by executor name. */\nfunction executorShells(shells: readonly DocumentString[]): ReadonlyMap<string, string> {\n const isExecutorShell = ({ path }: DocumentString): boolean =>\n path.length === EXECUTOR_SHELL_PATH_LENGTH && path[0] === EXECUTORS_KEY;\n return new Map(\n shells.filter(isExecutorShell).map((shell) => [String(shell.path[1]), shell.value]),\n );\n}\n\n/** The path of the job that a CircleCI `executor` value belongs to, or undefined. */\nfunction executorJob({ path }: DocumentString): DocumentPath | undefined {\n if (path.at(-1) === EXECUTOR_KEY) {\n return path.slice(0, -1);\n }\n const isNamed = path.at(-1) === EXECUTOR_NAME_KEY && path.at(-2) === EXECUTOR_KEY;\n return isNamed ? path.slice(0, -2) : undefined;\n}\n\n/**\n * The shells that CircleCI jobs take from their executor, by the scope of the job. A job's own\n * `shell` goes after these and wins.\n */\nfunction inheritedShells(strings: readonly DocumentString[], shells: readonly DocumentString[]) {\n const byExecutor = executorShells(shells);\n return strings.flatMap((value): [string, string][] => {\n const job = executorJob(value);\n const shell = byExecutor.get(value.value);\n return job === undefined || shell === undefined ? [] : [[JSON.stringify(job), shell]];\n });\n}\n\n/**\n * The shell that a command value runs with, when it is a program other than a shell\n * (`shell: python`): the nearest `shell` above the value, of its step, its job, its executor, or\n * a default of the job or the workflow. A step's own `shell` wins over a default of the same map.\n */\nexport function stepShells(strings: readonly DocumentString[]): StepShellOf {\n const shells = strings.filter((value) => value.path.at(-1) === STEP_SHELL_KEY);\n const isOwnShell = (value: DocumentString): boolean => !isDefaultShell(value);\n // Later entries win: the own `shell` of a map goes after a default of the same map.\n const ordered = [...shells.filter(isDefaultShell), ...shells.filter(isOwnShell)];\n const byScope = new Map([\n ...inheritedShells(strings, shells),\n ...ordered.map((value): [string, string] => [scopeOf(value), value.value]),\n ]);\n return (value) => {\n for (let depth = value.path.length - 1; depth >= 0; depth -= 1) {\n const shell = byScope.get(JSON.stringify(value.path.slice(0, depth)));\n if (shell !== undefined) {\n return isCommandLineShell(shell) ? undefined : shell;\n }\n }\n return undefined;\n };\n}\n\n/** A script of a step with another program as its shell that names an old package. */\nexport function otherShellFindings(\n values: readonly DocumentString[],\n shellOf: StepShellOf,\n locate: Locate,\n): ShellTextFindings {\n const manualSteps = values.flatMap((value) => {\n const shell = shellOf(value);\n return shell === undefined || !namesOriginalPackage(value.value)\n ? []\n : [{ kind: \"script-not-shell\", location: locate(value.start), shell } as const];\n });\n return { edits: [], changes: [], manualSteps };\n}\n","import type { RecipeHeader } from \"./just-recipe-parameters.js\";\nimport { isCommandLineShell } from \"./step-shells.js\";\n\n/**\n * A justfile recipe whose body starts with a shebang (`#!/usr/bin/env python3`) is a script for\n * that program: just writes the body to a file and runs it. A body for a program other than a\n * shell is code of that language, so the migration does not read it as commands.\n */\n\n/** The body of a recipe that another program runs, and that program as its shebang names it. */\nexport interface ShebangRecipe {\n readonly start: number;\n readonly end: number;\n /** The offset of the shebang, after the blank lines that may start the body. */\n readonly shebang: number;\n readonly shell: string;\n}\n\nconst LINE_BREAK = \"\\n\";\nconst SHEBANG = \"#!\";\n/** A line of a recipe body: indented, or blank inside the body. */\nconst BODY_LINE_RE = /^(?:[ \\t][^\\n]*|[ \\t]*\\r?)$/;\n\n/** The offset after the line break that ends the line at `offset`, or the end of the text. */\nfunction nextLineStart(text: string, offset: number): number {\n const lineBreak = text.indexOf(LINE_BREAK, offset);\n return lineBreak === -1 ? text.length : lineBreak + 1;\n}\n\n/** The end of the body that starts at `start`: before the first line that is not a body line. */\nfunction bodyEnd(text: string, start: number): number {\n let end = start;\n while (end < text.length) {\n const lineEnd = nextLineStart(text, end);\n if (!BODY_LINE_RE.test(text.slice(end, lineEnd).replace(LINE_BREAK, \"\"))) {\n break;\n }\n end = lineEnd;\n }\n return end;\n}\n\n/** The body of the recipe of a header, when its first line is a shebang for another program. */\nfunction shebangRecipe(text: string, header: RecipeHeader): ShebangRecipe[] {\n const start = nextLineStart(text, header.end);\n const end = bodyEnd(text, start);\n const firstLine = text\n .slice(start, end)\n .split(LINE_BREAK)\n .map((line) => line.trim())\n .find((line) => line.length > 0);\n if (firstLine === undefined || !firstLine.startsWith(SHEBANG)) {\n return [];\n }\n const shell = firstLine.slice(SHEBANG.length).trim();\n const shebang = text.indexOf(SHEBANG, start);\n return isCommandLineShell(shell) ? [] : [{ start, end, shebang, shell }];\n}\n\n/** The recipes of a justfile that a program other than a shell runs. */\nexport const shebangRecipes = (text: string, headers: readonly RecipeHeader[]): ShebangRecipe[] =>\n headers.flatMap((header) => shebangRecipe(text, header));\n","import { type CommandMigration, commandWordFindings } from \"./command-migration.js\";\nimport type { FileVariables } from \"./file-variables.js\";\nimport {\n commandLiterals,\n concatenationOperands,\n concatenationsOf,\n concatenationText,\n firstOperandDefinition,\n isFirstPartProgram,\n type JustOperand,\n stringRunsGenerator,\n} from \"./just-concatenations.js\";\nimport {\n expressionAt,\n interpolationsOf,\n type JustInterpolation,\n type JustLiteral,\n} from \"./just-expressions.js\";\nimport {\n type ParameterDefault,\n type RecipeHeader,\n recipeHeaders,\n} from \"./just-recipe-parameters.js\";\nimport { type ShebangRecipe, shebangRecipes } from \"./just-shebang-recipes.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\nimport {\n type ShellCommand,\n type ShellWord,\n shellCommands,\n shellCommandsAt,\n} from \"./shell-words.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport {\n type ProgramDefinition,\n type VariableProgram,\n variablePrograms,\n} from \"./variable-programs.js\";\n\n/**\n * Justfiles. just puts the value of a variable into a recipe line before the shell runs it, so a\n * variable can hold the generator command: `gen := \"npx openapi-typescript\"`, then\n * `{{gen}} a.yaml -it`. Each string literal and backtick of a just expression (a value, a\n * parameter default, an interpolation) is migrated where it is written, as a command line; the\n * flags after a variable set to the generator, or to such a variable (`run := gen`), where it is\n * used. A value that just computes (`env_var_or_default(\"GEN\", \"npx openapi-typescript\")`, an\n * `if`) and a recipe parameter may run another program, so the flags after them are reported.\n * A recipe with a shebang for another program (`#!/usr/bin/env python3`) is code of that\n * language: it is reported when it names an old package. Everything else is shell text.\n */\n\n/** An assignment at the start of a line: `gen := …`, also `export gen := …`. */\nconst ASSIGNMENT_RE = /^(export[ \\t]+)?([A-Za-z_][A-Za-z0-9_-]*)[ \\t]*:=[ \\t]*/gm;\n/** `set export` (also `:= true`): every variable and parameter reaches the recipes' shell. */\nconst SET_EXPORT_RE = /^set[ \\t]+export(?:[ \\t]*:=[ \\t]*true)?[ \\t]*(?:#.*)?$/m;\n/**\n * A word that expands one shell variable, after the recipe prefix: an exported variable reaches\n * the shell of a recipe as an environment variable (`$FLAGS`, `${FLAGS}`).\n */\nconst SHELL_VARIABLE_RE = /^[@+-]*\"?\\$(?:([A-Za-z_][A-Za-z0-9_]*)|\\{([A-Za-z_][A-Za-z0-9_]*)\\})\"?$/;\n/** A value that is the name of another variable. */\nconst NAME_VALUE_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n/** An interpolation of one variable, after the recipe prefix (`@`, `-`) of the line. */\nconst VARIABLE_INTERPOLATION_RE = /^[@+-]*\\{\\{[ \\t]*([A-Za-z_][A-Za-z0-9_-]*)[ \\t]*\\}\\}$/;\nconst MASK = \"_\";\nconst BLANK = \" \";\n\n/** An assignment of a justfile: the variable, its value as written, and their places. */\ninterface Assignment {\n readonly name: string;\n readonly isExported: boolean;\n /** The value as written, without a comment after it. */\n readonly value: string;\n readonly start: number;\n readonly end: number;\n readonly literals: readonly JustLiteral[];\n /** The parts of a value that joins strings and names with `+`, else undefined. */\n readonly operands: readonly JustOperand[] | undefined;\n}\n\nfunction assignmentsOf(text: string): Assignment[] {\n return [...text.matchAll(ASSIGNMENT_RE)].map((match) => {\n const valueStart = match.index + match[0].length;\n const { literals, end } = expressionAt(text, valueStart);\n const value = text.slice(valueStart, end).trim();\n const name = match[2] as string;\n const operands = concatenationOperands(text, { start: valueStart, end, literals });\n const isExported = match[1] !== undefined;\n return { name, isExported, value, start: match.index, end, literals, operands };\n });\n}\n\n/** The literal that is the whole value, or undefined for another expression. */\nfunction onlyString({ value, literals }: Assignment): JustLiteral | undefined {\n const [literal] = literals;\n if (literals.length !== 1 || literal?.kind !== \"string\") {\n return undefined;\n }\n return value.length === literal.end - literal.start ? literal : undefined;\n}\n\n/**\n * The definitions of a value that just computes from `literals`, or that the command line gives:\n * it may be a string that runs the generator, and it may be anything else.\n */\nfunction computedDefinitions(name: string, literals: readonly JustLiteral[]): ProgramDefinition[] {\n const other: ProgramDefinition = { name, kind: \"command\", runsGenerator: false };\n const isMaybeGenerator = literals.some(stringRunsGenerator);\n return isMaybeGenerator ? [{ name, kind: \"command\", runsGenerator: true }, other] : [other];\n}\n\n/** Each assignment as the programs it can set: a reference, a command, or a computed value. */\nfunction assignmentDefinitions(assignment: Assignment): ProgramDefinition[] {\n const { name, value, operands } = assignment;\n if (NAME_VALUE_RE.test(value)) {\n return [{ name, kind: \"reference\", target: value }];\n }\n if (operands?.[0] !== undefined && isFirstPartProgram(operands)) {\n return [firstOperandDefinition(name, operands[0])];\n }\n const literal = onlyString(assignment);\n return literal === undefined\n ? computedDefinitions(name, assignment.literals)\n : [{ name, kind: \"command\", runsGenerator: stringRunsGenerator(literal) }];\n}\n\n/** A parameter: its default, and the command line, which can set anything. */\nfunction parameterDefinitions({ name, literals, target }: ParameterDefault): ProgramDefinition[] {\n const fromCommandLine = computedDefinitions(name, literals);\n return target === undefined\n ? fromCommandLine\n : [{ name, kind: \"reference\", target }, ...fromCommandLine];\n}\n\n/** The shell text of a justfile, and the interpolations of its recipe lines. */\ninterface ShellText {\n readonly text: string;\n readonly interpolations: readonly JustInterpolation[];\n}\n\n/**\n * The text as the shell gets it: each interpolation one word of the same length, and each\n * assignment and recipe header blanked, since just reads them and no shell does. Blanks keep\n * every offset, so the interpolations found in it are those of the file's recipe lines.\n */\nfunction shellText(text: string, spans: readonly { start: number; end: number }[]): ShellText {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, end } of [...spans].sort((left, right) => left.start - right.start)) {\n parts.push(text.slice(copiedUpTo, start), BLANK.repeat(end - start));\n copiedUpTo = end;\n }\n parts.push(text.slice(copiedUpTo));\n const blanked = parts.join(\"\");\n const interpolations = interpolationsOf(blanked);\n const masked = interpolations.reduce(\n (current, { start, end }) =>\n current.slice(0, start) + MASK.repeat(end - start) + current.slice(end),\n blanked,\n );\n return { text: masked, interpolations };\n}\n\n/** The commands of literals, read as written: an escape (`\\\"`) stays two characters. */\nconst literalCommands = (literals: readonly JustLiteral[]): ShellCommand[] =>\n literals.flatMap((literal) => shellCommandsAt(literal.content, literal.contentStart));\n\n/** The text an assignment gives its variable: a string's contents, or the value as written. */\nfunction assignmentText(assignment: Assignment): string {\n const { operands } = assignment;\n return operands === undefined\n ? (onlyString(assignment)?.content ?? assignment.value)\n : concatenationText(operands);\n}\n\n/** The text a parameter default may give its variable: the contents of its literals. */\nconst defaultValue = ({ literals }: ParameterDefault): string =>\n literals.map((literal) => literal.content).join(BLANK);\n\n/**\n * The values of the variables, for an argument that expands one (`{{flags}}`): each assignment,\n * and each parameter default (`*flags='-it'`), joined when a name has several.\n */\nfunction variableValues(\n assignments: readonly Assignment[],\n defaults: readonly ParameterDefault[],\n): Map<string, string> {\n const values = new Map<string, string>();\n const named = [\n ...assignments.map((found) => ({ ...found, value: assignmentText(found) })),\n ...defaults.map((found) => ({ name: found.name, value: defaultValue(found) })),\n ];\n for (const { name, value } of named) {\n values.set(name, [values.get(name), value].join(BLANK).trim());\n }\n return values;\n}\n\n/**\n * The program of a word with interpolations that are not one variable: one whose strings may run\n * the generator (`{{ env_var_or_default(\"GEN\", \"npx openapi-typescript\") }}`) may also run another.\n */\nfunction computedProgram(written: string): VariableProgram | undefined {\n const literals = interpolationsOf(written).flatMap((interpolation) => interpolation.literals);\n return literals.some(stringRunsGenerator) ? \"generator-or-other\" : undefined;\n}\n\n/** The names that reach the shell of a recipe: all with `set export`, else the exported ones. */\nfunction exportedNames(\n text: string,\n assignments: readonly Assignment[],\n defaults: readonly ParameterDefault[],\n): ReadonlySet<string> {\n const isAll = SET_EXPORT_RE.test(text);\n const names = [...assignments, ...defaults].filter((found) => isAll || found.isExported);\n return new Set(names.map((found) => found.name));\n}\n\n/** The variable that a word expands: an interpolation, or an exported shell variable. */\nfunction expandedName(written: string, exported: ReadonlySet<string>): string | undefined {\n const interpolated = VARIABLE_INTERPOLATION_RE.exec(written)?.[1];\n const match = SHELL_VARIABLE_RE.exec(written);\n const shellName = match === null ? undefined : (match[1] ?? match[2]);\n return (\n interpolated ?? (shellName !== undefined && exported.has(shellName) ? shellName : undefined)\n );\n}\n\n/** What a justfile knows about its variables: their values, programs and exported names. */\ninterface JustVariables {\n readonly values: ReadonlyMap<string, string>;\n readonly programs: ReadonlyMap<string, VariableProgram>;\n readonly exported: ReadonlySet<string>;\n}\n\n/** The variables of a justfile, read from its assignments and recipe parameters. */\nfunction justfileVariables(\n text: string,\n { values, programs, exported }: JustVariables,\n): FileVariables {\n const writtenAt = (word: ShellWord): string => text.slice(word.start, word.end);\n const nameAt = (word: ShellWord) => expandedName(writtenAt(word), exported);\n return {\n programAt: (word) => {\n const name = nameAt(word);\n const written = writtenAt(word);\n const found = name === undefined ? computedProgram(written) : programs.get(name);\n return found === undefined ? undefined : { written, program: found };\n },\n referenceAt: (word) => {\n const name = nameAt(word);\n const value = name === undefined ? undefined : values.get(name);\n return value === undefined ? undefined : { written: writtenAt(word), value };\n },\n };\n}\n\n/** Each recipe that another program runs and that names an old package: code the tool skips. */\nconst shebangSteps = (\n text: string,\n recipes: readonly ShebangRecipe[],\n locate: (offset: number) => string,\n): ManualStep[] =>\n recipes\n .filter((recipe) => namesOriginalPackage(text.slice(recipe.start, recipe.end)))\n .map(({ shebang, shell }) => ({ kind: \"script-not-shell\", location: locate(shebang), shell }));\n\n/** Migrate a justfile; each finding names its `file:line`. */\nexport function migrateJustfile(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n const assignments = assignmentsOf(text);\n const headers: RecipeHeader[] = recipeHeaders(text);\n const defaults = headers.flatMap((header) => header.defaults);\n const programs = variablePrograms([\n ...assignments.flatMap(assignmentDefinitions),\n ...defaults.flatMap(parameterDefinitions),\n ]);\n const variables = justfileVariables(text, {\n values: variableValues(assignments, defaults),\n programs,\n exported: exportedNames(text, assignments, defaults),\n });\n const scripts = shebangRecipes(text, headers);\n const shell = shellText(text, [...assignments, ...headers, ...scripts]);\n const concatenations = concatenationsOf(assignments, programs);\n const commands = [\n ...shellCommands(shell.text),\n ...literalCommands(commandLiterals(assignments)),\n ...concatenations.commands,\n ...literalCommands(defaults.flatMap((found) => found.literals)),\n ...literalCommands(shell.interpolations.flatMap((found) => found.literals)),\n ];\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const found = commandWordFindings(commands, locate, variables, concatenations.appended);\n const { edits, changes, manualSteps } = found;\n const steps = [...manualSteps, ...shebangSteps(text, scripts, locate)];\n return { text: applyTextEdits(text, edits), changes, manualSteps: steps };\n}\n","import type { ManualStep } from \"./migration-findings.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\nimport { type ShellCommand, shellCommandsAt } from \"./shell-words.js\";\n\n/**\n * Make expansions in a Makefile: `$(NAME)`, `${NAME}` and function calls such as `$(or …)`. Make\n * expands them before a recipe line reaches the shell, so the shell reads each as one word. The\n * functions that give one of their arguments as their value (`$(or $(GEN),npx\n * openapi-typescript)`, `$(strip …)`) have command text in those arguments, read where it is\n * written. Any other function computes a new text from its arguments (`$(firstword …)`,\n * `$(call …)`, `$(shell …)`), so a call of one that names an old package is reported.\n */\n\nconst DOLLAR = \"$\";\nconst CLOSING: Readonly<Record<string, string>> = { \"(\": \")\", \"{\": \"}\" };\nconst MASK = \"_\";\nconst ARGUMENT_SEPARATOR = \",\";\n\n/** Where the make expansion that starts with the `$` at `start` ends, or undefined for none. */\nfunction expansionEnd(text: string, start: number): number | undefined {\n const open = text[start + 1] ?? \"\";\n const close = CLOSING[open];\n if (close === undefined) {\n return undefined;\n }\n let depth = 0;\n for (let index = start + 1; index < text.length; index++) {\n if (text[index] === open) {\n depth++;\n } else if (text[index] === close && --depth === 0) {\n return index + 1;\n }\n }\n return undefined;\n}\n\n/** A make expansion: where its `$` is and where it ends. */\ninterface Expansion {\n readonly start: number;\n readonly end: number;\n}\n\n/** The expansions of a text, outside one another; `$$` is a `$` for the shell. */\nfunction expansionsOf(text: string): Expansion[] {\n const found: Expansion[] = [];\n for (let index = text.indexOf(DOLLAR); index !== -1; index = text.indexOf(DOLLAR, index + 1)) {\n if (text[index + 1] === DOLLAR) {\n index++;\n continue;\n }\n const end = expansionEnd(text, index);\n if (end !== undefined) {\n found.push({ start: index, end });\n index = end - 1;\n }\n }\n return found;\n}\n\n/**\n * The text with each `$(…)` and `${…}` expansion turned into one word of the same length, so the\n * shell reads it as make passes it on.\n */\nexport function maskExpansions(text: string): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, end } of expansionsOf(text)) {\n parts.push(text.slice(copiedUpTo, start + 1), MASK.repeat(end - start - 1));\n copiedUpTo = end;\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/**\n * The functions whose value is one of their arguments, by the first argument that can be it:\n * `$(if COND,THEN,ELSE)` gives THEN or ELSE, `$(or A,B)` the first that is not empty, `$(and A,B)`\n * the last. `$(strip TEXT)` gives its one argument (commas included) with the blanks between\n * words made one, which the shell splits the same way. Any other function (`$(shell …)`,\n * `$(subst …)`) computes a new text.\n */\nconst VALUE_ARGUMENTS: ReadonlyMap<string, number> = new Map([\n [\"if\", 1],\n [\"or\", 0],\n [\"and\", 0],\n]);\nconst WHOLE_TEXT_FUNCTIONS: ReadonlySet<string> = new Set([\"strip\"]);\n/**\n * The head of a function call: `$(`, the function's name and the blanks after it. GNU make names\n * some functions with a hyphen (`filter-out`).\n */\nconst FUNCTION_HEAD_RE = /^\\$[({]([a-z]+(?:-[a-z]+)*)[ \\t]+/;\nconst OPENING: ReadonlySet<string> = new Set(Object.keys(CLOSING));\nconst CLOSINGS: ReadonlySet<string> = new Set(Object.values(CLOSING));\n\n/** An argument of a function call, as written, and where it starts in the whole text. */\ninterface Argument {\n readonly text: string;\n readonly start: number;\n}\n\n/** The arguments of a call between `start` and `end`, split at commas outside parentheses. */\nfunction callArguments(text: string, start: number, end: number): Argument[] {\n const found: Argument[] = [];\n let argumentStart = start;\n let depth = 0;\n for (let index = start; index < end; index++) {\n const char = text[index] as string;\n depth += OPENING.has(char) ? 1 : CLOSINGS.has(char) ? -1 : 0;\n if (char === ARGUMENT_SEPARATOR && depth === 0) {\n found.push({ text: text.slice(argumentStart, index), start: argumentStart });\n argumentStart = index + 1;\n }\n }\n return [...found, { text: text.slice(argumentStart, end), start: argumentStart }];\n}\n\n/** The arguments of the expansion that can be its value, or none for another expansion. */\nfunction valueArguments(text: string, { start, end }: Expansion): Argument[] {\n const head = FUNCTION_HEAD_RE.exec(text.slice(start, end));\n const name = head?.[1] ?? \"\";\n const first = VALUE_ARGUMENTS.get(name);\n const argumentStart = start + (head?.[0].length ?? 0);\n if (WHOLE_TEXT_FUNCTIONS.has(name)) {\n return [{ text: text.slice(argumentStart, end - 1), start: argumentStart }];\n }\n return first === undefined ? [] : callArguments(text, argumentStart, end - 1).slice(first);\n}\n\n/** Whether an expansion calls a function whose value the tool does not read. */\nfunction isUnreadCall(text: string, { start, end }: Expansion): boolean {\n const name = FUNCTION_HEAD_RE.exec(text.slice(start, end))?.[1];\n return name !== undefined && !VALUE_ARGUMENTS.has(name) && !WHOLE_TEXT_FUNCTIONS.has(name);\n}\n\n/** A call of a function that computes a new text, as written, and where it starts. */\nexport interface UnreadCall {\n readonly written: string;\n readonly start: number;\n}\n\n/**\n * The calls of functions that compute a new text in `text` (which starts at `offset` of the whole\n * text), also in the value arguments of other calls: their arguments are not read.\n */\nfunction unreadCalls(text: string, offset = 0): UnreadCall[] {\n return expansionsOf(text).flatMap((expansion) => {\n const own = isUnreadCall(text, expansion)\n ? [{ written: text.slice(expansion.start, expansion.end), start: offset + expansion.start }]\n : [];\n const nested = valueArguments(text, expansion).flatMap((argument) =>\n unreadCalls(argument.text, offset + argument.start),\n );\n return [...own, ...nested];\n });\n}\n\n/**\n * The commands in the value arguments of the function calls of `text`, which starts at `offset`\n * of the whole text, also of calls nested in such an argument. Each argument is read as a command\n * line where it is written, with its own expansions as words.\n */\nexport function functionCommands(text: string, offset = 0): ShellCommand[] {\n return expansionsOf(text)\n .flatMap((expansion) => valueArguments(text, expansion))\n .flatMap((argument) => [\n ...shellCommandsAt(maskExpansions(argument.text), offset + argument.start),\n ...functionCommands(argument.text, offset + argument.start),\n ]);\n}\n\n/**\n * A call of a function that computes a new text from arguments that name an old package\n * (`$(firstword npx openapi-typescript)`): the tool does not read what it gives, so it is reported.\n */\nexport const unreadCallSteps = (text: string, locate: (offset: number) => string): ManualStep[] =>\n unreadCalls(text)\n .filter((call) => namesOriginalPackage(call.written))\n .map(({ written, start }) => ({\n kind: \"old-name-in-command\",\n location: locate(start),\n word: written,\n }));\n","import { isOwnGeneratorCommand } from \"./appended-assignments.js\";\nimport {\n type AppendedValue,\n type CommandMigration,\n commandWordFindings,\n} from \"./command-migration.js\";\nimport { commandRoles } from \"./command-roles.js\";\nimport { type FileVariables, runsGenerator } from \"./file-variables.js\";\nimport { functionCommands, maskExpansions, unreadCallSteps } from \"./make-expansions.js\";\nimport { lineLocator } from \"./migration-findings.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport {\n type AppendedPlace,\n appendedPlace,\n type ProgramDefinition,\n type VariableProgram,\n variablePrograms,\n} from \"./variable-programs.js\";\n\n/**\n * Makefiles. Make expands its variables before a recipe line reaches the shell, so a variable can\n * hold the generator command: `OAT := openapi-typescript`, then `$(OAT) a.yaml -it`. The value of\n * an assignment is read as a command and migrated where it is set; the flags after a reference\n * to such a variable, or to one set to it (`GEN := $(OAT)`), are migrated where it is used. The\n * arguments of `$(or …)`, `$(and …)` and `$(if …)` are command lines where they are written\n * (make-expansions.ts). Everything else is shell text.\n */\n\n/**\n * A variable assignment at the start of a line (not a recipe line, which starts with a tab), also\n * one for some targets only (`gen: OAT := openapi-typescript`).\n */\nconst ASSIGNMENT_RE = new RegExp(\n [\n \"^(?:[^\\\\s:#=][^:#=\\\\n]*:[ \\\\t]*)?\",\n \"(?:(?:export|override|private)[ \\\\t]+)*\",\n \"([A-Za-z_][A-Za-z0-9_.-]*)\",\n \"[ \\\\t]*(:::=|::=|:=|\\\\?=|\\\\+=|!=|=)\",\n ].join(\"\"),\n \"gm\",\n);\n/**\n * A reference to one variable, as a whole word: `$(NAME)`, `${NAME}`, or `$N` for a variable whose\n * name is one letter, as make reads a `$` before any other character.\n */\nconst VARIABLE_REFERENCE_RE =\n /^\\$(?:\\(([A-Za-z_][A-Za-z0-9_.-]*)\\)|\\{([A-Za-z_][A-Za-z0-9_.-]*)\\}|([A-Za-z_]))$/;\n/** `@`, `-` and `+` before a recipe line: silent, ignore errors, always run. */\nconst RECIPE_PREFIX_RE = /^[@+-]+/;\nconst NOT_LINE_BREAK_RE = /[^\\n]/g;\nconst LINE_BREAK = \"\\n\";\nconst BACKSLASH = \"\\\\\";\n\n/** `+=` adds text to the value a variable already has, so the program it runs stays. */\nconst APPEND_OPERATOR = \"+=\";\n/** `?=` sets a variable only when the environment or the command line does not. */\nconst CONDITIONAL_OPERATOR = \"?=\";\n\n/** An assignment of a Makefile: the variable, its operator, where it starts and its value is. */\ninterface Assignment {\n readonly name: string;\n readonly operator: string;\n readonly start: number;\n readonly valueStart: number;\n readonly valueEnd: number;\n}\n\n/** Where the line that holds `index` ends; a `\\` before a line break continues it. */\nfunction logicalLineEnd(text: string, index: number): number {\n let end = text.indexOf(LINE_BREAK, index);\n while (end !== -1 && text[end - 1] === BACKSLASH) {\n end = text.indexOf(LINE_BREAK, end + 1);\n }\n return end === -1 ? text.length : end;\n}\n\nconst assignmentsOf = (text: string): Assignment[] =>\n [...text.matchAll(ASSIGNMENT_RE)].map((match) => {\n const valueStart = match.index + match[0].length;\n const valueEnd = logicalLineEnd(text, valueStart);\n const name = match[1] as string;\n const operator = match[2] as string;\n return { name, operator, start: match.index, valueStart, valueEnd };\n });\n\n/** The text with the `NAME :=` of each assignment blanked, so its value reads as a command. */\nfunction withoutAssignmentHeads(text: string, assignments: readonly Assignment[]): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, valueStart } of assignments) {\n parts.push(\n text.slice(copiedUpTo, start),\n text.slice(start, valueStart).replace(NOT_LINE_BREAK_RE, \" \"),\n );\n copiedUpTo = valueStart;\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** A make expansion at the start of a word: a reference or a function call such as `$(or …)`. */\nconst COMPUTED_RE = /^\\$[({]/;\n\n/**\n * Whether a word starts with a make expansion that is not a plain reference (`$(or $(GEN),npx\n * openapi-typescript)`, `$(shell …)`): make computes the program, which may be the generator.\n */\nconst isComputed = (written: string): boolean =>\n COMPUTED_RE.test(written.trim().replace(RECIPE_PREFIX_RE, \"\"));\n\n/** The variable that `written` references as a whole, after the recipe prefix, or undefined. */\nfunction referencedName(written: string): string | undefined {\n const match = VARIABLE_REFERENCE_RE.exec(written.trim().replace(RECIPE_PREFIX_RE, \"\"));\n return match === null ? undefined : (match[1] ?? match[2] ?? match[3]);\n}\n\n/** The program word of a command as written, or \"\" for a command without one. */\nfunction programWritten(text: string, command: ShellCommand): string {\n const { program } = commandRoles(command);\n const word = program === undefined ? undefined : command[program];\n return word === undefined ? \"\" : text.slice(word.start, word.end);\n}\n\n/**\n * The program an assignment's value sets, by the program word of its first command: a reference\n * to one variable (`GEN := $(OAT) --redoc r.yaml`), a program make computes (`$(or $(GEN),npx\n * openapi-typescript)`), which the run decides, or a command, which runs the generator when one\n * of the commands that start in the value does.\n */\nfunction valueDefinition(\n text: string,\n { name, valueStart, valueEnd }: Assignment,\n commands: readonly ShellCommand[],\n): ProgramDefinition {\n const inValue = commands.filter(\n ([first]) => first !== undefined && valueStart <= first.start && first.start < valueEnd,\n );\n // The command that starts first holds the program; the others are in its arguments.\n const [first] = inValue.sort((left, right) => (left[0]?.start ?? 0) - (right[0]?.start ?? 0));\n if (first === undefined) {\n return { name, kind: \"no-program\" };\n }\n const program = programWritten(text, first);\n const target = referencedName(program);\n if (target !== undefined) {\n return { name, kind: \"reference\", target };\n }\n if (isComputed(program)) {\n return { name, kind: \"run-time\" };\n }\n return { name, kind: \"command\", runsGenerator: inValue.some(runsGenerator) };\n}\n\n/** An assignment, and for a `+=` one, where its text is in the variable's value. */\ninterface PlacedAssignment {\n readonly assignment: Assignment;\n readonly place: AppendedPlace | undefined;\n}\n\n/** The assignments with their places, from the values that earlier lines set. */\nfunction placedAssignments(text: string, assignments: readonly Assignment[]): PlacedAssignment[] {\n return assignments.map((assignment, index) => {\n if (assignment.operator !== APPEND_OPERATOR) {\n return { assignment, place: undefined };\n }\n const earlier = assignments\n .slice(0, index)\n .filter((found) => found.name === assignment.name)\n .map(({ valueStart, valueEnd }) => text.slice(valueStart, valueEnd));\n return { assignment, place: appendedPlace(earlier) };\n });\n}\n\n/**\n * Each assignment as the programs it can set. Text appended after a value keeps its program; one\n * appended after a value from outside the file, or a `?=` value, is also whatever the environment\n * or the command line sets; text appended to an empty value is the value.\n */\nfunction programDefinitions(\n text: string,\n commands: readonly ShellCommand[],\n placed: readonly PlacedAssignment[],\n): ProgramDefinition[] {\n return placed.flatMap(({ assignment, place }): ProgramDefinition[] => {\n const { name, operator } = assignment;\n if (place === \"after-value\") {\n return [{ name, kind: \"no-program\" }];\n }\n if (place === \"after-outside\") {\n return [{ name, kind: \"run-time\" }];\n }\n const value = valueDefinition(text, assignment, commands);\n return operator === CONDITIONAL_OPERATOR ? [value, { name, kind: \"run-time\" }] : [value];\n });\n}\n\n/** The commands of an appended text, and the others. */\ninterface AppendedCommands {\n readonly commands: readonly ShellCommand[];\n readonly appended: readonly AppendedValue[];\n}\n\nconst startsIn = (command: ShellCommand, { valueStart, valueEnd }: Assignment): boolean => {\n const start = command[0]?.start ?? -1;\n return valueStart <= start && start < valueEnd;\n};\n\n/**\n * The text appended after a value (`GEN += --immutable-types`): its words are arguments of the\n * program the variable runs, not a command of their own, in the order they are written.\n */\nfunction appendedCommands(\n commands: readonly ShellCommand[],\n placed: readonly PlacedAssignment[],\n programs: ReadonlyMap<string, VariableProgram>,\n): AppendedCommands {\n const commandsIn = (assignment: Assignment): ShellCommand[] =>\n commands\n .filter((command) => startsIn(command, assignment))\n .sort((left, right) => (left[0]?.start ?? 0) - (right[0]?.start ?? 0));\n const appends = placed.filter(\n ({ assignment, place }) =>\n place !== undefined &&\n place !== \"start\" &&\n !isOwnGeneratorCommand(place, commandsIn(assignment)[0]),\n );\n const appended = appends.map(({ assignment }): AppendedValue => {\n const words = commandsIn(assignment)\n .flat()\n .sort((left, right) => left.start - right.start);\n const written = `$(${assignment.name})`;\n const program = programs.get(assignment.name) ?? \"generator-or-other\";\n return { words, program: { written, program } };\n });\n const isAppended = (command: ShellCommand): boolean =>\n appends.some(({ assignment }) => startsIn(command, assignment));\n return { commands: commands.filter((command) => !isAppended(command)), appended };\n}\n\n/** The values each variable gets in the file, joined: any of them can reach a command. */\nfunction variableValues(text: string, assignments: readonly Assignment[]): Map<string, string> {\n const values = new Map<string, string>();\n for (const { name, valueStart, valueEnd } of assignments) {\n const value = text.slice(valueStart, valueEnd);\n values.set(name, [values.get(name), value].filter((part) => part !== undefined).join(\" \"));\n }\n return values;\n}\n\n/** The variables of a Makefile, read from its assignments. */\nfunction makefileVariables(\n text: string,\n assignments: readonly Assignment[],\n programs: ReadonlyMap<string, VariableProgram>,\n) {\n const values = variableValues(text, assignments);\n const nameAt = (word: ShellWord) => referencedName(text.slice(word.start, word.end));\n const variables: FileVariables = {\n programAt: (program) => {\n const written = text.slice(program.start, program.end);\n const name = nameAt(program);\n if (name === undefined) {\n return isComputed(written) ? { written, program: \"generator-or-other\" } : undefined;\n }\n // A variable that no line of the file sets comes from an included file, the command line\n // or the environment, so it may run the generator.\n return { written, program: programs.get(name) ?? \"generator-or-other\" };\n },\n referenceAt: (word) => {\n const name = nameAt(word);\n const value = name === undefined ? undefined : values.get(name);\n const written = text.slice(word.start, word.end);\n return value === undefined ? undefined : { written, value };\n },\n };\n return variables;\n}\n\n/** Migrate a Makefile; each finding names its `file:line`. */\nexport function migrateMakefile(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n const assignments = assignmentsOf(text);\n const commands = [\n ...shellCommands(withoutAssignmentHeads(maskExpansions(text), assignments)),\n ...functionCommands(text),\n ];\n const placed = placedAssignments(text, assignments);\n const programs = variablePrograms(programDefinitions(text, commands, placed));\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const variables = makefileVariables(text, assignments, programs);\n const own = appendedCommands(commands, placed, programs);\n const found = commandWordFindings(own.commands, locate, variables, own.appended);\n const { edits, changes, manualSteps } = found;\n const steps = [...manualSteps, ...unreadCallSteps(text, locate)];\n return { text: applyTextEdits(text, edits), changes, manualSteps: steps };\n}\n","import { PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * Override, resolution and patch keys name a package with a path or a version around it:\n * `app>openapi-fetch` (pnpm), `**\\/openapi-fetch` (Yarn), `openapi-fetch@0.13` (pnpm, npm).\n * Matching the name as a substring took `openapi-typescript-helpers` for `openapi-typescript` too.\n */\n\nconst PARENT_SEPARATOR = \">\";\nconst PATH_SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\n\n/** The package a key targets: the last parent and path segment, without a version. */\nexport function overrideTarget(key: string): string {\n const child = key.split(PARENT_SEPARATOR).at(-1) ?? key;\n const segments = child.split(PATH_SEPARATOR);\n const isScoped = segments.length > 1 && segments.at(-2)?.startsWith(SCOPE_PREFIX) === true;\n const name = isScoped ? segments.slice(-2).join(PATH_SEPARATOR) : (segments.at(-1) ?? child);\n const versionAt = name.indexOf(SCOPE_PREFIX, 1);\n return versionAt === -1 ? name : name.slice(0, versionAt);\n}\n\n/** The original packages that `keys` target; each once, in key order. */\nexport function overriddenPackages(keys: readonly string[]): string[] {\n const targets = keys.map(overrideTarget);\n return [...new Set(targets.filter((target) => PACKAGE_RENAMES.has(target)))];\n}\n","import {\n CatalogEntries,\n type CatalogPlan,\n catalogOfSpec,\n DEFAULT_CATALOG,\n} from \"./catalog-plan.js\";\nimport {\n isMap,\n mapsAt,\n type TreeMap,\n type TreeNode,\n textEntries,\n valuesAt,\n} from \"./config-documents.js\";\nimport { overrideTarget } from \"./override-targets.js\";\nimport {\n CATALOG_FIELD,\n DEPENDENCY_FIELDS,\n NAMED_CATALOGS_FIELD,\n OVERRIDE_FIELDS,\n PACKAGE_RENAMES,\n PNPM_SETTINGS_FIELD,\n WORKSPACES_FIELD,\n} from \"./package-names.js\";\nimport { specEntries } from \"./tree-entries.js\";\n\n/**\n * Catalogs and the dependencies that point at them (`\"openapi-fetch\": \"catalog:\"`). A catalog\n * entry and the dependencies on it must keep the same name, or the install fails\n * (`ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`). The files are migrated one by one, so this plan\n * is made from all of them first: an entry keeps its old name while a dependency keeps using it,\n * and a dependency keeps its old name while its entry stays.\n */\n\nconst PATH_SEPARATOR = \".\";\n\n/** One catalog map: its name as `catalog:<name>` names it, and where it is in the file. */\nexport interface CatalogMap {\n readonly name: string;\n readonly label: string;\n readonly map: TreeMap;\n}\n\n/**\n * The catalogs of a file: `catalog` (the default one) and `catalogs.<name>`, as pnpm and Yarn\n * read them, and also under `workspaces` as bun reads them. `prefix` names where `root` is.\n */\nexport function catalogMaps(root: TreeMap, prefix = \"\"): CatalogMap[] {\n const maps = mapsAt(root, CATALOG_FIELD).map((map) => ({\n name: DEFAULT_CATALOG,\n label: `${prefix}${CATALOG_FIELD}`,\n map,\n }));\n for (const catalogs of mapsAt(root, NAMED_CATALOGS_FIELD)) {\n for (const { key, value } of textEntries(catalogs)) {\n if (isMap(value)) {\n const label = [prefix + NAMED_CATALOGS_FIELD, key.value].join(PATH_SEPARATOR);\n maps.push({ name: key.value, label, map: value });\n }\n }\n }\n return maps;\n}\n\n/** The catalogs of a manifest: at the top level and under `workspaces` (bun). */\nexport const manifestCatalogMaps = (manifest: TreeMap): CatalogMap[] => [\n ...catalogMaps(manifest),\n ...mapsAt(manifest, WORKSPACES_FIELD).flatMap((workspaces) =>\n catalogMaps(workspaces, `${WORKSPACES_FIELD}${PATH_SEPARATOR}`),\n ),\n];\n\n/** The documents the plan is made from: manifests, and the files that hold catalogs. */\nexport interface CatalogDocuments {\n readonly manifests: readonly TreeMap[];\n readonly catalogFiles: readonly TreeMap[];\n readonly isWorkspaceRoot: boolean;\n}\n\n/**\n * Dependencies on a catalog that keep the old name whatever the catalog does: their field has the\n * new name too, so the rename is left (domain/dependency-map.ts).\n */\nfunction entriesInUse(manifests: readonly TreeMap[]): CatalogEntries {\n const inUse = new CatalogEntries();\n const fields = manifests.flatMap((manifest) =>\n DEPENDENCY_FIELDS.flatMap((field) => mapsAt(manifest, field)),\n );\n for (const dependencies of fields) {\n const entries = specEntries(dependencies);\n const names = new Set(entries.map((entry) => entry.name));\n for (const { name, spec } of entries) {\n const catalog = spec === undefined ? undefined : catalogOfSpec(spec.value);\n const to = PACKAGE_RENAMES.get(name);\n if (catalog !== undefined && to !== undefined && names.has(to)) {\n inUse.add(catalog, name);\n }\n }\n }\n return inUse;\n}\n\n/** The `key: value` texts below `node` at every depth: npm nests overrides by parent package. */\nfunction nestedTexts(node: TreeNode): { key: string; value: string }[] {\n if (node.kind !== \"map\") {\n return [];\n }\n return textEntries(node).flatMap(({ key, value }) =>\n value.kind === \"scalar\" ? [{ key: key.value, value: value.value }] : nestedTexts(value),\n );\n}\n\n/**\n * Adds the entries that overrides point at (`\"openapi-fetch\": \"catalog:\"` in `overrides`,\n * `resolutions` or `pnpm.overrides`). The tool reports overrides and leaves them as they are, so\n * the entry they use must keep its old name, or the install fails\n * (`ERR_PNPM_CATALOG_IN_OVERRIDES`).\n */\nfunction addOverrideUses(documents: readonly TreeMap[], inUse: CatalogEntries): void {\n const sections = documents.flatMap((document) =>\n [...OVERRIDE_FIELDS, PNPM_SETTINGS_FIELD].flatMap((field) => valuesAt(document, field)),\n );\n for (const { key, value } of sections.flatMap(nestedTexts)) {\n const catalog = catalogOfSpec(value);\n const name = overrideTarget(key);\n if (catalog !== undefined && PACKAGE_RENAMES.has(name)) {\n inUse.add(catalog, name);\n }\n }\n}\n\n/**\n * The plan for the catalogs of a project, from all its manifests and catalog files. An entry with\n * an old name stays when its value is not one the tool edits (an alias, a flow map), or when a\n * dependency or an override keeps using it; then, unless the catalog has the new name too, the\n * dependencies on it keep the old name as well (dependency-map.ts makes both decisions by this\n * plan).\n */\nexport function planCatalogs({\n manifests,\n catalogFiles,\n isWorkspaceRoot,\n}: CatalogDocuments): CatalogPlan {\n const inUse = entriesInUse(manifests);\n addOverrideUses([...manifests, ...catalogFiles], inUse);\n const kept = new CatalogEntries();\n const defined = new CatalogEntries();\n const catalogs = [\n ...catalogFiles.flatMap((file) => catalogMaps(file)),\n ...manifests.flatMap(manifestCatalogMaps),\n ];\n for (const { name: catalog, map } of catalogs) {\n const entries = specEntries(map);\n const names = new Set(entries.map((entry) => entry.name));\n for (const { name, spec } of entries) {\n defined.add(catalog, name);\n const to = PACKAGE_RENAMES.get(name);\n const stays = spec === undefined || inUse.has(catalog, name);\n if (to !== undefined && !names.has(to) && stays) {\n kept.add(catalog, name);\n }\n }\n }\n return { inUse, kept, defined, isWorkspaceRoot };\n}\n","import { NPM_SPECIFIER_PREFIX } from \"./command-launchers.js\";\nimport {\n documentStrings,\n mapsAt,\n type TreeMap,\n type TreeNode,\n textEntries,\n} from \"./config-documents.js\";\nimport { isAtOrAbove } from \"./declared-packages.js\";\nimport { packageReference } from \"./old-package-words.js\";\nimport { overrideTarget } from \"./override-targets.js\";\nimport { OVERRIDE_FIELDS, PACKAGE_RENAMES, PNPM_SETTINGS_FIELD } from \"./package-names.js\";\n\n/**\n * The override that aliases an original package to its successor\n * (`\"openapi-fetch\": \"npm:openapi-typesafe-fetch@^1.0.0\"`) is what the docs ask for when a library\n * such as swr-openapi takes its client type from the original package. It is the migration done,\n * so it is not reported, and a dependency that needs the original as its peer then needs nothing.\n */\n\n/** The key of pnpm's overrides in the `pnpm` field of a manifest (`pnpm.overrides`). */\nconst PNPM_OVERRIDES = \"overrides\";\n\n/** True for an override entry that points an original package at its successor. */\nfunction isSuccessorAlias(key: string, value: TreeNode): boolean {\n const successor = PACKAGE_RENAMES.get(overrideTarget(key));\n return (\n value.kind === \"scalar\" &&\n value.value.startsWith(NPM_SPECIFIER_PREFIX) &&\n packageReference(value.value).name === successor\n );\n}\n\n/**\n * The original packages that an override map names, each once, in order, without the entries\n * that alias one to its successor; nested maps (npm's `\"swr-openapi\": { … }`) are read too.\n */\nexport function overriddenOldPackages(node: TreeNode): string[] {\n const names =\n node.kind === \"map\"\n ? textEntries(node).flatMap(({ key, value }) =>\n isSuccessorAlias(key.value, value)\n ? []\n : [overrideTarget(key.value), ...overriddenOldPackages(value)],\n )\n : documentStrings([node]).map((string) => packageReference(string.value).name);\n return [...new Set(names.filter((name) => PACKAGE_RENAMES.has(name)))];\n}\n\n/** The original packages that an override map aliases to their successors, at any depth. */\nfunction aliasedIn(node: TreeNode): string[] {\n if (node.kind !== \"map\") {\n return [];\n }\n return textEntries(node).flatMap(({ key, value }) =>\n isSuccessorAlias(key.value, value) ? [overrideTarget(key.value)] : aliasedIn(value),\n );\n}\n\n/**\n * The original packages that a manifest (`overrides`, `resolutions`, `pnpm.overrides`) or a\n * `pnpm-workspace.yaml` (`overrides`) aliases to their successors.\n */\nexport function successorAliasedPackages(root: TreeMap): string[] {\n const fields = [...OVERRIDE_FIELDS].flatMap((field) => mapsAt(root, field));\n const pnpm = mapsAt(root, PNPM_SETTINGS_FIELD).flatMap((map) => mapsAt(map, PNPM_OVERRIDES));\n return [...new Set([...fields, ...pnpm].flatMap(aliasedIn))];\n}\n\n/** The successor aliases of one file of the project, by its path. */\nexport interface SuccessorAliases {\n readonly path: string;\n readonly names: ReadonlySet<string>;\n}\n\n/**\n * The original packages aliased to their successors for a manifest at `filePath`: by a file at\n * or above it, as a workspace root's overrides apply to its packages.\n */\nexport function aliasedPackagesFor(\n aliases: readonly SuccessorAliases[],\n filePath: string,\n): ReadonlySet<string> {\n const applying = aliases.filter(({ path }) => isAtOrAbove(path, filePath));\n return new Set(applying.flatMap(({ names }) => [...names]));\n}\n","import { documentStrings, type TreeMap, type TreeNode, textEntries } from \"./config-documents.js\";\nimport type { Findings } from \"./dependency-map.js\";\nimport { packageReference } from \"./old-package-words.js\";\nimport { overrideTarget } from \"./override-targets.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { overriddenOldPackages } from \"./successor-aliases.js\";\nimport { nestedKeys } from \"./tree-entries.js\";\n\n/**\n * The settings of a package manager name packages in keys and values of every shape:\n * `packageExtensions: { \"openapi-fetch@*\": … }`, `allowedDeprecatedVersions`,\n * `onlyBuiltDependencies: [openapi-fetch]`, `overrides: { \"app>openapi-fetch\": … }`. A setting\n * that names an old package no longer applies once it is renamed, and what the new name needs\n * there is the user's call, so each one is reported, never changed.\n */\n\n/** How the sections of one settings map are read. */\nexport interface SettingsFile {\n /** Sections the migration renames itself (catalogs) or that hold no names (`packages`). */\n readonly migratedSections: ReadonlySet<string>;\n /** Sections that change what is installed; they are reported as overrides. */\n readonly overrideSections: ReadonlySet<string>;\n /** What comes before a section's key in the report (`pnpm.`). */\n readonly prefix: string;\n}\n\n/**\n * The old packages that `node` names, each once, in order: by its keys at any depth, with a path\n * or a version around the name (`a>openapi-fetch@0`), and by its string values, as a name with an\n * optional `npm:` and version (`openapi-fetch`, `npm:openapi-fetch@0.13`).\n */\nexport function oldPackagesNamedBy(node: TreeNode): string[] {\n const values = documentStrings([node]).map((string) => packageReference(string.value).name);\n const names = [...nestedKeys(node).map(overrideTarget), ...values];\n return [...new Set(names.filter((name) => PACKAGE_RENAMES.has(name)))];\n}\n\n/** Report each section of `settings` that names an old package, by its key. */\nexport function reportSettingSections(\n settings: TreeMap,\n file: SettingsFile,\n findings: Findings,\n): void {\n for (const { key, value } of textEntries(settings)) {\n if (file.migratedSections.has(key.value)) {\n continue;\n }\n const field = `${file.prefix}${key.value}`;\n const isOverride = file.overrideSections.has(key.value);\n const names = isOverride ? overriddenOldPackages(value) : oldPackagesNamedBy(value);\n for (const name of names) {\n findings.manualSteps.push(\n isOverride\n ? { kind: \"override-names-package\", field, name }\n : { kind: \"setting-names-package\", field, name },\n );\n }\n }\n}\n","import {\n type DocumentPath,\n documentStrings,\n isMap,\n type TreeMap,\n type TreeNode,\n textEntries,\n valuesAt,\n} from \"./config-documents.js\";\nimport { type Findings, isFree } from \"./dependency-map.js\";\nimport {\n oldPackageInNodeModules,\n PACKAGE_RENAMES,\n type RenamedSpecifier,\n renamedSpecifier,\n} from \"./package-names.js\";\nimport { replaceScalar } from \"./tree-entries.js\";\n\n/**\n * Config maps that name modules by their specifiers, as keys or as targets. The imports get the\n * new names (domain/source-migration.ts), so a key or target that names an original package, or\n * a subpath of it, would no longer match or resolve: it gets the new name too.\n */\n\nconst PATH_SEPARATOR = \".\";\n\n/**\n * Node's subpath imports: `\"imports\": { \"#client\": \"openapi-fetch\" }` maps a private name to a\n * target, a string under any nesting of conditions and fallback lists. The `#` keys are the\n * project's own names and stay.\n */\nconst IMPORTS_FIELD = \"imports\";\n\n/**\n * The `browser` field of bundlers: `\"browser\": { \"openapi-fetch\": false }` replaces a module, keyed\n * by its specifier, with another one or with nothing. A string `browser` names the package's own\n * file and stays.\n */\nconst BROWSER_FIELD = \"browser\";\n\n/** A deep specifier reaches into the package's files, whose layout is not part of the contract. */\nfunction reportDeep(renamed: RenamedSpecifier, location: string, findings: Findings): void {\n if (renamed.isDeep) {\n findings.manualSteps.push({ kind: \"deep-target\", location, specifier: renamed.to });\n }\n}\n\n/**\n * Rename the module specifiers among the strings below `nodes` (`field` locates them in the\n * report): a target that names an original package, or a subpath of it, gets the new name.\n */\nexport function renameSpecifierTargets(\n nodes: readonly TreeNode[],\n field: string,\n findings: Findings,\n): void {\n for (const target of documentStrings(nodes)) {\n const renamed = renamedSpecifier(target.value);\n if (renamed === undefined) {\n continue;\n }\n const location = [field, ...target.path].join(PATH_SEPARATOR);\n if (target.encode === undefined) {\n findings.manualSteps.push({ kind: \"entry-not-edited\", field: location, name: target.value });\n continue;\n }\n findings.edits.push(replaceScalar({ ...target, encode: target.encode }, renamed.to));\n findings.changes.push({\n kind: \"package-name-renamed\",\n location,\n from: target.value,\n to: renamed.to,\n });\n reportDeep(renamed, location, findings);\n }\n}\n\n/** A key that was renamed, by where it is, with its new name. */\ninterface RenamedKey {\n readonly location: string;\n readonly renamed: RenamedSpecifier;\n}\n\n/**\n * Rename the keys of `map` that are specifiers of an original package (`field` locates them), and\n * return them. A key whose new name the map already has is kept and reported, as dependency keys\n * are.\n */\nexport function renameSpecifierKeys(map: TreeMap, field: string, findings: Findings): RenamedKey[] {\n const keys = textEntries(map).map(({ key }) => key);\n const names = new Set(keys.map((key) => key.value));\n return keys.flatMap((key): RenamedKey[] => {\n const renamed = renamedSpecifier(key.value);\n if (renamed === undefined) {\n return [];\n }\n if (key.encode === undefined) {\n findings.manualSteps.push({ kind: \"entry-not-edited\", field, name: key.value });\n return [];\n }\n const { to } = renamed;\n if (!isFree({ from: key.value, to, field, names }, findings)) {\n return [];\n }\n findings.edits.push(replaceScalar({ ...key, encode: key.encode }, to));\n findings.changes.push({ kind: \"package-name-renamed\", location: field, from: key.value, to });\n return [{ location: `${field}${PATH_SEPARATOR}${key.value}`, renamed }];\n });\n}\n\nexport function migrateSubpathImports(manifest: TreeMap, findings: Findings): void {\n renameSpecifierTargets(valuesAt(manifest, IMPORTS_FIELD), IMPORTS_FIELD, findings);\n}\n\nexport function migrateBrowserField(manifest: TreeMap, findings: Findings): void {\n for (const browser of valuesAt(manifest, BROWSER_FIELD).filter(isMap)) {\n // A deep key replaces a file of the package, which the new package may not have there.\n for (const { location, renamed } of renameSpecifierKeys(browser, BROWSER_FIELD, findings)) {\n reportDeep(renamed, location, findings);\n }\n for (const { key, value } of textEntries(browser)) {\n renameSpecifierTargets([value], `${BROWSER_FIELD}${PATH_SEPARATOR}${key.value}`, findings);\n }\n }\n}\n\n/**\n * Report each string under `node` (at `prefix` of its file) that is a path into the installed\n * files of an old package (`node_modules/openapi-fetch/…`): the new package has its own files\n * there, so only the user can say where the path should point.\n */\nexport function reportOldPackagePaths(\n node: TreeNode,\n prefix: DocumentPath,\n findings: Findings,\n): void {\n for (const value of documentStrings([node])) {\n const name = oldPackageInNodeModules(value.value);\n const to = name === undefined ? undefined : PACKAGE_RENAMES.get(name);\n if (name !== undefined && to !== undefined) {\n const location = [...prefix, ...value.path].join(PATH_SEPARATOR);\n findings.manualSteps.push({ kind: \"old-package-path\", location, path: value.value, to });\n }\n }\n}\n","import { manifestCatalogMaps } from \"./catalogs.js\";\nimport {\n type DocumentRead,\n isMap,\n mapsAt,\n type TreeMap,\n textEntries,\n unreadableConfig,\n valuesAt,\n} from \"./config-documents.js\";\nimport { declaredNames } from \"./declared-packages.js\";\nimport {\n type Findings,\n migrateSpecMap,\n newFindings,\n type RenameTarget,\n renameNames,\n} from \"./dependency-map.js\";\nimport { JEST_FIELD, jestConfigSteps } from \"./jest-config.js\";\nimport { type FileMigration, unchanged } from \"./migration-findings.js\";\nimport { overriddenPackages } from \"./override-targets.js\";\nimport {\n DEPENDENCY_FIELDS,\n NAME_KEYED_FIELDS,\n NAME_LIST_FIELDS,\n namesOriginalPackage,\n OLD_PEER_DEPENDENTS,\n OVERRIDE_FIELDS,\n PACKAGE_RENAMES,\n PNPM_SETTINGS_FIELD,\n} from \"./package-names.js\";\nimport {\n oldPackagesNamedBy,\n reportSettingSections,\n type SettingsFile,\n} from \"./settings-sections.js\";\nimport {\n migrateBrowserField,\n migrateSubpathImports,\n reportOldPackagePaths,\n} from \"./specifier-maps.js\";\nimport { overriddenOldPackages } from \"./successor-aliases.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { itemEntries, keyEntries, specEntries } from \"./tree-entries.js\";\n\n/**\n * A package manifest: package.json, or the `package.yaml` that pnpm reads in its place. It is\n * edited in place: a renamed key or a new spec replaces that one value, and everything else stays\n * as written (domain/config-documents.ts). Scripts are commands: file-migrations.ts migrates\n * them with the other command files.\n */\n\n/** TypeScript's `typesVersions`: its paths may point into the installed files of an old package. */\nconst TYPES_VERSIONS_FIELD = \"typesVersions\";\n\nfunction migrateDependencyFields(manifest: TreeMap, target: RenameTarget, findings: Findings) {\n for (const field of DEPENDENCY_FIELDS) {\n for (const dependencies of mapsAt(manifest, field)) {\n const map = { kind: \"dependencies\", field } as const;\n migrateSpecMap(specEntries(dependencies), { ...target, map, findings });\n }\n }\n}\n\n/**\n * Keys of the meta fields that name an original package are renamed. A key with a version\n * (`openapi-fetch@0.13.0`, as Yarn allows) would need a new version too, so it is reported.\n */\nfunction migrateNameKeys(manifest: TreeMap, findings: Findings): void {\n for (const field of NAME_KEYED_FIELDS) {\n for (const meta of mapsAt(manifest, field)) {\n renameNames(keyEntries(meta), field, findings);\n const versioned = textEntries(meta)\n .map(({ key }) => key.value)\n .filter((key) => !PACKAGE_RENAMES.has(key));\n for (const name of overriddenPackages(versioned)) {\n findings.manualSteps.push({ kind: \"override-names-package\", field, name });\n }\n }\n }\n}\n\nfunction migrateNameLists(manifest: TreeMap, findings: Findings): void {\n for (const field of NAME_LIST_FIELDS) {\n for (const list of valuesAt(manifest, field)) {\n if (list.kind === \"list\") {\n renameNames(itemEntries(list), field, findings);\n }\n }\n }\n}\n\n/** bun's `catalog` and `catalogs.<name>`, at the top level and under `workspaces`. */\nfunction migrateCatalogs(manifest: TreeMap, target: RenameTarget, findings: Findings): void {\n for (const { name, label, map } of manifestCatalogMaps(manifest)) {\n const context = {\n ...target,\n map: { kind: \"catalog\", catalog: label, name } as const,\n findings,\n };\n migrateSpecMap(specEntries(map), context);\n }\n}\n\n/** pnpm's settings in package.json: none of them is migrated, `overrides` among them. */\nconst PNPM_SETTINGS: SettingsFile = {\n migratedSections: new Set(),\n overrideSections: new Set([\"overrides\", \"patchedDependencies\"]),\n prefix: `${PNPM_SETTINGS_FIELD}.`,\n};\n\n/**\n * bun's top-level settings that name packages: `trustedDependencies` lists the packages whose\n * install scripts may run, as pnpm's `onlyBuiltDependencies` does.\n */\nconst BUN_SETTING_FIELDS = [\"trustedDependencies\"] as const;\n\n/**\n * Overrides, resolutions and the settings of pnpm and bun can name the old packages; changing\n * them needs the user's intent (domain/settings-sections.ts).\n */\nfunction reportSettings(manifest: TreeMap, findings: Findings): void {\n for (const field of OVERRIDE_FIELDS) {\n for (const name of valuesAt(manifest, field).flatMap(overriddenOldPackages)) {\n findings.manualSteps.push({ kind: \"override-names-package\", field, name });\n }\n }\n for (const field of BUN_SETTING_FIELDS) {\n for (const name of valuesAt(manifest, field).flatMap(oldPackagesNamedBy)) {\n findings.manualSteps.push({ kind: \"setting-names-package\", field, name });\n }\n }\n for (const settings of mapsAt(manifest, PNPM_SETTINGS_FIELD)) {\n reportSettingSections(settings, PNPM_SETTINGS, findings);\n }\n}\n\n/**\n * A dependency that needs an original package as its peer keeps needing it after the rename,\n * unless an override of this manifest or of a workspace above it (`aliased`, from the project\n * plan) already points the peer at its successor.\n */\nfunction reportOldPeers(manifest: TreeMap, aliased: ReadonlySet<string>, findings: Findings) {\n const dependencies = new Set(declaredNames(manifest));\n for (const [dependent, { peer, range }] of OLD_PEER_DEPENDENTS) {\n if (dependencies.has(dependent) && !aliased.has(peer)) {\n findings.manualSteps.push({ kind: \"old-peer-needed\", dependent, peer, range });\n }\n }\n}\n\n/**\n * What a manifest is migrated with: the rename target, and the original packages that the\n * overrides of a workspace above it alias to their successors (domain/successor-aliases.ts).\n */\nexport interface ManifestTarget extends RenameTarget {\n readonly aliased?: ReadonlySet<string>;\n}\n\nfunction migrateManifestMap(manifest: TreeMap, target: ManifestTarget, findings: Findings): void {\n migrateDependencyFields(manifest, target, findings);\n migrateNameKeys(manifest, findings);\n migrateNameLists(manifest, findings);\n migrateCatalogs(manifest, target, findings);\n migrateSubpathImports(manifest, findings);\n migrateBrowserField(manifest, findings);\n for (const versions of valuesAt(manifest, TYPES_VERSIONS_FIELD)) {\n reportOldPackagePaths(versions, [TYPES_VERSIONS_FIELD], findings);\n }\n reportSettings(manifest, findings);\n for (const jest of valuesAt(manifest, JEST_FIELD)) {\n findings.manualSteps.push(...jestConfigSteps(jest, [JEST_FIELD]));\n }\n reportOldPeers(manifest, target.aliased ?? new Set(), findings);\n}\n\n/**\n * Migrate the package names of a manifest (`read` is `text` parsed): rename the original packages\n * in the dependency fields (with `version` as the new version), in the fields that name\n * dependencies, in bun's catalogs, in the targets of subpath imports and in the `browser` field,\n * and report overrides that name the original packages.\n */\nexport function migratePackageManifest(\n text: string,\n read: DocumentRead,\n target: ManifestTarget,\n): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const manifest of read.documents.filter(isMap)) {\n migrateManifestMap(manifest, target, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n\n/**\n * A manifest in a format the tool does not read: pnpm's `package.json5`. JSON5 has its own\n * strings (single quotes, line continuations), so it is not edited; a manifest that names an\n * original package is reported for the user to migrate.\n */\nexport function unreadManifest(text: string): FileMigration {\n return namesOriginalPackage(text)\n ? { ...unchanged(text), manualSteps: [{ kind: \"manifest-not-read\" }] }\n : unchanged(text);\n}\n","import type { ManualStep } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * Patches to the code of an installed package, by the file names their tools give them:\n * patch-package `openapi-fetch+0.13.0.patch` (`parent++openapi-fetch+0.13.0.patch` for a nested\n * one), pnpm `openapi-fetch@0.13.0.patch`, Yarn `openapi-fetch-npm-0.13.0-<hash>.patch`. The new\n * package has other code, so a patch to an old one cannot be carried over: it is reported.\n */\n\nconst PATCH_EXTENSION = \".patch\";\nconst NESTED_SEPARATOR = \"++\";\n/** What follows the package name in each tool's file name. */\nconst NAME_ENDS = [\"+\", \"@\", \"-npm-\"] as const;\n\n/** The old package that a patch file patches, by its file name, or undefined. */\nexport function patchedOldPackage(fileName: string): string | undefined {\n if (!fileName.endsWith(PATCH_EXTENSION)) {\n return undefined;\n }\n const innermost = fileName.split(NESTED_SEPARATOR).at(-1) ?? fileName;\n return [...PACKAGE_RENAMES.keys()].find((name) =>\n NAME_ENDS.some((end) => innermost.startsWith(`${name}${end}`)),\n );\n}\n\n/** The manual step for a patch file of an old package. */\nexport function oldPackagePatchSteps(fileName: string): ManualStep[] {\n const name = patchedOldPackage(fileName);\n const to = name === undefined ? undefined : PACKAGE_RENAMES.get(name);\n return name === undefined || to === undefined ? [] : [{ kind: \"old-package-patch\", name, to }];\n}\n","import type { DocumentString } from \"./config-documents.js\";\nimport type { FileVariables, VariableReference } from \"./file-variables.js\";\nimport { expressionLiterals, isWholeExpression, mapExpressions } from \"./workflow-expressions.js\";\n\n/**\n * The default of a parameter (yaml-parameters.ts: an input of a GitHub action or workflow, a\n * GitLab input, a CircleCI or Azure parameter) is the value of `${{ inputs.NAME }}` when the\n * caller gives none, so a command gets the flags in it from there.\n */\nconst BLANK = \" \";\nconst SURROUNDING_QUOTES_RE = /^\"(.*)\"$/s;\n\n/**\n * A reference to an input in an expression: `inputs.NAME`, `github.event.inputs.NAME`, or the\n * same with the name as a key, `inputs['NAME']`.\n */\nconst INPUT_REFERENCE_RE =\n /(?<![\\w.-])(?:github\\.event\\.)?inputs(?:\\.([A-Za-z_][A-Za-z0-9_-]*)|\\[[ \\t]*'([^']*)'[ \\t]*\\])/g;\n\n/** The values of the inputs of a file, by name; the defaults of one name are read as one. */\nexport function inputValues(\n defaults: ReadonlyMap<DocumentString, string>,\n): ReadonlyMap<string, string> {\n const values = new Map<string, string>();\n for (const [value, name] of defaults) {\n values.set(\n name,\n [values.get(name), value.value].filter((part) => part !== undefined).join(BLANK),\n );\n }\n return values;\n}\n\n/**\n * What one expression can give, as text: the default of each input it reads and each string\n * literal it holds (`${{ inputs.flags || '-it' }}` gives `-it` either way).\n */\nfunction expressionValue(expression: string, defaults: ReadonlyMap<string, string>): string {\n const inputs = [...expression.matchAll(INPUT_REFERENCE_RE)].flatMap((match) => {\n const value = defaults.get(match[1] ?? match[2] ?? \"\");\n return value === undefined ? [] : [value];\n });\n const literals = expressionLiterals(expression).map((literal) => literal.text);\n return [...inputs, ...literals].join(BLANK);\n}\n\n/**\n * The variables with the values of workflow expressions: an argument that is one expression gets\n * the defaults of the inputs it reads and its string literals as its value, and the value of a\n * variable (`FL: ${{ inputs.flags }}` used as `$FL`) has its expressions read so too, so their old\n * flags are reported, as `$FLAGS` does for an `env` value.\n */\nexport function withInputDefaults(\n variables: FileVariables,\n defaults: ReadonlyMap<string, string>,\n): FileVariables {\n const expressionsRead = (text: string): string =>\n mapExpressions(text, (expression) => expressionValue(expression, defaults));\n return {\n programAt: (program) => variables.programAt(program),\n referenceAt: (word): VariableReference | undefined => {\n const reference = variables.referenceAt(word);\n if (reference !== undefined) {\n return { ...reference, value: expressionsRead(reference.value) };\n }\n // The quotes around a whole expression (`\"${{ inputs.flags }}\"`) keep its value one word.\n const unquoted = word.raw.replace(SURROUNDING_QUOTES_RE, \"$1\");\n const value = isWholeExpression(word.raw) ? expressionsRead(unquoted) : \"\";\n return value.trim() === \"\" ? undefined : { written: word.raw, value };\n },\n };\n}\n","import type { Finding, Locate } from \"./argument-findings.js\";\nimport { commandWordFindings, type ShellTextFindings, textFindings } from \"./command-migration.js\";\nimport { type DocumentString, ownerKey } from \"./config-documents.js\";\nimport { entrypointArgumentFindings, shellScript } from \"./entrypoint-arguments.js\";\nimport { type ShellWord, shellCommands } from \"./shell-words.js\";\n\n/**\n * The commands of containers in YAML files, the one place that builds them: Compose, GitLab and\n * CircleCI images append `command` to `entrypoint`, Kubernetes appends `args` to `command`, both\n * keys in one map. A list value is exec form, each item one word that no shell splits; a string\n * value is shell text, read where it is written as other command values are. When every part is\n * a list, the container runs one command of all their items (`[\"npx\"]` and then\n * `[\"openapi-typescript\", \"-it\"]`), read once for its old names and flags and for the command line\n * of `[\"sh\", \"-c\", \"…\"]`. When a part is a string, the command is the arguments of the\n * entrypoint (entrypoint-arguments.ts).\n */\n\n/** The key of an entrypoint, and the key of its arguments in the same map. */\nconst ARGUMENT_KEYS: ReadonlyMap<string, string> = new Map([\n [\"entrypoint\", \"command\"],\n [\"command\", \"args\"],\n]);\nconst PAIRED_KEYS: ReadonlySet<string> = new Set([\n ...ARGUMENT_KEYS.keys(),\n ...ARGUMENT_KEYS.values(),\n]);\n/** A key whose value only adds to a command: `args` alone runs the image's own program. */\nconst TRAILING_KEY = \"args\";\nconst LINE_BREAK = \"\\n\";\n\n/** One value of a paired key: its strings (one scalar, or the items of one list). */\ninterface KeyValue {\n readonly map: string;\n readonly key: string;\n readonly strings: DocumentString[];\n}\n\nconst isItem = (string: DocumentString): boolean => typeof string.path.at(-1) === \"number\";\n\n/** Whether a value is an item of a container's list, which the container commands read. */\nexport const isContainerListItem = (string: DocumentString): boolean =>\n isItem(string) && PAIRED_KEYS.has(String(string.path.at(-2)));\n\nconst isList = (value: KeyValue): boolean =>\n value.strings[0] !== undefined && isItem(value.strings[0]);\n\n/** The path of the map that holds a value, as text. */\nconst mapOf = (string: DocumentString): string =>\n JSON.stringify(string.path.slice(0, isItem(string) ? -2 : -1));\n\n/** Whether `string` is the next item of the list that `value` holds. */\nfunction isNextItem(value: KeyValue | undefined, string: DocumentString): boolean {\n const last = value?.strings.at(-1);\n return (\n last !== undefined &&\n isItem(last) &&\n isItem(string) &&\n JSON.stringify(last.path.slice(0, -1)) === JSON.stringify(string.path.slice(0, -1)) &&\n Number(string.path.at(-1)) > Number(last.path.at(-1))\n );\n}\n\n/**\n * The values of the paired keys, in the order of the text, each place once (an alias gives the\n * strings of its anchor again). A stream of documents repeats a path, so a scalar, or a list item\n * whose index does not grow, starts another value.\n */\nfunction keyValues(strings: readonly DocumentString[]): KeyValue[] {\n const values: KeyValue[] = [];\n const starts = new Set<number>();\n for (const string of strings) {\n const key = ownerKey(string.path) ?? \"\";\n const isValue = isItem(string) ? string.path.at(-2) === key : string.path.at(-1) === key;\n if (!PAIRED_KEYS.has(key) || !isValue || starts.has(string.start)) {\n continue;\n }\n starts.add(string.start);\n const last = values.at(-1);\n if (last !== undefined && isNextItem(last, string)) {\n last.strings.push(string);\n } else {\n values.push({ map: mapOf(string), key, strings: [string] });\n }\n }\n return values;\n}\n\n/** Whether a scalar's text as written is its value, so its words can be edited in place. */\nconst isPlaceable = (string: DocumentString, text: string): boolean =>\n !string.isEscaped &&\n !(string.isFolded && text.slice(string.content.start, string.content.end).includes(LINE_BREAK));\n\n/** A word of a container's command, with the list item that holds it when it is one. */\ninterface ContainerWord extends ShellWord {\n readonly item?: DocumentString;\n}\n\n/** The words of a value and whether they are placed where they are written. */\ninterface ValueWords {\n readonly words: readonly ContainerWord[];\n readonly isPlaced: boolean;\n}\n\n/** The first command of a scalar: placed in the text, or all at its start when it cannot be. */\nfunction scalarWords(scalar: DocumentString, text: string): ValueWords {\n const { start, end } = scalar.content;\n const isPlaced = isPlaceable(scalar, text);\n const [words = []] = shellCommands(isPlaced ? text.slice(start, end) : scalar.value);\n const at = (word: ShellWord): ShellWord =>\n isPlaced\n ? { ...word, start: word.start + start, end: word.end + start }\n : { ...word, start: scalar.start, end: scalar.start };\n return { words: words.map(at), isPlaced };\n}\n\n/** The words of a value: each list item, or the first command of a scalar. */\nfunction valueWords(value: KeyValue, text: string): ValueWords {\n const [first] = value.strings;\n if (first !== undefined && !isItem(first)) {\n return scalarWords(first, text);\n }\n const words = value.strings.map((item): ContainerWord => {\n const { start, end } = item.content;\n return { start, end, value: item.value, raw: text.slice(start, end), item };\n });\n return { words, isPlaced: true };\n}\n\n/** The entrypoint and the arguments of two values next to each other, in either order. */\nfunction pairOf(left: KeyValue, right: KeyValue | undefined): [KeyValue, KeyValue] | undefined {\n if (right === undefined || left.map !== right.map) {\n return undefined;\n }\n if (ARGUMENT_KEYS.get(left.key) === right.key) {\n return [left, right];\n }\n return ARGUMENT_KEYS.get(right.key) === left.key ? [right, left] : undefined;\n}\n\n/** One container: its entrypoint (or its only part) and the command it gets as arguments. */\ninterface Container {\n readonly entrypoint: KeyValue;\n readonly command: KeyValue | undefined;\n}\n\n/**\n * The containers of an entrypoint and its arguments next to each other in one map, from the start\n * of the text, each value in one container: the documents of a stream may hold the same map path,\n * so a value is paired with its neighbour in the same document. An `args` value alone is left out.\n */\nfunction containers(values: readonly KeyValue[]): Container[] {\n const found: Container[] = [];\n for (let index = 0; index < values.length; index++) {\n const value = values[index] as KeyValue;\n const pair = pairOf(value, values[index + 1]);\n if (pair !== undefined) {\n found.push({ entrypoint: pair[0], command: pair[1] });\n index++;\n } else if (value.key !== TRAILING_KEY) {\n found.push({ entrypoint: value, command: undefined });\n }\n }\n return found;\n}\n\n/**\n * The exec-form command of a container: the items of its lists, the entrypoint first. A string\n * part is read where it is written, so a container with one holds at most one list.\n */\nfunction listCommand({ entrypoint, command }: Container, text: string): ContainerWord[] {\n const parts = command === undefined ? [entrypoint] : [entrypoint, command];\n return parts.filter(isList).flatMap((part) => valueWords(part, text).words);\n}\n\n/**\n * The old flags in the command that a container's entrypoint gets as arguments, where the joined\n * command does not show them: after a string entrypoint, or after a shell script that may pass its\n * arguments on. A command whose text is not its value as written is reported, not edited.\n */\nfunction argumentFindings(container: Container, text: string, locate: Locate): Finding[] {\n const { entrypoint, command } = container;\n if (command === undefined) {\n return [];\n }\n const words = valueWords(entrypoint, text).words;\n if (isList(entrypoint) && isList(command) && shellScript(words) === undefined) {\n return [];\n }\n const args = valueWords(command, text);\n const pair = { entrypoint: words, command: args.words, written: entrypoint.key };\n return entrypointArgumentFindings({ ...pair, isPlaced: args.isPlaced }, locate);\n}\n\n/** What the commands of the containers in a YAML file give. */\nexport interface ContainerCommands {\n /** The old names and flags of the commands. */\n readonly findings: readonly ShellTextFindings[];\n /** The items that a shell the commands start reads as command lines (`[\"sh\", \"-c\", \"…\"]`). */\n readonly scripts: ReadonlySet<DocumentString>;\n}\n\n/** The commands of the containers in a YAML file: their findings and their shell scripts. */\nexport function containerCommands(\n text: string,\n strings: readonly DocumentString[],\n locate: Locate,\n): ContainerCommands {\n const found = containers(keyValues(strings));\n const commands = found.map((container) => listCommand(container, text));\n const scripts = commands.flatMap((words) => shellScript(words)?.item ?? []);\n const flags = found.flatMap((container) => argumentFindings(container, text, locate));\n return {\n findings: [commandWordFindings(commands, locate), textFindings(flags)],\n scripts: new Set(scripts),\n };\n}\n","/**\n * The keys whose values YAML files run as shell commands. A file kind that runs other keys\n * (Taskfile `cmds`, pre-commit `entry`) adds its own to the common ones.\n */\n\n/**\n * Keys whose value is a shell command or a list of them: GitHub Actions and lefthook `run`,\n * GitLab, Travis and Bitbucket `script` and its hooks, Azure Pipelines `script` / `bash` /\n * `pwsh`, CircleCI `command`, Drone `commands`, Docker Compose `command` and `entrypoint`.\n */\nexport const YAML_COMMAND_KEYS: ReadonlySet<string> = new Set([\n \"run\",\n \"script\",\n \"before_script\",\n \"after_script\",\n \"before_install\",\n \"install\",\n \"bash\",\n \"pwsh\",\n \"powershell\",\n \"command\",\n \"commands\",\n \"entrypoint\",\n]);\n\n/**\n * Task (Taskfile.yml): `cmds` and `cmd` run commands, `defer` runs one when the task ends, `sh`\n * computes a variable or checks a precondition with one, `preconditions` lists such checks in\n * short form, and `status` lists commands that tell whether a task is up to date. A deferred task\n * (`defer: { task: … }`) and a precondition's `msg` are under other keys.\n */\nexport const TASKFILE_COMMAND_KEYS: ReadonlySet<string> = new Set([\n ...YAML_COMMAND_KEYS,\n \"cmds\",\n \"cmd\",\n \"defer\",\n \"sh\",\n \"preconditions\",\n \"status\",\n]);\n","import type { DocumentPath, DocumentString } from \"./config-documents.js\";\nimport { referencedProjectPath } from \"./relative-references.js\";\n\n/**\n * The files that a YAML file includes, as its tool reads them: a Taskfile's `includes`, a GitLab\n * CI `include` of a local file, an Azure Pipelines `template`. The tool reads an included file\n * as a part of the file that includes it, so it is migrated as a file of the same kind whatever\n * its name (application/yaml-file-reach.ts).\n */\nexport interface YamlIncludes {\n /** Whether the value at `path` names an included file. */\n readonly isIncludeAt: (path: DocumentPath) => boolean;\n /** Whether a path as written is from the project root, not from the including file's folder. */\n readonly isFromRoot: (reference: string) => boolean;\n}\n\nconst ROOT_PREFIX = \"/\";\n/**\n * A path that the tool computes (`$CI_DIR/gen.yml`, `{{.OS}}.yml`) or a URL. A path of another\n * repository (`gen.yml@templates`) does not end as a YAML file does.\n */\nconst NOT_A_PROJECT_PATH_RE = /\\{\\{|\\$|^[a-z][a-z\\d+.-]*:/i;\nconst LEADING_ROOT_RE = /^\\/+/;\nconst YAML_FILE_RE = /\\.ya?ml$/;\n\nexport const NO_INCLUDES: YamlIncludes = {\n isIncludeAt: () => false,\n isFromRoot: () => false,\n};\n\nconst TASKFILE_INCLUDES_KEY = \"includes\";\nconst TASKFILE_KEY = \"taskfile\";\n\n/** Task `includes: { gen: ./tasks/gen.yml }`, also `{ taskfile: … }`, from the file's folder. */\nexport const TASKFILE_INCLUDES: YamlIncludes = {\n isIncludeAt: ([key, name, field]) =>\n key === TASKFILE_INCLUDES_KEY &&\n typeof name === \"string\" &&\n (field === undefined || field === TASKFILE_KEY),\n isFromRoot: () => false,\n};\n\nconst GITLAB_INCLUDE_KEY = \"include\";\nconst GITLAB_LOCAL_KEY = \"local\";\n\n/**\n * GitLab `include: gen.yml`, `include: [gen.yml]` and `include: { local: gen.yml }`, in a list\n * too: a local include names a file from the project root, with or without a leading `/`.\n */\nexport const GITLAB_INCLUDES: YamlIncludes = {\n isIncludeAt: ([key, ...rest]) => {\n const [first] = typeof rest[0] === \"number\" ? rest.slice(1) : rest;\n const isLocal = first === undefined || first === GITLAB_LOCAL_KEY;\n return key === GITLAB_INCLUDE_KEY && isLocal;\n },\n isFromRoot: () => true,\n};\n\nconst AZURE_TEMPLATE_KEY = \"template\";\n\n/** Azure Pipelines `- template: gen.yml` of any part, from the file's folder or from `/`. */\nexport const AZURE_TEMPLATES: YamlIncludes = {\n isIncludeAt: (path) => path.at(-1) === AZURE_TEMPLATE_KEY,\n isFromRoot: (reference) => reference.startsWith(ROOT_PREFIX),\n};\n\n/**\n * The project paths of the YAML files that the file at `fromPath` includes. GitLab may name\n * several files with `*` and `**`, which stay in the path for the caller to match.\n */\nexport function includedPaths(\n fromPath: string,\n strings: readonly DocumentString[],\n includes: YamlIncludes,\n): string[] {\n return strings.flatMap((string) => {\n const reference = string.value.trim();\n if (!includes.isIncludeAt(string.path) || NOT_A_PROJECT_PATH_RE.test(reference)) {\n return [];\n }\n const path = includes.isFromRoot(reference)\n ? referencedProjectPath(\"\", reference.replace(LEADING_ROOT_RE, \"\"))\n : referencedProjectPath(fromPath, reference);\n return path !== undefined && YAML_FILE_RE.test(path) ? [path] : [];\n });\n}\n","import type { DocumentString } from \"./config-documents.js\";\n\nconst NAME_KEY = \"name\";\n\n/** The `name` of the list item that `strings[index]` is the `value` of, or undefined. */\nexport function itemName(strings: readonly DocumentString[], index: number): string | undefined {\n const item = strings[index]?.path.slice(0, -1) ?? [];\n const isInItem = (string: DocumentString | undefined): boolean =>\n string !== undefined && item.every((part, at) => string.path[at] === part);\n const isName = (string: DocumentString): boolean =>\n string.path.length === item.length + 1 && string.path.at(-1) === NAME_KEY;\n let [first, last] = [index, index];\n while (isInItem(strings[first - 1])) {\n first -= 1;\n }\n while (isInItem(strings[last + 1])) {\n last += 1;\n }\n return strings.slice(first, last + 1).find(isName)?.value;\n}\n","import type { DocumentString } from \"./config-documents.js\";\nimport { EXPRESSION_OPEN, mapExpressions } from \"./workflow-expressions.js\";\nimport { itemName } from \"./yaml-list-items.js\";\n\n/**\n * The parameters of a YAML file kind: inputs of a GitHub action or reusable workflow, GitLab\n * `spec: inputs`, CircleCI `parameters`, Azure template `parameters`. The tool puts a parameter's\n * value into a command before the shell runs, so its default is command text, and a reference\n * to it gives the default when the caller passes none. Each kind's references are read as the\n * workflow expressions of input-defaults.ts: `$[[ inputs.gen ]]` and `<< parameters.gen >>` as\n * `${{ inputs.gen }}`, with the offsets kept.\n */\nexport interface YamlParameters {\n /** The name of the parameter whose default `strings[index]` is, or undefined. */\n readonly defaultOf: (strings: readonly DocumentString[], index: number) => string | undefined;\n /** Shell text with the references to parameters written as expressions of `inputs`. */\n readonly asExpressions: (text: string) => string;\n}\n\nconst DEFAULT_KEY = \"default\";\nconst INPUTS_KEY = \"inputs\";\nconst PARAMETERS_KEY = \"parameters\";\nconst SPEC_KEY = \"spec\";\n/** `spec.inputs.NAME.default`: the parts of a GitLab input default's path. */\nconst SPEC_INPUT_DEPTH = 4;\nconst PATH_TAIL: readonly number[] = [-1, -2, -3];\n\n/** The name of a `KEY.NAME.default` value under `key`, or undefined. */\nfunction defaultUnder(key: string, value: DocumentString | undefined): string | undefined {\n const [last, name, owner] = PATH_TAIL.map((at) => value?.path.at(at));\n return last === DEFAULT_KEY && owner === key && typeof name === \"string\" ? name : undefined;\n}\n\nexport const NO_PARAMETERS: YamlParameters = {\n defaultOf: () => undefined,\n asExpressions: (text) => text,\n};\n\n/**\n * GitHub Actions: `inputs.NAME.default` of an action (`action.yml`) and of a reusable or manual\n * workflow (`on.workflow_call.inputs`), read as `${{ inputs.NAME }}`.\n */\nexport const GITHUB_INPUTS: YamlParameters = {\n defaultOf: (strings, index) => defaultUnder(INPUTS_KEY, strings[index]),\n asExpressions: (text) => text,\n};\n\n/** GitLab interpolation, `$[[ inputs.gen ]]`: its brackets are as long as an expression's. */\nconst GITLAB_INTERPOLATION_RE = /\\$\\[\\[(.*?)\\]\\]/g;\n\n/** GitLab CI inputs of the header document of a file (`spec: inputs: gen: default: …`). */\nexport const GITLAB_INPUTS: YamlParameters = {\n defaultOf: (strings, index) => {\n const value = strings[index];\n const isSpec = value?.path.length === SPEC_INPUT_DEPTH && value.path[0] === SPEC_KEY;\n return isSpec ? defaultUnder(INPUTS_KEY, value) : undefined;\n },\n asExpressions: (text) => text.replace(GITLAB_INTERPOLATION_RE, \"$${{$1}}\"),\n};\n\n/** `<< parameters.gen >>` and `<< pipeline.parameters.gen >>`, longer than their expressions. */\nconst CIRCLECI_PARAMETER_RE =\n /<<[ \\t]*(?:pipeline\\.)?parameters\\.([A-Za-z_][A-Za-z0-9_-]*)[ \\t]*>>/g;\nconst EXPRESSION_CLOSE = \"}}\";\n\n/** A CircleCI parameter reference as `${{ inputs.NAME }}`, padded inside to its length. */\nconst asInputExpression = (written: string, name: string): string =>\n `${EXPRESSION_OPEN} ${INPUTS_KEY}.${name}`.padEnd(written.length - EXPRESSION_CLOSE.length, \" \") +\n EXPRESSION_CLOSE;\n\n/** CircleCI `parameters` of a job, a command, an executor or the pipeline, with defaults. */\nexport const CIRCLECI_PARAMETERS: YamlParameters = {\n defaultOf: (strings, index) => defaultUnder(PARAMETERS_KEY, strings[index]),\n asExpressions: (text) => text.replace(CIRCLECI_PARAMETER_RE, asInputExpression),\n};\n\n/** `parameters` before `.NAME` or `['NAME']` in an expression, not as part of a longer name. */\nconst AZURE_PARAMETERS_RE = /(?<![\\w.-])parameters(?=\\.|\\[)/g;\n/** `inputs` padded before to the length of `parameters`, so the name after it keeps its place. */\nconst AZURE_AS_INPUTS = INPUTS_KEY.padStart(PARAMETERS_KEY.length, \" \");\n\n/** Azure Pipelines template `parameters`: a list of `- name: … / default: …` items. */\nexport const AZURE_PARAMETERS: YamlParameters = {\n defaultOf: (strings, index) => {\n const [last, item, owner] = PATH_TAIL.map((at) => strings[index]?.path.at(at));\n const isDefault = last === DEFAULT_KEY && typeof item === \"number\" && owner === PARAMETERS_KEY;\n return isDefault ? itemName(strings, index) : undefined;\n },\n asExpressions: (text) =>\n mapExpressions(text, (expression) => expression.replace(AZURE_PARAMETERS_RE, AZURE_AS_INPUTS)),\n};\n\n/** The parameter defaults of a file, by value, with the name of the parameter of each. */\nexport function parameterDefaults(\n strings: readonly DocumentString[],\n parameters: YamlParameters,\n): ReadonlyMap<DocumentString, string> {\n return new Map(\n strings.flatMap((value, index) => {\n const name = parameters.defaultOf(strings, index);\n return name === undefined ? [] : [[value, name] as const];\n }),\n );\n}\n","import { TASKFILE_COMMAND_KEYS, YAML_COMMAND_KEYS } from \"./yaml-command-keys.js\";\nimport {\n AZURE_TEMPLATES,\n GITLAB_INCLUDES,\n NO_INCLUDES,\n TASKFILE_INCLUDES,\n type YamlIncludes,\n} from \"./yaml-includes.js\";\nimport {\n AZURE_PARAMETERS,\n CIRCLECI_PARAMETERS,\n GITHUB_INPUTS,\n GITLAB_INPUTS,\n NO_PARAMETERS,\n type YamlParameters,\n} from \"./yaml-parameters.js\";\n\n/**\n * Where a YAML file kind sets the variables its commands run (`$GEN`), and how its commands name\n * them. A variable can hold a command, so each value is read as shell text: it changes only where\n * the generator is in command position, never in a sentence that names it.\n */\nexport interface YamlEnvironment {\n /** Keys whose map holds variables by name. */\n readonly keys: ReadonlySet<string>;\n /** Whether a variable can be a map with its value under `value` and its `options` (GitLab). */\n readonly hasValueMaps: boolean;\n /** Whether the map can be a list of `NAME=value` items (Compose). */\n readonly hasListItems: boolean;\n /** Whether the map can be a list of `{ name, value }` items (Azure Pipelines). */\n readonly hasNamedItems: boolean;\n /**\n * A reference that the file's tool replaces with a variable's value before the shell runs\n * (Task `{{.GEN}}`), with the name in one of its groups; global. A reference to a variable\n * the file does not set is read as written: Azure leaves `$(date)` as it is, and the shell\n * runs it as a command.\n */\n readonly reference: RegExp | undefined;\n /** The name the shell reads a variable of `key` by (Azure: `my.gen` as `$MY_GEN`). */\n readonly shellName: (name: string, key: string) => string;\n /** Whether the file's tool gives `$$` to the shell as one `$` (Compose). */\n readonly hasDollarEscapes: boolean;\n}\n\n/**\n * A YAML file kind: the keys that hold its commands, where it sets variables, its parameters, and\n * how it names the files it includes.\n */\nexport interface YamlCommandFile {\n readonly commandKeys: ReadonlySet<string>;\n readonly environment: YamlEnvironment;\n readonly parameters: YamlParameters;\n readonly includes: YamlIncludes;\n}\n\nexport const ENV_KEY = \"env\";\nconst ENVIRONMENT_KEY = \"environment\";\nconst VARIABLES_KEY = \"variables\";\nconst VARS_KEY = \"vars\";\nconst PLAIN: Omit<YamlEnvironment, \"keys\"> = {\n hasValueMaps: false,\n hasListItems: false,\n hasNamedItems: false,\n reference: undefined,\n shellName: (name) => name,\n hasDollarEscapes: false,\n};\n\n/** GitHub Actions, Gitea and Forgejo `env`, also of any other YAML file. */\nexport const DEFAULT_YAML_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: { ...PLAIN, keys: new Set([ENV_KEY]) },\n parameters: GITHUB_INPUTS,\n includes: NO_INCLUDES,\n};\n\n/** GitLab CI `variables` of the file and of a job; a value can be a map with `value`. */\nexport const GITLAB_CI_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: { ...PLAIN, keys: new Set([ENV_KEY, VARIABLES_KEY]), hasValueMaps: true },\n parameters: GITLAB_INPUTS,\n includes: GITLAB_INCLUDES,\n};\n\nconst CI_ENVIRONMENT: YamlEnvironment = { ...PLAIN, keys: new Set([ENV_KEY, ENVIRONMENT_KEY]) };\n\n/** Drone and Woodpecker `environment` of a pipeline or a step. */\nexport const CI_ENVIRONMENT_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: CI_ENVIRONMENT,\n parameters: NO_PARAMETERS,\n includes: NO_INCLUDES,\n};\n\n/** CircleCI `environment` of a job, a step or an executor, and its `parameters`. */\nexport const CIRCLECI_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: CI_ENVIRONMENT,\n parameters: CIRCLECI_PARAMETERS,\n includes: NO_INCLUDES,\n};\n\n/**\n * Docker Compose `environment` of a service, as a map or as a list of `NAME=value`. Compose\n * gives `$$GEN` to the container's shell as `$GEN`, which reads the service's `environment`.\n */\nexport const COMPOSE_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: {\n ...PLAIN,\n keys: new Set([ENV_KEY, ENVIRONMENT_KEY]),\n hasListItems: true,\n hasDollarEscapes: true,\n },\n parameters: NO_PARAMETERS,\n includes: NO_INCLUDES,\n};\n\n/**\n * Task `vars` and `env`, of the file and of a task. Task puts `{{.GEN}}` (Go template text) into\n * a command before the shell runs it, as the shell expands `$GEN`.\n */\nexport const TASKFILE: YamlCommandFile = {\n commandKeys: TASKFILE_COMMAND_KEYS,\n environment: {\n ...PLAIN,\n keys: new Set([ENV_KEY, VARS_KEY]),\n reference: /\\{\\{-?[ \\t]*\\.([A-Za-z_][A-Za-z0-9_]*)[ \\t]*-?\\}\\}/g,\n },\n parameters: NO_PARAMETERS,\n includes: TASKFILE_INCLUDES,\n};\n\nconst AZURE_NAME_SEPARATOR_RE = /\\./g;\nconst AZURE_SHELL_SEPARATOR = \"_\";\n\n/**\n * Azure Pipelines `variables` of the file, a stage and a job, as a map or as a list of\n * `{ name, value }` items (a `group` or `template` item sets none the tool can read), and `env` of\n * a step. A script reads a pipeline variable as `$GEN`, by its name upper-cased with `_` for `.`,\n * and Azure puts the value of a macro `$(gen)` or an expression `${{ variables.gen }}` into the\n * script before it runs.\n */\nexport const AZURE_PIPELINES_FILE: YamlCommandFile = {\n commandKeys: YAML_COMMAND_KEYS,\n environment: {\n ...PLAIN,\n keys: new Set([ENV_KEY, VARIABLES_KEY]),\n hasNamedItems: true,\n reference:\n /\\$\\(([A-Za-z_][A-Za-z0-9_.]*)\\)|\\$\\{\\{[ \\t]*variables\\.([A-Za-z_][A-Za-z0-9_.]*)[ \\t]*\\}\\}/g,\n shellName: (name, key) =>\n key === VARIABLES_KEY\n ? name.replace(AZURE_NAME_SEPARATOR_RE, AZURE_SHELL_SEPARATOR).toUpperCase()\n : name,\n },\n parameters: AZURE_PARAMETERS,\n includes: AZURE_TEMPLATES,\n};\n\n/**\n * A GitHub Actions expression that reads one `env` variable: `${{ env.NAME }}`. The runner puts its\n * value into the command before the shell runs, as the shell expands `$NAME`.\n */\nconst ENV_EXPRESSION_RE = /\\$\\{\\{[ \\t]*env\\.([A-Za-z_][A-Za-z0-9_]*)[ \\t]*\\}\\}/g;\n\n/** A reference read as `$NAME`, padded with blanks so that every offset stays. */\nconst asShellVariable = (reference: string, name: string): string =>\n `$${name}`.padEnd(reference.length, \" \");\n\n/**\n * How a file's tool replaces references: its environment, the variables the file sets, and how\n * it names its parameters.\n */\nexport interface VariableReferences {\n readonly environment: YamlEnvironment;\n readonly names: ReadonlySet<string>;\n readonly parameters: YamlParameters;\n}\n\n/** The references of the file's tool in `text` read as `$NAME`, where the tool replaces them. */\nfunction withToolReferences(text: string, { environment, names }: VariableReferences): string {\n const { reference, shellName } = environment;\n if (reference === undefined) {\n return text;\n }\n return text.replace(reference, (written: string, ...groups: unknown[]) => {\n const group = groups.find((part): part is string => typeof part === \"string\") ?? \"\";\n const name = shellName(group, VARIABLES_KEY);\n return names.has(name) ? asShellVariable(written, name) : written;\n });\n}\n\n/** A `$$` before a name or a `{`: Compose gives it to the shell as one `$`. */\nconst DOLLAR_ESCAPE_RE = /\\$\\$([A-Za-z_][A-Za-z0-9_]*|\\{[^}]*\\})/g;\n\n/** `$$GEN` read as `$GEN`, padded with a blank after it so that every offset stays. */\nconst withoutDollarEscapes = (text: string): string =>\n text.replace(DOLLAR_ESCAPE_RE, (written: string, name: string) =>\n `$${name}`.padEnd(written.length, \" \"),\n );\n\n/** Shell text with the references that a tool replaces before the shell runs read as `$NAME`. */\nexport function withVariableReferences(text: string, references?: VariableReferences): string {\n const parameters = references?.parameters.asExpressions(text) ?? text;\n const expressions = parameters.replace(ENV_EXPRESSION_RE, asShellVariable);\n if (references === undefined) {\n return expressions;\n }\n const escaped = references.environment.hasDollarEscapes\n ? withoutDollarEscapes(expressions)\n : expressions;\n return withToolReferences(escaped, references);\n}\n","import type { DocumentPath, DocumentString } from \"./config-documents.js\";\nimport type { ManualStep } from \"./migration-findings.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\nimport { ENV_KEY, type YamlEnvironment } from \"./yaml-environments.js\";\nimport { itemName } from \"./yaml-list-items.js\";\n\n/**\n * The values of a YAML file that set variables, as its file kind names its variable maps\n * (yaml-environments.ts), and where each one is set.\n */\n\n/**\n * A variable that a YAML value sets: its name, how much of the value its head takes, and the\n * part of the file whose commands get it.\n */\nexport interface EnvironmentEntry {\n readonly name: string;\n /** The length of `NAME=` before the value of a list item, else 0. */\n readonly head: number;\n /**\n * The path that the commands which get the variable are under. A step, a job or a stage that\n * is a list item runs with its own maps only (an Azure step `env`, a GitHub step `env`); one\n * that a map names can be extended by name (GitLab `extends`), so its maps count for the file.\n */\n readonly scope: DocumentPath;\n}\n\nconst VALUE_KEY = \"value\";\nconst OPTIONS_KEY = \"options\";\nconst LIST_ITEM_RE = /^([A-Za-z_][A-Za-z0-9_]*)=/;\n/** The last parts of a value's path: its own key or index, its owner's, and the two above. */\nconst PATH_TAIL: readonly number[] = [-1, -2, -3, -4];\n\n/** Whether a value is the `value` of a list item under one of `keys` (`- name: X / value: Y`). */\nconst isNamedItemValue = (value: DocumentString, keys: ReadonlySet<string>): boolean =>\n value.path.at(-1) === VALUE_KEY &&\n typeof value.path.at(-2) === \"number\" &&\n keys.has(String(value.path.at(-3)));\n\n/** Where a value sets a variable: its name as written, and the key of its map. */\ninterface EntryPlace {\n readonly name: string | undefined;\n readonly key: string;\n readonly head?: number;\n}\n\n/** The place where `strings[index]` sets a variable in `environment`, or undefined. */\nfunction entryPlace(\n strings: readonly DocumentString[],\n index: number,\n { keys, hasValueMaps, hasListItems, hasNamedItems }: YamlEnvironment,\n): EntryPlace | undefined {\n const value = strings[index] as DocumentString;\n const [last, owner, outer, optionOf] = PATH_TAIL.map((at) => value.path.at(at));\n const isKey = (part: unknown): part is string => keys.has(String(part));\n if (typeof last === \"string\" && isKey(owner)) {\n return { name: last, key: owner };\n }\n if (hasValueMaps && last === VALUE_KEY && typeof owner === \"string\" && isKey(outer)) {\n return { name: owner, key: outer };\n }\n // The value of a GitLab variable must be one of its `options`: each is a value it can have.\n const isOption = typeof last === \"number\" && owner === OPTIONS_KEY && typeof outer === \"string\";\n if (hasValueMaps && isOption && isKey(optionOf)) {\n return { name: outer, key: optionOf };\n }\n if (hasNamedItems && isNamedItemValue(value, keys)) {\n return { name: itemName(strings, index), key: String(outer) };\n }\n const isItem = hasListItems && typeof last === \"number\" && isKey(owner);\n const name = isItem ? LIST_ITEM_RE.exec(value.value)?.[1] : undefined;\n const head = (name?.length ?? 0) + 1;\n return name === undefined ? undefined : { name, key: String(owner), head };\n}\n\n/**\n * The scope of the map under `key` that the value at `path` is in: the path up to the last list\n * item above the map, if any. A variable name below the key is a string, so the last `key` of the\n * path is the map's own, or a name that adds no list item.\n */\nfunction scopeOf(path: DocumentPath, key: string): DocumentPath {\n const owner = path.slice(0, path.lastIndexOf(key));\n return owner.slice(0, owner.findLastIndex((part) => typeof part === \"number\") + 1);\n}\n\n/** The variables that the values of a file set in `environment`, by value. */\nexport function environmentEntries(\n strings: readonly DocumentString[],\n environment: YamlEnvironment,\n): ReadonlyMap<DocumentString, EnvironmentEntry> {\n return new Map(\n strings.flatMap((value, index) => {\n const place = entryPlace(strings, index, environment);\n if (place?.name === undefined) {\n return [];\n }\n const name = environment.shellName(place.name, place.key);\n const head = place.head ?? 0;\n const scope = scopeOf(value.path, place.key);\n return [[value, { name, head, scope }] as const];\n }),\n );\n}\n\n/** Whether a value at `path` is in the part of the file that gets the variable of `entry`. */\nexport const isInScope = (path: DocumentPath, entry: EnvironmentEntry): boolean =>\n entry.scope.every((part, at) => path[at] === part);\n\nconst ENV_ITEM_KEYS: ReadonlySet<string> = new Set([ENV_KEY]);\n\n/**\n * The `env` items of a Kubernetes container (`- name: GEN / value: openapi-typescript`) that name\n * an old package. Kubernetes gives such a value to the program as it is and puts it into\n * `command` and `args` for `$(GEN)`, where no shell reads it, so the tool reports it.\n */\nexport function environmentItemSteps(\n strings: readonly DocumentString[],\n entries: ReadonlyMap<DocumentString, EnvironmentEntry>,\n locate: (offset: number) => string,\n): ManualStep[] {\n return strings\n .filter((value) => isNamedItemValue(value, ENV_ITEM_KEYS) && !entries.has(value))\n .filter((value) => namesOriginalPackage(value.value))\n .map((value) => ({\n kind: \"old-name-in-command\",\n location: locate(value.start),\n word: value.value,\n }));\n}\n","import type { DocumentString } from \"./config-documents.js\";\nimport { type VariableReferences, withVariableReferences } from \"./yaml-environments.js\";\n\n/** A line break between two lines with text; a blank line between them stays a line break. */\nconst FOLDED_LINE_BREAK_RE = /(?<=\\S[^\\S\\n]*)\\n(?=[^\\S\\n]*\\S)/g;\n\n/**\n * The shell text of a value: where YAML folds a line break to a space, so does the shell text,\n * and a reference that the runner replaces is read as the variable it names. The replacements\n * keep the length, so offsets into it are offsets into the value as written.\n */\nexport function shellText(\n text: string,\n value: DocumentString,\n references?: VariableReferences,\n): string {\n const slice = text.slice(value.content.start, value.content.end);\n const unfolded = value.isFolded ? slice.replace(FOLDED_LINE_BREAK_RE, \" \") : slice;\n return withVariableReferences(unfolded, references);\n}\n","import type { DocumentString } from \"./config-documents.js\";\nimport type { FileVariables } from \"./file-variables.js\";\nimport { withInputDefaults } from \"./input-defaults.js\";\nimport { shellVariables } from \"./shell-variables.js\";\nimport { type EnvironmentEntry, isInScope } from \"./yaml-environment-entries.js\";\nimport { type VariableReferences, withVariableReferences } from \"./yaml-environments.js\";\nimport { shellText } from \"./yaml-shell-text.js\";\n\n/**\n * The variables of a YAML file as its commands use them (yaml-environment-entries.ts): `$GEN`\n * runs the generator when a map sets `GEN` to it. The maps that reach a command are read as one,\n * by name: those of the file and of a job a map names, and those of the list items (steps,\n * jobs, stages) that the command is in.\n */\n\n/** What the variables of a file are read from. */\nexport interface VariableSources {\n readonly text: string;\n readonly entries: ReadonlyMap<DocumentString, EnvironmentEntry>;\n /** The values of the file's parameters by name (input-defaults.ts). */\n readonly inputs: ReadonlyMap<string, string>;\n readonly references: VariableReferences;\n}\n\n/** A variable map's value, with where it is set. */\ninterface ScopedDefinition {\n readonly entry: EnvironmentEntry;\n readonly name: string;\n readonly value: string;\n}\n\n/** The variables that reach each value of a file. */\nexport function scopedVariables({\n text,\n entries,\n inputs,\n references,\n}: VariableSources): (value: DocumentString) => FileVariables {\n const definitions = [...entries].map(([value, entry]): ScopedDefinition => {\n const shell = value.isEscaped\n ? withVariableReferences(value.value, references)\n : shellText(text, value, references);\n return { entry, name: entry.name, value: shell.slice(entry.head) };\n });\n return (value) => {\n const reaching = definitions.filter(({ entry }) => isInScope(value.path, entry));\n return withInputDefaults(shellVariables(reaching), inputs);\n };\n}\n","import {\n type CommandMigration,\n commandWordFindings,\n type Locate,\n type ShellTextFindings,\n} from \"./command-migration.js\";\nimport { type CommandPathPattern, isCommandPath } from \"./command-paths.js\";\nimport { type DocumentString, ownerKey } from \"./config-documents.js\";\nimport type { FileVariables } from \"./file-variables.js\";\nimport { inputValues } from \"./input-defaults.js\";\nimport { type Change, lineLocator } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { otherShellFindings, stepShells } from \"./step-shells.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\nimport { containerCommands, isContainerListItem } from \"./yaml-entrypoints.js\";\nimport { environmentEntries, environmentItemSteps } from \"./yaml-environment-entries.js\";\nimport {\n DEFAULT_YAML_FILE,\n type VariableReferences,\n withVariableReferences,\n type YamlCommandFile,\n} from \"./yaml-environments.js\";\nimport { parameterDefaults } from \"./yaml-parameters.js\";\nimport { scopedVariables } from \"./yaml-scoped-variables.js\";\nimport { shellText } from \"./yaml-shell-text.js\";\n\nexport { shellText } from \"./yaml-shell-text.js\";\n\n/**\n * YAML files are migrated only where they hold commands or package names, so the text of other\n * values (an OpenAPI `description`, a label) stays as written even when it names a package.\n */\n\n/** Keys of a Dependabot config whose values are package names (`ignore`, `allow`, `groups`). */\nexport const DEPENDABOT_NAME_KEYS: ReadonlySet<string> = new Set([\n \"dependency-name\",\n \"patterns\",\n \"exclude-patterns\",\n]);\n\nconst LEADING_SPACES_RE = /^ */;\n\n/**\n * The indentation of a block scalar as written: the fewest spaces at the start of its lines after\n * the first, which YAML removes from the value the shell runs. 0 for a value on one line.\n */\nfunction blockIndent(shell: string): number {\n const lines = shell\n .split(\"\\n\")\n .slice(1)\n .filter((line) => line.trim() !== \"\");\n const indents = lines.map((line) => LEADING_SPACES_RE.exec(line)?.[0].length ?? 0);\n return indents.length === 0 ? 0 : Math.min(...indents);\n}\n\n/**\n * Each place of the text once: a YAML alias gives the strings of its anchor again, at its own\n * path (`script: [*scripts]`), and the first path that reads a place as shell text reads it.\n */\nfunction oncePerPlace(strings: readonly DocumentString[]): DocumentString[] {\n const starts = new Set<number>();\n return strings.filter((string) => {\n const isFirst = !starts.has(string.start);\n starts.add(string.start);\n return isFirst;\n });\n}\n\n/** The values that belong to one of `keys`, also as items of a list. */\nconst valuesOf = (\n strings: readonly DocumentString[],\n keys: ReadonlySet<string>,\n): DocumentString[] =>\n oncePerPlace(strings.filter((string) => keys.has(ownerKey(string.path) ?? \"\")));\n\n/** What the values of one file are read with. */\ninterface ValueContext {\n readonly text: string;\n readonly locate: Locate;\n readonly variables?: FileVariables;\n readonly references?: VariableReferences;\n}\n\n/**\n * The findings of a value with an escape (`\"echo \\\"Don't\\\" && …\"`), read as the value the shell\n * gets: its text as written would read `\\\"` as a quote and `'` as the start of a quoted word.\n * The offsets of the value are not those of the text, so a changed value replaces the whole\n * scalar, quoted as it was, and every finding names the line where the scalar starts.\n */\nfunction escapedValueFindings(\n value: DocumentString,\n encode: (value: string) => string,\n { locate, variables, references }: ValueContext,\n): ShellTextFindings {\n const read = withVariableReferences(value.value, references);\n const commands = shellCommands(read);\n const findings = commandWordFindings(commands, () => locate(value.start), variables);\n const found = withWrittenWords(findings, commands, { read, written: value.value });\n const migrated = applyTextEdits(value.value, found.edits);\n const isChanged = migrated !== value.value;\n const edits = isChanged ? [{ start: value.start, end: value.end, text: encode(migrated) }] : [];\n return { ...found, edits };\n}\n\n/** A value as the shell reads it and as it is written, with the same offsets. */\ninterface ReadValue {\n readonly read: string;\n readonly written: string;\n}\n\nconst PADDING = \" \";\n\n/**\n * A word of the read value as written: a reference that the file's tool replaces is read in\n * another form of the same length (`{{.GEN}}` as `$GEN` and blanks), so the word goes on to the\n * last written character over the blanks after it.\n */\nfunction writtenWord({ read, written }: ReadValue, word: ShellWord): string {\n let blanks = word.end;\n while (read[blanks] === PADDING) {\n blanks += 1;\n }\n const covered = written.slice(word.end, blanks).trimEnd();\n return written.slice(word.start, word.end + covered.length);\n}\n\n/**\n * The findings with the variables they name as written: the shell read a reference that the\n * file's tool replaces (`<< parameters.gen >>`, `${{ env.GEN }}`) in another form.\n */\nfunction withWrittenWords(\n found: ShellTextFindings,\n commands: readonly ShellCommand[],\n value: ReadValue,\n): ShellTextFindings {\n const words = new Map(commands.flat().map((word) => [word.raw, writtenWord(value, word)]));\n const manualSteps = found.manualSteps.map((step) =>\n \"variable\" in step ? { ...step, variable: words.get(step.variable) ?? step.variable } : step,\n );\n return { ...found, manualSteps };\n}\n\n/** The findings of one value read as shell text, with offsets into the whole text. */\nfunction valueFindings(value: DocumentString, context: ValueContext): ShellTextFindings {\n if (value.isEscaped && value.encode !== undefined) {\n return escapedValueFindings(value, value.encode, context);\n }\n const { text, locate, variables, references } = context;\n const { start } = value.content;\n const shell = shellText(text, value, references);\n const commands = shellCommands(shell, blockIndent(shell));\n const findings = commandWordFindings(commands, (offset) => locate(start + offset), variables);\n const written = text.slice(start, value.content.end);\n const found = withWrittenWords(findings, commands, { read: shell, written });\n return { ...found, edits: shiftedEdits(found.edits, start) };\n}\n\n/** The edits of shell findings in a value, as offsets into the whole text. */\nconst shiftedEdits = (edits: readonly TextEdit[], offset: number): TextEdit[] =>\n edits.map((edit) => ({ ...edit, start: edit.start + offset, end: edit.end + offset }));\n\nexport function appliedFindings(\n text: string,\n found: readonly ShellTextFindings[],\n): CommandMigration {\n return {\n text: applyTextEdits(\n text,\n found.flatMap((findings) => findings.edits),\n ),\n changes: found.flatMap((findings) => findings.changes),\n manualSteps: found.flatMap((findings) => findings.manualSteps),\n };\n}\n\n/**\n * Migrate the commands of a YAML file (CI workflows, Compose files, hook configs). Edits replace\n * words only, never the blanks between them, so they apply to the value as written even where a\n * folded scalar was read with spaces for its line breaks.\n */\nexport function migrateYamlCommands(\n text: string,\n file: string,\n strings: readonly DocumentString[],\n { commandKeys, environment, parameters }: YamlCommandFile = DEFAULT_YAML_FILE,\n): CommandMigration {\n const lineOf = lineLocator(text);\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const shellOf = stepShells(strings);\n const values = valuesOf(strings, commandKeys).filter((value) => shellOf(value) === undefined);\n const commandValues = new Set(values.filter((value) => !isContainerListItem(value)));\n const { findings, scripts } = containerCommands(text, strings, locate);\n const entries = environmentEntries(strings, environment);\n const defaults = parameterDefaults(strings, parameters);\n const isShellText = (value: DocumentString): boolean =>\n commandValues.has(value) || scripts.has(value) || entries.has(value) || defaults.has(value);\n const shellValues = oncePerPlace(strings.filter(isShellText));\n const names = new Set([...entries.values()].map((entry) => entry.name));\n const references = { environment, names, parameters };\n const inputs = inputValues(defaults);\n const variablesAt = scopedVariables({ text, entries, inputs, references });\n const contextOf = (value: DocumentString): ValueContext => ({\n ...{ text, locate, references },\n variables: variablesAt(value),\n });\n return appliedFindings(text, [\n ...shellValues.map((value) => valueFindings(value, contextOf(value))),\n ...findings,\n otherShellFindings(valuesOf(strings, commandKeys), shellOf, locate),\n { edits: [], changes: [], manualSteps: environmentItemSteps(strings, entries, locate) },\n ]);\n}\n\n/**\n * Migrate the commands of a YAML config at the paths of `patterns` (domain/command-paths.ts): a\n * pnpm `package.yaml`, a lint-staged config. Each finding names its place (`scripts.gen`).\n */\nexport function migrateYamlPathCommands(\n text: string,\n strings: readonly DocumentString[],\n patterns: readonly CommandPathPattern[],\n): CommandMigration {\n const commands = strings.filter((string) => isCommandPath(string.path, patterns));\n return appliedFindings(\n text,\n commands.map((command) =>\n valueFindings(command, { text, locate: () => command.path.join(\".\") }),\n ),\n );\n}\n\n/** Rename the original packages that a Dependabot config ignores, allows or groups. */\nexport function migrateDependabotConfig(\n text: string,\n file: string,\n strings: readonly DocumentString[],\n): CommandMigration {\n const changes: Change[] = [];\n const edits: TextEdit[] = [];\n const lineOf = lineLocator(text);\n for (const value of valuesOf(strings, DEPENDABOT_NAME_KEYS)) {\n const from = value.value;\n const to = PACKAGE_RENAMES.get(from);\n if (to !== undefined) {\n const { start, end } = value.content;\n const location = `${file}:${lineOf(start)}`;\n changes.push({ kind: \"package-name-renamed\", location, from, to });\n edits.push({ start, end, text: to });\n }\n }\n return { text: applyTextEdits(text, edits), changes, manualSteps: [] };\n}\n","import {\n type CommandMigration,\n commandWordFindings,\n type ShellTextFindings,\n} from \"./command-migration.js\";\nimport type { DocumentPath, DocumentString } from \"./config-documents.js\";\nimport { type Change, lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { packageReference } from \"./old-package-words.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport type { ShellCommand, ShellWord } from \"./shell-word-parts.js\";\nimport { shellCommands } from \"./shell-words.js\";\nimport type { TextEdit } from \"./text-edits.js\";\nimport { appliedFindings } from \"./yaml-migration.js\";\nimport { shellText } from \"./yaml-shell-text.js\";\n\n/**\n * pre-commit hooks (`.pre-commit-config.yaml`). A hook runs its `entry`, split into words without\n * a shell, with its `args` after them, so the two are read as one command: the flags of the\n * generator can be in either. A `language: node` hook installs its `additional_dependencies`;\n * an old package there is renamed, or reported when it is pinned to a version.\n */\n\nconst ENTRY_KEY = \"entry\";\nconst ARGS_KEY = \"args\";\nconst DEPENDENCIES_KEY = \"additional_dependencies\";\n\nconst hookOf = (path: DocumentPath): string => path.slice(0, -1).join(\".\");\n\n/** The items of the list at `key` of each hook, by hook. */\nfunction listsByHook(strings: readonly DocumentString[], key: string) {\n const lists = new Map<string, DocumentString[]>();\n for (const item of strings) {\n if (item.path.at(-2) === key) {\n const hook = item.path.slice(0, -2).join(\".\");\n lists.set(hook, [...(lists.get(hook) ?? []), item]);\n }\n }\n return lists;\n}\n\n/** The words of an entry, as offsets into the whole text. */\nfunction entryWords(text: string, entry: DocumentString): ShellWord[] {\n const { start } = entry.content;\n return shellCommands(shellText(text, entry))\n .flat()\n .map((word) => ({ ...word, start: word.start + start, end: word.end + start }));\n}\n\nconst itemWord = (text: string, item: DocumentString): ShellWord => {\n const { start, end } = item.content;\n return { start, end, value: item.value, raw: text.slice(start, end) };\n};\n\n/** The command of each hook: its entry words, then its args. */\nfunction hookCommands(text: string, strings: readonly DocumentString[]): ShellCommand[] {\n const args = listsByHook(strings, ARGS_KEY);\n return strings\n .filter((string) => string.path.at(-1) === ENTRY_KEY)\n .map((entry) => [\n ...entryWords(text, entry),\n ...(args.get(hookOf(entry.path)) ?? []).map((item) => itemWord(text, item)),\n ]);\n}\n\n/** The old packages that the hooks install, renamed, or reported when pinned. */\nfunction dependencyFindings(\n strings: readonly DocumentString[],\n locate: (offset: number) => string,\n): ShellTextFindings {\n const found = {\n edits: [] as TextEdit[],\n changes: [] as Change[],\n manualSteps: [] as ManualStep[],\n };\n for (const item of [...listsByHook(strings, DEPENDENCIES_KEY).values()].flat()) {\n const { name, isPinned } = packageReference(item.value);\n const to = PACKAGE_RENAMES.get(name);\n const location = locate(item.content.start);\n if (to !== undefined && isPinned) {\n found.manualSteps.push({ kind: \"pinned-package\", location, name });\n } else if (to !== undefined) {\n found.edits.push({ start: item.content.start, end: item.content.end, text: to });\n found.changes.push({ kind: \"package-name-renamed\", location, from: name, to });\n }\n }\n return found;\n}\n\n/** Migrate the hooks of a pre-commit config: their commands and the packages they install. */\nexport function migratePreCommitHooks(\n text: string,\n file: string,\n strings: readonly DocumentString[],\n): CommandMigration {\n const lineOf = lineLocator(text);\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n return appliedFindings(text, [\n commandWordFindings(hookCommands(text, strings), locate),\n dependencyFindings(strings, locate),\n ]);\n}\n","import {\n type DocumentRead,\n isMap,\n mapsAt,\n type TreeMap,\n unreadableConfig,\n valuesAt,\n} from \"./config-documents.js\";\nimport { type Findings, newFindings, renameNames } from \"./dependency-map.js\";\nimport type { FileMigration } from \"./migration-findings.js\";\nimport { renameSpecifierKeys, reportOldPackagePaths } from \"./specifier-maps.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { itemEntries } from \"./tree-entries.js\";\n\n/**\n * A TypeScript (or JavaScript) project config. Imports get the new names, so the options that\n * name packages get them too: the keys of `compilerOptions.paths` are module specifiers, and\n * `compilerOptions.types` lists packages by name. A path into the installed files of an old\n * package (`node_modules/openapi-fetch/…`, in `paths` or `include`) points at files the new\n * package does not have there, so it is reported.\n */\n\nconst COMPILER_OPTIONS_FIELD = \"compilerOptions\";\nconst PATHS_FIELD = \"paths\";\nconst TYPES_FIELD = \"types\";\nconst FIELD_SEPARATOR = \".\";\n\nfunction migrateCompilerOptions(options: TreeMap, findings: Findings): void {\n for (const paths of mapsAt(options, PATHS_FIELD)) {\n // A key maps the imports it matches to the project's own files, so a deep key (`x/*`) still\n // matches the renamed imports and reaches no file of the package.\n const field = [COMPILER_OPTIONS_FIELD, PATHS_FIELD].join(FIELD_SEPARATOR);\n renameSpecifierKeys(paths, field, findings);\n }\n for (const types of valuesAt(options, TYPES_FIELD)) {\n if (types.kind === \"list\") {\n const field = [COMPILER_OPTIONS_FIELD, TYPES_FIELD].join(FIELD_SEPARATOR);\n renameNames(itemEntries(types), field, findings);\n }\n }\n}\n\n/** Migrate the package names of a tsconfig or jsconfig (`read` is `text` parsed). */\nexport function migrateTsconfig(text: string, read: DocumentRead): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const config of read.documents.filter(isMap)) {\n for (const options of mapsAt(config, COMPILER_OPTIONS_FIELD)) {\n migrateCompilerOptions(options, findings);\n }\n reportOldPackagePaths(config, [], findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import { catalogMaps } from \"./catalogs.js\";\nimport { type DocumentRead, isMap, type TreeMap, unreadableConfig } from \"./config-documents.js\";\nimport { type Findings, migrateSpecMap, newFindings, type RenameTarget } from \"./dependency-map.js\";\nimport type { FileMigration } from \"./migration-findings.js\";\nimport { CATALOG_FIELD, NAMED_CATALOGS_FIELD } from \"./package-names.js\";\nimport { reportSettingSections, type SettingsFile } from \"./settings-sections.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { specEntries } from \"./tree-entries.js\";\n\n/**\n * Catalogs in YAML: `pnpm-workspace.yaml` (pnpm) and `.yarnrc.yml` (Yarn 4.10 and newer). A\n * project whose package.json says `\"openapi-fetch\": \"catalog:\"` keeps its version here, so the\n * entry and that dependency must keep one name whatever its spec is, or the install fails\n * (`ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`); the catalog plan (domain/catalogs.ts) says\n * which entries keep the old one. Only the renamed keys and values are replaced\n * in the text, so comments and formatting stay (domain/config-documents.ts). Only entries of\n * `catalog:` and `catalogs:` are renamed; the other settings that name an original package are\n * reported (domain/settings-sections.ts), like the same fields of package.json.\n */\n\nconst CATALOG_SECTIONS = [CATALOG_FIELD, NAMED_CATALOGS_FIELD];\n\nexport const PNPM_WORKSPACE_FILE: SettingsFile = {\n migratedSections: new Set([...CATALOG_SECTIONS, \"packages\"]),\n overrideSections: new Set([\"overrides\", \"patchedDependencies\"]),\n prefix: \"\",\n};\n\n/** Yarn keeps overrides in package.json (`resolutions`), not in `.yarnrc.yml`. */\nexport const YARNRC_FILE: SettingsFile = {\n migratedSections: new Set(CATALOG_SECTIONS),\n overrideSections: new Set(),\n prefix: \"\",\n};\n\nfunction migrateCatalogs(workspace: TreeMap, target: RenameTarget, findings: Findings): void {\n for (const { name, label, map } of catalogMaps(workspace)) {\n const context = {\n ...target,\n map: { kind: \"catalog\", catalog: label, name } as const,\n findings,\n };\n migrateSpecMap(specEntries(map), context);\n }\n}\n\n/**\n * Rename the original packages in the catalogs of a YAML file (`read` is `text` parsed); report\n * its other settings that name them.\n */\nexport function migrateWorkspaceCatalogs(\n text: string,\n read: DocumentRead,\n target: RenameTarget,\n file: SettingsFile,\n): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const workspace of read.documents.filter(isMap)) {\n migrateCatalogs(workspace, target, findings);\n reportSettingSections(workspace, file, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import type { DocumentString } from \"./config-documents.js\";\nimport { runsGenerator } from \"./file-variables.js\";\nimport { shellCommands } from \"./shell-words.js\";\nimport { environmentEntries } from \"./yaml-environment-entries.js\";\nimport type { YamlCommandFile } from \"./yaml-environments.js\";\nimport { shellText } from \"./yaml-shell-text.js\";\n\n/**\n * The variables that a YAML file sets to the old generator in its variable maps (a GitLab\n * `variables`, a Compose `environment`, a workflow `env`). Its tool gives them to every program a\n * job runs, so a script that the file does not hold can run the generator through them\n * (`$GEN api.yaml -it` in `scripts/gen.sh`).\n */\nexport function generatorVariables(\n text: string,\n strings: readonly DocumentString[],\n { environment }: YamlCommandFile,\n): string[] {\n const entries = environmentEntries(strings, environment);\n return [...entries].flatMap(([value, entry]) => {\n const shell = value.isEscaped ? value.value : shellText(text, value);\n return shellCommands(shell.slice(entry.head)).some(runsGenerator) ? [entry.name] : [];\n });\n}\n\nconst NAME_END = \"(?![A-Za-z0-9_])\";\nconst SPECIAL_CHARACTERS_RE = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Whether a text expands one of the variables `names`, as a shell (`$GEN`, `${GEN}`), make\n * (`$(GEN)`), cmd.exe (`%GEN%`) or PowerShell (`$env:GEN`) reads it.\n */\nexport function usesVariable(text: string, names: ReadonlySet<string>): boolean {\n if (names.size === 0) {\n return false;\n }\n const alternatives = [...names].map((name) => name.replace(SPECIAL_CHARACTERS_RE, \"\\\\$&\"));\n const name = `(?:${alternatives.join(\"|\")})`;\n const expansion = `\\\\$(?:\\\\{|\\\\(|env:)?${name}${NAME_END}|%${name}%`;\n return new RegExp(expansion).test(text);\n}\n","import type { CatalogPlan } from \"../domain/catalog-plan.js\";\nimport {\n type DocumentRead,\n type DocumentString,\n documentStrings,\n unreadableConfig,\n usedDocumentStrings,\n} from \"../domain/config-documents.js\";\nimport type { ManifestDeclarations } from \"../domain/declared-packages.js\";\nimport {\n type Change,\n type FileMigration,\n type ManualStep,\n unchanged,\n} from \"../domain/migration-findings.js\";\nimport { namesOriginalPackage } from \"../domain/package-names.js\";\nimport type { SuccessorAliases } from \"../domain/successor-aliases.js\";\nimport { usesVariable } from \"../domain/yaml-generator-variables.js\";\nimport type { ApiDescriptionParts } from \"./api-description-parts.js\";\nimport type { CallbackRewriter, DocumentReaders, SourceStringScanner } from \"./ports.js\";\nimport type { YamlReach } from \"./yaml-file-reach.js\";\n\n/**\n * The parts that file migrations are built from: the context they get, configs read once and\n * migrated in steps, and the gate that leaves a file naming no old package unread.\n */\n\n/** What a migration of one kind of file needs besides the text. */\nexport interface MigrationContext {\n readonly version: string;\n /** What the catalogs keep under the old names, from every manifest and catalog file. */\n readonly catalogs: CatalogPlan;\n /** What every manifest of the project declares, for the imports of a source file. */\n readonly manifests: readonly ManifestDeclarations[];\n /** The files whose overrides alias original packages to their successors. */\n readonly aliases: readonly SuccessorAliases[];\n /** The files that the API descriptions reach by `$ref`: data, not commands. */\n readonly apiDescriptionParts: ApiDescriptionParts;\n /** What the YAML files give the others: the kinds of included files, generator variables. */\n readonly yamlReach: YamlReach;\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\n readonly readers: DocumentReaders;\n}\n\n/** One kind of file the migration knows, and how to migrate it. */\nexport interface FileKind {\n readonly matches: (path: string) => boolean;\n readonly migrate: (text: string, path: string, context: MigrationContext) => FileMigration;\n}\n\n/** A migration with more manual steps appended. */\nexport const withSteps = (\n migration: FileMigration,\n steps: readonly ManualStep[],\n): FileMigration => ({\n ...migration,\n manualSteps: [...migration.manualSteps, ...steps],\n});\n\n/** Two migrations of the same text, one after the other, with their findings joined. */\nexport function chain(first: FileMigration, next: (text: string) => FileMigration): FileMigration {\n const second = next(first.text);\n const changes: Change[] = [...first.changes, ...second.changes];\n const manualSteps: ManualStep[] = [...first.manualSteps, ...second.manualSteps];\n return { text: second.text, changes, manualSteps };\n}\n\n/** One migration of a config, given its text and that text read. */\nexport type ConfigStep = (text: string, read: DocumentRead) => FileMigration;\n\n/**\n * The steps one after the other, each on the text the step before it left. A config that cannot\n * be read is reported once, and no step runs.\n */\nfunction migrateConfig(\n text: string,\n read: (text: string) => DocumentRead,\n steps: readonly ConfigStep[],\n): FileMigration {\n const first = read(text);\n if (first.kind === \"unreadable\") {\n return unreadableConfig(text, first.offset);\n }\n return steps.reduce(\n (done, step) =>\n chain(done, (current) => step(current, current === text ? first : read(current))),\n unchanged(text),\n );\n}\n\n/** A step that reads the string values of the config, with their key paths. */\nexport const stringsStep =\n (migrate: (text: string, strings: readonly DocumentString[]) => FileMigration): ConfigStep =>\n (text, read) =>\n read.kind === \"unreadable\"\n ? unreadableConfig(text, read.offset)\n : migrate(text, documentStrings(read.documents));\n\n/** A step that reads the string values where they are used: YAML aliases give theirs again. */\nexport const usedStringsStep =\n (migrate: (text: string, strings: readonly DocumentString[]) => FileMigration): ConfigStep =>\n (text, read) =>\n read.kind === \"unreadable\"\n ? unreadableConfig(text, read.offset)\n : migrate(text, usedDocumentStrings(read.documents));\n\n/** A JSON config migrated by `steps`, which also get its path. */\nexport const jsonConfig =\n (\n steps: (context: MigrationContext, path: string) => readonly ConfigStep[],\n ): FileKind[\"migrate\"] =>\n (text, path, context) =>\n migrateConfig(text, (current) => context.readers.json.read(current), steps(context, path));\n\n/** A YAML config migrated by `steps`, which also get its path. */\nexport const yamlConfig =\n (\n steps: (context: MigrationContext, path: string) => readonly ConfigStep[],\n ): FileKind[\"migrate\"] =>\n (text, path, context) =>\n migrateConfig(text, (current) => context.readers.yaml.read(current), steps(context, path));\n\n/**\n * A migration that leaves a text naming no original package as it is, without reading it. For\n * the files whose findings all start at an old name: commands and Dependabot names. Any YAML file\n * matches the command kind, and an OpenAPI document of megabytes is read in seconds, for nothing.\n * A text that expands a variable which a YAML file sets to the old generator is read too: the\n * flags after `$GEN` in a script that a job runs are the generator's.\n */\nexport const whenNamed =\n (migrate: FileKind[\"migrate\"]): FileKind[\"migrate\"] =>\n (text, path, context) =>\n namesOriginalPackage(text) || usesVariable(text, context.yamlReach.generatorVariables)\n ? migrate(text, path, context)\n : unchanged(text);\n","/** The names of the files the migration reads, as the tools that own them look for them. */\n\nexport const SHELL_EXTENSIONS: ReadonlySet<string> = new Set([\".sh\", \".bash\", \".zsh\"]);\nexport const MAKEFILE_EXTENSION = \".mk\";\nexport const YAML_EXTENSIONS: ReadonlySet<string> = new Set([\".yml\", \".yaml\"]);\n/** Makefiles, justfiles and Dockerfiles, by the names make, just and docker look for. */\nexport const MAKEFILE_NAMES: ReadonlySet<string> = new Set([\"Makefile\", \"makefile\", \"GNUmakefile\"]);\nexport const JUSTFILE_NAMES: ReadonlySet<string> = new Set([\"justfile\", \"Justfile\", \".justfile\"]);\nexport const DOCKERFILE_NAMES: ReadonlySet<string> = new Set([\"Dockerfile\", \"Containerfile\"]);\n/** Git hooks that husky runs; `.husky/_/` holds husky's own generated scripts. */\nexport const HUSKY_FOLDER = \".husky/\";\nexport const HUSKY_INTERNALS = \".husky/_/\";\nexport const NX_PROJECT_FILE = \"project.json\";\nexport const NX_WORKSPACE_FILE = \"nx.json\";\n/** Jest's config in JSON; `jest.config.js` and the other scripts are source files. */\nexport const JEST_JSON_CONFIG_FILE = \"jest.config.json\";\n/** The names Task looks for, `.dist` ones included. */\nexport const TASKFILE_NAMES: ReadonlySet<string> = new Set(\n [\"Taskfile\", \"taskfile\", \"Taskfile.dist\", \"taskfile.dist\"].flatMap((name) => [\n `${name}.yml`,\n `${name}.yaml`,\n ]),\n);\nexport const PRE_COMMIT_FILES: ReadonlySet<string> = new Set([\n \".pre-commit-config.yaml\",\n \".pre-commit-config.yml\",\n]);\n/** lint-staged reads `.lintstagedrc` as JSON or YAML; YAML reads both. */\nexport const LINT_STAGED_YAML_FILES: ReadonlySet<string> = new Set([\n \".lintstagedrc\",\n \".lintstagedrc.yaml\",\n \".lintstagedrc.yml\",\n]);\nexport const LINT_STAGED_JSON_FILE = \".lintstagedrc.json\";\nexport const SIMPLE_GIT_HOOKS_FILES: ReadonlySet<string> = new Set([\n \".simple-git-hooks.json\",\n \"simple-git-hooks.json\",\n]);\nexport const DENO_CONFIG_FILES: ReadonlySet<string> = new Set([\"deno.json\", \"deno.jsonc\"]);\n/** Deno reads its import map from its config, or from a file that the config names. */\nexport const IMPORT_MAP_FILE = \"import_map.json\";\nexport const DEPENDABOT_FILES: ReadonlySet<string> = new Set([\n \".github/dependabot.yml\",\n \".github/dependabot.yaml\",\n]);\nexport const WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nexport const YARNRC_FILE_NAME = \".yarnrc.yml\";\n/** pnpm reads a manifest from `package.yaml` too. */\nexport const YAML_MANIFEST_FILES: ReadonlySet<string> = new Set([\"package.yaml\", \"package.yml\"]);\n/** pnpm also reads a manifest from `package.json5`, a format the tool reports but does not read. */\nexport const JSON5_MANIFEST_FILE = \"package.json5\";\nexport const MANIFEST_FILE = \"package.json\";\n/**\n * TypeScript's project configs by the names tsc and editors look for: `tsconfig.json`,\n * `jsconfig.json`, and the `tsconfig.build.json` kind that `--project` and `extends` name.\n */\nexport const PROJECT_CONFIG_NAME = /^[jt]sconfig(\\.[^/]+)?\\.json$/;\n/** The package manager writes these again on install; their entries are not commands. */\nexport const LOCK_FILES: ReadonlySet<string> = new Set([\"pnpm-lock.yaml\", \"yarn.lock\", \"bun.lock\"]);\n\n/**\n * CI configs by the names and folders their services read: a top-level `openapi:` there is a job\n * (GitLab names jobs freely), never an API description.\n */\nconst CI_CONFIG_FILES: ReadonlySet<string> = new Set([\n \".gitlab-ci.yml\",\n \".gitlab-ci.yaml\",\n \"bitbucket-pipelines.yml\",\n \".drone.yml\",\n \".woodpecker.yml\",\n \".travis.yml\",\n]);\nconst CI_CONFIG_FOLDERS: readonly string[] = [\n \".github/workflows/\",\n \".gitea/workflows/\",\n \".forgejo/workflows/\",\n \".circleci/\",\n \".gitlab/\",\n \".woodpecker/\",\n];\nconst FOLDER_SEPARATOR = \"/\";\n\n/** Whether a path is in a folder of that name, also in a nested project. */\nexport const isInFolder = (path: string, folder: string): boolean =>\n path.startsWith(folder) || path.includes(`${FOLDER_SEPARATOR}${folder}`);\n\n/**\n * Azure Pipelines files by the names projects give them: `azure-pipelines.yml`, a named one\n * (`ci.azure-pipelines.yml`, `azure-pipelines-release.yaml`), and any file in `.azure-pipelines/`\n * or `.azuredevops/`. Azure reads the file a pipeline names, whatever its name.\n */\nconst AZURE_PIPELINES_FILE_RE = /^(?:[^/]+[.-])?azure-pipelines(?:[.-][^/]+)?\\.ya?ml$/;\nconst AZURE_PIPELINES_FOLDERS: readonly string[] = [\".azure-pipelines/\", \".azuredevops/\"];\n\nexport function isAzurePipelinesFile(path: string): boolean {\n const isInAzureFolder = AZURE_PIPELINES_FOLDERS.some((folder) => isInFolder(path, folder));\n return AZURE_PIPELINES_FILE_RE.test(baseName(path)) || isInAzureFolder;\n}\n\n/** Whether a path is a CI config, also in a nested project (`apps/api/.gitlab-ci.yml`). */\nexport function isCiConfigFile(path: string): boolean {\n const inFolder = (folder: string): boolean => isInFolder(path, folder);\n const isNamed = CI_CONFIG_FILES.has(baseName(path)) || isAzurePipelinesFile(path);\n return isNamed || CI_CONFIG_FOLDERS.some(inFolder);\n}\n\nexport function baseName(path: string): string {\n return path.slice(path.lastIndexOf(\"/\") + 1);\n}\n\nexport function extensionOf(path: string): string {\n const name = baseName(path);\n const dot = name.lastIndexOf(\".\");\n return dot <= 0 ? \"\" : name.slice(dot);\n}\n","import { isMap } from \"../domain/config-documents.js\";\nimport type { ManifestDeclarations } from \"../domain/declared-packages.js\";\nimport { importMapLocations } from \"../domain/import-map-reference.js\";\nimport type { DocumentReaders, ProjectFiles } from \"./ports.js\";\nimport { baseName, DENO_CONFIG_FILES } from \"./project-file-names.js\";\n\n/** Each import map file that Deno configs name, with the paths of the configs that name it. */\nexport type NamedImportMaps = ReadonlyMap<string, readonly string[]>;\n\nexport const NO_NAMED_IMPORT_MAPS: NamedImportMaps = new Map();\n\n/** The import maps in the project that one Deno config names, read as JSON. */\nasync function importMapsOf(\n path: string,\n files: ProjectFiles,\n readers: DocumentReaders,\n): Promise<string[]> {\n const read = await files.read(path);\n const parsed = read.kind === \"read\" ? readers.json.read(read.text) : undefined;\n if (parsed?.kind !== \"read\") {\n return [];\n }\n return importMapLocations(path, parsed.documents.filter(isMap)).flatMap((location) =>\n location.kind === \"in-project\" ? [location.path] : [],\n );\n}\n\n/**\n * The project files that Deno configs name as their import maps (`\"importMap\": \"./deps.json\"`).\n * They are found before the plan, which reads them as import maps whatever their name. A config\n * that cannot be read names none here; its migration reports it.\n */\nexport async function namedImportMaps(\n paths: readonly string[],\n files: ProjectFiles,\n readers: DocumentReaders,\n): Promise<NamedImportMaps> {\n const named = new Map<string, string[]>();\n for (const path of paths.filter((candidate) => DENO_CONFIG_FILES.has(baseName(candidate)))) {\n for (const map of await importMapsOf(path, files, readers)) {\n named.set(map, [...(named.get(map) ?? []), path]);\n }\n }\n return named;\n}\n\n/** All of `sets` in one; undefined (every package) when one of them is. */\nfunction joinedNames(\n sets: readonly (ReadonlySet<string> | undefined)[],\n): ReadonlySet<string> | undefined {\n return sets.some((names) => names === undefined)\n ? undefined\n : new Set(sets.flatMap((names) => [...(names ?? [])]));\n}\n\n/**\n * The declarations with the names of each named import map given to the configs that name it:\n * Deno resolves the imports of the files under a config through its map, wherever the map is.\n */\nexport function withNamedImportMaps(\n declarations: readonly ManifestDeclarations[],\n importMaps: NamedImportMaps,\n): ManifestDeclarations[] {\n const mapNames = new Map(declarations.map(({ path, names }) => [path, names]));\n return declarations\n .filter(({ path }) => !importMaps.has(path))\n .map((declaration) => {\n const { path, names } = declaration;\n const maps = [...importMaps].filter(([, configs]) => configs.includes(path));\n const named = maps.flatMap(([map]) => (mapNames.has(map) ? [mapNames.get(map)] : []));\n return { ...declaration, names: joinedNames([names, ...named]) };\n });\n}\n","import {\n AZURE_PIPELINES_FILE,\n CI_ENVIRONMENT_FILE,\n CIRCLECI_FILE,\n COMPOSE_FILE,\n DEFAULT_YAML_FILE,\n GITLAB_CI_FILE,\n type YamlCommandFile,\n} from \"../domain/yaml-environments.js\";\nimport { baseName, isAzurePipelinesFile, isInFolder } from \"./project-file-names.js\";\n\n/**\n * The kind of a YAML command file by the names and folders its tool reads, so that the variables\n * it sets (GitLab and Azure `variables`, CircleCI and Compose `environment`) are read in that\n * file only: the same keys mean other things in other files.\n */\n\nconst GITLAB_FILES: ReadonlySet<string> = new Set([\".gitlab-ci.yml\", \".gitlab-ci.yaml\"]);\nconst GITLAB_FOLDER = \".gitlab/\";\nconst CI_ENVIRONMENT_FILES: ReadonlySet<string> = new Set([\n \".drone.yml\",\n \".drone.yaml\",\n \".woodpecker.yml\",\n \".woodpecker.yaml\",\n]);\nconst CIRCLECI_FOLDER = \".circleci/\";\nconst WOODPECKER_FOLDER = \".woodpecker/\";\n/** `compose.yaml`, `docker-compose.yml` and their overrides (`compose.override.yaml`). */\nconst COMPOSE_FILE_RE = /^(?:docker-)?compose(?:\\.[^/]+)?\\.ya?ml$/;\n\n/** The YAML command file kind of a path. */\nexport function yamlCommandFileFor(path: string): YamlCommandFile {\n const name = baseName(path);\n if (GITLAB_FILES.has(name) || isInFolder(path, GITLAB_FOLDER)) {\n return GITLAB_CI_FILE;\n }\n if (isInFolder(path, CIRCLECI_FOLDER)) {\n return CIRCLECI_FILE;\n }\n if (CI_ENVIRONMENT_FILES.has(name) || isInFolder(path, WOODPECKER_FOLDER)) {\n return CI_ENVIRONMENT_FILE;\n }\n if (isAzurePipelinesFile(path)) {\n return AZURE_PIPELINES_FILE;\n }\n return COMPOSE_FILE_RE.test(name) ? COMPOSE_FILE : DEFAULT_YAML_FILE;\n}\n","import { mayBeApiDescription } from \"../domain/api-descriptions.js\";\nimport { type DocumentString, usedDocumentStrings } from \"../domain/config-documents.js\";\nimport { namesOriginalPackage } from \"../domain/package-names.js\";\nimport { DEFAULT_YAML_FILE, TASKFILE, type YamlCommandFile } from \"../domain/yaml-environments.js\";\nimport { generatorVariables } from \"../domain/yaml-generator-variables.js\";\nimport { includedPaths, NO_INCLUDES } from \"../domain/yaml-includes.js\";\nimport type { DocumentReaders, ProjectFiles } from \"./ports.js\";\nimport {\n baseName,\n extensionOf,\n isCiConfigFile,\n TASKFILE_NAMES,\n YAML_EXTENSIONS,\n} from \"./project-file-names.js\";\nimport { yamlCommandFileFor } from \"./yaml-file-kinds.js\";\n\n/**\n * What the YAML files of a project give the other files, read before any file is migrated: the\n * kind of each file that a Taskfile, a GitLab CI file or an Azure pipeline includes under another\n * name, and the variables that YAML files set to the old generator, which the scripts their jobs\n * run may expand.\n */\nexport interface YamlReach {\n readonly kinds: ReadonlyMap<string, YamlCommandFile>;\n readonly generatorVariables: ReadonlySet<string>;\n}\n\nexport const NO_YAML_REACH: YamlReach = { kinds: new Map(), generatorVariables: new Set() };\n\ninterface ReachDependencies {\n readonly files: ProjectFiles;\n readonly readers: DocumentReaders;\n}\n\n/** The YAML command file kind of a path: the kind of the file that includes it, or its own. */\nexport const yamlKindOf = (reach: YamlReach, path: string): YamlCommandFile =>\n reach.kinds.get(path) ?? yamlCommandFileFor(path);\n\n/** The kind of a path by its name, Taskfiles included. */\nconst namedKindOf = (path: string): YamlCommandFile =>\n TASKFILE_NAMES.has(baseName(path)) ? TASKFILE : yamlCommandFileFor(path);\n\n/** The text of a listed file, or undefined when it cannot be read. */\nasync function textOf(path: string, { files }: ReachDependencies): Promise<string | undefined> {\n const read = await files.read(path);\n return read.kind === \"read\" ? read.text : undefined;\n}\n\n/** The strings of a YAML text where they are used; none when it does not parse. */\nfunction stringsOf(text: string | undefined, { readers }: ReachDependencies): DocumentString[] {\n const parsed = text === undefined ? undefined : readers.yaml.read(text);\n return parsed?.kind === \"read\" ? usedDocumentStrings(parsed.documents) : [];\n}\n\nconst ANY_FOLDERS_WILDCARD = \"**\";\nconst WILDCARD_RE = /\\*\\*?/g;\nconst SPECIAL_CHARACTERS_RE = /[.+?^${}()|[\\]\\\\]/g;\nconst ANY_FOLDERS = \".*\";\nconst ANY_NAME = \"[^/]*\";\n\n/** The listed paths that an included path names; GitLab reads `*` and `**` as wildcards. */\nfunction matchingPaths(pattern: string, listed: readonly string[]): string[] {\n const source = pattern\n .replace(SPECIAL_CHARACTERS_RE, \"\\\\$&\")\n .replace(WILDCARD_RE, (star) => (star === ANY_FOLDERS_WILDCARD ? ANY_FOLDERS : ANY_NAME));\n const matches = new RegExp(`^${source}$`);\n return listed.filter((path) => matches.test(path));\n}\n\n/**\n * The kinds of the files that the files of `paths` include, followed through the files they\n * include in turn. A file that its name gives a kind keeps it. Only the files of a kind that\n * includes files are read.\n */\nasync function includedKinds(\n paths: readonly string[],\n dependencies: ReachDependencies,\n): Promise<Map<string, YamlCommandFile>> {\n const kinds = new Map<string, YamlCommandFile>();\n const pending = paths\n .map((path) => ({ path, kind: namedKindOf(path) }))\n .filter(({ kind }) => kind.includes !== NO_INCLUDES);\n for (let next = pending.pop(); next !== undefined; next = pending.pop()) {\n const strings = stringsOf(await textOf(next.path, dependencies), dependencies);\n const included = includedPaths(next.path, strings, next.kind.includes);\n for (const path of included.flatMap((pattern) => matchingPaths(pattern, paths))) {\n if (!kinds.has(path) && namedKindOf(path) === DEFAULT_YAML_FILE) {\n kinds.set(path, next.kind);\n pending.push({ path, kind: next.kind });\n }\n }\n }\n return kinds;\n}\n\n/** Whether the variables of a YAML file are read: it names an old package, and it is no API. */\nconst isVariableSource = (path: string, text: string): boolean =>\n namesOriginalPackage(text) && (isCiConfigFile(path) || !mayBeApiDescription(text));\n\n/** What the YAML files of `paths` give the other files of the project. */\nexport async function planYamlReach(\n paths: readonly string[],\n dependencies: ReachDependencies,\n): Promise<YamlReach> {\n const yamlPaths = paths.filter((path) => YAML_EXTENSIONS.has(extensionOf(path)));\n const kinds = await includedKinds(yamlPaths, dependencies);\n const names = new Set<string>();\n for (const path of yamlPaths) {\n const text = await textOf(path, dependencies);\n if (text !== undefined && isVariableSource(path, text)) {\n const kind = kinds.get(path) ?? namedKindOf(path);\n for (const name of generatorVariables(text, stringsOf(text, dependencies), kind)) {\n names.add(name);\n }\n }\n }\n return { kinds, generatorVariables: names };\n}\n","import { isApiDescription } from \"../domain/api-descriptions.js\";\nimport { migrateCommandLines } from \"../domain/command-migration.js\";\nimport {\n type CommandPathPattern,\n DENO_TASK_PATHS,\n LINT_STAGED_COMMAND_PATHS,\n MANIFEST_COMMAND_PATHS,\n NX_PROJECT_COMMAND_PATHS,\n NX_WORKSPACE_COMMAND_PATHS,\n SIMPLE_GIT_HOOKS_COMMAND_PATHS,\n} from \"../domain/command-paths.js\";\nimport { commandStringSteps } from \"../domain/command-strings.js\";\nimport { localPackagesFor, undeclaredImportSteps } from \"../domain/declared-packages.js\";\nimport { migrateDockerfile } from \"../domain/dockerfile-migration.js\";\nimport { migrateImportMap } from \"../domain/import-map-migration.js\";\nimport { importMapSteps } from \"../domain/import-map-reference.js\";\nimport { isJestConfig, jestJsonSteps, jestScriptSteps } from \"../domain/jest-config.js\";\nimport { migrateJsonCommands } from \"../domain/json-command-migration.js\";\nimport { migrateJustfile } from \"../domain/justfile-migration.js\";\nimport { migrateMakefile } from \"../domain/makefile-migration.js\";\nimport { migratePackageManifest, unreadManifest } from \"../domain/manifest-migration.js\";\nimport { type FileMigration, unchanged } from \"../domain/migration-findings.js\";\nimport { oldPackagePatchSteps, patchedOldPackage } from \"../domain/patch-files.js\";\nimport { migratePreCommitHooks } from \"../domain/pre-commit-migration.js\";\nimport {\n importedSpecifiers,\n migrateModuleSpecifiers,\n SOURCE_EXTENSIONS,\n} from \"../domain/source-migration.js\";\nimport { aliasedPackagesFor } from \"../domain/successor-aliases.js\";\nimport { migrateTsconfig } from \"../domain/tsconfig-migration.js\";\nimport {\n migrateWorkspaceCatalogs,\n PNPM_WORKSPACE_FILE,\n YARNRC_FILE,\n} from \"../domain/workspace-catalog-migration.js\";\nimport { TASKFILE } from \"../domain/yaml-environments.js\";\nimport {\n migrateDependabotConfig,\n migrateYamlCommands,\n migrateYamlPathCommands,\n} from \"../domain/yaml-migration.js\";\nimport {\n type ConfigStep,\n chain,\n type FileKind,\n jsonConfig,\n type MigrationContext,\n stringsStep,\n usedStringsStep,\n whenNamed,\n withSteps,\n yamlConfig,\n} from \"./config-steps.js\";\nimport { type NamedImportMaps, NO_NAMED_IMPORT_MAPS } from \"./named-import-maps.js\";\nimport {\n baseName,\n DENO_CONFIG_FILES,\n DEPENDABOT_FILES,\n DOCKERFILE_NAMES,\n extensionOf,\n HUSKY_FOLDER,\n HUSKY_INTERNALS,\n IMPORT_MAP_FILE,\n isCiConfigFile,\n JEST_JSON_CONFIG_FILE,\n JSON5_MANIFEST_FILE,\n JUSTFILE_NAMES,\n LINT_STAGED_JSON_FILE,\n LINT_STAGED_YAML_FILES,\n LOCK_FILES,\n MAKEFILE_EXTENSION,\n MAKEFILE_NAMES,\n MANIFEST_FILE,\n NX_PROJECT_FILE,\n NX_WORKSPACE_FILE,\n PRE_COMMIT_FILES,\n PROJECT_CONFIG_NAME,\n SHELL_EXTENSIONS,\n SIMPLE_GIT_HOOKS_FILES,\n TASKFILE_NAMES,\n WORKSPACE_FILE,\n YAML_EXTENSIONS,\n YAML_MANIFEST_FILES,\n YARNRC_FILE_NAME,\n} from \"./project-file-names.js\";\nimport { yamlKindOf } from \"./yaml-file-reach.js\";\n\nconst isHuskyHook = (path: string): boolean =>\n (path.startsWith(HUSKY_FOLDER) || path.includes(`/${HUSKY_FOLDER}`)) &&\n !path.includes(HUSKY_INTERNALS);\n\nconst isDependabotConfig = (path: string): boolean =>\n [...DEPENDABOT_FILES].some((file) => path === file || path.endsWith(`/${file}`));\n\n/** Module specifiers and `transform` callbacks are migrated; command strings are reported. */\nfunction migrateSource(text: string, path: string, context: MigrationContext): FileMigration {\n const strings = context.scanner.scan(text, path);\n const kept = localPackagesFor(context.manifests, path);\n const migrated = chain(migrateModuleSpecifiers(text, strings, context.version, kept), (renamed) =>\n context.rewriter.rewrite(renamed, path),\n );\n const imports = importedSpecifiers(text, strings);\n const undeclared = undeclaredImportSteps(imports, path, context.manifests);\n const patterns = isJestConfig(baseName(path)) ? jestScriptSteps(text, strings) : [];\n return withSteps(migrated, [...commandStringSteps(text, strings), ...undeclared, ...patterns]);\n}\n\nconst jsonCommandsStep = (patterns: readonly CommandPathPattern[]): ConfigStep =>\n stringsStep((text, strings) => migrateJsonCommands(text, strings, patterns));\n\n/** A Deno import map, in its own file or in a config. */\nconst importMapStep =\n (version: string): ConfigStep =>\n (text, read) =>\n migrateImportMap(text, read, version);\n\nconst importMapFile = jsonConfig(({ version }) => [importMapStep(version)]);\n\n/** A YAML config whose commands are at the paths of `patterns`. */\nconst yamlPathCommands = (patterns: readonly CommandPathPattern[]): ConfigStep =>\n stringsStep((text, strings) => migrateYamlPathCommands(text, strings, patterns));\n\n/**\n * Configs that only hold commands, by file name: they come before the generic YAML kind, which\n * would read them by the common command keys only.\n */\nconst COMMAND_CONFIG_KINDS: readonly FileKind[] = [\n {\n matches: (path) => baseName(path) === NX_PROJECT_FILE,\n migrate: jsonConfig(() => [jsonCommandsStep(NX_PROJECT_COMMAND_PATHS)]),\n },\n {\n matches: (path) => baseName(path) === NX_WORKSPACE_FILE,\n migrate: jsonConfig(() => [jsonCommandsStep(NX_WORKSPACE_COMMAND_PATHS)]),\n },\n {\n matches: (path) => baseName(path) === LINT_STAGED_JSON_FILE,\n migrate: jsonConfig(() => [jsonCommandsStep(LINT_STAGED_COMMAND_PATHS)]),\n },\n {\n matches: (path) => LINT_STAGED_YAML_FILES.has(baseName(path)),\n migrate: whenNamed(yamlConfig(() => [yamlPathCommands(LINT_STAGED_COMMAND_PATHS)])),\n },\n {\n matches: (path) => SIMPLE_GIT_HOOKS_FILES.has(baseName(path)),\n migrate: jsonConfig(() => [jsonCommandsStep(SIMPLE_GIT_HOOKS_COMMAND_PATHS)]),\n },\n {\n matches: (path) => TASKFILE_NAMES.has(baseName(path)),\n migrate: whenNamed(\n yamlConfig((_context, path) => [\n usedStringsStep((text, strings) => migrateYamlCommands(text, path, strings, TASKFILE)),\n ]),\n ),\n },\n {\n matches: (path) => PRE_COMMIT_FILES.has(baseName(path)),\n migrate: whenNamed(\n yamlConfig((_context, path) => [\n stringsStep((text, strings) => migratePreCommitHooks(text, path, strings)),\n ]),\n ),\n },\n];\n\n/**\n * The commands of a YAML file; an API description (an OpenAPI document) and the files it reaches\n * by `$ref` are data and stay. A CI config is never one (project-file-names.ts).\n */\nconst yamlCommandsStep =\n (path: string, { apiDescriptionParts, yamlReach }: MigrationContext): ConfigStep =>\n (text, read) => {\n const isCiFile = isCiConfigFile(path) || yamlReach.kinds.has(path);\n const isApi = !isCiFile && read.kind === \"read\" && isApiDescription(read.documents);\n return apiDescriptionParts.has(path) || isApi\n ? unchanged(text)\n : usedStringsStep((current, strings) =>\n migrateYamlCommands(current, path, strings, yamlKindOf(yamlReach, path)),\n )(text, read);\n };\n\n/** What the manifest at `path` is migrated with. */\nconst manifestTarget = ({ version, catalogs, aliases }: MigrationContext, path: string) => ({\n version,\n catalogs,\n aliased: aliasedPackagesFor(aliases, path),\n});\n\n/** The kinds in order; the first that matches a path migrates it. */\nconst FILE_KINDS: readonly FileKind[] = [\n {\n matches: (path) => baseName(path) === MANIFEST_FILE,\n migrate: jsonConfig((context, path) => [\n (text, read) => migratePackageManifest(text, read, manifestTarget(context, path)),\n jsonCommandsStep(MANIFEST_COMMAND_PATHS),\n ]),\n },\n {\n matches: (path) => YAML_MANIFEST_FILES.has(baseName(path)),\n migrate: yamlConfig((context, path) => [\n (text, read) => migratePackageManifest(text, read, manifestTarget(context, path)),\n yamlPathCommands(MANIFEST_COMMAND_PATHS),\n ]),\n },\n {\n matches: (path) => baseName(path) === JSON5_MANIFEST_FILE,\n migrate: unreadManifest,\n },\n {\n matches: (path) => baseName(path) === WORKSPACE_FILE,\n migrate: yamlConfig(({ version, catalogs }) => [\n (text, read) =>\n migrateWorkspaceCatalogs(text, read, { version, catalogs }, PNPM_WORKSPACE_FILE),\n ]),\n },\n {\n matches: (path) => baseName(path) === YARNRC_FILE_NAME,\n migrate: yamlConfig(({ version, catalogs }) => [\n (text, read) => migrateWorkspaceCatalogs(text, read, { version, catalogs }, YARNRC_FILE),\n ]),\n },\n {\n matches: (path) => baseName(path) === JEST_JSON_CONFIG_FILE,\n migrate: jsonConfig(() => [(text, read) => withSteps(unchanged(text), jestJsonSteps(read))]),\n },\n {\n matches: (path) => patchedOldPackage(baseName(path)) !== undefined,\n migrate: (text, path) => withSteps(unchanged(text), oldPackagePatchSteps(baseName(path))),\n },\n {\n matches: (path) => SOURCE_EXTENSIONS.has(extensionOf(path)),\n migrate: migrateSource,\n },\n ...COMMAND_CONFIG_KINDS,\n {\n matches: (path) => DENO_CONFIG_FILES.has(baseName(path)),\n migrate: jsonConfig(({ version }, path) => [\n importMapStep(version),\n (text, read) => withSteps(unchanged(text), importMapSteps(path, read)),\n jsonCommandsStep(DENO_TASK_PATHS),\n ]),\n },\n {\n matches: (path) => baseName(path) === IMPORT_MAP_FILE,\n migrate: importMapFile,\n },\n {\n matches: (path) => PROJECT_CONFIG_NAME.test(baseName(path)),\n migrate: whenNamed(jsonConfig(() => [migrateTsconfig])),\n },\n {\n matches: isDependabotConfig,\n migrate: whenNamed(\n yamlConfig((_context, path) => [\n stringsStep((text, strings) => migrateDependabotConfig(text, path, strings)),\n ]),\n ),\n },\n {\n matches: (path) => YAML_EXTENSIONS.has(extensionOf(path)),\n migrate: whenNamed(yamlConfig((context, path) => [yamlCommandsStep(path, context)])),\n },\n {\n matches: (path) => DOCKERFILE_NAMES.has(baseName(path)),\n migrate: whenNamed((text, path) => migrateDockerfile(text, path)),\n },\n {\n matches: (path) =>\n MAKEFILE_NAMES.has(baseName(path)) || extensionOf(path) === MAKEFILE_EXTENSION,\n migrate: whenNamed((text, path) => migrateMakefile(text, path)),\n },\n {\n matches: (path) => JUSTFILE_NAMES.has(baseName(path)),\n migrate: whenNamed((text, path) => migrateJustfile(text, path)),\n },\n {\n matches: (path) => SHELL_EXTENSIONS.has(extensionOf(path)) || isHuskyHook(path),\n migrate: whenNamed((text, path) => migrateCommandLines(text, path)),\n },\n];\n\n/**\n * The migration for a file, or undefined when the migration does not read that kind of file.\n * `namedImportMaps` are the files that a Deno config names as its import map (`\"importMap\":\n * \"./deps.json\"`): they are import maps whatever their name.\n */\nexport function fileMigrationFor(\n path: string,\n namedImportMaps: NamedImportMaps = NO_NAMED_IMPORT_MAPS,\n): FileKind[\"migrate\"] | undefined {\n if (LOCK_FILES.has(baseName(path))) {\n return undefined;\n }\n if (namedImportMaps.has(path)) {\n return importMapFile;\n }\n return FILE_KINDS.find((kind) => kind.matches(path))?.migrate;\n}\n","import {\n isApiDescription,\n mayBeApiDescription,\n referencedFiles,\n} from \"../domain/api-descriptions.js\";\nimport type { DocumentRead, TreeNode } from \"../domain/config-documents.js\";\nimport { namesOriginalPackage } from \"../domain/package-names.js\";\nimport type { DocumentReaders, ProjectFiles } from \"./ports.js\";\nimport { extensionOf, isCiConfigFile, YAML_EXTENSIONS } from \"./project-file-names.js\";\n\n/**\n * The files of a split API description: the YAML and JSON files that an API description of the\n * project reaches by `$ref`, directly or through other such files. Their values are data, so the\n * YAML command migration leaves them as it leaves the description.\n */\n\n/** The parts of the project's API descriptions; empty when none is listed. */\nexport type ApiDescriptionParts = ReadonlySet<string>;\n\nexport const NO_API_DESCRIPTION_PARTS: ApiDescriptionParts = new Set();\n\nconst JSON_EXTENSION = \".json\";\n\ninterface PartsDependencies {\n readonly files: ProjectFiles;\n readonly readers: DocumentReaders;\n}\n\nconst isYaml = (path: string): boolean => YAML_EXTENSIONS.has(extensionOf(path));\n\n/** A YAML or JSON file that can be an API description or a part of one; a CI config is neither. */\nconst isDescriptionFormat = (path: string): boolean =>\n (isYaml(path) || extensionOf(path) === JSON_EXTENSION) && !isCiConfigFile(path);\n\n/** The text of a listed file, or undefined when it cannot be read. */\nasync function textOf(path: string, files: ProjectFiles): Promise<string | undefined> {\n const read = await files.read(path);\n return read.kind === \"read\" ? read.text : undefined;\n}\n\n/** The parsed documents of a YAML or JSON text, or undefined when it does not parse. */\nfunction documentsOf(path: string, text: string, readers: DocumentReaders): TreeNode[] | undefined {\n const parsed: DocumentRead = (isYaml(path) ? readers.yaml : readers.json).read(text);\n return parsed.kind === \"read\" ? [...parsed.documents] : undefined;\n}\n\n/**\n * Whether a YAML file names an old package, so the command migration reads it: only then can a\n * part be changed. The descriptions, which can be large, are parsed only when there is one.\n */\nasync function hasNamingYaml(paths: readonly string[], files: ProjectFiles): Promise<boolean> {\n for (const path of paths.filter(isYaml)) {\n const text = await textOf(path, files);\n if (text !== undefined && namesOriginalPackage(text)) {\n return true;\n }\n }\n return false;\n}\n\n/** The API descriptions of the listing, with their parsed documents. */\nasync function descriptionRoots(\n paths: readonly string[],\n { files, readers }: PartsDependencies,\n): Promise<Map<string, TreeNode[]>> {\n const roots = new Map<string, TreeNode[]>();\n for (const path of paths.filter(isDescriptionFormat)) {\n const text = await textOf(path, files);\n const documents =\n text !== undefined && mayBeApiDescription(text)\n ? documentsOf(path, text, readers)\n : undefined;\n if (documents !== undefined && isApiDescription(documents)) {\n roots.set(path, documents);\n }\n }\n return roots;\n}\n\n/**\n * The listed files that the API descriptions of `paths` reach by `$ref`, the descriptions\n * themselves left out. A part that cannot be read or parsed is still a part; its own references\n * are not followed.\n */\nexport async function apiDescriptionParts(\n paths: readonly string[],\n dependencies: PartsDependencies,\n): Promise<ApiDescriptionParts> {\n if (!(await hasNamingYaml(paths, dependencies.files))) {\n return NO_API_DESCRIPTION_PARTS;\n }\n const listed = new Set(paths.filter(isDescriptionFormat));\n const roots = await descriptionRoots(paths, dependencies);\n const parts = new Set<string>();\n const pending = [...roots].flatMap(([path, documents]) => referencedFiles(path, documents));\n for (let path = pending.pop(); path !== undefined; path = pending.pop()) {\n if (!listed.has(path) || roots.has(path) || parts.has(path)) {\n continue;\n }\n parts.add(path);\n const text = await textOf(path, dependencies.files);\n const documents =\n text === undefined ? undefined : documentsOf(path, text, dependencies.readers);\n pending.push(...(documents === undefined ? [] : referencedFiles(path, documents)));\n }\n return parts;\n}\n","import type { DocumentRead } from \"../domain/config-documents.js\";\nimport type { NamedImportMaps } from \"./named-import-maps.js\";\nimport type { DocumentReaders } from \"./ports.js\";\nimport {\n baseName,\n DENO_CONFIG_FILES,\n IMPORT_MAP_FILE,\n JSON5_MANIFEST_FILE,\n MANIFEST_FILE,\n WORKSPACE_FILE,\n YAML_MANIFEST_FILES,\n YARNRC_FILE_NAME,\n} from \"./project-file-names.js\";\n\n/**\n * How a file takes part in the project plan: a manifest names dependencies on catalogs (and bun\n * keeps catalogs in package.json) and declares packages, a workspace file holds catalogs\n * (domain/catalogs.ts), and a Deno import map declares the packages that sources import.\n */\nexport interface PlanSource {\n readonly role: \"manifest\" | \"catalogs\" | \"import-map\";\n /** Undefined for a format the tool does not read; such a file counts as declaring all. */\n readonly read: ((text: string, readers: DocumentReaders) => DocumentRead) | undefined;\n}\n\nconst readJson = (text: string, readers: DocumentReaders) => readers.json.read(text);\nconst readYaml = (text: string, readers: DocumentReaders) => readers.yaml.read(text);\n\n/**\n * The part a file plays in the project plan, or undefined for a file that plays none.\n * `namedImportMaps` are the files that Deno configs name as their import maps.\n */\nexport function planSourceOf(\n path: string,\n namedImportMaps: NamedImportMaps,\n): PlanSource | undefined {\n const name = baseName(path);\n if (namedImportMaps.has(path) || DENO_CONFIG_FILES.has(name) || name === IMPORT_MAP_FILE) {\n return { role: \"import-map\", read: readJson };\n }\n if (name === MANIFEST_FILE) {\n return { role: \"manifest\", read: readJson };\n }\n if (YAML_MANIFEST_FILES.has(name)) {\n return { role: \"manifest\", read: readYaml };\n }\n if (name === JSON5_MANIFEST_FILE) {\n return { role: \"manifest\", read: undefined };\n }\n const isCatalogFile = name === WORKSPACE_FILE || name === YARNRC_FILE_NAME;\n return isCatalogFile ? { role: \"catalogs\", read: readYaml } : undefined;\n}\n","import type { CatalogPlan } from \"../domain/catalog-plan.js\";\nimport { planCatalogs } from \"../domain/catalogs.js\";\nimport { isMap, type TreeMap, valuesAt } from \"../domain/config-documents.js\";\nimport {\n declaredNames,\n localPackageNames,\n type ManifestDeclarations,\n namesUninstalledPackage,\n} from \"../domain/declared-packages.js\";\nimport { importMapNames } from \"../domain/import-map-migration.js\";\nimport { namesOriginalPackage, WORKSPACES_FIELD } from \"../domain/package-names.js\";\nimport { type SuccessorAliases, successorAliasedPackages } from \"../domain/successor-aliases.js\";\nimport { type ApiDescriptionParts, apiDescriptionParts } from \"./api-description-parts.js\";\nimport { type NamedImportMaps, namedImportMaps, withNamedImportMaps } from \"./named-import-maps.js\";\nimport { type PlanSource, planSourceOf } from \"./plan-sources.js\";\nimport type { DocumentReaders, ProjectFiles } from \"./ports.js\";\nimport { MANIFEST_FILE, WORKSPACE_FILE, YARNRC_FILE_NAME } from \"./project-file-names.js\";\nimport { planYamlReach, type YamlReach } from \"./yaml-file-reach.js\";\n\n/**\n * The project plan: what the manifests, catalog files and import maps of a project say, read once\n * before any file is migrated, so that each file is migrated in step with the others.\n */\n\n/** What the plan reads files with. */\nexport interface PlanDependencies {\n readonly files: ProjectFiles;\n readonly readers: DocumentReaders;\n}\n\n/**\n * What every file of a project is migrated with: the tool's version, the catalog plan and what the\n * manifests declare.\n */\nexport interface ProjectTarget {\n readonly version: string;\n readonly catalogs: CatalogPlan;\n readonly manifests: readonly ManifestDeclarations[];\n /** The manifests and workspace files whose overrides alias original packages. */\n readonly aliases: readonly SuccessorAliases[];\n /** The files that Deno configs name as their import maps. */\n readonly importMaps: NamedImportMaps;\n /** The files that the API descriptions reach by `$ref`, which are data. */\n readonly apiDescriptionParts: ApiDescriptionParts;\n /** What the YAML files give the others: the kinds of included files, generator variables. */\n readonly yamlReach: YamlReach;\n}\n\n/**\n * A manifest, catalog or import map file as the plan reads it: whether it names an original\n * package, and its parsed roots; `roots` is undefined when the file cannot be read or parsed.\n */\ninterface PlanRead {\n readonly namesOriginal: boolean;\n readonly roots: readonly TreeMap[] | undefined;\n}\n\nasync function readForPlan(\n path: string,\n source: PlanSource,\n dependencies: PlanDependencies,\n): Promise<PlanRead> {\n const read = await dependencies.files.read(path);\n if (read.kind !== \"read\") {\n return { namesOriginal: false, roots: undefined };\n }\n const namesOriginal = namesOriginalPackage(read.text);\n // A file that names none of the packages adds nothing, so it is not parsed (the same gate as\n // the migration's own, which keeps large YAML files fast). The root manifest is parsed: its\n // `workspaces` field tells whether the root is a workspace root.\n const isNeeded = namesOriginal || namesUninstalledPackage(read.text) || path === MANIFEST_FILE;\n if (!isNeeded) {\n return { namesOriginal, roots: [] };\n }\n const parsed = source.read?.(read.text, dependencies.readers);\n const roots = parsed?.kind === \"read\" ? parsed.documents.filter(isMap) : undefined;\n return { namesOriginal, roots };\n}\n\n/** The files at a workspace root where pnpm and yarn keep the workspace's catalogs. */\nconst ROOT_WORKSPACE_FILES: ReadonlySet<string> = new Set([WORKSPACE_FILE, YARNRC_FILE_NAME]);\n\n/**\n * Whether a file of the root makes it a workspace root: a pnpm or yarn workspace file, or a\n * root manifest with `workspaces` (bun keeps its catalogs there).\n */\nfunction marksWorkspaceRoot(path: string, roots: readonly TreeMap[] | undefined): boolean {\n if (ROOT_WORKSPACE_FILES.has(path)) {\n return true;\n }\n const manifests = path === MANIFEST_FILE ? (roots ?? []) : [];\n return manifests.some((manifest) => valuesAt(manifest, WORKSPACES_FIELD).length > 0);\n}\n\n/** The names that a manifest or an import map declares, by the role of its file. */\nconst DECLARED_NAMES: Readonly<\n Record<PlanSource[\"role\"], ((root: TreeMap) => string[]) | undefined>\n> = { manifest: declaredNames, \"import-map\": importMapNames, catalogs: undefined };\n\n/** What a manifest or an import map declares; nothing for a file of another role. */\nfunction declarationsOf(\n path: string,\n role: PlanSource[\"role\"],\n roots: readonly TreeMap[] | undefined,\n): ManifestDeclarations[] {\n const names = DECLARED_NAMES[role];\n if (names === undefined) {\n return [];\n }\n const local = role === \"manifest\" ? (roots ?? []).flatMap(localPackageNames) : [];\n return [{ path, names: roots && new Set(roots.flatMap(names)), localPackages: new Set(local) }];\n}\n\n/** The successor aliases in the overrides of a manifest or a workspace file. */\nfunction aliasesOf(path: string, roots: readonly TreeMap[] | undefined): SuccessorAliases[] {\n const names = (roots ?? []).flatMap(successorAliasedPackages);\n return names.length === 0 ? [] : [{ path, names: new Set(names) }];\n}\n\n/**\n * The catalog plan of the project and what its manifests and import maps declare, from the files\n * of the listing. A file that cannot be read or parsed adds no catalogs, and is reported when it\n * is migrated; such a manifest or import map counts as declaring every package.\n */\nexport async function planProjectTarget(\n paths: readonly string[],\n dependencies: PlanDependencies,\n version: string,\n): Promise<ProjectTarget> {\n const documents: Record<\"manifest\" | \"catalogs\", TreeMap[]> = { manifest: [], catalogs: [] };\n const manifests: ManifestDeclarations[] = [];\n const aliases: SuccessorAliases[] = [];\n let isWorkspaceRoot = false;\n const importMaps = await namedImportMaps(paths, dependencies.files, dependencies.readers);\n for (const path of paths) {\n const source = planSourceOf(path, importMaps);\n if (source === undefined) {\n continue;\n }\n const { namesOriginal, roots } = await readForPlan(path, source, dependencies);\n isWorkspaceRoot ||= marksWorkspaceRoot(path, roots);\n if (namesOriginal && source.role !== \"import-map\") {\n documents[source.role].push(...(roots ?? []));\n }\n manifests.push(...declarationsOf(path, source.role, roots));\n aliases.push(...aliasesOf(path, roots));\n }\n const catalogs = planCatalogs({\n manifests: documents.manifest,\n catalogFiles: documents.catalogs,\n isWorkspaceRoot,\n });\n const declarations = withNamedImportMaps(manifests, importMaps);\n const parts = await apiDescriptionParts(paths, dependencies);\n const yamlReach = await planYamlReach(paths, dependencies);\n return {\n ...{ version, catalogs, manifests: declarations, aliases, importMaps },\n ...{ apiDescriptionParts: parts, yamlReach },\n };\n}\n","import { MigrationBugError } from \"../domain/migration-bug.js\";\nimport type { Change, FileMigration, ManualStep } from \"../domain/migration-findings.js\";\nimport type { MigrationContext } from \"./config-steps.js\";\nimport { fileMigrationFor } from \"./file-migrations.js\";\nimport type {\n CallbackRewriter,\n DocumentReaders,\n FileProblem,\n Logger,\n ProjectFiles,\n SkippedFile,\n SourceStringScanner,\n} from \"./ports.js\";\nimport { type ProjectTarget, planProjectTarget } from \"./project-target.js\";\n\nexport interface MigrateProjectDependencies {\n readonly files: ProjectFiles;\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\n readonly readers: DocumentReaders;\n readonly logger: Logger;\n}\n\nexport interface MigrateProjectInput {\n /** The openapi-typesafe version that renamed dependencies get. */\n readonly version: string;\n /** Write the changed files; without it the migration only reports (dry run). */\n readonly isWrite: boolean;\n}\n\n/**\n * What happened to the changed files. A write that fails stops the writing: the files written\n * before it are named, and so are the ones that were not written.\n */\nexport type WriteOutcome =\n | { readonly kind: \"dry-run\" }\n | { readonly kind: \"written\"; readonly paths: readonly string[] }\n | {\n readonly kind: \"failed\";\n readonly written: readonly string[];\n readonly failed: SkippedFile;\n readonly notWritten: readonly string[];\n };\n\n/** Why a file was left as it was: it was not read, or a bug of the tool would corrupt it. */\nexport type SkipReason = FileProblem | { readonly kind: \"migration-bug\"; readonly message: string };\n\n/** A listed file that the migration left as it was, and why. */\nexport interface SkippedPath {\n readonly path: string;\n readonly reason: SkipReason;\n}\n\n/**\n * What the migration found: the files with changes or manual steps, the paths that were not\n * read, and what was written.\n */\nexport interface ProjectMigration {\n readonly files: readonly FileReport[];\n readonly skipped: readonly SkippedPath[];\n readonly write: WriteOutcome;\n}\n\n/** What the migration found in one file. */\nexport interface FileReport {\n readonly path: string;\n readonly isChanged: boolean;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** A file's report and the text to write; the text is undefined when nothing changed. */\ninterface PlannedFile {\n readonly report: FileReport;\n readonly text: string | undefined;\n}\n\ntype FilePlan =\n | { readonly kind: \"planned\"; readonly file: PlannedFile }\n | { readonly kind: \"skipped\"; readonly reason: SkipReason }\n | { readonly kind: \"not-migrated\" };\n\ntype MigrationAttempt =\n | { readonly kind: \"migrated\"; readonly migration: FileMigration }\n | { readonly kind: \"skipped\"; readonly reason: SkipReason };\n\n/** The migration of one file, or the bug that stopped it (see MigrationBugError). */\nfunction attemptMigration(migrate: () => FileMigration): MigrationAttempt {\n try {\n return { kind: \"migrated\", migration: migrate() };\n } catch (error) {\n if (error instanceof MigrationBugError) {\n return { kind: \"skipped\", reason: { kind: \"migration-bug\", message: error.message } };\n }\n throw error;\n }\n}\n\nasync function planFile(\n path: string,\n dependencies: MigrateProjectDependencies,\n target: ProjectTarget,\n): Promise<FilePlan> {\n const migrate = fileMigrationFor(path, target.importMaps);\n if (migrate === undefined) {\n return { kind: \"not-migrated\" };\n }\n const read = await dependencies.files.read(path);\n if (read.kind === \"skipped\") {\n return read;\n }\n const { rewriter, scanner, readers } = dependencies;\n const { version, catalogs, manifests, aliases, apiDescriptionParts, yamlReach } = target;\n const context: MigrationContext = {\n ...{ version, catalogs, manifests, aliases, apiDescriptionParts, yamlReach },\n ...{ rewriter, scanner, readers },\n };\n const attempt = attemptMigration(() => migrate(read.text, path, context));\n if (attempt.kind === \"skipped\") {\n return attempt;\n }\n const { migration } = attempt;\n const isChanged = migration.text !== read.text;\n const { changes, manualSteps } = migration;\n if (isChanged || manualSteps.length > 0) {\n dependencies.logger.info(\"file_migrated\", { path, isChanged, changes, manualSteps });\n }\n const report = { path, isChanged, changes, manualSteps };\n return { kind: \"planned\", file: { report, text: isChanged ? migration.text : undefined } };\n}\n\ninterface ProjectPlan {\n readonly files: readonly PlannedFile[];\n readonly skipped: readonly SkippedPath[];\n}\n\n/**\n * Every file is read and migrated before anything is written, so a file that cannot be read\n * leaves the project as it was instead of half migrated. Such a file is skipped and reported.\n */\nasync function planProject(\n paths: readonly string[],\n dependencies: MigrateProjectDependencies,\n version: string,\n): Promise<ProjectPlan> {\n const files: PlannedFile[] = [];\n const skipped: SkippedPath[] = [];\n const target = await planProjectTarget(paths, dependencies, version);\n for (const path of paths) {\n const plan = await planFile(path, dependencies, target);\n if (plan.kind === \"skipped\") {\n skipped.push({ path, reason: plan.reason });\n dependencies.logger.warn(\"file_skipped\", { path, reason: plan.reason });\n } else if (plan.kind === \"planned\") {\n const { report } = plan.file;\n const isReported = report.isChanged || report.manualSteps.length > 0;\n files.push(...(isReported ? [plan.file] : []));\n }\n }\n return { files, skipped };\n}\n\n/** Writes the changed files in path order and stops at the first one that fails. */\nasync function writeFiles(\n planned: readonly PlannedFile[],\n dependencies: MigrateProjectDependencies,\n): Promise<WriteOutcome> {\n const changed = planned.flatMap(({ report, text }) =>\n text === undefined ? [] : [{ path: report.path, text }],\n );\n const written: string[] = [];\n for (const [index, { path, text }] of changed.entries()) {\n const result = await dependencies.files.write(path, text);\n if (result.kind === \"failed\") {\n dependencies.logger.warn(\"file_write_failed\", { path, reason: result.reason, written });\n const notWritten = changed.slice(index + 1).map((file) => file.path);\n return { kind: \"failed\", written, failed: { path, reason: result.reason }, notWritten };\n }\n written.push(path);\n }\n return { kind: \"written\", paths: written };\n}\n\n/**\n * Migrate every file of a project (ENGINEERING_PLAN 10.1): package.json files, catalogs, module\n * specifiers and `transform` callbacks in sources, and the generator command in scripts. Reads\n * and migrates every file first, then writes the changed ones, only with `isWrite`. Gives the\n * files with changes or manual steps in path order, the skipped paths, and what was written.\n */\nexport async function migrateProject(\n dependencies: MigrateProjectDependencies,\n input: MigrateProjectInput,\n): Promise<ProjectMigration> {\n const listing = await dependencies.files.listFiles();\n const paths = [...listing.files].sort();\n dependencies.logger.info(\"migration_started\", { fileCount: paths.length, ...input });\n const plan = await planProject(paths, dependencies, input.version);\n const skipped = [...listing.skipped, ...plan.skipped];\n const write: WriteOutcome = input.isWrite\n ? await writeFiles(plan.files, dependencies)\n : { kind: \"dry-run\" };\n dependencies.logger.info(\"migration_finished\", {\n changedFiles: plan.files.length,\n skippedFiles: skipped.length,\n write: write.kind,\n });\n return { files: plan.files.map((file) => file.report), skipped, write };\n}\n","/**\n * Text from a document or a project (a path key, an `operationId`, a file name) reaches the\n * terminal and CI job logs. A line break in it starts a new line that CI reads as a command\n * (`::error …` in GitHub Actions, `##vso[…]` in Azure Pipelines), and an escape sequence moves\n * the cursor or erases lines, so it can forge or hide output. Each such character is shown as an\n * escape instead (`\\n`, `\\u001b`), so one message stays one line and shows what the text holds.\n */\n\n/**\n * The code points shown as escapes: C0 controls but the tab, DEL and C1 controls, the Unicode\n * line and paragraph separators, and the bidirectional controls, which reorder how a terminal\n * shows the text around them.\n */\nconst CONTROL_RANGES: readonly (readonly [number, number])[] = [\n [0x00, 0x08],\n [0x0a, 0x1f],\n [0x7f, 0x9f],\n [0x2028, 0x2029],\n [0x202a, 0x202e],\n [0x2066, 0x2069],\n];\n\nconst SHORT_ESCAPES: Readonly<Record<string, string>> = { \"\\n\": \"\\\\n\", \"\\r\": \"\\\\r\" };\nconst HEX_DIGITS = 4;\nconst HEX_RADIX = 16;\n\nfunction isControl(codePoint: number): boolean {\n return CONTROL_RANGES.some(([first, last]) => codePoint >= first && codePoint <= last);\n}\n\nfunction escapeOf(character: string, codePoint: number): string {\n const hex = codePoint.toString(HEX_RADIX).padStart(HEX_DIGITS, \"0\");\n return SHORT_ESCAPES[character] ?? `\\\\u${hex}`;\n}\n\n/** The text with every control character shown as an escape, so it prints as one plain line. */\nexport function terminalSafeText(text: string): string {\n let shown = \"\";\n for (const character of text) {\n const codePoint = character.codePointAt(0) ?? 0;\n shown += isControl(codePoint) ? escapeOf(character, codePoint) : character;\n }\n return shown;\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { ManualStep } from \"../domain/migration-findings.js\";\nimport { FLAG_RENAMES, PACKAGE_RENAMES } from \"../domain/package-names.js\";\n\n/** The user-facing text of the manual steps found in commands (CODING_PRINCIPLES 7.8). */\n\nconst PINNED_NOTE = \"change it to openapi-typesafe@<version>\";\nconst OLD_FILE_NOTE =\n \"is a file of openapi-typescript, which is no longer installed: run openapi-typesafe instead\";\nconst FLAGS_IN_VARIABLE_NOTE =\n \"holds old flags of the generator and may serve other commands, so it was kept: rename\";\nconst NOT_ONLY_GENERATOR_NOTE =\n \"may run openapi-typescript or another program (set elsewhere in the file, in another \" +\n \"step or outside it), so the flags after it were kept; where it runs the generator, rename\";\nconst OLD_NAME_IN_COMMAND_NOTE =\n \"names an old package where the tool cannot tell what runs it (a script name, an argument of \" +\n \"a program it does not know), so it was kept: migrate it by hand\";\nconst SCRIPT_NOT_SHELL_NOTE =\n \"so the tool does not read it as commands: migrate the old package names in it by hand\";\nconst COMMAND_STRING_NOTE = \"a string runs openapi-typescript, so it was kept; change it to\";\n\nfunction pinnedPackageMessage(step: Extract<ManualStep, { kind: \"pinned-package\" }>): string {\n const successor = PACKAGE_RENAMES.get(step.name) ?? step.name;\n return (\n `${step.location} names a pinned ${step.name}@<version>: ` +\n `change it to ${successor}@<version>`\n );\n}\n\n/** `-it to --immutable, …`: each old flag with its new name. */\nconst flagRenames = (flags: readonly string[]): string =>\n flags.map((flag) => `${flag} to ${FLAG_RENAMES.get(flag) ?? flag}`).join(\", \");\n\nfunction flagsInVariableMessage(step: Extract<ManualStep, { kind: \"flags-in-variable\" }>) {\n return `${step.location}: ${step.variable} ${FLAGS_IN_VARIABLE_NOTE} ${flagRenames(step.flags)}`;\n}\n\nfunction notOnlyGeneratorMessage(\n step: Extract<ManualStep, { kind: \"variable-not-only-generator\" }>,\n): string {\n return `${step.location}: ${step.variable} ${NOT_ONLY_GENERATOR_NOTE} ${flagRenames(step.flags)}`;\n}\n\n/** The manual steps found in commands: scripts, shell files, CI files and command strings. */\ntype CommandStep = Extract<\n ManualStep,\n {\n kind:\n | \"versioned-command\"\n | \"flags-in-variable\"\n | \"variable-not-only-generator\"\n | \"pinned-package\"\n | \"old-package-file\"\n | \"old-name-in-command\"\n | \"script-not-shell\"\n | \"command-string\";\n }\n>;\n\nconst COMMAND_STEP_KINDS: ReadonlySet<ManualStep[\"kind\"]> = new Set([\n \"versioned-command\",\n \"flags-in-variable\",\n \"variable-not-only-generator\",\n \"pinned-package\",\n \"old-package-file\",\n \"old-name-in-command\",\n \"script-not-shell\",\n \"command-string\",\n]);\n\nexport const isCommandStep = (step: ManualStep): step is CommandStep =>\n COMMAND_STEP_KINDS.has(step.kind);\n\nexport function commandStepMessage(step: CommandStep): string {\n switch (step.kind) {\n case \"versioned-command\":\n return `${step.location} runs a pinned openapi-typescript@<version>: ${PINNED_NOTE}`;\n case \"flags-in-variable\":\n return flagsInVariableMessage(step);\n case \"variable-not-only-generator\":\n return notOnlyGeneratorMessage(step);\n case \"pinned-package\":\n return pinnedPackageMessage(step);\n case \"old-package-file\":\n return `${step.location}: ${step.path} ${OLD_FILE_NOTE}`;\n case \"old-name-in-command\":\n return `${step.location}: \"${step.word}\" ${OLD_NAME_IN_COMMAND_NOTE}`;\n case \"script-not-shell\":\n return `${step.location}: the script runs with ${step.shell}, ${SCRIPT_NOT_SHELL_NOTE}`;\n case \"command-string\":\n return `line ${step.line}: ${COMMAND_STRING_NOTE} \"${step.to}\"`;\n default:\n return assertNever(step);\n }\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { ManualStep, TransformKeepReason } from \"../domain/migration-findings.js\";\n\n/** The user-facing text of the manual steps found in source files (CODING_PRINCIPLES 7.8). */\n\n// The same guide the generator links in its deprecation warning.\nconst IR_CALLBACKS_GUIDE =\n \"https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks\";\n\nconst KEEP_REASONS: Readonly<Record<TransformKeepReason, string>> = {\n \"other-callbacks\":\n \"postTransform or transformProperty are set too, and they need TypeScript nodes\",\n \"not-a-function\": \"it is not an inline function or a function of this file\",\n \"shared-function\": \"the function it names is used elsewhere too\",\n \"shared-options\": \"its options object is used elsewhere too\",\n \"unknown-return\": \"a return value is not a plain ts.factory type\",\n \"typed-options\":\n \"its options are declared with a type built from OpenAPITSOptions, which the tool cannot \" +\n \"change to OpenAPITSIrOptions\",\n \"spread-options\":\n \"its options take keys from another object (`...base`), whose callbacks and type the tool \" +\n \"cannot see\",\n \"declared-type\":\n \"its declared type (a `const` type, JSDoc `@type` or `@returns`) names a type the tool \" +\n \"cannot change to type text\",\n \"in-spread\":\n \"it is in an object that the options take keys from (`...base`), and the tool rewrites \" +\n \"only a transform written in the options\",\n};\nconst OPTIONS_NOTE =\n \"the options of openapiTS() are not an object written in this file: check them for \" +\n `transform, postTransform and transformProperty. See ${IR_CALLBACKS_GUIDE}`;\nconst SPREAD_NOTE =\n \"the options of openapiTS() take keys from an object the tool cannot read (`...base`): \" +\n `check it for transform, postTransform and transformProperty. See ${IR_CALLBACKS_GUIDE}`;\nconst DEEP_IMPORT_NOTE = \"imports a file inside the package; check that it exists\";\nconst OLD_FILE_NOTE = \"imports a file from node_modules of\";\nconst OLD_FILE_FIX_NOTE = \"which is no longer installed: import from\";\nconst DYNAMIC_NOTE =\n \"builds its module name at run time from an old package name, so it was kept; rename it to\";\nconst STRING_NOTE = \"is a string, not a module specifier, so it was kept\";\nconst STRING_FIX_NOTE = \"if it names the package, change it to\";\nconst KEPT_NOTE = `it works, with a deprecation warning. See ${IR_CALLBACKS_GUIDE}`;\nconst LEGACY_CALLBACK_NOTE = `receives TypeScript nodes (deprecated). See ${IR_CALLBACKS_GUIDE}`;\nconst HELPER_TYPES_ENTRY = \"openapi-typesafe-fetch/helpers\";\n\nfunction packageNotDeclaredMessage(\n step: Extract<ManualStep, { kind: \"package-not-declared\" }>,\n): string {\n const { line, name, installers } = step;\n return (\n `line ${line}: no package.json or Deno import map at or above this file lists ${name}; ` +\n `${installers.join(\" and \")} installed it, the openapi-typesafe packages do not: ` +\n `add it to the dependencies, or import the types from ${HELPER_TYPES_ENTRY}`\n );\n}\n\n/** Steps for a line of a source file. */\nexport type SourceStep = Extract<\n ManualStep,\n {\n kind:\n | \"options-not-inspected\"\n | \"options-spread-not-inspected\"\n | \"deep-import\"\n | \"old-package-import\"\n | \"dynamic-specifier\"\n | \"string-names-package\"\n | \"transform-not-rewritten\"\n | \"legacy-callback\"\n | \"package-not-declared\";\n }\n>;\n\nconst SOURCE_STEP_KINDS: ReadonlySet<ManualStep[\"kind\"]> = new Set([\n \"options-not-inspected\",\n \"options-spread-not-inspected\",\n \"deep-import\",\n \"old-package-import\",\n \"dynamic-specifier\",\n \"string-names-package\",\n \"transform-not-rewritten\",\n \"legacy-callback\",\n \"package-not-declared\",\n]);\n\nexport const isSourceStep = (step: ManualStep): step is SourceStep =>\n SOURCE_STEP_KINDS.has(step.kind);\n\nexport function sourceStepMessage(step: SourceStep): string {\n switch (step.kind) {\n case \"options-not-inspected\":\n return `line ${step.line}: ${OPTIONS_NOTE}`;\n case \"options-spread-not-inspected\":\n return `line ${step.line}: ${SPREAD_NOTE}`;\n case \"deep-import\":\n return `line ${step.line}: \"${step.specifier}\" ${DEEP_IMPORT_NOTE}`;\n case \"old-package-import\":\n return (\n `line ${step.line}: \"${step.specifier}\" ${OLD_FILE_NOTE} ${step.name}, ` +\n `${OLD_FILE_FIX_NOTE} ${step.to}`\n );\n case \"dynamic-specifier\":\n return `line ${step.line}: \\`${step.value}\\` ${DYNAMIC_NOTE} ${step.to}`;\n case \"string-names-package\":\n return `line ${step.line}: \"${step.value}\" ${STRING_NOTE}; ${STRING_FIX_NOTE} \"${step.to}\"`;\n case \"transform-not-rewritten\":\n return `line ${step.line}: transform kept (${KEEP_REASONS[step.reason]}); ${KEPT_NOTE}`;\n case \"legacy-callback\":\n return `line ${step.line}: ${step.callback} ${LEGACY_CALLBACK_NOTE}`;\n case \"package-not-declared\":\n return packageNotDeclaredMessage(step);\n default:\n return assertNever(step);\n }\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { ManualStep } from \"../domain/migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"../domain/package-names.js\";\nimport { commandStepMessage, isCommandStep } from \"./command-step-messages.js\";\nimport { isSourceStep, sourceStepMessage } from \"./source-step-messages.js\";\n\n/** The user-facing text of the manual steps in the report (CODING_PRINCIPLES 7.8). */\n\nconst OPENAPI_FETCH_ALIAS_GUIDE =\n \"https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md\" +\n \"#libraries-built-on-openapi-fetch\";\n\nconst PEER_NOTE = \"users of this package must switch too (a breaking change for them)\";\nconst MANIFEST_NOT_READ_NOTE =\n \"is a JSON5 manifest, which the tool does not read: rename the packages and the generator \" +\n \"command by hand, or write it as package.json and run the tool again\";\nconst IMPORT_MAP_NOTE =\n \"is a URL or a file outside the project folder, so it was not migrated: rename the old \" +\n \"packages in it by hand\";\nconst PATCH_NOTE = \"check whether the fix is still needed, then make the patch again or delete it\";\nconst PATTERN_NOTE = \"is a pattern that names\";\nconst PATTERN_FIX_NOTE = \"where it means the package, make it match\";\nconst SETTING_NOTE = \"remove the setting if it no longer applies, or make it name\";\nconst LOCAL_PACKAGE_NOTE =\n \"points at a local package, not the npm package, so it and the imports of it were kept: if \" +\n \"that package is a copy of the original, move it to\";\nconst DEEP_TARGET_NOTE = \"points at a file inside the package; check that it exists\";\nconst OLD_PATH_NOTE =\n \"is a path into node_modules of an old package, which is no longer installed:\";\nconst OLD_PATH_FIX_NOTE = \"point it at the files of\";\n\nconst renamed = (name: string): string => PACKAGE_RENAMES.get(name) ?? name;\n\nconst localPackageMessage = (step: Extract<ManualStep, { kind: \"local-package\" }>): string =>\n `${step.field}: ${step.name} \"${step.spec}\" ${LOCAL_PACKAGE_NOTE} ${renamed(step.name)}`;\n\nfunction oldPeerMessage(step: Extract<ManualStep, { kind: \"old-peer-needed\" }>): string {\n const { dependent, peer, range } = step;\n const successor = PACKAGE_RENAMES.get(peer) ?? peer;\n return (\n `${dependent} takes its client type from ${peer}@${range}, its peer dependency: alias ` +\n `${peer} to ${successor} with overrides or resolutions, or passing it the ${successor} ` +\n `client fails to type-check. See ${OPENAPI_FETCH_ALIAS_GUIDE}`\n );\n}\n\n/** Steps for places of a structured file (JSON, YAML) that the tool could not edit. */\ntype UneditedStep = Extract<\n ManualStep,\n {\n kind:\n | \"config-unreadable\"\n | \"manifest-not-read\"\n | \"import-map-not-editable\"\n | \"old-package-patch\"\n | \"entry-not-edited\"\n | \"name-collision\";\n }\n>;\n\n/** Steps for catalog entries and the dependencies on them that keep the old names. */\ntype CatalogStep = Extract<\n ManualStep,\n {\n kind:\n | \"catalog-reference-kept\"\n | \"catalog-entry-outside\"\n | \"catalog-entry-missing\"\n | \"catalog-entry-in-use\";\n }\n>;\n\nfunction uneditedStepMessage(step: UneditedStep): string {\n switch (step.kind) {\n case \"config-unreadable\":\n return step.position === undefined\n ? \"nests too deep to be read; migrate it by hand\"\n : `cannot be parsed at line ${step.position.line}, column ${step.position.column}; ` +\n \"migrate it by hand\";\n case \"manifest-not-read\":\n return MANIFEST_NOT_READ_NOTE;\n case \"import-map-not-editable\":\n return `importMap \"${step.reference}\" ${IMPORT_MAP_NOTE}`;\n case \"old-package-patch\":\n return `patches the code of ${step.name}, which ${step.to} does not share: ${PATCH_NOTE}`;\n case \"entry-not-edited\":\n return `${step.field}: ${step.name} has a value the tool does not read; rename it by hand`;\n case \"name-collision\":\n return (\n `${step.field} has both ${step.from} and ${step.to}, so ${step.from} was kept: ` +\n \"remove one of them\"\n );\n default:\n return assertNever(step);\n }\n}\n\nfunction catalogStepMessage(step: CatalogStep): string {\n switch (step.kind) {\n case \"catalog-reference-kept\":\n return (\n `${step.field}: ${step.name} was kept, because catalog \"${step.catalog}\" keeps ` +\n `${step.name}: rename the entry and the dependency together`\n );\n case \"catalog-entry-outside\":\n return (\n `${step.field}: ${step.name} was kept, because no catalog of this project has its ` +\n `\"${step.catalog}\" entry; a catalog above the root (pnpm-workspace.yaml, .yarnrc.yml or ` +\n \"the workspace package.json) may hold it: rename the entry and the dependency together\"\n );\n case \"catalog-entry-missing\":\n return (\n `${step.field}: ${step.name} was kept, because no catalog of the workspace has its ` +\n `\"${step.catalog}\" entry: add the entry, or give the dependency a version`\n );\n case \"catalog-entry-in-use\":\n return (\n `${step.catalog}: ${step.name} was kept, because a dependency or an override still ` +\n \"names it: rename the entry and what names it together\"\n );\n default:\n return assertNever(step);\n }\n}\n\n/** Steps for the packages a manifest names. */\ntype PackageStep = Extract<\n ManualStep,\n {\n kind:\n | \"peer-dependency-renamed\"\n | \"spec-kept\"\n | \"local-package\"\n | \"override-names-package\"\n | \"setting-names-package\"\n | \"pattern-names-package\"\n | \"deep-target\"\n | \"old-package-path\"\n | \"old-peer-needed\";\n }\n>;\n\nfunction packageStepMessage(step: PackageStep): string {\n switch (step.kind) {\n case \"peer-dependency-renamed\":\n return `${step.name} is a peer dependency: ${PEER_NOTE}`;\n case \"spec-kept\":\n return `${step.name} kept the spec \"${step.spec}\": point it at an openapi-typesafe version`;\n case \"local-package\":\n return localPackageMessage(step);\n case \"override-names-package\":\n return `\"${step.field}\" names ${step.name}: update or remove that override`;\n case \"setting-names-package\":\n return `\"${step.field}\" names ${step.name}: ${SETTING_NOTE} ${renamed(step.name)}`;\n case \"pattern-names-package\":\n return (\n `${step.location}: \"${step.value}\" ${PATTERN_NOTE} ${step.name}: ` +\n `${PATTERN_FIX_NOTE} ${step.to}`\n );\n case \"deep-target\":\n return `${step.location}: \"${step.specifier}\" ${DEEP_TARGET_NOTE}`;\n case \"old-package-path\":\n return `${step.location}: \"${step.path}\" ${OLD_PATH_NOTE} ${OLD_PATH_FIX_NOTE} ${step.to}`;\n case \"old-peer-needed\":\n return oldPeerMessage(step);\n default:\n return assertNever(step);\n }\n}\n\nexport function manualStepMessage(step: ManualStep): string {\n if (isCommandStep(step)) {\n return commandStepMessage(step);\n }\n if (isSourceStep(step)) {\n return sourceStepMessage(step);\n }\n switch (step.kind) {\n case \"config-unreadable\":\n case \"manifest-not-read\":\n case \"import-map-not-editable\":\n case \"old-package-patch\":\n case \"entry-not-edited\":\n case \"name-collision\":\n return uneditedStepMessage(step);\n case \"catalog-reference-kept\":\n case \"catalog-entry-outside\":\n case \"catalog-entry-missing\":\n case \"catalog-entry-in-use\":\n return catalogStepMessage(step);\n case \"peer-dependency-renamed\":\n case \"spec-kept\":\n case \"local-package\":\n case \"override-names-package\":\n case \"setting-names-package\":\n case \"pattern-names-package\":\n case \"deep-target\":\n case \"old-package-path\":\n case \"old-peer-needed\":\n return packageStepMessage(step);\n default:\n return assertNever(step);\n }\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { Change } from \"../domain/migration-findings.js\";\nimport type { SkipReason } from \"./migrate-project.js\";\nimport type { FileProblem } from \"./ports.js\";\n\n/**\n * The user-facing text of the report (CODING_PRINCIPLES 7.8: kept apart from the logic); the\n * manual steps have their own module, manual-step-messages.ts.\n */\n\nexport function changeMessage(change: Change): string {\n switch (change.kind) {\n case \"dependency-renamed\":\n return `${change.field}: ${change.from} → ${change.to}@${change.spec}`;\n case \"catalog-entry-renamed\":\n return `${change.catalog}: ${change.from} → ${change.to}@${change.spec}`;\n case \"import-renamed\":\n return `${change.field}: \"${change.from}\" → \"${change.to}\" (${change.target})`;\n case \"alias-renamed\":\n return `${change.field}: ${change.name} → ${change.spec}`;\n case \"command-renamed\":\n return `${change.location}: openapi-typescript → openapi-typesafe`;\n case \"flag-renamed\":\n case \"package-name-renamed\":\n return `${change.location}: ${change.from} → ${change.to}`;\n case \"specifier-renamed\":\n return `line ${change.line}: \"${change.from}\" → \"${change.to}\"`;\n case \"transform-rewritten\":\n return `line ${change.line}: transform returns type text; irCallbacks: true added`;\n case \"declaration-removed\":\n return `line ${change.line}: ${change.name} removed; only the old transform returns used it`;\n default:\n return assertNever(change);\n }\n}\n\nexport const SKIPPED_HEADING = \"Skipped (not migrated, not written):\";\n\n/** Why a file was left as it was, after its path in the \"Skipped\" section. */\nexport function skippedMessage(reason: SkipReason): string {\n switch (reason.kind) {\n case \"outside-root\":\n return \"it leads outside the project folder (a link, or a path in the git index)\";\n case \"not-utf-8\":\n return \"it is not UTF-8 text, so it was not changed; check it by hand\";\n case \"io-error\":\n return `it could not be read (${reason.code})`;\n case \"migration-bug\":\n return (\n `the tool could not migrate it (${reason.message}), a bug of the tool: it was not ` +\n \"changed, so migrate it by hand, and please report the bug\"\n );\n default:\n return assertNever(reason);\n }\n}\n\nfunction writeProblemMessage(reason: FileProblem): string {\n switch (reason.kind) {\n case \"outside-root\":\n return \"it leads outside the project folder\";\n case \"not-utf-8\":\n return \"its text is not UTF-8\";\n case \"io-error\":\n return reason.code;\n default:\n return assertNever(reason);\n }\n}\n\n/** The first line of the report's end when a write failed and the writing stopped. */\nexport const writeFailedMessage = (path: string, reason: FileProblem): string =>\n `Writing stopped: ${path} could not be written (${writeProblemMessage(reason)}).`;\nexport const WRITTEN_HEADING = \"Written before it:\";\nexport const NOT_WRITTEN_HEADING = \"Not written (still as they were):\";\nexport const NONE_WRITTEN = \"Nothing was written before it.\";\n\nexport const NEXT_STEPS: readonly string[] = [\n \"Install: run your package manager's install, so the lockfile has the new packages.\",\n \"Regenerate your types and commit them once: the file header names openapi-typesafe now, \" +\n \"so `--check` fails until you do.\",\n \"Run your type check and tests.\",\n];\n\nexport const DRY_RUN_NOTE = \"Dry run: nothing was written. Run again with --write to apply.\";\nexport const WRITTEN_NOTE = \"Files were written.\";\nexport const NOTHING_FOUND =\n \"Nothing to migrate: no openapi-typescript, openapi-fetch, openapi-react-query \" +\n \"or openapi-typescript-helpers found.\";\n/** The end of a report whose only files with findings were skipped by a bug of the tool. */\nexport const NOTHING_ELSE_FOUND =\n \"Nothing else to migrate: migrate the skipped files above by hand.\";\n","import { assertNever } from \"../domain/assert-never.js\";\nimport { terminalSafeText } from \"../domain/terminal-text.js\";\nimport { manualStepMessage } from \"./manual-step-messages.js\";\nimport {\n changeMessage,\n DRY_RUN_NOTE,\n NEXT_STEPS,\n NONE_WRITTEN,\n NOT_WRITTEN_HEADING,\n NOTHING_ELSE_FOUND,\n NOTHING_FOUND,\n SKIPPED_HEADING,\n skippedMessage,\n WRITTEN_HEADING,\n WRITTEN_NOTE,\n writeFailedMessage,\n} from \"./messages.js\";\nimport type { FileReport, ProjectMigration, SkippedPath, WriteOutcome } from \"./migrate-project.js\";\n\nfunction changesSection(reports: readonly FileReport[]): string[] {\n const changed = reports.filter((report) => report.changes.length > 0);\n if (changed.length === 0) {\n return [];\n }\n return [\n \"Changes:\",\n ...changed.flatMap((report) => [\n ` ${report.path}`,\n ...report.changes.map((change) => ` ${changeMessage(change)}`),\n ]),\n \"\",\n ];\n}\n\nfunction manualStepsSection(reports: readonly FileReport[]): string[] {\n const steps = reports.flatMap((report) =>\n report.manualSteps.map((step) => ` ${report.path}: ${manualStepMessage(step)}`),\n );\n return steps.length === 0 ? [] : [\"Manual steps:\", ...steps, \"\"];\n}\n\nfunction skippedSection(skipped: readonly SkippedPath[]): string[] {\n if (skipped.length === 0) {\n return [];\n }\n const lines = skipped.map((file) => ` ${file.path}: ${skippedMessage(file.reason)}`);\n return [SKIPPED_HEADING, ...lines, \"\"];\n}\n\nconst listed = (paths: readonly string[]): string[] => paths.map((path) => ` ${path}`);\n\n/** The end of the report: what was written, or where the writing stopped. */\nfunction writeSection(write: WriteOutcome): string[] {\n switch (write.kind) {\n case \"dry-run\":\n return [DRY_RUN_NOTE];\n case \"written\":\n return [WRITTEN_NOTE];\n case \"failed\":\n return [\n writeFailedMessage(write.failed.path, write.failed.reason),\n ...(write.written.length === 0 ? [NONE_WRITTEN] : [WRITTEN_HEADING]),\n ...listed(write.written),\n ...(write.notWritten.length === 0 ? [] : [NOT_WRITTEN_HEADING]),\n ...listed(write.notWritten),\n ];\n default:\n return assertNever(write);\n }\n}\n\n/**\n * The report's lines as printed. A line quotes file names and text of the project, so each one is\n * shown as one plain line: a line break or an escape sequence in a file name must not forge a CI\n * command or erase the lines before it (terminal-text.ts).\n */\nfunction printed(lines: readonly string[]): string {\n return `${lines.map(terminalSafeText).join(\"\\n\")}\\n`;\n}\n\n/**\n * The summary the command prints: changes per file, manual steps, skipped paths, what to do\n * next, and what was written.\n */\nexport function renderReport(migration: ProjectMigration): string {\n const reports = migration.files;\n const skipped = skippedSection(migration.skipped);\n if (reports.length === 0) {\n // A file that a bug of the tool skipped was read and had something to migrate.\n const hasBug = migration.skipped.some((file) => file.reason.kind === \"migration-bug\");\n return printed([...skipped, hasBug ? NOTHING_ELSE_FOUND : NOTHING_FOUND]);\n }\n const lines = [\n ...changesSection(reports),\n ...manualStepsSection(reports),\n ...skipped,\n \"Next steps:\",\n ...NEXT_STEPS.map((step, index) => ` ${index + 1}. ${step}`),\n \"\",\n ...writeSection(migration.write),\n ];\n return printed(lines);\n}\n","import { parseArgs } from \"node:util\";\n\n/** What the command was asked to do. */\nexport type CliRequest =\n | { readonly kind: \"help\" }\n | { readonly kind: \"version\" }\n | {\n readonly kind: \"migrate\";\n readonly isWrite: boolean;\n readonly root: string | undefined;\n readonly logPath: string | undefined;\n };\n\nconst OPTIONS = {\n write: { type: \"boolean\" },\n root: { type: \"string\" },\n log: { type: \"string\" },\n help: { type: \"boolean\", short: \"h\" },\n version: { type: \"boolean\", short: \"v\" },\n} as const;\n\n/** Parse the arguments; unknown options and positionals throw a TypeError with Node's message. */\nexport function parseCliArguments(argv: readonly string[]): CliRequest {\n const { values } = parseArgs({ args: [...argv], options: OPTIONS, strict: true });\n if (values.help === true) {\n return { kind: \"help\" };\n }\n if (values.version === true) {\n return { kind: \"version\" };\n }\n return {\n kind: \"migrate\",\n isWrite: values.write === true,\n root: values.root,\n logPath: values.log,\n };\n}\n","import type { ProjectRootState } from \"../application/ports.js\";\n\n/** The command's own text: help, usage errors and the closing notes. */\n\nexport const HELP_TEXT = `Usage\n openapi-typesafe-migrate [options]\n\nMove a project from openapi-typescript, openapi-fetch, openapi-react-query and\nopenapi-typescript-helpers to the openapi-typesafe packages. Without --write it only reports.\n\nOptions\n --write Write the changes (default: dry run)\n --root <dir> The project directory (default: the current directory)\n --log <file> The JSON Lines log file (default: a new file in the temporary directory)\n --help, -h Show this help\n --version, -v Show the version\n\nExit codes\n 0 Done\n 1 The migration failed (the message and the log say why), a file could not be written\n (the report names what was written), or the log could not be created\n 2 Unknown option or argument\n`;\n\nexport const usageError = (message: string): string =>\n `${message}\\nRun openapi-typesafe-migrate --help for the options.\\n`;\n\nexport const logNote = (path: string): string => `Log: ${path}\\n`;\n\nconst ROOT_PROBLEMS: Readonly<Record<Exclude<ProjectRootState, \"directory\">, string>> = {\n missing: \"does not exist\",\n \"not-a-directory\": \"is not a folder; --root takes the project folder\",\n};\n\n/** The project folder, as resolved from `--root` or the current directory, cannot be listed. */\nexport const rootError = (root: string, state: Exclude<ProjectRootState, \"directory\">): string =>\n `The project folder ${root} ${ROOT_PROBLEMS[state]}\\n`;\n\n/** `path` is the `--log` value as given; without one the log goes to the temporary directory. */\nexport const logError = (path: string | undefined, message: string): string =>\n `Cannot create the log ${path ?? \"in the temporary directory\"}: ${message}\\n`;\n","import { migrateProject } from \"../application/migrate-project.js\";\nimport type {\n CallbackRewriter,\n DocumentReaders,\n Logger,\n ProjectFiles,\n ProjectRootState,\n SourceStringScanner,\n} from \"../application/ports.js\";\nimport { renderReport } from \"../application/report.js\";\nimport { terminalSafeText } from \"../domain/terminal-text.js\";\nimport { type CliRequest, parseCliArguments } from \"./cli-arguments.js\";\nimport { HELP_TEXT, logError, logNote, rootError, usageError } from \"./cli-text.js\";\n\n/** Everything the command takes from the process, so tests run it with fakes. */\nexport interface CliDependencies {\n readonly version: string;\n readonly cwd: string;\n readonly writeStdout: (text: string) => void;\n readonly writeStderr: (text: string) => void;\n readonly inspectRoot: (root: string) => Promise<ProjectRootState>;\n readonly createFiles: (root: string, logger: Logger) => ProjectFiles;\n readonly createLogger: (path: string | undefined) => {\n readonly logger: Logger;\n readonly path: string;\n };\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\n readonly readers: DocumentReaders;\n readonly resolvePath: (cwd: string, path: string) => string;\n}\n\nexport const EXIT_CODES = { success: 0, failure: 1, usage: 2 } as const;\n\nfunction parseRequest(\n argv: readonly string[],\n dependencies: CliDependencies,\n): CliRequest | undefined {\n try {\n return parseCliArguments(argv);\n } catch (error) {\n // parseArgs reports unknown options and stray positionals as a TypeError.\n if (error instanceof TypeError) {\n dependencies.writeStderr(usageError(error.message));\n return undefined;\n }\n throw error;\n }\n}\n\ntype MigrateRequest = Extract<CliRequest, { kind: \"migrate\" }>;\n\nconst errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n/**\n * The log is created before any file is read, so a log that cannot be written (a parent that is\n * a file, a read-only folder) stops the run before it changes anything.\n */\nfunction openLog(\n request: MigrateRequest,\n dependencies: CliDependencies,\n): ReturnType<CliDependencies[\"createLogger\"]> | undefined {\n try {\n return dependencies.createLogger(request.logPath);\n } catch (error) {\n dependencies.writeStderr(logError(request.logPath, errorMessage(error)));\n return undefined;\n }\n}\n\n/** Migrate the project in `root`; resolves to the exit code. */\nasync function migrateRoot(\n request: MigrateRequest,\n root: string,\n logger: Logger,\n dependencies: CliDependencies,\n): Promise<number> {\n const rootState = await dependencies.inspectRoot(root);\n if (rootState !== \"directory\") {\n logger.warn(\"root_unusable\", { root, rootState });\n dependencies.writeStderr(rootError(root, rootState));\n return EXIT_CODES.failure;\n }\n const files = dependencies.createFiles(root, logger);\n const { rewriter, scanner, readers } = dependencies;\n const input = { version: dependencies.version, isWrite: request.isWrite };\n const migration = await migrateProject({ files, rewriter, scanner, readers, logger }, input);\n dependencies.writeStdout(renderReport(migration));\n // A file that a bug of the tool left as it was is not migrated: the run did not finish its job.\n const hasBug = migration.skipped.some((file) => file.reason.kind === \"migration-bug\");\n return migration.write.kind === \"failed\" || hasBug ? EXIT_CODES.failure : EXIT_CODES.success;\n}\n\nasync function runMigration(\n request: MigrateRequest,\n dependencies: CliDependencies,\n): Promise<number> {\n const log = openLog(request, dependencies);\n if (log === undefined) {\n return EXIT_CODES.failure;\n }\n const { logger, path } = log;\n const root = dependencies.resolvePath(dependencies.cwd, request.root ?? \".\");\n try {\n return await migrateRoot(request, root, logger, dependencies);\n } catch (error) {\n const message = errorMessage(error);\n logger.warn(\"migration_failed\", { root, message });\n // The message of a failed read or parse quotes a file name or text of the project.\n dependencies.writeStderr(`${terminalSafeText(message)}\\n`);\n return EXIT_CODES.failure;\n } finally {\n dependencies.writeStdout(logNote(path));\n }\n}\n\n/** Run the command; resolves to the exit code. */\nexport async function runCli(\n argv: readonly string[],\n dependencies: CliDependencies,\n): Promise<number> {\n const request = parseRequest(argv, dependencies);\n if (request === undefined) {\n return EXIT_CODES.usage;\n }\n if (request.kind === \"help\") {\n dependencies.writeStdout(HELP_TEXT);\n return EXIT_CODES.success;\n }\n if (request.kind === \"version\") {\n dependencies.writeStdout(`${dependencies.version}\\n`);\n return EXIT_CODES.success;\n }\n return runMigration(request, dependencies);\n}\n","import { readFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { resolve } from \"node:path\";\nimport { createGitFileList } from \"../adapters/git-file-list/git-file-list.js\";\nimport { createNodeGitFileSystem } from \"../adapters/git-file-list/git-locations.js\";\nimport {\n createJsonLinesLogger,\n createTemporaryLogPath,\n} from \"../adapters/json-lines-logger/json-lines-logger.js\";\nimport { createJsonTextReader } from \"../adapters/json-text/json-text.js\";\nimport {\n createNodeProjectFiles,\n inspectProjectRoot,\n} from \"../adapters/node-project-files/node-project-files.js\";\nimport { createPipeSafeWriter } from \"../adapters/pipe-safe-writer/pipe-safe-writer.js\";\nimport { createTypescriptCallbackRewriter } from \"../adapters/typescript-parser/rewriter.js\";\nimport { createTypescriptStringScanner } from \"../adapters/typescript-parser/source-strings.js\";\nimport { createYamlTextReader } from \"../adapters/yaml-text/yaml-text.js\";\nimport { type CliDependencies, runCli } from \"./run-cli.js\";\n\n/**\n * The composition root: the only module that touches the process. `bin/migrate.js` imports the\n * built copy of this module.\n */\n\n/** The same path from `src/cli/` and from the built `dist/cli/`. */\nconst PACKAGE_JSON = new URL(\"../../package.json\", import.meta.url);\n\nfunction readVersion(): string {\n const packageJson: { version: string } = JSON.parse(readFileSync(PACKAGE_JSON, \"utf8\"));\n return packageJson.version;\n}\n\nconst now = (): Date => new Date();\n\n/**\n * Without `--log`, a new file per run in a new private folder in the temporary directory, named\n * by its UTC start time. A `--log` file is the user's choice and gets the lines appended.\n */\nfunction createLogger(path: string | undefined): ReturnType<CliDependencies[\"createLogger\"]> {\n const isExclusive = path === undefined;\n const logPath = isExclusive ? createTemporaryLogPath(tmpdir(), now()) : resolve(path);\n return { logger: createJsonLinesLogger({ path: logPath, now, isExclusive }), path: logPath };\n}\n\n/** Git for the project at `root`: git is looked up on PATH outside that folder. */\nconst createGit = (root: string) =>\n createGitFileList({\n environment: process.env,\n platform: process.platform,\n fileSystem: createNodeGitFileSystem(),\n projectRoot: root,\n });\n\nconst dependencies: CliDependencies = {\n version: readVersion(),\n cwd: process.cwd(),\n writeStdout: createPipeSafeWriter(process.stdout),\n writeStderr: createPipeSafeWriter(process.stderr),\n inspectRoot: inspectProjectRoot,\n createFiles: (root, logger) => createNodeProjectFiles(root, { git: createGit(root), logger }),\n createLogger,\n rewriter: createTypescriptCallbackRewriter(),\n scanner: createTypescriptStringScanner(),\n readers: { json: createJsonTextReader(), yaml: createYamlTextReader() },\n resolvePath: resolve,\n};\n\nrunCli(process.argv.slice(2), dependencies).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"names":["PARENT_FOLDER","listedPaths","spanOf","convert","read","isInFolder","baseName","files","TYPESCRIPT_MODULES","joined","DEFAULT_EXPORT","referencedName","renamed","importEdits","extensionOf","plain","singleQuoted","doubleQuoted","isScalar","isMap","PATH_SEPARATOR","EXPRESSION_CLOSE","BACKSLASH","DOUBLE_QUOTE","ASSIGNMENT_RE","APPEND_OPERATOR","isOption","RECIPE_PREFIX_RE","LINE_BREAK","PATH_SEPARATOR_RE","WINDOWS_EXECUTABLE_RE","OPTION_START","QUOTES","SHELLS","OPTION_PREFIX","programName","valueCommands","placedAssignments","argumentFindings","SHELL_VARIABLE_RE","expandedName","programDefinitions","found","NPM_PROTOCOL","protocol","NOT_LINE_BREAK_RE","ASSIGNMENT","SCOPE_PREFIX","IMPORTS_FIELD","FIELD_SEPARATOR","NAME_RE","BLANK_RE","COMMENT_START","scopeOf","MASK","BLANK","assignmentsOf","shellText","variableValues","first","migrateCatalogs","PATH_TAIL","SPECIAL_CHARACTERS_RE","name","textOf","OLD_FILE_NOTE"],"mappings":";;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