@venizia/dev-configs 0.4.8-9 → 0.4.8

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-get.js","sourceRoot":"","sources":["../../../src/cli/codemod/env-get.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,yCAA8C;AAC9C,mCAAuC;AAEvC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEA2CkD,CAAC;AAEjE,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,oGAAoG;AACpG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC,CAAC;AAEjE,4GAA4G;AAC5G,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAE/D,MAAM,WAAW;aACC,UAAK,GAAG,SAAS,CAAC;aAClB,QAAG,GAAG,OAAO,CAAC;aACd,YAAO,GAAG,WAAW,CAAC;aACtB,UAAK,GAAG,SAAS,CAAC;aAClB,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,OAAO;QACZ,IAAI,CAAC,KAAK;QACV,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;;AAgBH,2EAA2E;AAC3E,MAAa,MAAM;IACjB,0HAA0H;IAClH,MAAM,CAAC,aAAa,CAAC,IAI5B;QACC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI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ync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport { CodemodFiles } from './files';\n\nconst 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.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\n/** The names the environment store is exported under, and so the receivers `get()` is called on. */\nconst RECEIVERS = new Set(['applicationEnvironment', 'AppEnvs']);\n\n/** A module that exports the store: the root package and the helpers package, with or without a subpath. */\nconst STORE_MODULE = /^@venizia\\/ignis(?:-helpers)?(?:\\/.*)?$/;\n\nclass EnvGetFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\n static readonly NUMBERS = '--numbers';\n static readonly CHECK = '--check';\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.NUMBERS,\n this.CHECK,\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 IEnvGetResult {\n output: string;\n changed: boolean;\n /** How many calls were rewritten. */\n rewritten: number;\n /** 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. */\n manual: Array<{ line: number; type: string; reason?: string }>;\n /** With `--numbers`: the lines of the number reads rewritten to a transform (they are counted in `rewritten` too). */\n numbered: number[];\n /** 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. */\n skipped: Array<{ line: number; receiver: string }>;\n}\n\n/** Rewrites the type arguments of `applicationEnvironment.get()` calls. */\nexport class EnvGet {\n /** The names a declaration in `node` binds, for `node` a scope: a block or file, a function, a loop or a catch clause. */\n private static declarationIn(opts: {\n typescript: typeof import('typescript');\n scope: import('typescript').Node;\n name: string;\n }): import('typescript').Node | undefined {\n const { typescript: ts, scope, name } = opts;\n\n const bindingNames = (node: import('typescript').BindingName): string[] => {\n if (ts.isIdentifier(node)) {\n return [node.text];\n }\n\n return node.elements.flatMap((element) =>\n ts.isBindingElement(element) ? bindingNames(element.name) : [],\n );\n };\n\n const inDeclarations = (\n declarations: ReadonlyArray<import('typescript').VariableDeclaration>,\n ): import('typescript').Node | undefined =>\n declarations.find((declaration) => bindingNames(declaration.name).includes(name));\n\n if (\n ts.isSourceFile(scope) ||\n ts.isBlock(scope) ||\n ts.isModuleBlock(scope) ||\n ts.isCaseClause(scope) ||\n ts.isDefaultClause(scope)\n ) {\n for (const statement of scope.statements) {\n if (ts.isVariableStatement(statement)) {\n const found = inDeclarations(statement.declarationList.declarations);\n\n if (found !== undefined) {\n return found;\n }\n } else if (\n (ts.isFunctionDeclaration(statement) ||\n ts.isClassDeclaration(statement) ||\n ts.isEnumDeclaration(statement)) &&\n statement.name?.text === name\n ) {\n return statement;\n } else if (ts.isImportDeclaration(statement) && statement.importClause !== undefined) {\n const clause = statement.importClause;\n\n if (clause.name?.text === name) {\n return clause;\n }\n\n const bindings = clause.namedBindings;\n\n if (\n bindings !== undefined &&\n ts.isNamespaceImport(bindings) &&\n bindings.name.text === name\n ) {\n return bindings;\n }\n\n if (bindings !== undefined && ts.isNamedImports(bindings)) {\n const element = bindings.elements.find((candidate) => candidate.name.text === name);\n\n if (element !== undefined) {\n return element;\n }\n }\n }\n }\n\n return undefined;\n }\n\n if (ts.isFunctionLike(scope)) {\n const parameter = scope.parameters.find((candidate) =>\n bindingNames(candidate.name).includes(name),\n );\n\n if (parameter !== undefined) {\n return parameter;\n }\n\n return ts.isFunctionExpression(scope) && scope.name?.text === name ? scope : undefined;\n }\n\n if (\n (ts.isForStatement(scope) || ts.isForOfStatement(scope) || ts.isForInStatement(scope)) &&\n scope.initializer !== undefined &&\n ts.isVariableDeclarationList(scope.initializer)\n ) {\n return inDeclarations(scope.initializer.declarations);\n }\n\n if (ts.isCatchClause(scope) && scope.variableDeclaration !== undefined) {\n return inDeclarations([scope.variableDeclaration]);\n }\n\n return undefined;\n }\n\n /**\n * Whether `identifier` refers to the environment store: the binding the name resolves to, from the\n * innermost scope outwards, is an import of `applicationEnvironment` or `AppEnvs` from the store module\n * (aliased or not), or a `const` that is initialised from such a name. A parameter, a local, an import\n * from anywhere else and a name nothing declares are not the store.\n */\n static isStore(opts: {\n typescript: typeof import('typescript');\n identifier: import('typescript').Identifier;\n }): boolean {\n return EnvGet.storeImport(opts) !== undefined;\n }\n\n /** The import specifier of the store that `identifier` resolves to (through const aliases), or `undefined` when it is not the store. */\n static storeImport(opts: {\n typescript: typeof import('typescript');\n identifier: import('typescript').Identifier;\n seen?: Set<import('typescript').Node>;\n }): import('typescript').ImportSpecifier | undefined {\n const { typescript: ts, identifier } = opts;\n const seen = opts.seen ?? new Set<import('typescript').Node>();\n\n if (seen.has(identifier)) {\n return undefined;\n }\n\n seen.add(identifier);\n\n for (\n let scope: import('typescript').Node | undefined = identifier.parent;\n scope !== undefined;\n scope = scope.parent\n ) {\n const declaration = EnvGet.declarationIn({ typescript: ts, scope, name: identifier.text });\n\n if (declaration === undefined) {\n continue;\n }\n\n if (ts.isImportSpecifier(declaration)) {\n const importDeclaration = declaration.parent.parent.parent;\n\n return ts.isStringLiteral(importDeclaration.moduleSpecifier) &&\n STORE_MODULE.test(importDeclaration.moduleSpecifier.text) &&\n RECEIVERS.has((declaration.propertyName ?? declaration.name).text)\n ? declaration\n : undefined;\n }\n\n if (\n ts.isVariableDeclaration(declaration) &&\n (ts.getCombinedNodeFlags(declaration) & ts.NodeFlags.Const) !== 0 &&\n ts.isIdentifier(declaration.name) &&\n declaration.initializer !== undefined &&\n ts.isIdentifier(declaration.initializer)\n ) {\n return EnvGet.storeImport({ typescript: ts, identifier: declaration.initializer, seen });\n }\n\n return undefined;\n }\n\n return undefined;\n }\n\n static rewrite(opts: {\n typescript: typeof import('typescript');\n fileName: string;\n source: string;\n /** `--numbers`: rewrite `get<number>(key)` and `get<number>(key, { defaultValue })` to a `ParseUtility.toNumber` transform. */\n numbers?: boolean;\n }): IEnvGetResult {\n const { typescript: ts, fileName, source, numbers = false } = opts;\n const language = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, language);\n const edits: Array<{ start: number; end: number; text: string }> = [];\n const manual: Array<{ line: number; type: string; reason?: string }> = [];\n const skipped: Array<{ line: number; receiver: string }> = [];\n const numbered: number[] = [];\n let rewrittenCalls = 0;\n let isParseUtilityImported = false;\n const lineOf = (node: import('typescript').Node): number =>\n file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1;\n\n /** `string`, or `string | undefined` (the type `get(key)` already answers): the type argument can go. */\n const isStringType = (node: import('typescript').TypeNode): boolean => {\n if (node.kind === ts.SyntaxKind.StringKeyword) {\n return true;\n }\n\n if (ts.isParenthesizedTypeNode(node)) {\n return isStringType(node.type);\n }\n\n if (ts.isUnionTypeNode(node) && node.types.length === 2) {\n const parts = node.types.map((part) => part.kind);\n\n return (\n parts.includes(ts.SyntaxKind.StringKeyword) &&\n parts.includes(ts.SyntaxKind.UndefinedKeyword)\n );\n }\n\n return false;\n };\n\n /** An options literal that already carries a `transform`: the call is in the new form. */\n const hasTransform = (node: import('typescript').Expression | undefined): boolean =>\n node !== undefined &&\n ts.isObjectLiteralExpression(node) &&\n node.properties.some(\n (property) =>\n property.name !== undefined &&\n ts.isIdentifier(property.name) &&\n property.name.text === 'transform',\n );\n\n /** `number`, or `number | undefined`: the types `--numbers` rewrites. */\n const isNumberType = (node: import('typescript').TypeNode): boolean => {\n if (node.kind === ts.SyntaxKind.NumberKeyword) {\n return true;\n }\n\n if (ts.isParenthesizedTypeNode(node)) {\n return isNumberType(node.type);\n }\n\n if (ts.isUnionTypeNode(node) && node.types.length === 2) {\n const parts = node.types.map((part) => part.kind);\n\n return (\n parts.includes(ts.SyntaxKind.NumberKeyword) &&\n parts.includes(ts.SyntaxKind.UndefinedKeyword)\n );\n }\n\n return false;\n };\n\n /** A literal that is not a number: a `defaultValue` of this kind matches no overload of the rewritten call. */\n const isNonNumericLiteral = (node: import('typescript').Expression): boolean =>\n ts.isStringLiteral(node) ||\n ts.isNoSubstitutionTemplateLiteral(node) ||\n ts.isTemplateExpression(node) ||\n ts.isRegularExpressionLiteral(node) ||\n ts.isArrayLiteralExpression(node) ||\n ts.isObjectLiteralExpression(node) ||\n node.kind === ts.SyntaxKind.TrueKeyword ||\n node.kind === ts.SyntaxKind.FalseKeyword ||\n node.kind === ts.SyntaxKind.NullKeyword;\n\n /** An options literal whose `defaultValue` is a literal that is not a number (`{ defaultValue: '10' }`). */\n const hasNonNumericDefault = (node: import('typescript').Expression | undefined): boolean =>\n node !== undefined &&\n ts.isObjectLiteralExpression(node) &&\n node.properties.some(\n (property) =>\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n property.name.text === 'defaultValue' &&\n isNonNumericLiteral(property.initializer),\n );\n\n /** The import specifier the file already has for `ParseUtility`: a value import from the store module, under any local name. */\n const findParseUtilityImport = (): import('typescript').ImportSpecifier | undefined => {\n for (const statement of file.statements) {\n if (\n ts.isImportDeclaration(statement) &&\n ts.isStringLiteral(statement.moduleSpecifier) &&\n STORE_MODULE.test(statement.moduleSpecifier.text) &&\n statement.importClause?.namedBindings !== undefined &&\n ts.isNamedImports(statement.importClause.namedBindings)\n ) {\n const element = statement.importClause.namedBindings.elements.find(\n (candidate) =>\n (candidate.propertyName ?? candidate.name).text === 'ParseUtility' &&\n !candidate.isTypeOnly &&\n !statement.importClause?.isTypeOnly,\n );\n\n if (element !== undefined) {\n return element;\n }\n }\n }\n\n return undefined;\n };\n\n /**\n * The local name `call` can use for `ParseUtility`, or the reason it cannot. The name resolves from the\n * scope of the call, the way the store receiver does: the file's own import of `ParseUtility` from the store\n * module (under any local name) when it is the binding the call sees, a new `ParseUtility` import when\n * nothing in the file or in a scope around the call declares that name. Another module's `ParseUtility`, a\n * type-only import of it, a local declaration of it and a parameter that shadows it all leave the call manual,\n * because the rewrite would not compile (TS2300, TS2339).\n */\n const resolveParseUtility = (\n call: import('typescript').CallExpression,\n ): { name: string } | { reason: string } => {\n const existing = findParseUtilityImport();\n const name = existing?.name.text ?? 'ParseUtility';\n let found: import('typescript').Node | undefined;\n let isFileLevel = false;\n\n for (\n let scope: import('typescript').Node | undefined = call.parent;\n scope !== undefined && found === undefined;\n scope = scope.parent\n ) {\n found = EnvGet.declarationIn({ typescript: ts, scope, name });\n isFileLevel = ts.isSourceFile(scope);\n }\n\n if (found === existing) {\n return { name };\n }\n\n return {\n reason: isFileLevel\n ? `${name} is already declared in this file by something other than a value import from @venizia/ignis-helpers (an import from another module, a type-only import or a local declaration): the rewrite would not compile, so import ParseUtility from @venizia/ignis-helpers under a free name and write the transform by hand`\n : `a parameter or local declaration named ${name} hides the ParseUtility import at this call: the rewrite would not compile, so write the transform by hand or rename the local`,\n };\n };\n\n /** Adds `ParseUtility` to the import of the store, once per file: on its own line inside a multi-line import, after the last name in a one-line one, in a new import beside a type-only one. */\n const addParseUtilityImport = (storeImport: import('typescript').ImportSpecifier): void => {\n if (isParseUtilityImported || findParseUtilityImport() !== undefined) {\n return;\n }\n\n isParseUtilityImported = true;\n\n const declaration = storeImport.parent.parent.parent;\n const named = storeImport.parent;\n\n if (declaration.importClause?.isTypeOnly) {\n edits.push({\n start: declaration.getEnd(),\n end: declaration.getEnd(),\n text: `\\nimport { ParseUtility } from ${declaration.moduleSpecifier.getText(file)};`,\n });\n\n return;\n }\n\n const last = named.elements[named.elements.length - 1];\n const lastLine = file.getLineAndCharacterOfPosition(last.getStart(file)).line;\n const isMultiLine = file.getLineAndCharacterOfPosition(named.getStart(file)).line < lastLine;\n\n if (!isMultiLine) {\n edits.push({ start: last.getEnd(), end: last.getEnd(), text: ', ParseUtility' });\n\n return;\n }\n\n const lineStart = file.getLineStarts()[lastLine];\n const indent = source.slice(lineStart, last.getStart(file)).match(/^\\s*/)?.[0] ?? '';\n const lineBreak = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n\n edits.push({\n start: last.getEnd(),\n end: last.getEnd(),\n text: `,${lineBreak}${indent}ParseUtility`,\n });\n };\n\n /** Puts `transform` first in the options literal, keeping its layout: `{}` becomes `{ transform }`, a multi-line literal gets the property on its own line. */\n const insertTransform = (\n options: import('typescript').ObjectLiteralExpression,\n transform: string,\n ): void => {\n const open = options.getStart(file) + 1;\n const [first] = options.properties;\n\n if (first === undefined) {\n const inner = source.slice(open, options.getEnd() - 1);\n\n edits.push(\n inner.trim() === ''\n ? { start: open, end: options.getEnd() - 1, text: ` ${transform} ` }\n : { start: open, end: open, text: ` ${transform}` },\n );\n\n return;\n }\n\n const between = source.slice(open, first.getStart(file));\n\n if (between.includes('\\n')) {\n const firstLineStart =\n file.getLineStarts()[file.getLineAndCharacterOfPosition(first.getStart(file)).line];\n const indent = source.slice(firstLineStart, first.getStart(file)).match(/^\\s*/)?.[0] ?? '';\n const lineBreak = between.includes('\\r\\n') ? '\\r\\n' : '\\n';\n\n edits.push({ start: open, end: open, text: `${lineBreak}${indent}${transform},` });\n\n return;\n }\n\n edits.push({\n start: open,\n end: open,\n text: ` ${transform},${/^\\s/.test(between) ? '' : ' '}`,\n });\n };\n\n const visit = (node: import('typescript').Node): void => {\n if (\n ts.isCallExpression(node) &&\n node.typeArguments !== undefined &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'get'\n ) {\n const callee = node.expression;\n const isOptional =\n node.questionDotToken !== undefined || callee.questionDotToken !== undefined;\n\n const storeImport =\n !isOptional && ts.isIdentifier(callee.expression)\n ? EnvGet.storeImport({ typescript: ts, identifier: callee.expression })\n : undefined;\n\n if (storeImport !== undefined) {\n const [first] = node.typeArguments;\n const start = callee.name.getEnd();\n const end = node.arguments.pos - 1;\n const options = node.arguments[1];\n const isTwo = node.typeArguments.length === 2;\n const isPlainLiteral =\n options !== undefined &&\n ts.isObjectLiteralExpression(options) &&\n !hasTransform(options);\n // `get<number>(key)`, `get<number>(key, { defaultValue })` and `get<number, B>(key, { defaultValue })` are one read.\n const isNumberRead =\n numbers &&\n isNumberType(first) &&\n ((!isTwo &&\n !hasTransform(options) &&\n (options === undefined || ts.isObjectLiteralExpression(options))) ||\n (isTwo && isPlainLiteral));\n // `--numbers`: a number read (one type argument or two) with options the codemod cannot read. It cannot see\n // whether they hold a transform, so the call is listed, not left silently.\n const isNumberReadWithVariableOptions =\n numbers &&\n isNumberType(first) &&\n options !== undefined &&\n !ts.isObjectLiteralExpression(options);\n\n if (isNumberReadWithVariableOptions) {\n manual.push({\n line: lineOf(node),\n type: first.getText(file),\n reason:\n 'the options are not an object literal, so the codemod cannot see whether they hold a transform: put the number transform in them by hand, for example { ...options, transform: (raw) => ParseUtility.toNumber({ input: raw }) }',\n });\n } else if (isNumberRead) {\n const parseUtility = resolveParseUtility(node);\n\n if ('reason' in parseUtility) {\n manual.push({\n line: lineOf(node),\n type: first.getText(file),\n reason: parseUtility.reason,\n });\n } else if (hasNonNumericDefault(options)) {\n manual.push({\n line: lineOf(node),\n type: first.getText(file),\n reason:\n 'the defaultValue is a literal that is not a number: the rewritten call matches no overload (and would return that value as it is), so give it a number or convert it where you use it',\n });\n } else {\n addParseUtilityImport(storeImport);\n\n const transform = `transform: (raw) => ${parseUtility.name}.toNumber({ input: raw })`;\n\n edits.push({ start, end, text: '' });\n\n if (options !== undefined && ts.isObjectLiteralExpression(options)) {\n insertTransform(options, transform);\n } else {\n const insertAt = node.arguments[0].getEnd();\n\n edits.push({ start: insertAt, end: insertAt, text: `, { ${transform} }` });\n }\n\n numbered.push(lineOf(node));\n rewrittenCalls += 1;\n }\n } else if (isTwo && options !== undefined && !ts.isObjectLiteralExpression(options)) {\n // `get<R, B>(key, options)` with options in a variable: the codemod cannot see whether they hold a\n // transform or a default of the right type, and `get<R>(key, options)` may not compile with them.\n manual.push({\n line: lineOf(node),\n type: first.getText(file),\n reason:\n 'two type arguments and options that are not an object literal, so the codemod cannot see what they hold: drop the second type argument by hand once the options carry a transform',\n });\n } else if (isTwo && hasTransform(options)) {\n // `get<R, B>(key, { transform })` keeps R, even when R is `string`: a second run leaves\n // `get<string>(key, { transform })` alone.\n edits.push({ start, end, text: `<${first.getText(file)}>` });\n rewrittenCalls += 1;\n } else if (\n !isTwo &&\n options !== undefined &&\n (hasTransform(options) || !ts.isObjectLiteralExpression(options))\n ) {\n // One type argument and a transform: the new form. One type argument and options that are not a\n // literal (a variable): the codemod cannot see what they hold, and what it just left in\n // `get<R, B>(key, options)` would otherwise be listed on the next run; the typecheck names a bad one.\n // Nothing to do and nothing to list.\n } else if (isStringType(first) && (!isTwo || isPlainLiteral)) {\n // `string` is what get() returns without a transform, so the type arguments carry nothing: a literal\n // without a transform reads the same with one type argument or two.\n edits.push({ start, end, text: '' });\n rewrittenCalls += 1;\n } else {\n manual.push({ line: lineOf(node), type: first.getText(file) });\n }\n } else if (node.arguments.length > 0 && !ts.isObjectLiteralExpression(node.arguments[0])) {\n // Every other `x.get<T>(key)` is listed, never hidden: a name the file does not bind to the store, a\n // property, a parameter or an optional chain. A container lookup shares the shape (its first\n // argument is an object literal, so it is not listed).\n skipped.push({ line: lineOf(node), receiver: callee.expression.getText(file) });\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(file);\n\n if (edits.length === 0) {\n return { output: source, changed: false, rewritten: 0, manual, numbered, skipped };\n }\n\n let output = source;\n\n for (const edit of [...edits].sort((left, right) => right.start - left.start)) {\n output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);\n }\n\n return {\n output,\n changed: output !== source,\n rewritten: rewrittenCalls,\n manual,\n numbered,\n skipped,\n };\n }\n}\n\n/** `devz codemod env-get [paths...] [--write | --check]`: rewrites the type arguments of `applicationEnvironment.get()`. */\nexport class EnvGetCommand {\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(EnvGetFlags.HELP) || args.includes(EnvGetFlags.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) => !EnvGetFlags.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(EnvGetFlags.WRITE);\n const isCheck = flags.includes(EnvGetFlags.CHECK);\n const isNumbers = flags.includes(EnvGetFlags.NUMBERS);\n\n if (isWrite && isCheck) {\n console.error(\n `devz codemod: ${EnvGetFlags.WRITE} and ${EnvGetFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'env-get',\n isWrite,\n isAll: flags.includes(EnvGetFlags.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 callCount = 0;\n let manualCount = 0;\n let skippedCount = 0;\n let numberedCount = 0;\n const manualByType = new Map<string, number>();\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 (!/\\.\\s*get\\b/.test(source)) {\n continue;\n }\n\n const result = EnvGet.rewrite({\n typescript,\n fileName: file,\n source,\n numbers: isNumbers,\n });\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n for (const item of result.manual) {\n manualCount += 1;\n manualByType.set(item.type, (manualByType.get(item.type) ?? 0) + 1);\n console.warn(\n `manual ${shown}:${item.line} get<${item.type}>: ${\n item.reason ??\n 'a type argument the rewrite cannot place (not string or string | undefined, or two type arguments without an options argument): a number or other conversion goes in a transform, for example get(key, { transform: Number })'\n }`,\n );\n }\n\n for (const line of result.numbered) {\n numberedCount += 1;\n console.log(\n `numbers ${shown}:${line} get<number> rewritten to a transform: the value is now a real number and a non-numeric value throws at the read`,\n );\n }\n\n for (const call of result.skipped) {\n skippedCount += 1;\n console.warn(\n `skipped ${shown}:${call.line} ${call.receiver}.get<...>(): the receiver is not bound to applicationEnvironment or AppEnvs in this file (a property, a parameter, an optional chain or another object): check it by hand if it is the environment store`,\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 callCount += result.rewritten;\n console.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} call(s))`,\n );\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n }\n\n console.log(\n `devz codemod env-get: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${callCount} call(s) ${isWrite ? 'rewritten' : 'would be rewritten'}, ${manualCount} manual, ${skippedCount} skipped` +\n (isNumbers ? `, ${numberedCount} number read(s) rewritten` : '') +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (manualByType.size > 0) {\n const counts = [...manualByType.entries()]\n .sort((left, right) => right[1] - left[1])\n .map(([typeText, count]) => `${typeText} x${count}`)\n .join(', ');\n\n console.log(`manual by type argument: ${counts}`);\n }\n\n if (!isWrite && changedCount > 0) {\n console.log(\n `Nothing was written. Run again with ${EnvGetFlags.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 || manualCount > 0) ? 1 : 0;\n }\n}\n"]}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CodemodCommand = void 0;
4
+ const any_aliases_1 = require("./any-aliases");
4
5
  const async_style_1 = require("./async-style");
5
6
  const connector_imports_1 = require("./connector-imports");
6
7
  const const_classes_1 = require("./const-classes");
8
+ const env_get_1 = require("./env-get");
7
9
  const drop_redundant_casts_1 = require("./drop-redundant-casts");
8
10
  const namespace_functions_1 = require("./namespace-functions");
9
11
  const USAGE = [
@@ -12,6 +14,8 @@ const USAGE = [
12
14
  async_style_1.AsyncStyleCommand.USAGE,
13
15
  namespace_functions_1.NamespaceFunctionsCommand.USAGE,
14
16
  connector_imports_1.ConnectorImportsCommand.USAGE,
17
+ env_get_1.EnvGetCommand.USAGE,
18
+ any_aliases_1.AnyAliasesCommand.USAGE,
15
19
  ].join('\n\n');
16
20
  /** The codemods `devz codemod <name>` runs. */
17
21
  const NAME_LIST = [
@@ -20,12 +24,20 @@ const NAME_LIST = [
20
24
  'async-style',
21
25
  'namespace-functions',
22
26
  'connector-imports',
27
+ 'env-get',
28
+ 'any-aliases',
23
29
  ];
24
30
  const NAMES = NAME_LIST.join(', ');
25
31
  /** A usage error: nothing was read or written. */
26
32
  const USAGE_ERROR_CODE = 2;
27
33
  /** The codemods that are style rewrites, not migrations: there is no downgrade of them. */
28
- const NOT_REVERSIBLE = new Set(['drop-redundant-casts', 'const-classes', 'async-style']);
34
+ const NOT_REVERSIBLE = new Set([
35
+ 'drop-redundant-casts',
36
+ 'const-classes',
37
+ 'async-style',
38
+ 'env-get',
39
+ 'any-aliases',
40
+ ]);
29
41
  /** `devz codemod <name> [args]`: hands the arguments to the codemod called `name`. */
30
42
  class CodemodCommand {
31
43
  static async run(opts) {
@@ -54,6 +66,12 @@ class CodemodCommand {
54
66
  if (name === 'connector-imports') {
55
67
  return connector_imports_1.ConnectorImportsCommand.run({ root: opts.root, args: rest });
56
68
  }
69
+ if (name === 'env-get') {
70
+ return env_get_1.EnvGetCommand.run({ root: opts.root, args: rest });
71
+ }
72
+ if (name === 'any-aliases') {
73
+ return any_aliases_1.AnyAliasesCommand.run({ root: opts.root, args: rest });
74
+ }
57
75
  if (args.includes('--help') || args.includes('-h')) {
58
76
  console.log(USAGE);
59
77
  return 0;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/codemod/index.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,2DAA8D;AAC9D,mDAAsD;AACtD,iEAAmE;AACnE,+DAAkE;AAElE,MAAM,KAAK,GAAG;IACZ,gDAAyB,CAAC,KAAK;IAC/B,mCAAmB,CAAC,KAAK;IACzB,+BAAiB,CAAC,KAAK;IACvB,+CAAyB,CAAC,KAAK;IAC/B,2CAAuB,CAAC,KAAK;CAC9B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEf,+CAA+C;AAC/C,MAAM,SAAS,GAAG;IAChB,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,qBAAqB;IACrB,mBAAmB;CACpB,CAAC;AACF,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEnC,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,2FAA2F;AAC3F,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,sBAAsB,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC;AAEzF,sFAAsF;AACtF,MAAa,cAAc;IACzB,MAAM,CAAC,KAAK,CAAC,GA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AAmB,EAAE,CAAC;YACjC,OAAO,2CAAuB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAEnB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,CAAC,KAAK,CACX,kCAAkC,IAAI,IAAI,EAAE,yBAAyB,KAAK,OAAO,KAAK,EAAE,CACzF,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAjDD,wCAiDC","sourcesContent":["import { AsyncStyleCommand } from './async-style';\nimport { ConnectorImportsCommand } from './connector-imports';\nimport { ConstClassesCommand } from './const-classes';\nimport { DropRedundantCastsCommand } from './drop-redundant-casts';\nimport { NamespaceFunctionsCommand } from './namespace-functions';\n\nconst USAGE = [\n DropRedundantCastsCommand.USAGE,\n ConstClassesCommand.USAGE,\n AsyncStyleCommand.USAGE,\n NamespaceFunctionsCommand.USAGE,\n ConnectorImportsCommand.USAGE,\n].join('\\n\\n');\n\n/** The codemods `devz codemod <name>` runs. */\nconst NAME_LIST = [\n 'drop-redundant-casts',\n 'const-classes',\n 'async-style',\n 'namespace-functions',\n 'connector-imports',\n];\nconst NAMES = NAME_LIST.join(', ');\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\n/** The codemods that are style rewrites, not migrations: there is no downgrade of them. */\nconst NOT_REVERSIBLE = new Set(['drop-redundant-casts', 'const-classes', 'async-style']);\n\n/** `devz codemod <name> [args]`: hands the arguments to the codemod called `name`. */\nexport class CodemodCommand {\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { args } = opts;\n const [name, ...rest] = args;\n\n if (name === '--list') {\n console.log(NAME_LIST.join('\\n'));\n\n return 0;\n }\n\n if (name !== undefined && NOT_REVERSIBLE.has(name) && rest.includes('--reverse')) {\n console.error(`devz codemod ${name}: not reversible`);\n\n return USAGE_ERROR_CODE;\n }\n\n if (name === 'drop-redundant-casts') {\n return DropRedundantCastsCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'const-classes') {\n return ConstClassesCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'async-style') {\n return AsyncStyleCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'namespace-functions') {\n return NamespaceFunctionsCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'connector-imports') {\n return ConnectorImportsCommand.run({ root: opts.root, args: rest });\n }\n\n if (args.includes('--help') || args.includes('-h')) {\n console.log(USAGE);\n\n return 0;\n }\n\n console.error(\n `devz codemod: unknown codemod \"${name ?? ''}\" | the codemods are: ${NAMES}\\n\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/codemod/index.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,+CAAkD;AAClD,2DAA8D;AAC9D,mDAAsD;AACtD,uCAA0C;AAC1C,iEAAmE;AACnE,+DAAkE;AAElE,MAAM,KAAK,GAAG;IACZ,gDAAyB,CAAC,KAAK;IAC/B,mCAAmB,CAAC,KAAK;IACzB,+BAAiB,CAAC,KAAK;IACvB,+CAAyB,CAAC,KAAK;IAC/B,2CAAuB,CAAC,KAAK;IAC7B,uBAAa,CAAC,KAAK;IACnB,+BAAiB,CAAC,KAAK;CACxB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEf,+CAA+C;AAC/C,MAAM,SAAS,GAAG;IAChB,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,qBAAqB;IACrB,mBAAmB;IACnB,SAAS;IACT,aAAa;CACd,CAAC;AACF,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,C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I,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACnC,OAAO,+CAAyB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACjC,OAAO,2CAAuB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,uBAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YAC3B,OAAO,+BAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAEnB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,CAAC,KAAK,CACX,kCAAkC,IAAI,IAAI,EAAE,yBAAyB,KAAK,OAAO,KAAK,EAAE,CACzF,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAzDD,wCAyDC","sourcesContent":["import { AnyAliasesCommand } from './any-aliases';\nimport { AsyncStyleCommand } from './async-style';\nimport { ConnectorImportsCommand } from './connector-imports';\nimport { ConstClassesCommand } from './const-classes';\nimport { EnvGetCommand } from './env-get';\nimport { DropRedundantCastsCommand } from './drop-redundant-casts';\nimport { NamespaceFunctionsCommand } from './namespace-functions';\n\nconst USAGE = [\n DropRedundantCastsCommand.USAGE,\n ConstClassesCommand.USAGE,\n AsyncStyleCommand.USAGE,\n NamespaceFunctionsCommand.USAGE,\n ConnectorImportsCommand.USAGE,\n EnvGetCommand.USAGE,\n AnyAliasesCommand.USAGE,\n].join('\\n\\n');\n\n/** The codemods `devz codemod <name>` runs. */\nconst NAME_LIST = [\n 'drop-redundant-casts',\n 'const-classes',\n 'async-style',\n 'namespace-functions',\n 'connector-imports',\n 'env-get',\n 'any-aliases',\n];\nconst NAMES = NAME_LIST.join(', ');\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\n/** The codemods that are style rewrites, not migrations: there is no downgrade of them. */\nconst NOT_REVERSIBLE = new Set([\n 'drop-redundant-casts',\n 'const-classes',\n 'async-style',\n 'env-get',\n 'any-aliases',\n]);\n\n/** `devz codemod <name> [args]`: hands the arguments to the codemod called `name`. */\nexport class CodemodCommand {\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n const { args } = opts;\n const [name, ...rest] = args;\n\n if (name === '--list') {\n console.log(NAME_LIST.join('\\n'));\n\n return 0;\n }\n\n if (name !== undefined && NOT_REVERSIBLE.has(name) && rest.includes('--reverse')) {\n console.error(`devz codemod ${name}: not reversible`);\n\n return USAGE_ERROR_CODE;\n }\n\n if (name === 'drop-redundant-casts') {\n return DropRedundantCastsCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'const-classes') {\n return ConstClassesCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'async-style') {\n return AsyncStyleCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'namespace-functions') {\n return NamespaceFunctionsCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'connector-imports') {\n return ConnectorImportsCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'env-get') {\n return EnvGetCommand.run({ root: opts.root, args: rest });\n }\n\n if (name === 'any-aliases') {\n return AnyAliasesCommand.run({ root: opts.root, args: rest });\n }\n\n if (args.includes('--help') || args.includes('-h')) {\n console.log(USAGE);\n\n return 0;\n }\n\n console.error(\n `devz codemod: unknown codemod \"${name ?? ''}\" | the codemods are: ${NAMES}\\n\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n}\n"]}
package/dist/cli/index.js CHANGED
@@ -17,6 +17,8 @@ Commands:
17
17
  codemod async-style [paths...] apply the async-style lint fixers and list the rest (dry run unless --write)
18
18
  codemod namespace-functions [paths...] move calls of a function that moved into a class to the class form (dry run unless --write)
19
19
  codemod connector-imports [paths...] move @venizia/ignis/<connector sub-path> imports to @venizia/ignis-connectors (dry run unless --write)
20
+ codemod env-get [paths...] strip the type arguments of applicationEnvironment.get() for the string-reading get() (dry run unless --write)
21
+ codemod any-aliases [paths...] replace the removed AnyType and AnyObject aliases by what they stood for, any (--strict: unknown and Record<string, unknown>; dry run unless --write)
20
22
 
21
23
  Run \`devz clean --help\` or \`devz codemod --help\` for a command's options.`;
22
24
  const main = async (opts) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AACA,mCAAuC;AACvC,mCAAuC;AACvC,uCAA2C;AAC3C,iCAAqC;AAErC,MAAM,KAAK,GAAG;;;;;;;;;;;;;8EAagE,CAAC;AAE/E,MAAM,IAAI,GAAG,KAAK,EAAE,IAAwB,EAAmB,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IAErC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,kBAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,oBAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,oBAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,wBAAc,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,0BAA0B,OAAO,IAAI,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC;IAEpE,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CACxC,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpC,CAAC,KAAc,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport { CheckCommand } from './check';\nimport { CleanCommand } from './clean';\nimport { CodemodCommand } from './codemod';\nimport { LintCommand } from './lint';\n\nconst USAGE = `Usage: devz <command> [options]\n\nCommands:\n lint [--fix] [files] oxlint, ESLint and the formatter; --fix writes\n check purity --claims <file> [package] [--json] probe every entry claimed browser-pure (needs a build)\n check module-cycles | split-report | catalog shared repository gates; devz check --help lists their options\n clean remove dist, node_modules/.cache and *.tsbuildinfo\n codemod drop-redundant-casts [paths...] remove \\`as X\\` casts the compiler no longer needs (dry run unless --write)\n codemod const-classes [paths...] turn a string-literal union into a const class (dry run unless --write)\n codemod async-style [paths...] apply the async-style lint fixers and list the rest (dry run unless --write)\n codemod namespace-functions [paths...] move calls of a function that moved into a class to the class form (dry run unless --write)\n codemod connector-imports [paths...] move @venizia/ignis/<connector sub-path> imports to @venizia/ignis-connectors (dry run unless --write)\n\nRun \\`devz clean --help\\` or \\`devz codemod --help\\` for a command's options.`;\n\nconst main = async (opts: { argv: string[] }): Promise<number> => {\n const [command, ...args] = opts.argv;\n\n if (command === undefined || command === '--help' || command === '-h') {\n console.log(USAGE);\n\n return 0;\n }\n\n if (command === 'lint') {\n return LintCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'check') {\n return CheckCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'clean') {\n return CleanCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'codemod') {\n return CodemodCommand.run({ root: process.cwd(), args });\n }\n\n console.error(`devz: unknown command \"${command ?? ''}\"\\n${USAGE}`);\n\n return 1;\n};\n\nmain({ argv: process.argv.slice(2) }).then(\n (exitCode) => process.exit(exitCode),\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AACA,mCAAuC;AACvC,mCAAuC;AACvC,uCAA2C;AAC3C,iCAAqC;AAErC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;8EAegE,CAAC;AAE/E,MAAM,IAAI,GAAG,KAAK,EAAE,IAAwB,EAAmB,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,I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,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport { CheckCommand } from './check';\nimport { CleanCommand } from './clean';\nimport { CodemodCommand } from './codemod';\nimport { LintCommand } from './lint';\n\nconst USAGE = `Usage: devz <command> [options]\n\nCommands:\n lint [--fix] [files] oxlint, ESLint and the formatter; --fix writes\n check purity --claims <file> [package] [--json] probe every entry claimed browser-pure (needs a build)\n check module-cycles | split-report | catalog shared repository gates; devz check --help lists their options\n clean remove dist, node_modules/.cache and *.tsbuildinfo\n codemod drop-redundant-casts [paths...] remove \\`as X\\` casts the compiler no longer needs (dry run unless --write)\n codemod const-classes [paths...] turn a string-literal union into a const class (dry run unless --write)\n codemod async-style [paths...] apply the async-style lint fixers and list the rest (dry run unless --write)\n codemod namespace-functions [paths...] move calls of a function that moved into a class to the class form (dry run unless --write)\n codemod connector-imports [paths...] move @venizia/ignis/<connector sub-path> imports to @venizia/ignis-connectors (dry run unless --write)\n codemod env-get [paths...] strip the type arguments of applicationEnvironment.get() for the string-reading get() (dry run unless --write)\n codemod any-aliases [paths...] replace the removed AnyType and AnyObject aliases by what they stood for, any (--strict: unknown and Record<string, unknown>; dry run unless --write)\n\nRun \\`devz clean --help\\` or \\`devz codemod --help\\` for a command's options.`;\n\nconst main = async (opts: { argv: string[] }): Promise<number> => {\n const [command, ...args] = opts.argv;\n\n if (command === undefined || command === '--help' || command === '-h') {\n console.log(USAGE);\n\n return 0;\n }\n\n if (command === 'lint') {\n return LintCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'check') {\n return CheckCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'clean') {\n return CleanCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'codemod') {\n return CodemodCommand.run({ root: process.cwd(), args });\n }\n\n console.error(`devz: unknown command \"${command ?? ''}\"\\n${USAGE}`);\n\n return 1;\n};\n\nmain({ argv: process.argv.slice(2) }).then(\n (exitCode) => process.exit(exitCode),\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n);\n"]}
@@ -36,16 +36,23 @@ class RepoTmp {
36
36
  * `env` a caller passes wins. `spawn(cmd, options)` and `spawn({ cmd, ...options })` are both handled.
37
37
  */
38
38
  static withCurrentEnv(spawn) {
39
- return (...args) => {
40
- const [first, second] = args;
41
- const options = Array.isArray(first) ? second : first;
42
- if (options?.env !== undefined) {
43
- return spawn(...args);
44
- }
45
- return Array.isArray(first)
46
- ? spawn(first, { ...second, env: process.env })
47
- : spawn({ ...first, env: process.env });
48
- };
39
+ const withEnv = (base) => ({
40
+ ...(typeof base === 'object' && base !== null ? base : {}),
41
+ env: process.env,
42
+ });
43
+ return new Proxy(spawn, {
44
+ apply: (target, thisArg, args) => {
45
+ const [first, second] = args;
46
+ const options = Array.isArray(first) ? second : first;
47
+ if (typeof options === 'object' &&
48
+ options !== null &&
49
+ 'env' in options &&
50
+ options.env !== undefined) {
51
+ return Reflect.apply(target, thisArg, args);
52
+ }
53
+ return Reflect.apply(target, thisArg, Array.isArray(first) ? [first, withEnv(second)] : [withEnv(first)]);
54
+ },
55
+ });
49
56
  }
50
57
  /**
51
58
  * Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a
@@ -1 +1 @@
1
- {"version":3,"file":"repo-tmp.js","sourceRoot":"","sources":["../../src/testing/repo-tmp.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,qCAAgD;AAChD,yCAAwD;AAExD,iFAAiF;AACpE,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAI3E,qJAAqJ;AACrJ,MAAa,OAAO;IAClB,+GAA+G;IAC/G,MAAM,CAAC,QAAQ,CAAC,OAA2B,EAAE;QAC3C,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACvC,IAAI,OAAO,GAAG,IAAA,mBA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IAAA,gBAAI,EAAC,IAAI,EAAE,0BAAkB,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAEnC,IAAI,OAAO,KAAK,SAAS,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,eAAG,EAAE,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,eAAG,EAAE,CAAC,EAAE,CAAC;YACxF,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAA,mBAAS,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,OAAO,CAAC;QAC9C,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,cAAc,CAChC,GAAG,CAAC,KAA0B,CACA,CAAC;QACjC,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,cAAc,CACpC,GAAG,CAAC,SAA8B,CACA,CAAC;QAErC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlED,0BAkEC","sourcesContent":["/**\n * Where a test makes its temp folders: `.agents/local/tmp/tests` of the repository, never the system\n * temp. `make test` sets TMPDIR to a folder like it; this does the same for a run without make - a\n * bare `bun test` on one file - and is the one place that knows the path.\n *\n * The empty `.git` marker in it stops git and bun's ignore lookup from reading the enclosing\n * repository, so GIT_CEILING_DIRECTORIES is set to the same folder.\n */\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\n\n/** The folder under the repository root that holds a test run's temp folders. */\nexport const REPO_TMP_DIRECTORY = join('.agents', 'local', 'tmp', 'tests');\n\ntype TSpawn = (...args: unknown[]) => unknown;\n\n/** Routes test temp folders into the repository: `apply` sets `TMPDIR` and `GIT_CEILING_DIRECTORIES` and makes `Bun.spawn` children inherit them. */\nexport class RepoTmp {\n /** The nearest ancestor of `start` that holds a `.git` (folder or file); `start` itself when there is none. */\n static findRoot(opts: { start?: string } = {}): string {\n const { start = process.cwd() } = opts;\n let current = resolve(start);\n\n for (;;) {\n if (existsSync(join(current, '.git'))) {\n return current;\n }\n\n const parent = dirname(current);\n\n if (parent === current) {\n return resolve(start);\n }\n\n current = parent;\n }\n }\n\n /**\n * `Bun.spawn` and `Bun.spawnSync` hand a child the environment the process started with, not the one\n * it has now, so a TMPDIR set here would never reach it. Wrapped to default to the current one; an\n * `env` a caller passes wins. `spawn(cmd, options)` and `spawn({ cmd, ...options })` are both handled.\n */\n private static withCurrentEnv(spawn: TSpawn): TSpawn {\n return (...args) => {\n const [first, second] = args;\n const options = Array.isArray(first) ? second : first;\n\n if ((options as { env?: unknown } | undefined)?.env !== undefined) {\n return spawn(...args);\n }\n\n return Array.isArray(first)\n ? spawn(first, { ...(second as object), env: process.env })\n : spawn({ ...(first as object), env: process.env });\n };\n }\n\n /**\n * Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a\n * private folder a caller made there), and returns the folder now in force. Idempotent.\n */\n static apply(opts: { root?: string } = {}): string {\n const root = opts.root ?? RepoTmp.findRoot();\n const testTmp = join(root, REPO_TMP_DIRECTORY);\n const current = process.env.TMPDIR;\n\n if (current !== undefined && `${resolve(current)}${sep}`.startsWith(`${testTmp}${sep}`)) {\n return current;\n }\n\n mkdirSync(join(testTmp, '.git'), { recursive: true });\n process.env.TMPDIR = testTmp;\n process.env.GIT_CEILING_DIRECTORIES = testTmp;\n Bun.spawn = RepoTmp.withCurrentEnv(\n Bun.spawn as unknown as TSpawn,\n ) as unknown as typeof Bun.spawn;\n Bun.spawnSync = RepoTmp.withCurrentEnv(\n Bun.spawnSync as unknown as TSpawn,\n ) as unknown as typeof Bun.spawnSync;\n\n return testTmp;\n }\n}\n"]}
1
+ {"version":3,"file":"repo-tmp.js","sourceRoot":"","sources":["../../src/testing/repo-tmp.ts"],"names":[],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AM,GAAG,OAAO,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,OAAO,CAAC;QAC9C,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9C,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEtD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA9ED,0BA8EC","sourcesContent":["/**\n * Where a test makes its temp folders: `.agents/local/tmp/tests` of the repository, never the system\n * temp. `make test` sets TMPDIR to a folder like it; this does the same for a run without make - a\n * bare `bun test` on one file - and is the one place that knows the path.\n *\n * The empty `.git` marker in it stops git and bun's ignore lookup from reading the enclosing\n * repository, so GIT_CEILING_DIRECTORIES is set to the same folder.\n */\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\n\n/** The folder under the repository root that holds a test run's temp folders. */\nexport const REPO_TMP_DIRECTORY = join('.agents', 'local', 'tmp', 'tests');\n\n/** Routes test temp folders into the repository: `apply` sets `TMPDIR` and `GIT_CEILING_DIRECTORIES` and makes `Bun.spawn` children inherit them. */\nexport class RepoTmp {\n /** The nearest ancestor of `start` that holds a `.git` (folder or file); `start` itself when there is none. */\n static findRoot(opts: { start?: string } = {}): string {\n const { start = process.cwd() } = opts;\n let current = resolve(start);\n\n for (;;) {\n if (existsSync(join(current, '.git'))) {\n return current;\n }\n\n const parent = dirname(current);\n\n if (parent === current) {\n return resolve(start);\n }\n\n current = parent;\n }\n }\n\n /**\n * `Bun.spawn` and `Bun.spawnSync` hand a child the environment the process started with, not the one\n * it has now, so a TMPDIR set here would never reach it. Wrapped to default to the current one; an\n * `env` a caller passes wins. `spawn(cmd, options)` and `spawn({ cmd, ...options })` are both handled.\n */\n private static withCurrentEnv<TSpawnFunction extends Function>(\n spawn: TSpawnFunction,\n ): TSpawnFunction {\n const withEnv = (base: unknown) => ({\n ...(typeof base === 'object' && base !== null ? base : {}),\n env: process.env,\n });\n\n return new Proxy(spawn, {\n apply: (target, thisArg, args: unknown[]) => {\n const [first, second] = args;\n const options = Array.isArray(first) ? second : first;\n\n if (\n typeof options === 'object' &&\n options !== null &&\n 'env' in options &&\n options.env !== undefined\n ) {\n return Reflect.apply(target, thisArg, args);\n }\n\n return Reflect.apply(\n target,\n thisArg,\n Array.isArray(first) ? [first, withEnv(second)] : [withEnv(first)],\n );\n },\n });\n }\n\n /**\n * Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a\n * private folder a caller made there), and returns the folder now in force. Idempotent.\n */\n static apply(opts: { root?: string } = {}): string {\n const root = opts.root ?? RepoTmp.findRoot();\n const testTmp = join(root, REPO_TMP_DIRECTORY);\n const current = process.env.TMPDIR;\n\n if (current !== undefined && `${resolve(current)}${sep}`.startsWith(`${testTmp}${sep}`)) {\n return current;\n }\n\n mkdirSync(join(testTmp, '.git'), { recursive: true });\n process.env.TMPDIR = testTmp;\n process.env.GIT_CEILING_DIRECTORIES = testTmp;\n Bun.spawn = RepoTmp.withCurrentEnv(Bun.spawn);\n Bun.spawnSync = RepoTmp.withCurrentEnv(Bun.spawnSync);\n\n return testTmp;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/dev-configs",
3
- "version": "0.4.8-9",
3
+ "version": "0.4.8",
4
4
  "description": "Shareable development configurations for TypeScript projects: oxlint presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
5
5
  "keywords": [
6
6
  "build-tools",