openapi-typesafe-migrate 1.0.0-rc.3 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +88 -21
- package/dist/cli/main.mjs +2917 -486
- package/dist/cli/main.mjs.map +1 -1
- package/package.json +5 -3
package/dist/cli/main.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAAgB,SAAA,EAAW,GAAG,CAAA;AAC9D,MAAM,iBAAA,GAAoB,CAAA;AAC1B,MAAM,qBAAA,GAAwB,CAAA;AAC9B,MAAM,cAAA,GAAiB,iDAAA;AACvB,MAAM,WAAA,GAAc,KAAA;AAUpB,MAAM,eAAA,GAAkB;AAAA,EACtB,IAAA;AAAA,EACA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"file":"main.mjs","sources":["../../src/adapters/git-file-list/git-locations.ts","../../src/adapters/git-file-list/git-process.ts","../../src/adapters/git-file-list/git-file-list.ts","../../src/adapters/json-lines-logger/json-lines-logger.ts","../../src/adapters/json-text/json-text.ts","../../src/adapters/node-project-files/paths-in-root.ts","../../src/adapters/node-project-files/node-project-files.ts","../../src/domain/migration-findings.ts","../../src/domain/text-edits.ts","../../src/adapters/typescript-parser/file-bindings.ts","../../src/adapters/typescript-parser/generator-calls.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/unused-declarations.ts","../../src/adapters/typescript-parser/rewriter.ts","../../src/adapters/typescript-parser/source-strings.ts","../../src/adapters/yaml-text/yaml-text.ts","../../src/domain/catalog-plan.ts","../../src/domain/package-names.ts","../../src/domain/config-documents.ts","../../src/domain/override-targets.ts","../../src/domain/tree-entries.ts","../../src/domain/catalogs.ts","../../src/domain/declared-packages.ts","../../src/domain/assert-never.ts","../../src/domain/version-spec.ts","../../src/domain/npm-alias.ts","../../src/domain/url-credentials.ts","../../src/domain/dependency-map.ts","../../src/domain/import-map-migration.ts","../../src/domain/command-launchers.ts","../../src/domain/command-roles.ts","../../src/domain/shell-words.ts","../../src/domain/command-migration.ts","../../src/domain/command-strings.ts","../../src/domain/variable-programs.ts","../../src/domain/shell-variables.ts","../../src/domain/dockerfile-migration.ts","../../src/domain/json-command-migration.ts","../../src/domain/makefile-migration.ts","../../src/domain/manifest-migration.ts","../../src/domain/source-migration.ts","../../src/domain/workspace-catalog-migration.ts","../../src/domain/yaml-migration.ts","../../src/application/project-file-names.ts","../../src/application/file-migrations.ts","../../src/application/plan-sources.ts","../../src/application/migrate-project.ts","../../src/application/manual-step-messages.ts","../../src/application/messages.ts","../../src/application/report.ts","../../src/cli/cli-arguments.ts","../../src/cli/cli-text.ts","../../src/cli/run-cli.ts","../../src/cli/main.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { access, lstat, realpath, stat } from \"node:fs/promises\";\nimport { posix, win32 } from \"node:path\";\nimport type { GitEnvironment } from \"./git-process.js\";\n\n/** What the git adapter reads from the file system to find git and the repository of a folder. */\nexport interface GitFileSystem {\n /** Whether `path` is a file that this process may execute. */\n isExecutableFile(path: string): Promise<boolean>;\n /** Whether anything (a file, a folder, a link) is at `path`. */\n hasEntry(path: string): Promise<boolean>;\n /** The path with every link resolved, or undefined when nothing usable is at `path`. */\n realPath(path: string): Promise<string | undefined>;\n}\n\n/** Where git is looked for: the process environment, its platform and its file system. */\nexport interface GitHost {\n readonly environment: GitEnvironment;\n readonly platform: NodeJS.Platform;\n readonly fileSystem: GitFileSystem;\n /** The folder the tool migrates. It is not trusted, so no git in it or under it runs. */\n readonly projectRoot: string;\n}\n\nconst WINDOWS = \"win32\";\nconst PATH_VARIABLE = \"PATH\";\nconst GIT_NAME = \"git\";\n/**\n * Git for Windows puts `git.exe` on PATH. A `.cmd` or `.bat` file runs only through a shell, and\n * the tool never starts one, so executables are the only candidates.\n */\nconst WINDOWS_EXECUTABLE_EXTENSION = \".exe\";\nconst GIT_FOLDER = \".git\";\nconst PARENT_FOLDER = \"..\";\n/**\n * The folder where package managers install packages and link their bins. npx puts the\n * `node_modules/.bin` of the project and of every folder above it on PATH, so a workspace root\n * above the migrated package, or any package of it, could plant a `git` there.\n */\nconst PACKAGES_FOLDER = \"node_modules\";\n/**\n * Errors that mean \"nothing usable is there\": a missing path, a parent that is not a folder, or\n * no permission. Any other error is a fault of the file system and is passed on.\n */\nconst ABSENT_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\", \"EACCES\", \"EPERM\"]);\n\nfunction isAbsent(error: unknown): boolean {\n return ABSENT_CODES.has((error as NodeJS.ErrnoException | undefined)?.code ?? \"\");\n}\n\n/** What `check` gives, or `absent` when it fails because nothing usable is at the path. */\nasync function unlessAbsent<T>(check: () => Promise<T>, absent: T): Promise<T> {\n try {\n return await check();\n } catch (error) {\n if (isAbsent(error)) {\n return absent;\n }\n throw error;\n }\n}\n\nconst pathsOf = (platform: NodeJS.Platform) => (platform === WINDOWS ? win32 : posix);\n\n/** The PATH variable; Windows spells its name in any case (`Path`). */\nfunction pathVariable({ environment, platform }: GitHost): string {\n const name =\n platform === WINDOWS\n ? Object.keys(environment).find((key) => key.toUpperCase() === PATH_VARIABLE)\n : PATH_VARIABLE;\n return name === undefined ? \"\" : (environment[name] ?? \"\");\n}\n\n/** Whether the real path `target` is the real folder `folder` or lies under it. */\nfunction isAtOrUnder(paths: typeof posix, folder: string, target: string): boolean {\n const path = paths.relative(folder, target);\n return (\n !(path === PARENT_FOLDER || path.startsWith(`${PARENT_FOLDER}${paths.sep}`)) &&\n !paths.isAbsolute(path)\n );\n}\n\n/**\n * Whether `path` has a `node_modules` segment, in any case. The file systems of macOS and Windows\n * ignore case, so a `NODE_MODULES` folder is the `node_modules` that npx puts on PATH, and a real\n * path keeps the case the folder was created with. Where case matters, this passes over more.\n */\nfunction isInPackagesFolder(host: GitHost, path: string): boolean {\n const separator = host.platform === WINDOWS ? /[\\\\/]/ : posix.sep;\n return path.split(separator).some((segment) => segment.toLowerCase() === PACKAGES_FOLDER);\n}\n\n/**\n * Whether a PATH entry is a folder git may run from. An empty or relative entry names a folder\n * relative to the working directory, a folder in the project is the project's, and a folder in a\n * `node_modules` holds the bins of packages, which npx puts on PATH for the project and every\n * folder above it; each can hold a planted git, so each is passed over. The entry is checked as\n * written and as its real path: a `node_modules` can be a link to a folder with another name.\n */\nasync function isTrustedFolder(host: GitHost, project: string, folder: string): Promise<boolean> {\n const paths = pathsOf(host.platform);\n if (!paths.isAbsolute(folder) || isInPackagesFolder(host, folder)) {\n return false;\n }\n const real = await host.fileSystem.realPath(folder);\n return (\n real !== undefined && !isAtOrUnder(paths, project, real) && !isInPackagesFolder(host, real)\n );\n}\n\n/**\n * The absolute path of the first git on PATH outside the project and outside every `node_modules`,\n * or undefined when there is none. The absolute path also keeps Windows from looking in the\n * working directory first, as it does for a bare program name: a `git.exe` planted at the project\n * root never runs.\n */\nexport async function findGitExecutable(host: GitHost): Promise<string | undefined> {\n const paths = pathsOf(host.platform);\n const name = host.platform === WINDOWS ? `${GIT_NAME}${WINDOWS_EXECUTABLE_EXTENSION}` : GIT_NAME;\n const root = paths.resolve(host.projectRoot);\n const project = (await host.fileSystem.realPath(root)) ?? root;\n for (const folder of pathVariable(host).split(paths.delimiter)) {\n const candidate = paths.join(folder, name);\n const isTrusted = await isTrustedFolder(host, project, folder);\n if (isTrusted && (await host.fileSystem.isExecutableFile(candidate))) {\n return candidate;\n }\n }\n return undefined;\n}\n\n/**\n * Whether git takes `folder` as the root of a repository when it looks no higher than `ceiling`\n * (the parent of `folder`, or `folder` itself at the root of the file system).\n */\nexport type RepositoryCheck = (folder: string, ceiling: string) => Promise<boolean>;\n\n/**\n * The nearest folder at or above `directory` whose `.git` entry (a folder, or the file of a\n * submodule or a linked work tree) git takes as a repository, or undefined. Git takes that folder\n * as the work tree unless `core.worktree` names another one; a planted `core.worktree` made git\n * list another folder, and the project looked empty, so the tool gives git this folder as the\n * work tree. Git passes over a `.git` that is no repository (an empty folder) and finds the one\n * above it, so `isRepository` asks git about each folder that has a `.git` entry.\n */\nexport async function findWorkTree(\n directory: string,\n { platform, fileSystem }: GitHost,\n isRepository: RepositoryCheck,\n): Promise<string | undefined> {\n const paths = pathsOf(platform);\n let folder = paths.resolve(directory);\n for (;;) {\n const parent = paths.dirname(folder);\n const hasGit = await fileSystem.hasEntry(paths.join(folder, GIT_FOLDER));\n if (hasGit && (await isRepository(folder, parent))) {\n return folder;\n }\n if (parent === folder) {\n return undefined;\n }\n folder = parent;\n }\n}\n\n/** The git file system on `node:fs`. */\nexport function createNodeGitFileSystem(): GitFileSystem {\n return {\n isExecutableFile: (path) =>\n unlessAbsent(async () => {\n const isFile = (await stat(path)).isFile();\n await access(path, constants.X_OK);\n return isFile;\n }, false),\n hasEntry: (path) =>\n unlessAbsent(async () => {\n await lstat(path);\n return true;\n }, false),\n realPath: (path) => unlessAbsent<string | undefined>(() => realpath(path), undefined),\n };\n}\n","import { spawn } from \"node:child_process\";\n\n/** The environment variables git inherits, as `process.env` holds them. */\nexport type GitEnvironment = Readonly<Record<string, string | undefined>>;\n\n/** One git command: the git program by its absolute path, where it runs, and with what. */\nexport interface GitInvocation {\n readonly executable: string;\n readonly directory: string;\n readonly gitArguments: readonly string[];\n readonly environment: GitEnvironment;\n}\n\n/** How a git command ended: its exit code and output, or why it did not start. */\nexport type GitRun =\n | {\n readonly kind: \"exited\";\n readonly exitCode: number | null;\n readonly output: string;\n readonly errors: string;\n }\n | { readonly kind: \"failed\"; readonly reason: string };\n\n/** Runs one git command exactly as given; the hardening is part of the invocation. */\nexport type GitProcess = (invocation: GitInvocation) => Promise<GitRun>;\n\n/** A git process in a child process, with the invocation's environment and nothing else. */\nexport const spawnGitProcess: GitProcess = ({ executable, directory, gitArguments, environment }) =>\n new Promise((resolve) => {\n // spawn, not execFile: the output of a large repository has no buffer limit this way.\n const child = spawn(executable, [...gitArguments], { cwd: directory, env: environment });\n const output: Buffer[] = [];\n const errors: Buffer[] = [];\n child.stdout.on(\"data\", (chunk: Buffer) => output.push(chunk));\n child.stderr.on(\"data\", (chunk: Buffer) => errors.push(chunk));\n // Git is gone since it was found, or the directory does not exist.\n child.on(\"error\", (error) => resolve({ kind: \"failed\", reason: error.message }));\n child.on(\"close\", (exitCode) => {\n resolve({\n kind: \"exited\",\n exitCode,\n output: Buffer.concat(output).toString(\"utf8\"),\n errors: Buffer.concat(errors).toString(\"utf8\").trim(),\n });\n });\n });\n\n/**\n * Settings that win over every config file, because the tool runs git in folders it did not\n * create: a nested repository unpacked from an archive, or a bare repository committed inside a\n * cloned one. Their config is not trusted.\n *\n * - `core.fsmonitor=false`: the fsmonitor hook is a command from config that `ls-files` and\n * `check-ignore` run on every call.\n * - `protocol.allow=never`: refuses every transport that no `protocol.<name>.allow` key allows.\n * A repository's own config can still allow one by name, so the environment below refuses\n * them all for real.\n * - `safe.bareRepository=explicit`: a bare repository found by walking up from the folder is\n * refused, so its config is not read at all; the folder is then walked as a tree.\n *\n * These two commands write no index, so no hook runs, and they start no filter or pager.\n */\nconst HARDENED_CONFIG = [\n \"-c\",\n \"core.fsmonitor=false\",\n \"-c\",\n \"protocol.allow=never\",\n \"-c\",\n \"safe.bareRepository=explicit\",\n] as const;\n\n/**\n * A partial clone fetches a missing object from its promisor remote while it reads the index (a\n * sparse directory entry, for example), and a fetch runs commands from config (`core.sshCommand`,\n * `remote.<name>.uploadpack`, `ext::` URLs, credential helpers).\n *\n * - `GIT_ALLOW_PROTOCOL` set to an empty list: git then allows only the transports in the list,\n * whatever any `protocol.*` key says (git 2.12 and newer), so no fetch starts. It is the\n * guarantee on every git the tool supports; git reports the missing object on stderr and\n * lists the files it can read.\n * - `GIT_NO_LAZY_FETCH=1`: git 2.45 and newer do not even try a fetch. Older git ignores it.\n * - `GIT_TERMINAL_PROMPT=0`: git never waits on a password prompt.\n */\nconst HARDENED_ENVIRONMENT = {\n GIT_ALLOW_PROTOCOL: \"\",\n GIT_NO_LAZY_FETCH: \"1\",\n GIT_TERMINAL_PROMPT: \"0\",\n} as const;\n\n/**\n * Variables that name a repository or a part of it. A git hook sets `GIT_DIR` and\n * `GIT_INDEX_FILE` for the commands it runs, so a run from a hook would list that repository\n * for every folder. The tool lists each folder by the repository the folder is in.\n */\nconst REPOSITORY_VARIABLES: readonly string[] = [\n \"GIT_DIR\",\n \"GIT_WORK_TREE\",\n \"GIT_COMMON_DIR\",\n \"GIT_INDEX_FILE\",\n \"GIT_OBJECT_DIRECTORY\",\n \"GIT_ALTERNATE_OBJECT_DIRECTORIES\",\n];\n/** Makes git use this folder as the work tree, whatever `core.worktree` says. */\nconst WORK_TREE_VARIABLE = \"GIT_WORK_TREE\";\n/** Keeps git from looking for a repository above this folder. */\nconst CEILING_VARIABLE = \"GIT_CEILING_DIRECTORIES\";\n\n/** The environment of a hardened git command, from the environment the process has. */\nfunction hardenedEnvironment(command: HardenedGitCommand): GitEnvironment {\n const kept = Object.entries(command.environment).filter(\n ([name]) => !REPOSITORY_VARIABLES.includes(name.toUpperCase()),\n );\n const { workTree, ceiling } = command;\n const forced = {\n ...(workTree === undefined ? {} : { [WORK_TREE_VARIABLE]: workTree }),\n ...(ceiling === undefined ? {} : { [CEILING_VARIABLE]: ceiling }),\n };\n return { ...Object.fromEntries(kept), ...forced, ...HARDENED_ENVIRONMENT };\n}\n\n/** What a hardened git command needs besides its arguments. */\nexport interface HardenedGitCommand {\n readonly executable: string;\n readonly directory: string;\n readonly environment: GitEnvironment;\n /** The folder that holds the `.git` of the repository, or undefined when there is none. */\n readonly workTree: string | undefined;\n /** The folder above which git looks for no repository; git's own rule when undefined. */\n readonly ceiling?: string;\n}\n\n/** The invocation of `gitArguments` with the hardening above. */\nexport function hardenedInvocation(\n command: HardenedGitCommand,\n gitArguments: readonly string[],\n): GitInvocation {\n return {\n executable: command.executable,\n directory: command.directory,\n gitArguments: [...HARDENED_CONFIG, ...gitArguments],\n environment: hardenedEnvironment(command),\n };\n}\n","import {\n findGitExecutable,\n findWorkTree,\n type GitFileSystem,\n type GitHost,\n type RepositoryCheck,\n} from \"./git-locations.js\";\nimport {\n type GitEnvironment,\n type GitProcess,\n type GitRun,\n type HardenedGitCommand,\n hardenedInvocation,\n spawnGitProcess,\n} from \"./git-process.js\";\n\nexport type { GitEnvironment } from \"./git-process.js\";\n\n/** The paths git lists for a directory, or why it could not list them. */\nexport type GitListing =\n | { readonly kind: \"listed\"; readonly paths: readonly string[] }\n | { readonly kind: \"unavailable\"; readonly reason: string };\n\n/**\n * Lists a directory the way git sees it: tracked files, and untracked files that are not ignored.\n * A submodule or a nested repository is one path: the directory, without a trailing slash.\n */\nexport interface GitFileList {\n list(directory: string): Promise<GitListing>;\n}\n\n/**\n * Tracked files, and untracked files that `.gitignore`, `.git/info/exclude` and the global\n * excludes file do not ignore, under the working directory, relative to it, NUL-separated. A file\n * in a merge conflict is in the index once per side; `--deduplicate` (git 2.31) lists it once.\n */\nconst LS_FILES_ARGUMENTS = [\n \"ls-files\",\n \"--cached\",\n \"--others\",\n \"--exclude-standard\",\n \"--deduplicate\",\n \"-z\",\n] as const;\n/**\n * Exit code 0 when the working directory is ignored by the repository it is in, 1 when not. Git\n * lists nothing in an ignored directory, so its listing would look like an empty project.\n */\nconst CHECK_IGNORE_ARGUMENTS = [\"check-ignore\", \"--quiet\", \".\"] as const;\n/** Exit code 0 when git finds a repository in the working directory. */\nconst REPOSITORY_CHECK_ARGUMENTS = [\"rev-parse\", \"--git-dir\"] as const;\nconst IGNORED_EXIT_CODE = 0;\nconst NOT_IGNORED_EXIT_CODE = 1;\nconst IGNORED_REASON = \"the git repository around the folder ignores it\";\nconst NO_GIT_REASON = \"no git executable in an absolute folder of PATH\";\n/** An untracked nested repository is listed with a slash, and the directory itself as `./`. */\nconst TRAILING_SLASH_RE = /\\/$/;\nconst SELF_PATHS: ReadonlySet<string> = new Set([\"\", \".\"]);\n\nfunction failureReason(run: GitRun): string {\n if (run.kind === \"failed\") {\n return run.reason;\n }\n return run.errors || `exit code ${run.exitCode}`;\n}\n\nfunction listedPaths(output: string): string[] {\n return output\n .split(\"\\0\")\n .map((path) => path.replace(TRAILING_SLASH_RE, \"\"))\n .filter((path) => !SELF_PATHS.has(path));\n}\n\nasync function listWith(command: HardenedGitCommand, run: GitProcess): Promise<GitListing> {\n const ignored = await run(hardenedInvocation(command, CHECK_IGNORE_ARGUMENTS));\n if (ignored.kind === \"exited\" && ignored.exitCode === IGNORED_EXIT_CODE) {\n return { kind: \"unavailable\", reason: IGNORED_REASON };\n }\n if (ignored.kind === \"failed\" || ignored.exitCode !== NOT_IGNORED_EXIT_CODE) {\n return { kind: \"unavailable\", reason: failureReason(ignored) };\n }\n const listed = await run(hardenedInvocation(command, LS_FILES_ARGUMENTS));\n if (listed.kind === \"failed\" || listed.exitCode !== 0) {\n return { kind: \"unavailable\", reason: failureReason(listed) };\n }\n return { kind: \"listed\", paths: listedPaths(listed.output) };\n}\n\n/** What the git file list runs git with. */\nexport interface GitFileListOptions {\n /** The process environment: `PATH`, `HOME` and git's own variables. */\n readonly environment: GitEnvironment;\n readonly platform: NodeJS.Platform;\n readonly fileSystem: GitFileSystem;\n /** The folder the tool migrates; no git in it or under it runs. */\n readonly projectRoot: string;\n /** Runs one git command; a child process unless a test wraps it. */\n readonly process?: GitProcess;\n}\n\nclass HardenedGitFileList implements GitFileList {\n readonly #host: GitHost;\n readonly #process: GitProcess;\n /** PATH is searched once, on the first listing. */\n #executable: Promise<string | undefined> | undefined;\n\n constructor(options: GitFileListOptions) {\n this.#host = options;\n this.#process = options.process ?? spawnGitProcess;\n }\n\n async list(directory: string): Promise<GitListing> {\n this.#executable ??= findGitExecutable(this.#host);\n const executable = await this.#executable;\n if (executable === undefined) {\n return { kind: \"unavailable\", reason: NO_GIT_REASON };\n }\n const { environment } = this.#host;\n const isRepository: RepositoryCheck = async (folder, ceiling) => {\n const command = { executable, directory: folder, environment, workTree: undefined, ceiling };\n const run = await this.#process(hardenedInvocation(command, REPOSITORY_CHECK_ARGUMENTS));\n return run.kind === \"exited\" && run.exitCode === 0;\n };\n const workTree = await findWorkTree(directory, this.#host, isRepository);\n return listWith({ executable, directory, environment, workTree }, this.#process);\n }\n}\n\n/**\n * A git file list that runs `git check-ignore` and `git ls-files` (git-process.ts has the\n * hardening): git by its absolute path from a PATH folder outside the project, with the folder\n * whose `.git` git takes as the repository of the listed directory as the work tree.\n */\nexport function createGitFileList(options: GitFileListOptions): GitFileList {\n return new HardenedGitFileList(options);\n}\n","import { appendFileSync, closeSync, fstatSync, mkdirSync, mkdtempSync, openSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Logger } from \"../../application/ports.js\";\n\n/** The log file, the clock of the timestamps, and whether the file must be new. */\nexport interface JsonLinesLoggerOptions {\n readonly path: string;\n readonly now: () => Date;\n /**\n * The file must not exist yet: it is created with `O_CREAT | O_EXCL`, which also refuses a\n * link at the path instead of following it. Used for the default log in the temporary folder.\n * Without it, an existing file (the user's `--log`) gets the new lines appended.\n * Either way the file is opened when the logger is created, so a path that cannot be a log\n * file (a folder, a read-only place) fails before the migration starts.\n */\n readonly isExclusive: boolean;\n}\n\ntype Level = \"info\" | \"warn\";\n\n/** The log can name files and changes of a private project, so only its owner can read it. */\nconst LOG_FILE_MODE = 0o600;\nconst TEMPORARY_FOLDER_PREFIX = \"openapi-typesafe-migrate-\";\nconst LOG_EXTENSION = \".jsonl\";\nconst TIME_SEPARATOR = \":\";\n/** `:` is not allowed in Windows file names. */\nconst FILE_NAME_TIME_SEPARATOR = \"-\";\n\n/** The path names a folder, so lines cannot be appended to it. */\nexport class LogPathIsFolderError extends Error {\n override readonly name = \"LogPathIsFolderError\";\n\n constructor(path: string) {\n super(`${path} is a folder; --log takes a file path`);\n }\n}\n\nconst EXCLUSIVE_CREATE_FLAG = \"wx\";\nconst APPEND_FLAG = \"a\";\nconst IS_A_DIRECTORY_CODE = \"EISDIR\";\n\n/**\n * Create or open the log file once, to fail early. POSIX refuses to open a folder for writing\n * (EISDIR), but Windows opens it and accepts empty writes, so the opened file is also checked.\n */\nfunction openLogFile(path: string, isExclusive: boolean): void {\n let descriptor: number;\n try {\n descriptor = openSync(path, isExclusive ? EXCLUSIVE_CREATE_FLAG : APPEND_FLAG, LOG_FILE_MODE);\n } catch (error) {\n throw isDirectoryError(error) ? new LogPathIsFolderError(path) : error;\n }\n try {\n if (fstatSync(descriptor).isDirectory()) {\n throw new LogPathIsFolderError(path);\n }\n } finally {\n closeSync(descriptor);\n }\n}\n\nconst isDirectoryError = (error: unknown): boolean =>\n error instanceof Error && \"code\" in error && error.code === IS_A_DIRECTORY_CODE;\n\n/**\n * The Logger port as a JSON Lines file: one object per event with a UTC timestamp, the level and\n * the event's fields. Lines are appended synchronously, so the log is complete when the command\n * fails half way.\n */\nclass JsonLinesLogger implements Logger {\n readonly #options: JsonLinesLoggerOptions;\n\n constructor(options: JsonLinesLoggerOptions) {\n this.#options = options;\n if (!options.isExclusive) {\n mkdirSync(dirname(options.path), { recursive: true });\n }\n openLogFile(options.path, options.isExclusive);\n }\n\n info(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"info\", event, fields);\n }\n\n warn(event: string, fields: Readonly<Record<string, unknown>> = {}): void {\n this.#append(\"warn\", event, fields);\n }\n\n #append(level: Level, event: string, fields: Readonly<Record<string, unknown>>): void {\n const time = this.#options.now().toISOString();\n const line = `${JSON.stringify({ time, level, event, ...fields })}\\n`;\n appendFileSync(this.#options.path, line, { mode: LOG_FILE_MODE });\n }\n}\n\n/** A logger that appends to the JSON Lines file at `options.path`, creating its directory. */\nexport function createJsonLinesLogger(options: JsonLinesLoggerOptions): Logger {\n return new JsonLinesLogger(options);\n}\n\n/**\n * The path of a run's log in a new folder under `parent` (the system temporary folder), named by\n * the run's UTC start time. `mkdtemp` gives the folder a name no other user can guess and mode\n * 0700, so on a shared host nobody else can plant a file or a link in it.\n */\nexport function createTemporaryLogPath(parent: string, startTime: Date): string {\n const folder = mkdtempSync(join(parent, TEMPORARY_FOLDER_PREFIX));\n const name = startTime.toISOString().replaceAll(TIME_SEPARATOR, FILE_NAME_TIME_SEPARATOR);\n return join(folder, `${name}${LOG_EXTENSION}`);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { JsonDocumentReader } from \"../../application/ports.js\";\nimport type { DocumentRead, TreeEntry, TreeNode } from \"../../domain/config-documents.js\";\n\n/**\n * The JsonDocumentReader port on the TypeScript 6 JSON parser (ADR-015), the one tsc reads\n * `tsconfig.json` with: it accepts comments and trailing commas, as `deno.jsonc` and Nx\n * `project.json` do, and gives every node its offsets in the text. A byte order mark is allowed\n * before the value.\n */\n\n/** The parser names the file in its diagnostics only. */\nconst FILE_NAME = \"document.json\";\n/** The length of the quote on each side of a JSON string. */\nconst QUOTE_LENGTH = 1;\n\nconst encode = (value: string): string => JSON.stringify(value);\n\nfunction spanOf(node: ts.Node, file: ts.SourceFile): { start: number; end: number } {\n return { start: node.getStart(file), end: node.end };\n}\n\nfunction convertString(node: ts.StringLiteral, file: ts.SourceFile): TreeNode {\n const span = spanOf(node, file);\n const content = { start: span.start + QUOTE_LENGTH, end: span.end - QUOTE_LENGTH };\n return { kind: \"scalar\", value: node.text, content, isFolded: false, encode, ...span };\n}\n\nfunction convertObject(node: ts.ObjectLiteralExpression, file: ts.SourceFile): TreeNode {\n // A valid document has only quoted keys (see firstError); the check narrows the node type.\n const entries = node.properties.filter(ts.isPropertyAssignment).map(\n (property): TreeEntry => ({\n key: ts.isStringLiteral(property.name)\n ? convertString(property.name, file)\n : { kind: \"other\", ...spanOf(property.name, file) },\n value: convert(property.initializer, file),\n }),\n );\n return { kind: \"map\", entries, ...spanOf(node, file) };\n}\n\nfunction convert(node: ts.Expression, file: ts.SourceFile): TreeNode {\n if (ts.isObjectLiteralExpression(node)) {\n return convertObject(node, file);\n }\n if (ts.isArrayLiteralExpression(node)) {\n const items = node.elements.map((item) => convert(item, file));\n return { kind: \"list\", items, ...spanOf(node, file) };\n }\n if (ts.isStringLiteral(node)) {\n return convertString(node, file);\n }\n return { kind: \"other\", ...spanOf(node, file) };\n}\n\n/**\n * `parseJsonText` keeps its syntax errors internal. This public reader of the same grammar\n * reports the first of them, and rejects what JSON forbids and the parser allows: unquoted or\n * single-quoted keys, and a root value that is not an object.\n */\nfunction firstError(text: string): number | undefined {\n const { error } = ts.parseConfigFileTextToJson(FILE_NAME, text);\n return error === undefined ? undefined : (error.start ?? 0);\n}\n\nfunction readTree(text: string): DocumentRead {\n const errorAt = firstError(text);\n if (errorAt !== undefined) {\n return { kind: \"unreadable\", offset: errorAt };\n }\n const file = ts.parseJsonText(FILE_NAME, text);\n const documents = file.statements.map((statement) => convert(statement.expression, file));\n return { kind: \"read\", documents };\n}\n\nfunction read(text: string): DocumentRead {\n try {\n return readTree(text);\n } catch (error) {\n // The parser and the conversion recurse per level of nesting: a crafted file (about a\n // thousand levels) exhausts the stack, and the error gives no place.\n if (error instanceof RangeError) {\n return { kind: \"unreadable\", offset: undefined };\n }\n throw error;\n }\n}\n\nexport function createJsonTextReader(): JsonDocumentReader {\n return { read };\n}\n","import { lstat, realpath } from \"node:fs/promises\";\nimport { isAbsolute, join, relative, sep } from \"node:path\";\n\nconst PARENT_DIRECTORY = \"..\";\n/**\n * Errors of a listed path that leads to no file: a tracked file deleted from the working tree\n * (ENOENT), a path through a file (ENOTDIR), and a link that is dangling or loops (ELOOP).\n */\nconst UNRESOLVED_PATH_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\", \"ELOOP\"]);\n\n/** What a path that git lists is on disk. */\nexport type ListedEntry = \"file\" | \"directory\" | \"other\" | \"outside\";\n\n/**\n * Whether `path` stays under the folder it is relative to, by its text. Git checks a path when it\n * adds it to the index, but it prints an index that it did not write (one in a planted `.git`) as\n * it is, with `../` or a leading `/`. Links are checked by the real path.\n */\nexport function isRelativeDownward(path: string): boolean {\n return !isAbsolute(path) && !path.split(\"/\").includes(PARENT_DIRECTORY);\n}\n\n/** Whether the real path `target` is in the real folder `folder`, not the folder itself. */\nexport function isInFolder(folder: string, target: string): boolean {\n const path = relative(folder, target);\n return (\n path !== \"\" &&\n path !== PARENT_DIRECTORY &&\n !path.startsWith(`${PARENT_DIRECTORY}${sep}`) &&\n !isAbsolute(path)\n );\n}\n\n/**\n * Git also lists links and tracked files deleted from the working tree; only regular files that\n * exist are the project's files. A directory is a submodule or a nested repository. A path whose\n * real path is outside the root (by `..`, a linked parent folder, or a link itself) is \"outside\",\n * so the report names it. A link inside the root is \"other\": links are not followed, and what it\n * points at is listed on its own. A path that leads to no file, a broken link included, is \"other\".\n */\nexport async function entryAt(root: string, realRoot: string, path: string): Promise<ListedEntry> {\n if (!isRelativeDownward(path)) {\n return \"outside\";\n }\n try {\n const stats = await lstat(join(root, path));\n const isListable = stats.isFile() || stats.isDirectory();\n if (!isListable && !stats.isSymbolicLink()) {\n return \"other\";\n }\n // A link to the root itself (`self -> .`) is in the project, like a link to a folder in it.\n const realPath = await realpath(join(root, path));\n if (realPath !== realRoot && !isInFolder(realRoot, realPath)) {\n return \"outside\";\n }\n if (!isListable) {\n return \"other\";\n }\n return stats.isFile() ? \"file\" : \"directory\";\n } catch (error) {\n if (UNRESOLVED_PATH_CODES.has((error as NodeJS.ErrnoException).code ?? \"\")) {\n return \"other\";\n }\n throw error;\n }\n}\n","import type { Dirent } from \"node:fs\";\nimport {\n chmod,\n lstat,\n readdir,\n readFile,\n realpath,\n rename,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { basename, dirname, join } from \"node:path\";\nimport type {\n FileProblem,\n FileRead,\n FileWrite,\n Logger,\n ProjectFileList,\n ProjectFiles,\n ProjectRootState,\n SkippedFile,\n} from \"../../application/ports.js\";\nimport type { GitFileList } from \"../git-file-list/git-file-list.js\";\nimport { entryAt, isInFolder, isRelativeDownward, type ListedEntry } from \"./paths-in-root.js\";\n\n/**\n * Installed packages, git metadata, build output and the output folders of frameworks and test\n * tools are not the project's own files: rewriting them only adds noise to the dry run and the\n * diff. They are skipped even when git tracks them.\n * `build` and `out` stay in, because some projects keep sources there. Links are not followed, so a\n * linked workspace package is migrated in its own project, not twice.\n */\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \".next\",\n \".nuxt\",\n \".output\",\n \".svelte-kit\",\n \".turbo\",\n \"coverage\",\n]);\n\nconst CURRENT_DIRECTORY = \".\";\n/** The new text is written next to the file under this suffix, then renamed over it. */\nconst TEMPORARY_SUFFIX = \".openapi-typesafe-migrate.tmp\";\nconst PERMISSION_BITS = 0o7777;\n/** Only the owner can read the new text until it has the mode of the file it replaces. */\nconst TEMPORARY_MODE = 0o600;\nconst OUTSIDE_ROOT: FileProblem = { kind: \"outside-root\" };\nconst NOT_UTF_8: FileProblem = { kind: \"not-utf-8\" };\nconst UTF_8 = \"utf-8\";\n\n/**\n * The text of a file's bytes, or \"not-utf-8\". Decoding replaces invalid bytes with U+FFFD by\n * default, and writing that text back would destroy them (a Latin-1 `é` became `�`). A fatal\n * decoder refuses them instead. The byte order mark stays in the text, so it is written back.\n */\nfunction decodeUtf8(bytes: Uint8Array): FileRead {\n try {\n const text = new TextDecoder(UTF_8, { fatal: true, ignoreBOM: true }).decode(bytes);\n return { kind: \"read\", text };\n } catch (error) {\n // The fatal decoder reports invalid bytes as a TypeError; anything else is a bug.\n if (error instanceof TypeError) {\n return { kind: \"skipped\", reason: NOT_UTF_8 };\n }\n throw error;\n }\n}\n\n/** The problem of a failed file system call; an error without an error code is passed on. */\nfunction ioProblem(error: unknown): FileProblem {\n const code = (error as NodeJS.ErrnoException | undefined)?.code;\n if (typeof code !== \"string\") {\n throw error;\n }\n return { kind: \"io-error\", code };\n}\n\n/** What the project files read besides the file system. */\nexport interface NodeProjectFilesOptions {\n readonly git: GitFileList;\n readonly logger: Logger;\n}\n\nfunction isInSkippedDirectory(path: string): boolean {\n return path\n .split(\"/\")\n .slice(0, -1)\n .some((directory) => SKIPPED_DIRECTORIES.has(directory));\n}\n\nasync function listTree(root: string, relative: string): Promise<string[]> {\n const entries: Dirent[] = await readdir(join(root, relative), { withFileTypes: true });\n const nested = await Promise.all(\n entries.map((entry) => {\n const path = relative === \"\" ? entry.name : `${relative}/${entry.name}`;\n if (entry.isDirectory()) {\n return SKIPPED_DIRECTORIES.has(entry.name) ? [] : listTree(root, path);\n }\n return entry.isFile() ? [path] : [];\n }),\n );\n return nested.flat();\n}\n\ninterface ListedPaths {\n readonly files: readonly string[];\n readonly directories: readonly string[];\n readonly skipped: readonly SkippedFile[];\n}\n\n/** The files, the nested repositories and the paths outside the root of a git listing. */\nasync function listedPaths(\n root: string,\n realRoot: string,\n paths: readonly string[],\n): Promise<ListedPaths> {\n const candidates = paths.filter((path) => !isInSkippedDirectory(path));\n const entries = await Promise.all(candidates.map((path) => entryAt(root, realRoot, path)));\n const withEntry = (entry: ListedEntry) =>\n candidates.filter((_path, index) => entries[index] === entry);\n return {\n files: withEntry(\"file\"),\n directories: withEntry(\"directory\").filter((path) => !SKIPPED_DIRECTORIES.has(baseName(path))),\n skipped: withEntry(\"outside\").map((path): SkippedFile => ({ path, reason: OUTSIDE_ROOT })),\n };\n}\n\nfunction baseName(path: string): string {\n return path.slice(path.lastIndexOf(\"/\") + 1);\n}\n\nfunction joinRelative(directory: string, path: string): string {\n return directory === \"\" ? path : `${directory}/${path}`;\n}\n\nconst NO_FILES: ProjectFileList = { files: [], skipped: [] };\n\nfunction joinLists(lists: readonly ProjectFileList[]): ProjectFileList {\n return lists.reduce(\n (joined, list) => ({\n files: [...joined.files, ...list.files],\n skipped: [...joined.skipped, ...list.skipped],\n }),\n NO_FILES,\n );\n}\n\nclass NodeProjectFiles implements ProjectFiles {\n readonly #root: string;\n readonly #options: NodeProjectFilesOptions;\n\n constructor(root: string, options: NodeProjectFilesOptions) {\n this.#root = root;\n this.#options = options;\n }\n\n /** Git's view of the project when it is in a git repository, so ignored files stay out. */\n async listFiles(): Promise<ProjectFileList> {\n return this.#listDirectory(await realpath(this.#root), \"\");\n }\n\n /**\n * One directory, by the git repository it is in. Git lists a submodule or a nested repository\n * as one entry, so each of those is listed the same way, by its own repository and ignore rules.\n */\n async #listDirectory(realRoot: string, directory: string): Promise<ProjectFileList> {\n const { git, logger } = this.#options;\n const listing = await git.list(join(this.#root, directory));\n const logged = { directory: directory === \"\" ? CURRENT_DIRECTORY : directory };\n if (listing.kind === \"unavailable\") {\n // Not a git repository, no git, or ignored by the repository around it: walk the tree; only\n // the skipped folders stay out.\n const files = await listTree(this.#root, directory);\n logger.info(\"files_listed\", {\n ...logged,\n source: \"tree\",\n fileCount: files.length,\n reason: listing.reason,\n });\n return { files, skipped: [] };\n }\n const paths = listing.paths.map((path) => joinRelative(directory, path));\n const { files, directories, skipped } = await listedPaths(this.#root, realRoot, paths);\n logger.info(\"files_listed\", { ...logged, source: \"git\", fileCount: files.length });\n for (const file of skipped) {\n logger.warn(\"file_skipped\", { ...file });\n }\n const nested = await Promise.all(\n directories.map((path) => this.#listDirectory(realRoot, path)),\n );\n return joinLists([{ files, skipped }, ...nested]);\n }\n\n async read(path: string): Promise<FileRead> {\n try {\n const target = await this.#pathInRoot(path);\n return target === undefined\n ? { kind: \"skipped\", reason: OUTSIDE_ROOT }\n : decodeUtf8(await readFile(target));\n } catch (error) {\n return { kind: \"skipped\", reason: ioProblem(error) };\n }\n }\n\n async write(path: string, text: string): Promise<FileWrite> {\n try {\n const target = await this.#pathInRoot(path);\n if (target === undefined) {\n return { kind: \"failed\", reason: OUTSIDE_ROOT };\n }\n await this.#replace(target, text, path);\n return { kind: \"written\" };\n } catch (error) {\n return { kind: \"failed\", reason: ioProblem(error) };\n }\n }\n\n /**\n * Writes a new file and renames it over the old one, so the write never goes through a link: a\n * hard link to a file outside the root keeps its old text, and is reported in the log. The new\n * file keeps the mode of the old one.\n */\n async #replace(target: string, text: string, path: string): Promise<void> {\n const { mode, nlink } = await lstat(target);\n // `wx`: a leftover of a failed run is not overwritten; the error names it.\n const temporary = join(dirname(target), `.${basename(target)}${TEMPORARY_SUFFIX}`);\n await writeFile(temporary, text, { encoding: \"utf8\", flag: \"wx\", mode: TEMPORARY_MODE });\n try {\n // The mode is set after the write, because `writeFile`'s mode is reduced by the umask.\n await chmod(temporary, mode & PERMISSION_BITS);\n await rename(temporary, target);\n } catch (error) {\n await rm(temporary, { force: true });\n throw error;\n }\n if (nlink > 1) {\n this.#options.logger.warn(\"hard_link_separated\", { path, linkCount: nlink });\n }\n }\n\n /** The real path of a project file, or undefined for one that resolves outside the root. */\n async #pathInRoot(path: string): Promise<string | undefined> {\n const realPath = isRelativeDownward(path) ? await realpath(join(this.#root, path)) : undefined;\n if (realPath === undefined || !isInFolder(await realpath(this.#root), realPath)) {\n return undefined;\n }\n return realPath;\n }\n}\n\n/** The files of the project in the directory `root`, by `/`-separated relative paths. */\nexport function createNodeProjectFiles(\n root: string,\n options: NodeProjectFilesOptions,\n): ProjectFiles {\n return new NodeProjectFiles(root, options);\n}\n\nconst MISSING_PATH_CODES: ReadonlySet<string> = new Set([\"ENOENT\", \"ENOTDIR\"]);\n\n/**\n * Whether `root` is a folder the migration can list, by its real path (a link to a folder is\n * one). Asked before anything is listed, so `--root` naming a file or nothing fails with a clear\n * message instead of git's or the file system's.\n */\nexport async function inspectProjectRoot(root: string): Promise<ProjectRootState> {\n try {\n return (await stat(root)).isDirectory() ? \"directory\" : \"not-a-directory\";\n } catch (error) {\n if (MISSING_PATH_CODES.has((error as NodeJS.ErrnoException).code ?? \"\")) {\n return \"missing\";\n }\n throw error;\n }\n}\n","/**\n * What a migration found in one file: changes it made, and steps it leaves to the user. Both are\n * closed sets of facts, not text; the report turns them into messages (application/report.ts).\n * They go to the report and the log, so a version spec in them has its URL credentials hidden\n * (domain/url-credentials.ts).\n */\n\n/** A place in a text, 1-based. */\nexport interface TextPosition {\n readonly line: number;\n readonly column: number;\n}\n\nexport type Change =\n | {\n readonly kind: \"dependency-renamed\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n readonly spec: string;\n }\n | {\n readonly kind: \"catalog-entry-renamed\";\n readonly catalog: string;\n readonly from: string;\n readonly to: string;\n readonly spec: string;\n }\n | {\n readonly kind: \"import-renamed\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n readonly target: string;\n }\n | {\n readonly kind: \"alias-renamed\";\n readonly field: string;\n readonly name: string;\n readonly spec: string;\n }\n | { readonly kind: \"command-renamed\"; readonly location: string }\n | {\n readonly kind: \"package-name-renamed\";\n readonly location: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"flag-renamed\";\n readonly location: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"specifier-renamed\";\n readonly line: number;\n readonly from: string;\n readonly to: string;\n }\n | { readonly kind: \"transform-rewritten\"; readonly line: number }\n | { readonly kind: \"declaration-removed\"; readonly line: number; readonly name: string };\n\nexport type ManualStep =\n | { readonly kind: \"entry-not-edited\"; readonly field: string; readonly name: string }\n | {\n readonly kind: \"name-collision\";\n readonly field: string;\n readonly from: string;\n readonly to: string;\n }\n | {\n readonly kind: \"catalog-reference-kept\";\n readonly field: string;\n readonly name: string;\n readonly catalog: string;\n }\n | { readonly kind: \"catalog-entry-in-use\"; readonly catalog: string; readonly name: string }\n | { readonly kind: \"peer-dependency-renamed\"; readonly name: string }\n | { readonly kind: \"spec-kept\"; readonly name: string; readonly spec: string }\n | { readonly kind: \"override-names-package\"; readonly field: string; readonly name: string }\n | { readonly kind: \"versioned-command\"; readonly location: string }\n | {\n readonly kind: \"flags-in-variable\";\n readonly location: string;\n readonly variable: string;\n /** The old flags in the variable's value. */\n readonly flags: readonly string[];\n }\n | {\n readonly kind: \"variable-not-only-generator\";\n readonly location: string;\n readonly variable: string;\n /** The old flags of the generator after the variable, or in a variable's value there. */\n readonly flags: readonly string[];\n }\n | { readonly kind: \"pinned-package\"; readonly location: string; readonly name: string }\n | { readonly kind: \"old-package-file\"; readonly location: string; readonly path: string }\n | { readonly kind: \"command-string\"; readonly line: number; readonly to: string }\n | { readonly kind: \"config-unreadable\"; readonly position: TextPosition | undefined }\n | { readonly kind: \"manifest-not-read\" }\n | { readonly kind: \"options-not-inspected\"; readonly line: number }\n | { readonly kind: \"deep-import\"; readonly line: number; readonly specifier: string }\n | {\n readonly kind: \"dynamic-specifier\";\n readonly line: number;\n readonly value: string;\n /** The new name of the package the specifier starts with. */\n readonly to: string;\n }\n | {\n readonly kind: \"string-names-package\";\n readonly line: number;\n readonly value: string;\n readonly to: string;\n }\n | {\n readonly kind: \"old-peer-needed\";\n readonly dependent: string;\n readonly peer: string;\n readonly range: string;\n }\n | {\n readonly kind: \"transform-not-rewritten\";\n readonly line: number;\n readonly reason: TransformKeepReason;\n }\n | { readonly kind: \"legacy-callback\"; readonly line: number; readonly callback: string }\n | {\n readonly kind: \"package-not-declared\";\n readonly line: number;\n readonly name: string;\n /** The original packages that installed it as their own dependency. */\n readonly installers: readonly string[];\n };\n\n/** Why a `transform` callback was left as it is. */\nexport type TransformKeepReason =\n | \"other-callbacks\"\n | \"not-a-function\"\n | \"shared-function\"\n | \"shared-options\"\n | \"unknown-return\";\n\n/** A file's new text and what was found in it. Unchanged text means nothing to write. */\nexport interface FileMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** The result for a file that the migration does not touch. */\nexport function unchanged(text: string): FileMigration {\n return { text, changes: [], manualSteps: [] };\n}\n\n/** Line number (1-based) of a character offset. */\nexport function lineAt(text: string, offset: number): number {\n let line = 1;\n for (let index = text.indexOf(\"\\n\"); index !== -1 && index < offset; ) {\n line++;\n index = text.indexOf(\"\\n\", index + 1);\n }\n return line;\n}\n\n/**\n * Line numbers (1-based) of character offsets in `text`, for a migration that names many places\n * of one text. The line starts are found once and searched by halves, so naming every command of\n * a large file stays linear in its size (`lineAt` for each one was quadratic: 57 s on 4 MB).\n */\nexport function lineLocator(text: string): (offset: number) => number {\n const lineStarts = [0];\n for (let index = text.indexOf(\"\\n\"); index !== -1; index = text.indexOf(\"\\n\", index + 1)) {\n lineStarts.push(index + 1);\n }\n return (offset) => {\n // The last line start at or before `offset`; a break at `offset` itself ends that line.\n let low = 0;\n let high = lineStarts.length - 1;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n if ((lineStarts[middle] as number) <= offset) {\n low = middle;\n } else {\n high = middle - 1;\n }\n }\n return low + 1;\n };\n}\n\n/** Column number (1-based) of a character offset. */\nexport function columnAt(text: string, offset: number): number {\n return offset - text.lastIndexOf(\"\\n\", offset - 1);\n}\n","/**\n * Edits by offset into the original text. A migration changes only the names, specs and command\n * words it renames, so everything else stays byte for byte: formatting, comments, key order,\n * number spellings, escapes and duplicate keys.\n */\nexport interface TextEdit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\n/**\n * The text with the edits applied. Edits that overlap cannot both apply: that is a bug of the\n * migration that made them, and applying them would corrupt the file.\n */\nexport function applyTextEdits(text: string, edits: readonly TextEdit[]): string {\n const sorted = [...edits].sort((left, right) => left.start - right.start);\n let edited = \"\";\n let copiedUpTo = 0;\n for (const edit of sorted) {\n if (edit.start < copiedUpTo) {\n throw new Error(\n `Edits overlap at offset ${edit.start}; the file was not changed (a migration bug).`,\n );\n }\n edited += `${text.slice(copiedUpTo, edit.start)}${edit.text}`;\n copiedUpTo = edit.end;\n }\n return edited + text.slice(copiedUpTo);\n}\n","import ts from \"@typescript/typescript6\";\n\n/**\n * The module-level names of a file that the rewriter follows: the TypeScript module and its named\n * imports, the generator and its helpers, module-level `const`s and functions. Identifiers are\n * resolved by scope with the TypeScript checker, so a local `const DATE` inside a callback is not\n * the module's `DATE`, however it is spelled.\n */\n\nexport type Binding =\n /** `ts` in `import ts from \"typescript\"` or `import * as ts from \"typescript\"`. */\n | { readonly kind: \"typescript-module\" }\n /** `factory` in `import { factory } from \"typescript\"`, by its imported name. */\n | { readonly kind: \"typescript-import\"; readonly name: string }\n /** A named import from the generator (`tsUnion`, `NULL`), by its imported name. */\n | { readonly kind: \"helper-import\"; readonly name: string }\n /** The generator function: the default import of the generator module. */\n | { readonly kind: \"generator-function\" }\n /** A namespace import of the generator module; `ns.default` is the generator function. */\n | { readonly kind: \"generator-module\" }\n /** A module-level `const` with an initializer. */\n | { readonly kind: \"constant\"; readonly initializer: ts.Expression }\n /** A module-level function declaration. */\n | { readonly kind: \"function\"; readonly declaration: ts.FunctionDeclaration };\n\nexport interface FileBindings {\n /** Every binding of the file, by its declaration node. */\n readonly declarations: ReadonlyMap<ts.Node, Binding>;\n /** The declaration node an identifier refers to, if it is a binding of this file. */\n declarationOf(identifier: ts.Identifier): ts.Node | undefined;\n bindingOf(identifier: ts.Identifier): Binding | undefined;\n /** The identifiers that refer to a declaration, without the name it declares. */\n usesOf(declaration: ts.Node): readonly ts.Identifier[];\n /** True when the file imports the generator, so it may call it. */\n readonly hasGenerator: boolean;\n}\n\n/** 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\"]);\nconst DEFAULT_EXPORT = \"default\";\n\ntype BindingMap = Map<ts.Node, Binding>;\n\nfunction addNamedImports(clause: ts.ImportClause, isGenerator: boolean, into: BindingMap): void {\n const bindings = clause.namedBindings;\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n return;\n }\n for (const element of bindings.elements) {\n const name = (element.propertyName ?? element.name).text;\n const binding: Binding = isGenerator\n ? name === DEFAULT_EXPORT\n ? { kind: \"generator-function\" }\n : { kind: \"helper-import\", name }\n : { kind: \"typescript-import\", name };\n into.set(element, binding);\n }\n}\n\nfunction addImport(statement: ts.ImportDeclaration, into: BindingMap): void {\n const clause = statement.importClause;\n const specifier = ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : \"\";\n const isGenerator = GENERATOR_MODULES.has(specifier);\n if (clause === undefined || (!isGenerator && !TYPESCRIPT_MODULES.has(specifier))) {\n return;\n }\n if (clause.name !== undefined) {\n into.set(clause, isGenerator ? { kind: \"generator-function\" } : { kind: \"typescript-module\" });\n }\n const namespace = clause.namedBindings;\n if (namespace !== undefined && ts.isNamespaceImport(namespace)) {\n const kind = isGenerator ? \"generator-module\" : \"typescript-module\";\n into.set(namespace, { kind });\n }\n addNamedImports(clause, isGenerator, into);\n}\n\nfunction addConstants(statement: ts.VariableStatement, into: BindingMap): void {\n if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0) {\n return;\n }\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer !== undefined) {\n into.set(declaration, { kind: \"constant\", initializer: declaration.initializer });\n }\n }\n}\n\nfunction collectBindings(file: ts.SourceFile): BindingMap {\n const bindings: BindingMap = new Map();\n for (const statement of file.statements) {\n if (ts.isImportDeclaration(statement)) {\n addImport(statement, bindings);\n } else if (ts.isVariableStatement(statement)) {\n addConstants(statement, bindings);\n } else if (ts.isFunctionDeclaration(statement) && statement.name !== undefined) {\n bindings.set(statement, { kind: \"function\", declaration: statement });\n }\n }\n return bindings;\n}\n\n/** A compiler host that knows only the parsed file, so the file system is never read. */\nexport function singleFileHost(file: ts.SourceFile): ts.CompilerHost {\n return {\n getSourceFile: (name) => (name === file.fileName ? file : undefined),\n getDefaultLibFileName: () => \"lib.d.ts\",\n writeFile: () => undefined,\n getCurrentDirectory: () => \"\",\n getCanonicalFileName: (name) => name,\n useCaseSensitiveFileNames: () => true,\n getNewLine: () => \"\\n\",\n fileExists: (name) => name === file.fileName,\n readFile: () => undefined,\n };\n}\n\n/**\n * A checker for this one file: no default library and no module resolution, which binding names\n * by scope does not need.\n */\nfunction createChecker(file: ts.SourceFile): ts.TypeChecker {\n const options: ts.CompilerOptions = { noLib: true, noResolve: true, allowJs: true, types: [] };\n const host = singleFileHost(file);\n return ts.createProgram({ rootNames: [file.fileName], options, host }).getTypeChecker();\n}\n\n/** The symbol of an identifier; `{ DATE }` refers to the variable, not to the new property. */\nfunction symbolOf(checker: ts.TypeChecker, identifier: ts.Identifier): ts.Symbol | undefined {\n const parent = identifier.parent;\n return ts.isShorthandPropertyAssignment(parent) && parent.name === identifier\n ? checker.getShorthandAssignmentValueSymbol(parent)\n : checker.getSymbolAtLocation(identifier);\n}\n\n/** True for the name that a declaration of this file declares, and for names in imports. */\nfunction isDeclaredName(identifier: ts.Identifier, declaration: ts.Node): boolean {\n const declaredName = (declaration as ts.NamedDeclaration).name;\n return (\n declaredName === identifier || ts.findAncestor(identifier, ts.isImportDeclaration) !== undefined\n );\n}\n\nfunction indexUses(file: ts.SourceFile, bindings: FileBindings): Map<ts.Node, ts.Identifier[]> {\n const uses = new Map<ts.Node, ts.Identifier[]>();\n const visit = (node: ts.Node): void => {\n const declaration = ts.isIdentifier(node) ? bindings.declarationOf(node) : undefined;\n if (declaration !== undefined && !isDeclaredName(node as ts.Identifier, declaration)) {\n uses.set(declaration, [...(uses.get(declaration) ?? []), node as ts.Identifier]);\n }\n ts.forEachChild(node, visit);\n };\n visit(file);\n return uses;\n}\n\nclass CheckedFileBindings implements FileBindings {\n readonly hasGenerator: boolean;\n readonly #file: ts.SourceFile;\n readonly #bindings: BindingMap;\n readonly declarations: ReadonlyMap<ts.Node, Binding>;\n #checker: ts.TypeChecker | undefined;\n #uses: Map<ts.Node, ts.Identifier[]> | undefined;\n\n constructor(file: ts.SourceFile) {\n this.#file = file;\n this.#bindings = collectBindings(file);\n this.declarations = this.#bindings;\n this.hasGenerator = [...this.#bindings.values()].some(\n (binding) => binding.kind === \"generator-function\" || binding.kind === \"generator-module\",\n );\n }\n\n declarationOf(identifier: ts.Identifier): ts.Node | undefined {\n // The checker is built on first use: most files never call the generator.\n this.#checker ??= createChecker(this.#file);\n const declaration = symbolOf(this.#checker, identifier)?.declarations?.[0];\n return declaration !== undefined && this.#bindings.has(declaration) ? declaration : undefined;\n }\n\n bindingOf(identifier: ts.Identifier): Binding | undefined {\n const declaration = this.declarationOf(identifier);\n return declaration === undefined ? undefined : this.#bindings.get(declaration);\n }\n\n usesOf(declaration: ts.Node): readonly ts.Identifier[] {\n this.#uses ??= indexUses(this.#file, this);\n return this.#uses.get(declaration) ?? [];\n }\n}\n\n/** The bindings of a parsed file (parsed with parent pointers). */\nexport function createFileBindings(file: ts.SourceFile): FileBindings {\n return new CheckedFileBindings(file);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { FileBindings } from \"./file-bindings.js\";\n\n/**\n * The `openapiTS(source, options)` calls of a file, and where their options object is: written in\n * the call, in a module-level `const` (`openapiTS(source, options)`), or somewhere the rewriter\n * cannot see. The generator is the default import of the generator module, by any local name,\n * or `ns.default` of a namespace import (`import * as ns from \"openapi-typescript\"`).\n */\n\nexport type GeneratorOptions =\n /** An object literal that only this call uses: it may be rewritten. */\n | { readonly kind: \"own\"; readonly options: ts.ObjectLiteralExpression }\n /** An object literal in a `const` that other code uses too: it is only reported. */\n | { readonly kind: \"shared\"; readonly options: ts.ObjectLiteralExpression }\n /** An expression that is not an object literal of this file. */\n | { readonly kind: \"unknown\"; readonly expression: ts.Expression };\n\nexport interface GeneratorCall {\n readonly call: ts.CallExpression;\n /** Undefined when the call passes no options. */\n readonly options: GeneratorOptions | undefined;\n}\n\nconst DEFAULT_EXPORT = \"default\";\n\nfunction isGenerator(callee: ts.Expression, bindings: FileBindings): boolean {\n if (ts.isIdentifier(callee)) {\n return bindings.bindingOf(callee)?.kind === \"generator-function\";\n }\n return (\n ts.isPropertyAccessExpression(callee) &&\n callee.name.text === DEFAULT_EXPORT &&\n ts.isIdentifier(callee.expression) &&\n bindings.bindingOf(callee.expression)?.kind === \"generator-module\"\n );\n}\n\n/** The expression without parentheses, `as` and `satisfies`, which do not change the value. */\nfunction unwrapped(expression: ts.Expression): ts.Expression {\n if (\n ts.isParenthesizedExpression(expression) ||\n ts.isAsExpression(expression) ||\n ts.isSatisfiesExpression(expression)\n ) {\n return unwrapped(expression.expression);\n }\n return expression;\n}\n\nconst isExported = (declaration: ts.Node): boolean =>\n (ts.getCombinedModifierFlags(declaration as ts.Declaration) & ts.ModifierFlags.Export) !== 0;\n\n/** The options object a `const` holds, owned by this call when the call is its only use. */\nfunction constantOptions(name: ts.Identifier, bindings: FileBindings): GeneratorOptions {\n const binding = bindings.bindingOf(name);\n const declaration = bindings.declarationOf(name);\n const value = binding?.kind === \"constant\" ? unwrapped(binding.initializer) : undefined;\n if (value === undefined || !ts.isObjectLiteralExpression(value)) {\n return { kind: \"unknown\", expression: name };\n }\n const isOwn = bindings.usesOf(declaration as ts.Node).length === 1;\n return { kind: isOwn && !isExported(declaration as ts.Node) ? \"own\" : \"shared\", options: value };\n}\n\nfunction optionsOf(argument: ts.Expression, bindings: FileBindings): GeneratorOptions {\n const value = unwrapped(argument);\n if (ts.isObjectLiteralExpression(value)) {\n return { kind: \"own\", options: value };\n }\n return ts.isIdentifier(value)\n ? constantOptions(value, bindings)\n : { kind: \"unknown\", expression: argument };\n}\n\n/** Every generator call of the file, in source order. */\nexport function generatorCalls(file: ts.SourceFile, bindings: FileBindings): GeneratorCall[] {\n const calls: GeneratorCall[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isCallExpression(node) && isGenerator(node.expression, bindings)) {\n const argument = node.arguments[1];\n const options = argument === undefined ? undefined : optionsOf(argument, bindings);\n calls.push({ call: node, options });\n }\n ts.forEachChild(node, visit);\n };\n visit(file);\n return calls;\n}\n","import ts from \"@typescript/typescript6\";\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\nimport type { FileBindings } from \"./file-bindings.js\";\n\n/**\n * TypeScript type text for the `ts.factory` expressions of the classic `transform` recipe\n * (`createTypeReferenceNode`, keywords, `null` and literal types, unions, intersections, arrays),\n * and for the openapi-typesafe helper constants and `tsUnion` / `tsIntersection`. Anything else\n * returns undefined, so the callback is left as it is. A name such as `DATE` is followed to the\n * module-level `const` it refers to by scope, never by spelling.\n */\n\n/** How to read names: the file's bindings, and the constants being followed (to stop cycles). */\nexport interface FactoryNames {\n readonly bindings: FileBindings;\n readonly following: ReadonlySet<ts.Node>;\n}\n\nconst KEYWORDS: ReadonlyMap<string, string> = new Map([\n [\"AnyKeyword\", \"any\"],\n [\"BigIntKeyword\", \"bigint\"],\n [\"BooleanKeyword\", \"boolean\"],\n [\"NeverKeyword\", \"never\"],\n [\"NumberKeyword\", \"number\"],\n [\"ObjectKeyword\", \"object\"],\n [\"StringKeyword\", \"string\"],\n [\"SymbolKeyword\", \"symbol\"],\n [\"UndefinedKeyword\", \"undefined\"],\n [\"UnknownKeyword\", \"unknown\"],\n [\"VoidKeyword\", \"void\"],\n]);\n\nconst HELPER_CONSTANTS: ReadonlyMap<string, string> = new Map([\n [\"BOOLEAN\", \"boolean\"],\n [\"FALSE\", \"false\"],\n [\"NEVER\", \"never\"],\n [\"NULL\", \"null\"],\n [\"NUMBER\", \"number\"],\n [\"STRING\", \"string\"],\n [\"TRUE\", \"true\"],\n [\"UNDEFINED\", \"undefined\"],\n [\"UNKNOWN\", \"unknown\"],\n]);\n\n/** A type name the type text can hold as written: `Date`, `Foo.Bar`. */\nconst TYPE_NAME_RE = /^[A-Za-z_$][\\w$]*(\\.[A-Za-z_$][\\w$]*)*$/;\n\n/** A type with a `|` or `&` at the top needs parentheses inside `[]`, and a union inside `&`. */\ninterface TypeText {\n readonly text: string;\n readonly operator: \"|\" | \"&\" | null;\n}\n\nconst plain = (text: string): TypeText => ({ text, operator: null });\n\n/**\n * True when `target` is the TypeScript export `member`: `factory` imported by name, or\n * `ts.factory` on the TypeScript module.\n */\nfunction isTypescriptMember(target: ts.Expression, member: string, names: FactoryNames): boolean {\n if (ts.isIdentifier(target)) {\n const binding = names.bindings.bindingOf(target);\n return binding?.kind === \"typescript-import\" && binding.name === member;\n }\n return (\n ts.isPropertyAccessExpression(target) &&\n target.name.text === member &&\n ts.isIdentifier(target.expression) &&\n names.bindings.bindingOf(target.expression)?.kind === \"typescript-module\"\n );\n}\n\n/** `ts.factory.createX` or `factory.createX`: the factory method name, if that is the callee. */\nfunction factoryMethod(callee: ts.Expression, names: FactoryNames): string | undefined {\n return ts.isPropertyAccessExpression(callee) &&\n isTypescriptMember(callee.expression, \"factory\", names)\n ? callee.name.text\n : undefined;\n}\n\n/** `ts.SyntaxKind.StringKeyword` or `SyntaxKind.StringKeyword`: the member name. */\nfunction syntaxKindMember(expression: ts.Expression, names: FactoryNames): string | undefined {\n return ts.isPropertyAccessExpression(expression) &&\n isTypescriptMember(expression.expression, \"SyntaxKind\", names)\n ? expression.name.text\n : undefined;\n}\n\nfunction typeName(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined) {\n return undefined;\n }\n if (ts.isStringLiteralLike(argument)) {\n return TYPE_NAME_RE.test(argument.text) ? argument.text : undefined;\n }\n if (\n ts.isCallExpression(argument) &&\n factoryMethod(argument.expression, names) === \"createIdentifier\"\n ) {\n return typeName(argument.arguments[0], names);\n }\n return undefined;\n}\n\n/** Digits with optional `_` separators between them, as in `1_000`. */\nconst digits = (digit: string): string => `${digit}(?:_?${digit})*`;\nconst DECIMAL_LITERAL =\n `(?:(?:0|[1-9](?:_?\\\\d)*)(?:\\\\.(?:${digits(\"\\\\d\")})?)?|\\\\.${digits(\"\\\\d\")})` +\n `(?:[eE][+-]?${digits(\"\\\\d\")})?`;\n/** A numeric literal as TypeScript writes it: decimal, hex, octal or binary. */\nconst NUMERIC_LITERAL_RE = new RegExp(\n `^(?:0[xX]${digits(\"[\\\\da-fA-F]\")}|0[oO]${digits(\"[0-7]\")}|0[bB]${digits(\"[01]\")}|` +\n `${DECIMAL_LITERAL})$`,\n);\n\n/**\n * The text that `createNumericLiteral(value)` prints. A string prints as given, so it is kept as\n * written (`1_000`, `1e999`) when it is a numeric literal. A number prints as JavaScript writes\n * it, and one beyond the range of a number prints `Infinity`, which is no type: that is left.\n */\nfunction numericLiteralText(value: ts.Expression): string | undefined {\n if (ts.isNumericLiteral(value)) {\n const number = Number(value.text);\n return Number.isFinite(number) ? String(number) : undefined;\n }\n return ts.isStringLiteralLike(value) && NUMERIC_LITERAL_RE.test(value.text)\n ? value.text\n : undefined;\n}\n\nfunction literalText(argument: ts.Expression | undefined, names: FactoryNames): string | undefined {\n if (argument === undefined || !ts.isCallExpression(argument)) {\n return undefined;\n }\n const method = factoryMethod(argument.expression, names);\n const [value] = argument.arguments;\n switch (method) {\n case \"createNull\":\n return \"null\";\n case \"createTrue\":\n return \"true\";\n case \"createFalse\":\n return \"false\";\n case \"createStringLiteral\":\n return value !== undefined && ts.isStringLiteralLike(value)\n ? JSON.stringify(value.text)\n : undefined;\n case \"createNumericLiteral\":\n return value === undefined ? undefined : numericLiteralText(value);\n default:\n return undefined;\n }\n}\n\nfunction joined(\n elements: ts.Expression | undefined,\n operator: \"|\" | \"&\",\n names: FactoryNames,\n): TypeText | undefined {\n if (\n elements === undefined ||\n !ts.isArrayLiteralExpression(elements) ||\n elements.elements.length === 0\n ) {\n return undefined;\n }\n const parts = elements.elements.map((element) => typeTextOf(element, names));\n if (parts.some((part) => part === undefined)) {\n return undefined;\n }\n const 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 binding = names.bindings.bindingOf(call.expression);\n const helper = binding?.kind === \"helper-import\" ? binding.name : undefined;\n if (helper === \"tsUnion\") {\n return joined(call.arguments[0], \"|\", names);\n }\n return helper === \"tsIntersection\" ? joined(call.arguments[0], \"&\", names) : undefined;\n}\n\nfunction identifierText(identifier: ts.Identifier, names: FactoryNames): TypeText | undefined {\n const declaration = names.bindings.declarationOf(identifier);\n const binding = names.bindings.bindingOf(identifier);\n if (binding?.kind === \"helper-import\") {\n const constant = HELPER_CONSTANTS.get(binding.name);\n return constant === undefined ? undefined : plain(constant);\n }\n if (binding?.kind !== \"constant\" || names.following.has(declaration as ts.Node)) {\n return undefined;\n }\n const following = new Set([...names.following, declaration as ts.Node]);\n return typeTextOf(binding.initializer, { ...names, following });\n}\n\n/** The type text of an expression that builds a type, or undefined. */\nexport function typeTextOf(expression: ts.Expression, names: FactoryNames): TypeText | undefined {\n if (ts.isParenthesizedExpression(expression)) {\n return typeTextOf(expression.expression, names);\n }\n if (ts.isIdentifier(expression)) {\n return identifierText(expression, names);\n }\n if (!ts.isCallExpression(expression)) {\n return undefined;\n }\n const method = factoryMethod(expression.expression, names);\n return method === undefined\n ? helperCallText(expression, names)\n : factoryCallText(expression, method, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport { type FactoryNames, typeTextOf } from \"./factory-type-text.js\";\n\n/** The returned expressions of a function, without those of functions nested in it. */\nexport function returnedExpressions(body: ts.ConciseBody): (ts.Expression | undefined)[] {\n if (!ts.isBlock(body)) {\n return [body];\n }\n const returned: (ts.Expression | undefined)[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isFunctionLike(node) || ts.isClassLike(node)) {\n return;\n }\n if (ts.isReturnStatement(node)) {\n returned.push(node.expression);\n }\n ts.forEachChild(node, visit);\n };\n ts.forEachChild(body, visit);\n return returned;\n}\n\nconst isUndefined = (expression: ts.Expression): boolean =>\n (ts.isIdentifier(expression) && expression.text === \"undefined\") ||\n ts.isVoidExpression(expression);\n\nfunction typeTextEdit(expression: ts.Expression, names: FactoryNames): TextEdit[] | undefined {\n const typeText = typeTextOf(expression, names);\n if (typeText === undefined) {\n return undefined;\n }\n const start = expression.getStart();\n return [{ start, end: expression.getEnd(), text: JSON.stringify(typeText.text) }];\n}\n\n/** `{ schema: <type>, questionToken: … }`: only the `schema` value changes. */\nfunction resultObjectEdits(\n object: ts.ObjectLiteralExpression,\n names: FactoryNames,\n): TextEdit[] | undefined {\n const schema = object.properties.find(\n (property) =>\n property.name !== undefined &&\n ts.isIdentifier(property.name) &&\n property.name.text === \"schema\",\n );\n const isPlain = object.properties.every(ts.isPropertyAssignment);\n if (schema === undefined || !isPlain || !ts.isPropertyAssignment(schema)) {\n return undefined;\n }\n return typeTextEdit(schema.initializer, names);\n}\n\n/**\n * The edits that turn one returned expression into type text, or undefined when it is not one of\n * the known type-building forms. `undefined` (keep the generated type) needs no edit.\n */\nexport function returnEdits(\n expression: ts.Expression | undefined,\n names: FactoryNames,\n): TextEdit[] | undefined {\n if (expression === undefined || isUndefined(expression)) {\n return [];\n }\n if (ts.isParenthesizedExpression(expression)) {\n return returnEdits(expression.expression, names);\n }\n if (ts.isConditionalExpression(expression)) {\n const whenTrue = returnEdits(expression.whenTrue, names);\n const whenFalse = returnEdits(expression.whenFalse, names);\n return whenTrue === undefined || whenFalse === undefined\n ? undefined\n : [...whenTrue, ...whenFalse];\n }\n if (ts.isObjectLiteralExpression(expression)) {\n return resultObjectEdits(expression, names);\n }\n return typeTextEdit(expression, names);\n}\n","import ts from \"@typescript/typescript6\";\nimport type { TextEdit } from \"../../domain/text-edits.js\";\nimport { type FactoryNames, typeTextOf } from \"./factory-type-text.js\";\nimport type { Binding } from \"./file-bindings.js\";\n\n/**\n * After the `transform` returns become type text, the module-level constants that built the old\n * nodes (`const DATE = ts.factory…`), and the TypeScript and helper imports that only they used,\n * are no longer read. Left in place they fail `noUnusedLocals` (TS6133), so they are removed.\n * Only declarations that the rewrite made unused go: each had uses, and all of them were in\n * replaced text or in other removed declarations. A constant goes only when its initializer is a\n * type-building expression, so no side effect is lost; an exported one always stays.\n */\n\n/** A removed declaration, for the report. */\nexport interface RemovedDeclaration {\n readonly node: ts.Node;\n readonly name: string;\n}\n\ninterface Range {\n readonly start: number;\n readonly end: number;\n}\n\nconst isExported = (node: ts.Node): boolean =>\n (ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0;\n\nfunction isRemovable(node: ts.Node, binding: Binding, names: FactoryNames): boolean {\n switch (binding.kind) {\n case \"typescript-module\":\n case \"typescript-import\":\n case \"helper-import\":\n return true;\n case \"constant\":\n return !isExported(node) && typeTextOf(binding.initializer, names) !== undefined;\n default:\n return false;\n }\n}\n\nconst isInside = (node: ts.Node, ranges: readonly Range[]): boolean =>\n ranges.some((range) => node.getStart() >= range.start && node.getEnd() <= range.end);\n\n/** The declarations that the replaced ranges leave without a use, until nothing changes. */\nexport function unusedDeclarations(\n names: FactoryNames,\n replaced: readonly TextEdit[],\n): RemovedDeclaration[] {\n const ranges: Range[] = replaced.filter((edit) => edit.end > edit.start);\n const removed: RemovedDeclaration[] = [];\n for (let isChanged = true; isChanged; ) {\n isChanged = false;\n for (const [node, binding] of names.bindings.declarations) {\n const uses = names.bindings.usesOf(node);\n const isUnused = uses.length > 0 && uses.every((use) => isInside(use, ranges));\n const isNew = removed.every((found) => found.node !== node);\n if (isNew && isUnused && isRemovable(node, binding, names)) {\n const name = (node as ts.NamedDeclaration).name?.getText() ?? \"\";\n removed.push({ node, name });\n ranges.push({ start: node.getStart(), end: node.getEnd() });\n isChanged = true;\n }\n }\n }\n return removed;\n}\n\n/** The edit that removes a whole statement, with its line when nothing else is on it. */\nfunction statementRemoval(statement: ts.Statement, text: string): TextEdit {\n const start = statement.getStart(undefined, true);\n const end = statement.getEnd();\n const lineStart = text.lastIndexOf(\"\\n\", start - 1) + 1;\n const lineBreak = text.indexOf(\"\\n\", end);\n const lineEnd = lineBreak === -1 ? text.length : lineBreak + 1;\n const isAlone =\n text.slice(lineStart, start).trim() === \"\" && text.slice(end, lineEnd).trim() === \"\";\n return isAlone ? { start: lineStart, end: lineEnd, text: \"\" } : { start, end, text: \"\" };\n}\n\n/**\n * The edits that remove some elements of a comma-separated list. An element before the last kept\n * one goes with the comma after it; the elements after the last kept one go with the comma before\n * them, in one edit.\n */\nfunction listRemovals(\n elements: readonly ts.Node[],\n isRemoved: (node: ts.Node) => boolean,\n): TextEdit[] {\n const lastKept = elements.findLastIndex((element) => !isRemoved(element));\n const edits: TextEdit[] = [];\n elements.forEach((element, index) => {\n const next = elements[index + 1];\n if (index < lastKept && isRemoved(element) && next !== undefined) {\n edits.push({ start: element.getStart(), end: next.getStart(), text: \"\" });\n }\n });\n const last = elements.at(-1);\n if (lastKept !== -1 && last !== undefined && lastKept < elements.length - 1) {\n edits.push({ start: (elements[lastKept] as ts.Node).getEnd(), end: last.getEnd(), text: \"\" });\n }\n return edits;\n}\n\ntype IsRemoved = (node: ts.Node) => boolean;\n\n/** The edits for an import some of whose bindings were removed. */\nfunction importEdits(\n statement: ts.ImportDeclaration,\n isRemoved: IsRemoved,\n text: string,\n): TextEdit[] {\n const clause = statement.importClause as ts.ImportClause;\n const bindings = clause.namedBindings;\n const named = bindings !== undefined && ts.isNamedImports(bindings) ? bindings : undefined;\n const namespace = bindings !== undefined && ts.isNamespaceImport(bindings) ? bindings : undefined;\n const parts: ts.Node[] = [\n ...(clause.name === undefined ? [] : [clause]),\n ...(namespace === undefined ? [] : [namespace]),\n ...(named?.elements ?? []),\n ];\n if (parts.every(isRemoved)) {\n return [statementRemoval(statement, text)];\n }\n // Not every part is removed, so a removed default import has a named or namespace one after it.\n const defaultEnd = clause.name?.getEnd() ?? 0;\n const edits: TextEdit[] = [];\n if (clause.name !== undefined && isRemoved(clause)) {\n edits.push({ start: clause.name.getStart(), end: (bindings as ts.Node).getStart(), text: \"\" });\n }\n if (namespace !== undefined && isRemoved(namespace)) {\n edits.push({ start: defaultEnd, end: namespace.getEnd(), text: \"\" });\n }\n if (named !== undefined && named.elements.length > 0 && named.elements.every(isRemoved)) {\n edits.push({ start: defaultEnd, end: named.getEnd(), text: \"\" });\n } else if (named !== undefined) {\n edits.push(...listRemovals(named.elements, isRemoved));\n }\n return edits;\n}\n\nfunction statementEdits(statement: ts.Statement, isRemoved: IsRemoved, text: string): TextEdit[] {\n if (ts.isImportDeclaration(statement)) {\n return importEdits(statement, isRemoved, text);\n }\n const declarations = (statement as ts.VariableStatement).declarationList.declarations;\n return declarations.every(isRemoved)\n ? [statementRemoval(statement, text)]\n : listRemovals(declarations, isRemoved);\n}\n\n/** The edits that remove the declarations, grouped by the statement each belongs to. */\nexport function removalEdits(removed: readonly RemovedDeclaration[], text: string): TextEdit[] {\n const nodes = new Set(removed.map((found) => found.node));\n const isRemoved: IsRemoved = (node) => nodes.has(node);\n const statements = new Set(\n removed.map(\n (found) =>\n ts.findAncestor(\n found.node,\n (node) => ts.isVariableStatement(node) || ts.isImportDeclaration(node),\n ) as ts.Statement,\n ),\n );\n return [...statements].flatMap((statement) => statementEdits(statement, isRemoved, text));\n}\n","import ts from \"@typescript/typescript6\";\nimport type { CallbackRewriter } from \"../../application/ports.js\";\nimport {\n type Change,\n type FileMigration,\n lineAt,\n type ManualStep,\n type TransformKeepReason,\n unchanged,\n} from \"../../domain/migration-findings.js\";\nimport { applyTextEdits, type TextEdit } from \"../../domain/text-edits.js\";\nimport type { FactoryNames } from \"./factory-type-text.js\";\nimport { createFileBindings } from \"./file-bindings.js\";\nimport { type GeneratorCall, generatorCalls } from \"./generator-calls.js\";\nimport { plainScriptKind } from \"./script-regions.js\";\nimport { returnEdits, returnedExpressions } from \"./transform-returns.js\";\nimport { removalEdits, unusedDeclarations } from \"./unused-declarations.js\";\n\n/**\n * The CallbackRewriter port on the TypeScript 6 parser (ADR-015). In each `openapiTS(source, {…})`\n * call where `transform` is the only callback and every value it returns builds a type with\n * `ts.factory` or the helpers, the returns become TypeScript type text and `irCallbacks: true` is\n * added; the module-level constants and imports that only the old returns used are removed. Every\n * other legacy callback is reported, not changed: it still works, with a warning.\n */\n\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/** The function a `const` or a function declaration of this file holds. */\nfunction namedFunction(\n name: ts.Identifier,\n names: FactoryNames,\n): ts.FunctionLikeDeclaration | undefined {\n const binding = names.bindings.bindingOf(name);\n if (binding?.kind === \"function\") {\n return binding.declaration;\n }\n const value = binding?.kind === \"constant\" ? binding.initializer : undefined;\n return value !== undefined && (ts.isArrowFunction(value) || ts.isFunctionExpression(value))\n ? value\n : undefined;\n}\n\n/**\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: FactoryNames,\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 namedFunction(value, names);\n }\n return ts.isArrowFunction(value) || ts.isFunctionExpression(value) ? value : undefined;\n}\n\n/**\n * A function named by `transform` is rewritten only when this is its only use: other callers\n * would get type text where they expect nodes.\n */\nfunction isSharedFunction(property: ts.ObjectLiteralElementLike, names: FactoryNames): boolean {\n if (!ts.isPropertyAssignment(property) || !ts.isIdentifier(property.initializer)) {\n return false;\n }\n const declaration = names.bindings.declarationOf(property.initializer);\n return declaration !== undefined && names.bindings.usesOf(declaration).length > 1;\n}\n\n/**\n * A declared return type names TypeScript nodes (`ts.TypeNode`), which type text does not match,\n * so it is removed and the type is inferred from the new returns.\n */\nfunction returnTypeEdits(callback: ts.FunctionLikeDeclaration, text: string): TextEdit[] {\n const type = callback.type;\n if (type === undefined) {\n return [];\n }\n const colon = text.lastIndexOf(\":\", type.getStart());\n return [{ start: colon, end: type.getEnd(), text: \"\" }];\n}\n\n/** The edits for the returns of `transform`, or the reason to keep it. */\nfunction transformEdits(\n property: ts.ObjectLiteralElementLike,\n names: FactoryNames,\n text: string,\n): TextEdit[] | TransformKeepReason {\n const callback = callbackFunction(property, names);\n if (callback?.body === undefined) {\n return \"not-a-function\";\n }\n if (isSharedFunction(property, names)) {\n return \"shared-function\";\n }\n const 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: FactoryNames,\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/** Options that other code uses too: the callbacks are reported, never changed. */\nfunction sharedOptionsFindings(options: ts.ObjectLiteralExpression, text: string): CallFindings {\n const findings: CallFindings = { edits: [], changes: [], manualSteps: [] };\n if (propertyNamed(options, IR_CALLBACKS_OPTION) !== undefined) {\n return findings;\n }\n findings.manualSteps.push(...legacyCallbackSteps(options, text));\n const transform = propertyNamed(options, TRANSFORM);\n if (transform !== undefined) {\n const line = lineAt(text, transform.getStart());\n findings.manualSteps.push({ kind: \"transform-not-rewritten\", line, reason: \"shared-options\" });\n }\n return findings;\n}\n\nfunction callFindings(found: GeneratorCall, text: string, names: FactoryNames): CallFindings {\n const options = found.options;\n switch (options?.kind) {\n case undefined:\n return { edits: [], changes: [], manualSteps: [] };\n case \"own\":\n return migrateOptions(options.options, text, names);\n case \"shared\":\n return sharedOptionsFindings(options.options, text);\n case \"unknown\": {\n const line = lineAt(text, options.expression.getStart());\n return { edits: [], changes: [], manualSteps: [{ kind: \"options-not-inspected\", line }] };\n }\n }\n}\n\n/** The findings of every generator call; options that several calls share are read once. */\nfunction findCallFindings(file: ts.SourceFile, text: string, names: FactoryNames): CallFindings {\n const all: CallFindings = { edits: [], changes: [], manualSteps: [] };\n const seen = new Set<ts.Node>();\n for (const found of generatorCalls(file, names.bindings)) {\n const options = found.options?.kind === \"unknown\" ? undefined : found.options?.options;\n if (options !== undefined && seen.has(options)) {\n continue;\n }\n if (options !== undefined) {\n seen.add(options);\n }\n const findings = callFindings(found, text, names);\n all.edits.push(...findings.edits);\n all.changes.push(...findings.changes);\n all.manualSteps.push(...findings.manualSteps);\n }\n return all;\n}\n\n/** The rewrite of a file that calls the generator, with the declarations it leaves unused. */\nfunction rewriteFile(file: ts.SourceFile, names: FactoryNames): FileMigration {\n const text = file.text;\n const { edits, changes, manualSteps } = findCallFindings(file, text, names);\n const removed = unusedDeclarations(names, edits);\n for (const found of removed) {\n changes.push({\n kind: \"declaration-removed\",\n line: lineAt(text, found.node.getStart()),\n name: found.name,\n });\n }\n const allEdits = [...edits, ...removalEdits(removed, text)];\n return { text: applyTextEdits(text, allEdits), changes, manualSteps };\n}\n\nclass TypescriptCallbackRewriter implements CallbackRewriter {\n rewrite(text: string, path: string): FileMigration {\n // Single-file components (`.vue`, `.svelte`, `.astro`) are not plain scripts; they are left.\n const scriptKind = plainScriptKind(path);\n if (scriptKind === undefined) {\n return unchanged(text);\n }\n const file = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, scriptKind);\n const bindings = createFileBindings(file);\n if (!bindings.hasGenerator) {\n return unchanged(text);\n }\n return rewriteFile(file, { bindings, following: new Set() });\n }\n}\n\n/** A callback rewriter that parses each file with the TypeScript 6 parser. */\nexport function createTypescriptCallbackRewriter(): CallbackRewriter {\n return new TypescriptCallbackRewriter();\n}\n","import ts from \"@typescript/typescript6\";\nimport type { SourceStringScanner } from \"../../application/ports.js\";\nimport type { SourceString } from \"../../domain/source-migration.js\";\nimport { type ScriptRegion, scriptRegions } from \"./script-regions.js\";\n\n/**\n * The SourceStringScanner port on the TypeScript 6 parser (ADR-015). It finds every string\n * literal of a file's scripts, JSDoc types included, and the `/// <reference types>` directives,\n * and tells module specifiers from other strings by the syntax around them.\n */\n\nconst REQUIRE = \"require\";\nconst RESOLVE = \"resolve\";\n/** Methods of vitest's `vi` whose first argument is a module. */\nconst VITEST_METHODS: ReadonlySet<string> = new Set([\n \"mock\",\n \"doMock\",\n \"unmock\",\n \"doUnmock\",\n \"importActual\",\n \"importMock\",\n]);\n/** Methods of `jest` whose first argument is a module, older names included. */\nconst JEST_METHODS: ReadonlySet<string> = new Set([\n \"mock\",\n \"doMock\",\n \"unmock\",\n \"dontMock\",\n \"deepUnmock\",\n \"setMock\",\n \"requireActual\",\n \"requireMock\",\n \"createMockFromModule\",\n \"genMockFromModule\",\n \"unstable_mockModule\",\n \"unstable_unmockModule\",\n]);\n/** `vi.mock`, `jest.setMock`, bun's `mock.module` and `require.resolve`, by object. */\nconst MODULE_METHODS: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [\"vi\", VITEST_METHODS],\n [\"jest\", JEST_METHODS],\n [\"mock\", new Set([\"module\"])],\n [REQUIRE, new Set([RESOLVE])],\n]);\n\nfunction isIdentifierNamed(node: ts.Node, name: string): boolean {\n return ts.isIdentifier(node) && node.text === name;\n}\n\n/** The module methods, and `import.meta.resolve`. */\nfunction isModuleMethod(callee: ts.PropertyAccessExpression): boolean {\n const object = callee.expression;\n const method = callee.name.text;\n if (ts.isIdentifier(object)) {\n return MODULE_METHODS.get(object.text)?.has(method) ?? false;\n }\n return method === RESOLVE && ts.isMetaProperty(object);\n}\n\n/** Calls whose first argument is a module: `import()`, `require()` and the module methods. */\nfunction isModuleCall(call: ts.CallExpression): boolean {\n const callee = call.expression;\n if (callee.kind === ts.SyntaxKind.ImportKeyword || isIdentifierNamed(callee, REQUIRE)) {\n return true;\n }\n return ts.isPropertyAccessExpression(callee) && isModuleMethod(callee);\n}\n\nfunction isModuleSpecifier(literal: ts.StringLiteralLike | ts.TemplateExpression): boolean {\n const parent = literal.parent;\n if (\n ts.isImportDeclaration(parent) ||\n ts.isExportDeclaration(parent) ||\n ts.isJSDocImportTag(parent)\n ) {\n return parent.moduleSpecifier === literal;\n }\n if (ts.isCallExpression(parent)) {\n return parent.arguments[0] === literal && isModuleCall(parent);\n }\n if (ts.isModuleDeclaration(parent)) {\n return parent.name === literal;\n }\n // `import(\"openapi-fetch\").Client` in a type, also in a JSDoc type of a JavaScript file.\n if (ts.isLiteralTypeNode(parent)) {\n return ts.isImportTypeNode(parent.parent);\n }\n return ts.isExternalModuleReference(parent);\n}\n\ntype FoundStrings = Map<number, SourceString>;\n\n/** The value of a string literal; the text between the backticks of a template with `${…}`. */\nfunction stringValue(node: ts.StringLiteralLike | ts.TemplateExpression, file: ts.SourceFile) {\n return ts.isTemplateExpression(node)\n ? file.text.slice(node.getStart(file) + 1, node.getEnd() - 1)\n : node.text;\n}\n\n/** Adds the string literals under `root` to `found`; `file` starts at `offset` in the file. */\nfunction collectStrings(\n root: ts.Node,\n file: ts.SourceFile,\n offset: number,\n found: FoundStrings,\n): void {\n const visit = (node: ts.Node): void => {\n // A template with substitutions (`npx openapi-typescript ${spec}`) gives its text as written,\n // `${…}` included: the specifier rename then keeps the substitutions, and a command in it is\n // reported with them.\n if (ts.isStringLiteralLike(node) || ts.isTemplateExpression(node)) {\n // The value starts after the opening quote and ends before the closing one.\n const start = offset + node.getStart(file) + 1;\n const end = offset + node.getEnd() - 1;\n found.set(start, {\n start,\n end,\n value: stringValue(node, file),\n isModuleSpecifier: isModuleSpecifier(node),\n });\n }\n ts.forEachChild(node, visit);\n };\n visit(root);\n}\n\n/**\n * Every comment of a parsed file. Comments are the trivia in front of tokens, so the ranges in\n * front of each token cover them all, also where no node owns a JSDoc block. A trailing range\n * ends at the first line break and a leading one starts after it, so a token needs both. JSX text\n * is not trivia, and the JSDoc nodes are read from their comments, so neither is walked.\n */\nfunction commentRanges(file: ts.SourceFile): ts.CommentRange[] {\n const ranges = new Map<number, ts.CommentRange>();\n const add = (found: ts.CommentRange[] | undefined): void => {\n for (const range of found ?? []) {\n ranges.set(range.pos, range);\n }\n };\n const visit = (node: ts.Node): void => {\n if (node.kind === ts.SyntaxKind.JsxText) {\n return;\n }\n const children = node.getChildren(file).filter((child) => !ts.isJSDoc(child));\n if (children.length === 0) {\n add(ts.getTrailingCommentRanges(file.text, node.pos));\n add(ts.getLeadingCommentRanges(file.text, node.pos));\n }\n children.forEach(visit);\n };\n visit(file);\n return [...ranges.values()];\n}\n\nconst JSDOC_START = \"/**\";\nconst EMPTY_BLOCK_COMMENT = \"/**/\";\n/** A statement for an isolated JSDoc block to belong to, so that the parser reads the block. */\nconst JSDOC_HOST = \"\\nvar host;\";\nconst JSDOC_FILE_NAME = \"jsdoc.js\";\n\n/**\n * Adds the strings of one JSDoc block. The parser reads only the last block before a node it\n * keeps JSDoc for, so each block is parsed on its own, in front of a statement of its own.\n */\nfunction collectJsDocStrings(comment: string, offset: number, found: FoundStrings): void {\n const text = `${comment}${JSDOC_HOST}`;\n const file = ts.createSourceFile(JSDOC_FILE_NAME, text, ts.ScriptTarget.Latest, true);\n const host = file.statements[0] as ts.Statement;\n for (const doc of ts.getJSDocCommentsAndTags(host)) {\n collectStrings(doc, file, offset, found);\n }\n}\n\nfunction literalStrings(file: ts.SourceFile, offset: number): FoundStrings {\n const found: FoundStrings = new Map();\n collectStrings(file, file, offset, found);\n for (const range of commentRanges(file)) {\n const comment = file.text.slice(range.pos, range.end);\n if (comment.startsWith(JSDOC_START) && comment !== EMPTY_BLOCK_COMMENT) {\n collectJsDocStrings(comment, offset + range.pos, found);\n }\n }\n return found;\n}\n\nfunction regionStrings(region: ScriptRegion, path: string): SourceString[] {\n const file = ts.createSourceFile(path, region.text, ts.ScriptTarget.Latest, true, region.kind);\n const found = literalStrings(file, region.offset);\n for (const reference of file.typeReferenceDirectives) {\n const start = region.offset + reference.pos;\n const end = region.offset + reference.end;\n found.set(start, { start, end, value: reference.fileName, isModuleSpecifier: true });\n }\n return [...found.values()];\n}\n\nclass TypescriptSourceStringScanner implements SourceStringScanner {\n scan(text: string, path: string): SourceString[] {\n return scriptRegions(text, path)\n .flatMap((region) => regionStrings(region, path))\n .sort((left, right) => left.start - right.start);\n }\n}\n\n/** A source string scanner that parses each script with the TypeScript 6 parser. */\nexport function createTypescriptStringScanner(): SourceStringScanner {\n return new TypescriptSourceStringScanner();\n}\n","import { CST, isMap, isNode, isScalar, isSeq, parseAllDocuments, Scalar } from \"yaml\";\nimport type { YamlDocumentReader } from \"../../application/ports.js\";\nimport type { DocumentRead, TreeNode } from \"../../domain/config-documents.js\";\n\n/**\n * The YamlDocumentReader port on the `yaml` package (ADR-015). It keeps the source tokens, so\n * each scalar has the offsets of its text as written, in block and flow style alike, and reads\n * every document of a stream.\n */\n\ninterface Conversion {\n /** Inside a flow collection (`{ … }`, `[ … ]`), where `,` and brackets end a plain scalar. */\n readonly isFlow: boolean;\n}\n\ninterface TextRange {\n readonly start: number;\n readonly end: number;\n}\n\ntype Quoting = (value: string) => string;\n\nconst plain: Quoting = (value) => value;\nconst singleQuoted: Quoting = (value) => `'${value.replaceAll(\"'\", \"''\")}'`;\n// JSON is YAML: a JSON string is a valid double-quoted scalar for every value.\nconst doubleQuoted: Quoting = (value) => JSON.stringify(value);\n\n/** The quotings a new value may take, the old scalar's first; block scalars take none. */\nconst QUOTINGS: Readonly<Record<string, readonly Quoting[]>> = {\n [Scalar.PLAIN]: [plain, singleQuoted, doubleQuoted],\n [Scalar.QUOTE_SINGLE]: [singleQuoted, doubleQuoted],\n [Scalar.QUOTE_DOUBLE]: [doubleQuoted],\n};\n\n/** Whether `written`, at a place like the old scalar's, reads back as the string `value`. */\nfunction readsBack(written: string, value: string, isFlow: boolean): boolean {\n const [document] = parseAllDocuments(isFlow ? `[${written}]` : `- ${written}`);\n const list = document?.contents;\n const item = isSeq(list) && list.items.length === 1 ? list.items[0] : undefined;\n return document?.errors.length === 0 && isScalar(item) && item.value === value;\n}\n\n/**\n * The old scalar's quoting, or the next one that can hold the new value: a value that plain text\n * would read as another type or cut short (`true`, `a: b`, `x #y`) is quoted.\n */\nfunction encoderFor(quotings: readonly Quoting[], isFlow: boolean): (value: string) => string {\n return (value) =>\n quotings.map((quoting) => quoting(value)).find((text) => readsBack(text, value, isFlow)) ??\n doubleQuoted(value);\n}\n\n/** The content lines of a block scalar follow its header line, which its props make up. */\nfunction blockContent(token: CST.BlockScalar): TextRange {\n const headerLength = token.props.reduce((length, prop) => length + CST.stringify(prop).length, 0);\n const start = token.offset + headerLength;\n return { start, end: start + token.source.trimEnd().length };\n}\n\n/** The text of a scalar as written: without quotes, and without the header of a block scalar. */\nfunction contentRange(token: CST.Token | undefined, node: TextRange): TextRange {\n switch (token?.type) {\n case \"scalar\":\n return { start: token.offset, end: token.offset + token.source.length };\n case \"single-quoted-scalar\":\n case \"double-quoted-scalar\":\n return { start: token.offset + 1, end: token.offset + token.source.length - 1 };\n case \"block-scalar\":\n return blockContent(token);\n default:\n return node;\n }\n}\n\nfunction spanOf(node: { range?: [number, number, number] | null }): TextRange {\n const [start, end] = node.range ?? [0, 0];\n return { start, end };\n}\n\n/** A plain scalar that YAML reads as a number or boolean keeps its text as written. */\nfunction scalarText(node: Scalar): string | undefined {\n if (typeof node.value === \"string\") {\n return node.value;\n }\n const isWritten = node.type === Scalar.PLAIN && node.value !== null;\n return isWritten ? node.source : undefined;\n}\n\nfunction convertScalar(node: Scalar, isFlow: boolean): TreeNode {\n const span = spanOf(node);\n const value = scalarText(node);\n if (value === undefined) {\n return { kind: \"other\", ...span };\n }\n const quotings = node.type === undefined ? undefined : QUOTINGS[node.type];\n const isReplaceable =\n quotings !== undefined && node.anchor === undefined && node.tag === undefined;\n return {\n kind: \"scalar\",\n value,\n content: contentRange(node.srcToken, span),\n isFolded: node.type !== Scalar.BLOCK_LITERAL,\n encode: isReplaceable ? encoderFor(quotings, isFlow) : undefined,\n ...span,\n };\n}\n\nconst flowOf = (conversion: Conversion, node: { flow?: boolean }): Conversion => ({\n isFlow: conversion.isFlow || node.flow === true,\n});\n\nfunction convert(node: unknown, conversion: Conversion): TreeNode {\n if (isScalar(node)) {\n return convertScalar(node, conversion.isFlow);\n }\n if (isSeq(node)) {\n const inner = flowOf(conversion, node);\n return { kind: \"list\", items: node.items.map((item) => convert(item, inner)), ...spanOf(node) };\n }\n if (isMap(node)) {\n const inner = flowOf(conversion, node);\n const entries = node.items.map((pair) => ({\n key: convert(pair.key, inner),\n value: convert(pair.value, inner),\n }));\n return { kind: \"map\", entries, ...spanOf(node) };\n }\n // An alias, or no value at all (`key:` with nothing after it).\n return { kind: \"other\", ...spanOf(isNode(node) ? node : {}) };\n}\n\n/**\n * The offset of the first key that repeats an earlier scalar key of the same map, under `node`.\n * YAML forbids such a key. The `yaml` package checks it by comparing each key with every key\n * before it, which took 25 s on a 6 MB OpenAPI document; this check is linear and finds the same\n * keys: scalar keys with the same value.\n */\nfunction duplicateKeyOffset(node: unknown): number | undefined {\n if (isSeq(node)) {\n return firstOffset(node.items);\n }\n if (!isMap(node)) {\n return undefined;\n }\n const keys = new Set<unknown>();\n for (const pair of node.items) {\n if (isScalar(pair.key) && keys.has(pair.key.value)) {\n return spanOf(pair.key).start;\n }\n keys.add(isScalar(pair.key) ? pair.key.value : pair.key);\n }\n return firstOffset(node.items.flatMap((pair) => [pair.key, pair.value]));\n}\n\nfunction firstOffset(nodes: readonly unknown[]): number | undefined {\n for (const node of nodes) {\n const offset = duplicateKeyOffset(node);\n if (offset !== undefined) {\n return offset;\n }\n }\n return undefined;\n}\n\n/**\n * How the `yaml` package parses a config. Its own duplicate key check compares each key with every\n * key before it, so it is turned off (`uniqueKeys: false`) for the linear one above; the source\n * tokens give the offsets of the strings the migrations edit.\n */\nexport const YAML_PARSE_OPTIONS = { keepSourceTokens: true, uniqueKeys: false } as const;\n\n/**\n * The `yaml` package stops at nesting deeper than the stack allows and reports it as an error, so\n * a tree it gives is shallow enough for the migrations to walk.\n */\nfunction read(text: string): DocumentRead {\n const documents = parseAllDocuments(text, YAML_PARSE_OPTIONS);\n const error = documents.flatMap((document) => document.errors)[0];\n if (error !== undefined) {\n return { kind: \"unreadable\", offset: error.pos[0] };\n }\n const duplicate = firstOffset(documents.map((document) => document.contents));\n if (duplicate !== undefined) {\n return { kind: \"unreadable\", offset: duplicate };\n }\n const roots = documents.flatMap((document) =>\n document.contents === null ? [] : [convert(document.contents, { isFlow: false })],\n );\n return { kind: \"read\", documents: roots };\n}\n\nexport function createYamlTextReader(): YamlDocumentReader {\n return { read };\n}\n","/**\n * What the catalogs of a project keep under the old names (domain/catalogs.ts makes the plan).\n * It is apart from the catalogs so that dependency-map.ts can read a plan without importing the\n * catalog readers, which import it.\n */\n\nconst CATALOG_PROTOCOL = \"catalog:\";\n/** The name that `catalog:` gives the default catalog. */\nexport const DEFAULT_CATALOG = \"default\";\n\n/** The catalog that a spec points at (`catalog:` is the default one), or undefined. */\nexport function catalogOfSpec(spec: string): string | undefined {\n if (!spec.startsWith(CATALOG_PROTOCOL)) {\n return undefined;\n }\n return spec.slice(CATALOG_PROTOCOL.length) || DEFAULT_CATALOG;\n}\n\n/** Entries of catalogs, by catalog and package name. */\nexport class CatalogEntries {\n readonly #keys = new Set<string>();\n\n add(catalog: string, name: string): void {\n this.#keys.add(JSON.stringify([catalog, name]));\n }\n\n has(catalog: string, name: string): boolean {\n return this.#keys.has(JSON.stringify([catalog, name]));\n }\n}\n\n/** What the catalogs of a project keep under the old names. */\nexport interface CatalogPlan {\n /** Entries that a dependency keeps using under the old name: they are not renamed. */\n readonly inUse: CatalogEntries;\n /** Entries that keep the old name, with no entry for the new one: a dependency stays. */\n readonly kept: CatalogEntries;\n}\n\n/** The plan for a project whose catalogs were not read: nothing is kept for them. */\nexport const NO_CATALOG_PLAN: CatalogPlan = {\n inUse: new CatalogEntries(),\n kept: new CatalogEntries(),\n};\n","/**\n * What the migration renames (ENGINEERING_PLAN 10.1). openapi-typesafe is a drop-in successor, so\n * moving a project is a matter of names: packages, the CLI command and a few renamed CLI flags.\n */\n\n/** Original package name → openapi-typesafe package name. */\nexport const PACKAGE_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"openapi-typescript\", \"openapi-typesafe\"],\n [\"openapi-fetch\", \"openapi-typesafe-fetch\"],\n [\"openapi-react-query\", \"openapi-typesafe-react-query\"],\n [\"openapi-typescript-helpers\", \"openapi-typesafe-helpers\"],\n]);\n\n/**\n * Whether `text` names an original package as written. Every rename and every report starts at\n * such a name, so a text without one has nothing to migrate. The generator command is one of the\n * names. A name written with escapes (`\"openapi\\x2dfetch\"` in YAML) is not found, so a file that\n * names a package only that way is left as it is.\n */\nexport function namesOriginalPackage(text: string): boolean {\n return [...PACKAGE_RENAMES.keys()].some((name) => text.includes(name));\n}\n\n/** The generator's command, as package.json scripts and shell lines run it. */\nexport const GENERATOR_COMMAND = \"openapi-typescript\";\nexport const MIGRATED_GENERATOR_COMMAND = \"openapi-typesafe\";\n\n/**\n * Flags that openapi-typescript 6 and 7 renamed; the openapi-typesafe CLI rejects the old spelling\n * with CLI_FLAG_REMOVED, so the migration writes the new one.\n */\nexport const FLAG_RENAMES: ReadonlyMap<string, string> = new Map([\n [\"--immutable-types\", \"--immutable\"],\n [\"-it\", \"--immutable\"],\n [\"--support-array-length\", \"--array-length\"],\n [\"--redoc\", \"--redocly\"],\n [\"-ap\", \"--additional-properties\"],\n]);\n\n/** The dependency fields of package.json that install packages, in the order npm documents them. */\nexport const DEPENDENCY_FIELDS = [\n \"dependencies\",\n \"devDependencies\",\n \"peerDependencies\",\n \"optionalDependencies\",\n] as const;\n\nexport type DependencyField = (typeof DEPENDENCY_FIELDS)[number];\n\n/**\n * Fields keyed by the name of a dependency: `peerDependenciesMeta` (npm, its `optional` flag),\n * `dependenciesMeta` (pnpm and Yarn). A key left with the old name loses its meaning: an optional\n * peer becomes required (finding M3).\n */\nexport const NAME_KEYED_FIELDS = [\"peerDependenciesMeta\", \"dependenciesMeta\"] as const;\n\n/** Fields that list the names of dependencies to bundle (npm reads both spellings). */\nexport const NAME_LIST_FIELDS = [\"bundleDependencies\", \"bundledDependencies\"] as const;\n\n/**\n * Catalogs in package.json: bun reads `catalog` and `catalogs` at the top level and under\n * `workspaces`. Their names are what `catalog:` dependencies point at.\n */\nexport const CATALOG_FIELD = \"catalog\";\nexport const NAMED_CATALOGS_FIELD = \"catalogs\";\nexport const WORKSPACES_FIELD = \"workspaces\";\n\n/** Fields that can name a package without installing it; they are reported, not rewritten. */\nexport const OVERRIDE_FIELDS = [\"overrides\", \"resolutions\", \"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\nconst PATH_SEPARATOR = \"/\";\n\n/** A module specifier with the package renamed, and whether it reaches into the package. */\nexport interface RenamedSpecifier {\n readonly to: string;\n readonly isDeep: boolean;\n}\n\n/**\n * The new name of a whole package name, or of a name and a subpath (`openapi-fetch/x`, and the\n * `openapi-fetch/` prefix of an import map); undefined for other specifiers.\n */\nexport function renamedSpecifier(value: string): RenamedSpecifier | undefined {\n const slash = value.indexOf(PATH_SEPARATOR);\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 const subpath = value.slice(name.length);\n return { to: `${renamed}${subpath}`, isDeep: subpath !== \"\" && subpath !== PATH_SEPARATOR };\n}\n","import { columnAt, type FileMigration, lineAt, unchanged } from \"./migration-findings.js\";\nimport { namesOriginalPackage } from \"./package-names.js\";\n\n/**\n * A JSON, JSONC or YAML config as a parser adapter reads it: a tree per document with the offsets\n * of its nodes in the text, so a migration replaces one key, value or word and keeps the rest of\n * the file byte for byte (comments, formatting, number literals, key order, duplicate keys).\n * Migrations that look for values by key path read the string values of the tree.\n */\n\ninterface Span {\n readonly start: number;\n readonly end: number;\n}\n\n/**\n * A text value: a JSON string, a YAML scalar. `start` and `end` cover the node with its quotes;\n * `content` covers its text as written: inside the quotes, and the content lines of a block\n * scalar without its `|` or `>` line. A YAML plain scalar that YAML reads as a number or a\n * boolean has its text as written as `value` (`1.10`, not 1.1).\n */\nexport interface TreeScalar extends Span {\n readonly kind: \"scalar\";\n readonly value: string;\n readonly content: Span;\n /** Line breaks fold to spaces in every YAML scalar but a literal block scalar (`|`). */\n readonly isFolded: boolean;\n /**\n * Writes a new value as the format needs it at this place, in the quoting of the old one when\n * that quoting can hold it. Undefined where a whole new value could change other places or the\n * type: a YAML block scalar, an anchored or a tagged scalar.\n */\n readonly encode: ((value: string) => string) | undefined;\n}\n\nexport interface TreeEntry {\n readonly key: TreeNode;\n readonly value: TreeNode;\n}\n\n/** A JSON object or YAML mapping, every entry as written, duplicate keys included, in order. */\nexport interface TreeMap extends Span {\n readonly kind: \"map\";\n readonly entries: readonly TreeEntry[];\n}\n\nexport interface TreeList extends Span {\n readonly kind: \"list\";\n readonly items: readonly TreeNode[];\n}\n\n/** A number, boolean or null in JSON, a YAML alias, an empty value. */\nexport interface TreeOther extends Span {\n readonly kind: \"other\";\n}\n\nexport type TreeNode = TreeMap | TreeList | TreeScalar | TreeOther;\n\n/**\n * The documents of a config (a YAML stream can hold several), or where the text stops being\n * valid. `offset` is undefined when the parser gives no place (it gave up on nesting deeper than\n * it can follow).\n */\nexport type DocumentRead =\n | { readonly kind: \"read\"; readonly documents: readonly TreeNode[] }\n | { readonly kind: \"unreadable\"; readonly offset: number | undefined };\n\n/** A key path: mapping keys and list indexes, from the root of the document. */\nexport type DocumentPath = readonly (string | number)[];\n\n/** A string value of a document with its key path. */\nexport interface DocumentString extends TreeScalar {\n readonly path: DocumentPath;\n}\n\nexport const isMap = (node: TreeNode | undefined): node is TreeMap => node?.kind === \"map\";\n\nexport const isScalar = (node: TreeNode): node is TreeScalar => node.kind === \"scalar\";\n\n/** The entries of `map` with a text key, as key and value. */\nexport function textEntries(map: TreeMap): { key: TreeScalar; value: TreeNode }[] {\n return map.entries.flatMap(({ key, value }) => (isScalar(key) ? [{ key, value }] : []));\n}\n\n/** The values of the entries of `map` whose key is `key`, in order. */\nexport function valuesAt(map: TreeMap, key: string): TreeNode[] {\n return textEntries(map)\n .filter((entry) => entry.key.value === key)\n .map((entry) => entry.value);\n}\n\n/** The maps at `key` of `map`, all of them if the key is there more than once. */\nexport function mapsAt(map: TreeMap, key: string): TreeMap[] {\n return valuesAt(map, key).filter(isMap);\n}\n\n/** The string values below `node` in document order; none below a key that is not text. */\nfunction stringsBelow(node: TreeNode, path: DocumentPath): DocumentString[] {\n switch (node.kind) {\n case \"scalar\":\n return [{ ...node, path }];\n case \"list\":\n return node.items.flatMap((item, index) => stringsBelow(item, [...path, index]));\n case \"map\":\n return textEntries(node).flatMap(({ key, value }) =>\n stringsBelow(value, [...path, key.value]),\n );\n default:\n return [];\n }\n}\n\n/** Every string value of the documents (not the keys), with its key path, in document order. */\nexport function documentStrings(documents: readonly TreeNode[]): DocumentString[] {\n return documents.flatMap((document) => stringsBelow(document, []));\n}\n\n/**\n * The key a value belongs to: the last key of its path, past list indexes, so the items of a list\n * (also of a nested list) belong to the key that holds the list.\n */\nexport function ownerKey(path: DocumentPath): string | undefined {\n return path.findLast((part): part is string => typeof part === \"string\");\n}\n\n/**\n * The migration of a config that the parser could not read. A broken config that names no\n * original package is not this migration's concern; one that does is left to the user, with the\n * place where it stops being valid.\n */\nexport function unreadableConfig(text: string, offset: number | undefined): FileMigration {\n if (!namesOriginalPackage(text)) {\n return unchanged(text);\n }\n const position =\n offset === undefined\n ? undefined\n : { line: lineAt(text, offset), column: columnAt(text, offset) };\n return { ...unchanged(text), manualSteps: [{ kind: \"config-unreadable\", position }] };\n}\n","import { PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * Override, resolution and patch keys name a package with a path or a version around it:\n * `app>openapi-fetch` (pnpm), `**\\/openapi-fetch` (Yarn), `openapi-fetch@0.13` (pnpm, npm).\n * Matching the name as a substring took `openapi-typescript-helpers` for `openapi-typescript` too.\n */\n\nconst PARENT_SEPARATOR = \">\";\nconst PATH_SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\n\n/** The package a key targets: the last parent and path segment, without a version. */\nexport function overrideTarget(key: string): string {\n const child = key.split(PARENT_SEPARATOR).at(-1) ?? key;\n const segments = child.split(PATH_SEPARATOR);\n const isScoped = segments.length > 1 && segments.at(-2)?.startsWith(SCOPE_PREFIX) === true;\n const name = isScoped ? segments.slice(-2).join(PATH_SEPARATOR) : (segments.at(-1) ?? child);\n const versionAt = name.indexOf(SCOPE_PREFIX, 1);\n return versionAt === -1 ? name : name.slice(0, versionAt);\n}\n\n/** The original packages that `keys` target; each once, in key order. */\nexport function overriddenPackages(keys: readonly string[]): string[] {\n const targets = keys.map(overrideTarget);\n return [...new Set(targets.filter((target) => PACKAGE_RENAMES.has(target)))];\n}\n","import {\n type TreeList,\n type TreeMap,\n type TreeNode,\n type TreeScalar,\n textEntries,\n} from \"./config-documents.js\";\nimport type { NameEntry, SpecEntry } from \"./dependency-map.js\";\nimport type { TextEdit } from \"./text-edits.js\";\n\n/**\n * The tree side of domain/dependency-map.ts: the entries of parsed maps and lists, with the edits\n * that replace their keys and values in place (domain/config-documents.ts).\n */\n\n/** A scalar that a whole new value can replace. */\ntype EditableScalar = TreeScalar & { readonly encode: (value: string) => string };\n\nconst isEditable = (node: TreeNode): node is EditableScalar =>\n node.kind === \"scalar\" && node.encode !== undefined;\n\n/** The edit that writes `value` where `scalar` is. */\nexport const replaceScalar = (scalar: EditableScalar, value: string): TextEdit => ({\n start: scalar.start,\n end: scalar.end,\n text: scalar.encode(value),\n});\n\n/**\n * The `name: spec` entries of a dependency map, catalog or import map. A key the tool cannot\n * replace is left out; a value it cannot replace gives an entry without a spec.\n */\nexport function specEntries(map: TreeMap): SpecEntry[] {\n return textEntries(map).flatMap(({ key, value }): SpecEntry[] => {\n if (!isEditable(key)) {\n return [];\n }\n const spec = isEditable(value)\n ? { value: value.value, replace: (to: string) => replaceScalar(value, to) }\n : undefined;\n return [{ name: key.value, spec, renameKey: (name) => replaceScalar(key, name) }];\n });\n}\n\n/** The keys of `map` that the tool can replace, as names. */\nexport function keyEntries(map: TreeMap): NameEntry[] {\n return textEntries(map)\n .map(({ key }) => key)\n .filter(isEditable)\n .map((key) => ({ name: key.value, rename: (name) => replaceScalar(key, name) }));\n}\n\n/** The text items of `list` that the tool can replace, as names. */\nexport function itemEntries(list: TreeList): NameEntry[] {\n return list.items\n .filter(isEditable)\n .map((item) => ({ name: item.value, rename: (name) => replaceScalar(item, name) }));\n}\n\n/**\n * The keys of `node` and of the maps in it, at any depth, in order. Override fields name\n * packages by their keys (domain/override-targets.ts).\n */\nexport function nestedKeys(node: TreeNode): string[] {\n if (node.kind !== \"map\") {\n return [];\n }\n return textEntries(node).flatMap(({ key, value }) => [key.value, ...nestedKeys(value)]);\n}\n","import {\n CatalogEntries,\n type CatalogPlan,\n catalogOfSpec,\n DEFAULT_CATALOG,\n} from \"./catalog-plan.js\";\nimport {\n isMap,\n mapsAt,\n type TreeMap,\n type TreeNode,\n textEntries,\n valuesAt,\n} from \"./config-documents.js\";\nimport { overrideTarget } from \"./override-targets.js\";\nimport {\n CATALOG_FIELD,\n DEPENDENCY_FIELDS,\n NAMED_CATALOGS_FIELD,\n OVERRIDE_FIELDS,\n PACKAGE_RENAMES,\n WORKSPACES_FIELD,\n} from \"./package-names.js\";\nimport { specEntries } from \"./tree-entries.js\";\n\n/**\n * Catalogs and the dependencies that point at them (`\"openapi-fetch\": \"catalog:\"`). A catalog\n * entry and the dependencies on it must keep the same name, or the install fails\n * (`ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`). The files are migrated one by one, so this plan\n * is made from all of them first: an entry keeps its old name while a dependency keeps using it,\n * and a dependency keeps its old name while its entry stays.\n */\n\nconst PATH_SEPARATOR = \".\";\n\n/** One catalog map: its name as `catalog:<name>` names it, and where it is in the file. */\nexport interface CatalogMap {\n readonly name: string;\n readonly label: string;\n readonly map: TreeMap;\n}\n\n/**\n * The catalogs of a file: `catalog` (the default one) and `catalogs.<name>`, as pnpm and Yarn\n * read them, and also under `workspaces` as bun reads them. `prefix` names where `root` is.\n */\nexport function catalogMaps(root: TreeMap, prefix = \"\"): CatalogMap[] {\n const maps = mapsAt(root, CATALOG_FIELD).map((map) => ({\n name: DEFAULT_CATALOG,\n label: `${prefix}${CATALOG_FIELD}`,\n map,\n }));\n for (const catalogs of mapsAt(root, NAMED_CATALOGS_FIELD)) {\n for (const { key, value } of textEntries(catalogs)) {\n if (isMap(value)) {\n const label = [prefix + NAMED_CATALOGS_FIELD, key.value].join(PATH_SEPARATOR);\n maps.push({ name: key.value, label, map: value });\n }\n }\n }\n return maps;\n}\n\n/** The catalogs of a manifest: at the top level and under `workspaces` (bun). */\nexport const manifestCatalogMaps = (manifest: TreeMap): CatalogMap[] => [\n ...catalogMaps(manifest),\n ...mapsAt(manifest, WORKSPACES_FIELD).flatMap((workspaces) =>\n catalogMaps(workspaces, `${WORKSPACES_FIELD}${PATH_SEPARATOR}`),\n ),\n];\n\n/** The documents the plan is made from: manifests, and the files that hold catalogs. */\nexport interface CatalogDocuments {\n readonly manifests: readonly TreeMap[];\n readonly catalogFiles: readonly TreeMap[];\n}\n\n/**\n * Dependencies on a catalog that keep the old name whatever the catalog does: their field has the\n * new name too, so the rename is left (domain/dependency-map.ts).\n */\nfunction entriesInUse(manifests: readonly TreeMap[]): CatalogEntries {\n const inUse = new CatalogEntries();\n const fields = manifests.flatMap((manifest) =>\n DEPENDENCY_FIELDS.flatMap((field) => mapsAt(manifest, field)),\n );\n for (const dependencies of fields) {\n const entries = specEntries(dependencies);\n const names = new Set(entries.map((entry) => entry.name));\n for (const { name, spec } of entries) {\n const catalog = spec === undefined ? undefined : catalogOfSpec(spec.value);\n const to = PACKAGE_RENAMES.get(name);\n if (catalog !== undefined && to !== undefined && names.has(to)) {\n inUse.add(catalog, name);\n }\n }\n }\n return inUse;\n}\n\n/** The `key: value` texts below `node` at every depth: npm nests overrides by parent package. */\nfunction nestedTexts(node: TreeNode): { key: string; value: string }[] {\n if (node.kind !== \"map\") {\n return [];\n }\n return textEntries(node).flatMap(({ key, value }) =>\n value.kind === \"scalar\" ? [{ key: key.value, value: value.value }] : nestedTexts(value),\n );\n}\n\n/**\n * Adds the entries that overrides point at (`\"openapi-fetch\": \"catalog:\"` in `overrides`,\n * `resolutions` or `pnpm.overrides`). The tool reports overrides and leaves them as they are, so\n * the entry they use must keep its old name, or the install fails\n * (`ERR_PNPM_CATALOG_IN_OVERRIDES`).\n */\nfunction addOverrideUses(documents: readonly TreeMap[], inUse: CatalogEntries): void {\n const sections = documents.flatMap((document) =>\n OVERRIDE_FIELDS.flatMap((field) => valuesAt(document, field)),\n );\n for (const { key, value } of sections.flatMap(nestedTexts)) {\n const catalog = catalogOfSpec(value);\n const name = overrideTarget(key);\n if (catalog !== undefined && PACKAGE_RENAMES.has(name)) {\n inUse.add(catalog, name);\n }\n }\n}\n\n/**\n * The plan for the catalogs of a project, from all its manifests and catalog files. An entry with\n * an old name stays when its value is not one the tool edits (an alias, a flow map), or when a\n * dependency or an override keeps using it; then, unless the catalog has the new name too, the\n * dependencies on it keep the old name as well (dependency-map.ts makes both decisions by this\n * plan).\n */\nexport function planCatalogs({ manifests, catalogFiles }: CatalogDocuments): CatalogPlan {\n const inUse = entriesInUse(manifests);\n addOverrideUses([...manifests, ...catalogFiles], inUse);\n const kept = new CatalogEntries();\n const catalogs = [\n ...catalogFiles.flatMap((file) => catalogMaps(file)),\n ...manifests.flatMap(manifestCatalogMaps),\n ];\n for (const { name: catalog, map } of catalogs) {\n const entries = specEntries(map);\n const names = new Set(entries.map((entry) => entry.name));\n for (const { name, spec } of entries) {\n const to = PACKAGE_RENAMES.get(name);\n const stays = spec === undefined || inUse.has(catalog, name);\n if (to !== undefined && !names.has(to) && stays) {\n kept.add(catalog, name);\n }\n }\n }\n return { inUse, kept };\n}\n","import { mapsAt, type TreeMap, textEntries } from \"./config-documents.js\";\nimport type { ManualStep } from \"./migration-findings.js\";\nimport { DEPENDENCY_FIELDS, PACKAGE_RENAMES } from \"./package-names.js\";\n\n/**\n * What the manifests of a project declare, to tell whether a source file may import a package\n * without relying on another package to install it.\n */\n\n/**\n * One manifest of the project: its path in the listing and the names its dependency fields hold;\n * `names` is undefined when the manifest could not be read, and it then counts as declaring all.\n */\nexport interface ManifestDeclarations {\n readonly path: string;\n readonly names: ReadonlySet<string> | undefined;\n}\n\n/**\n * A package that an original package installed as its own dependency and its successor does not.\n * openapi-fetch and openapi-react-query depend on openapi-typescript-helpers, so code could import\n * it without a dependency of its own. openapi-typesafe-fetch declares the helper types itself and\n * the hooks name them through it, so nothing installs openapi-typesafe-helpers for such code.\n */\nexport const NO_LONGER_INSTALLED: ReadonlyMap<string, readonly string[]> = new Map([\n [\"openapi-typesafe-helpers\", [\"openapi-fetch\", \"openapi-react-query\"]],\n]);\n\n/** The original name of each successor package. */\nconst ORIGINAL_NAMES: ReadonlyMap<string, string> = new Map(\n [...PACKAGE_RENAMES].map(([original, successor]) => [successor, original]),\n);\n\nconst PATH_SEPARATOR = \"/\";\n\n/** Whether a manifest text can declare a package of NO_LONGER_INSTALLED, so it must be read. */\nexport function namesUninstalledPackage(text: string): boolean {\n return [...NO_LONGER_INSTALLED.keys()].some(\n (name) => text.includes(name) || text.includes(ORIGINAL_NAMES.get(name) ?? name),\n );\n}\n\nconst directoryOf = (path: string): string => path.slice(0, path.lastIndexOf(PATH_SEPARATOR) + 1);\n\n/** The names that the dependency fields of a parsed manifest hold. */\nexport function declaredNames(manifest: TreeMap): string[] {\n return DEPENDENCY_FIELDS.flatMap((field) => mapsAt(manifest, field))\n .flatMap(textEntries)\n .map(({ key }) => key.value);\n}\n\n/**\n * Whether a manifest at or above `filePath` declares `name`, under its old or its new name. Node\n * looks for a package in the `node_modules` folders of every directory above the file, so a\n * dependency of a workspace root counts for its packages. A file that no manifest contains is not\n * judged: it is not part of a package (a Deno module, a loose script).\n */\nfunction isDeclaredFor(\n manifests: readonly ManifestDeclarations[],\n filePath: string,\n name: string,\n): boolean {\n const original = ORIGINAL_NAMES.get(name);\n const containing = manifests.filter(({ path }) => filePath.startsWith(directoryOf(path)));\n const declares = ({ names }: ManifestDeclarations): boolean =>\n names === undefined || names.has(name) || (original !== undefined && names.has(original));\n return containing.length === 0 || containing.some(declares);\n}\n\n/** The package that a module specifier names: `pkg` of `pkg/subpath`. */\nconst packageOfSpecifier = (specifier: string): string => {\n const slash = specifier.indexOf(PATH_SEPARATOR);\n return slash === -1 ? specifier : specifier.slice(0, slash);\n};\n\n/** A module specifier of a source file, as the migration leaves it, and its line. */\nexport interface ImportedSpecifier {\n readonly specifier: string;\n readonly line: number;\n}\n\n/**\n * The imports of a source file, as the migration leaves them, of a package that no manifest or\n * import map at or above the file declares and that the original packages no longer install. An\n * import already renamed by an earlier run counts too, so a second run still reports it. A Deno\n * `npm:` specifier installs its package itself and is not a package name, so it is never reported.\n */\nexport function undeclaredImportSteps(\n imports: readonly ImportedSpecifier[],\n filePath: string,\n manifests: readonly ManifestDeclarations[],\n): ManualStep[] {\n return imports.flatMap(({ specifier, line }) => {\n const name = packageOfSpecifier(specifier);\n const installers = NO_LONGER_INSTALLED.get(name);\n return installers === undefined || isDeclaredFor(manifests, filePath, name)\n ? []\n : [{ kind: \"package-not-declared\", line, name, installers } as const];\n });\n}\n","/** Compile-time proof that a switch over a closed union handled every variant. */\nexport function assertNever(value: never): never {\n throw new Error(`Unexpected variant: ${JSON.stringify(value)}`);\n}\n","/**\n * The version spec a renamed dependency gets. A semver range keeps its style and gets the\n * openapi-typesafe version: `^` and `>=` give `^`, `~` gives `~`, an exact version stays exact,\n * and a partial version keeps what it fixes (`7` and `7.x` fix the major: `^`; `0.13` and\n * `0.13.x` fix the minor: `~`). A range of several comparators takes the style of its first one.\n * `catalog:` and `workspace:` stay, because they point elsewhere; anything else (a tag, `*`, an\n * upper bound only, a URL, a file or an npm alias) is kept and reported.\n */\n\nconst KEPT_PROTOCOLS = [\"catalog:\", \"workspace:\"] as const;\nconst RANGE_SEPARATOR = \"||\";\nconst HYPHEN = \"-\";\nconst WHITE_SPACE_RE = /\\s+/;\n/** node-semver allows white space between an operator and its version: `>= 1.2.3`. */\nconst SPACED_OPERATOR_RE = /(<=|>=|<|>|=|~>|~|\\^)\\s+/g;\nconst OPERATOR = String.raw`(<=|>=|<|>|=|~>|~|\\^)?`;\nconst VERSION_PART = String.raw`(\\d+|[xX*])`;\nconst LABELS = String.raw`(?:-[\\w.-]+)?(?:\\+[\\w.-]+)?`;\n/** A comparator: an operator, then a version whose parts can be `x` or `*` or left out. */\nconst COMPARATOR_RE = new RegExp(\n String.raw`^${OPERATOR}v?${VERSION_PART}(?:\\.${VERSION_PART})?(?:\\.${VERSION_PART})?${LABELS}$`,\n);\nconst NUMBER_RE = /^\\d+$/;\n\n/** The style a replaced spec keeps: `^`, `~` or exact (no operator). */\ntype RangeStyle = \"^\" | \"~\" | \"\";\n\nconst OPERATOR_STYLES: Readonly<Record<string, RangeStyle | undefined>> = {\n \"^\": \"^\",\n // `>=` means \"this or newer\"; with a new package line, a caret range says the same safely.\n \">=\": \"^\",\n \">\": \"^\",\n \"~\": \"~\",\n \"~>\": \"~\",\n};\n\nexport type SpecDecision =\n | { readonly kind: \"replaced\"; readonly spec: string }\n | { readonly kind: \"kept\"; readonly spec: string; readonly isReported: boolean };\n\nconst isNumber = (part: string | undefined): boolean => part !== undefined && NUMBER_RE.test(part);\n\n/** The style of a comparator without an operator (or `=`), by the parts it fixes. */\nfunction versionStyle(\n major: string | undefined,\n minor: string | undefined,\n patch: string | undefined,\n): RangeStyle | undefined {\n if (!isNumber(major)) {\n return undefined;\n }\n if (isNumber(minor) && isNumber(patch)) {\n return \"\";\n }\n return isNumber(minor) ? \"~\" : \"^\";\n}\n\n/** The style of the first comparator of a range, or undefined when the spec is not a range. */\nfunction rangeStyle(spec: string): RangeStyle | undefined {\n const sets = spec.replace(SPACED_OPERATOR_RE, \"$1\").split(RANGE_SEPARATOR);\n const tokens = sets.map((set) => set.trim().split(WHITE_SPACE_RE));\n const comparators = tokens.flat().filter((token) => token !== HYPHEN);\n const matches = comparators.map((comparator) => COMPARATOR_RE.exec(comparator));\n const first = matches[0];\n if (first === undefined || first === null || matches.includes(null)) {\n return undefined;\n }\n const operator = first[1];\n // `1.2.3 - 2.0.0` is `>=1.2.3 <=2.0.0`: a lower bound, as `>=` is.\n const isHyphenRange = tokens[0]?.[1] === HYPHEN;\n if (operator !== undefined && operator !== \"=\") {\n return OPERATOR_STYLES[operator];\n }\n return isHyphenRange ? \"^\" : versionStyle(first[2], first[3], first[4]);\n}\n\n/** 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 = rangeStyle(spec);\n if (style === undefined) {\n return { kind: \"kept\", spec, isReported: true };\n }\n return { kind: \"replaced\", spec: `${style}${version}` };\n}\n","import { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { migrateVersionSpec } from \"./version-spec.js\";\n\n/**\n * `npm:` specs name a package from the registry under another name: an alias in package.json\n * (`\"my-fetch\": \"npm:openapi-fetch@^0.13\"`), and the npm specifiers of Deno (in `deno.json`\n * imports and in sources: `npm:openapi-fetch@0.13/path`, `npm:/openapi-fetch@0.13/`). The package\n * in them is renamed like any other, and the range gets the openapi-typesafe version.\n */\n\nconst NPM_PROTOCOL = \"npm:\";\nconst SCOPE_PREFIX = \"@\";\nconst PATH_SEPARATOR = \"/\";\nconst VERSION_SEPARATOR = \"@\";\n\n/** The parts of `npm:[/]<name>[@<range>][/<path>]`; `rest` is the `/<path>` after the range. */\ninterface NpmSpec {\n readonly lead: string;\n readonly name: string;\n readonly range: string | undefined;\n readonly rest: string;\n}\n\n/** The end of the package name in `text`: a scoped name has one `/` inside. */\nfunction nameEnd(text: string): number {\n const searchFrom = text.startsWith(SCOPE_PREFIX) ? text.indexOf(PATH_SEPARATOR) + 1 : 0;\n const ends = [VERSION_SEPARATOR, PATH_SEPARATOR]\n .map((separator) => text.indexOf(separator, Math.max(searchFrom, 1)))\n .filter((index) => index !== -1);\n return ends.length === 0 ? text.length : Math.min(...ends);\n}\n\nfunction parseNpmSpec(spec: string): NpmSpec | undefined {\n if (!spec.startsWith(NPM_PROTOCOL)) {\n return undefined;\n }\n const body = spec.slice(NPM_PROTOCOL.length);\n const lead = body.startsWith(PATH_SEPARATOR) ? PATH_SEPARATOR : \"\";\n const text = body.slice(lead.length);\n const end = nameEnd(text);\n const name = text.slice(0, end);\n if (!text.startsWith(VERSION_SEPARATOR, end)) {\n return { lead, name, range: undefined, rest: text.slice(end) };\n }\n const rangeEnd = text.indexOf(PATH_SEPARATOR, end);\n const restStart = rangeEnd === -1 ? text.length : rangeEnd;\n return { lead, name, range: text.slice(end + 1, restStart), rest: text.slice(restStart) };\n}\n\n/**\n * An `npm:` spec of an original package, renamed. `isReported` when its range was kept;\n * `isDeep` when it reaches into the package (`npm:openapi-fetch@0.13/dist/index.js`).\n */\nexport interface MigratedNpmSpec {\n readonly spec: string;\n readonly isReported: boolean;\n readonly isDeep: boolean;\n}\n\n/**\n * The `npm:` spec with the openapi-typesafe package and version, or undefined when `spec` is not\n * an `npm:` spec of an original package. A spec without a range keeps none; a range that is not\n * a semver range (a tag) is kept and reported.\n */\nexport function migrateNpmSpec(spec: string, version: string): MigratedNpmSpec | undefined {\n const parsed = parseNpmSpec(spec);\n const renamed = parsed === undefined ? undefined : PACKAGE_RENAMES.get(parsed.name);\n if (parsed === undefined || renamed === undefined) {\n return undefined;\n }\n const head = `${NPM_PROTOCOL}${parsed.lead}${renamed}`;\n const isDeep = parsed.rest !== \"\" && parsed.rest !== PATH_SEPARATOR;\n if (parsed.range === undefined) {\n return { spec: `${head}${parsed.rest}`, isReported: false, isDeep };\n }\n const decision = migrateVersionSpec(parsed.range, version);\n const isReported = decision.kind === \"kept\" && decision.isReported;\n const migrated = `${head}${VERSION_SEPARATOR}${decision.spec}${parsed.rest}`;\n return { spec: migrated, isReported, isDeep };\n}\n","/**\n * Credentials in URLs (`https://user:password@host`, `git+https://token@host`) that the findings\n * would copy into the report and the log. The project files keep them; only the findings hide\n * them, because a CI log or a temporary log file is a new place for a secret.\n */\n\nconst SCHEME_SEPARATOR = \"://\";\nconst HIDDEN_USERINFO = \"***\";\nconst USERINFO_END = \"@\";\n/** The authority of a URL ends at a path, a query, a fragment, a quote or white space. */\nconst AUTHORITY_END_RE = /[/?#\"'`\\s]/;\n\n/** The index where the authority that starts at `start` ends, and its last `@` (or -1). */\nfunction scanAuthority(text: string, start: number): { end: number; userinfoEnd: number } {\n let userinfoEnd = -1;\n let end = start;\n for (; end < text.length && !AUTHORITY_END_RE.test(text.charAt(end)); end++) {\n if (text.charAt(end) === USERINFO_END) {\n userinfoEnd = end;\n }\n }\n return { end, userinfoEnd };\n}\n\n/** `text` with the userinfo of every URL in it replaced by `***`. Linear in the text length. */\nexport function hideUrlCredentials(text: string): string {\n let hidden = \"\";\n let copiedUpTo = 0;\n for (let found = text.indexOf(SCHEME_SEPARATOR); found !== -1; ) {\n const start = found + SCHEME_SEPARATOR.length;\n const { end, userinfoEnd } = scanAuthority(text, start);\n if (userinfoEnd !== -1) {\n hidden += `${text.slice(copiedUpTo, start)}${HIDDEN_USERINFO}`;\n copiedUpTo = userinfoEnd;\n }\n found = text.indexOf(SCHEME_SEPARATOR, end);\n }\n return `${hidden}${text.slice(copiedUpTo)}`;\n}\n","import { assertNever } from \"./assert-never.js\";\nimport { type CatalogPlan, catalogOfSpec } from \"./catalog-plan.js\";\nimport type { Change, ManualStep } from \"./migration-findings.js\";\nimport { migrateNpmSpec } from \"./npm-alias.js\";\nimport { PACKAGE_RENAMES, renamedSpecifier } from \"./package-names.js\";\nimport type { TextEdit } from \"./text-edits.js\";\nimport { hideUrlCredentials } from \"./url-credentials.js\";\nimport { migrateVersionSpec } from \"./version-spec.js\";\n\n/**\n * Maps of package names: dependency fields and catalogs (`name: spec`), and lists or keys that\n * only name a package (`peerDependenciesMeta`, `bundleDependencies`). The file formats (JSON and\n * YAML) give their entries with edits that keep the format's quoting; the decisions are here, so\n * every format renames the same way.\n */\n\n/** The string value of an entry, and the edit that replaces it. */\nexport interface SpecValue {\n readonly value: string;\n readonly replace: (spec: string) => TextEdit;\n}\n\n/** One `name: spec` entry. `spec` is undefined when the value is not a string. */\nexport interface SpecEntry {\n readonly name: string;\n readonly spec: SpecValue | undefined;\n readonly renameKey: (name: string) => TextEdit;\n}\n\n/** One place that only names a package: a key of a meta field, an item of a list. */\nexport interface NameEntry {\n readonly name: string;\n readonly rename: (name: string) => TextEdit;\n}\n\n/** The edits a file gets, and what the migration found while making them. */\nexport interface Findings {\n readonly edits: TextEdit[];\n readonly changes: Change[];\n readonly manualSteps: ManualStep[];\n}\n\nexport const newFindings = (): Findings => ({ edits: [], changes: [], manualSteps: [] });\n\n/**\n * A dependency field (`dependencies`, …), a catalog (`catalog`, `catalogs.legacy`, …), or an\n * import map (Deno's `imports` and `scopes`), whose keys are module specifiers: a package name, a\n * subpath of it or a prefix (`openapi-fetch/`).\n */\nexport type SpecMap =\n | { readonly kind: \"dependencies\"; readonly field: string }\n | {\n readonly kind: \"catalog\";\n /** Where the catalog is in its file (`catalogs.legacy`), for the report. */\n readonly catalog: string;\n /** The name that `catalog:<name>` gives it (`default` for `catalog:`). */\n readonly name: string;\n }\n | { readonly kind: \"imports\"; readonly field: string };\n\n/** What renamed entries get: the version of the tool, and the plan of the project's catalogs. */\nexport interface RenameTarget {\n readonly version: string;\n readonly catalogs: CatalogPlan;\n}\n\n/** Where a map is, the version renamed entries get, and where the findings go. */\nexport interface MapContext {\n readonly map: SpecMap;\n readonly version: string;\n readonly findings: Findings;\n /** What the project's catalogs keep under the old names (domain/catalogs.ts). */\n readonly catalogs: CatalogPlan;\n}\n\nconst PEER_FIELD = \"peerDependencies\";\n\nconst mapLabel = (map: SpecMap): string => (map.kind === \"catalog\" ? map.catalog : map.field);\n\n/** The new key of an entry of `map`, or undefined when it names no original package. */\nconst renamedKey = (name: string, map: SpecMap): string | undefined =>\n map.kind === \"imports\" ? renamedSpecifier(name)?.to : PACKAGE_RENAMES.get(name);\n\n/** The spec a renamed entry gets; `isReported` when it was kept because it is not a range. */\nfunction migrateSpec(spec: string, version: string): { spec: string; isReported: boolean } {\n const npm = migrateNpmSpec(spec, version);\n if (npm !== undefined) {\n return { spec: npm.spec, isReported: npm.isReported };\n }\n const decision = migrateVersionSpec(spec, version);\n return { spec: decision.spec, isReported: decision.kind === \"kept\" && decision.isReported };\n}\n\n/** A rename of one key or name, where it is, and the other names of that place. */\ninterface Rename {\n readonly from: string;\n readonly to: string;\n readonly field: string;\n readonly names: ReadonlySet<string>;\n}\n\n/**\n * Whether the rename can be made: not when the place already has the new name too. Renaming then\n * would give a map the same key twice, and one entry would be lost without a word (finding\n * M10), so the old entry is left and reported.\n */\nfunction isFree({ from, to, field, names }: Rename, findings: Findings): boolean {\n if (names.has(to)) {\n findings.manualSteps.push({ kind: \"name-collision\", field, from, to });\n return false;\n }\n return true;\n}\n\n/** An entry under another name whose spec is an `npm:` alias of an original package. */\nfunction migrateAlias(entry: SpecEntry, { map, version, findings }: MapContext): void {\n const migrated = entry.spec === undefined ? undefined : migrateNpmSpec(entry.spec.value, version);\n if (entry.spec === undefined || migrated === undefined) {\n return;\n }\n findings.edits.push(entry.spec.replace(migrated.spec));\n const spec = hideUrlCredentials(migrated.spec);\n findings.changes.push({ kind: \"alias-renamed\", field: mapLabel(map), name: entry.name, spec });\n if (migrated.isReported) {\n findings.manualSteps.push({ kind: \"spec-kept\", name: entry.name, spec });\n }\n}\n\nfunction renamedChange(map: SpecMap, from: string, to: string, spec: string): Change {\n switch (map.kind) {\n case \"dependencies\":\n return { kind: \"dependency-renamed\", field: map.field, from, to, spec };\n case \"catalog\":\n return { kind: \"catalog-entry-renamed\", catalog: map.catalog, from, to, spec };\n case \"imports\":\n return { kind: \"import-renamed\", field: map.field, from, to, target: spec };\n default:\n return assertNever(map);\n }\n}\n\nfunction migrateEntry(\n entry: SpecEntry,\n spec: SpecValue,\n to: string,\n { map, version, findings }: MapContext,\n): void {\n const old = spec.value;\n const migrated = migrateSpec(old, version);\n findings.edits.push(entry.renameKey(to));\n if (migrated.spec !== old) {\n findings.edits.push(spec.replace(migrated.spec));\n }\n findings.changes.push(renamedChange(map, entry.name, to, hideUrlCredentials(migrated.spec)));\n if (migrated.isReported) {\n findings.manualSteps.push({ kind: \"spec-kept\", name: to, spec: hideUrlCredentials(old) });\n }\n if (map.kind === \"dependencies\" && map.field === PEER_FIELD) {\n findings.manualSteps.push({ kind: \"peer-dependency-renamed\", name: to });\n }\n}\n\n/**\n * Why an entry keeps its old name to stay in step with a catalog, or undefined. A dependency on a\n * catalog entry that stays keeps the name it points at; a catalog entry that a dependency keeps\n * using stays too, so `catalog:` never points at a name the catalog does not have.\n */\nfunction catalogHold(entry: SpecEntry, spec: SpecValue, { map, catalogs }: MapContext) {\n if (map.kind === \"catalog\") {\n const isInUse = catalogs.inUse.has(map.name, entry.name);\n return isInUse\n ? ({ kind: \"catalog-entry-in-use\", catalog: map.catalog, name: entry.name } as const)\n : undefined;\n }\n const catalog = map.kind === \"dependencies\" ? catalogOfSpec(spec.value) : undefined;\n return catalog !== undefined && catalogs.kept.has(catalog, entry.name)\n ? ({ kind: \"catalog-reference-kept\", field: map.field, name: entry.name, catalog } as const)\n : undefined;\n}\n\n/**\n * Rename the original packages of a dependency field or catalog, in place, with `version` as\n * the new version, and retarget `npm:` aliases of them. An entry whose value is not a string (a\n * YAML anchor or flow value) is not one the tool understands: it is left and reported.\n */\nexport function migrateSpecMap(entries: readonly SpecEntry[], context: MapContext): void {\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of entries) {\n const to = renamedKey(entry.name, context.map);\n const field = mapLabel(context.map);\n if (to === undefined) {\n migrateAlias(entry, context);\n continue;\n }\n if (!isFree({ from: entry.name, to, field, names }, context.findings)) {\n continue;\n }\n const hold = entry.spec === undefined ? undefined : catalogHold(entry, entry.spec, context);\n if (entry.spec === undefined) {\n context.findings.manualSteps.push({ kind: \"entry-not-edited\", field, name: entry.name });\n } else if (hold !== undefined) {\n context.findings.manualSteps.push(hold);\n } else {\n migrateEntry(entry, entry.spec, to, context);\n }\n }\n}\n\n/** Rename the original packages where `field` only names them. */\nexport function renameNames(\n entries: readonly NameEntry[],\n field: string,\n findings: Findings,\n): void {\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of entries) {\n const to = PACKAGE_RENAMES.get(entry.name);\n if (to !== undefined && isFree({ from: entry.name, to, field, names }, findings)) {\n findings.edits.push(entry.rename(to));\n findings.changes.push({\n kind: \"package-name-renamed\",\n location: field,\n from: entry.name,\n to,\n });\n }\n }\n}\n","// Import maps point at no catalog, so no catalog plan applies to them.\nimport { NO_CATALOG_PLAN } from \"./catalog-plan.js\";\nimport {\n type DocumentRead,\n isMap,\n mapsAt,\n type TreeMap,\n textEntries,\n unreadableConfig,\n} from \"./config-documents.js\";\nimport { type Findings, migrateSpecMap, newFindings } from \"./dependency-map.js\";\nimport type { FileMigration } from \"./migration-findings.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { specEntries } from \"./tree-entries.js\";\n\n/**\n * Deno import maps: the `imports` and `scopes` of `deno.json` / `deno.jsonc`, and of a separate\n * `import_map.json`. Sources import the keys, and the migration renames the packages in sources,\n * so a key that names an original package (`openapi-fetch`, `openapi-fetch/`) gets the new name\n * too, and an `npm:` value gets the new package and version. A value it cannot replace (a URL) is\n * kept and reported. Deno reads these files as JSONC; they are edited in place\n * (domain/config-documents.ts).\n */\n\nconst IMPORTS_FIELD = \"imports\";\nconst SCOPES_FIELD = \"scopes\";\nconst FIELD_SEPARATOR = \".\";\n\nfunction migrateImports(config: TreeMap, version: string, findings: Findings): void {\n for (const imports of mapsAt(config, IMPORTS_FIELD)) {\n const map = { kind: \"imports\", field: IMPORTS_FIELD } as const;\n migrateSpecMap(specEntries(imports), { map, version, findings, catalogs: NO_CATALOG_PLAN });\n }\n for (const scopes of mapsAt(config, SCOPES_FIELD)) {\n for (const { key, value } of textEntries(scopes)) {\n if (isMap(value)) {\n const field = [SCOPES_FIELD, key.value].join(FIELD_SEPARATOR);\n const map = { kind: \"imports\", field } as const;\n migrateSpecMap(specEntries(value), { map, version, findings, catalogs: NO_CATALOG_PLAN });\n }\n }\n }\n}\n\nconst PATH_SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\n\n/** The keys of an import map, the module specifiers it maps. */\nfunction importMapKeys(config: TreeMap): string[] {\n const scoped = mapsAt(config, SCOPES_FIELD)\n .flatMap(textEntries)\n .flatMap(({ value }) => (isMap(value) ? [value] : []));\n return [...mapsAt(config, IMPORTS_FIELD), ...scoped]\n .flatMap(textEntries)\n .map(({ key }) => key.value);\n}\n\n/**\n * The package names that an import map declares for the sources that use it: `pkg` of the keys\n * `pkg`, `pkg/` and `pkg/subpath`, and `@scope/pkg` of scoped keys. Deno resolves a bare import\n * through the map, so such a package needs no `package.json` entry.\n */\nexport function importMapNames(config: TreeMap): string[] {\n return importMapKeys(config).map((key) => {\n const parts = key.split(PATH_SEPARATOR);\n return key.startsWith(SCOPE_PREFIX)\n ? parts.slice(0, 2).join(PATH_SEPARATOR)\n : (parts[0] ?? key);\n });\n}\n\n/** Migrate the import map of a Deno config or import map file (`read` is `text` parsed). */\nexport function migrateImportMap(text: string, read: DocumentRead, version: string): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const config of read.documents.filter(isMap)) {\n migrateImports(config, version, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","/**\n * The programs that run another program or install packages, so the migration can tell the\n * generator command and package names from the words of other commands. `docker run -it` keeps\n * its flag, `npm run openapi-typescript` names a script, and `npm i openapi-fetch` a package.\n */\n\n/** A program that runs the program named by its first argument that is not an option. */\nexport interface Launcher {\n /** The words that start it: `npx`, or `pnpm dlx`. */\n readonly words: readonly string[];\n /** Options whose value is the next word, so that word is not the program. */\n readonly valueOptions: ReadonlySet<string>;\n /** Options whose value is a package to install first (`npx -p <package>`). */\n readonly packageOptions: ReadonlySet<string>;\n /** Arguments before the program that are not options: the image of `docker run <image>`. */\n readonly operands: number;\n}\n\nconst NONE: ReadonlySet<string> = new Set();\n/** `npx -p`, `pnpm dlx --package`, `yarn dlx -p`, `bunx -p`. */\nconst PACKAGE_OPTIONS: ReadonlySet<string> = new Set([\"-p\", \"--package\"]);\n/** Options of npm, pnpm and yarn that take a value and may come before the subcommand. */\nconst PACKAGE_MANAGER_OPTIONS: ReadonlySet<string> = new Set([\n \"--filter\",\n \"-F\",\n \"--dir\",\n \"-C\",\n \"--prefix\",\n \"--cwd\",\n \"--workspace\",\n]);\n\nconst launcher = (\n words: readonly string[],\n packageOptions: ReadonlySet<string> = NONE,\n valueOptions: ReadonlySet<string> = NONE,\n): Launcher => {\n const allValueOptions = new Set([...valueOptions, ...packageOptions]);\n return { words, packageOptions, valueOptions: allValueOptions, operands: 0 };\n};\n\n/** Options of `docker run` and `docker exec` that take a value. */\nconst CONTAINER_OPTIONS: ReadonlySet<string> = new Set([\n \"-e\",\n \"--env\",\n \"--env-file\",\n \"-v\",\n \"--volume\",\n \"--mount\",\n \"-p\",\n \"--publish\",\n \"-w\",\n \"--workdir\",\n \"-u\",\n \"--user\",\n \"--name\",\n \"--network\",\n \"--entrypoint\",\n \"--platform\",\n \"-l\",\n \"--label\",\n \"-h\",\n \"--hostname\",\n \"--add-host\",\n]);\n\n/** `docker run <image> <command>`: the image comes first, then the command run in it. */\nconst container = (words: readonly string[]): Launcher => ({\n ...launcher(words, NONE, CONTAINER_OPTIONS),\n operands: 1,\n});\n\n/**\n * The launchers, longest first, so `pnpm dlx` wins over `pnpm`. A bare `pnpm <name>` or\n * `yarn <name>` runs the binary `<name>` when no script has that name; `run` names a script.\n */\nexport const LAUNCHERS: readonly Launcher[] = [\n launcher([\"npm\", \"exec\"], PACKAGE_OPTIONS),\n launcher([\"npm\", \"x\"], PACKAGE_OPTIONS),\n launcher([\"pnpm\", \"exec\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"pnpm\", \"dlx\"], new Set([\"--package\"])),\n launcher([\"yarn\", \"dlx\"], PACKAGE_OPTIONS),\n launcher([\"yarn\", \"exec\"]),\n launcher([\"bun\", \"x\"], PACKAGE_OPTIONS),\n launcher([\"deno\", \"run\"], NONE, new Set([\"--config\", \"-c\", \"--import-map\", \"--location\"])),\n launcher([\"deno\", \"x\"]),\n launcher([\"npx\"], PACKAGE_OPTIONS, new Set([\"-c\", \"--call\"])),\n launcher([\"pnpx\"], PACKAGE_OPTIONS),\n launcher([\"bunx\"], PACKAGE_OPTIONS),\n launcher([\"pnpm\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"yarn\"], NONE, PACKAGE_MANAGER_OPTIONS),\n launcher([\"node\"], NONE, new Set([\"-r\", \"--require\", \"--import\", \"--loader\", \"--env-file\"])),\n launcher([\"cross-env\"]),\n launcher([\"dotenv\"], NONE, new Set([\"-e\", \"-c\", \"-v\"])),\n launcher([\"env\"], NONE, new Set([\"-u\", \"--unset\", \"-C\", \"--chdir\"])),\n launcher([\"exec\"]),\n launcher([\"time\"]),\n launcher([\"nohup\"]),\n launcher([\"sudo\"], NONE, new Set([\"-u\", \"-g\"])),\n // The shell form of Dockerfile instructions runs the rest of the line in a shell.\n launcher([\"RUN\"], NONE, new Set([\"--mount\", \"--network\", \"--security\"])),\n launcher([\"CMD\"]),\n launcher([\"ENTRYPOINT\"]),\n container([\"docker\", \"run\"]),\n container([\"docker\", \"exec\"]),\n container([\"docker\", \"compose\", \"run\"]),\n container([\"docker\", \"compose\", \"exec\"]),\n container([\"podman\", \"run\"]),\n container([\"podman\", \"exec\"]),\n];\n\n/** A subcommand that installs, updates or removes the packages named by its other arguments. */\nexport interface Installer {\n readonly words: readonly string[];\n}\n\nconst installers = (manager: string, subcommands: readonly string[]): Installer[] =>\n subcommands.map((subcommand) => ({ words: [manager, subcommand] }));\n\nconst NPM_INSTALL = [\"install\", \"i\", \"add\", \"update\", \"up\", \"uninstall\", \"remove\", \"rm\", \"un\"];\n\nexport const INSTALLERS: readonly Installer[] = [\n ...installers(\"npm\", NPM_INSTALL),\n ...installers(\"pnpm\", [\"add\", \"update\", \"up\", \"remove\", \"rm\", \"uninstall\", \"un\"]),\n ...installers(\"yarn\", [\"add\", \"upgrade\", \"up\", \"remove\"]),\n ...installers(\"bun\", [\"add\", \"a\", \"update\", \"remove\", \"rm\", \"install\", \"i\"]),\n ...installers(\"deno\", [\"add\", \"install\", \"i\", \"remove\", \"uninstall\"]),\n];\n\n/** `npm:` names a package in Deno commands (`deno run npm:openapi-typescript`). */\nexport const NPM_SPECIFIER_PREFIX = \"npm:\";\n","import { INSTALLERS, LAUNCHERS, type Launcher } from \"./command-launchers.js\";\nimport type { ShellCommand, ShellWord } from \"./shell-words.js\";\n\n/**\n * What the words of one shell command are: which word is the program it runs, after launchers\n * such as `npx`, `pnpm exec`, `cross-env` or `node`, and which words name packages to install.\n * The other words are arguments of whichever program owns them, and are never renamed for it.\n */\n\n/** A word that names a package, and the package part of it (`--package=x` names `x`). */\nexport interface PackageWord {\n readonly word: ShellWord;\n readonly value: string;\n}\n\nexport interface CommandRoles {\n /** The index of the program's word, or undefined for an install or an empty command. */\n readonly program: number | undefined;\n readonly packages: readonly PackageWord[];\n}\n\nconst ASSIGNMENT_RE = /^[A-Za-z_][A-Za-z0-9_]*=/;\nconst END_OF_OPTIONS = \"--\";\n\nconst isOption = (word: ShellWord): boolean => word.value.startsWith(\"-\") && word.value.length > 1;\n\n/** The first word after the `NAME=value` assignments that may start a command. */\nfunction skipAssignments(words: ShellCommand, start: number): number {\n let index = start;\n while (index < words.length && ASSIGNMENT_RE.test((words[index] as ShellWord).raw)) {\n index++;\n }\n return index;\n}\n\n/** The first entry whose words start the command at `index`. */\nfunction matchingPrefix<T extends { readonly words: readonly string[] }>(\n entries: readonly T[],\n words: ShellCommand,\n index: number,\n): T | undefined {\n return entries.find((entry) =>\n entry.words.every((name, offset) => words[index + offset]?.value === name),\n );\n}\n\n/** An option with its value in the same word (`--package=x`): the package it names, if any. */\nfunction inlineOptionPackage(word: ShellWord, launcher: Launcher): PackageWord | undefined {\n const equals = word.value.indexOf(\"=\");\n const name = word.value.slice(0, equals);\n return launcher.packageOptions.has(name)\n ? { word, value: word.value.slice(equals + 1) }\n : undefined;\n}\n\n/**\n * The index of the program a launcher runs: the first word after its options. Options that take\n * a value skip it, and the values of package options are collected into `packages`.\n */\nfunction launchedProgram(\n words: ShellCommand,\n start: number,\n launcher: Launcher,\n packages: PackageWord[],\n): number {\n let index = start;\n while (index < words.length && isOption(words[index] as ShellWord)) {\n const option = words[index++] as ShellWord;\n if (option.value === END_OF_OPTIONS) {\n break;\n }\n const inline = option.value.includes(\"=\") ? inlineOptionPackage(option, launcher) : undefined;\n if (inline !== undefined) {\n packages.push(inline);\n }\n const value = words[index];\n if (!option.value.includes(\"=\") && launcher.valueOptions.has(option.value) && value) {\n if (launcher.packageOptions.has(option.value)) {\n packages.push({ word: value, value: value.value });\n }\n index++;\n }\n }\n return index;\n}\n\n/** The package arguments of an install command: every word that is not an option. */\nconst installArguments = (words: ShellCommand, start: number): PackageWord[] =>\n words\n .slice(start)\n .filter((word) => !isOption(word))\n .map((word) => ({ word, value: word.value }));\n\n/** The roles of the words of one simple command. */\nexport function commandRoles(words: ShellCommand): CommandRoles {\n const packages: PackageWord[] = [];\n let index = skipAssignments(words, 0);\n while (index < words.length) {\n const installer = matchingPrefix(INSTALLERS, words, index);\n if (installer !== undefined) {\n packages.push(...installArguments(words, index + installer.words.length));\n return { program: undefined, packages };\n }\n const launcher = matchingPrefix(LAUNCHERS, words, index);\n if (launcher === undefined) {\n return { program: index, packages };\n }\n const start = index + launcher.words.length;\n const afterOptions = launchedProgram(words, start, launcher, packages);\n index = skipAssignments(words, afterOptions + launcher.operands);\n }\n return { program: undefined, packages };\n}\n","/**\n * Splits shell text (a package.json script, a line of a shell script, Makefile or CI step) into\n * simple commands, each a list of words with their offsets. It follows the POSIX shell rules that\n * decide where a word and a command end: quotes, backslash escapes, line continuations, comments\n * and the control operators. It does not expand anything, so it never runs or guesses a value.\n */\n\n/** One word of a command. `start` and `end` are offsets of the word as written, quotes included. */\nexport interface ShellWord {\n readonly start: number;\n readonly end: number;\n /** The word after quote removal: `\"a b\"` is `a b`. */\n readonly value: string;\n /** The word as written: `\"a b\"` is `\"a b\"`. */\n readonly raw: string;\n}\n\n/** A simple command: the words between two control operators. */\nexport type ShellCommand = readonly ShellWord[];\n\n/** Characters that end a command: `;`, `&`, `|`, subshells and command substitution. */\nconst COMMAND_SEPARATORS: ReadonlySet<string> = new Set([\";\", \"&\", \"|\", \"(\", \")\", \"`\", \"\\n\"]);\n/** Characters that end a word without ending the command: blanks and redirections. */\nconst WORD_BREAKS: ReadonlySet<string> = new Set([\" \", \"\\t\", \"\\r\", \"<\", \">\"]);\nconst BACKSLASH = \"\\\\\";\nconst COMMENT = \"#\";\n/** Inside double quotes a backslash escapes only these characters (POSIX 2.2.3). */\nconst DOUBLE_QUOTE_ESCAPES: ReadonlySet<string> = new Set([\"$\", \"`\", '\"', BACKSLASH, \"\\n\"]);\n\n/** A quoted part of a word: where it ends (after the closing quote) and its value. */\ninterface QuotedPart {\n readonly end: number;\n readonly value: string;\n}\n\n/** A single-quoted part starting at `start`: everything up to the next `'` is literal. */\nfunction singleQuoted(text: string, start: number): QuotedPart {\n const close = text.indexOf(\"'\", start + 1);\n const end = close === -1 ? text.length : close + 1;\n return { end, value: text.slice(start + 1, close === -1 ? text.length : close) };\n}\n\n/** A double-quoted part starting at `start`, with its backslash escapes resolved. */\nfunction doubleQuoted(text: string, start: number): QuotedPart {\n let value = \"\";\n let index = start + 1;\n while (index < text.length && text[index] !== '\"') {\n const next = text[index + 1] ?? \"\";\n const isEscape = text[index] === BACKSLASH && DOUBLE_QUOTE_ESCAPES.has(next);\n value += isEscape ? (next === \"\\n\" ? \"\" : next) : text[index];\n index += isEscape ? 2 : 1;\n }\n return { end: Math.min(index + 1, text.length), value };\n}\n\nconst isLineContinuation = (text: string, index: number): boolean =>\n text[index] === BACKSLASH && (text[index + 1] === \"\\n\" || text.startsWith(\"\\r\\n\", index + 1));\n\n/** The part of a word that starts at `index`: a quoted string, an escape or one character. */\nfunction wordPart(text: string, index: number): QuotedPart {\n const char = text[index] as string;\n if (char === \"'\") {\n return singleQuoted(text, index);\n }\n if (char === '\"') {\n return doubleQuoted(text, index);\n }\n if (char === BACKSLASH && index + 1 < text.length) {\n return { end: index + 2, value: text[index + 1] as string };\n }\n return { end: index + 1, value: char };\n}\n\nconst endsWord = (text: string, index: number): boolean => {\n const char = text[index] as string;\n return WORD_BREAKS.has(char) || COMMAND_SEPARATORS.has(char) || isLineContinuation(text, index);\n};\n\n/** The word that starts at `start` (not a blank, separator or comment). */\nfunction readWord(text: string, start: number): ShellWord {\n let value = \"\";\n let index = start;\n while (index < text.length && !endsWord(text, index)) {\n const part = wordPart(text, index);\n value += part.value;\n index = part.end;\n }\n return { start, end: index, value, raw: text.slice(start, index) };\n}\n\n/** Where the blank, continuation or comment at `index` ends, or `index` if there is none. */\nfunction skipTrivia(text: string, index: number): number {\n const char = text[index] as string;\n if (WORD_BREAKS.has(char)) {\n return index + 1;\n }\n if (isLineContinuation(text, index)) {\n return text.indexOf(\"\\n\", index) + 1;\n }\n if (char === COMMENT) {\n const lineEnd = text.indexOf(\"\\n\", index);\n return lineEnd === -1 ? text.length : lineEnd;\n }\n return index;\n}\n\n/** The commands of `text`, in order, without nested ones. */\nfunction topLevelCommands(text: string): ShellWord[][] {\n const commands: ShellWord[][] = [[]];\n let index = 0;\n while (index < text.length) {\n const afterTrivia = skipTrivia(text, index);\n if (afterTrivia !== index) {\n index = afterTrivia;\n } else if (COMMAND_SEPARATORS.has(text[index] as string)) {\n commands.push([]);\n index++;\n } else {\n const word = readWord(text, index);\n commands.at(-1)?.push(word);\n index = word.end;\n }\n }\n return commands.filter((words) => words.length > 0);\n}\n\n/**\n * Reserved words (POSIX 2.4, and bash's `[[`) that open or close a compound command and are\n * followed by a command: `if a; then b; fi`, `while a; do b; done`, `! a`, `{ a; }`. They are\n * reserved only where a command name can stand, and only unquoted, so `echo then` and `\"if\"` stay\n * words. `time` is a launcher (domain/command-launchers.ts), as it takes options.\n */\nconst COMMAND_PREFIX_WORDS: ReadonlySet<string> = new Set([\n \"if\",\n \"then\",\n \"elif\",\n \"else\",\n \"fi\",\n \"while\",\n \"until\",\n \"do\",\n \"done\",\n \"!\",\n \"{\",\n \"}\",\n \"esac\",\n]);\n/**\n * Reserved words whose words up to the next separator are not a command: `for NAME in WORDS`,\n * `select NAME in WORDS`, `case WORD in`, and a `[[ … ]]` test.\n */\nconst CLAUSE_WORDS: ReadonlySet<string> = new Set([\"for\", \"select\", \"case\", \"[[\"]);\n/** `function NAME` (bash, ksh): the function's body, a compound command, follows the name. */\nconst FUNCTION_WORD = \"function\";\nconst FUNCTION_HEADER_LENGTH = 2;\n\nconst isReserved = (word: ShellWord | undefined, words: ReadonlySet<string>): boolean =>\n word !== undefined && word.raw === word.value && words.has(word.value);\n\n/** How many words at `index` are a reserved word or a function header, before a command. */\nfunction prefixLength(words: readonly ShellWord[], index: number): number {\n if (isReserved(words[index], COMMAND_PREFIX_WORDS)) {\n return 1;\n }\n const word = words[index];\n return word?.raw === FUNCTION_WORD ? FUNCTION_HEADER_LENGTH : 0;\n}\n\n/**\n * The simple command that a list of words between two separators holds, without the reserved\n * words in front of it: `then a b` is the command `a b`, and `for x in a b` is none.\n */\nfunction simpleCommand(words: readonly ShellWord[]): ShellWord[] {\n let first = 0;\n for (let length = prefixLength(words, 0); length > 0; length = prefixLength(words, first)) {\n first += length;\n }\n return isReserved(words[first], CLAUSE_WORDS) ? [] : words.slice(first);\n}\n\nconst QUOTES: ReadonlySet<string> = new Set([\"'\", '\"']);\n/** A quoted word with more than one word in it may be a command (`sh -c \"…\"`, `concurrently`). */\nconst NESTED_COMMAND_RE = /[\\s;&|()`]/;\n\n/**\n * The text inside the quotes of a word that is one quoted string holding a command line. The\n * inner text is read as written, so its offsets map one to one onto the outer text.\n */\nfunction nestedCommandText(word: ShellWord): string | undefined {\n const quote = word.raw[0] as string;\n const isOneQuotedString =\n QUOTES.has(quote) &&\n word.raw.length > 1 &&\n word.raw.endsWith(quote) &&\n wordPart(word.raw, 0).end === word.raw.length;\n return isOneQuotedString && NESTED_COMMAND_RE.test(word.value)\n ? word.raw.slice(1, -1)\n : undefined;\n}\n\n/** Moves the offsets of words found in a part of a text to offsets in the whole text. */\nconst shifted = (words: readonly ShellWord[], offset: number): ShellWord[] =>\n words.map((word) => ({ ...word, start: word.start + offset, end: word.end + offset }));\n\n/** The commands of `text`, which starts at `offset` of a larger text, by offsets in that one. */\nexport function shellCommandsAt(text: string, offset: number): ShellCommand[] {\n return shellCommands(text).map((words) => shifted(words, offset));\n}\n\n/**\n * The commands of `text`, in order of their first word. A quoted word that holds a command line\n * is read as commands too, so `sh -c \"openapi-typescript a.yaml\"` and `concurrently \"…\"` count.\n */\nexport function shellCommands(text: string): ShellCommand[] {\n const commands: ShellCommand[] = [];\n for (const command of topLevelCommands(text).map(simpleCommand)) {\n if (command.length > 0) {\n commands.push(command);\n }\n for (const word of command) {\n const inner = nestedCommandText(word);\n if (inner !== undefined) {\n const nested = shellCommands(inner).map((words) => shifted(words, word.start + 1));\n commands.push(...nested);\n }\n }\n }\n return commands;\n}\n","import { NPM_SPECIFIER_PREFIX } from \"./command-launchers.js\";\nimport { commandRoles, type PackageWord } from \"./command-roles.js\";\nimport { type Change, lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport {\n FLAG_RENAMES,\n GENERATOR_COMMAND,\n MIGRATED_GENERATOR_COMMAND,\n PACKAGE_RENAMES,\n} from \"./package-names.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\nimport type { VariableProgram } from \"./variable-programs.js\";\n\n/** One command line or script after the migration. */\nexport interface CommandMigration {\n readonly text: string;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** Names the place of an offset for the report: a script name, or `file:line`. */\nexport type Locate = (offset: number) => string;\n\n/** What the migration found at one offset of the text. */\ninterface Finding {\n readonly offset: number;\n readonly edit?: TextEdit;\n readonly change?: Change;\n readonly manualStep?: ManualStep;\n}\n\nconst QUOTES: ReadonlySet<string> = new Set([\"'\", '\"']);\nconst PATH_SEPARATOR = \"/\";\nconst BIN_FOLDER = \"/.bin/\";\nconst OLD_PACKAGE_FOLDER = `node_modules/${GENERATOR_COMMAND}/`;\n\n/**\n * The edit that renames `name` at the end of a word (`x`, `\"x\"`, `npm:x`, `.bin/x`), or undefined\n * when the word is quoted in a way that does not keep `name` in one piece.\n */\nfunction renameAtEnd(word: ShellWord, name: string, to: string): TextEdit | undefined {\n const at = word.raw.lastIndexOf(name);\n const tail = word.raw.slice(at + name.length);\n if (at === -1 || (tail !== \"\" && !QUOTES.has(tail))) {\n return undefined;\n }\n return { start: word.start + at, end: word.start + at + name.length, text: to };\n}\n\n/** A package name with an optional `npm:` prefix and `@version`. */\nfunction packageReference(value: string): { name: string; isPinned: boolean } {\n const bare = value.startsWith(NPM_SPECIFIER_PREFIX)\n ? value.slice(NPM_SPECIFIER_PREFIX.length)\n : value;\n const at = bare.indexOf(\"@\", 1);\n return { name: at === -1 ? bare : bare.slice(0, at), isPinned: at !== -1 };\n}\n\n/** A word of an install command or a `--package` option that names an original package. */\nfunction packageFindings(found: PackageWord, locate: Locate): Finding[] {\n const { name, isPinned } = packageReference(found.value);\n const to = PACKAGE_RENAMES.get(name);\n const offset = found.word.start;\n if (to === undefined) {\n return [];\n }\n const location = locate(offset);\n if (isPinned) {\n return [{ offset, manualStep: { kind: \"pinned-package\", location, name } }];\n }\n const edit = renameAtEnd(found.word, name, to);\n const change: Change = { kind: \"package-name-renamed\", location, from: name, to };\n return edit === undefined ? [] : [{ offset, edit, change }];\n}\n\n/** The program given by a path: `node_modules/.bin/openapi-typescript` or a file of the package. */\nfunction programPathFindings(word: ShellWord, location: string): Finding[] {\n const offset = word.start;\n if (word.value.includes(OLD_PACKAGE_FOLDER)) {\n return [{ offset, manualStep: { kind: \"old-package-file\", location, path: word.value } }];\n }\n const isBin = word.value.endsWith(`${BIN_FOLDER}${GENERATOR_COMMAND}`);\n const edit = isBin ? renameAtEnd(word, GENERATOR_COMMAND, MIGRATED_GENERATOR_COMMAND) : undefined;\n return edit === undefined\n ? []\n : [{ offset, edit, change: { kind: \"command-renamed\", location } }];\n}\n\n/** The findings for the program word of a command; renamed tells whether flags follow. */\nfunction programFindings(word: ShellWord, location: string): Finding[] {\n if (word.value.includes(PATH_SEPARATOR)) {\n return programPathFindings(word, location);\n }\n const { name, isPinned } = packageReference(word.value);\n if (name !== GENERATOR_COMMAND) {\n return [];\n }\n if (isPinned) {\n return [{ offset: word.start, manualStep: { kind: \"versioned-command\", location } }];\n }\n const edit = renameAtEnd(word, GENERATOR_COMMAND, MIGRATED_GENERATOR_COMMAND);\n const change: Change = { kind: \"command-renamed\", location };\n return edit === undefined ? [] : [{ offset: word.start, edit, change }];\n}\n\n/** A renamed flag of the generator, alone (`-it`) or with its value (`--redoc=r.yaml`). */\nfunction flagFindings(word: ShellWord, locate: Locate): Finding[] {\n const flag = word.raw.split(\"=\", 1)[0] as string;\n const to = FLAG_RENAMES.get(flag);\n if (to === undefined) {\n return [];\n }\n const offset = word.start;\n const edit: TextEdit = { start: offset, end: offset + flag.length, text: to };\n return [\n { offset, edit, change: { kind: \"flag-renamed\", location: locate(offset), from: flag, to } },\n ];\n}\n\n/** `@`, `-` and `+` before a Makefile or justfile recipe: silent, ignore errors, always run. */\nconst RECIPE_PREFIX_RE = /^[@+-]+(?=.)/;\n\n/**\n * The command with the recipe prefix taken off the value of its first word, so `@npx …` runs\n * `npx`. A shell command never starts with an option, so this changes nothing else.\n */\nfunction withoutRecipePrefix(words: ShellCommand): ShellCommand {\n const [first, ...rest] = words;\n if (first === undefined || !RECIPE_PREFIX_RE.test(first.value)) {\n return words;\n }\n return [{ ...first, value: first.value.replace(RECIPE_PREFIX_RE, \"\") }, ...rest];\n}\n\n/** A program word that expands one variable the file sets: as written, and what it runs. */\nexport interface VariableProgramUse {\n readonly written: string;\n readonly program: VariableProgram;\n}\n\n/** A whole word that expands one variable the file sets: as written, and the value it gets. */\nexport interface VariableReference {\n readonly written: string;\n readonly value: string;\n}\n\n/**\n * The variables of a file as its commands use them. A program word can run the generator through\n * a variable (`$(OAT)` in a Makefile with `OAT := openapi-typescript`): the variable's value is\n * migrated where it is set, the flags after it where it is used. An argument can expand a\n * variable that holds flags (`$(FLAGS)` with `FLAGS := -it`); the variable may serve other\n * commands too, so its old flags are reported, not changed.\n */\nexport interface FileVariables {\n /** What a program word runs through a variable, or undefined when it expands none. */\n programAt(program: ShellWord): VariableProgramUse | undefined;\n referenceAt(word: ShellWord): VariableReference | undefined;\n}\n\nconst NO_VARIABLES: FileVariables = {\n programAt: () => undefined,\n referenceAt: () => undefined,\n};\n\n/** The flags of a variable's value that the generator renamed, each once. */\nfunction renamedFlags(value: string): string[] {\n const flags = shellCommands(value)\n .flat()\n .map((word) => word.raw.split(\"=\", 1)[0] as string);\n return [...new Set(flags.filter((flag) => FLAG_RENAMES.has(flag)))];\n}\n\n/** The findings of one argument of the generator: a renamed flag, or a variable that holds one. */\nfunction argumentFindings(word: ShellWord, locate: Locate, variables: FileVariables): Finding[] {\n const reference = variables.referenceAt(word);\n if (reference === undefined) {\n return flagFindings(word, locate);\n }\n const flags = renamedFlags(reference.value);\n if (flags.length === 0) {\n return [];\n }\n const manualStep: ManualStep = {\n kind: \"flags-in-variable\",\n location: locate(word.start),\n variable: reference.written,\n flags,\n };\n return [{ offset: word.start, manualStep }];\n}\n\n/** The old flags that findings rename, or report in a variable's value. */\nconst oldFlagsOf = (findings: readonly Finding[]): string[] =>\n findings.flatMap(({ change, manualStep }) => {\n if (change?.kind === \"flag-renamed\") {\n return [change.from];\n }\n return manualStep?.kind === \"flags-in-variable\" ? [...manualStep.flags] : [];\n });\n\n/**\n * The findings after a variable that runs the generator in some of its definitions only: one step\n * that names the old flags, since the tool cannot tell which program runs there.\n */\nfunction uncertainFlagSteps(\n program: ShellWord,\n variable: string,\n found: readonly Finding[],\n locate: Locate,\n) {\n const flags = [...new Set(oldFlagsOf(found))];\n if (flags.length === 0) {\n return [];\n }\n const manualStep: ManualStep = {\n kind: \"variable-not-only-generator\",\n location: locate(program.start),\n variable,\n flags,\n };\n return [{ offset: program.start, manualStep }];\n}\n\nfunction commandFindings(\n command: ShellCommand,\n locate: Locate,\n variables: FileVariables,\n): Finding[] {\n const words = withoutRecipePrefix(command);\n const roles = commandRoles(words);\n const findings = roles.packages.flatMap((found) => packageFindings(found, locate));\n const program = roles.program === undefined ? undefined : (words[roles.program] as ShellWord);\n if (program === undefined) {\n return findings;\n }\n const found = programFindings(program, locate(program.start));\n findings.push(...found);\n // Only a renamed command is ours to change; a pinned one still runs the old package.\n const isRenamed = found.some((finding) => finding.change?.kind === \"command-renamed\");\n const variable = variables.programAt(program);\n if (!isRenamed && (variable === undefined || variable.program === \"other\")) {\n return findings;\n }\n const flags = words.slice((roles.program as number) + 1);\n const flagFound = flags.flatMap((word) => argumentFindings(word, locate, variables));\n const isUncertain = variable?.program === \"generator-or-other\";\n findings.push(\n ...(isUncertain ? uncertainFlagSteps(program, variable.written, flagFound, locate) : flagFound),\n );\n return findings;\n}\n\n/**\n * Whether a command runs the generator by its old name, so a variable set to it holds the\n * generator command.\n */\nexport function runsGenerator(command: ShellCommand): boolean {\n const words = withoutRecipePrefix(command);\n const { program } = commandRoles(words);\n const word = program === undefined ? undefined : words[program];\n return word !== undefined && packageReference(word.value).name === GENERATOR_COMMAND;\n}\n\n/** The findings of a shell text as edits, without applying them. */\nexport interface ShellTextFindings {\n readonly edits: readonly TextEdit[];\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** Find what to migrate in every command of a shell text; `locate` names each place. */\nexport function shellTextFindings(text: string, locate: Locate): ShellTextFindings {\n return commandWordFindings(shellCommands(text), locate);\n}\n\n/** Find what to migrate in commands already split into words, as an exec-form list is. */\nexport function commandWordFindings(\n commands: readonly ShellCommand[],\n locate: Locate,\n variables: FileVariables = NO_VARIABLES,\n): ShellTextFindings {\n const findings = commands\n .flatMap((words) => commandFindings(words, locate, variables))\n .sort((left, right) => left.offset - right.offset);\n return {\n edits: findings.flatMap((finding) => (finding.edit === undefined ? [] : [finding.edit])),\n changes: findings.flatMap((finding) => (finding.change === undefined ? [] : [finding.change])),\n manualSteps: findings.flatMap((finding) =>\n finding.manualStep === undefined ? [] : [finding.manualStep],\n ),\n };\n}\n\nfunction migrateShellText(text: string, locate: Locate): CommandMigration {\n const { edits, changes, manualSteps } = shellTextFindings(text, locate);\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n\n/**\n * Rename the generator command in one script, the renamed flags of that command only, and the\n * original packages that an install command or `npx -p` names. `location` names the script.\n */\nexport function migrateCommand(text: string, location: string): CommandMigration {\n return migrateShellText(text, () => location);\n}\n\n/**\n * Every command of a shell script, Makefile or Dockerfile, through `migrateCommand`. A command\n * continued with `\\` onto the next lines is one command. Each finding names its `file:line`.\n */\nexport function migrateCommandLines(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n return migrateShellText(text, (offset) => `${file}:${lineOf(offset)}`);\n}\n","import { migrateCommand } from \"./command-migration.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport type { SourceString } from \"./source-migration.js\";\n\n/** No location: the step names the line of the string instead. */\nconst NO_LOCATION = \"\";\n\n/**\n * Strings of a source file that run the generator, such as `execSync(\"npx openapi-typescript …\")`\n * or the command of `spawn` with `shell: true`. They are reported with the migrated command, not\n * changed: a string is data, and only the author knows that it reaches a shell.\n */\nexport function commandStringSteps(text: string, strings: readonly SourceString[]): ManualStep[] {\n const lineOf = lineLocator(text);\n return strings.flatMap((found) => {\n // A string that is just a package name is reported by the specifier migration.\n if (found.isModuleSpecifier || PACKAGE_RENAMES.has(found.value)) {\n return [];\n }\n const migrated = migrateCommand(found.value, NO_LOCATION).text;\n return migrated === found.value\n ? []\n : [{ kind: \"command-string\" as const, line: lineOf(found.start), to: migrated }];\n });\n}\n","/**\n * Which program a variable runs where a command starts with it (`$GEN …`, `$(GEN) …`). A file can\n * set one name in several places: two Dockerfile stages, a workflow and one of its steps, a\n * Makefile line and a later one that make reads before it runs any recipe. The tool does not\n * follow which definition reaches which command, so it changes the flags after a variable only\n * when every definition of the name runs the generator.\n */\n\nimport { assertNever } from \"./assert-never.js\";\n\n/**\n * `generator`: every definition runs the generator. `generator-or-other`: some definitions run it\n * and some run another program, so the flags after the variable are left to the user. `other`: no\n * definition runs it.\n */\nexport type VariableProgram = \"generator\" | \"generator-or-other\" | \"other\";\n\n/**\n * What one definition of a variable sets it to: a command (that runs the generator or not), a\n * reference to one variable (`GEN := $(OAT)`, `ENV GEN=$GEN`), or text that make appends to the\n * value it already has (`GEN += --flag`), which keeps the program.\n */\nexport type ProgramDefinition =\n | { readonly name: string; readonly kind: \"command\"; readonly runsGenerator: boolean }\n | { readonly name: string; readonly kind: \"reference\"; readonly target: string }\n | { readonly name: string; readonly kind: \"append\" };\n\n/** Whether a definition can run the generator, given the names found to run it so far. */\nfunction canRunGenerator(definition: ProgramDefinition, generators: ReadonlySet<string>): boolean {\n switch (definition.kind) {\n case \"command\":\n return definition.runsGenerator;\n case \"reference\":\n return generators.has(definition.target);\n case \"append\":\n return false;\n default:\n return assertNever(definition);\n }\n}\n\n/**\n * Whether a definition can run another program. A reference to a variable the file never sets\n * gets its value from elsewhere (the environment, a base image), so it can run anything.\n */\nfunction canRunOther(\n definition: ProgramDefinition,\n others: ReadonlySet<string>,\n defined: ReadonlySet<string>,\n): boolean {\n switch (definition.kind) {\n case \"command\":\n return !definition.runsGenerator;\n case \"reference\":\n return others.has(definition.target) || !defined.has(definition.target);\n case \"append\":\n return false;\n default:\n return assertNever(definition);\n }\n}\n\n/**\n * The program each defined variable runs. References are followed however long the chain, so\n * `GEN := $(OAT)` runs what `OAT` runs; a cycle adds nothing.\n */\nexport function variablePrograms(\n definitions: readonly ProgramDefinition[],\n): ReadonlyMap<string, VariableProgram> {\n const defined = new Set(definitions.map((definition) => definition.name));\n const generators = new Set<string>();\n const others = new Set<string>();\n for (let size = -1; size !== generators.size + others.size; ) {\n size = generators.size + others.size;\n for (const definition of definitions) {\n if (canRunGenerator(definition, generators)) {\n generators.add(definition.name);\n }\n if (canRunOther(definition, others, defined)) {\n others.add(definition.name);\n }\n }\n }\n const programOf = (name: string): VariableProgram => {\n if (!generators.has(name)) {\n return \"other\";\n }\n return others.has(name) ? \"generator-or-other\" : \"generator\";\n };\n return new Map([...defined].map((name) => [name, programOf(name)]));\n}\n","import { type FileVariables, runsGenerator } from \"./command-migration.js\";\nimport { type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { type ProgramDefinition, variablePrograms } from \"./variable-programs.js\";\n\n/** A shell variable as a file sets it: its name and its value, read as shell text. */\nexport interface VariableDefinition {\n readonly name: string;\n readonly value: string;\n}\n\n/** A whole word that expands one shell variable: `$NAME`, `${NAME}`, also in double quotes. */\nconst SHELL_VARIABLE_RE = /^\"?\\$(?:([A-Za-z_][A-Za-z0-9_]*)|\\{([A-Za-z_][A-Za-z0-9_]*)\\})\"?$/;\n\n/** The variable that `text` expands as a whole, or undefined. */\nfunction expandedName(text: string): string | undefined {\n const match = SHELL_VARIABLE_RE.exec(text);\n return match === null ? undefined : (match[1] ?? match[2]);\n}\n\n/** A definition as the program it sets: a reference to one variable, or a command. */\nfunction programDefinition({ name, value }: VariableDefinition): ProgramDefinition {\n const target = expandedName(value.trim());\n if (target !== undefined) {\n return { name, kind: \"reference\", target };\n }\n return { name, kind: \"command\", runsGenerator: shellCommands(value).some(runsGenerator) };\n}\n\n/**\n * The variables that a file's shell commands expand: `$GEN` runs the generator when every\n * definition of `GEN` in the file sets it to the generator (see variable-programs.ts). The\n * values of one name are read as one (a workflow, a job and a step `env`), since any of them can\n * reach a command.\n */\nexport function shellVariables(definitions: readonly VariableDefinition[]): FileVariables {\n const values = new Map<string, string>();\n for (const { name, value } of definitions) {\n values.set(name, [values.get(name), value].filter((part) => part !== undefined).join(\" \"));\n }\n const programs = variablePrograms(definitions.map(programDefinition));\n // A word that expands no variable has no name, so no definition (not even of \"\") matches it.\n const nameAt = (word: ShellWord): string | undefined => expandedName(word.raw);\n return {\n programAt: (program) => {\n const name = nameAt(program);\n const found = name === undefined ? undefined : programs.get(name);\n return found === undefined ? undefined : { written: program.raw, program: found };\n },\n referenceAt: (word) => {\n const name = nameAt(word);\n const value = name === undefined ? undefined : values.get(name);\n return value === undefined ? undefined : { written: word.raw, value };\n },\n };\n}\n","import { type CommandMigration, commandWordFindings, migrateCommand } from \"./command-migration.js\";\nimport { lineLocator, type ManualStep } from \"./migration-findings.js\";\nimport { shellVariables, type VariableDefinition } from \"./shell-variables.js\";\nimport {\n type ShellCommand,\n type ShellWord,\n shellCommands,\n shellCommandsAt,\n} from \"./shell-words.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\n\n/**\n * Dockerfiles and Containerfiles. `RUN`, `CMD` and `ENTRYPOINT` take a command in shell form (a\n * line the shell splits) or in exec form: a JSON array of strings, each one word, which no shell\n * splits. Docker reads an instruction whose argument is not a valid JSON array as shell form, and\n * so does the migration.\n */\n\n/**\n * An instruction that takes a command, at the start of a line, before its `[`, after the flags of\n * `RUN` (`--mount=type=cache,target=/root/.npm`, `--network=none`). In capitals, as Dockerfiles\n * write them and as the launcher table reads the shell form (command-launchers.ts).\n */\nconst EXEC_FORM_START_RE = /^[ \\t]*(?:RUN|CMD|ENTRYPOINT)(?:[ \\t]+--\\S+)*[ \\t]+\\[/gm;\n/** Shells whose `-c` option takes a command line, as `SHELL` and the shell form use them. */\nconst SHELLS: ReadonlySet<string> = new Set([\"sh\", \"bash\", \"dash\", \"ash\", \"zsh\"]);\nconst OPTION_PREFIX = \"-\";\nconst LONG_OPTION_PREFIX = \"--\";\nconst COMMAND_OPTION = \"c\";\nconst SET_OPTION = \"-o\";\nconst PATH_SEPARATOR = \"/\";\n/** Blanks between the items of the array; a `\\` at the end of a line continues the instruction. */\nconst ARRAY_BLANK_RE = /(?:[ \\t\\r\\n]|\\\\\\r?\\n)*/y;\n/** A double-quoted string on one line; `JSON.parse` decides whether it is a JSON string. */\nconst QUOTED_RE = /\"(?:[^\"\\\\\\n]|\\\\.)*\"/y;\nconst ITEM_SEPARATOR = \",\";\nconst NOT_LINE_BREAK_RE = /[^\\n]/g;\nconst ARRAY_END = \"]\";\n/** Instructions that set variables which later shell-form commands expand (`$GEN`). */\nconst VARIABLE_INSTRUCTIONS: ReadonlySet<string> = new Set([\"ARG\", \"ENV\"]);\nconst LEGACY_ENV_INSTRUCTION = \"ENV\";\nconst ASSIGNMENT = \"=\";\nconst QUOTES: ReadonlySet<string> = new Set(['\"', \"'\"]);\n\n/** Where a pattern with the sticky flag matches at `index`, or undefined. */\nfunction matchAt(pattern: RegExp, text: string, index: number): string | undefined {\n pattern.lastIndex = index;\n return pattern.exec(text)?.[0];\n}\n\n/** The value of a JSON string, or undefined when `raw` is not one (a bad escape, a raw tab). */\nfunction jsonString(raw: string): string | undefined {\n try {\n return JSON.parse(raw) as string;\n } catch (error) {\n // Docker reads an argument that is not valid JSON as shell form; so does the migration.\n if (error instanceof SyntaxError) {\n return undefined;\n }\n throw error;\n }\n}\n\n/** One exec-form array: where it starts (at the `[`) and ends (after the `]`), and its words. */\ninterface ExecForm {\n readonly start: number;\n readonly end: number;\n readonly words: readonly ShellWord[];\n}\n\n/** The exec-form array whose `[` is at `start`, or undefined when it is not one. */\nfunction execFormAt(text: string, start: number): ExecForm | undefined {\n const words: ShellWord[] = [];\n let index = start + 1;\n for (;;) {\n index += matchAt(ARRAY_BLANK_RE, text, index)?.length ?? 0;\n const raw = matchAt(QUOTED_RE, text, index);\n if (raw === undefined) {\n const isEmpty = text[index] === ARRAY_END && words.length === 0;\n return isEmpty ? { start, end: index + 1, words } : undefined;\n }\n const value = jsonString(raw);\n if (value === undefined) {\n return undefined;\n }\n // A word is the text inside the quotes, as an exec-form item of a YAML file is.\n words.push({ start: index + 1, end: index + raw.length - 1, value, raw: raw.slice(1, -1) });\n index += raw.length;\n index += matchAt(ARRAY_BLANK_RE, text, index)?.length ?? 0;\n if (text[index] === ARRAY_END) {\n return { start, end: index + 1, words };\n }\n if (text[index] !== ITEM_SEPARATOR) {\n return undefined;\n }\n index++;\n }\n}\n\n/** The exec-form arrays of a Dockerfile, in order. */\nfunction execForms(text: string): ExecForm[] {\n return [...text.matchAll(EXEC_FORM_START_RE)].flatMap((match) => {\n const form = execFormAt(text, match.index + match[0].length - 1);\n return form === undefined ? [] : [form];\n });\n}\n\n/**\n * The command line of `[\"sh\", \"-c\", \"…\"]` (also `/bin/bash -o pipefail -ec`): the word after the\n * first short option that holds `c`, before any word that is not an option.\n */\nfunction shellScript(words: readonly ShellWord[]): ShellWord | undefined {\n const program = words[0]?.value.split(PATH_SEPARATOR).at(-1) ?? \"\";\n if (!SHELLS.has(program)) {\n return undefined;\n }\n let index = 1;\n for (let option = words[index]?.value; option !== undefined; option = words[index]?.value) {\n if (!option.startsWith(OPTION_PREFIX)) {\n return undefined;\n }\n if (!option.startsWith(LONG_OPTION_PREFIX) && option.includes(COMMAND_OPTION)) {\n return words[index + 1];\n }\n // `-o pipefail` names a shell option in the next word.\n index += option === SET_OPTION ? 2 : 1;\n }\n return undefined;\n}\n\n/** What the exec-form arrays run: the arrays, and the command lines of the shells they start. */\ninterface ExecCommands {\n readonly commands: readonly ShellCommand[];\n /** Command lines with JSON escapes, whose offsets do not map onto the file: reported only. */\n readonly escaped: readonly ShellWord[];\n}\n\nfunction execCommands(forms: readonly ExecForm[]): ExecCommands {\n const commands: ShellCommand[] = [];\n const escaped: ShellWord[] = [];\n for (const { words } of forms) {\n commands.push(words);\n const script = shellScript(words);\n if (script !== undefined && script.raw === script.value) {\n commands.push(...shellCommandsAt(script.value, script.start));\n } else if (script !== undefined) {\n escaped.push(script);\n }\n }\n return { commands, escaped };\n}\n\n/** The text with the arrays blanked out, line breaks kept, so the shell reads the rest. */\nfunction withoutExecForms(text: string, forms: readonly ExecForm[]): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, end } of forms) {\n parts.push(\n text.slice(copiedUpTo, start),\n text.slice(start, end).replace(NOT_LINE_BREAK_RE, \" \"),\n );\n copiedUpTo = end;\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** A command line that the migration would change but cannot edit in place, as a manual step. */\nfunction escapedScriptSteps(scripts: readonly ShellWord[], lineOf: (offset: number) => number) {\n return scripts.flatMap((script): ManualStep[] => {\n const migrated = migrateCommand(script.value, \"\").text;\n return migrated === script.value\n ? []\n : [{ kind: \"command-string\", line: lineOf(script.start), to: migrated }];\n });\n}\n\n/** A variable that `ARG` or `ENV` sets: its name, and its value as commands at their offsets. */\ninterface DockerVariable {\n readonly name: string;\n readonly commands: readonly ShellCommand[];\n}\n\n/** The variable of one `NAME=value` word, its quotes taken off, or undefined. */\nfunction assignedVariable(word: ShellWord): DockerVariable | undefined {\n const at = word.raw.indexOf(ASSIGNMENT);\n if (at <= 0) {\n return undefined;\n }\n const raw = word.raw.slice(at + 1);\n const isQuoted = raw.length >= 2 && QUOTES.has(raw[0] as string) && raw.at(-1) === raw[0];\n const value = isQuoted ? raw.slice(1, -1) : raw;\n const start = word.start + at + 1 + (isQuoted ? 1 : 0);\n return { name: word.raw.slice(0, at), commands: shellCommandsAt(value, start) };\n}\n\n/**\n * The variables that `ARG NAME=value` and `ENV NAME=value …` set, and `ENV NAME value`, the\n * legacy form that sets one variable to the rest of the line.\n */\nfunction dockerVariables(commands: readonly ShellCommand[]): DockerVariable[] {\n return commands.flatMap(([instruction, first, ...rest]) => {\n if (instruction === undefined || first === undefined) {\n return [];\n }\n if (!VARIABLE_INSTRUCTIONS.has(instruction.value)) {\n return [];\n }\n if (instruction.value === LEGACY_ENV_INSTRUCTION && !first.raw.includes(ASSIGNMENT)) {\n return [{ name: first.value, commands: [rest] }];\n }\n return [first, ...rest].flatMap((word) => assignedVariable(word) ?? []);\n });\n}\n\nconst definitionOf = ({ name, commands }: DockerVariable): VariableDefinition => ({\n name,\n value: commands.flatMap((words) => words.map((word) => word.raw)).join(\" \"),\n});\n\n/**\n * Migrate the commands of a Dockerfile: exec-form arrays word by word, everything else as shell\n * text, with the values of `ARG` and `ENV` variables as commands that `$NAME` runs. Each finding\n * names its `file:line`.\n */\nexport function migrateDockerfile(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const forms = execForms(text);\n const exec = execCommands(forms);\n const shellForm = shellCommands(withoutExecForms(text, forms));\n // A value that runs the generator is migrated where it is set, its flags where it is used.\n const definitions = dockerVariables(shellForm);\n const values = definitions.flatMap((variable) => variable.commands);\n const commands = [...shellForm, ...values, ...exec.commands];\n const variables = shellVariables(definitions.map(definitionOf));\n const { edits, changes, manualSteps } = commandWordFindings(commands, locate, variables);\n const steps = [...manualSteps, ...escapedScriptSteps(exec.escaped, lineOf)];\n return { text: applyTextEdits(text, edits), changes, manualSteps: steps };\n}\n","import { migrateCommand } from \"./command-migration.js\";\nimport type { DocumentPath, DocumentString } from \"./config-documents.js\";\nimport type { Change, FileMigration, ManualStep } from \"./migration-findings.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\n\n/**\n * Commands in JSON configs: package.json scripts, Nx `project.json` targets and Deno tasks.\n * Only the strings at command paths are migrated, and each is replaced in place, so the rest of\n * the file keeps its formatting.\n */\n\n/** A key path pattern; `*` matches any key or index. */\nexport type JsonPathPattern = readonly string[];\n\nconst ANY = \"*\";\n\n/** package.json scripts; each finding names its script (`scripts.gen`). */\nexport const PACKAGE_SCRIPT_PATHS: readonly JsonPathPattern[] = [[\"scripts\", ANY]];\n\n/** `nx:run-commands` targets: `command`, `options.command` and `options.commands`. */\nexport const NX_COMMAND_PATHS: readonly JsonPathPattern[] = [\n [\"targets\", ANY, \"command\"],\n [\"targets\", ANY, \"options\", \"command\"],\n [\"targets\", ANY, \"options\", \"commands\", ANY],\n [\"targets\", ANY, \"options\", \"commands\", ANY, \"command\"],\n];\n\n/** Deno tasks: a command string, or an object with a `command`. */\nexport const DENO_TASK_PATHS: readonly JsonPathPattern[] = [\n [\"tasks\", ANY],\n [\"tasks\", ANY, \"command\"],\n];\n\nconst matches = (path: DocumentPath, pattern: JsonPathPattern): boolean =>\n path.length === pattern.length &&\n pattern.every((part, index) => part === ANY || part === String(path[index]));\n\n/** Migrate the command strings of a JSON config whose key paths match one of `patterns`. */\nexport function migrateJsonCommands(\n text: string,\n strings: readonly DocumentString[],\n patterns: readonly JsonPathPattern[],\n): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n const edits: TextEdit[] = [];\n for (const found of strings.filter((string) => patterns.some((p) => matches(string.path, p)))) {\n const migrated = migrateCommand(found.value, found.path.join(\".\"));\n changes.push(...migrated.changes);\n manualSteps.push(...migrated.manualSteps);\n if (migrated.text !== found.value) {\n edits.push({ start: found.start, end: found.end, text: JSON.stringify(migrated.text) });\n }\n }\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import {\n type CommandMigration,\n commandWordFindings,\n type FileVariables,\n runsGenerator,\n} from \"./command-migration.js\";\nimport { lineLocator } from \"./migration-findings.js\";\nimport { type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport {\n type ProgramDefinition,\n type VariableProgram,\n variablePrograms,\n} from \"./variable-programs.js\";\n\n/**\n * Makefiles. Make expands its variables before a recipe line reaches the shell, so a variable can\n * hold the generator command: `OAT := openapi-typescript`, then `$(OAT) a.yaml -it`. The value of\n * an assignment is read as a command and migrated where it is set; the flags after a reference\n * to such a variable, or to one set to it (`GEN := $(OAT)`), are migrated where it is used.\n * Everything else is shell text.\n */\n\n/**\n * A variable assignment at the start of a line (not a recipe line, which starts with a tab), also\n * one for some targets only (`gen: OAT := openapi-typescript`).\n */\nconst ASSIGNMENT_RE = new RegExp(\n [\n \"^(?:[^\\\\s:#=][^:#=\\\\n]*:[ \\\\t]*)?\",\n \"(?:(?:export|override|private)[ \\\\t]+)*\",\n \"([A-Za-z_][A-Za-z0-9_.-]*)\",\n \"[ \\\\t]*(:::=|::=|:=|\\\\?=|\\\\+=|!=|=)\",\n ].join(\"\"),\n \"gm\",\n);\n/**\n * A reference to one variable, as a whole word: `$(NAME)`, `${NAME}`, or `$N` for a variable whose\n * name is one letter, as make reads a `$` before any other character.\n */\nconst VARIABLE_REFERENCE_RE =\n /^\\$(?:\\(([A-Za-z_][A-Za-z0-9_.-]*)\\)|\\{([A-Za-z_][A-Za-z0-9_.-]*)\\}|([A-Za-z_]))$/;\n/** `@`, `-` and `+` before a recipe line: silent, ignore errors, always run. */\nconst RECIPE_PREFIX_RE = /^[@+-]+/;\nconst DOLLAR = \"$\";\nconst CLOSING: Readonly<Record<string, string>> = { \"(\": \")\", \"{\": \"}\" };\nconst NOT_LINE_BREAK_RE = /[^\\n]/g;\nconst MASK = \"_\";\nconst LINE_BREAK = \"\\n\";\nconst BACKSLASH = \"\\\\\";\n\n/** Where the make expansion that starts with the `$` at `start` ends, or undefined for none. */\nfunction expansionEnd(text: string, start: number): number | undefined {\n const open = text[start + 1] ?? \"\";\n const close = CLOSING[open];\n if (close === undefined) {\n return undefined;\n }\n let depth = 0;\n for (let index = start + 1; index < text.length; index++) {\n if (text[index] === open) {\n depth++;\n } else if (text[index] === close && --depth === 0) {\n return index + 1;\n }\n }\n return undefined;\n}\n\n/**\n * The text with each `$(…)` and `${…}` expansion turned into one word of the same length, so the\n * shell reads it as make passes it on. `$$` is a `$` for the shell and stays.\n */\nfunction maskExpansions(text: string): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (let index = text.indexOf(DOLLAR); index !== -1; index = text.indexOf(DOLLAR, index + 1)) {\n if (text[index + 1] === DOLLAR) {\n index++;\n continue;\n }\n const end = expansionEnd(text, index);\n if (end !== undefined) {\n parts.push(text.slice(copiedUpTo, index + 1), MASK.repeat(end - index - 1));\n copiedUpTo = end;\n index = end - 1;\n }\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** `+=` adds text to the value a variable already has, so the program it runs stays. */\nconst APPEND_OPERATOR = \"+=\";\n\n/** An assignment of a Makefile: the variable, where it starts, and where its value is. */\ninterface Assignment {\n readonly name: string;\n readonly isAppend: boolean;\n readonly start: number;\n readonly valueStart: number;\n readonly valueEnd: number;\n}\n\n/** Where the line that holds `index` ends; a `\\` before a line break continues it. */\nfunction logicalLineEnd(text: string, index: number): number {\n let end = text.indexOf(LINE_BREAK, index);\n while (end !== -1 && text[end - 1] === BACKSLASH) {\n end = text.indexOf(LINE_BREAK, end + 1);\n }\n return end === -1 ? text.length : end;\n}\n\nconst assignmentsOf = (text: string): Assignment[] =>\n [...text.matchAll(ASSIGNMENT_RE)].map((match) => {\n const valueStart = match.index + match[0].length;\n const valueEnd = logicalLineEnd(text, valueStart);\n const name = match[1] as string;\n const isAppend = match[2] === APPEND_OPERATOR;\n return { name, isAppend, start: match.index, valueStart, valueEnd };\n });\n\n/** The text with the `NAME :=` of each assignment blanked, so its value reads as a command. */\nfunction withoutAssignmentHeads(text: string, assignments: readonly Assignment[]): string {\n const parts: string[] = [];\n let copiedUpTo = 0;\n for (const { start, valueStart } of assignments) {\n parts.push(\n text.slice(copiedUpTo, start),\n text.slice(start, valueStart).replace(NOT_LINE_BREAK_RE, \" \"),\n );\n copiedUpTo = valueStart;\n }\n parts.push(text.slice(copiedUpTo));\n return parts.join(\"\");\n}\n\n/** The variable that `written` references as a whole, after the recipe prefix, or undefined. */\nfunction referencedName(written: string): string | undefined {\n const match = VARIABLE_REFERENCE_RE.exec(written.trim().replace(RECIPE_PREFIX_RE, \"\"));\n return match === null ? undefined : (match[1] ?? match[2] ?? match[3]);\n}\n\n/**\n * Each assignment as the program it sets: text appended to the value, a reference to one variable\n * (`GEN := $(OAT)`), or a command, which runs the generator when one of the commands that start in\n * its value does.\n */\nfunction programDefinitions(\n text: string,\n commands: readonly (readonly ShellWord[])[],\n assignments: readonly Assignment[],\n): ProgramDefinition[] {\n const generatorStarts = commands\n .filter(runsGenerator)\n .map((command) => (command[0] as ShellWord).start);\n return assignments.map(({ name, isAppend, valueStart, valueEnd }): ProgramDefinition => {\n if (isAppend) {\n return { name, kind: \"append\" };\n }\n const target = referencedName(text.slice(valueStart, valueEnd));\n if (target !== undefined) {\n return { name, kind: \"reference\", target };\n }\n const runs = generatorStarts.some((start) => valueStart <= start && start < valueEnd);\n return { name, kind: \"command\", runsGenerator: runs };\n });\n}\n\n/** The values each variable gets in the file, joined: any of them can reach a command. */\nfunction variableValues(text: string, assignments: readonly Assignment[]): Map<string, string> {\n const values = new Map<string, string>();\n for (const { name, valueStart, valueEnd } of assignments) {\n const value = text.slice(valueStart, valueEnd);\n values.set(name, [values.get(name), value].filter((part) => part !== undefined).join(\" \"));\n }\n return values;\n}\n\n/** The variables of a Makefile, read from its assignments. */\nfunction makefileVariables(\n text: string,\n assignments: readonly Assignment[],\n programs: ReadonlyMap<string, VariableProgram>,\n) {\n const values = variableValues(text, assignments);\n const nameAt = (word: ShellWord) => referencedName(text.slice(word.start, word.end));\n const variables: FileVariables = {\n programAt: (program) => {\n const name = nameAt(program);\n const found = name === undefined ? undefined : programs.get(name);\n const written = text.slice(program.start, program.end);\n return found === undefined ? undefined : { written, program: found };\n },\n referenceAt: (word) => {\n const name = nameAt(word);\n const value = name === undefined ? undefined : values.get(name);\n const written = text.slice(word.start, word.end);\n return value === undefined ? undefined : { written, value };\n },\n };\n return variables;\n}\n\n/** Migrate a Makefile; each finding names its `file:line`. */\nexport function migrateMakefile(text: string, file: string): CommandMigration {\n const lineOf = lineLocator(text);\n const assignments = assignmentsOf(text);\n const commands = shellCommands(withoutAssignmentHeads(maskExpansions(text), assignments));\n const programs = variablePrograms(programDefinitions(text, commands, assignments));\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const variables = makefileVariables(text, assignments, programs);\n const { edits, changes, manualSteps } = commandWordFindings(commands, locate, variables);\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import { manifestCatalogMaps } from \"./catalogs.js\";\nimport {\n type DocumentRead,\n isMap,\n mapsAt,\n type TreeMap,\n textEntries,\n unreadableConfig,\n valuesAt,\n} from \"./config-documents.js\";\nimport { declaredNames } from \"./declared-packages.js\";\nimport {\n type Findings,\n migrateSpecMap,\n newFindings,\n type RenameTarget,\n renameNames,\n} from \"./dependency-map.js\";\nimport { type FileMigration, unchanged } from \"./migration-findings.js\";\nimport { overriddenPackages } from \"./override-targets.js\";\nimport {\n DEPENDENCY_FIELDS,\n NAME_KEYED_FIELDS,\n NAME_LIST_FIELDS,\n namesOriginalPackage,\n OLD_PEER_DEPENDENTS,\n OVERRIDE_FIELDS,\n PACKAGE_RENAMES,\n} from \"./package-names.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { itemEntries, keyEntries, nestedKeys, specEntries } from \"./tree-entries.js\";\n\n/**\n * A package manifest: package.json, or the `package.yaml` that pnpm reads in its place. It is\n * edited in place: a renamed key or a new spec replaces that one value, and everything else stays\n * as written (domain/config-documents.ts). Scripts are commands: file-migrations.ts migrates\n * them with the other command files.\n */\n\nfunction migrateDependencyFields(manifest: TreeMap, target: RenameTarget, findings: Findings) {\n for (const field of DEPENDENCY_FIELDS) {\n for (const dependencies of mapsAt(manifest, field)) {\n const map = { kind: \"dependencies\", field } as const;\n migrateSpecMap(specEntries(dependencies), { ...target, map, findings });\n }\n }\n}\n\n/**\n * Keys of the meta fields that name an original package are renamed. A key with a version\n * (`openapi-fetch@0.13.0`, as Yarn allows) would need a new version too, so it is reported.\n */\nfunction migrateNameKeys(manifest: TreeMap, findings: Findings): void {\n for (const field of NAME_KEYED_FIELDS) {\n for (const meta of mapsAt(manifest, field)) {\n renameNames(keyEntries(meta), field, findings);\n const versioned = textEntries(meta)\n .map(({ key }) => key.value)\n .filter((key) => !PACKAGE_RENAMES.has(key));\n for (const name of overriddenPackages(versioned)) {\n findings.manualSteps.push({ kind: \"override-names-package\", field, name });\n }\n }\n }\n}\n\nfunction migrateNameLists(manifest: TreeMap, findings: Findings): void {\n for (const field of NAME_LIST_FIELDS) {\n for (const list of valuesAt(manifest, field)) {\n if (list.kind === \"list\") {\n renameNames(itemEntries(list), field, findings);\n }\n }\n }\n}\n\n/** bun's `catalog` and `catalogs.<name>`, at the top level and under `workspaces`. */\nfunction migrateCatalogs(manifest: TreeMap, target: RenameTarget, findings: Findings): void {\n for (const { name, label, map } of manifestCatalogMaps(manifest)) {\n const context = {\n ...target,\n map: { kind: \"catalog\", catalog: label, name } as const,\n findings,\n };\n migrateSpecMap(specEntries(map), context);\n }\n}\n\n/** Overrides and resolutions can pin the old packages; changing them needs the user's intent. */\nfunction reportOverrides(manifest: TreeMap, findings: Findings): void {\n for (const field of OVERRIDE_FIELDS) {\n const keys = valuesAt(manifest, field).flatMap(nestedKeys);\n for (const name of overriddenPackages(keys)) {\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: TreeMap, findings: Findings): void {\n const dependencies = new Set(declaredNames(manifest));\n for (const [dependent, { peer, range }] of OLD_PEER_DEPENDENTS) {\n if (dependencies.has(dependent)) {\n findings.manualSteps.push({ kind: \"old-peer-needed\", dependent, peer, range });\n }\n }\n}\n\nfunction migrateManifestMap(manifest: TreeMap, target: RenameTarget, findings: Findings): void {\n migrateDependencyFields(manifest, target, findings);\n migrateNameKeys(manifest, findings);\n migrateNameLists(manifest, findings);\n migrateCatalogs(manifest, target, findings);\n reportOverrides(manifest, findings);\n reportOldPeers(manifest, findings);\n}\n\n/**\n * Migrate the package names of a manifest (`read` is `text` parsed): rename the original packages\n * in the dependency fields (with `version` as the new version), in the fields that name\n * dependencies and in bun's catalogs, and report overrides that name the original packages.\n */\nexport function migratePackageManifest(\n text: string,\n read: DocumentRead,\n target: RenameTarget,\n): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const manifest of read.documents.filter(isMap)) {\n migrateManifestMap(manifest, target, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n\n/**\n * A manifest in a format the tool does not read: pnpm's `package.json5`. JSON5 has its own\n * strings (single quotes, line continuations), so it is not edited; a manifest that names an\n * original package is reported for the user to migrate.\n */\nexport function unreadManifest(text: string): FileMigration {\n return namesOriginalPackage(text)\n ? { ...unchanged(text), manualSteps: [{ kind: \"manifest-not-read\" }] }\n : unchanged(text);\n}\n","import type { ImportedSpecifier } from \"./declared-packages.js\";\nimport {\n type Change,\n type FileMigration,\n lineLocator,\n type ManualStep,\n} from \"./migration-findings.js\";\nimport { migrateNpmSpec } from \"./npm-alias.js\";\nimport { PACKAGE_RENAMES, type RenamedSpecifier, renamedSpecifier } from \"./package-names.js\";\nimport { hideUrlCredentials } from \"./url-credentials.js\";\n\n/**\n * A string literal of a source file, as a parser finds it. `start` and `end` are the offsets of\n * its value, inside the quotes. `isModuleSpecifier` is true where the string names a module:\n * `import … from`, `export … from`, `import()`, `require()`, `import x = require()`,\n * `import(\"…\")` types and JSDoc `@import` tags, `declare module`, `/// <reference types>` and the\n * module mocks of vitest, jest and bun. Strings nest: a template with substitutions spans its\n * text as written, so the strings inside its `${…}` lie within it.\n */\nexport interface SourceString {\n readonly start: number;\n readonly end: number;\n readonly value: string;\n readonly isModuleSpecifier: boolean;\n}\n\n/** Source file extensions whose text can hold module specifiers. */\nexport const SOURCE_EXTENSIONS: ReadonlySet<string> = new Set([\n \".ts\",\n \".tsx\",\n \".mts\",\n \".cts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".vue\",\n \".svelte\",\n \".astro\",\n]);\n\n/** A renamed specifier; `keptSpec` is the old spec when its range could not be replaced. */\ninterface RenamedValue extends RenamedSpecifier {\n readonly keptSpec?: string;\n}\n\n/**\n * The new specifier: a package name or subpath, or a Deno `npm:` specifier\n * (`npm:openapi-fetch@^0.13`), which gets the new package and version.\n */\nfunction renamedValue(value: string, version: string): RenamedValue | undefined {\n const npm = migrateNpmSpec(value, version);\n if (npm === undefined) {\n return renamedSpecifier(value);\n }\n const renamed = { to: npm.spec, isDeep: npm.isDeep };\n return npm.isReported ? { ...renamed, keptSpec: hideUrlCredentials(value) } : renamed;\n}\n\nconst TEMPLATE_SUBSTITUTION = \"${\";\n\n/**\n * The new name of an original package that a template specifier ends its name with, right before\n * a substitution (`openapi-fetch${suffix}`). The substitution may go on with the name or start a\n * subpath, so only the user knows what to write; undefined for any other specifier.\n */\nfunction dynamicPackage(value: string): string | undefined {\n const at = value.indexOf(TEMPLATE_SUBSTITUTION);\n return at === -1 ? undefined : PACKAGE_RENAMES.get(value.slice(0, at));\n}\n\n/** Outer strings first: a string that holds another starts no later and ends no earlier. */\nconst byStartThenOuter = (left: SourceString, right: SourceString): number =>\n left.start - right.start || right.end - left.end;\n\n/**\n * The strings in file order, outer before inner, each span once. A span found twice (two scripts\n * of a component that overlap) is one string, and a module specifier if either finding says so.\n * Spans may nest, as a template holds the strings of its substitutions; spans that cross cannot\n * both be replaced: that is a scanner bug, and editing on would corrupt the file.\n */\nfunction distinctStrings(strings: readonly SourceString[]): SourceString[] {\n const distinct: SourceString[] = [];\n const enclosing: SourceString[] = [];\n for (const found of [...strings].sort(byStartThenOuter)) {\n const previous = distinct.at(-1);\n if (previous?.start === found.start && previous.end === found.end) {\n const isModuleSpecifier = previous.isModuleSpecifier || found.isModuleSpecifier;\n distinct[distinct.length - 1] = { ...previous, isModuleSpecifier };\n continue;\n }\n let outer = enclosing.at(-1);\n while (outer !== undefined && outer.end <= found.start) {\n enclosing.pop();\n outer = enclosing.at(-1);\n }\n if (outer !== undefined && found.end > outer.end) {\n throw new Error(\n `Source strings overlap at offsets ${outer.start}-${outer.end} and ` +\n `${found.start}-${found.end}; the file was not changed.`,\n );\n }\n enclosing.push(found);\n distinct.push(found);\n }\n return distinct;\n}\n\nconst dynamicStep = (line: number, value: string, to: string): ManualStep => ({\n kind: \"dynamic-specifier\",\n line,\n value,\n to,\n});\n\n/**\n * 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 version: string,\n): FileMigration {\n const changes: Change[] = [];\n const manualSteps: ManualStep[] = [];\n let migrated = \"\";\n let copiedUpTo = 0;\n const lineOf = lineLocator(text);\n for (const found of distinctStrings(strings)) {\n const renamed = renamedValue(found.value, version);\n const line = lineOf(found.start);\n const dynamic = found.isModuleSpecifier ? dynamicPackage(found.value) : undefined;\n if (renamed === undefined) {\n manualSteps.push(...(dynamic === undefined ? [] : [dynamicStep(line, found.value, dynamic)]));\n continue;\n }\n // A string inside a template that was replaced is part of the replacement, which keeps it as\n // written, so it can only be reported.\n if (!found.isModuleSpecifier || found.start < copiedUpTo) {\n manualSteps.push({ kind: \"string-names-package\", line, value: found.value, to: renamed.to });\n continue;\n }\n changes.push({ kind: \"specifier-renamed\", line, from: found.value, to: renamed.to });\n // A deep import reaches into the package's files, whose layout is not part of the contract.\n if (renamed.isDeep) {\n manualSteps.push({ kind: \"deep-import\", line, specifier: renamed.to });\n }\n if (renamed.keptSpec !== undefined) {\n manualSteps.push({ kind: \"spec-kept\", name: renamed.to, spec: renamed.keptSpec });\n }\n migrated += `${text.slice(copiedUpTo, found.start)}${renamed.to}`;\n copiedUpTo = found.end;\n }\n return { text: migrated + text.slice(copiedUpTo), changes, manualSteps };\n}\n\n/**\n * The module specifiers of a source file as the migration leaves them: an original package with\n * its new name, any other specifier as written, each with its line.\n */\nexport function importedSpecifiers(\n text: string,\n strings: readonly SourceString[],\n): ImportedSpecifier[] {\n const lineOf = lineLocator(text);\n return strings\n .filter((found) => found.isModuleSpecifier)\n .map((found) => ({\n specifier: renamedSpecifier(found.value)?.to ?? found.value,\n line: lineOf(found.start),\n }));\n}\n","import { catalogMaps } from \"./catalogs.js\";\nimport {\n type DocumentRead,\n isMap,\n type TreeMap,\n unreadableConfig,\n valuesAt,\n} from \"./config-documents.js\";\nimport { type Findings, migrateSpecMap, newFindings, type RenameTarget } from \"./dependency-map.js\";\nimport type { FileMigration } from \"./migration-findings.js\";\nimport { overriddenPackages } from \"./override-targets.js\";\nimport { applyTextEdits } from \"./text-edits.js\";\nimport { nestedKeys, specEntries } from \"./tree-entries.js\";\n\n/**\n * Catalogs in YAML: `pnpm-workspace.yaml` (pnpm) and `.yarnrc.yml` (Yarn 4.10 and newer). A\n * project whose package.json says `\"openapi-fetch\": \"catalog:\"` keeps its version here, so the\n * entry and that dependency must keep one name whatever its spec is, or the install fails\n * (`ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`); the catalog plan (domain/catalogs.ts) says\n * which entries keep the old one. Only the renamed keys and values are replaced\n * in the text, so comments and formatting stay (domain/config-documents.ts). Only entries of\n * `catalog:` and `catalogs:` are renamed; sections that can name an original package without\n * being a catalog are reported, like the same fields of package.json.\n */\nexport interface CatalogFile {\n /** Sections whose keys can target a package: reported, not renamed. */\n readonly reportedSections: ReadonlySet<string>;\n}\n\nexport const PNPM_WORKSPACE_FILE: CatalogFile = {\n reportedSections: new Set([\"overrides\", \"patchedDependencies\"]),\n};\n\n/** Yarn keeps overrides in package.json (`resolutions`), not in `.yarnrc.yml`. */\nexport const YARNRC_FILE: CatalogFile = { reportedSections: new Set() };\n\nfunction migrateCatalogs(workspace: TreeMap, target: RenameTarget, findings: Findings): void {\n for (const { name, label, map } of catalogMaps(workspace)) {\n const context = {\n ...target,\n map: { kind: \"catalog\", catalog: label, name } as const,\n findings,\n };\n migrateSpecMap(specEntries(map), context);\n }\n}\n\n/** The keys of `sections` (at any depth) that target an original package. */\nfunction reportSections(workspace: TreeMap, file: CatalogFile, findings: Findings): void {\n for (const field of file.reportedSections) {\n for (const name of overriddenPackages(valuesAt(workspace, field).flatMap(nestedKeys))) {\n findings.manualSteps.push({ kind: \"override-names-package\", field, name });\n }\n }\n}\n\n/**\n * Rename the original packages in the catalogs of a YAML file (`read` is `text` parsed); report\n * its other sections that name them.\n */\nexport function migrateWorkspaceCatalogs(\n text: string,\n read: DocumentRead,\n target: RenameTarget,\n file: CatalogFile,\n): FileMigration {\n if (read.kind === \"unreadable\") {\n return unreadableConfig(text, read.offset);\n }\n const findings = newFindings();\n for (const workspace of read.documents.filter(isMap)) {\n migrateCatalogs(workspace, target, findings);\n reportSections(workspace, file, findings);\n }\n const { edits, changes, manualSteps } = findings;\n return { text: applyTextEdits(text, edits), changes, manualSteps };\n}\n","import {\n type CommandMigration,\n commandWordFindings,\n type FileVariables,\n type Locate,\n type ShellTextFindings,\n} from \"./command-migration.js\";\nimport { type DocumentString, ownerKey } from \"./config-documents.js\";\nimport { type Change, lineLocator } from \"./migration-findings.js\";\nimport { PACKAGE_RENAMES } from \"./package-names.js\";\nimport { shellVariables } from \"./shell-variables.js\";\nimport { type ShellCommand, type ShellWord, shellCommands } from \"./shell-words.js\";\nimport { applyTextEdits, type TextEdit } from \"./text-edits.js\";\n\n/**\n * YAML files are migrated only where they hold commands or package names, so the text of other\n * values (an OpenAPI `description`, a label) stays as written even when it names a package.\n */\n\n/**\n * Keys whose value is a shell command or a list of them: GitHub Actions and lefthook `run`,\n * GitLab, Travis and Bitbucket `script` and its hooks, Azure Pipelines `script` / `bash` /\n * `pwsh`, CircleCI `command`, Drone `commands`, Docker Compose `command` and `entrypoint`.\n */\nexport const YAML_COMMAND_KEYS: ReadonlySet<string> = new Set([\n \"run\",\n \"script\",\n \"before_script\",\n \"after_script\",\n \"before_install\",\n \"install\",\n \"bash\",\n \"pwsh\",\n \"powershell\",\n \"command\",\n \"commands\",\n \"entrypoint\",\n]);\n\n/**\n * Keys whose map holds environment variables (GitHub Actions, Drone and Woodpecker `env`). A\n * variable can hold a command that a step runs as `$GEN`, so each value is read as shell text:\n * it changes only where the generator is in command position, never in a sentence that names it.\n */\nconst ENVIRONMENT_KEYS: ReadonlySet<string> = new Set([\"env\"]);\n\nconst isEnvironmentValue = (value: DocumentString): boolean =>\n value.path.length >= 2 && ENVIRONMENT_KEYS.has(String(value.path.at(-2)));\n\n/**\n * The `env` variables of a file as its commands use them: `$GEN` runs the generator when an `env`\n * map sets `GEN` to it. The maps of a workflow, a job and a step are read as one, by name.\n */\nfunction environmentVariables(text: string, strings: readonly DocumentString[]): FileVariables {\n return shellVariables(\n strings\n .filter(isEnvironmentValue)\n .map((value) => ({ name: String(value.path.at(-1)), value: shellText(text, value) })),\n );\n}\n\n/** Keys of a Dependabot config whose values are package names (`ignore`, `allow`, `groups`). */\nexport const DEPENDABOT_NAME_KEYS: ReadonlySet<string> = new Set([\n \"dependency-name\",\n \"patterns\",\n \"exclude-patterns\",\n]);\n\n/** A line break between two lines with text; a blank line between them stays a line break. */\nconst FOLDED_LINE_BREAK_RE = /(?<=\\S[^\\S\\n]*)\\n(?=[^\\S\\n]*\\S)/g;\n\n/**\n * The shell text of a value: where YAML folds a line break to a space, so does the shell text.\n * The replacement keeps the length, so offsets into it are offsets into the value as written.\n */\n/**\n * A GitHub Actions expression that reads one `env` variable: `${{ env.NAME }}`. The runner puts its\n * value into the command before the shell runs, as the shell expands `$NAME`.\n */\nconst ENV_EXPRESSION_RE = /\\$\\{\\{[ \\t]*env\\.([A-Za-z_][A-Za-z0-9_]*)[ \\t]*\\}\\}/g;\n\n/** `${{ env.NAME }}` read as `$NAME`, padded with blanks so that every offset stays. */\nconst asShellVariable = (expression: string, name: string): string =>\n `$${name}`.padEnd(expression.length, \" \");\n\nfunction shellText(text: string, value: DocumentString): string {\n const slice = text.slice(value.content.start, value.content.end);\n const unfolded = value.isFolded ? slice.replace(FOLDED_LINE_BREAK_RE, \" \") : slice;\n return unfolded.replace(ENV_EXPRESSION_RE, asShellVariable);\n}\n\n/** The values that belong to one of `keys`, also as items of a list. */\nconst valuesOf = (\n strings: readonly DocumentString[],\n keys: ReadonlySet<string>,\n): DocumentString[] => strings.filter((string) => keys.has(ownerKey(string.path) ?? \"\"));\n\n/**\n * Keys whose list value is one command in exec form, as Compose and Kubernetes read it: each item\n * is one word, and no shell splits it. A string value of these keys is still shell text.\n */\nconst EXEC_FORM_KEYS: ReadonlySet<string> = new Set([\"command\", \"entrypoint\"]);\n\nconst isExecFormItem = (value: DocumentString): boolean =>\n typeof value.path.at(-1) === \"number\" && EXEC_FORM_KEYS.has(String(value.path.at(-2)));\n\nconst listOf = (item: DocumentString): string => item.path.slice(0, -1).join(\".\");\n\n/** The next item of the same list: the documents of a stream may repeat a list's path. */\nconst isNextItem = (previous: DocumentString, item: DocumentString): boolean =>\n listOf(previous) === listOf(item) && Number(item.path.at(-1)) > Number(previous.path.at(-1));\n\n/** The commands of exec-form lists, one per list, each item a word. */\nfunction execFormCommands(text: string, items: readonly DocumentString[]): ShellCommand[] {\n const commands: ShellWord[][] = [];\n let previous: DocumentString | undefined;\n let command: ShellWord[] = [];\n for (const item of items) {\n if (previous === undefined || !isNextItem(previous, item)) {\n command = [];\n commands.push(command);\n }\n const { start, end } = item.content;\n command.push({ start, end, value: item.value, raw: text.slice(start, end) });\n previous = item;\n }\n return commands;\n}\n\n/** The findings of one value read as shell text, with offsets into the whole text. */\nfunction valueFindings(\n text: string,\n value: DocumentString,\n locate: Locate,\n variables?: FileVariables,\n): ShellTextFindings {\n const { start } = value.content;\n const commands = shellCommands(shellText(text, value));\n const found = commandWordFindings(commands, (offset) => locate(start + offset), variables);\n return { ...found, edits: shiftedEdits(found.edits, start) };\n}\n\n/** The edits of shell findings in a value, as offsets into the whole text. */\nconst shiftedEdits = (edits: readonly TextEdit[], offset: number): TextEdit[] =>\n edits.map((edit) => ({ ...edit, start: edit.start + offset, end: edit.end + offset }));\n\nfunction appliedFindings(text: string, found: readonly ShellTextFindings[]): CommandMigration {\n return {\n text: applyTextEdits(\n text,\n found.flatMap((findings) => findings.edits),\n ),\n changes: found.flatMap((findings) => findings.changes),\n manualSteps: found.flatMap((findings) => findings.manualSteps),\n };\n}\n\n/**\n * Migrate the commands of a YAML file (CI workflows, Compose files, hook configs). Edits replace\n * words only, never the blanks between them, so they apply to the value as written even where a\n * folded scalar was read with spaces for its line breaks.\n */\nexport function migrateYamlCommands(\n text: string,\n file: string,\n strings: readonly DocumentString[],\n): CommandMigration {\n const values = valuesOf(strings, YAML_COMMAND_KEYS);\n const lineOf = lineLocator(text);\n const locate = (offset: number): string => `${file}:${lineOf(offset)}`;\n const commandValues = new Set(values.filter((value) => !isExecFormItem(value)));\n const shellValues = strings.filter(\n (value) => commandValues.has(value) || isEnvironmentValue(value),\n );\n const variables = environmentVariables(text, strings);\n return appliedFindings(text, [\n ...shellValues.map((value) => valueFindings(text, value, locate, variables)),\n commandWordFindings(execFormCommands(text, values.filter(isExecFormItem)), locate),\n ]);\n}\n\n/** The top-level key of a pnpm `package.yaml` whose values are scripts. */\nconst SCRIPTS_KEY = \"scripts\";\n\nconst isScript = (string: DocumentString): boolean =>\n string.path.length === 2 && string.path[0] === SCRIPTS_KEY;\n\n/** Migrate the scripts of a pnpm `package.yaml` manifest; each finding names its script. */\nexport function migrateYamlScripts(\n text: string,\n strings: readonly DocumentString[],\n): CommandMigration {\n const scripts = strings.filter(isScript);\n return appliedFindings(\n text,\n scripts.map((script) => valueFindings(text, script, () => script.path.join(\".\"))),\n );\n}\n\n/** Rename the original packages that a Dependabot config ignores, allows or groups. */\nexport function migrateDependabotConfig(\n text: string,\n file: string,\n strings: readonly DocumentString[],\n): CommandMigration {\n const changes: Change[] = [];\n const edits: TextEdit[] = [];\n const lineOf = lineLocator(text);\n for (const value of valuesOf(strings, DEPENDABOT_NAME_KEYS)) {\n const from = value.value;\n const to = PACKAGE_RENAMES.get(from);\n if (to !== undefined) {\n const { start, end } = value.content;\n const location = `${file}:${lineOf(start)}`;\n changes.push({ kind: \"package-name-renamed\", location, from, to });\n edits.push({ start, end, text: to });\n }\n }\n return { text: applyTextEdits(text, edits), changes, manualSteps: [] };\n}\n","/** The names of the files the migration reads, as the tools that own them look for them. */\n\nexport const SHELL_EXTENSIONS: ReadonlySet<string> = new Set([\".sh\", \".bash\", \".zsh\"]);\nexport const MAKEFILE_EXTENSION = \".mk\";\nexport const YAML_EXTENSIONS: ReadonlySet<string> = new Set([\".yml\", \".yaml\"]);\n/** Makefiles, justfiles and Dockerfiles, by the names make, just and docker look for. */\nexport const MAKEFILE_NAMES: ReadonlySet<string> = new Set([\"Makefile\", \"makefile\", \"GNUmakefile\"]);\nexport const SHELL_FILE_NAMES: ReadonlySet<string> = new Set([\"justfile\", \"Justfile\", \".justfile\"]);\nexport const DOCKERFILE_NAMES: ReadonlySet<string> = new Set([\"Dockerfile\", \"Containerfile\"]);\n/** Git hooks that husky runs; `.husky/_/` holds husky's own generated scripts. */\nexport const HUSKY_FOLDER = \".husky/\";\nexport const HUSKY_INTERNALS = \".husky/_/\";\nexport const NX_PROJECT_FILE = \"project.json\";\nexport const DENO_CONFIG_FILES: ReadonlySet<string> = new Set([\"deno.json\", \"deno.jsonc\"]);\n/** Deno reads its import map from its config, or from a file that the config names. */\nexport const IMPORT_MAP_FILE = \"import_map.json\";\nexport const DEPENDABOT_FILES: ReadonlySet<string> = new Set([\n \".github/dependabot.yml\",\n \".github/dependabot.yaml\",\n]);\nexport const WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nexport const YARNRC_FILE_NAME = \".yarnrc.yml\";\n/** pnpm reads a manifest from `package.yaml` too. */\nexport const YAML_MANIFEST_FILES: ReadonlySet<string> = new Set([\"package.yaml\", \"package.yml\"]);\n/** pnpm also reads a manifest from `package.json5`, a format the tool reports but does not read. */\nexport const JSON5_MANIFEST_FILE = \"package.json5\";\nexport const MANIFEST_FILE = \"package.json\";\n/** The package manager writes these again on install; their entries are not commands. */\nexport const LOCK_FILES: ReadonlySet<string> = new Set([\"pnpm-lock.yaml\", \"yarn.lock\", \"bun.lock\"]);\n\nexport function baseName(path: string): string {\n return path.slice(path.lastIndexOf(\"/\") + 1);\n}\n\nexport function extensionOf(path: string): string {\n const name = baseName(path);\n const dot = name.lastIndexOf(\".\");\n return dot <= 0 ? \"\" : name.slice(dot);\n}\n","import type { CatalogPlan } from \"../domain/catalog-plan.js\";\nimport { migrateCommandLines } from \"../domain/command-migration.js\";\nimport { commandStringSteps } from \"../domain/command-strings.js\";\nimport {\n type DocumentRead,\n type DocumentString,\n documentStrings,\n unreadableConfig,\n} from \"../domain/config-documents.js\";\nimport { type ManifestDeclarations, undeclaredImportSteps } from \"../domain/declared-packages.js\";\nimport { migrateDockerfile } from \"../domain/dockerfile-migration.js\";\nimport { migrateImportMap } from \"../domain/import-map-migration.js\";\nimport {\n DENO_TASK_PATHS,\n type JsonPathPattern,\n migrateJsonCommands,\n NX_COMMAND_PATHS,\n PACKAGE_SCRIPT_PATHS,\n} from \"../domain/json-command-migration.js\";\nimport { migrateMakefile } from \"../domain/makefile-migration.js\";\nimport { migratePackageManifest, unreadManifest } from \"../domain/manifest-migration.js\";\nimport {\n type Change,\n type FileMigration,\n type ManualStep,\n unchanged,\n} from \"../domain/migration-findings.js\";\nimport { namesOriginalPackage } from \"../domain/package-names.js\";\nimport {\n importedSpecifiers,\n migrateModuleSpecifiers,\n SOURCE_EXTENSIONS,\n} from \"../domain/source-migration.js\";\nimport {\n migrateWorkspaceCatalogs,\n PNPM_WORKSPACE_FILE,\n YARNRC_FILE,\n} from \"../domain/workspace-catalog-migration.js\";\nimport {\n migrateDependabotConfig,\n migrateYamlCommands,\n migrateYamlScripts,\n} from \"../domain/yaml-migration.js\";\nimport type { CallbackRewriter, DocumentReaders, SourceStringScanner } from \"./ports.js\";\nimport {\n baseName,\n DENO_CONFIG_FILES,\n DEPENDABOT_FILES,\n DOCKERFILE_NAMES,\n extensionOf,\n HUSKY_FOLDER,\n HUSKY_INTERNALS,\n IMPORT_MAP_FILE,\n JSON5_MANIFEST_FILE,\n LOCK_FILES,\n MAKEFILE_EXTENSION,\n MAKEFILE_NAMES,\n MANIFEST_FILE,\n NX_PROJECT_FILE,\n SHELL_EXTENSIONS,\n SHELL_FILE_NAMES,\n WORKSPACE_FILE,\n YAML_EXTENSIONS,\n YAML_MANIFEST_FILES,\n YARNRC_FILE_NAME,\n} from \"./project-file-names.js\";\n\n/** What a migration of one kind of file needs besides the text. */\nexport interface MigrationContext {\n readonly version: string;\n /** What the catalogs keep under the old names, from every manifest and catalog file. */\n readonly catalogs: CatalogPlan;\n /** What every manifest of the project declares, for the imports of a source file. */\n readonly manifests: readonly ManifestDeclarations[];\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\n readonly readers: DocumentReaders;\n}\n\n/** One kind of file the migration knows, and how to migrate it. */\ninterface FileKind {\n readonly matches: (path: string) => boolean;\n readonly migrate: (text: string, path: string, context: MigrationContext) => FileMigration;\n}\n\nconst isHuskyHook = (path: string): boolean =>\n (path.startsWith(HUSKY_FOLDER) || path.includes(`/${HUSKY_FOLDER}`)) &&\n !path.includes(HUSKY_INTERNALS);\n\nconst isDependabotConfig = (path: string): boolean =>\n [...DEPENDABOT_FILES].some((file) => path === file || path.endsWith(`/${file}`));\n\n/** A migration with more manual steps appended. */\nconst withSteps = (migration: FileMigration, steps: readonly ManualStep[]): FileMigration => ({\n ...migration,\n manualSteps: [...migration.manualSteps, ...steps],\n});\n\n/** Module specifiers and `transform` callbacks are migrated; command strings are reported. */\nfunction migrateSource(text: string, path: string, context: MigrationContext): FileMigration {\n const strings = context.scanner.scan(text, path);\n const migrated = chain(migrateModuleSpecifiers(text, strings, context.version), (renamed) =>\n context.rewriter.rewrite(renamed, path),\n );\n const imports = importedSpecifiers(text, strings);\n const undeclared = undeclaredImportSteps(imports, path, context.manifests);\n return withSteps(migrated, [...commandStringSteps(text, strings), ...undeclared]);\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/** One migration of a config, given its text and that text read. */\ntype ConfigStep = (text: string, read: DocumentRead) => FileMigration;\n\n/**\n * The steps one after the other, each on the text the step before it left. A config that cannot\n * be read is reported once, and no step runs.\n */\nfunction migrateConfig(\n text: string,\n read: (text: string) => DocumentRead,\n steps: readonly ConfigStep[],\n): FileMigration {\n const first = read(text);\n if (first.kind === \"unreadable\") {\n return unreadableConfig(text, first.offset);\n }\n return steps.reduce(\n (done, step) =>\n chain(done, (current) => step(current, current === text ? first : read(current))),\n unchanged(text),\n );\n}\n\n/** A step that reads the string values of the config, with their key paths. */\nconst stringsStep =\n (migrate: (text: string, strings: readonly DocumentString[]) => FileMigration): ConfigStep =>\n (text, read) =>\n read.kind === \"unreadable\"\n ? unreadableConfig(text, read.offset)\n : migrate(text, documentStrings(read.documents));\n\nconst jsonCommandsStep = (patterns: readonly JsonPathPattern[]): ConfigStep =>\n stringsStep((text, strings) => migrateJsonCommands(text, strings, patterns));\n\n/** A JSON config migrated by `steps`. */\nconst jsonConfig =\n (steps: (context: MigrationContext) => readonly ConfigStep[]): FileKind[\"migrate\"] =>\n (text, _path, context) =>\n migrateConfig(text, (current) => context.readers.json.read(current), steps(context));\n\n/** A YAML config migrated by `steps`, which also get its path. */\nconst yamlConfig =\n (\n steps: (context: MigrationContext, path: string) => readonly ConfigStep[],\n ): FileKind[\"migrate\"] =>\n (text, path, context) =>\n migrateConfig(text, (current) => context.readers.yaml.read(current), steps(context, path));\n\n/**\n * A migration that leaves a text naming no original package as it is, without reading it. For\n * the files whose findings all start at an old name: commands and Dependabot names. Any YAML file\n * matches the command kind, and an OpenAPI document of megabytes is read in seconds, for nothing.\n */\nconst whenNamed =\n (migrate: FileKind[\"migrate\"]): FileKind[\"migrate\"] =>\n (text, path, context) =>\n namesOriginalPackage(text) ? migrate(text, path, context) : unchanged(text);\n\n/** The kinds in order; the first that matches a path migrates it. */\nconst FILE_KINDS: readonly FileKind[] = [\n {\n matches: (path) => baseName(path) === MANIFEST_FILE,\n migrate: jsonConfig(({ version, catalogs }) => [\n (text, read) => migratePackageManifest(text, read, { version, catalogs }),\n jsonCommandsStep(PACKAGE_SCRIPT_PATHS),\n ]),\n },\n {\n matches: (path) => YAML_MANIFEST_FILES.has(baseName(path)),\n migrate: yamlConfig(({ version, catalogs }) => [\n (text, read) => migratePackageManifest(text, read, { version, catalogs }),\n stringsStep(migrateYamlScripts),\n ]),\n },\n {\n matches: (path) => baseName(path) === JSON5_MANIFEST_FILE,\n migrate: unreadManifest,\n },\n {\n matches: (path) => baseName(path) === WORKSPACE_FILE,\n migrate: yamlConfig(({ version, catalogs }) => [\n (text, read) =>\n migrateWorkspaceCatalogs(text, read, { version, catalogs }, PNPM_WORKSPACE_FILE),\n ]),\n },\n {\n matches: (path) => baseName(path) === YARNRC_FILE_NAME,\n migrate: yamlConfig(({ version, catalogs }) => [\n (text, read) => migrateWorkspaceCatalogs(text, read, { version, catalogs }, YARNRC_FILE),\n ]),\n },\n {\n matches: (path) => SOURCE_EXTENSIONS.has(extensionOf(path)),\n migrate: migrateSource,\n },\n {\n matches: (path) => baseName(path) === NX_PROJECT_FILE,\n migrate: jsonConfig(() => [jsonCommandsStep(NX_COMMAND_PATHS)]),\n },\n {\n matches: (path) => DENO_CONFIG_FILES.has(baseName(path)),\n migrate: jsonConfig(({ version }) => [\n (text, read) => migrateImportMap(text, read, version),\n jsonCommandsStep(DENO_TASK_PATHS),\n ]),\n },\n {\n matches: (path) => baseName(path) === IMPORT_MAP_FILE,\n migrate: jsonConfig(({ version }) => [(text, read) => migrateImportMap(text, read, version)]),\n },\n {\n matches: isDependabotConfig,\n migrate: whenNamed(\n yamlConfig((_context, path) => [\n stringsStep((text, strings) => migrateDependabotConfig(text, path, strings)),\n ]),\n ),\n },\n {\n matches: (path) => YAML_EXTENSIONS.has(extensionOf(path)),\n migrate: whenNamed(\n yamlConfig((_context, path) => [\n stringsStep((text, strings) => migrateYamlCommands(text, path, strings)),\n ]),\n ),\n },\n {\n matches: (path) => DOCKERFILE_NAMES.has(baseName(path)),\n migrate: whenNamed((text, path) => migrateDockerfile(text, path)),\n },\n {\n matches: (path) =>\n MAKEFILE_NAMES.has(baseName(path)) || extensionOf(path) === MAKEFILE_EXTENSION,\n migrate: whenNamed((text, path) => migrateMakefile(text, path)),\n },\n {\n matches: (path) =>\n SHELL_EXTENSIONS.has(extensionOf(path)) ||\n SHELL_FILE_NAMES.has(baseName(path)) ||\n isHuskyHook(path),\n migrate: whenNamed((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 { DocumentRead } from \"../domain/config-documents.js\";\nimport type { DocumentReaders } from \"./ports.js\";\nimport {\n baseName,\n DENO_CONFIG_FILES,\n IMPORT_MAP_FILE,\n JSON5_MANIFEST_FILE,\n MANIFEST_FILE,\n WORKSPACE_FILE,\n YAML_MANIFEST_FILES,\n YARNRC_FILE_NAME,\n} from \"./project-file-names.js\";\n\n/**\n * How a file takes part in the project plan: a manifest names dependencies on catalogs (and bun\n * keeps catalogs in package.json) and declares packages, a workspace file holds catalogs\n * (domain/catalogs.ts), and a Deno import map declares the packages that sources import.\n */\nexport interface PlanSource {\n readonly role: \"manifest\" | \"catalogs\" | \"import-map\";\n /** Undefined for a format the tool does not read; such a file counts as declaring all. */\n readonly read: ((text: string, readers: DocumentReaders) => DocumentRead) | undefined;\n}\n\nconst readJson = (text: string, readers: DocumentReaders) => readers.json.read(text);\nconst readYaml = (text: string, readers: DocumentReaders) => readers.yaml.read(text);\n\n/** The part a file plays in the project plan, or undefined for a file that plays none. */\nexport function planSourceOf(path: string): PlanSource | undefined {\n const name = baseName(path);\n if (name === MANIFEST_FILE) {\n return { role: \"manifest\", read: readJson };\n }\n if (DENO_CONFIG_FILES.has(name) || name === IMPORT_MAP_FILE) {\n return { role: \"import-map\", read: readJson };\n }\n if (YAML_MANIFEST_FILES.has(name)) {\n return { role: \"manifest\", read: readYaml };\n }\n if (name === JSON5_MANIFEST_FILE) {\n return { role: \"manifest\", read: undefined };\n }\n const isCatalogFile = name === WORKSPACE_FILE || name === YARNRC_FILE_NAME;\n return isCatalogFile ? { role: \"catalogs\", read: readYaml } : undefined;\n}\n","import type { CatalogPlan } from \"../domain/catalog-plan.js\";\nimport { planCatalogs } from \"../domain/catalogs.js\";\nimport { isMap, type TreeMap } from \"../domain/config-documents.js\";\nimport {\n declaredNames,\n type ManifestDeclarations,\n namesUninstalledPackage,\n} from \"../domain/declared-packages.js\";\nimport { importMapNames } from \"../domain/import-map-migration.js\";\nimport type { Change, ManualStep } from \"../domain/migration-findings.js\";\nimport { namesOriginalPackage } from \"../domain/package-names.js\";\nimport { fileMigrationFor, type MigrationContext } from \"./file-migrations.js\";\nimport { type PlanSource, planSourceOf } from \"./plan-sources.js\";\nimport type {\n CallbackRewriter,\n DocumentReaders,\n FileProblem,\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 readers: DocumentReaders;\n readonly logger: Logger;\n}\n\nexport interface MigrateProjectInput {\n /** The openapi-typesafe version that renamed dependencies get. */\n readonly version: string;\n /** Write the changed files; without it the migration only reports (dry run). */\n readonly isWrite: boolean;\n}\n\n/**\n * What happened to the changed files. A write that fails stops the writing: the files written\n * before it are named, and so are the ones that were not written.\n */\nexport type WriteOutcome =\n | { readonly kind: \"dry-run\" }\n | { readonly kind: \"written\"; readonly paths: readonly string[] }\n | {\n readonly kind: \"failed\";\n readonly written: readonly string[];\n readonly failed: SkippedFile;\n readonly notWritten: readonly string[];\n };\n\n/**\n * What the migration found: the files with changes or manual steps, the paths that were not\n * read, and what was written.\n */\nexport interface ProjectMigration {\n readonly files: readonly FileReport[];\n readonly skipped: readonly SkippedFile[];\n readonly write: WriteOutcome;\n}\n\n/** What the migration found in one file. */\nexport interface FileReport {\n readonly path: string;\n readonly isChanged: boolean;\n readonly changes: readonly Change[];\n readonly manualSteps: readonly ManualStep[];\n}\n\n/** A file's report and the text to write; the text is undefined when nothing changed. */\ninterface PlannedFile {\n readonly report: FileReport;\n readonly text: string | undefined;\n}\n\ntype FilePlan =\n | { readonly kind: \"planned\"; readonly file: PlannedFile }\n | { readonly kind: \"skipped\"; readonly reason: FileProblem }\n | { readonly kind: \"not-migrated\" };\n\n/**\n * What every file of a project is migrated with: the tool's version, the catalog plan and what the\n * manifests declare.\n */\ninterface ProjectTarget {\n readonly version: string;\n readonly catalogs: CatalogPlan;\n readonly manifests: readonly ManifestDeclarations[];\n}\n\nasync function planFile(\n path: string,\n dependencies: MigrateProjectDependencies,\n target: ProjectTarget,\n): Promise<FilePlan> {\n const migrate = fileMigrationFor(path);\n if (migrate === undefined) {\n return { kind: \"not-migrated\" };\n }\n const read = await dependencies.files.read(path);\n if (read.kind === \"skipped\") {\n return read;\n }\n const { rewriter, scanner, readers } = dependencies;\n const context: MigrationContext = { ...target, rewriter, scanner, readers };\n const migration = migrate(read.text, path, context);\n const isChanged = migration.text !== read.text;\n const { changes, manualSteps } = migration;\n if (isChanged || manualSteps.length > 0) {\n dependencies.logger.info(\"file_migrated\", { path, isChanged, changes, manualSteps });\n }\n const report = { path, isChanged, changes, manualSteps };\n return { kind: \"planned\", file: { report, text: isChanged ? migration.text : undefined } };\n}\n\ninterface ProjectPlan {\n readonly files: readonly PlannedFile[];\n readonly skipped: readonly SkippedFile[];\n}\n\n/**\n * A manifest, catalog or import map file as the plan reads it: whether it names an original\n * package, and its parsed roots; `roots` is undefined when the file cannot be read or parsed.\n */\ninterface PlanRead {\n readonly namesOriginal: boolean;\n readonly roots: readonly TreeMap[] | undefined;\n}\n\nasync function readForPlan(\n path: string,\n source: PlanSource,\n dependencies: MigrateProjectDependencies,\n): Promise<PlanRead> {\n const read = await dependencies.files.read(path);\n if (read.kind !== \"read\") {\n return { namesOriginal: false, roots: undefined };\n }\n const namesOriginal = namesOriginalPackage(read.text);\n // A file that names none of the packages adds nothing, so it is not parsed (the same gate as\n // the migration's own, which keeps large YAML files fast).\n if (!namesOriginal && !namesUninstalledPackage(read.text)) {\n return { namesOriginal, roots: [] };\n }\n const parsed = source.read?.(read.text, dependencies.readers);\n const roots = parsed?.kind === \"read\" ? parsed.documents.filter(isMap) : undefined;\n return { namesOriginal, roots };\n}\n\n/** The names that a manifest or an import map declares, by the role of its file. */\nconst DECLARED_NAMES: Readonly<\n Record<PlanSource[\"role\"], ((root: TreeMap) => string[]) | undefined>\n> = { manifest: declaredNames, \"import-map\": importMapNames, catalogs: undefined };\n\n/**\n * The catalog plan of the project and what its manifests and import maps declare, from the files\n * of the listing. A file that cannot be read or parsed adds no catalogs, and is reported when it\n * is migrated; such a manifest or import map counts as declaring every package.\n */\nasync function planProjectTarget(\n paths: readonly string[],\n dependencies: MigrateProjectDependencies,\n version: string,\n): Promise<ProjectTarget> {\n const documents: Record<\"manifest\" | \"catalogs\", TreeMap[]> = { manifest: [], catalogs: [] };\n const manifests: ManifestDeclarations[] = [];\n for (const path of paths) {\n const source = planSourceOf(path);\n if (source === undefined) {\n continue;\n }\n const { namesOriginal, roots } = await readForPlan(path, source, dependencies);\n if (namesOriginal && source.role !== \"import-map\") {\n documents[source.role].push(...(roots ?? []));\n }\n const names = DECLARED_NAMES[source.role];\n if (names !== undefined) {\n manifests.push({ path, names: roots && new Set(roots.flatMap(names)) });\n }\n }\n const catalogs = planCatalogs({\n manifests: documents.manifest,\n catalogFiles: documents.catalogs,\n });\n return { version, catalogs, manifests };\n}\n\n/**\n * Every file is read and migrated before anything is written, so a file that cannot be read\n * leaves the project as it was instead of half migrated. Such a file is skipped and reported.\n */\nasync function planProject(\n paths: readonly string[],\n dependencies: MigrateProjectDependencies,\n version: string,\n): Promise<ProjectPlan> {\n const files: PlannedFile[] = [];\n const skipped: SkippedFile[] = [];\n const target = await planProjectTarget(paths, dependencies, version);\n for (const path of paths) {\n const plan = await planFile(path, dependencies, target);\n if (plan.kind === \"skipped\") {\n skipped.push({ path, reason: plan.reason });\n dependencies.logger.warn(\"file_skipped\", { path, reason: plan.reason });\n } else if (plan.kind === \"planned\") {\n const { report } = plan.file;\n const isReported = report.isChanged || report.manualSteps.length > 0;\n files.push(...(isReported ? [plan.file] : []));\n }\n }\n return { files, skipped };\n}\n\n/** Writes the changed files in path order and stops at the first one that fails. */\nasync function writeFiles(\n planned: readonly PlannedFile[],\n dependencies: MigrateProjectDependencies,\n): Promise<WriteOutcome> {\n const changed = planned.flatMap(({ report, text }) =>\n text === undefined ? [] : [{ path: report.path, text }],\n );\n const written: string[] = [];\n for (const [index, { path, text }] of changed.entries()) {\n const result = await dependencies.files.write(path, text);\n if (result.kind === \"failed\") {\n dependencies.logger.warn(\"file_write_failed\", { path, reason: result.reason, written });\n const notWritten = changed.slice(index + 1).map((file) => file.path);\n return { kind: \"failed\", written, failed: { path, reason: result.reason }, notWritten };\n }\n written.push(path);\n }\n return { kind: \"written\", paths: written };\n}\n\n/**\n * Migrate every file of a project (ENGINEERING_PLAN 10.1): package.json files, catalogs, module\n * specifiers and `transform` callbacks in sources, and the generator command in scripts. Reads\n * and migrates every file first, then writes the changed ones, only with `isWrite`. Gives the\n * files with changes or manual steps in path order, the skipped paths, and what was written.\n */\nexport async function migrateProject(\n dependencies: MigrateProjectDependencies,\n input: MigrateProjectInput,\n): Promise<ProjectMigration> {\n const listing = await dependencies.files.listFiles();\n const paths = [...listing.files].sort();\n dependencies.logger.info(\"migration_started\", { fileCount: paths.length, ...input });\n const plan = await planProject(paths, dependencies, input.version);\n const skipped = [...listing.skipped, ...plan.skipped];\n const write: WriteOutcome = input.isWrite\n ? await writeFiles(plan.files, dependencies)\n : { kind: \"dry-run\" };\n dependencies.logger.info(\"migration_finished\", {\n changedFiles: plan.files.length,\n skippedFiles: skipped.length,\n write: write.kind,\n });\n return { files: plan.files.map((file) => file.report), skipped, write };\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { ManualStep, TransformKeepReason } from \"../domain/migration-findings.js\";\nimport { FLAG_RENAMES, PACKAGE_RENAMES } from \"../domain/package-names.js\";\n\n/** The user-facing text of the manual steps in the report (CODING_PRINCIPLES 7.8). */\n\n// The same guide the generator links in its deprecation warning.\nconst IR_CALLBACKS_GUIDE =\n \"https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks\";\nconst OPENAPI_FETCH_ALIAS_GUIDE =\n \"https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md\" +\n \"#libraries-built-on-openapi-fetch\";\n\nconst KEEP_REASONS: Readonly<Record<TransformKeepReason, string>> = {\n \"other-callbacks\":\n \"postTransform or transformProperty are set too, and they need TypeScript nodes\",\n \"not-a-function\": \"it is not an inline function or a function of this file\",\n \"shared-function\": \"the function it names is used elsewhere too\",\n \"shared-options\": \"its options object is used elsewhere too\",\n \"unknown-return\": \"a return value is not a plain ts.factory type\",\n};\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 OLD_FILE_NOTE =\n \"is a file of openapi-typescript, which is no longer installed: run openapi-typesafe instead\";\nconst FLAGS_IN_VARIABLE_NOTE =\n \"holds old flags of the generator and may serve other commands, so it was kept: rename\";\nconst NOT_ONLY_GENERATOR_NOTE =\n \"runs openapi-typescript in some of its definitions in this file and another program in \" +\n \"others, so the flags after it were kept; where it runs the generator, rename\";\nconst COMMAND_STRING_NOTE = \"a string runs openapi-typescript, so it was kept; change it to\";\nconst OPTIONS_NOTE =\n \"the options of openapiTS() are not an object written in this file: check them for \" +\n `transform, postTransform and transformProperty. See ${IR_CALLBACKS_GUIDE}`;\nconst MANIFEST_NOT_READ_NOTE =\n \"is a JSON5 manifest, which the tool does not read: rename the packages and the generator \" +\n \"command by hand, or write it as package.json and run the tool again\";\nconst DEEP_IMPORT_NOTE = \"imports a file inside the package; check that it exists\";\nconst DYNAMIC_NOTE =\n \"builds its module name at run time from an old package name, so it was kept; rename it to\";\nconst STRING_NOTE = \"is a string, not a module specifier, so it was kept\";\nconst STRING_FIX_NOTE = \"if it names the package, change it to\";\nconst KEPT_NOTE = `it works, with a deprecation warning. See ${IR_CALLBACKS_GUIDE}`;\nconst LEGACY_CALLBACK_NOTE = `receives TypeScript nodes (deprecated). See ${IR_CALLBACKS_GUIDE}`;\nconst HELPER_TYPES_ENTRY = \"openapi-typesafe-fetch/helpers\";\n\nfunction packageNotDeclaredMessage(\n step: Extract<ManualStep, { kind: \"package-not-declared\" }>,\n): string {\n const { line, name, installers } = step;\n return (\n `line ${line}: no package.json or Deno import map at or above this file lists ${name}; ` +\n `${installers.join(\" and \")} installed it, the openapi-typesafe packages do not: ` +\n `add it to the dependencies, or import the types from ${HELPER_TYPES_ENTRY}`\n );\n}\n\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\nfunction pinnedPackageMessage(step: Extract<ManualStep, { kind: \"pinned-package\" }>): string {\n const successor = PACKAGE_RENAMES.get(step.name) ?? step.name;\n return (\n `${step.location} names a pinned ${step.name}@<version>: ` +\n `change it to ${successor}@<version>`\n );\n}\n\n/** `-it to --immutable, …`: each old flag with its new name. */\nconst flagRenames = (flags: readonly string[]): string =>\n flags.map((flag) => `${flag} to ${FLAG_RENAMES.get(flag) ?? flag}`).join(\", \");\n\nfunction flagsInVariableMessage(step: Extract<ManualStep, { kind: \"flags-in-variable\" }>) {\n return `${step.location}: ${step.variable} ${FLAGS_IN_VARIABLE_NOTE} ${flagRenames(step.flags)}`;\n}\n\nfunction notOnlyGeneratorMessage(\n step: Extract<ManualStep, { kind: \"variable-not-only-generator\" }>,\n): string {\n return `${step.location}: ${step.variable} ${NOT_ONLY_GENERATOR_NOTE} ${flagRenames(step.flags)}`;\n}\n\n/** The manual steps found in commands: scripts, shell files, CI files and command strings. */\ntype CommandStep = Extract<\n ManualStep,\n {\n kind:\n | \"versioned-command\"\n | \"flags-in-variable\"\n | \"variable-not-only-generator\"\n | \"pinned-package\"\n | \"old-package-file\"\n | \"command-string\";\n }\n>;\n\nconst COMMAND_STEP_KINDS: ReadonlySet<ManualStep[\"kind\"]> = new Set([\n \"versioned-command\",\n \"flags-in-variable\",\n \"variable-not-only-generator\",\n \"pinned-package\",\n \"old-package-file\",\n \"command-string\",\n]);\n\nconst isCommandStep = (step: ManualStep): step is CommandStep => COMMAND_STEP_KINDS.has(step.kind);\n\nfunction commandStepMessage(step: CommandStep): string {\n switch (step.kind) {\n case \"versioned-command\":\n return `${step.location} runs a pinned openapi-typescript@<version>: ${PINNED_NOTE}`;\n case \"flags-in-variable\":\n return flagsInVariableMessage(step);\n case \"variable-not-only-generator\":\n return notOnlyGeneratorMessage(step);\n case \"pinned-package\":\n return pinnedPackageMessage(step);\n case \"old-package-file\":\n return `${step.location}: ${step.path} ${OLD_FILE_NOTE}`;\n case \"command-string\":\n return `line ${step.line}: ${COMMAND_STRING_NOTE} \"${step.to}\"`;\n default:\n return assertNever(step);\n }\n}\n\n/** Steps for places of a structured file (JSON, YAML) that the tool could not edit. */\ntype UneditedStep = Extract<\n ManualStep,\n {\n kind:\n | \"config-unreadable\"\n | \"manifest-not-read\"\n | \"entry-not-edited\"\n | \"name-collision\"\n | \"catalog-reference-kept\"\n | \"catalog-entry-in-use\";\n }\n>;\n\nfunction uneditedStepMessage(step: UneditedStep): string {\n switch (step.kind) {\n case \"config-unreadable\":\n return step.position === undefined\n ? \"nests too deep to be read; migrate it by hand\"\n : `cannot be parsed at line ${step.position.line}, column ${step.position.column}; ` +\n \"migrate it by hand\";\n case \"manifest-not-read\":\n return MANIFEST_NOT_READ_NOTE;\n case \"entry-not-edited\":\n return `${step.field}: ${step.name} has a value the tool does not read; rename it by hand`;\n case \"name-collision\":\n return (\n `${step.field} has both ${step.from} and ${step.to}, so ${step.from} was kept: ` +\n \"remove one of them\"\n );\n case \"catalog-reference-kept\":\n return (\n `${step.field}: ${step.name} was kept, because catalog \"${step.catalog}\" keeps ` +\n `${step.name}: rename the entry and the dependency together`\n );\n case \"catalog-entry-in-use\":\n return (\n `${step.catalog}: ${step.name} was kept, because a dependency or an override still ` +\n \"names it: rename the entry and what names it together\"\n );\n default:\n return assertNever(step);\n }\n}\n\n/** Steps for a line of a source file. */\ntype SourceStep = Extract<\n ManualStep,\n {\n kind:\n | \"options-not-inspected\"\n | \"deep-import\"\n | \"dynamic-specifier\"\n | \"string-names-package\"\n | \"transform-not-rewritten\"\n | \"legacy-callback\"\n | \"package-not-declared\";\n }\n>;\n\nfunction sourceStepMessage(step: SourceStep): string {\n switch (step.kind) {\n case \"options-not-inspected\":\n return `line ${step.line}: ${OPTIONS_NOTE}`;\n case \"deep-import\":\n return `line ${step.line}: \"${step.specifier}\" ${DEEP_IMPORT_NOTE}`;\n case \"dynamic-specifier\":\n return `line ${step.line}: \\`${step.value}\\` ${DYNAMIC_NOTE} ${step.to}`;\n case \"string-names-package\":\n return `line ${step.line}: \"${step.value}\" ${STRING_NOTE}; ${STRING_FIX_NOTE} \"${step.to}\"`;\n case \"transform-not-rewritten\":\n return `line ${step.line}: transform kept (${KEEP_REASONS[step.reason]}); ${KEPT_NOTE}`;\n case \"legacy-callback\":\n return `line ${step.line}: ${step.callback} ${LEGACY_CALLBACK_NOTE}`;\n case \"package-not-declared\":\n return packageNotDeclaredMessage(step);\n default:\n return assertNever(step);\n }\n}\n\nexport function manualStepMessage(step: ManualStep): string {\n if (isCommandStep(step)) {\n return commandStepMessage(step);\n }\n switch (step.kind) {\n case \"config-unreadable\":\n case \"manifest-not-read\":\n case \"entry-not-edited\":\n case \"name-collision\":\n case \"catalog-reference-kept\":\n case \"catalog-entry-in-use\":\n return uneditedStepMessage(step);\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 \"options-not-inspected\":\n case \"deep-import\":\n case \"dynamic-specifier\":\n case \"string-names-package\":\n case \"transform-not-rewritten\":\n case \"legacy-callback\":\n case \"package-not-declared\":\n return sourceStepMessage(step);\n case \"old-peer-needed\":\n return oldPeerMessage(step);\n default:\n return assertNever(step);\n }\n}\n","import { assertNever } from \"../domain/assert-never.js\";\nimport type { Change } from \"../domain/migration-findings.js\";\nimport type { FileProblem } from \"./ports.js\";\n\n/**\n * The user-facing text of the report (CODING_PRINCIPLES 7.8: kept apart from the logic); the\n * manual steps have their own module, manual-step-messages.ts.\n */\n\nexport function changeMessage(change: Change): string {\n switch (change.kind) {\n case \"dependency-renamed\":\n return `${change.field}: ${change.from} → ${change.to}@${change.spec}`;\n case \"catalog-entry-renamed\":\n return `${change.catalog}: ${change.from} → ${change.to}@${change.spec}`;\n case \"import-renamed\":\n return `${change.field}: \"${change.from}\" → \"${change.to}\" (${change.target})`;\n case \"alias-renamed\":\n return `${change.field}: ${change.name} → ${change.spec}`;\n case \"command-renamed\":\n return `${change.location}: openapi-typescript → openapi-typesafe`;\n case \"flag-renamed\":\n case \"package-name-renamed\":\n return `${change.location}: ${change.from} → ${change.to}`;\n case \"specifier-renamed\":\n return `line ${change.line}: \"${change.from}\" → \"${change.to}\"`;\n case \"transform-rewritten\":\n return `line ${change.line}: transform returns type text; irCallbacks: true added`;\n case \"declaration-removed\":\n return `line ${change.line}: ${change.name} removed; only the old transform returns used it`;\n default:\n return assertNever(change);\n }\n}\n\nexport const SKIPPED_HEADING = \"Skipped (not read, not written):\";\n\n/** Why a file was not read, after its path in the \"Skipped\" section. */\nexport function skippedMessage(reason: FileProblem): string {\n switch (reason.kind) {\n case \"outside-root\":\n return \"it leads outside the project folder (a link, or a path in the git index)\";\n case \"not-utf-8\":\n return \"it is not UTF-8 text, so it was not changed; check it by hand\";\n case \"io-error\":\n return `it could not be read (${reason.code})`;\n default:\n return assertNever(reason);\n }\n}\n\nfunction writeProblemMessage(reason: FileProblem): string {\n switch (reason.kind) {\n case \"outside-root\":\n return \"it leads outside the project folder\";\n case \"not-utf-8\":\n return \"its text is not UTF-8\";\n case \"io-error\":\n return reason.code;\n default:\n return assertNever(reason);\n }\n}\n\n/** The first line of the report's end when a write failed and the writing stopped. */\nexport const writeFailedMessage = (path: string, reason: FileProblem): string =>\n `Writing stopped: ${path} could not be written (${writeProblemMessage(reason)}).`;\nexport const WRITTEN_HEADING = \"Written before it:\";\nexport const NOT_WRITTEN_HEADING = \"Not written (still as they were):\";\nexport const NONE_WRITTEN = \"Nothing was written before it.\";\n\nexport const NEXT_STEPS: readonly string[] = [\n \"Install: run your package manager's install, so the lockfile has the new packages.\",\n \"Regenerate your types and commit them once: the file header names openapi-typesafe now, \" +\n \"so `--check` fails until you do.\",\n \"Run your type check and tests.\",\n];\n\nexport const DRY_RUN_NOTE = \"Dry run: nothing was written. Run again with --write to apply.\";\nexport const WRITTEN_NOTE = \"Files were written.\";\nexport const NOTHING_FOUND =\n \"Nothing to migrate: no openapi-typescript, openapi-fetch, openapi-react-query \" +\n \"or openapi-typescript-helpers found.\";\n","import { assertNever } from \"../domain/assert-never.js\";\nimport { manualStepMessage } from \"./manual-step-messages.js\";\nimport {\n changeMessage,\n DRY_RUN_NOTE,\n NEXT_STEPS,\n NONE_WRITTEN,\n NOT_WRITTEN_HEADING,\n NOTHING_FOUND,\n SKIPPED_HEADING,\n skippedMessage,\n WRITTEN_HEADING,\n WRITTEN_NOTE,\n writeFailedMessage,\n} from \"./messages.js\";\nimport type { FileReport, ProjectMigration, WriteOutcome } 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}: ${skippedMessage(file.reason)}`);\n return [SKIPPED_HEADING, ...lines, \"\"];\n}\n\nconst listed = (paths: readonly string[]): string[] => paths.map((path) => ` ${path}`);\n\n/** The end of the report: what was written, or where the writing stopped. */\nfunction writeSection(write: WriteOutcome): string[] {\n switch (write.kind) {\n case \"dry-run\":\n return [DRY_RUN_NOTE];\n case \"written\":\n return [WRITTEN_NOTE];\n case \"failed\":\n return [\n writeFailedMessage(write.failed.path, write.failed.reason),\n ...(write.written.length === 0 ? [NONE_WRITTEN] : [WRITTEN_HEADING]),\n ...listed(write.written),\n ...(write.notWritten.length === 0 ? [] : [NOT_WRITTEN_HEADING]),\n ...listed(write.notWritten),\n ];\n default:\n return assertNever(write);\n }\n}\n\n/**\n * The summary the command prints: changes per file, manual steps, skipped paths, what to do\n * next, and what was written.\n */\nexport function renderReport(migration: ProjectMigration): string {\n const reports = migration.files;\n const skipped = skippedSection(migration.skipped);\n if (reports.length === 0) {\n 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 ...writeSection(migration.write),\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","import type { ProjectRootState } from \"../application/ports.js\";\n\n/** The command's own text: help, usage errors and the closing notes. */\n\nexport const HELP_TEXT = `Usage\n openapi-typesafe-migrate [options]\n\nMove a project from openapi-typescript, openapi-fetch, openapi-react-query and\nopenapi-typescript-helpers to the openapi-typesafe packages. Without --write it only reports.\n\nOptions\n --write Write the changes (default: dry run)\n --root <dir> The project directory (default: the current directory)\n --log <file> The JSON Lines log file (default: a new file in the temporary directory)\n --help, -h Show this help\n --version, -v Show the version\n\nExit codes\n 0 Done\n 1 The migration failed (the message and the log say why), a file could not be written\n (the report names what was written), or the log could not be created\n 2 Unknown option or argument\n`;\n\nexport const usageError = (message: string): string =>\n `${message}\\nRun openapi-typesafe-migrate --help for the options.\\n`;\n\nexport const logNote = (path: string): string => `Log: ${path}\\n`;\n\nconst ROOT_PROBLEMS: Readonly<Record<Exclude<ProjectRootState, \"directory\">, string>> = {\n missing: \"does not exist\",\n \"not-a-directory\": \"is not a folder; --root takes the project folder\",\n};\n\n/** The project folder, as resolved from `--root` or the current directory, cannot be listed. */\nexport const rootError = (root: string, state: Exclude<ProjectRootState, \"directory\">): string =>\n `The project folder ${root} ${ROOT_PROBLEMS[state]}\\n`;\n\n/** `path` is the `--log` value as given; without one the log goes to the temporary directory. */\nexport const logError = (path: string | undefined, message: string): string =>\n `Cannot create the log ${path ?? \"in the temporary directory\"}: ${message}\\n`;\n","import { migrateProject } from \"../application/migrate-project.js\";\nimport type {\n CallbackRewriter,\n DocumentReaders,\n Logger,\n ProjectFiles,\n ProjectRootState,\n SourceStringScanner,\n} from \"../application/ports.js\";\nimport { renderReport } from \"../application/report.js\";\nimport { type CliRequest, parseCliArguments } from \"./cli-arguments.js\";\nimport { HELP_TEXT, logError, logNote, rootError, usageError } from \"./cli-text.js\";\n\n/** Everything the command takes from the process, so tests run it with fakes. */\nexport interface CliDependencies {\n readonly version: string;\n readonly cwd: string;\n readonly writeStdout: (text: string) => void;\n readonly writeStderr: (text: string) => void;\n readonly inspectRoot: (root: string) => Promise<ProjectRootState>;\n readonly createFiles: (root: string, logger: Logger) => ProjectFiles;\n readonly createLogger: (path: string | undefined) => {\n readonly logger: Logger;\n readonly path: string;\n };\n readonly rewriter: CallbackRewriter;\n readonly scanner: SourceStringScanner;\n readonly readers: DocumentReaders;\n readonly resolvePath: (cwd: string, path: string) => string;\n}\n\nexport const EXIT_CODES = { success: 0, failure: 1, usage: 2 } as const;\n\nfunction parseRequest(\n argv: readonly string[],\n dependencies: CliDependencies,\n): CliRequest | undefined {\n try {\n return parseCliArguments(argv);\n } catch (error) {\n // parseArgs reports unknown options and stray positionals as a TypeError.\n if (error instanceof TypeError) {\n dependencies.writeStderr(usageError(error.message));\n return undefined;\n }\n throw error;\n }\n}\n\ntype MigrateRequest = Extract<CliRequest, { kind: \"migrate\" }>;\n\nconst errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n/**\n * The log is created before any file is read, so a log that cannot be written (a parent that is\n * a file, a read-only folder) stops the run before it changes anything.\n */\nfunction openLog(\n request: MigrateRequest,\n dependencies: CliDependencies,\n): ReturnType<CliDependencies[\"createLogger\"]> | undefined {\n try {\n return dependencies.createLogger(request.logPath);\n } catch (error) {\n dependencies.writeStderr(logError(request.logPath, errorMessage(error)));\n return undefined;\n }\n}\n\n/** Migrate the project in `root`; resolves to the exit code. */\nasync function migrateRoot(\n request: MigrateRequest,\n root: string,\n logger: Logger,\n dependencies: CliDependencies,\n): Promise<number> {\n const rootState = await dependencies.inspectRoot(root);\n if (rootState !== \"directory\") {\n logger.warn(\"root_unusable\", { root, rootState });\n dependencies.writeStderr(rootError(root, rootState));\n return EXIT_CODES.failure;\n }\n const files = dependencies.createFiles(root, logger);\n const { rewriter, scanner, readers } = dependencies;\n const input = { version: dependencies.version, isWrite: request.isWrite };\n const migration = await migrateProject({ files, rewriter, scanner, readers, logger }, input);\n dependencies.writeStdout(renderReport(migration));\n return migration.write.kind === \"failed\" ? EXIT_CODES.failure : EXIT_CODES.success;\n}\n\nasync function runMigration(\n request: MigrateRequest,\n dependencies: CliDependencies,\n): Promise<number> {\n const log = openLog(request, dependencies);\n if (log === undefined) {\n return EXIT_CODES.failure;\n }\n const { logger, path } = log;\n const root = dependencies.resolvePath(dependencies.cwd, request.root ?? \".\");\n try {\n return await migrateRoot(request, root, logger, dependencies);\n } catch (error) {\n const message = errorMessage(error);\n logger.warn(\"migration_failed\", { root, message });\n 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 { createNodeGitFileSystem } from \"../adapters/git-file-list/git-locations.js\";\nimport {\n createJsonLinesLogger,\n createTemporaryLogPath,\n} from \"../adapters/json-lines-logger/json-lines-logger.js\";\nimport { createJsonTextReader } from \"../adapters/json-text/json-text.js\";\nimport {\n createNodeProjectFiles,\n inspectProjectRoot,\n} from \"../adapters/node-project-files/node-project-files.js\";\nimport { createTypescriptCallbackRewriter } from \"../adapters/typescript-parser/rewriter.js\";\nimport { createTypescriptStringScanner } from \"../adapters/typescript-parser/source-strings.js\";\nimport { createYamlTextReader } from \"../adapters/yaml-text/yaml-text.js\";\nimport { type CliDependencies, runCli } from \"./run-cli.js\";\n\n/**\n * The composition root: the only module that touches the process. `bin/migrate.js` imports the\n * built copy of this module.\n */\n\n/** The same path from `src/cli/` and from the built `dist/cli/`. */\nconst PACKAGE_JSON = new URL(\"../../package.json\", import.meta.url);\n\nfunction readVersion(): string {\n const packageJson: { version: string } = JSON.parse(readFileSync(PACKAGE_JSON, \"utf8\"));\n return packageJson.version;\n}\n\nconst now = (): Date => new Date();\n\n/**\n * Without `--log`, a new file per run in a new private folder in the temporary directory, named\n * by its UTC start time. A `--log` file is the user's choice and gets the lines appended.\n */\nfunction createLogger(path: string | undefined): ReturnType<CliDependencies[\"createLogger\"]> {\n const isExclusive = path === undefined;\n const logPath = isExclusive ? createTemporaryLogPath(tmpdir(), now()) : resolve(path);\n return { logger: createJsonLinesLogger({ path: logPath, now, isExclusive }), path: logPath };\n}\n\n/** Git for the project at `root`: git is looked up on PATH outside that folder. */\nconst createGit = (root: string) =>\n createGitFileList({\n environment: process.env,\n platform: process.platform,\n fileSystem: createNodeGitFileSystem(),\n projectRoot: root,\n });\n\nconst dependencies: CliDependencies = {\n version: readVersion(),\n cwd: process.cwd(),\n writeStdout: (text) => process.stdout.write(text),\n writeStderr: (text) => process.stderr.write(text),\n inspectRoot: inspectProjectRoot,\n createFiles: (root, logger) => createNodeProjectFiles(root, { git: createGit(root), logger }),\n createLogger,\n rewriter: createTypescriptCallbackRewriter(),\n scanner: createTypescriptStringScanner(),\n readers: { json: createJsonTextReader(), yaml: createYamlTextReader() },\n resolvePath: resolve,\n};\n\nrunCli(process.argv.slice(2), dependencies).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"names":["listedPaths","spanOf","convert","read","baseName","files","DEFAULT_EXPORT","isExported","extensionOf","plain","singleQuoted","doubleQuoted","isScalar","isMap","PATH_SEPARATOR","SCOPE_PREFIX","ASSIGNMENT_RE","BACKSLASH","QUOTES","RECIPE_PREFIX_RE","found","NOT_LINE_BREAK_RE","migrateCatalogs"],"mappings":";;;;;;;;;AAwBA,MAAM,OAAA,GAAU,OAAA;AAChB,MAAM,aAAA,GAAgB,MAAA;AACtB,MAAM,QAAA,GAAW,KAAA;AAKjB,MAAM,4BAAA,GAA+B,MAAA;AACrC,MAAM,UAAA,GAAa,MAAA;AACnB,MAAM,aAAA,GAAgB,IAAA;AAMtB,MAAM,eAAA,GAAkB,cAAA;AAKxB,MAAM,YAAA,uBAAwC,GAAA,CAAI,CAAC,UAAU,SAAA,EAAW,QAAA,EAAU,OAAO,CAAC,CAAA;AAE1F,SAAS,SAAS,KAAA,EAAyB;AACzC,EAAA,OAAO,YAAA,CAAa,GAAA,CAAK,KAAA,EAA6C,IAAA,IAAQ,EAAE,CAAA;AAClF;AAGA,eAAe,YAAA,CAAgB,OAAyB,MAAA,EA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