openapi-typesafe-migrate 1.0.0-rc.0 → 1.0.0-rc.2
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/LICENSE +0 -1
- package/README.md +56 -17
- package/dist/cli/main.mjs +640 -79
- package/dist/cli/main.mjs.map +1 -1
- package/package.json +2 -2
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,CAAK,SAAA,CAAU,EAAE,IA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,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-file-list.ts","../../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/script-regions.ts","../../src/adapters/typescript-parser/factory-type-text.ts","../../src/adapters/typescript-parser/transform-returns.ts","../../src/adapters/typescript-parser/rewriter.ts","../../src/adapters/typescript-parser/source-strings.ts","../../src/domain/package-names.ts","../../src/domain/command-migration.ts","../../src/domain/override-targets.ts","../../src/domain/url-credentials.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 { spawn } from \"node:child_process\";\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;\nconst IGNORED_EXIT_CODE = 0;\nconst NOT_IGNORED_EXIT_CODE = 1;\nconst IGNORED_REASON = \"the git repository around the folder ignores it\";\nconst GIT_COMMAND = \"git\";\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. `core.fsmonitor` is the one setting that makes\n * `ls-files` and `check-ignore` run a command (they write no index, so no hook runs, and they\n * start no filter, pager or network helper). `safe.bareRepository=explicit` refuses a bare\n * repository found by walking up from the folder, so its config is not read at all; the folder\n * is then walked as a tree.\n */\nconst HARDENED_CONFIG = [\n \"-c\",\n \"core.fsmonitor=false\",\n \"-c\",\n \"safe.bareRepository=explicit\",\n] as const;\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\ntype 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\nfunction runGit(directory: string, gitArguments: readonly string[]): Promise<GitRun> {\n return new Promise((resolve) => {\n // spawn, not execFile: the output of a large repository has no buffer limit this way.\n const child = spawn(GIT_COMMAND, [...HARDENED_CONFIG, ...gitArguments], { cwd: directory });\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 not installed, 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\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 listDirectory(directory: string): Promise<GitListing> {\n const ignored = await runGit(directory, 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 runGit(directory, 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\nclass SpawnedGitFileList implements GitFileList {\n list(directory: string): Promise<GitListing> {\n return listDirectory(directory);\n }\n}\n\n/** A git file list that runs `git check-ignore` and `git ls-files` in a child process. */\nexport function createGitFileList(): GitFileList {\n return new SpawnedGitFileList();\n}\n","import { appendFileSync, mkdirSync, mkdtempSync, writeFileSync } 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 */\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/**\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 writeFileSync(options.path, \"\", { flag: \"wx\", mode: LOG_FILE_MODE });\n } else {\n mkdirSync(dirname(options.path), { recursive: true });\n }\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 type { Dirent } from \"node:fs\";\nimport { chmod, lstat, readdir, readFile, realpath, rename, rm, writeFile } from \"node:fs/promises\";\nimport { basename, dirname, isAbsolute, join, relative, sep } from \"node:path\";\nimport type {\n Logger,\n ProjectFileList,\n ProjectFiles,\n SkippedFile,\n} from \"../../application/ports.js\";\nimport type { GitFileList } from \"../git-file-list/git-file-list.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 PARENT_DIRECTORY = \"..\";\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\n/** What a path that git lists is on disk. */\ntype 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 */\nfunction 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. */\nfunction 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 file or\n * directory whose real path is outside the root (by `..`, or by a linked parent folder) is\n * \"outside\".\n */\nasync 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 if (!stats.isFile() && !stats.isDirectory()) {\n return \"other\";\n }\n if (!isInFolder(realRoot, await realpath(join(root, path)))) {\n return \"outside\";\n }\n return stats.isFile() ? \"file\" : \"directory\";\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return \"other\";\n }\n throw error;\n }\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<string> {\n return readFile(await this.#pathInRoot(path), \"utf8\");\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 write(path: string, text: string): Promise<void> {\n const target = await this.#pathInRoot(path);\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; refuses one that resolves outside the root. */\n async #pathInRoot(path: string): Promise<string> {\n const realPath = isRelativeDownward(path) ? await realpath(join(this.#root, path)) : undefined;\n if (realPath === undefined || !isInFolder(await realpath(this.#root), realPath)) {\n throw new Error(`${path} is outside the project folder ${this.#root}`);\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","/**\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\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: \"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/** 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/** 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 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/**\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. Component markup is not a script and is 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 return componentRegions(text, extensionOf(path) === ASTRO_EXTENSION);\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 { plainScriptKind } from \"./script-regions.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\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 // 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 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","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): 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/** 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 if (ts.isStringLiteralLike(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: node.text,\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","/**\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\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","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 * 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","/**\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 {\n DEPENDENCY_FIELDS,\n OLD_PEER_DEPENDENTS,\n OVERRIDE_FIELDS,\n PACKAGE_RENAMES,\n} from \"./package-names.js\";\nimport { hideUrlCredentials } from \"./url-credentials.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 = \" \";\nconst LF = \"\\n\";\nconst CRLF = \"\\r\\n\";\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * The manifest as written again: same indentation, the same line ending (CRLF when the file has\n * one), and a final newline only if it had one. `JSON.stringify` escapes line breaks in strings,\n * so every LF in its output is a line ending.\n */\nfunction formatLike(original: string, manifest: JsonObject): string {\n const indent = INDENT_RE.exec(original)?.[0] ?? DEFAULT_INDENT;\n const lineEnding = original.includes(CRLF) ? CRLF : LF;\n const finalNewline = original.endsWith(LF) ? lineEnding : \"\";\n return `${JSON.stringify(manifest, null, indent).replaceAll(LF, lineEnding)}${finalNewline}`;\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: hideUrlCredentials(decision.spec),\n });\n if (decision.kind === \"kept\" && decision.isReported) {\n findings.manualSteps.push({\n kind: \"spec-kept\",\n name: renamed,\n spec: hideUrlCredentials(spec),\n });\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\n/** A dependency that needs an original package as its peer keeps needing it after the rename. */\nfunction reportOldPeers(manifest: JsonObject, findings: Findings): void {\n for (const [dependent, { peer, range }] of OLD_PEER_DEPENDENTS) {\n const isDependency = DEPENDENCY_FIELDS.some((field) => {\n const dependencies = manifest[field];\n return isObject(dependencies) && Object.hasOwn(dependencies, dependent);\n });\n if (isDependency) {\n findings.manualSteps.push({ kind: \"old-peer-needed\", dependent, peer, range });\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 reportOldPeers(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 // V8 quotes a short text in the message, so it can hold a credential too.\n const reason = hideUrlCredentials(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 * 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.\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]);\n\ninterface RenamedValue {\n readonly to: string;\n readonly isDeep: boolean;\n}\n\n/** The new name of a whole package name, or of a name and a subpath (`openapi-fetch/x`). */\nfunction renamedValue(value: string): RenamedValue | undefined {\n const slash = value.indexOf(\"/\");\n const name = slash === -1 ? value : value.slice(0, slash);\n const renamed = PACKAGE_RENAMES.get(name);\n if (renamed === undefined) {\n return undefined;\n }\n return { to: `${renamed}${value.slice(name.length)}`, isDeep: slash !== -1 };\n}\n\n/**\n * The strings in file order, each span once. A span found twice (two scripts of a component that\n * overlap) is one string, and a module specifier if either finding says so. Spans that overlap\n * otherwise cannot 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 for (const found of [...strings].sort((left, right) => left.start - right.start)) {\n const previous = distinct.at(-1);\n if (previous === undefined || found.start >= previous.end) {\n distinct.push(found);\n } else if (found.start === previous.start && found.end === previous.end) {\n const isModuleSpecifier = previous.isModuleSpecifier || found.isModuleSpecifier;\n distinct[distinct.length - 1] = { ...previous, isModuleSpecifier };\n } else {\n throw new Error(\n `Source strings overlap at offsets ${previous.start}-${previous.end} and ` +\n `${found.start}-${found.end}; the file was not changed.`,\n );\n }\n }\n return distinct;\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.\n */\nexport function migrateModuleSpecifiers(\n text: string,\n strings: readonly SourceString[],\n): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n let migrated = \"\";\n let copiedUpTo = 0;\n for (const found of distinctStrings(strings)) {\n const renamed = renamedValue(found.value);\n if (renamed === undefined) {\n continue;\n }\n const line = lineAt(text, found.start);\n if (!found.isModuleSpecifier) {\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 migrated += `${text.slice(copiedUpTo, found.start)}${renamed.to}`;\n copiedUpTo = found.end;\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 { hideUrlCredentials } from \"./url-credentials.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/*\n * The patterns below run on every line of a file from the project, so each must stay linear in\n * the line length. A trailing `(.*)$` (the rest of an entry) and a key that could start inside the\n * indent before it made them quadratic: seconds on a crafted line of 160 kB.\n */\n/**\n * ` openapi-fetch: ^0.13.1`, ` \"openapi-fetch\": \"0.13\"`; groups: indent, quote, name, spec. The\n * rest of the line (a comment) is what follows the match.\n */\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. The key starts after the indent. */\nconst KEY_RE = /^\\s+([\"']?)(\\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 [whole, indent, keyQuote, name, specQuote, spec] = entry as unknown as string[];\n const rest = line.slice((whole as string).length);\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: hideUrlCredentials(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\nconst LINE_FEED = \"\\n\";\nconst CARRIAGE_RETURN = \"\\r\";\n\n/**\n * A line without its carriage return, and a function that puts it back. Lines are split at LF,\n * so a CRLF line keeps its CR; the patterns see the line without it, and each line keeps its own\n * ending when the file is written again.\n */\nfunction withoutCarriageReturn(line: string): { body: string; restore: (body: string) => string } {\n if (!line.endsWith(CARRIAGE_RETURN)) {\n return { body: line, restore: (body) => body };\n }\n return {\n body: line.slice(0, -CARRIAGE_RETURN.length),\n restore: (body) => `${body}${CARRIAGE_RETURN}`,\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(LINE_FEED).map((rawLine) => {\n const { body: line, restore } = withoutCarriageReturn(rawLine);\n const topLevelKey = TOP_LEVEL_KEY_RE.exec(line)?.[1];\n if (topLevelKey !== undefined) {\n section = topLevelKey;\n return rawLine;\n }\n if (section !== undefined && REPORTED_SECTIONS.has(section)) {\n manualSteps.push(...reportEntry(line, section));\n return rawLine;\n }\n if (section === undefined || !CATALOG_SECTIONS.has(section)) {\n return rawLine;\n }\n const result = migrateEntry(line, version);\n changes.push(...(result.change ? [result.change] : []));\n manualSteps.push(...(result.manualStep ? [result.manualStep] : []));\n return restore(result.line);\n });\n return changes.length === 0\n ? { ...unchanged(text), manualSteps }\n : { text: lines.join(LINE_FEED), 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, SourceStringScanner } 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 readonly scanner: SourceStringScanner;\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, context.scanner.scan(text, path)), (renamed) =>\n context.rewriter.rewrite(renamed, path),\n ),\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 {\n CallbackRewriter,\n Logger,\n ProjectFiles,\n SkippedFile,\n SourceStringScanner,\n} from \"./ports.js\";\n\nexport interface MigrateProjectDependencies {\n readonly files: ProjectFiles;\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\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: the files with changes or manual steps, and the skipped paths. */\nexport interface ProjectMigration {\n readonly files: readonly FileReport[];\n readonly skipped: readonly SkippedFile[];\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 { rewriter, scanner } = dependencies;\n const context: MigrationContext = { version: input.version, rewriter, scanner };\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`. Gives the files with changes or manual steps, in path order, and\n * the listed paths that were skipped.\n */\nexport async function migrateProject(\n dependencies: MigrateProjectDependencies,\n input: MigrateProjectInput,\n): Promise<ProjectMigration> {\n const { files, skipped } = await dependencies.files.listFiles();\n const paths = [...files].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\", {\n changedFiles: reports.length,\n skippedFiles: skipped.length,\n });\n return { files: reports, skipped };\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\";\nimport { PACKAGE_RENAMES } from \"../domain/package-names.js\";\nimport type { SkipReason } from \"./ports.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\";\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\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 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}`;\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\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 \"string-names-package\":\n return `line ${step.line}: \"${step.value}\" ${STRING_NOTE}; ${STRING_FIX_NOTE} \"${step.to}\"`;\n case \"old-peer-needed\":\n return oldPeerMessage(step);\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 SKIPPED_HEADING = \"Skipped (not read, not written):\";\n\nconst SKIP_REASONS: Readonly<Record<SkipReason, string>> = {\n \"outside-root\":\n \"git listed it, but it is outside the project folder; check where this git index came from\",\n};\n\nexport function skipReasonMessage(reason: SkipReason): string {\n return SKIP_REASONS[reason];\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 SKIPPED_HEADING,\n skipReasonMessage,\n WRITTEN_NOTE,\n} from \"./messages.js\";\nimport type { FileReport, ProjectMigration } from \"./migrate-project.js\";\nimport type { SkippedFile } from \"./ports.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 SkippedFile[]): string[] {\n if (skipped.length === 0) {\n return [];\n }\n const lines = skipped.map((file) => ` ${file.path}: ${skipReasonMessage(file.reason)}`);\n return [SKIPPED_HEADING, ...lines, \"\"];\n}\n\n/**\n * The summary the command prints: changes per file, manual steps, skipped paths, and what to do\n * next.\n */\nexport function renderReport(migration: ProjectMigration, isWrite: boolean): string {\n const reports = migration.files;\n const skipped = skippedSection(migration.skipped);\n if (reports.length === 0) {\n return `${[...skipped, NOTHING_FOUND].join(\"\\n\")}\\n`;\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 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), 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\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 Logger,\n ProjectFiles,\n SourceStringScanner,\n} from \"../application/ports.js\";\nimport { renderReport } from \"../application/report.js\";\nimport { type CliRequest, parseCliArguments } from \"./cli-arguments.js\";\nimport { HELP_TEXT, logError, 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, 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 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\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 const files = dependencies.createFiles(root, logger);\n const { rewriter, scanner } = dependencies;\n const input = { version: dependencies.version, isWrite: request.isWrite };\n const migration = await migrateProject({ files, rewriter, scanner, logger }, input);\n dependencies.writeStdout(renderReport(migration, request.isWrite));\n return EXIT_CODES.success;\n } catch (error) {\n const message = errorMessage(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 { resolve } from \"node:path\";\nimport { createGitFileList } from \"../adapters/git-file-list/git-file-list.js\";\nimport {\n createJsonLinesLogger,\n createTemporaryLogPath,\n} 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 { createTypescriptStringScanner } from \"../adapters/typescript-parser/source-strings.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\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: (root, logger) => createNodeProjectFiles(root, { git: createGitFileList(), logger }),\n createLogger,\n rewriter: createTypescriptCallbackRewriter(),\n scanner: createTypescriptStringScanner(),\n resolvePath: resolve,\n};\n\nrunCli(process.argv.slice(2), dependencies).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"names":["listedPaths","relative","baseName","files","extensionOf"],"mappings":";;;;;;;;AAoBA,MAAM,kBAAA,GAAqB;AAAA,EACzB,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,oBAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA;AAKA,MAAM,sBAAA,GAAyB,CAAC,cAAA,EAAg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