@venizia/dev-configs 0.5.0-5 → 0.5.0-6

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.
Files changed (31) hide show
  1. package/dist/cli/codemod/any-aliases.d.ts +1 -1
  2. package/dist/cli/codemod/any-aliases.js +2 -2
  3. package/dist/cli/codemod/any-aliases.js.map +1 -1
  4. package/dist/cli/codemod/async-style.d.ts +1 -1
  5. package/dist/cli/codemod/async-style.js +2 -2
  6. package/dist/cli/codemod/async-style.js.map +1 -1
  7. package/dist/cli/codemod/binding-keys.d.ts +1 -1
  8. package/dist/cli/codemod/binding-keys.js +2 -2
  9. package/dist/cli/codemod/binding-keys.js.map +1 -1
  10. package/dist/cli/codemod/class-renames.d.ts +1 -1
  11. package/dist/cli/codemod/class-renames.js +2 -3
  12. package/dist/cli/codemod/class-renames.js.map +1 -1
  13. package/dist/cli/codemod/connector-imports.d.ts +1 -1
  14. package/dist/cli/codemod/connector-imports.js +2 -2
  15. package/dist/cli/codemod/connector-imports.js.map +1 -1
  16. package/dist/cli/codemod/const-class-sets.d.ts +55 -0
  17. package/dist/cli/codemod/const-class-sets.js +219 -0
  18. package/dist/cli/codemod/const-class-sets.js.map +1 -0
  19. package/dist/cli/codemod/const-classes.d.ts +21 -3
  20. package/dist/cli/codemod/const-classes.js +135 -21
  21. package/dist/cli/codemod/const-classes.js.map +1 -1
  22. package/dist/cli/codemod/env-get.d.ts +1 -1
  23. package/dist/cli/codemod/env-get.js +2 -2
  24. package/dist/cli/codemod/env-get.js.map +1 -1
  25. package/dist/cli/codemod/files.d.ts +4 -2
  26. package/dist/cli/codemod/files.js +5 -6
  27. package/dist/cli/codemod/files.js.map +1 -1
  28. package/dist/cli/codemod/namespace-functions/index.d.ts +1 -1
  29. package/dist/cli/codemod/namespace-functions/index.js +2 -2
  30. package/dist/cli/codemod/namespace-functions/index.js.map +1 -1
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"binding-ke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YAChC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;;AAtPH,gDAuPC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative, resolve } from 'node:path';\nimport { CodemodFiles } from './files';\n\nconst USAGE = `Usage: devz codemod binding-keys [paths...] [--write [--all] | --check] [--import-from <module>]\n\nRewrites the raw binding keys of the @venizia/ignis-inversion release where a key is made by BindingKeys.build<T>:\n\n container.get<Mailer>({ key: 'services.Mailer' }) becomes container.get({ key: BindingKeys.build<Mailer>({ key: 'services.Mailer' }) })\n container.bind({ key: 'services.Mailer' }) becomes container.bind({ key: BindingKeys.build<unknown>({ key: 'services.Mailer' }) })\n @inject({ key: 'services.Mailer' }) becomes @inject({ key: BindingKeys.build<unknown>({ key: 'services.Mailer' }) })\n container.get({ key: { namespace, key } }) becomes container.get({ key: BindingKeys.build<unknown>({ namespace, key }) })\n container.get({ key: \\`\\${namespace}.Name\\` }) becomes container.get({ key: BindingKeys.build<unknown>({ namespace, key: 'Name' }) })\n BindingKeys.build({ key }) becomes BindingKeys.build<unknown>({ key })\n\nThe key string is never changed.\n\nA call is rewritten only when the TypeScript checker resolves it to the framework's container (Container, IContainer,\nBinding) or to its inject and provide, under any local name. A redis.get<T>({ key }), a worker pool or a class of your own\nis left alone, type argument included. The checker reads your project through the nearest tsconfig.json, so run the codemod\nfrom the project root with the dependencies installed; a receiver it cannot resolve is listed as \"manual\". The call's own type argument moves into build<T>, so the caller keeps the type it\nclaimed; without one the codemod writes build<unknown> and lists the site (\"type\"): name the real type there.\n\nIt rewrites a call named get, gets, getBinding, bind, isBound or unbind whose argument is an object literal with a\n\\`key\\` (and, for get, \\`isOptional\\`), and a call of inject or provide. A container cannot be told from syntax, so the shape is the\ntest. A string key, a substitution-free template literal, a { namespace, key } literal and a template written\n\\${namespace}.Name or \\${namespace}.\\${name} are rewritten. These are listed\nas \"manual\" and left alone: a key made at run time (a template with substitutions, a call) and a Symbol key (symbols are no\nlonger keys). A key written Foo.name or this.constructor.name (a string TypeScript's own lib declares) is wrapped in\nplace. A key held in a name (MAILER, Keys.MAILER) is built where it is declared, in any file of the run: a const, a\nreadonly property or a property of an object literal, with a string initializer and no type annotation. Its type is the\none type its use sites claim (get<Mailer>, the type of a decorated parameter), else unknown (listed as \"type\"); the use\nsites are not edited. A name declared another way (a let, an annotation, a parameter, a call, a package you do not own)\nis listed as \"manual\". build throws on an empty key, so a computed constant that comes out '' now throws when its class loads.\n\nBindingKeys is imported from the module the file already takes inject from, else from the first @venizia/ignis import,\nor from --import-from <module>; a file with none of them is listed as manual and not rewritten. An existing import of\nBindingKeys is reused. A second run changes nothing.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts). A .js, .cjs or .mjs file is not read: edit it by hand.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change or a manual site remains (for CI)\n --import-from the module BindingKeys is imported from when the file gives no better one\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git knows, and\n--write refuses a file with local changes: commit or stash it first, so git can undo it.\nThere is no --reverse: a downgrade restores the files from git.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\n/** The methods whose options object carries a container key. */\nconst KEY_METHODS = new Set(['get', 'gets', 'getBinding', 'bind', 'isBound', 'unbind']);\n\n/** The other properties a key options object may carry and still be one. */\nconst OPTION_NAMES = new Set(['key', 'isOptional', 'scope']);\n\n/** The decorators that take a key options object. */\nconst KEY_DECORATORS = new Set(['inject', 'provide']);\n\n/** Where a file already imports the container API from. */\nconst IGNIS_MODULE = /^@venizia\\/ignis(?:-kernel|-inversion)?$/;\n\nconst BUILDER = 'BindingKeys';\n\n/** A declaration file of TypeScript's own `lib` (where `Function.name` is declared). */\nconst LIB_FILE = /[\\\\/]typescript[\\\\/]lib[\\\\/]lib\\.[^\\\\/]*\\.d\\.ts$/;\n\n/** The classes and interfaces whose key methods are the container's. */\nconst CONTAINER_TYPES = new Set([\n 'IContainer',\n 'AbstractContainer',\n 'BaseContainer',\n 'Container',\n 'Binding',\n]);\n\n/** The packages that declare the container: the framework is identified by name, wherever it is installed or checked out. */\nconst FRAMEWORK_PACKAGES = new Set([\n '@venizia/ignis',\n '@venizia/ignis-inversion',\n '@venizia/ignis-kernel',\n]);\n\n/** A module of the framework: a file's own barrel is not a place to take `BindingKeys` from. */\nconst VENIZIA_MODULE = /^@venizia\\//;\n\nclass BindingKeysFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\n static readonly CHECK = '--check';\n static readonly IMPORT_FROM = '--import-from';\n static readonly HELP = '--help';\n static readonly HELP_SHORT = '-h';\n\n static readonly SCHEME_SET = new Set<string>([\n this.WRITE,\n this.ALL,\n this.CHECK,\n this.IMPORT_FROM,\n this.HELP,\n this.HELP_SHORT,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One site the codemod would change or cannot change. */\nexport interface IBindingKeysResult {\n output: string;\n changed: boolean;\n rewritten: number;\n /** Lines where `build<unknown>` was written because the call named no type. */\n unnamed: number[];\n manual: Array<{ line: number; reason: string }>;\n}\n\n/** What the use sites of one key constant claim: each claim is the type's text and the symbols its names resolve to at the use site. */\nexport interface IKeyClaims {\n declaration: import('typescript').Node;\n claims: Array<{\n text: string | undefined;\n names: Array<{ name: string; symbol: import('typescript').Symbol | undefined }>;\n }>;\n}\n\n/** Rewrites raw binding keys to `BindingKeys.build<T>({ key })`. */\nexport class BindingKeysCodemod {\n /** The module `BindingKeys` comes from in this file: an existing import, the module of `inject`, a @venizia/ignis import, or `fallback`. */\n private static readIdentifierSource(opts: {\n typescript: typeof import('typescript');\n file: import('typescript').SourceFile;\n fallback?: string;\n }): { module: string | undefined; declared: boolean; named?: import('typescript').NamedImports } {\n const { typescript: ts, file, fallback } = opts;\n let injectModule: string | undefined;\n let ignisModule: string | undefined;\n let named: import('typescript').NamedImports | undefined;\n let declared = false;\n\n for (const statement of file.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n\n const module = statement.moduleSpecifier.text;\n const bindings = statement.importClause?.namedBindings;\n const isTypeOnly = statement.importClause?.isTypeOnly === true;\n\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const imported = (element.propertyName ?? element.name).text;\n\n if (imported === BUILDER && !isTypeOnly && !element.isTypeOnly) {\n declared = true;\n }\n\n if (imported === 'inject' && injectModule === undefined && VENIZIA_MODULE.test(module)) {\n injectModule = module;\n }\n }\n\n if (IGNIS_MODULE.test(module) && !isTypeOnly) {\n ignisModule ??= module;\n named ??= bindings;\n }\n }\n\n return { module: injectModule ?? ignisModule ?? fallback, declared, named };\n }\n\n /** The local name `BindingKeys` is imported under (an alias included), or `BindingKeys` when the file does not import it. */\n private static readBuilderName(opts: {\n typescript: typeof import('typescript');\n file: import('typescript').SourceFile;\n }): string {\n const { typescript: ts, file } = opts;\n\n for (const statement of file.statements) {\n const bindings = ts.isImportDeclaration(statement)\n ? statement.importClause?.namedBindings\n : undefined;\n\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n if ((element.propertyName ?? element.name).text === BUILDER) {\n return element.name.text;\n }\n }\n }\n\n return BUILDER;\n }\n\n /**\n * The type a key constant is built with: the one type its use sites claim, else `undefined` (`unknown`). A type is copied as\n * text into the declaration's file, so it counts only when every name in it means the same symbol at each use site and\n * at the declaration (a type of another file, not imported there, would not compile); no import is added.\n */\n static agreedType(opts: {\n typescript: typeof import('typescript');\n checker: import('typescript').TypeChecker;\n entry: IKeyClaims;\n }): string | undefined {\n const { typescript: ts, checker, entry } = opts;\n const named = entry.claims.filter((claim) => claim.text !== undefined);\n const texts = new Set(named.map((claim) => claim.text));\n\n if (texts.size !== 1) {\n return undefined;\n }\n\n // An exported declaration has a local symbol and an export symbol; an import resolves to the export one.\n const dealias = (symbol: import('typescript').Symbol | undefined) =>\n symbol === undefined\n ? undefined\n : checker.getExportSymbolOfSymbol(\n symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol,\n );\n const flags =\n ts.SymbolFlags.Type | ts.SymbolFlags.Value | ts.SymbolFlags.Namespace | ts.SymbolFlags.Alias;\n const inScope = checker.getSymbolsInScope(entry.declaration, flags);\n\n for (const { name } of named[0].names) {\n const here = dealias(inScope.find((candidate) => candidate.name === name));\n\n if (\n here === undefined ||\n named.some((claim) =>\n claim.names.some((other) => other.name === name && dealias(other.symbol) !== here),\n )\n ) {\n return undefined;\n }\n }\n\n return named[0].text;\n }\n\n static rewrite(opts: {\n typescript: typeof import('typescript');\n fileName: string;\n source: string;\n /** The module `BindingKeys` is imported from when the file gives no better one. */\n importFrom?: string;\n /** The program's source file for `fileName` and its checker: a call is rewritten only when the checker resolves it to the container. */\n program?: {\n sourceFile: import('typescript').SourceFile;\n checker: import('typescript').TypeChecker;\n };\n /** Reads a file for the package.json lookup; defaults to the file system. */\n readFile?: (path: string) => string | undefined;\n /** Out: the value type each use site claims for a key constant, by declaration (`<file>:<initializer start>`). */\n claims?: Map<string, IKeyClaims>;\n /** In: the type to build each key constant of THIS file with (`undefined` is `unknown`); a constant of this file not named here gets the type its own use sites agree on. */\n declare?: Map<string, string | undefined>;\n /** Whether a declaration in `fileName` may be edited: the files the run reads. Defaults to this file only. */\n isEditable?: (fileName: string) => boolean;\n }): IBindingKeysResult {\n const {\n typescript: ts,\n fileName,\n importFrom,\n program,\n readFile = (path: string) => ts.sys.readFile(path),\n claims = new Map<string, IKeyClaims>(),\n } = opts;\n const language = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const file =\n program?.sourceFile ??\n ts.createSourceFile(fileName, opts.source, ts.ScriptTarget.Latest, true, language);\n const source = file.text;\n const checker = program?.checker;\n const builder = BindingKeysCodemod.readBuilderName({ typescript: ts, file });\n const edits: Array<{ start: number; end: number; text: string }> = [];\n const manual: Array<{ line: number; reason: string }> = [];\n const unnamed: number[] = [];\n const handled = new Set<import('typescript').Node>();\n let rewritten = 0;\n const lineOf = (node: import('typescript').Node): number =>\n file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1;\n const isEditable = opts.isEditable ?? ((name: string) => name === file.fileName);\n\n const propertyOf = (\n node: import('typescript').ObjectLiteralExpression,\n name: string,\n ): import('typescript').PropertyAssignment | undefined => {\n for (const property of node.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n property.name.text === name\n ) {\n return property;\n }\n }\n\n return undefined;\n };\n\n /** An object literal whose properties are all in `names` and that has a `key`: the shape of a key options object. */\n const isKeyOptions = (\n node: import('typescript').Expression | undefined,\n ): node is import('typescript').ObjectLiteralExpression => {\n if (node === undefined || !ts.isObjectLiteralExpression(node)) {\n return false;\n }\n\n return (\n propertyOf(node, 'key') !== undefined &&\n node.properties.every(\n (property) =>\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n OPTION_NAMES.has(property.name.text),\n )\n );\n };\n\n const isBuilderCall = (\n node: import('typescript').Node,\n ): node is import('typescript').CallExpression =>\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n ts.isIdentifier(node.expression.expression) &&\n node.expression.expression.text === builder &&\n node.expression.name.text === 'build';\n\n const isSymbolExpression = (node: import('typescript').Expression): boolean =>\n (ts.isCallExpression(node) &&\n ((ts.isIdentifier(node.expression) && node.expression.text === 'Symbol') ||\n (ts.isPropertyAccessExpression(node.expression) &&\n ts.isIdentifier(node.expression.expression) &&\n node.expression.expression.text === 'Symbol'))) ||\n (ts.isPropertyAccessExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'Symbol');\n\n /**\n * The `{ namespace, key }` text of a template written as `${namespace}.Name` or `${namespace}.${name}` (the two\n * shapes the framework's own keys take), or `undefined` for any other template.\n */\n const namespaceKeyOf = (node: import('typescript').TemplateExpression): string | undefined => {\n const { head, templateSpans } = node;\n\n if (head.text !== '') {\n return undefined;\n }\n\n if (templateSpans.length === 1 && templateSpans[0].literal.text.startsWith('.')) {\n const tail = templateSpans[0].literal.text.slice(1);\n\n return tail === ''\n ? undefined\n : `{ namespace: ${templateSpans[0].expression.getText(file)}, key: '${tail.replace(/'/g, \"\\\\'\")}' }`;\n }\n\n if (\n templateSpans.length === 2 &&\n templateSpans[0].literal.text === '.' &&\n templateSpans[1].literal.text === ''\n ) {\n return `{ namespace: ${templateSpans[0].expression.getText(file)}, key: ${templateSpans[1].expression.getText(file)} }`;\n }\n\n return undefined;\n };\n\n /** An object literal under `as const`: its properties are readonly, as a `readonly` class property is. */\n const isConstObject = (node: import('typescript').Node): boolean =>\n ts.isObjectLiteralExpression(node) &&\n ts.isAsExpression(node.parent) &&\n ts.isTypeReferenceNode(node.parent.type) &&\n ts.isIdentifier(node.parent.type.typeName) &&\n node.parent.type.typeName.text === 'const';\n\n /** `Foo.name`, `this.constructor.name`: the `name` that TypeScript's own lib declares, so there is no constant of yours to build. Another lib string (`err.message`, `location.href`) is not a key. */\n const isLibString = (value: import('typescript').Expression): boolean => {\n if (\n checker === undefined ||\n !ts.isPropertyAccessExpression(value) ||\n value.name.text !== 'name'\n ) {\n return false;\n }\n\n const declared = checker.getSymbolAtLocation(value.name)?.declarations?.[0]?.getSourceFile();\n\n return (\n declared !== undefined &&\n declared.isDeclarationFile &&\n LIB_FILE.test(declared.fileName) &&\n (checker.getTypeAtLocation(value).flags & ts.TypeFlags.StringLike) !== 0\n );\n };\n\n /**\n * The declaration of a key held in a name (`MAILER`, `Keys.MAILER`) that the codemod may build where it is made: a const, a\n * readonly property or a property of an object literal, with a string initializer, no type annotation, in a file of the\n * run (not a declaration file, not node_modules). `undefined` when the name is anything else.\n */\n const heldDeclaration = (\n value: import('typescript').Expression,\n ):\n | {\n initializer: import('typescript').Expression;\n key: string;\n declaration: import('typescript').Node;\n }\n | undefined => {\n if (checker === undefined) {\n return undefined;\n }\n\n const name = ts.isPropertyAccessExpression(value) ? value.name : value;\n let symbol = checker.getSymbolAtLocation(name);\n\n if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n\n const declaration = symbol?.valueDeclaration;\n const initializer =\n declaration !== undefined &&\n (ts.isVariableDeclaration(declaration) ||\n ts.isPropertyDeclaration(declaration) ||\n ts.isPropertyAssignment(declaration))\n ? declaration.initializer\n : undefined;\n\n if (declaration === undefined || initializer === undefined) {\n return undefined;\n }\n\n const isHeld = ts.isVariableDeclaration(declaration)\n ? ts.isIdentifier(declaration.name) &&\n (ts.getCombinedNodeFlags(declaration) & ts.NodeFlags.Const) !== 0 &&\n declaration.type === undefined\n : ts.isPropertyDeclaration(declaration)\n ? (ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Readonly) !== 0 &&\n declaration.type === undefined\n : isConstObject(declaration.parent);\n const declared = declaration.getSourceFile();\n const type = checker.getTypeAtLocation(initializer);\n\n if (\n !isHeld ||\n declared.isDeclarationFile ||\n declared.fileName.includes('/node_modules/') ||\n !isEditable(declared.fileName) ||\n !(type.flags & ts.TypeFlags.StringLike) ||\n type.getProperty('valueType') !== undefined\n ) {\n return undefined;\n }\n\n return {\n initializer,\n key: `${declared.fileName}:${initializer.getStart(declared)}`,\n declaration,\n };\n };\n\n /** The names a type mentions (`Mailer`, the head of `ns.Mailer`, `typeof X`) with what each means at the use site. */\n const namesOf = (\n type: import('typescript').TypeNode,\n ): Array<{ name: string; symbol: import('typescript').Symbol | undefined }> => {\n const found = new Map<string, import('typescript').Symbol | undefined>();\n const flags =\n ts.SymbolFlags.Type |\n ts.SymbolFlags.Value |\n ts.SymbolFlags.Namespace |\n ts.SymbolFlags.Alias;\n const inScope = checker?.getSymbolsInScope(type, flags) ?? [];\n const head = (name: import('typescript').EntityName): string =>\n ts.isIdentifier(name) ? name.text : head(name.left);\n\n const search = (node: import('typescript').Node): void => {\n // `import('../mailer').Mailer` names a path that means something only from the file that wrote it.\n if (ts.isImportTypeNode(node)) {\n found.set(`import(${node.argument.getText()})`, undefined);\n }\n\n const name = ts.isTypeReferenceNode(node)\n ? node.typeName\n : ts.isTypeQueryNode(node)\n ? node.exprName\n : undefined;\n\n if (name !== undefined) {\n const text = head(name);\n\n found.set(\n text,\n inScope.find((candidate) => candidate.name === text),\n );\n }\n\n ts.forEachChild(node, search);\n };\n\n search(type);\n\n return [...found].map(([name, symbol]) => ({ name, symbol }));\n };\n\n /**\n * Wraps the key of one options object. `typeText` is the value type the call already claimed, or `undefined` for\n * `unknown`. Answers whether the key was rewritten.\n */\n const rewriteKey = (\n options: import('typescript').ObjectLiteralExpression,\n typeText: string | undefined,\n typeNode?: import('typescript').TypeNode,\n ): boolean => {\n const property = propertyOf(options, 'key');\n\n if (property === undefined) {\n return false;\n }\n\n const value = property.initializer;\n const text = typeText ?? 'unknown';\n const held =\n ts.isIdentifier(value) || ts.isPropertyAccessExpression(value)\n ? heldDeclaration(value)\n : undefined;\n\n if (ts.isStringLiteral(value) || ts.isNoSubstitutionTemplateLiteral(value)) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>({ key: ${value.getText(file)} })`,\n });\n } else if (\n ts.isObjectLiteralExpression(value) &&\n propertyOf(value, 'key') !== undefined &&\n value.properties.every(\n (item) =>\n ts.isPropertyAssignment(item) &&\n ts.isIdentifier(item.name) &&\n (item.name.text === 'key' || item.name.text === 'namespace'),\n )\n ) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>(${value.getText(file)})`,\n });\n } else if (ts.isTemplateExpression(value) && namespaceKeyOf(value) !== undefined) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>(${namespaceKeyOf(value)})`,\n });\n } else if (held !== undefined) {\n // The key is built where it is declared (the claim is answered once every file is read); this site needs no edit.\n const entry = claims.get(held.key) ?? { declaration: held.declaration, claims: [] };\n\n entry.claims.push({\n text: typeText,\n names: typeNode === undefined ? [] : namesOf(typeNode),\n });\n claims.set(held.key, entry);\n\n return false;\n } else if (isLibString(value)) {\n // `Foo.name` is wrapped in place, like a literal: the type the call claimed moves into build<T>.\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>({ key: ${value.getText(file)} })`,\n });\n } else if (isBuilderCall(value)) {\n if (value.typeArguments !== undefined) {\n return false;\n }\n\n handled.add(value);\n // `BindingKeys.build(` then the argument: the type argument goes between the name and the parenthesis.\n edits.push({\n start: value.expression.getEnd(),\n end: value.expression.getEnd(),\n text: `<${text}>`,\n });\n } else if (isSymbolExpression(value)) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a Symbol key: symbols are no longer binding keys, use BindingKeys.build<T>({ key: \"...\" })',\n });\n\n return false;\n } else {\n // A name or a property (`MAILER`, `Keys.MAILER`) may already be a built key, and the typecheck names a raw\n // one: only an expression that makes a string at run time is listed.\n const isReference =\n ts.isIdentifier(value) ||\n ts.isPropertyAccessExpression(value) ||\n ts.isElementAccessExpression(value);\n\n if (isReference && checker !== undefined) {\n const type = checker.getTypeAtLocation(value);\n\n if (type.flags & ts.TypeFlags.StringLike && type.getProperty('valueType') === undefined) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a string held in a name: build it with BindingKeys.build<T>({ key }) where it is defined (a key of a package you do not own is built by that package)',\n });\n }\n }\n\n if (!isReference) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a key made at run time (a template with substitutions, a call): build it with BindingKeys.build<T>({ key }) where it is made',\n });\n }\n\n return false;\n }\n\n rewritten += 1;\n\n if (typeText === undefined) {\n unnamed.push(lineOf(value));\n }\n\n return true;\n };\n\n /** The declaration the checker resolves a call to, or `undefined` when it cannot (an unresolved receiver). */\n const declarationOf = (\n node: import('typescript').CallExpression,\n ): import('typescript').Declaration | undefined =>\n checker?.getResolvedSignature(node)?.declaration;\n\n const packageNames = new Map<string, string | undefined>();\n\n /**\n * The name in the nearest package.json above `directory` that has one, or `undefined` when there is none. A package.json\n * without a name does not end the walk: an installed package ships `dist/esm/package.json` (`{ \"type\": \"module\" }`) beside\n * the declarations, and the package's own file is further up.\n */\n const packageNameAbove = (directory: string): string | undefined => {\n if (packageNames.has(directory)) {\n return packageNames.get(directory);\n }\n\n const text = readFile(join(directory, 'package.json'));\n const parent = dirname(directory);\n let name: string | undefined;\n\n if (text !== undefined) {\n const parsed: unknown = JSON.parse(text);\n\n if (\n typeof parsed === 'object' &&\n parsed !== null &&\n 'name' in parsed &&\n typeof parsed.name === 'string'\n ) {\n name = parsed.name;\n }\n }\n\n if (name === undefined && parent !== directory) {\n name = packageNameAbove(parent);\n }\n\n packageNames.set(directory, name);\n\n return name;\n };\n\n /** A declaration of the framework: the nearest package.json above its file names one of the framework's packages. */\n const isFrameworkFile = (declaration: import('typescript').Node): boolean => {\n const name = packageNameAbove(dirname(declaration.getSourceFile().fileName));\n\n return name !== undefined && FRAMEWORK_PACKAGES.has(name);\n };\n\n /** `container.get(...)`: the checker resolves the method to the container's (or `Binding`'s), declared by the framework. */\n const isContainerMethod = (\n declaration: import('typescript').Declaration | undefined,\n ): boolean => {\n if (declaration === undefined || !isFrameworkFile(declaration)) {\n return false;\n }\n\n const owner = declaration.parent;\n\n return (\n (ts.isClassLike(owner) || ts.isInterfaceDeclaration(owner)) &&\n owner.name !== undefined &&\n CONTAINER_TYPES.has(owner.name.text)\n );\n };\n\n /** `inject(...)` or `provide(...)` under any local name: the checker follows the import to the framework's. */\n const isFrameworkDecorator = (callee: import('typescript').Expression): boolean => {\n if (checker === undefined || !ts.isIdentifier(callee)) {\n return false;\n }\n\n const symbol = checker.getSymbolAtLocation(callee);\n const target =\n symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias\n ? checker.getAliasedSymbol(symbol)\n : symbol;\n const declaration = target?.declarations?.[0];\n\n return (\n declaration !== undefined &&\n KEY_DECORATORS.has(target?.name ?? '') &&\n isFrameworkFile(declaration)\n );\n };\n\n /** Whether a type mentions a type parameter of a function or class that encloses `from`. */\n const mentionsScopedTypeParameter = (\n type: import('typescript').TypeNode,\n from: import('typescript').Node,\n ): boolean => {\n const scoped = new Set<string>();\n\n for (\n let scope: import('typescript').Node | undefined = from;\n scope !== undefined;\n scope = scope.parent\n ) {\n const parameters =\n ts.isFunctionLike(scope) || ts.isClassLike(scope) ? scope.typeParameters : undefined;\n\n for (const parameter of parameters ?? []) {\n scoped.add(parameter.name.text);\n }\n }\n\n const search = (node: import('typescript').Node): boolean =>\n (ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName) &&\n scoped.has(node.typeName.text)) ||\n ts.forEachChild(node, (child) => (search(child) ? true : undefined)) === true;\n\n return search(type);\n };\n\n /** The text of a decorated parameter's type with `undefined` left out: the key names what is injected, not its absence. */\n const liftedTypeText = (type: import('typescript').TypeNode): string => {\n if (!ts.isUnionTypeNode(type)) {\n return type.getText(file);\n }\n\n const kept = type.types.filter((member) => member.kind !== ts.SyntaxKind.UndefinedKeyword);\n\n return kept.map((member) => member.getText(file)).join(' | ');\n };\n\n const visit = (node: import('typescript').Node): void => {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n const first = node.arguments[0];\n const methodName =\n ts.isPropertyAccessExpression(callee) && KEY_METHODS.has(callee.name.text)\n ? callee.name.text\n : undefined;\n\n if (\n isBuilderCall(node) &&\n node.typeArguments === undefined &&\n node.arguments.length === 1\n ) {\n if (handled.has(node)) {\n ts.forEachChild(node, visit);\n\n return;\n }\n\n const argument = node.arguments[0];\n\n if (ts.isObjectLiteralExpression(argument) && propertyOf(argument, 'key') !== undefined) {\n edits.push({\n start: node.expression.getEnd(),\n end: node.expression.getEnd(),\n text: '<unknown>',\n });\n rewritten += 1;\n unnamed.push(lineOf(node));\n }\n } else if (methodName !== undefined || ts.isIdentifier(callee)) {\n const isGets =\n methodName === 'gets' && first !== undefined && ts.isObjectLiteralExpression(first);\n const hasShape = isGets || isKeyOptions(first);\n const declaration = methodName === undefined ? undefined : declarationOf(node);\n const isContainer =\n methodName === undefined\n ? hasShape && isFrameworkDecorator(callee)\n : hasShape && isContainerMethod(declaration);\n\n if (hasShape && methodName !== undefined && !isContainer && declaration === undefined) {\n manual.push({\n line: lineOf(node),\n reason: `${methodName}(...) with a key: the receiver's type is not resolved (no tsconfig reaches this file, or it is any), so it is not known to be the container: change it by hand if it is`,\n });\n }\n\n if (isContainer && isGets && ts.isObjectLiteralExpression(first)) {\n const list = propertyOf(first, 'bindings')?.initializer;\n\n if (list !== undefined && ts.isArrayLiteralExpression(list)) {\n for (const element of list.elements) {\n if (isKeyOptions(element)) {\n rewriteKey(element, undefined);\n }\n }\n }\n } else if (isContainer && isKeyOptions(first)) {\n // `@inject({ key }) service: Mailer`: the type the parameter or property already claims is the key's type.\n const decorated =\n methodName === undefined &&\n ts.isDecorator(node.parent) &&\n (ts.isParameter(node.parent.parent) || ts.isPropertyDeclaration(node.parent.parent))\n ? node.parent.parent.type\n : undefined;\n const callArgument =\n methodName !== undefined && node.typeArguments?.length === 1\n ? node.typeArguments[0]\n : undefined;\n const claimed = callArgument ?? decorated;\n\n // A type that names a type parameter of the enclosing code cannot go into `build<T>`: the check on the type\n // argument is made while it is still unresolved.\n if (claimed !== undefined && mentionsScopedTypeParameter(claimed, node)) {\n manual.push({\n line: lineOf(node),\n reason:\n 'a key whose type names a type parameter of the enclosing code: a generic key factory builds BindingKeys.build<unknown> and returns it typed as TBindingKey<T>',\n });\n } else {\n const isKeyBuilt = (() => {\n const value = propertyOf(first, 'key')?.initializer;\n\n return (\n value !== undefined && isBuilderCall(value) && value.typeArguments !== undefined\n );\n })();\n\n if (!isKeyBuilt) {\n const typeText =\n callArgument !== undefined\n ? callArgument.getText(file)\n : decorated === undefined\n ? undefined\n : liftedTypeText(decorated);\n const done = rewriteKey(first, typeText, callArgument ?? decorated);\n\n // The type argument moved into `build<T>`; the call no longer needs it. Comments inside it stay.\n if (done && callArgument !== undefined) {\n const open = node.expression.getEnd();\n const close = source.indexOf('(', callArgument.getEnd());\n const comments = source\n .slice(open, close)\n .match(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n]*\\n?/g);\n\n edits.push({ start: open, end: close, text: comments ? comments.join(' ') : '' });\n }\n }\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(file);\n\n // A key constant of this file: build it with the type its use sites agree on, or the one the run settled.\n const build = new Map(opts.declare);\n\n for (const [key, entry] of claims) {\n if (key.startsWith(`${file.fileName}:`) && !build.has(key) && checker !== undefined) {\n build.set(key, BindingKeysCodemod.agreedType({ typescript: ts, checker, entry }));\n }\n }\n\n if (build.size > 0) {\n const declare = (node: import('typescript').Node): void => {\n if (\n (ts.isVariableDeclaration(node) ||\n ts.isPropertyDeclaration(node) ||\n ts.isPropertyAssignment(node)) &&\n node.initializer !== undefined &&\n build.has(`${file.fileName}:${node.initializer.getStart(file)}`)\n ) {\n const type = build.get(`${file.fileName}:${node.initializer.getStart(file)}`);\n\n edits.push({\n start: node.initializer.getStart(file),\n end: node.initializer.getEnd(),\n text: `${builder}.build<${type ?? 'unknown'}>({ key: ${node.initializer.getText(file)} })`,\n });\n rewritten += 1;\n\n if (type === undefined) {\n unnamed.push(lineOf(node.initializer));\n }\n }\n\n ts.forEachChild(node, declare);\n };\n\n declare(file);\n }\n\n if (edits.length === 0) {\n return { output: source, changed: false, rewritten, unnamed, manual };\n }\n\n const { module, declared, named } = BindingKeysCodemod.readIdentifierSource({\n typescript: ts,\n file,\n fallback: importFrom,\n });\n\n if (!declared && module === undefined) {\n return {\n output: source,\n changed: false,\n rewritten: 0,\n unnamed: [],\n manual: [\n ...manual,\n {\n line: 1,\n reason: `${rewritten} key(s) could be rewritten but the file imports nothing from @venizia/ignis to take BindingKeys from: pass --import-from <module>`,\n },\n ],\n };\n }\n\n if (!declared) {\n if (named !== undefined && named.elements.length > 0) {\n const last = named.elements[named.elements.length - 1];\n\n edits.push({ start: last.getEnd(), end: last.getEnd(), text: `, ${BUILDER}` });\n } else {\n const lastImport = [...file.statements]\n .reverse()\n .find((statement) => ts.isImportDeclaration(statement));\n const position = lastImport === undefined ? 0 : lastImport.getEnd();\n const text = `${lastImport === undefined ? '' : '\\n'}import { ${builder} } from '${module}';${lastImport === undefined ? '\\n' : ''}`;\n\n edits.push({ start: position, end: position, text });\n }\n }\n\n let output = source;\n\n for (const edit of [...edits].sort(\n (left, right) => right.start - left.start || right.end - left.end,\n )) {\n output = `${output.slice(0, edit.start)}${edit.text}${output.slice(edit.end)}`;\n }\n\n return { output, changed: output !== source, rewritten, unnamed, manual };\n }\n}\n\n/** `devz codemod binding-keys [paths...] [--write | --check]`: rewrites raw binding keys to `BindingKeys.build<T>`. */\nexport class BindingKeysCommand {\n static readonly USAGE = USAGE;\n\n /**\n * The program the checker answers from: the project's own tsconfig (the nearest one above `root`) with the files the\n * codemod reads added, so a receiver resolves the way the project's typecheck resolves it.\n */\n static createProgram(opts: {\n typescript: typeof import('typescript');\n root: string;\n files: string[];\n }): import('typescript').Program {\n const { typescript: ts, root, files } = opts;\n const configPath = ts.findConfigFile(root, (path) => ts.sys.fileExists(path), 'tsconfig.json');\n const read =\n configPath === undefined\n ? undefined\n : ts.readConfigFile(configPath, (path) => ts.sys.readFile(path));\n const parsed =\n configPath === undefined || read === undefined || read.error !== undefined\n ? undefined\n : ts.parseJsonConfigFileContent(read.config, ts.sys, resolve(configPath, '..'));\n const options: import('typescript').CompilerOptions = {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n experimentalDecorators: true,\n ...parsed?.options,\n noEmit: true,\n skipLibCheck: true,\n incremental: false,\n composite: false,\n allowJs: false,\n };\n\n return ts.createProgram({ rootNames: files, options });\n }\n\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { root, args } = opts;\n\n if (args.includes(BindingKeysFlags.HELP) || args.includes(BindingKeysFlags.HELP_SHORT)) {\n console.log(USAGE);\n\n return 0;\n }\n\n const flags: string[] = [];\n const paths: string[] = [];\n let importFrom: string | undefined;\n let hasImportFlag = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const argument = args[index];\n\n if (argument === BindingKeysFlags.IMPORT_FROM) {\n hasImportFlag = true;\n importFrom = args[index + 1];\n index += 1;\n } else if (argument.startsWith('-')) {\n flags.push(argument);\n } else {\n paths.push(argument);\n }\n }\n\n const unknown = flags.filter((flag) => !BindingKeysFlags.isValid(flag));\n\n if (hasImportFlag && (importFrom === undefined || importFrom.startsWith('-'))) {\n console.error(`devz codemod: ${BindingKeysFlags.IMPORT_FROM} needs a module\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n if (unknown.length > 0) {\n console.error(\n `devz codemod: unknown option ${unknown.map((flag) => `\"${flag}\"`).join(', ')}\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const isWrite = flags.includes(BindingKeysFlags.WRITE);\n const isCheck = flags.includes(BindingKeysFlags.CHECK);\n\n if (isWrite && isCheck) {\n console.error(\n `devz codemod: ${BindingKeysFlags.WRITE} and ${BindingKeysFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'binding-keys',\n isWrite,\n isAll: flags.includes(BindingKeysFlags.ALL),\n paths,\n });\n\n if (refusal) {\n console.error(`${refusal}\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n let typescript: typeof import('typescript');\n\n try {\n const loaded = await import('typescript');\n typescript = loaded.default;\n } catch {\n console.error('devz codemod: the \"typescript\" package is required to read your sources');\n\n return 1;\n }\n\n const targets = (paths.length > 0 ? paths : ['.']).map((path) => resolve(root, path));\n let changedCount = 0;\n let rewrittenCount = 0;\n let manualCount = 0;\n let unnamedCount = 0;\n let refusedCount = 0;\n\n const collected = targets.map((target) => CodemodFiles.collect({ target }));\n const program = BindingKeysCommand.createProgram({\n typescript,\n root,\n files: collected.flat(),\n });\n const checker = program.getTypeChecker();\n const prefilter = /\\b(?:get|gets|getBinding|bind|isBound|unbind|inject|provide|build)\\b/;\n const editable = new Set(collected.flat().map((file) => resolve(file)));\n const isEditable = (fileName: string): boolean => editable.has(resolve(fileName));\n\n // First pass: every use site of a key held in a constant claims a type for the constant's declaration, which can be in\n // another file. The answer is one type per declaration, so the second pass edits each declaration once.\n const claims = new Map<string, IKeyClaims>();\n\n for (const file of collected.flat()) {\n const source = readFileSync(file, 'utf8');\n const sourceFile = program.getSourceFile(file);\n\n if (sourceFile !== undefined && prefilter.test(source)) {\n BindingKeysCodemod.rewrite({\n typescript,\n fileName: file,\n source,\n importFrom,\n program: { sourceFile, checker },\n claims,\n isEditable,\n });\n }\n }\n\n const declare = new Map<string, string | undefined>();\n const declareFiles = new Set<string>();\n\n for (const [key, entry] of claims) {\n declare.set(key, BindingKeysCodemod.agreedType({ typescript, checker, entry }));\n declareFiles.add(entry.declaration.getSourceFile().fileName);\n }\n\n for (const [index, target] of targets.entries()) {\n const files = collected[index];\n const dirty = isWrite ? CodemodFiles.dirty({ target }) : undefined;\n\n if (files.length === 0 && paths.length > 0) {\n console.warn(\n `devz codemod: no source files under \"${relative(root, target) || target}\" (git ignores the path, or it holds none): nothing was read`,\n );\n }\n\n for (const file of files) {\n const source = readFileSync(file, 'utf8');\n\n const sourceFile = program.getSourceFile(file);\n\n if (!prefilter.test(source) && !declareFiles.has(sourceFile?.fileName ?? file)) {\n continue;\n }\n\n const result = BindingKeysCodemod.rewrite({\n typescript,\n fileName: file,\n source,\n importFrom,\n program: sourceFile === undefined ? undefined : { sourceFile, checker },\n declare,\n isEditable,\n });\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n for (const item of result.manual) {\n manualCount += 1;\n console.warn(`manual ${shown}:${item.line} ${item.reason}`);\n }\n\n for (const line of result.unnamed) {\n unnamedCount += 1;\n console.warn(\n `type ${shown}:${line} BindingKeys.build<unknown>: name the type of the value bound under this key`,\n );\n }\n\n if (!result.changed) {\n continue;\n }\n\n if (dirty?.has(file)) {\n refusedCount += 1;\n console.warn(\n `refused ${shown} has local changes (commit or stash them, then run again)`,\n );\n continue;\n }\n\n changedCount += 1;\n rewrittenCount += result.rewritten;\n console.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} key(s))`,\n );\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n }\n\n console.log(\n `devz codemod binding-keys: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${rewrittenCount} key(s) ${isWrite ? 'rewritten' : 'would be rewritten'}, ${unnamedCount} to type, ${manualCount} manual` +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (!isWrite && changedCount > 0) {\n console.log(\n `Nothing was written. Run again with ${BindingKeysFlags.WRITE} to apply, then name each \"type\" site and run your typecheck.`,\n );\n }\n\n if (isWrite && refusedCount > 0) {\n return 1;\n }\n\n return isCheck && (changedCount > 0 || manualCount > 0) ? 1 : 0;\n }\n}\n"]}
1
+ {"version":3,"file":"binding-keys.js","sourceRoot":"","sources":["../../../src/cli/codemod/binding-keys.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,yCAA6D;AAC7D,mCAAuC;AAEvC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEA6CkD,CAAC;AAEjE,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,gEAAgE;AAChE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExF,4EAA4E;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,SAAS,CAAC;gBACnC,OAAO,CAAC,GAAG,CACT,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,KAAK,KAAK,MAAM,MAAM,CAAC,SAAS,UAAU,CAClF,CAAC;gBAEF,IAAI,OAAO,EAAE,CAAC;oBACZ,IAAA,uBAAa,EAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CACT,8BAA8B,YAAY,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,KAAK,cAAc,WAAW,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,KAAK,YAAY,aAAa,WAAW,SAAS;YACpN,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CACxD,CAAC;QAEF,IAAI,CAAC,OAAO,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CACT,uCAAuC,gBAAgB,CAAC,KAAK,+DAA+D,CAC7H,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;;AAtPH,gDAuPC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative, resolve } from 'node:path';\nimport { CodemodFiles } from './files';\n\nconst USAGE = `Usage: devz codemod binding-keys [paths...] [--write [--all] | --check] [--import-from <module>]\n\nRewrites the raw binding keys of the @venizia/ignis-inversion release where a key is made by BindingKeys.build<T>:\n\n container.get<Mailer>({ key: 'services.Mailer' }) becomes container.get({ key: BindingKeys.build<Mailer>({ key: 'services.Mailer' }) })\n container.bind({ key: 'services.Mailer' }) becomes container.bind({ key: BindingKeys.build<unknown>({ key: 'services.Mailer' }) })\n @inject({ key: 'services.Mailer' }) becomes @inject({ key: BindingKeys.build<unknown>({ key: 'services.Mailer' }) })\n container.get({ key: { namespace, key } }) becomes container.get({ key: BindingKeys.build<unknown>({ namespace, key }) })\n container.get({ key: \\`\\${namespace}.Name\\` }) becomes container.get({ key: BindingKeys.build<unknown>({ namespace, key: 'Name' }) })\n BindingKeys.build({ key }) becomes BindingKeys.build<unknown>({ key })\n\nThe key string is never changed.\n\nA call is rewritten only when the TypeScript checker resolves it to the framework's container (Container, IContainer,\nBinding) or to its inject and provide, under any local name. A redis.get<T>({ key }), a worker pool or a class of your own\nis left alone, type argument included. The checker reads your project through the nearest tsconfig.json, so run the codemod\nfrom the project root with the dependencies installed; a receiver it cannot resolve is listed as \"manual\". The call's own type argument moves into build<T>, so the caller keeps the type it\nclaimed; without one the codemod writes build<unknown> and lists the site (\"type\"): name the real type there.\n\nIt rewrites a call named get, gets, getBinding, bind, isBound or unbind whose argument is an object literal with a\n\\`key\\` (and, for get, \\`isOptional\\`), and a call of inject or provide. A container cannot be told from syntax, so the shape is the\ntest. A string key, a substitution-free template literal, a { namespace, key } literal and a template written\n\\${namespace}.Name or \\${namespace}.\\${name} are rewritten. These are listed\nas \"manual\" and left alone: a key made at run time (a template with substitutions, a call) and a Symbol key (symbols are no\nlonger keys). A key written Foo.name or this.constructor.name (a string TypeScript's own lib declares) is wrapped in\nplace. A key held in a name (MAILER, Keys.MAILER) is built where it is declared, in any file of the run: a const, a\nreadonly property or a property of an object literal, with a string initializer and no type annotation. Its type is the\none type its use sites claim (get<Mailer>, the type of a decorated parameter), else unknown (listed as \"type\"); the use\nsites are not edited. A name declared another way (a let, an annotation, a parameter, a call, a package you do not own)\nis listed as \"manual\". build throws on an empty key, so a computed constant that comes out '' now throws when its class loads.\n\nBindingKeys is imported from the module the file already takes inject from, else from the first @venizia/ignis import,\nor from --import-from <module>; a file with none of them is listed as manual and not rewritten. An existing import of\nBindingKeys is reused. A second run changes nothing.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts). A .js, .cjs or .mjs file is not read: edit it by hand.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change or a manual site remains (for CI)\n --import-from the module BindingKeys is imported from when the file gives no better one\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git knows, and\n--write refuses a file with local changes: commit, stash or \"git add\" it first, so git can undo it.\nThere is no --reverse: a downgrade restores the files from git.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\n/** The methods whose options object carries a container key. */\nconst KEY_METHODS = new Set(['get', 'gets', 'getBinding', 'bind', 'isBound', 'unbind']);\n\n/** The other properties a key options object may carry and still be one. */\nconst OPTION_NAMES = new Set(['key', 'isOptional', 'scope']);\n\n/** The decorators that take a key options object. */\nconst KEY_DECORATORS = new Set(['inject', 'provide']);\n\n/** Where a file already imports the container API from. */\nconst IGNIS_MODULE = /^@venizia\\/ignis(?:-kernel|-inversion)?$/;\n\nconst BUILDER = 'BindingKeys';\n\n/** A declaration file of TypeScript's own `lib` (where `Function.name` is declared). */\nconst LIB_FILE = /[\\\\/]typescript[\\\\/]lib[\\\\/]lib\\.[^\\\\/]*\\.d\\.ts$/;\n\n/** The classes and interfaces whose key methods are the container's. */\nconst CONTAINER_TYPES = new Set([\n 'IContainer',\n 'AbstractContainer',\n 'BaseContainer',\n 'Container',\n 'Binding',\n]);\n\n/** The packages that declare the container: the framework is identified by name, wherever it is installed or checked out. */\nconst FRAMEWORK_PACKAGES = new Set([\n '@venizia/ignis',\n '@venizia/ignis-inversion',\n '@venizia/ignis-kernel',\n]);\n\n/** A module of the framework: a file's own barrel is not a place to take `BindingKeys` from. */\nconst VENIZIA_MODULE = /^@venizia\\//;\n\nclass BindingKeysFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\n static readonly CHECK = '--check';\n static readonly IMPORT_FROM = '--import-from';\n static readonly HELP = '--help';\n static readonly HELP_SHORT = '-h';\n\n static readonly SCHEME_SET = new Set<string>([\n this.WRITE,\n this.ALL,\n this.CHECK,\n this.IMPORT_FROM,\n this.HELP,\n this.HELP_SHORT,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One site the codemod would change or cannot change. */\nexport interface IBindingKeysResult {\n output: string;\n changed: boolean;\n rewritten: number;\n /** Lines where `build<unknown>` was written because the call named no type. */\n unnamed: number[];\n manual: Array<{ line: number; reason: string }>;\n}\n\n/** What the use sites of one key constant claim: each claim is the type's text and the symbols its names resolve to at the use site. */\nexport interface IKeyClaims {\n declaration: import('typescript').Node;\n claims: Array<{\n text: string | undefined;\n names: Array<{ name: string; symbol: import('typescript').Symbol | undefined }>;\n }>;\n}\n\n/** Rewrites raw binding keys to `BindingKeys.build<T>({ key })`. */\nexport class BindingKeysCodemod {\n /** The module `BindingKeys` comes from in this file: an existing import, the module of `inject`, a @venizia/ignis import, or `fallback`. */\n private static readIdentifierSource(opts: {\n typescript: typeof import('typescript');\n file: import('typescript').SourceFile;\n fallback?: string;\n }): { module: string | undefined; declared: boolean; named?: import('typescript').NamedImports } {\n const { typescript: ts, file, fallback } = opts;\n let injectModule: string | undefined;\n let ignisModule: string | undefined;\n let named: import('typescript').NamedImports | undefined;\n let declared = false;\n\n for (const statement of file.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n\n const module = statement.moduleSpecifier.text;\n const bindings = statement.importClause?.namedBindings;\n const isTypeOnly = statement.importClause?.isTypeOnly === true;\n\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const imported = (element.propertyName ?? element.name).text;\n\n if (imported === BUILDER && !isTypeOnly && !element.isTypeOnly) {\n declared = true;\n }\n\n if (imported === 'inject' && injectModule === undefined && VENIZIA_MODULE.test(module)) {\n injectModule = module;\n }\n }\n\n if (IGNIS_MODULE.test(module) && !isTypeOnly) {\n ignisModule ??= module;\n named ??= bindings;\n }\n }\n\n return { module: injectModule ?? ignisModule ?? fallback, declared, named };\n }\n\n /** The local name `BindingKeys` is imported under (an alias included), or `BindingKeys` when the file does not import it. */\n private static readBuilderName(opts: {\n typescript: typeof import('typescript');\n file: import('typescript').SourceFile;\n }): string {\n const { typescript: ts, file } = opts;\n\n for (const statement of file.statements) {\n const bindings = ts.isImportDeclaration(statement)\n ? statement.importClause?.namedBindings\n : undefined;\n\n if (bindings === undefined || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n if ((element.propertyName ?? element.name).text === BUILDER) {\n return element.name.text;\n }\n }\n }\n\n return BUILDER;\n }\n\n /**\n * The type a key constant is built with: the one type its use sites claim, else `undefined` (`unknown`). A type is copied as\n * text into the declaration's file, so it counts only when every name in it means the same symbol at each use site and\n * at the declaration (a type of another file, not imported there, would not compile); no import is added.\n */\n static agreedType(opts: {\n typescript: typeof import('typescript');\n checker: import('typescript').TypeChecker;\n entry: IKeyClaims;\n }): string | undefined {\n const { typescript: ts, checker, entry } = opts;\n const named = entry.claims.filter((claim) => claim.text !== undefined);\n const texts = new Set(named.map((claim) => claim.text));\n\n if (texts.size !== 1) {\n return undefined;\n }\n\n // An exported declaration has a local symbol and an export symbol; an import resolves to the export one.\n const dealias = (symbol: import('typescript').Symbol | undefined) =>\n symbol === undefined\n ? undefined\n : checker.getExportSymbolOfSymbol(\n symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol,\n );\n const flags =\n ts.SymbolFlags.Type | ts.SymbolFlags.Value | ts.SymbolFlags.Namespace | ts.SymbolFlags.Alias;\n const inScope = checker.getSymbolsInScope(entry.declaration, flags);\n\n for (const { name } of named[0].names) {\n const here = dealias(inScope.find((candidate) => candidate.name === name));\n\n if (\n here === undefined ||\n named.some((claim) =>\n claim.names.some((other) => other.name === name && dealias(other.symbol) !== here),\n )\n ) {\n return undefined;\n }\n }\n\n return named[0].text;\n }\n\n static rewrite(opts: {\n typescript: typeof import('typescript');\n fileName: string;\n source: string;\n /** The module `BindingKeys` is imported from when the file gives no better one. */\n importFrom?: string;\n /** The program's source file for `fileName` and its checker: a call is rewritten only when the checker resolves it to the container. */\n program?: {\n sourceFile: import('typescript').SourceFile;\n checker: import('typescript').TypeChecker;\n };\n /** Reads a file for the package.json lookup; defaults to the file system. */\n readFile?: (path: string) => string | undefined;\n /** Out: the value type each use site claims for a key constant, by declaration (`<file>:<initializer start>`). */\n claims?: Map<string, IKeyClaims>;\n /** In: the type to build each key constant of THIS file with (`undefined` is `unknown`); a constant of this file not named here gets the type its own use sites agree on. */\n declare?: Map<string, string | undefined>;\n /** Whether a declaration in `fileName` may be edited: the files the run reads. Defaults to this file only. */\n isEditable?: (fileName: string) => boolean;\n }): IBindingKeysResult {\n const {\n typescript: ts,\n fileName,\n importFrom,\n program,\n readFile = (path: string) => ts.sys.readFile(path),\n claims = new Map<string, IKeyClaims>(),\n } = opts;\n const language = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const file =\n program?.sourceFile ??\n ts.createSourceFile(fileName, opts.source, ts.ScriptTarget.Latest, true, language);\n const source = file.text;\n const checker = program?.checker;\n const builder = BindingKeysCodemod.readBuilderName({ typescript: ts, file });\n const edits: Array<{ start: number; end: number; text: string }> = [];\n const manual: Array<{ line: number; reason: string }> = [];\n const unnamed: number[] = [];\n const handled = new Set<import('typescript').Node>();\n let rewritten = 0;\n const lineOf = (node: import('typescript').Node): number =>\n file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1;\n const isEditable = opts.isEditable ?? ((name: string) => name === file.fileName);\n\n const propertyOf = (\n node: import('typescript').ObjectLiteralExpression,\n name: string,\n ): import('typescript').PropertyAssignment | undefined => {\n for (const property of node.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n property.name.text === name\n ) {\n return property;\n }\n }\n\n return undefined;\n };\n\n /** An object literal whose properties are all in `names` and that has a `key`: the shape of a key options object. */\n const isKeyOptions = (\n node: import('typescript').Expression | undefined,\n ): node is import('typescript').ObjectLiteralExpression => {\n if (node === undefined || !ts.isObjectLiteralExpression(node)) {\n return false;\n }\n\n return (\n propertyOf(node, 'key') !== undefined &&\n node.properties.every(\n (property) =>\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n OPTION_NAMES.has(property.name.text),\n )\n );\n };\n\n const isBuilderCall = (\n node: import('typescript').Node,\n ): node is import('typescript').CallExpression =>\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n ts.isIdentifier(node.expression.expression) &&\n node.expression.expression.text === builder &&\n node.expression.name.text === 'build';\n\n const isSymbolExpression = (node: import('typescript').Expression): boolean =>\n (ts.isCallExpression(node) &&\n ((ts.isIdentifier(node.expression) && node.expression.text === 'Symbol') ||\n (ts.isPropertyAccessExpression(node.expression) &&\n ts.isIdentifier(node.expression.expression) &&\n node.expression.expression.text === 'Symbol'))) ||\n (ts.isPropertyAccessExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'Symbol');\n\n /**\n * The `{ namespace, key }` text of a template written as `${namespace}.Name` or `${namespace}.${name}` (the two\n * shapes the framework's own keys take), or `undefined` for any other template.\n */\n const namespaceKeyOf = (node: import('typescript').TemplateExpression): string | undefined => {\n const { head, templateSpans } = node;\n\n if (head.text !== '') {\n return undefined;\n }\n\n if (templateSpans.length === 1 && templateSpans[0].literal.text.startsWith('.')) {\n const tail = templateSpans[0].literal.text.slice(1);\n\n return tail === ''\n ? undefined\n : `{ namespace: ${templateSpans[0].expression.getText(file)}, key: '${tail.replace(/'/g, \"\\\\'\")}' }`;\n }\n\n if (\n templateSpans.length === 2 &&\n templateSpans[0].literal.text === '.' &&\n templateSpans[1].literal.text === ''\n ) {\n return `{ namespace: ${templateSpans[0].expression.getText(file)}, key: ${templateSpans[1].expression.getText(file)} }`;\n }\n\n return undefined;\n };\n\n /** An object literal under `as const`: its properties are readonly, as a `readonly` class property is. */\n const isConstObject = (node: import('typescript').Node): boolean =>\n ts.isObjectLiteralExpression(node) &&\n ts.isAsExpression(node.parent) &&\n ts.isTypeReferenceNode(node.parent.type) &&\n ts.isIdentifier(node.parent.type.typeName) &&\n node.parent.type.typeName.text === 'const';\n\n /** `Foo.name`, `this.constructor.name`: the `name` that TypeScript's own lib declares, so there is no constant of yours to build. Another lib string (`err.message`, `location.href`) is not a key. */\n const isLibString = (value: import('typescript').Expression): boolean => {\n if (\n checker === undefined ||\n !ts.isPropertyAccessExpression(value) ||\n value.name.text !== 'name'\n ) {\n return false;\n }\n\n const declared = checker.getSymbolAtLocation(value.name)?.declarations?.[0]?.getSourceFile();\n\n return (\n declared !== undefined &&\n declared.isDeclarationFile &&\n LIB_FILE.test(declared.fileName) &&\n (checker.getTypeAtLocation(value).flags & ts.TypeFlags.StringLike) !== 0\n );\n };\n\n /**\n * The declaration of a key held in a name (`MAILER`, `Keys.MAILER`) that the codemod may build where it is made: a const, a\n * readonly property or a property of an object literal, with a string initializer, no type annotation, in a file of the\n * run (not a declaration file, not node_modules). `undefined` when the name is anything else.\n */\n const heldDeclaration = (\n value: import('typescript').Expression,\n ):\n | {\n initializer: import('typescript').Expression;\n key: string;\n declaration: import('typescript').Node;\n }\n | undefined => {\n if (checker === undefined) {\n return undefined;\n }\n\n const name = ts.isPropertyAccessExpression(value) ? value.name : value;\n let symbol = checker.getSymbolAtLocation(name);\n\n if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n\n const declaration = symbol?.valueDeclaration;\n const initializer =\n declaration !== undefined &&\n (ts.isVariableDeclaration(declaration) ||\n ts.isPropertyDeclaration(declaration) ||\n ts.isPropertyAssignment(declaration))\n ? declaration.initializer\n : undefined;\n\n if (declaration === undefined || initializer === undefined) {\n return undefined;\n }\n\n const isHeld = ts.isVariableDeclaration(declaration)\n ? ts.isIdentifier(declaration.name) &&\n (ts.getCombinedNodeFlags(declaration) & ts.NodeFlags.Const) !== 0 &&\n declaration.type === undefined\n : ts.isPropertyDeclaration(declaration)\n ? (ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Readonly) !== 0 &&\n declaration.type === undefined\n : isConstObject(declaration.parent);\n const declared = declaration.getSourceFile();\n const type = checker.getTypeAtLocation(initializer);\n\n if (\n !isHeld ||\n declared.isDeclarationFile ||\n declared.fileName.includes('/node_modules/') ||\n !isEditable(declared.fileName) ||\n !(type.flags & ts.TypeFlags.StringLike) ||\n type.getProperty('valueType') !== undefined\n ) {\n return undefined;\n }\n\n return {\n initializer,\n key: `${declared.fileName}:${initializer.getStart(declared)}`,\n declaration,\n };\n };\n\n /** The names a type mentions (`Mailer`, the head of `ns.Mailer`, `typeof X`) with what each means at the use site. */\n const namesOf = (\n type: import('typescript').TypeNode,\n ): Array<{ name: string; symbol: import('typescript').Symbol | undefined }> => {\n const found = new Map<string, import('typescript').Symbol | undefined>();\n const flags =\n ts.SymbolFlags.Type |\n ts.SymbolFlags.Value |\n ts.SymbolFlags.Namespace |\n ts.SymbolFlags.Alias;\n const inScope = checker?.getSymbolsInScope(type, flags) ?? [];\n const head = (name: import('typescript').EntityName): string =>\n ts.isIdentifier(name) ? name.text : head(name.left);\n\n const search = (node: import('typescript').Node): void => {\n // `import('../mailer').Mailer` names a path that means something only from the file that wrote it.\n if (ts.isImportTypeNode(node)) {\n found.set(`import(${node.argument.getText()})`, undefined);\n }\n\n const name = ts.isTypeReferenceNode(node)\n ? node.typeName\n : ts.isTypeQueryNode(node)\n ? node.exprName\n : undefined;\n\n if (name !== undefined) {\n const text = head(name);\n\n found.set(\n text,\n inScope.find((candidate) => candidate.name === text),\n );\n }\n\n ts.forEachChild(node, search);\n };\n\n search(type);\n\n return [...found].map(([name, symbol]) => ({ name, symbol }));\n };\n\n /**\n * Wraps the key of one options object. `typeText` is the value type the call already claimed, or `undefined` for\n * `unknown`. Answers whether the key was rewritten.\n */\n const rewriteKey = (\n options: import('typescript').ObjectLiteralExpression,\n typeText: string | undefined,\n typeNode?: import('typescript').TypeNode,\n ): boolean => {\n const property = propertyOf(options, 'key');\n\n if (property === undefined) {\n return false;\n }\n\n const value = property.initializer;\n const text = typeText ?? 'unknown';\n const held =\n ts.isIdentifier(value) || ts.isPropertyAccessExpression(value)\n ? heldDeclaration(value)\n : undefined;\n\n if (ts.isStringLiteral(value) || ts.isNoSubstitutionTemplateLiteral(value)) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>({ key: ${value.getText(file)} })`,\n });\n } else if (\n ts.isObjectLiteralExpression(value) &&\n propertyOf(value, 'key') !== undefined &&\n value.properties.every(\n (item) =>\n ts.isPropertyAssignment(item) &&\n ts.isIdentifier(item.name) &&\n (item.name.text === 'key' || item.name.text === 'namespace'),\n )\n ) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>(${value.getText(file)})`,\n });\n } else if (ts.isTemplateExpression(value) && namespaceKeyOf(value) !== undefined) {\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>(${namespaceKeyOf(value)})`,\n });\n } else if (held !== undefined) {\n // The key is built where it is declared (the claim is answered once every file is read); this site needs no edit.\n const entry = claims.get(held.key) ?? { declaration: held.declaration, claims: [] };\n\n entry.claims.push({\n text: typeText,\n names: typeNode === undefined ? [] : namesOf(typeNode),\n });\n claims.set(held.key, entry);\n\n return false;\n } else if (isLibString(value)) {\n // `Foo.name` is wrapped in place, like a literal: the type the call claimed moves into build<T>.\n edits.push({\n start: value.getStart(file),\n end: value.getEnd(),\n text: `${builder}.build<${text}>({ key: ${value.getText(file)} })`,\n });\n } else if (isBuilderCall(value)) {\n if (value.typeArguments !== undefined) {\n return false;\n }\n\n handled.add(value);\n // `BindingKeys.build(` then the argument: the type argument goes between the name and the parenthesis.\n edits.push({\n start: value.expression.getEnd(),\n end: value.expression.getEnd(),\n text: `<${text}>`,\n });\n } else if (isSymbolExpression(value)) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a Symbol key: symbols are no longer binding keys, use BindingKeys.build<T>({ key: \"...\" })',\n });\n\n return false;\n } else {\n // A name or a property (`MAILER`, `Keys.MAILER`) may already be a built key, and the typecheck names a raw\n // one: only an expression that makes a string at run time is listed.\n const isReference =\n ts.isIdentifier(value) ||\n ts.isPropertyAccessExpression(value) ||\n ts.isElementAccessExpression(value);\n\n if (isReference && checker !== undefined) {\n const type = checker.getTypeAtLocation(value);\n\n if (type.flags & ts.TypeFlags.StringLike && type.getProperty('valueType') === undefined) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a string held in a name: build it with BindingKeys.build<T>({ key }) where it is defined (a key of a package you do not own is built by that package)',\n });\n }\n }\n\n if (!isReference) {\n manual.push({\n line: lineOf(value),\n reason:\n 'a key made at run time (a template with substitutions, a call): build it with BindingKeys.build<T>({ key }) where it is made',\n });\n }\n\n return false;\n }\n\n rewritten += 1;\n\n if (typeText === undefined) {\n unnamed.push(lineOf(value));\n }\n\n return true;\n };\n\n /** The declaration the checker resolves a call to, or `undefined` when it cannot (an unresolved receiver). */\n const declarationOf = (\n node: import('typescript').CallExpression,\n ): import('typescript').Declaration | undefined =>\n checker?.getResolvedSignature(node)?.declaration;\n\n const packageNames = new Map<string, string | undefined>();\n\n /**\n * The name in the nearest package.json above `directory` that has one, or `undefined` when there is none. A package.json\n * without a name does not end the walk: an installed package ships `dist/esm/package.json` (`{ \"type\": \"module\" }`) beside\n * the declarations, and the package's own file is further up.\n */\n const packageNameAbove = (directory: string): string | undefined => {\n if (packageNames.has(directory)) {\n return packageNames.get(directory);\n }\n\n const text = readFile(join(directory, 'package.json'));\n const parent = dirname(directory);\n let name: string | undefined;\n\n if (text !== undefined) {\n const parsed: unknown = JSON.parse(text);\n\n if (\n typeof parsed === 'object' &&\n parsed !== null &&\n 'name' in parsed &&\n typeof parsed.name === 'string'\n ) {\n name = parsed.name;\n }\n }\n\n if (name === undefined && parent !== directory) {\n name = packageNameAbove(parent);\n }\n\n packageNames.set(directory, name);\n\n return name;\n };\n\n /** A declaration of the framework: the nearest package.json above its file names one of the framework's packages. */\n const isFrameworkFile = (declaration: import('typescript').Node): boolean => {\n const name = packageNameAbove(dirname(declaration.getSourceFile().fileName));\n\n return name !== undefined && FRAMEWORK_PACKAGES.has(name);\n };\n\n /** `container.get(...)`: the checker resolves the method to the container's (or `Binding`'s), declared by the framework. */\n const isContainerMethod = (\n declaration: import('typescript').Declaration | undefined,\n ): boolean => {\n if (declaration === undefined || !isFrameworkFile(declaration)) {\n return false;\n }\n\n const owner = declaration.parent;\n\n return (\n (ts.isClassLike(owner) || ts.isInterfaceDeclaration(owner)) &&\n owner.name !== undefined &&\n CONTAINER_TYPES.has(owner.name.text)\n );\n };\n\n /** `inject(...)` or `provide(...)` under any local name: the checker follows the import to the framework's. */\n const isFrameworkDecorator = (callee: import('typescript').Expression): boolean => {\n if (checker === undefined || !ts.isIdentifier(callee)) {\n return false;\n }\n\n const symbol = checker.getSymbolAtLocation(callee);\n const target =\n symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias\n ? checker.getAliasedSymbol(symbol)\n : symbol;\n const declaration = target?.declarations?.[0];\n\n return (\n declaration !== undefined &&\n KEY_DECORATORS.has(target?.name ?? '') &&\n isFrameworkFile(declaration)\n );\n };\n\n /** Whether a type mentions a type parameter of a function or class that encloses `from`. */\n const mentionsScopedTypeParameter = (\n type: import('typescript').TypeNode,\n from: import('typescript').Node,\n ): boolean => {\n const scoped = new Set<string>();\n\n for (\n let scope: import('typescript').Node | undefined = from;\n scope !== undefined;\n scope = scope.parent\n ) {\n const parameters =\n ts.isFunctionLike(scope) || ts.isClassLike(scope) ? scope.typeParameters : undefined;\n\n for (const parameter of parameters ?? []) {\n scoped.add(parameter.name.text);\n }\n }\n\n const search = (node: import('typescript').Node): boolean =>\n (ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName) &&\n scoped.has(node.typeName.text)) ||\n ts.forEachChild(node, (child) => (search(child) ? true : undefined)) === true;\n\n return search(type);\n };\n\n /** The text of a decorated parameter's type with `undefined` left out: the key names what is injected, not its absence. */\n const liftedTypeText = (type: import('typescript').TypeNode): string => {\n if (!ts.isUnionTypeNode(type)) {\n return type.getText(file);\n }\n\n const kept = type.types.filter((member) => member.kind !== ts.SyntaxKind.UndefinedKeyword);\n\n return kept.map((member) => member.getText(file)).join(' | ');\n };\n\n const visit = (node: import('typescript').Node): void => {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n const first = node.arguments[0];\n const methodName =\n ts.isPropertyAccessExpression(callee) && KEY_METHODS.has(callee.name.text)\n ? callee.name.text\n : undefined;\n\n if (\n isBuilderCall(node) &&\n node.typeArguments === undefined &&\n node.arguments.length === 1\n ) {\n if (handled.has(node)) {\n ts.forEachChild(node, visit);\n\n return;\n }\n\n const argument = node.arguments[0];\n\n if (ts.isObjectLiteralExpression(argument) && propertyOf(argument, 'key') !== undefined) {\n edits.push({\n start: node.expression.getEnd(),\n end: node.expression.getEnd(),\n text: '<unknown>',\n });\n rewritten += 1;\n unnamed.push(lineOf(node));\n }\n } else if (methodName !== undefined || ts.isIdentifier(callee)) {\n const isGets =\n methodName === 'gets' && first !== undefined && ts.isObjectLiteralExpression(first);\n const hasShape = isGets || isKeyOptions(first);\n const declaration = methodName === undefined ? undefined : declarationOf(node);\n const isContainer =\n methodName === undefined\n ? hasShape && isFrameworkDecorator(callee)\n : hasShape && isContainerMethod(declaration);\n\n if (hasShape && methodName !== undefined && !isContainer && declaration === undefined) {\n manual.push({\n line: lineOf(node),\n reason: `${methodName}(...) with a key: the receiver's type is not resolved (no tsconfig reaches this file, or it is any), so it is not known to be the container: change it by hand if it is`,\n });\n }\n\n if (isContainer && isGets && ts.isObjectLiteralExpression(first)) {\n const list = propertyOf(first, 'bindings')?.initializer;\n\n if (list !== undefined && ts.isArrayLiteralExpression(list)) {\n for (const element of list.elements) {\n if (isKeyOptions(element)) {\n rewriteKey(element, undefined);\n }\n }\n }\n } else if (isContainer && isKeyOptions(first)) {\n // `@inject({ key }) service: Mailer`: the type the parameter or property already claims is the key's type.\n const decorated =\n methodName === undefined &&\n ts.isDecorator(node.parent) &&\n (ts.isParameter(node.parent.parent) || ts.isPropertyDeclaration(node.parent.parent))\n ? node.parent.parent.type\n : undefined;\n const callArgument =\n methodName !== undefined && node.typeArguments?.length === 1\n ? node.typeArguments[0]\n : undefined;\n const claimed = callArgument ?? decorated;\n\n // A type that names a type parameter of the enclosing code cannot go into `build<T>`: the check on the type\n // argument is made while it is still unresolved.\n if (claimed !== undefined && mentionsScopedTypeParameter(claimed, node)) {\n manual.push({\n line: lineOf(node),\n reason:\n 'a key whose type names a type parameter of the enclosing code: a generic key factory builds BindingKeys.build<unknown> and returns it typed as TBindingKey<T>',\n });\n } else {\n const isKeyBuilt = (() => {\n const value = propertyOf(first, 'key')?.initializer;\n\n return (\n value !== undefined && isBuilderCall(value) && value.typeArguments !== undefined\n );\n })();\n\n if (!isKeyBuilt) {\n const typeText =\n callArgument !== undefined\n ? callArgument.getText(file)\n : decorated === undefined\n ? undefined\n : liftedTypeText(decorated);\n const done = rewriteKey(first, typeText, callArgument ?? decorated);\n\n // The type argument moved into `build<T>`; the call no longer needs it. Comments inside it stay.\n if (done && callArgument !== undefined) {\n const open = node.expression.getEnd();\n const close = source.indexOf('(', callArgument.getEnd());\n const comments = source\n .slice(open, close)\n .match(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n]*\\n?/g);\n\n edits.push({ start: open, end: close, text: comments ? comments.join(' ') : '' });\n }\n }\n }\n }\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(file);\n\n // A key constant of this file: build it with the type its use sites agree on, or the one the run settled.\n const build = new Map(opts.declare);\n\n for (const [key, entry] of claims) {\n if (key.startsWith(`${file.fileName}:`) && !build.has(key) && checker !== undefined) {\n build.set(key, BindingKeysCodemod.agreedType({ typescript: ts, checker, entry }));\n }\n }\n\n if (build.size > 0) {\n const declare = (node: import('typescript').Node): void => {\n if (\n (ts.isVariableDeclaration(node) ||\n ts.isPropertyDeclaration(node) ||\n ts.isPropertyAssignment(node)) &&\n node.initializer !== undefined &&\n build.has(`${file.fileName}:${node.initializer.getStart(file)}`)\n ) {\n const type = build.get(`${file.fileName}:${node.initializer.getStart(file)}`);\n\n edits.push({\n start: node.initializer.getStart(file),\n end: node.initializer.getEnd(),\n text: `${builder}.build<${type ?? 'unknown'}>({ key: ${node.initializer.getText(file)} })`,\n });\n rewritten += 1;\n\n if (type === undefined) {\n unnamed.push(lineOf(node.initializer));\n }\n }\n\n ts.forEachChild(node, declare);\n };\n\n declare(file);\n }\n\n if (edits.length === 0) {\n return { output: source, changed: false, rewritten, unnamed, manual };\n }\n\n const { module, declared, named } = BindingKeysCodemod.readIdentifierSource({\n typescript: ts,\n file,\n fallback: importFrom,\n });\n\n if (!declared && module === undefined) {\n return {\n output: source,\n changed: false,\n rewritten: 0,\n unnamed: [],\n manual: [\n ...manual,\n {\n line: 1,\n reason: `${rewritten} key(s) could be rewritten but the file imports nothing from @venizia/ignis to take BindingKeys from: pass --import-from <module>`,\n },\n ],\n };\n }\n\n if (!declared) {\n if (named !== undefined && named.elements.length > 0) {\n const last = named.elements[named.elements.length - 1];\n\n edits.push({ start: last.getEnd(), end: last.getEnd(), text: `, ${BUILDER}` });\n } else {\n const lastImport = [...file.statements]\n .reverse()\n .find((statement) => ts.isImportDeclaration(statement));\n const position = lastImport === undefined ? 0 : lastImport.getEnd();\n const text = `${lastImport === undefined ? '' : '\\n'}import { ${builder} } from '${module}';${lastImport === undefined ? '\\n' : ''}`;\n\n edits.push({ start: position, end: position, text });\n }\n }\n\n let output = source;\n\n for (const edit of [...edits].sort(\n (left, right) => right.start - left.start || right.end - left.end,\n )) {\n output = `${output.slice(0, edit.start)}${edit.text}${output.slice(edit.end)}`;\n }\n\n return { output, changed: output !== source, rewritten, unnamed, manual };\n }\n}\n\n/** `devz codemod binding-keys [paths...] [--write | --check]`: rewrites raw binding keys to `BindingKeys.build<T>`. */\nexport class BindingKeysCommand {\n static readonly USAGE = USAGE;\n\n /**\n * The program the checker answers from: the project's own tsconfig (the nearest one above `root`) with the files the\n * codemod reads added, so a receiver resolves the way the project's typecheck resolves it.\n */\n static createProgram(opts: {\n typescript: typeof import('typescript');\n root: string;\n files: string[];\n }): import('typescript').Program {\n const { typescript: ts, root, files } = opts;\n const configPath = ts.findConfigFile(root, (path) => ts.sys.fileExists(path), 'tsconfig.json');\n const read =\n configPath === undefined\n ? undefined\n : ts.readConfigFile(configPath, (path) => ts.sys.readFile(path));\n const parsed =\n configPath === undefined || read === undefined || read.error !== undefined\n ? undefined\n : ts.parseJsonConfigFileContent(read.config, ts.sys, resolve(configPath, '..'));\n const options: import('typescript').CompilerOptions = {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n experimentalDecorators: true,\n ...parsed?.options,\n noEmit: true,\n skipLibCheck: true,\n incremental: false,\n composite: false,\n allowJs: false,\n };\n\n return ts.createProgram({ rootNames: files, options });\n }\n\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { root, args } = opts;\n\n if (args.includes(BindingKeysFlags.HELP) || args.includes(BindingKeysFlags.HELP_SHORT)) {\n console.log(USAGE);\n\n return 0;\n }\n\n const flags: string[] = [];\n const paths: string[] = [];\n let importFrom: string | undefined;\n let hasImportFlag = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const argument = args[index];\n\n if (argument === BindingKeysFlags.IMPORT_FROM) {\n hasImportFlag = true;\n importFrom = args[index + 1];\n index += 1;\n } else if (argument.startsWith('-')) {\n flags.push(argument);\n } else {\n paths.push(argument);\n }\n }\n\n const unknown = flags.filter((flag) => !BindingKeysFlags.isValid(flag));\n\n if (hasImportFlag && (importFrom === undefined || importFrom.startsWith('-'))) {\n console.error(`devz codemod: ${BindingKeysFlags.IMPORT_FROM} needs a module\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n if (unknown.length > 0) {\n console.error(\n `devz codemod: unknown option ${unknown.map((flag) => `\"${flag}\"`).join(', ')}\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const isWrite = flags.includes(BindingKeysFlags.WRITE);\n const isCheck = flags.includes(BindingKeysFlags.CHECK);\n\n if (isWrite && isCheck) {\n console.error(\n `devz codemod: ${BindingKeysFlags.WRITE} and ${BindingKeysFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'binding-keys',\n isWrite,\n isAll: flags.includes(BindingKeysFlags.ALL),\n paths,\n });\n\n if (refusal) {\n console.error(`${refusal}\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n let typescript: typeof import('typescript');\n\n try {\n const loaded = await import('typescript');\n typescript = loaded.default;\n } catch {\n console.error('devz codemod: the \"typescript\" package is required to read your sources');\n\n return 1;\n }\n\n const targets = (paths.length > 0 ? paths : ['.']).map((path) => resolve(root, path));\n let changedCount = 0;\n let rewrittenCount = 0;\n let manualCount = 0;\n let unnamedCount = 0;\n let refusedCount = 0;\n\n const collected = targets.map((target) => CodemodFiles.collect({ target }));\n const program = BindingKeysCommand.createProgram({\n typescript,\n root,\n files: collected.flat(),\n });\n const checker = program.getTypeChecker();\n const prefilter = /\\b(?:get|gets|getBinding|bind|isBound|unbind|inject|provide|build)\\b/;\n const editable = new Set(collected.flat().map((file) => resolve(file)));\n const isEditable = (fileName: string): boolean => editable.has(resolve(fileName));\n\n // First pass: every use site of a key held in a constant claims a type for the constant's declaration, which can be in\n // another file. The answer is one type per declaration, so the second pass edits each declaration once.\n const claims = new Map<string, IKeyClaims>();\n\n for (const file of collected.flat()) {\n const source = readFileSync(file, 'utf8');\n const sourceFile = program.getSourceFile(file);\n\n if (sourceFile !== undefined && prefilter.test(source)) {\n BindingKeysCodemod.rewrite({\n typescript,\n fileName: file,\n source,\n importFrom,\n program: { sourceFile, checker },\n claims,\n isEditable,\n });\n }\n }\n\n const declare = new Map<string, string | undefined>();\n const declareFiles = new Set<string>();\n\n for (const [key, entry] of claims) {\n declare.set(key, BindingKeysCodemod.agreedType({ typescript, checker, entry }));\n declareFiles.add(entry.declaration.getSourceFile().fileName);\n }\n\n for (const [index, target] of targets.entries()) {\n const files = collected[index];\n const dirty = isWrite ? CodemodFiles.dirty({ target }) : undefined;\n\n if (files.length === 0 && paths.length > 0) {\n console.warn(\n `devz codemod: no source files under \"${relative(root, target) || target}\" (git ignores the path, or it holds none): nothing was read`,\n );\n }\n\n for (const file of files) {\n const source = readFileSync(file, 'utf8');\n\n const sourceFile = program.getSourceFile(file);\n\n if (!prefilter.test(source) && !declareFiles.has(sourceFile?.fileName ?? file)) {\n continue;\n }\n\n const result = BindingKeysCodemod.rewrite({\n typescript,\n fileName: file,\n source,\n importFrom,\n program: sourceFile === undefined ? undefined : { sourceFile, checker },\n declare,\n isEditable,\n });\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n for (const item of result.manual) {\n manualCount += 1;\n console.warn(`manual ${shown}:${item.line} ${item.reason}`);\n }\n\n for (const line of result.unnamed) {\n unnamedCount += 1;\n console.warn(\n `type ${shown}:${line} BindingKeys.build<unknown>: name the type of the value bound under this key`,\n );\n }\n\n if (!result.changed) {\n continue;\n }\n\n if (dirty?.has(file)) {\n refusedCount += 1;\n console.warn(\n `refused ${shown} has local changes (commit, stash or \"git add\" them, then run again)`,\n );\n continue;\n }\n\n changedCount += 1;\n rewrittenCount += result.rewritten;\n console.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} key(s))`,\n );\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n }\n\n console.log(\n `devz codemod binding-keys: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${rewrittenCount} key(s) ${isWrite ? 'rewritten' : 'would be rewritten'}, ${unnamedCount} to type, ${manualCount} manual` +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (!isWrite && changedCount > 0) {\n console.log(\n `Nothing was written. Run again with ${BindingKeysFlags.WRITE} to apply, then name each \"type\" site and run your typecheck.`,\n );\n }\n\n if (isWrite && refusedCount > 0) {\n return 1;\n }\n\n return isCheck && (changedCount > 0 || manualCount > 0) ? 1 : 0;\n }\n}\n"]}
@@ -30,7 +30,7 @@ export declare class ClassRenames {
30
30
  * would change.
31
31
  */
32
32
  export declare class ClassRenamesCommand {
33
- static readonly USAGE = "Usage: devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]\n\nRenames the classes IGNIS renamed, at the import and at every use in the file: RetryHelper, SlugHelper\nand CredentialHelper (@venizia/ignis-helpers) become RetryUtility, SlugUtility and CredentialUtility,\nRejectionHelper and SpawnHelper (@venizia/dev-configs/testing) become RejectionUtility and SpawnUtility. One\ntable, in this file; a later rename adds a row.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): a named import or re-export from the package that owns\nthe class is renamed, and so is each use of the name it brought in (an aliased import, \"Old as Alias\", keeps\nits alias and changes only the imported name). A namespace import's member (\"ns.Old\") is renamed too. A .js,\n.cjs or .mjs file is not read, and neither is \"import('pkg').Old\": edit those by hand. A property or method that\nhas the same name as a class is left alone.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change (for CI)\n --reverse rename back, for a downgrade\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed,\nstaged or untracked): commit or stash it first, so git can undo the codemod.";
33
+ static readonly USAGE = "Usage: devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]\n\nRenames the classes IGNIS renamed, at the import and at every use in the file: RetryHelper, SlugHelper\nand CredentialHelper (@venizia/ignis-helpers) become RetryUtility, SlugUtility and CredentialUtility,\nRejectionHelper and SpawnHelper (@venizia/dev-configs/testing) become RejectionUtility and SpawnUtility. One\ntable, in this file; a later rename adds a row.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): a named import or re-export from the package that owns\nthe class is renamed, and so is each use of the name it brought in (an aliased import, \"Old as Alias\", keeps\nits alias and changes only the imported name). A namespace import's member (\"ns.Old\") is renamed too. A .js,\n.cjs or .mjs file is not read, and neither is \"import('pkg').Old\": edit those by hand. A property or method that\nhas the same name as a class is left alone.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change (for CI)\n --reverse rename back, for a downgrade\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed since staged, or untracked): commit, stash or \"git add\" it first, so git can undo the codemod.";
34
34
  static run(opts: {
35
35
  root: string;
36
36
  args: string[];
@@ -24,8 +24,7 @@ has the same name as a class is left alone.
24
24
  --help print this text and exit
25
25
 
26
26
  With no flag it lists what would change and writes nothing. Inside a git repository it reads the files git
27
- knows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed,
28
- staged or untracked): commit or stash it first, so git can undo the codemod.`;
27
+ knows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed since staged, or untracked): commit, stash or "git add" it first, so git can undo the codemod.`;
29
28
  /** A usage error: nothing was read or written. */
30
29
  const USAGE_ERROR_CODE = 2;
31
30
  class ClassRenameFlags {
@@ -253,7 +252,7 @@ class ClassRenamesCommand {
253
252
  const shown = (0, node_path_1.relative)(root, file).split('\\').join('/') || file;
254
253
  if (dirty?.has(file)) {
255
254
  refusedCount += 1;
256
- console.warn(`refused ${shown} has local changes (commit or stash them, then run again)`);
255
+ console.warn(`refused ${shown} has local changes (commit, stash or "git add" them, then run again)`);
257
256
  continue;
258
257
  }
259
258
  changedCount += 1;
@@ -1 +1 @@
1
- {"version":3,"file":"class-renames.js","sourceRoot":"","sources":["../../../src/cli/codemod/class-renames.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,yCAA8C;AAC9C,mCAAuC;AAEvC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;6EAqB+D,CAAC;AAE9E,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,gBAAgB;aACJ,UAAK,GAAG,SAAS,CAAC;aAClB,QAAG,GAAG,OAAO,CAAC;aACd,UAAK,GAAG,SAAS,CAAC;aAClB,YAAO,GAAG,WAAW,CAAC;aACtB,SAAI,GAAG,QAAQ,CAAC;aAChB,eAAU,GAAG,IAAI,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,GAAG;QACR,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,UAAU;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAUH,qIAAqI;AACrI,MAAM,OAAO,GAAG,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAEjD,0DAA0D;AAC1D,MAAa,gBAAgB;aACX,SAAI,GAAgC;QAClD,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE;QACtE,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE;QACpE,EAAE,OAAO,EAAE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;oBAClB,OAAO,CAAC,IAAI,CACV,YAAY,KAAK,4DAA4D,CAC9E,CAAC;oBACF,SAAS;gBACX,CAAC;gBAED,YAAY,IAAI,CAAC,CAAC;gBAClB,YAAY,IAAI,MAAM,CAAC,SAAS,CAAC;gBACjC,OAAO,CAAC,GAAG,CACT,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,KAAK,KAAK,MAAM,MAAM,CAAC,SAAS,WAAW,CACnF,CAAC;gBAEF,IAAI,OAAO,EAAE,CAAC;oBACZ,IAAA,uBAAa,EAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CACT,+BAA+B,YAAY,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,KAAK,YAAY,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAAE;YAChK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CACxD,CAAC;QAEF,IAAI,CAAC,OAAO,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CACT,uCAAuC,gBAAgB,CAAC,KAAK,qCAAqC,CACnG,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,OAAO,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;;AApIH,kDAqIC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport { CodemodFiles } from './files';\n\nconst USAGE = `Usage: devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]\n\nRenames the classes IGNIS renamed, at the import and at every use in the file: RetryHelper, SlugHelper\nand CredentialHelper (@venizia/ignis-helpers) become RetryUtility, SlugUtility and CredentialUtility,\nRejectionHelper and SpawnHelper (@venizia/dev-configs/testing) become RejectionUtility and SpawnUtility. One\ntable, in this file; a later rename adds a row.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): a named import or re-export from the package that owns\nthe class is renamed, and so is each use of the name it brought in (an aliased import, \"Old as Alias\", keeps\nits alias and changes only the imported name). A namespace import's member (\"ns.Old\") is renamed too. A .js,\n.cjs or .mjs file is not read, and neither is \"import('pkg').Old\": edit those by hand. A property or method that\nhas the same name as a class is left alone.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change (for CI)\n --reverse rename back, for a downgrade\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed,\nstaged or untracked): commit or stash it first, so git can undo the codemod.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\nclass ClassRenameFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\n static readonly CHECK = '--check';\n static readonly REVERSE = '--reverse';\n static readonly HELP = '--help';\n static readonly HELP_SHORT = '-h';\n\n static readonly SCHEME_SET = new Set<string>([\n this.WRITE,\n this.ALL,\n this.CHECK,\n this.REVERSE,\n this.HELP,\n this.HELP_SHORT,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport interface IClassRename {\n oldName: string;\n newName: string;\n /** The packages that export it; a module specifier is theirs when it is the package or a sub-path of it. */\n packages: ReadonlyArray<string>;\n}\n\n/** `@venizia/ignis` re-exports the helpers as types only, so a value import of these classes comes from `@venizia/ignis-helpers`. */\nconst HELPERS = ['@venizia/ignis-helpers', '@venizia/ignis'];\nconst TESTING = ['@venizia/dev-configs/testing'];\n\n/** The renamed classes: add a row for the next rename. */\nexport class ClassRenameTable {\n static readonly ROWS: ReadonlyArray<IClassRename> = [\n { oldName: 'RetryHelper', newName: 'RetryUtility', packages: HELPERS },\n { oldName: 'SlugHelper', newName: 'SlugUtility', packages: HELPERS },\n { oldName: 'CredentialHelper', newName: 'CredentialUtility', packages: HELPERS },\n { oldName: 'RejectionHelper', newName: 'RejectionUtility', packages: TESTING },\n { oldName: 'SpawnHelper', newName: 'SpawnUtility', packages: TESTING },\n ];\n}\n\nexport interface IClassRenamesResult {\n output: string;\n changed: boolean;\n /** How many identifiers were renamed. */\n rewritten: number;\n}\n\n/** Renames the classes of `ClassRenameTable` where a file imports them. */\nexport class ClassRenames {\n static rewrite(opts: {\n typescript: typeof import('typescript');\n fileName: string;\n source: string;\n /** Rename the new names back to the old ones. */\n reverse?: boolean;\n }): IClassRenamesResult {\n const { typescript: ts, fileName, source, reverse = false } = opts;\n const rows = ClassRenameTable.ROWS.map((row) =>\n reverse ? { ...row, oldName: row.newName, newName: row.oldName } : row,\n );\n const scriptKind = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, scriptKind);\n const edits = new Map<number, { start: number; end: number; text: string }>();\n\n const rowsOf = (specifier: string): ReadonlyArray<IClassRename> =>\n rows.filter((row) =>\n row.packages.some((name) => specifier === name || specifier.startsWith(`${name}/`)),\n );\n\n const rename = (node: import('typescript').Node, row: IClassRename, text = row.newName) => {\n const start = node.getStart(file);\n edits.set(start, { start, end: node.getEnd(), text });\n };\n\n /** The local names to rename everywhere in the file, and the namespace imports whose members are renamed. */\n const locals = new Map<string, IClassRename>();\n const namespaces = new Map<string, ReadonlyArray<IClassRename>>();\n\n for (const statement of file.statements) {\n if (\n (ts.isImportDeclaration(statement) || ts.isExportDeclaration(statement)) &&\n statement.moduleSpecifier &&\n ts.isStringLiteralLike(statement.moduleSpecifier)\n ) {\n const owned = rowsOf(statement.moduleSpecifier.text);\n\n if (owned.length === 0) {\n continue;\n }\n\n if (ts.isImportDeclaration(statement)) {\n const bindings = statement.importClause?.namedBindings;\n\n if (bindings && ts.isNamespaceImport(bindings)) {\n namespaces.set(bindings.name.text, owned);\n continue;\n }\n\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const imported = element.propertyName ?? element.name;\n const row = owned.find((entry) => entry.oldName === imported.text);\n\n if (!row) {\n continue;\n }\n\n rename(imported, row);\n\n if (!element.propertyName) {\n locals.set(element.name.text, row);\n }\n }\n } else if (statement.exportClause && ts.isNamedExports(statement.exportClause)) {\n for (const element of statement.exportClause.elements) {\n const exported = element.propertyName ?? element.name;\n const row = owned.find((entry) => entry.oldName === exported.text);\n\n if (row) {\n rename(exported, row);\n }\n }\n }\n }\n }\n\n if (locals.size === 0 && namespaces.size === 0 && edits.size === 0) {\n return { output: source, changed: false, rewritten: 0 };\n }\n\n /** An identifier that names a property, member or attribute, not the class. */\n const isMemberName = (node: import('typescript').Identifier): boolean => {\n const parent = node.parent;\n\n if (ts.isPropertyAccessExpression(parent)) {\n return parent.name === node;\n }\n\n if (ts.isQualifiedName(parent)) {\n return parent.right === node;\n }\n\n if (ts.isBindingElement(parent)) {\n return parent.propertyName === node;\n }\n\n return (\n (ts.isPropertyAssignment(parent) ||\n ts.isPropertyDeclaration(parent) ||\n ts.isPropertySignature(parent) ||\n ts.isMethodDeclaration(parent) ||\n ts.isMethodSignature(parent) ||\n ts.isGetAccessorDeclaration(parent) ||\n ts.isSetAccessorDeclaration(parent) ||\n ts.isEnumMember(parent) ||\n ts.isJsxAttribute(parent)) &&\n parent.name === node\n );\n };\n\n const visit = (node: import('typescript').Node): void => {\n if (ts.isImportDeclaration(node) || (ts.isExportDeclaration(node) && node.moduleSpecifier)) {\n return;\n }\n\n if (ts.isIdentifier(node)) {\n const row = locals.get(node.text);\n\n if (row && !isMemberName(node)) {\n // `{ Old }` in an object literal or a destructuring keeps its key: `{ Old: New }`.\n const isShorthand =\n (ts.isShorthandPropertyAssignment(node.parent) && node.parent.name === node) ||\n (ts.isBindingElement(node.parent) &&\n !node.parent.propertyName &&\n node.parent.name === node);\n\n rename(node, row, isShorthand ? `${node.text}: ${row.newName}` : row.newName);\n }\n }\n\n if (ts.isPropertyAccessExpression(node) || ts.isQualifiedName(node)) {\n const [scope, member] = ts.isPropertyAccessExpression(node)\n ? [node.expression, node.name]\n : [node.left, node.right];\n const owned = ts.isIdentifier(scope) ? namespaces.get(scope.text) : undefined;\n const row = owned?.find((entry) => entry.oldName === member.text);\n\n if (row) {\n rename(member, row);\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(file);\n\n let output = source;\n\n for (const edit of [...edits.values()].sort((a, b) => b.start - a.start)) {\n output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);\n }\n\n return { output, changed: output !== source, rewritten: edits.size };\n }\n}\n\n/**\n * `devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]`: renames the classes IGNIS\n * renamed. It is a dry run unless `--write` is given. `--check` is the same dry run, and exits 1 while a file\n * would change.\n */\nexport class ClassRenamesCommand {\n static readonly USAGE = USAGE;\n\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { root, args } = opts;\n\n if (args.includes(ClassRenameFlags.HELP) || args.includes(ClassRenameFlags.HELP_SHORT)) {\n console.log(USAGE);\n\n return 0;\n }\n\n const flags = args.filter((argument) => argument.startsWith('-'));\n const paths = args.filter((argument) => !argument.startsWith('-'));\n const unknown = flags.filter((flag) => !ClassRenameFlags.isValid(flag));\n\n if (unknown.length > 0) {\n console.error(\n `devz codemod: unknown option ${unknown.map((flag) => `\"${flag}\"`).join(', ')}\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const isWrite = flags.includes(ClassRenameFlags.WRITE);\n const isCheck = flags.includes(ClassRenameFlags.CHECK);\n const isReverse = flags.includes(ClassRenameFlags.REVERSE);\n\n if (isWrite && isCheck) {\n console.error(\n `devz codemod: ${ClassRenameFlags.WRITE} and ${ClassRenameFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'class-renames',\n isWrite,\n isAll: flags.includes(ClassRenameFlags.ALL),\n paths,\n });\n\n if (refusal) {\n console.error(`${refusal}\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n let typescript: typeof import('typescript');\n\n try {\n const loaded = await import('typescript');\n typescript = loaded.default;\n } catch {\n console.error('devz codemod: the \"typescript\" package is required to read your sources');\n\n return 1;\n }\n\n const names = ClassRenameTable.ROWS.map((row) => (isReverse ? row.newName : row.oldName));\n const targets = (paths.length > 0 ? paths : ['.']).map((path) => resolve(root, path));\n let changedCount = 0;\n let renamedCount = 0;\n let refusedCount = 0;\n\n for (const target of targets) {\n const files = CodemodFiles.collect({ target });\n const dirty = isWrite ? CodemodFiles.dirty({ target }) : undefined;\n\n if (files.length === 0 && paths.length > 0) {\n console.warn(\n `devz codemod: no source files under \"${relative(root, target) || target}\" (git ignores the path, or it holds none): nothing was read`,\n );\n }\n\n for (const file of files) {\n const source = readFileSync(file, 'utf8');\n\n if (!names.some((name) => source.includes(name))) {\n continue;\n }\n\n const result = ClassRenames.rewrite({\n typescript,\n fileName: file,\n source,\n reverse: isReverse,\n });\n\n if (!result.changed) {\n continue;\n }\n\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n if (dirty?.has(file)) {\n refusedCount += 1;\n console.warn(\n `refused ${shown} has local changes (commit or stash them, then run again)`,\n );\n continue;\n }\n\n changedCount += 1;\n renamedCount += result.rewritten;\n console.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} name(s))`,\n );\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n }\n\n console.log(\n `devz codemod class-renames: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${renamedCount} name(s) ${isWrite ? 'renamed' : 'would be renamed'}` +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (!isWrite && changedCount > 0) {\n console.log(\n `Nothing was written. Run again with ${ClassRenameFlags.WRITE} to apply, then run your typecheck.`,\n );\n }\n\n if (isWrite && refusedCount > 0) {\n return 1;\n }\n\n return isCheck && changedCount > 0 ? 1 : 0;\n }\n}\n"]}
1
+ {"version":3,"file":"class-renames.js","sourceRoot":"","sources":["../../../src/cli/codemod/class-renames.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,yCAA8C;AAC9C,mCAAuC;AAEvC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;qMAoBuL,CAAC;AAEtM,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,gBAAgB;aACJ,UAAK,GAAG,SAAS,CAAC;aAClB,QAAG,GAAG,OAAO,CAAC;aACd,UAAK,GAAG,SAAS,CAAC;aAClB,YAAO,GAAG,WAAW,CAAC;aACtB,SAAI,GAAG,QAAQ,CAAC;aAChB,eAAU,GAAG,IAAI,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,GAAG;QACR,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,UAAU;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAUH,qIAAqI;AACrI,MAAM,OAAO,GAAG,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAEjD,0DAA0D;AAC1D,MAAa,gBAAgB;aACX,SAAI,GAAgC;QAClD,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ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{ readFileSync, writeFileSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport { CodemodFiles } from './files';\n\nconst USAGE = `Usage: devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]\n\nRenames the classes IGNIS renamed, at the import and at every use in the file: RetryHelper, SlugHelper\nand CredentialHelper (@venizia/ignis-helpers) become RetryUtility, SlugUtility and CredentialUtility,\nRejectionHelper and SpawnHelper (@venizia/dev-configs/testing) become RejectionUtility and SpawnUtility. One\ntable, in this file; a later rename adds a row.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): a named import or re-export from the package that owns\nthe class is renamed, and so is each use of the name it brought in (an aliased import, \"Old as Alias\", keeps\nits alias and changes only the imported name). A namespace import's member (\"ns.Old\") is renamed too. A .js,\n.cjs or .mjs file is not read, and neither is \"import('pkg').Old\": edit those by hand. A property or method that\nhas the same name as a class is left alone.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change (for CI)\n --reverse rename back, for a downgrade\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed since staged, or untracked): commit, stash or \"git add\" it first, so git can undo the codemod.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\nclass ClassRenameFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\n static readonly CHECK = '--check';\n static readonly REVERSE = '--reverse';\n static readonly HELP = '--help';\n static readonly HELP_SHORT = '-h';\n\n static readonly SCHEME_SET = new Set<string>([\n this.WRITE,\n this.ALL,\n this.CHECK,\n this.REVERSE,\n this.HELP,\n this.HELP_SHORT,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport interface IClassRename {\n oldName: string;\n newName: string;\n /** The packages that export it; a module specifier is theirs when it is the package or a sub-path of it. */\n packages: ReadonlyArray<string>;\n}\n\n/** `@venizia/ignis` re-exports the helpers as types only, so a value import of these classes comes from `@venizia/ignis-helpers`. */\nconst HELPERS = ['@venizia/ignis-helpers', '@venizia/ignis'];\nconst TESTING = ['@venizia/dev-configs/testing'];\n\n/** The renamed classes: add a row for the next rename. */\nexport class ClassRenameTable {\n static readonly ROWS: ReadonlyArray<IClassRename> = [\n { oldName: 'RetryHelper', newName: 'RetryUtility', packages: HELPERS },\n { oldName: 'SlugHelper', newName: 'SlugUtility', packages: HELPERS },\n { oldName: 'CredentialHelper', newName: 'CredentialUtility', packages: HELPERS },\n { oldName: 'RejectionHelper', newName: 'RejectionUtility', packages: TESTING },\n { oldName: 'SpawnHelper', newName: 'SpawnUtility', packages: TESTING },\n ];\n}\n\nexport interface IClassRenamesResult {\n output: string;\n changed: boolean;\n /** How many identifiers were renamed. */\n rewritten: number;\n}\n\n/** Renames the classes of `ClassRenameTable` where a file imports them. */\nexport class ClassRenames {\n static rewrite(opts: {\n typescript: typeof import('typescript');\n fileName: string;\n source: string;\n /** Rename the new names back to the old ones. */\n reverse?: boolean;\n }): IClassRenamesResult {\n const { typescript: ts, fileName, source, reverse = false } = opts;\n const rows = ClassRenameTable.ROWS.map((row) =>\n reverse ? { ...row, oldName: row.newName, newName: row.oldName } : row,\n );\n const scriptKind = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, scriptKind);\n const edits = new Map<number, { start: number; end: number; text: string }>();\n\n const rowsOf = (specifier: string): ReadonlyArray<IClassRename> =>\n rows.filter((row) =>\n row.packages.some((name) => specifier === name || specifier.startsWith(`${name}/`)),\n );\n\n const rename = (node: import('typescript').Node, row: IClassRename, text = row.newName) => {\n const start = node.getStart(file);\n edits.set(start, { start, end: node.getEnd(), text });\n };\n\n /** The local names to rename everywhere in the file, and the namespace imports whose members are renamed. */\n const locals = new Map<string, IClassRename>();\n const namespaces = new Map<string, ReadonlyArray<IClassRename>>();\n\n for (const statement of file.statements) {\n if (\n (ts.isImportDeclaration(statement) || ts.isExportDeclaration(statement)) &&\n statement.moduleSpecifier &&\n ts.isStringLiteralLike(statement.moduleSpecifier)\n ) {\n const owned = rowsOf(statement.moduleSpecifier.text);\n\n if (owned.length === 0) {\n continue;\n }\n\n if (ts.isImportDeclaration(statement)) {\n const bindings = statement.importClause?.namedBindings;\n\n if (bindings && ts.isNamespaceImport(bindings)) {\n namespaces.set(bindings.name.text, owned);\n continue;\n }\n\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const imported = element.propertyName ?? element.name;\n const row = owned.find((entry) => entry.oldName === imported.text);\n\n if (!row) {\n continue;\n }\n\n rename(imported, row);\n\n if (!element.propertyName) {\n locals.set(element.name.text, row);\n }\n }\n } else if (statement.exportClause && ts.isNamedExports(statement.exportClause)) {\n for (const element of statement.exportClause.elements) {\n const exported = element.propertyName ?? element.name;\n const row = owned.find((entry) => entry.oldName === exported.text);\n\n if (row) {\n rename(exported, row);\n }\n }\n }\n }\n }\n\n if (locals.size === 0 && namespaces.size === 0 && edits.size === 0) {\n return { output: source, changed: false, rewritten: 0 };\n }\n\n /** An identifier that names a property, member or attribute, not the class. */\n const isMemberName = (node: import('typescript').Identifier): boolean => {\n const parent = node.parent;\n\n if (ts.isPropertyAccessExpression(parent)) {\n return parent.name === node;\n }\n\n if (ts.isQualifiedName(parent)) {\n return parent.right === node;\n }\n\n if (ts.isBindingElement(parent)) {\n return parent.propertyName === node;\n }\n\n return (\n (ts.isPropertyAssignment(parent) ||\n ts.isPropertyDeclaration(parent) ||\n ts.isPropertySignature(parent) ||\n ts.isMethodDeclaration(parent) ||\n ts.isMethodSignature(parent) ||\n ts.isGetAccessorDeclaration(parent) ||\n ts.isSetAccessorDeclaration(parent) ||\n ts.isEnumMember(parent) ||\n ts.isJsxAttribute(parent)) &&\n parent.name === node\n );\n };\n\n const visit = (node: import('typescript').Node): void => {\n if (ts.isImportDeclaration(node) || (ts.isExportDeclaration(node) && node.moduleSpecifier)) {\n return;\n }\n\n if (ts.isIdentifier(node)) {\n const row = locals.get(node.text);\n\n if (row && !isMemberName(node)) {\n // `{ Old }` in an object literal or a destructuring keeps its key: `{ Old: New }`.\n const isShorthand =\n (ts.isShorthandPropertyAssignment(node.parent) && node.parent.name === node) ||\n (ts.isBindingElement(node.parent) &&\n !node.parent.propertyName &&\n node.parent.name === node);\n\n rename(node, row, isShorthand ? `${node.text}: ${row.newName}` : row.newName);\n }\n }\n\n if (ts.isPropertyAccessExpression(node) || ts.isQualifiedName(node)) {\n const [scope, member] = ts.isPropertyAccessExpression(node)\n ? [node.expression, node.name]\n : [node.left, node.right];\n const owned = ts.isIdentifier(scope) ? namespaces.get(scope.text) : undefined;\n const row = owned?.find((entry) => entry.oldName === member.text);\n\n if (row) {\n rename(member, row);\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(file);\n\n let output = source;\n\n for (const edit of [...edits.values()].sort((a, b) => b.start - a.start)) {\n output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);\n }\n\n return { output, changed: output !== source, rewritten: edits.size };\n }\n}\n\n/**\n * `devz codemod class-renames [paths...] [--write [--all] | --check] [--reverse]`: renames the classes IGNIS\n * renamed. It is a dry run unless `--write` is given. `--check` is the same dry run, and exits 1 while a file\n * would change.\n */\nexport class ClassRenamesCommand {\n static readonly USAGE = USAGE;\n\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { root, args } = opts;\n\n if (args.includes(ClassRenameFlags.HELP) || args.includes(ClassRenameFlags.HELP_SHORT)) {\n console.log(USAGE);\n\n return 0;\n }\n\n const flags = args.filter((argument) => argument.startsWith('-'));\n const paths = args.filter((argument) => !argument.startsWith('-'));\n const unknown = flags.filter((flag) => !ClassRenameFlags.isValid(flag));\n\n if (unknown.length > 0) {\n console.error(\n `devz codemod: unknown option ${unknown.map((flag) => `\"${flag}\"`).join(', ')}\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const isWrite = flags.includes(ClassRenameFlags.WRITE);\n const isCheck = flags.includes(ClassRenameFlags.CHECK);\n const isReverse = flags.includes(ClassRenameFlags.REVERSE);\n\n if (isWrite && isCheck) {\n console.error(\n `devz codemod: ${ClassRenameFlags.WRITE} and ${ClassRenameFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'class-renames',\n isWrite,\n isAll: flags.includes(ClassRenameFlags.ALL),\n paths,\n });\n\n if (refusal) {\n console.error(`${refusal}\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n let typescript: typeof import('typescript');\n\n try {\n const loaded = await import('typescript');\n typescript = loaded.default;\n } catch {\n console.error('devz codemod: the \"typescript\" package is required to read your sources');\n\n return 1;\n }\n\n const names = ClassRenameTable.ROWS.map((row) => (isReverse ? row.newName : row.oldName));\n const targets = (paths.length > 0 ? paths : ['.']).map((path) => resolve(root, path));\n let changedCount = 0;\n let renamedCount = 0;\n let refusedCount = 0;\n\n for (const target of targets) {\n const files = CodemodFiles.collect({ target });\n const dirty = isWrite ? CodemodFiles.dirty({ target }) : undefined;\n\n if (files.length === 0 && paths.length > 0) {\n console.warn(\n `devz codemod: no source files under \"${relative(root, target) || target}\" (git ignores the path, or it holds none): nothing was read`,\n );\n }\n\n for (const file of files) {\n const source = readFileSync(file, 'utf8');\n\n if (!names.some((name) => source.includes(name))) {\n continue;\n }\n\n const result = ClassRenames.rewrite({\n typescript,\n fileName: file,\n source,\n reverse: isReverse,\n });\n\n if (!result.changed) {\n continue;\n }\n\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n if (dirty?.has(file)) {\n refusedCount += 1;\n console.warn(\n `refused ${shown} has local changes (commit, stash or \"git add\" them, then run again)`,\n );\n continue;\n }\n\n changedCount += 1;\n renamedCount += result.rewritten;\n console.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} name(s))`,\n );\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n }\n\n console.log(\n `devz codemod class-renames: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${renamedCount} name(s) ${isWrite ? 'renamed' : 'would be renamed'}` +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (!isWrite && changedCount > 0) {\n console.log(\n `Nothing was written. Run again with ${ClassRenameFlags.WRITE} to apply, then run your typecheck.`,\n );\n }\n\n if (isWrite && refusedCount > 0) {\n return 1;\n }\n\n return isCheck && changedCount > 0 ? 1 : 0;\n }\n}\n"]}
@@ -38,7 +38,7 @@ export declare class ConnectorImports {
38
38
  * is given. `--check` is the same dry run, and exits 1 while a file would change.
39
39
  */
40
40
  export declare class ConnectorImportsCommand {
41
- static readonly USAGE = "Usage: devz codemod connector-imports [paths...] [--write | --check] [--reverse]\n\nMoves the connector sub-path imports of @venizia/ignis to @venizia/ignis-connectors. The sub-paths\n@venizia/ignis/postgres, /postgres/node-postgres, /postgres/postgres-js, /postgres/pglite,\n/postgres/supabase, /relational, /sqlite, /sqlite/libsql, /search, /search/controllers, /meilisearch,\n/typesense and /typesense/controllers are removed; each one is the same name under\n@venizia/ignis-connectors, so the rewrite changes only the specifier.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): import and export declarations, import(\"...\"),\nrequire(\"...\"), require.resolve(\"...\") and import.meta.resolve(\"...\"), import(\"...\") types, declare module\n\"...\" and the module name of mock.module(\"...\") style calls. A .js, .cjs or .mjs file is not read: edit it by hand. Other sub-paths of @venizia/ignis (mail, static-asset,\ntesting, websocket, ...) and the root are not touched. The app must list @venizia/ignis-connectors as a\ndirect dependency: it reports each package.json that does not.\n\n --write write the changed files (without it, nothing is written)\n --check dry run that exits 1 while a file would change (for CI)\n --reverse move the specifiers back, for a downgrade: @venizia/ignis-connectors/<sub-path> becomes\n @venizia/ignis/<sub-path>\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the\nfiles git knows (tracked, or untracked and not ignored), and --write refuses a file with local changes\n(changed, staged or untracked): commit or stash it first, so git can undo the codemod.";
41
+ static readonly USAGE = "Usage: devz codemod connector-imports [paths...] [--write | --check] [--reverse]\n\nMoves the connector sub-path imports of @venizia/ignis to @venizia/ignis-connectors. The sub-paths\n@venizia/ignis/postgres, /postgres/node-postgres, /postgres/postgres-js, /postgres/pglite,\n/postgres/supabase, /relational, /sqlite, /sqlite/libsql, /search, /search/controllers, /meilisearch,\n/typesense and /typesense/controllers are removed; each one is the same name under\n@venizia/ignis-connectors, so the rewrite changes only the specifier.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts): import and export declarations, import(\"...\"),\nrequire(\"...\"), require.resolve(\"...\") and import.meta.resolve(\"...\"), import(\"...\") types, declare module\n\"...\" and the module name of mock.module(\"...\") style calls. A .js, .cjs or .mjs file is not read: edit it by hand. Other sub-paths of @venizia/ignis (mail, static-asset,\ntesting, websocket, ...) and the root are not touched. The app must list @venizia/ignis-connectors as a\ndirect dependency: it reports each package.json that does not.\n\n --write write the changed files (without it, nothing is written)\n --check dry run that exits 1 while a file would change (for CI)\n --reverse move the specifiers back, for a downgrade: @venizia/ignis-connectors/<sub-path> becomes\n @venizia/ignis/<sub-path>\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the\nfiles git knows (tracked, or untracked and not ignored), and --write refuses a file with local changes\n(changed since staged, or untracked): commit, stash or \"git add\" it first, so git can undo the codemod.";
42
42
  static run(opts: {
43
43
  root: string;
44
44
  args: string[];
@@ -26,7 +26,7 @@ direct dependency: it reports each package.json that does not.
26
26
 
27
27
  With no flag it lists what would change and writes nothing. Inside a git repository it reads the
28
28
  files git knows (tracked, or untracked and not ignored), and --write refuses a file with local changes
29
- (changed, staged or untracked): commit or stash it first, so git can undo the codemod.`;
29
+ (changed since staged, or untracked): commit, stash or "git add" it first, so git can undo the codemod.`;
30
30
  /** A usage error: nothing was read or written. */
31
31
  const USAGE_ERROR_CODE = 2;
32
32
  const CONNECTORS_PACKAGE = '@venizia/ignis-connectors';
@@ -255,7 +255,7 @@ class ConnectorImportsCommand {
255
255
  const shown = (0, node_path_1.relative)(root, file).split('\\').join('/') || file;
256
256
  if (dirty?.has(file)) {
257
257
  refusedCount += 1;
258
- console.warn(`refused ${shown} has local changes (commit or stash them, then run again)`);
258
+ console.warn(`refused ${shown} has local changes (commit, stash or "git add" them, then run again)`);
259
259
  continue;
260
260
  }
261
261
  changedCount += 1;