@venizia/dev-configs 0.4.8-9 → 0.5.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/cli/codemod/any-aliases.d.ts +35 -0
- package/dist/cli/codemod/any-aliases.js +544 -0
- package/dist/cli/codemod/any-aliases.js.map +1 -0
- package/dist/cli/codemod/binding-keys.d.ts +51 -0
- package/dist/cli/codemod/binding-keys.js +716 -0
- package/dist/cli/codemod/binding-keys.js.map +1 -0
- package/dist/cli/codemod/env-get.d.ts +56 -0
- package/dist/cli/codemod/env-get.js +599 -0
- package/dist/cli/codemod/env-get.js.map +1 -0
- package/dist/cli/codemod/index.js +26 -1
- package/dist/cli/codemod/index.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/testing/repo-tmp.js +17 -10
- package/dist/testing/repo-tmp.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEA0CkD,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;AAC5E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7D,qDAAqD;AACrD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,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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;;AAnNH,gDAoNC","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 that is a const of the file (const MAILER = 'services.Mailer') is rewritten where it is declared. Any\nother name or property (Keys.MAILER) is left alone without a line: it may already be a built key, and your typecheck\nnames a raw one.\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/** 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/** 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 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 }): IBindingKeysResult {\n const {\n typescript: ts,\n fileName,\n importFrom,\n program,\n readFile = (path: string) => ts.sys.readFile(path),\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 /** `const NAME = 'literal'` declared once in the file: a key held in a constant is rewritten where it is declared. */\n const constants = new Map<string, import('typescript').VariableDeclaration>();\n const duplicates = new Set<string>();\n let rewritten = 0;\n const lineOf = (node: import('typescript').Node): number =>\n file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1;\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 /**\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 ): 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\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 (\n ts.isIdentifier(value) &&\n constants.has(value.text) &&\n !duplicates.has(value.text)\n ) {\n const declaration = constants.get(value.text);\n\n if (declaration?.initializer === undefined || handled.has(declaration)) {\n return false;\n }\n\n handled.add(declaration);\n edits.push({\n start: declaration.initializer.getStart(file),\n end: declaration.initializer.getEnd(),\n text: `${builder}.build<${text}>({ key: ${declaration.initializer.getText(file)} })`,\n });\n\n if (typeText === undefined) {\n unnamed.push(lineOf(declaration));\n }\n\n rewritten += 1;\n\n return true;\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 /** The name in the nearest package.json above `directory`, or `undefined` when there is none. */\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 name =\n typeof parsed === 'object' &&\n parsed !== null &&\n 'name' in parsed &&\n typeof parsed.name === 'string'\n ? parsed.name\n : '';\n } else if (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);\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 const collect = (node: import('typescript').Node): void => {\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.initializer !== undefined &&\n (ts.isStringLiteral(node.initializer) ||\n ts.isNoSubstitutionTemplateLiteral(node.initializer)) &&\n (ts.getCombinedNodeFlags(node) & ts.NodeFlags.Const) !== 0\n ) {\n if (constants.has(node.name.text)) {\n duplicates.add(node.name.text);\n }\n\n constants.set(node.name.text, node);\n }\n\n ts.forEachChild(node, collect);\n };\n\n collect(file);\n visit(file);\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\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 if (!/\\b(?:get|gets|getBinding|bind|isBound|unbind|inject|provide|build)\\b/.test(source)) {\n continue;\n }\n\n const sourceFile = program.getSourceFile(file);\n const result = BindingKeysCodemod.rewrite({\n typescript,\n fileName: file,\n source,\n importFrom,\n program: sourceFile === undefined ? undefined : { sourceFile, checker },\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"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface IEnvGetResult {
|
|
2
|
+
output: string;
|
|
3
|
+
changed: boolean;
|
|
4
|
+
/** How many calls were rewritten. */
|
|
5
|
+
rewritten: number;
|
|
6
|
+
/** The store calls the codemod cannot rewrite: file line (1-based), the first type argument and, when the cause is not the type argument itself, the reason. */
|
|
7
|
+
manual: Array<{
|
|
8
|
+
line: number;
|
|
9
|
+
type: string;
|
|
10
|
+
reason?: string;
|
|
11
|
+
}>;
|
|
12
|
+
/** With `--numbers`: the lines of the number reads rewritten to a transform (they are counted in `rewritten` too). */
|
|
13
|
+
numbered: number[];
|
|
14
|
+
/** The `get<...>(key)` calls on a receiver the file does not bind to the store (or through an optional chain), left alone and listed: file line (1-based) and the receiver text. */
|
|
15
|
+
skipped: Array<{
|
|
16
|
+
line: number;
|
|
17
|
+
receiver: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
/** Rewrites the type arguments of `applicationEnvironment.get()` calls. */
|
|
21
|
+
export declare class EnvGet {
|
|
22
|
+
/** The names a declaration in `node` binds, for `node` a scope: a block or file, a function, a loop or a catch clause. */
|
|
23
|
+
private static declarationIn;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `identifier` refers to the environment store: the binding the name resolves to, from the
|
|
26
|
+
* innermost scope outwards, is an import of `applicationEnvironment` or `AppEnvs` from the store module
|
|
27
|
+
* (aliased or not), or a `const` that is initialised from such a name. A parameter, a local, an import
|
|
28
|
+
* from anywhere else and a name nothing declares are not the store.
|
|
29
|
+
*/
|
|
30
|
+
static isStore(opts: {
|
|
31
|
+
typescript: typeof import('typescript');
|
|
32
|
+
identifier: import('typescript').Identifier;
|
|
33
|
+
}): boolean;
|
|
34
|
+
/** The import specifier of the store that `identifier` resolves to (through const aliases), or `undefined` when it is not the store. */
|
|
35
|
+
static storeImport(opts: {
|
|
36
|
+
typescript: typeof import('typescript');
|
|
37
|
+
identifier: import('typescript').Identifier;
|
|
38
|
+
seen?: Set<import('typescript').Node>;
|
|
39
|
+
}): import('typescript').ImportSpecifier | undefined;
|
|
40
|
+
static rewrite(opts: {
|
|
41
|
+
typescript: typeof import('typescript');
|
|
42
|
+
fileName: string;
|
|
43
|
+
source: string;
|
|
44
|
+
/** `--numbers`: rewrite `get<number>(key)` and `get<number>(key, { defaultValue })` to a `ParseUtility.toNumber` transform. */
|
|
45
|
+
numbers?: boolean;
|
|
46
|
+
}): IEnvGetResult;
|
|
47
|
+
}
|
|
48
|
+
/** `devz codemod env-get [paths...] [--write | --check]`: rewrites the type arguments of `applicationEnvironment.get()`. */
|
|
49
|
+
export declare class EnvGetCommand {
|
|
50
|
+
static readonly USAGE = "Usage: devz codemod env-get [paths...] [--write [--all] | --check]\n\nRewrites the type arguments of applicationEnvironment.get() (and its alias AppEnvs.get()) for the\n@venizia/ignis-helpers release where get() reads strings:\n\n get<string>(key) becomes get(key)\n get<string | undefined>(key) becomes get(key)\n get<string>(key, { defaultValue }) becomes get(key, { defaultValue })\n get<R, B>(key, { transform }) becomes get<R>(key, { transform })\n\nAny other type argument (get<number>(key), get<boolean>(key)) was a cast the new get() no longer allows:\nthe codemod lists it as \"manual\" and leaves it. Move the conversion into a transform, or read the\nstring and convert it where you use it: get(key, { transform: Number }).\n\nA call already in the new form (one type argument and an options literal with a transform) is left alone\nand not listed, and a second run changes nothing.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts) and rewrites only calls whose receiver resolves, from the\nscope of the call, to the store: a name imported as applicationEnvironment or AppEnvs from @venizia/ignis,\n@venizia/ignis-helpers (or a sub-path), under any local name (import { AppEnvs as Envs } ...), or a const\ninitialised from such a name in the same or an enclosing scope. A parameter, a local variable, an import from\nanywhere else (a barrel of your own included) and a name nothing declares are not the store. Every other\nget<...>(key) call (a property, an optional chain, those names) is printed as skipped with its file and line,\nand a call with a type argument it cannot place as manual, so run your typecheck after it. A call with one type argument and options\nthat are not a literal (a variable) is left alone and not listed; one with two type arguments and such options is listed as manual, and so is a number read with such options under --numbers (the codemod cannot see what the options hold). A var declared in a nested block counts as block-scoped (a hoisted one is not followed). A comment between the method name and the parenthesis is dropped. A .js, .cjs or .mjs file\nis 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 --numbers also rewrite the number reads: get<number>(key) and get<number>(key, { defaultValue }) become\n get(key, { transform: (raw) => ParseUtility.toNumber({ input: raw }), defaultValue }) and\n ParseUtility joins the import of the store. Every rewrite is listed (\"numbers\"). The old call returned\n the environment STRING typed as a number: after the rewrite the read converts it to a number, an unset\n variable still answers undefined (or the default), and a non-numeric value throws at the read\n instead of flowing on as a string. A boolean (the \"false\" string is truthy) stays manual. So does a number\n read the rewrite would not compile: a defaultValue that is a literal but not a number ('10'), options that\n are a variable, a ParseUtility name the file already declares for something else (an import from another\n module, a type-only import, a local), and a parameter or local named ParseUtility at the call.\n --check dry run that exits 1 while a file would change or a manual call remains (for CI)\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\ngit knows, and --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.";
|
|
51
|
+
static run(opts: {
|
|
52
|
+
root: string;
|
|
53
|
+
args: string[];
|
|
54
|
+
}): Promise<number>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=env-get.d.ts.map
|