@venizia/dev-configs 0.5.0-11 → 0.5.0-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/codemod/binding-keys.js +2 -0
  3. package/dist/cli/codemod/binding-keys.js.map +1 -1
  4. package/dist/cli/codemod/class-renames.d.ts +9 -2
  5. package/dist/cli/codemod/class-renames.js +92 -17
  6. package/dist/cli/codemod/class-renames.js.map +1 -1
  7. package/dist/cli/codemod/index.js +7 -0
  8. package/dist/cli/codemod/index.js.map +1 -1
  9. package/dist/cli/codemod/namespace-functions/mapping.d.ts +6 -0
  10. package/dist/cli/codemod/namespace-functions/mapping.js.map +1 -1
  11. package/dist/cli/codemod/namespace-functions/mappings/connectors.d.ts +2 -0
  12. package/dist/cli/codemod/namespace-functions/mappings/connectors.js +19 -1
  13. package/dist/cli/codemod/namespace-functions/mappings/connectors.js.map +1 -1
  14. package/dist/cli/codemod/namespace-functions/mappings/guards.d.ts +4 -0
  15. package/dist/cli/codemod/namespace-functions/mappings/guards.js +15 -0
  16. package/dist/cli/codemod/namespace-functions/mappings/guards.js.map +1 -0
  17. package/dist/cli/codemod/namespace-functions/mappings/helpers.d.ts +3 -2
  18. package/dist/cli/codemod/namespace-functions/mappings/helpers.js +24 -3
  19. package/dist/cli/codemod/namespace-functions/mappings/helpers.js.map +1 -1
  20. package/dist/cli/codemod/namespace-functions/mappings/inversion.d.ts +6 -2
  21. package/dist/cli/codemod/namespace-functions/mappings/inversion.js +42 -3
  22. package/dist/cli/codemod/namespace-functions/mappings/inversion.js.map +1 -1
  23. package/dist/cli/codemod/namespace-functions/mappings/kernel.d.ts +4 -2
  24. package/dist/cli/codemod/namespace-functions/mappings/kernel.js +16 -3
  25. package/dist/cli/codemod/namespace-functions/mappings/kernel.js.map +1 -1
  26. package/dist/cli/codemod/namespace-functions/rewriter.d.ts +7 -0
  27. package/dist/cli/codemod/namespace-functions/rewriter.js +75 -8
  28. package/dist/cli/codemod/namespace-functions/rewriter.js.map +1 -1
  29. package/dist/cli/codemod/public-names.d.ts +25 -0
  30. package/dist/cli/codemod/public-names.js +140 -0
  31. package/dist/cli/codemod/public-names.js.map +1 -0
  32. package/dist/cli/codemod/typed-route-context-satisfies.d.ts +85 -0
  33. package/dist/cli/codemod/typed-route-context-satisfies.js +910 -0
  34. package/dist/cli/codemod/typed-route-context-satisfies.js.map +1 -0
  35. package/dist/cli/codemod/typed-route-context.d.ts +17 -2
  36. package/dist/cli/codemod/typed-route-context.js +148 -37
  37. package/dist/cli/codemod/typed-route-context.js.map +1 -1
  38. package/dist/cli/index.js +1 -0
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/linters/house/framework-api-patterns.js +1 -1
  41. package/dist/linters/house/framework-api-patterns.js.map +1 -1
  42. package/dist/linters/house/no-shadow-framework-type.rule.d.ts +1 -1
  43. package/dist/linters/house/no-shadow-framework-type.rule.js +1 -1
  44. package/dist/linters/house/no-shadow-framework-type.rule.js.map +1 -1
  45. package/dist/linters/rules/naming-convention.rule.js +1 -1
  46. package/dist/linters/rules/naming-convention.rule.js.map +1 -1
  47. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-route-context-satisfies.js","sourceRoot":"","sources":["../../../src/cli/codemod/typed-route-context-satisfies.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAKrC,qEAAqE;AACrE,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,oFAAoF;AACpF,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,mDAAmD;AACnD,MAAM,WAAW;aACC,QAAG,GAAG,mBAAmB,CAAC;aAC1B,QAAG,GAAG,mBAAmB,CAAC;aAC1B,mBAAc,GAAG,gBAAgB,CAAC;aAClC,gBAAW,GAAG,oCAAoC,CAAC;aACnD,oBAAe,GAAG,uCAAuC,CAAC;aAC1D,YAAO,GAAG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gB;IAC3B,MAAM,CAAC,IAAI,CAAC,IAAmE;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;YACtC,CAAC,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;YACrC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAQZ;QACC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AAlBD,4CAkBC","sourcesContent":["import { relative } from 'node:path';\nimport type TypeScript from 'typescript';\n\ntype TTypeScript = typeof TypeScript;\n\n/** The type whose annotation loses the schemas of a route config. */\nconst CONFIG_TYPE = 'IAuthRouteConfig';\nconst RULE = 'typed-route-context';\n/** How many times the projects are typechecked with candidates written, at most. */\nconst ROUND_LIMIT = 40;\n\n/** Why a config declared wide is left as it is. */\nclass LeftReasons {\n static readonly LET = 'declared with let';\n static readonly VAR = 'declared with var';\n static readonly NO_INITIALIZER = 'no initializer';\n static readonly NOT_LITERAL = 'its value is not an object literal';\n static readonly OTHER_ASSERTION = 'its value is asserted to another type';\n static readonly PATTERN = 'a destructuring pattern';\n static readonly OPTIONAL = 'an optional or definite property';\n static readonly MUTABLE_PROPERTY = 'a property that is not readonly';\n static readonly DISABLED = 'the lint rule is turned off here';\n static readonly IMPORT_TYPE = 'typed through import()';\n static readonly OPEN_KEY = 'indexed with a key that is not a literal';\n static readonly ABSENT_KEY = 'indexed with a key the object does not hold';\n}\n\n/** The calls that write to their first argument. */\nconst WRITING_CALLS = new Set([\n 'Object.assign',\n 'Object.defineProperty',\n 'Object.defineProperties',\n 'Reflect.set',\n 'Reflect.defineProperty',\n 'Reflect.deleteProperty',\n]);\n\nexport interface ITextEdit {\n start: number;\n end: number;\n text: string;\n}\n\n/** A config the codemod leaves declared wide, and why. */\nexport interface ILeftConfig {\n file: string;\n line: number;\n name: string;\n reason: string;\n}\n\n/** One annotation or assertion that can become `satisfies`, as far as its own file tells. */\nexport interface ISatisfiesCandidate {\n file: string;\n line: number;\n name: string;\n /** The span of the declaration (or of the assertion, outside one) in the source. */\n start: number;\n end: number;\n /** Where the name of the declared binding starts; `undefined` for an assertion that declares none. */\n binding: number | undefined;\n /** Whether code outside the file can reach the declaration. */\n isExported: boolean;\n /** For a `Record`: the keys its literal writes. */\n recordKeys: ReadonlySet<string> | undefined;\n edits: ITextEdit[];\n}\n\n/** One round of the proof, as it starts. */\nexport interface IProofRound {\n round: number;\n limit: number;\n /** The configs neither proved nor left yet. */\n inDoubt: number;\n}\n\nexport interface IProof {\n accepted: ISatisfiesCandidate[];\n left: ILeftConfig[];\n /** The configs the round limit left unchecked: they are not written. */\n untried: ISatisfiesCandidate[];\n}\n\nexport interface IScannedFile {\n candidates: ISatisfiesCandidate[];\n left: ILeftConfig[];\n}\n\n/** Applies edits to a text, and moves positions between the text before and after them. */\nexport class TextEdits {\n /** The text of each file once the candidates are written, and the edits that make it. */\n static writeAll(opts: {\n sources: ReadonlyMap<string, string>;\n candidates: ISatisfiesCandidate[];\n }): { edits: Map<string, ITextEdit[]>; contents: Map<string, string> } {\n const edits = new Map<string, ITextEdit[]>();\n\n for (const { file, edits: own } of opts.candidates) {\n edits.set(file, [...(edits.get(file) ?? []), ...own]);\n }\n\n const contents = new Map(\n [...edits].map(([file, own]) => [\n file,\n TextEdits.apply({ source: opts.sources.get(file) ?? '', edits: own }),\n ]),\n );\n\n return { edits, contents };\n }\n\n static apply(opts: { source: string; edits: ITextEdit[] }): string {\n let output = opts.source;\n\n for (const edit of [...opts.edits].sort((a, b) => b.start - a.start || b.end - a.end)) {\n output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);\n }\n\n return output;\n }\n\n static toSource(opts: { edits: ITextEdit[]; position: number }): number {\n let moved = 0;\n\n for (const edit of [...opts.edits].sort((a, b) => a.start - b.start || a.end - b.end)) {\n const start = edit.start + moved;\n\n if (opts.position < start) {\n break;\n }\n\n if (opts.position < start + edit.text.length) {\n return edit.start;\n }\n\n moved += edit.text.length - (edit.end - edit.start);\n }\n\n return opts.position - moved;\n }\n}\n\n/** The configs one file declares wide, in the forms `@venizia/typed-route-context` reports. */\nclass ConfigDeclarations {\n private readonly file: TypeScript.SourceFile;\n /** The type aliases of this file that stand for a wide config type. */\n private readonly aliases = new Map<string, TypeScript.TypeNode>();\n /** The assertions a declaration's own annotation already covers. */\n private readonly covered = new Set<TypeScript.Node>();\n private readonly result: IScannedFile = { candidates: [], left: [] };\n\n constructor(\n private readonly options: { typescript: TTypeScript; fileName: string; source: string },\n ) {\n const { typescript: ts, fileName, source } = options;\n const scriptKind = fileName.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n this.file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, scriptKind);\n }\n\n scan(): IScannedFile {\n const { typescript: ts } = this.options;\n\n for (const statement of this.file.statements) {\n if (ts.isTypeAliasDeclaration(statement) && !statement.typeParameters) {\n this.aliases.set(statement.name.text, statement.type);\n }\n }\n\n const visit = (node: TypeScript.Node): void => {\n if (ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node)) {\n this.readDeclaration(node);\n }\n\n if (ts.isAsExpression(node) && !this.covered.has(node)) {\n this.readAssertion(node);\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(this.file);\n\n return this.result;\n }\n\n /** Whether a type is `IAuthRouteConfig`, alone, in an `Omit` or `Readonly`, or as the value of a `Record`. */\n private isWide(type: TypeScript.TypeNode | undefined, seen = new Set<string>()): boolean {\n const { typescript: ts } = this.options;\n\n if (type && ts.isImportTypeNode(type)) {\n return type.qualifier?.getText(this.file) === CONFIG_TYPE;\n }\n\n if (!type || !ts.isTypeReferenceNode(type)) {\n return false;\n }\n\n const name = type.typeName.getText(this.file);\n const [first, second] = type.typeArguments ?? [];\n\n if (name === 'Record') {\n return this.isWide(second, seen);\n }\n\n if (name === 'Omit' || name === 'Readonly') {\n return this.isWide(first, seen);\n }\n\n const alias = this.aliases.get(name);\n\n if (alias && !seen.has(name)) {\n return this.isWide(alias, seen.add(name));\n }\n\n return name === CONFIG_TYPE;\n }\n\n private hasImportType(node: TypeScript.Node): boolean {\n return (\n this.options.typescript.isImportTypeNode(node) ||\n this.options.typescript.forEachChild(node, (child) =>\n this.hasImportType(child) ? true : undefined,\n ) === true\n );\n }\n\n private isRecord(type: TypeScript.TypeNode, seen = new Set<string>()): boolean {\n const { typescript: ts } = this.options;\n\n if (!ts.isTypeReferenceNode(type)) {\n return false;\n }\n\n const name = type.typeName.getText(this.file);\n const [first] = type.typeArguments ?? [];\n\n if (name === 'Readonly' && first) {\n return this.isRecord(first, seen);\n }\n\n const alias = this.aliases.get(name);\n\n if (alias && !seen.has(name)) {\n return this.isRecord(alias, seen.add(name));\n }\n\n return name === 'Record';\n }\n\n private unwrapped(expression: TypeScript.Expression): TypeScript.Expression {\n return this.options.typescript.isParenthesizedExpression(expression)\n ? this.unwrapped(expression.expression)\n : expression;\n }\n\n /** An empty object is a collection filled later, which the lint rule does not report. */\n private isFilledObject(expression: TypeScript.Expression): boolean {\n const value = this.unwrapped(expression);\n\n return this.options.typescript.isObjectLiteralExpression(value) && value.properties.length > 0;\n }\n\n private isConstAssertion(type: TypeScript.TypeNode): boolean {\n return type.getText(this.file) === 'const';\n }\n\n private readDeclaration(\n declaration: TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration,\n ) {\n const { typescript: ts } = this.options;\n const { type, initializer } = declaration;\n\n if (!type || !this.isWide(type)) {\n return;\n }\n\n const value = initializer ? this.unwrapped(initializer) : undefined;\n const asserted = value && ts.isAsExpression(value) ? value : undefined;\n\n if (asserted) {\n this.covered.add(asserted);\n }\n\n const literal = asserted ? asserted.expression : value;\n\n // `for (const x of list)` takes its value from the list, and an empty object is filled later.\n const isEmpty =\n literal !== undefined &&\n ts.isObjectLiteralExpression(this.unwrapped(literal)) &&\n !this.isFilledObject(literal);\n\n if (isEmpty || ts.isForOfStatement(declaration.parent.parent)) {\n return;\n }\n\n const name = declaration.name.getText(this.file);\n const refusal = this.hasImportType(type)\n ? LeftReasons.IMPORT_TYPE\n : this.refusalOf(declaration);\n\n if (refusal) {\n this.leave({ node: declaration, name, reason: refusal });\n\n return;\n }\n\n if (!initializer || !literal || !this.isFilledObject(literal)) {\n this.leave({ node: declaration, name, reason: LeftReasons.NOT_LITERAL });\n\n return;\n }\n\n const typeText = type.getText(this.file);\n const edits = this.removeAnnotation({ declaration, type });\n\n if (!asserted || this.isConstAssertion(asserted.type)) {\n const end = initializer.getEnd();\n edits.push({ start: end, end, text: ` satisfies ${typeText}` });\n } else if (asserted.type.getText(this.file) === typeText) {\n edits.push(this.assertionToSatisfies(asserted));\n } else {\n this.leave({ node: declaration, name, reason: LeftReasons.OTHER_ASSERTION });\n\n return;\n }\n\n this.add({ node: declaration, declaration, name, type, literal, edits });\n }\n\n private isDeclaration(\n node: TypeScript.Node,\n ): node is TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration {\n const { typescript: ts } = this.options;\n\n return ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node);\n }\n\n private readAssertion(assertion: TypeScript.AsExpression) {\n const { typescript: ts } = this.options;\n\n if (!this.isWide(assertion.type) || !this.isFilledObject(assertion.expression)) {\n return;\n }\n\n let node: TypeScript.Node = assertion.parent;\n\n // The declaration the assertion is part of the value of; one inside a function belongs to no outer declaration.\n while (!ts.isSourceFile(node) && !ts.isFunctionLike(node) && !this.isDeclaration(node)) {\n node = node.parent;\n }\n\n const current = this.isDeclaration(node) ? node : undefined;\n const name = current ? current.name.getText(this.file) : 'an assertion';\n const refusal = this.hasImportType(assertion.type)\n ? LeftReasons.IMPORT_TYPE\n : current\n ? this.refusalOf(current)\n : this.disabledAt(assertion);\n\n if (refusal) {\n this.leave({ node: assertion, name, reason: refusal });\n\n return;\n }\n\n // Only a whole value is the `Record` itself; a member's assertion types that member.\n const isWhole = current?.initializer === assertion;\n this.add({\n node: current ?? assertion,\n declaration: current,\n name,\n type: isWhole ? assertion.type : undefined,\n literal: assertion.expression,\n edits: [this.assertionToSatisfies(assertion)],\n });\n }\n\n /** What about the declaration itself forbids the rewrite. */\n private refusalOf(\n declaration: TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration,\n ): string | undefined {\n const { typescript: ts } = this.options;\n const disabled = this.disabledAt(declaration);\n\n if (disabled) {\n return disabled;\n }\n\n if (ts.isPropertyDeclaration(declaration)) {\n const isReadonly = declaration.modifiers?.some(\n (modifier) => modifier.kind === ts.SyntaxKind.ReadonlyKeyword,\n );\n\n if (!declaration.initializer) {\n return LeftReasons.NO_INITIALIZER;\n }\n\n if (declaration.questionToken || declaration.exclamationToken) {\n return LeftReasons.OPTIONAL;\n }\n\n return isReadonly ? undefined : LeftReasons.MUTABLE_PROPERTY;\n }\n\n const flags = ts.getCombinedNodeFlags(declaration);\n\n if (!declaration.initializer) {\n return LeftReasons.NO_INITIALIZER;\n }\n\n if (!(flags & ts.NodeFlags.Const)) {\n return flags & ts.NodeFlags.Let ? LeftReasons.LET : LeftReasons.VAR;\n }\n\n return ts.isIdentifier(declaration.name) ? undefined : LeftReasons.PATTERN;\n }\n\n /** Whether an `eslint-disable` comment turns the rule off for this node. */\n private disabledAt(node: TypeScript.Node): string | undefined {\n const lines = this.options.source.split('\\n');\n const line = this.lineOf(node) - 1;\n const near = [lines[line - 1] ?? '', lines[line] ?? ''].join('\\n');\n const isNear = /eslint-disable(?:-next-line|-line)?\\s/.test(near) && near.includes(RULE);\n const isWholeFile = new RegExp(`/\\\\*\\\\s*eslint-disable\\\\s[^*]*${RULE}`).test(\n this.options.source,\n );\n\n return isNear || isWholeFile ? LeftReasons.DISABLED : undefined;\n }\n\n /** Removes `: Type`; a comment between the colon and the type stays. */\n private removeAnnotation(opts: {\n declaration: TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration;\n type: TypeScript.TypeNode;\n }): ITextEdit[] {\n const { declaration, type } = opts;\n const { source } = this.options;\n const colon = declaration\n .getChildren(this.file)\n .find((child) => child.kind === this.options.typescript.SyntaxKind.ColonToken);\n const start = colon?.getStart(this.file) ?? type.getStart(this.file);\n const typeStart = type.getStart(this.file);\n const end = type.getEnd();\n\n if (source.slice(start + 1, typeStart).trim() === '') {\n return [{ start, end, text: '' }];\n }\n\n // The space before the type goes with it, so no double space stays before `=`.\n const blank = source.slice(0, typeStart).trimEnd().length;\n\n return [\n { start, end: start + 1, text: '' },\n { start: blank, end, text: '' },\n ];\n }\n\n private assertionToSatisfies(assertion: TypeScript.AsExpression): ITextEdit {\n const { typescript: ts, source } = this.options;\n const scanner = ts.createScanner(ts.ScriptTarget.Latest, true);\n scanner.setText(source, assertion.expression.getEnd());\n scanner.scan();\n const start = scanner.getTokenStart();\n\n return { start, end: scanner.getTokenEnd(), text: 'satisfies' };\n }\n\n private add(opts: {\n node: TypeScript.Node;\n declaration: TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration | undefined;\n name: string;\n type: TypeScript.TypeNode | undefined;\n literal: TypeScript.Expression;\n edits: ITextEdit[];\n }) {\n const { typescript: ts } = this.options;\n const { node, declaration, name, type, literal, edits } = opts;\n const value = this.unwrapped(literal);\n const keys =\n type && this.isRecord(type) && ts.isObjectLiteralExpression(value)\n ? value.properties.flatMap((property) => {\n const { name: written } = property;\n // `['/a']: ...` writes the same key as `'/a': ...`.\n const key =\n written && ts.isComputedPropertyName(written) ? written.expression : written;\n\n // A bare identifier in brackets names a variable, not the key.\n if (key && ts.isIdentifier(key)) {\n return key === written ? [key.text] : [];\n }\n\n return key && (ts.isStringLiteralLike(key) || ts.isNumericLiteral(key))\n ? [key.text]\n : [];\n })\n : undefined;\n\n this.result.candidates.push({\n file: this.options.fileName,\n line: this.lineOf(node),\n name,\n start: node.getStart(this.file),\n end: node.getEnd(),\n binding: declaration?.name.getStart(this.file),\n isExported: this.isExported(node),\n recordKeys: keys ? new Set(keys) : undefined,\n edits,\n });\n }\n\n /** Exported where it stands, or named by an `export` of its file; nothing declared in a function is. */\n private isExported(node: TypeScript.Node): boolean {\n const { typescript: ts } = this.options;\n let statement = node;\n\n while (!ts.isSourceFile(statement.parent)) {\n statement = statement.parent;\n\n if (ts.isFunctionLike(statement)) {\n return false;\n }\n }\n\n const isModified =\n ts.canHaveModifiers(statement) &&\n ts.getModifiers(statement)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);\n\n if (isModified || ts.isExportAssignment(statement)) {\n return true;\n }\n\n const names = ts.isVariableStatement(statement)\n ? statement.declarationList.declarations.map((item) => item.name.getText(this.file))\n : ts.isClassDeclaration(statement) && statement.name\n ? [statement.name.text]\n : [];\n\n return this.file.statements.some((item) => {\n if (ts.isExportAssignment(item)) {\n return names.includes(item.expression.getText(this.file));\n }\n\n return (\n ts.isExportDeclaration(item) &&\n !item.moduleSpecifier &&\n item.exportClause !== undefined &&\n ts.isNamedExports(item.exportClause) &&\n item.exportClause.elements.some((element) =>\n names.includes((element.propertyName ?? element.name).text),\n )\n );\n });\n }\n\n private leave(opts: { node: TypeScript.Node; name: string; reason: string }) {\n const { node, name, reason } = opts;\n this.result.left.push({ file: this.options.fileName, line: this.lineOf(node), name, reason });\n }\n\n private lineOf(node: TypeScript.Node): number {\n return this.file.getLineAndCharacterOfPosition(node.getStart(this.file)).line + 1;\n }\n}\n\n/** One type error of a check, at its place in the source as it was. */\ninterface IFoundError {\n file: string;\n /** In the checked text. */\n position: number;\n line: number;\n code: number;\n /** The file and the position, whatever the code. */\n place: string;\n key: string;\n}\n\n/**\n * Which of the candidates can be written: those whose binding is never written to and, if a `Record`, never indexed\n * by a key the literal may not hold, and whose rewrite adds no type error to any project of the run.\n */\nclass SatisfiesProof {\n private readonly accepted: Set<ISatisfiesCandidate>;\n private readonly left = new Map<ISatisfiesCandidate, ILeftConfig>();\n private readonly untried: ISatisfiesCandidate[] = [];\n /** How many times the projects were typechecked with candidates written. */\n private rounds = 0;\n\n constructor(\n private readonly options: {\n typescript: TTypeScript;\n root: string;\n sources: ReadonlyMap<string, string>;\n candidates: ISatisfiesCandidate[];\n /** The program of each project of the run, with `contents` read in place of the files. */\n programs: (contents: ReadonlyMap<string, string>) => TypeScript.Program[];\n roundLimit?: number;\n onRound?: (round: IProofRound) => void;\n },\n ) {\n this.accepted = new Set(options.candidates);\n }\n\n run(): IProof {\n if (this.accepted.size === 0) {\n return { accepted: [], left: [], untried: [] };\n }\n\n const programs = this.holding(this.options.programs(new Map()));\n this.dropWritten(programs);\n\n if (this.accepted.size > 0) {\n this.dropBreaking(new Set(this.errorsOf(programs, new Map()).map((error) => error.key)));\n }\n\n return { accepted: [...this.accepted], left: [...this.left.values()], untried: this.untried };\n }\n\n /** The programs that read a file with a candidate: no other can be broken by a rewrite. */\n private holding(programs: TypeScript.Program[]): TypeScript.Program[] {\n const files = this.options.candidates.map((candidate) => candidate.file);\n\n return programs.filter((program) => files.some((file) => program.getSourceFile(file)));\n }\n\n private reject(opts: { candidate: ISatisfiesCandidate; reason: string }) {\n const { candidate, reason } = opts;\n\n if (this.accepted.delete(candidate)) {\n const { file, line, name } = candidate;\n this.left.set(candidate, { file, line, name, reason });\n }\n }\n\n /** Takes a rejection back, so that the candidate is proved again. */\n private restore(candidate: ISatisfiesCandidate) {\n this.left.delete(candidate);\n this.accepted.add(candidate);\n }\n\n private shown(file: string): string {\n return relative(this.options.root, file).split('\\\\').join('/');\n }\n\n private ownFiles(program: TypeScript.Program): TypeScript.SourceFile[] {\n return program\n .getSourceFiles()\n .filter((file) => !file.isDeclarationFile && !file.fileName.includes('/node_modules/'));\n }\n\n /** The candidates by their binding: the file and the position of its name in the source. */\n private bindings(): Map<string, ISatisfiesCandidate[]> {\n const found = new Map<string, ISatisfiesCandidate[]>();\n\n for (const candidate of this.accepted) {\n if (candidate.binding !== undefined) {\n const key = `${candidate.file}:${candidate.binding}`;\n found.set(key, [...(found.get(key) ?? []), candidate]);\n }\n }\n\n return found;\n }\n\n /** What an identifier stands for, through an import and a shorthand property. */\n private symbolOf(opts: { checker: TypeScript.TypeChecker; name: TypeScript.Identifier }) {\n const { typescript: ts } = this.options;\n const { checker, name } = opts;\n const { parent } = name;\n const symbol =\n ts.isShorthandPropertyAssignment(parent) && parent.name === name\n ? checker.getShorthandAssignmentValueSymbol(parent)\n : checker.getSymbolAtLocation(name);\n\n return symbol && symbol.flags & ts.SymbolFlags.Alias\n ? checker.getAliasedSymbol(symbol)\n : symbol;\n }\n\n /** The declaration of the value a member of an object literal holds, through any number of such members. */\n private heldBy(opts: {\n checker: TypeScript.TypeChecker;\n declaration: TypeScript.Declaration | undefined;\n }): TypeScript.Declaration | undefined {\n const { typescript: ts } = this.options;\n const { checker } = opts;\n const seen = new Set<TypeScript.Declaration>();\n let { declaration } = opts;\n\n while (declaration && !seen.has(declaration)) {\n seen.add(declaration);\n let held: TypeScript.Symbol | undefined;\n\n if (ts.isShorthandPropertyAssignment(declaration)) {\n held = checker.getShorthandAssignmentValueSymbol(declaration);\n } else if (ts.isPropertyAssignment(declaration) && ts.isIdentifier(declaration.initializer)) {\n held = checker.getSymbolAtLocation(declaration.initializer);\n } else {\n return declaration;\n }\n\n declaration =\n held && held.flags & ts.SymbolFlags.Alias\n ? checker.getAliasedSymbol(held).valueDeclaration\n : held?.valueDeclaration;\n }\n\n return declaration;\n }\n\n /** Calls `found` for each identifier under `node` that reads the binding of a candidate. */\n private forEachReference(opts: {\n program: TypeScript.Program;\n node: TypeScript.Node;\n edits: ReadonlyMap<string, ITextEdit[]>;\n bindings: ReadonlyMap<string, ISatisfiesCandidate[]>;\n /** Also reads a member of an object literal (`ALL.A`) as the binding it holds. */\n isThroughMembers?: boolean;\n found: (reference: TypeScript.Identifier, candidates: ISatisfiesCandidate[]) => void;\n }) {\n const { typescript: ts } = this.options;\n const { program, node, edits, bindings, isThroughMembers = false, found } = opts;\n const checker = program.getTypeChecker();\n const names = new Set([...bindings.values()].flat().map((candidate) => candidate.name));\n\n const visit = (current: TypeScript.Node): void => {\n ts.forEachChild(current, visit);\n\n if (!ts.isIdentifier(current)) {\n return;\n }\n\n const read = this.symbolOf({ checker, name: current })?.valueDeclaration;\n const declaration = isThroughMembers ? this.heldBy({ checker, declaration: read }) : read;\n\n if (\n !declaration ||\n !(ts.isVariableDeclaration(declaration) || ts.isPropertyDeclaration(declaration)) ||\n !names.has(declaration.name.getText()) ||\n declaration.name === current\n ) {\n return;\n }\n\n const file = declaration.getSourceFile().fileName;\n const position = TextEdits.toSource({\n edits: edits.get(file) ?? [],\n position: declaration.name.getStart(),\n });\n const candidates = bindings.get(`${file}:${position}`);\n\n if (candidates) {\n found(current, candidates);\n }\n };\n\n visit(node);\n }\n\n private dropWritten(programs: TypeScript.Program[]) {\n const bindings = this.bindings();\n\n for (const program of programs) {\n const { noImplicitAny, strict } = program.getCompilerOptions();\n const isImplicitAnyRefused = noImplicitAny ?? strict ?? false;\n\n for (const file of this.ownFiles(program)) {\n this.forEachReference({\n program,\n node: file,\n edits: new Map(),\n bindings,\n found: (reference, candidates) => {\n const line = file.getLineAndCharacterOfPosition(reference.getStart()).line + 1;\n const where = `${this.shown(file.fileName)}:${line}`;\n\n for (const candidate of candidates) {\n const { isWritten, openIndex } = this.useOf({\n program,\n reference,\n keys: candidate.recordKeys,\n isImplicitAnyRefused,\n });\n\n if (isWritten) {\n this.reject({ candidate, reason: `written at ${where}` });\n }\n\n if (openIndex) {\n this.reject({ candidate, reason: `${openIndex} at ${where}` });\n }\n }\n },\n });\n }\n }\n }\n\n /**\n * How one reference uses its binding. An index is open when its key is not a literal; without `noImplicitAny` also\n * when the literal does not hold it, because the read then turns into `any` with no error.\n */\n private useOf(opts: {\n program: TypeScript.Program;\n reference: TypeScript.Identifier;\n keys: ReadonlySet<string> | undefined;\n isImplicitAnyRefused: boolean;\n }): { isWritten: boolean; openIndex: string | undefined } {\n const { typescript: ts } = this.options;\n const { program, reference, keys, isImplicitAnyRefused } = opts;\n const { parent } = reference;\n let current: TypeScript.Expression =\n ts.isPropertyAccessExpression(parent) && parent.name === reference ? parent : reference;\n const base = current;\n let openIndex: string | undefined;\n\n while (true) {\n const next: TypeScript.Node = current.parent;\n\n if (ts.isElementAccessExpression(next) && next.expression === current) {\n if (keys && this.unwrappedUse(current) === base) {\n const type = program.getTypeChecker().getTypeAtLocation(next.argumentExpression);\n const parts = type.isUnion() ? type.types : [type];\n const literals = parts.flatMap((part) =>\n part.isStringLiteral() || part.isNumberLiteral() ? [String(part.value)] : [],\n );\n\n if (literals.length !== parts.length) {\n openIndex = LeftReasons.OPEN_KEY;\n } else if (!isImplicitAnyRefused && !literals.every((key) => keys.has(key))) {\n openIndex = LeftReasons.ABSENT_KEY;\n }\n }\n\n current = next;\n continue;\n }\n\n if (\n (ts.isPropertyAccessExpression(next) ||\n ts.isParenthesizedExpression(next) ||\n ts.isNonNullExpression(next) ||\n ts.isAsExpression(next) ||\n ts.isSatisfiesExpression(next)) &&\n next.expression === current\n ) {\n current = next;\n continue;\n }\n\n return { isWritten: this.isWriteTarget(current), openIndex };\n }\n }\n\n private unwrappedUse(expression: TypeScript.Expression): TypeScript.Expression {\n const { typescript: ts } = this.options;\n\n return ts.isParenthesizedExpression(expression) || ts.isNonNullExpression(expression)\n ? this.unwrappedUse(expression.expression)\n : expression;\n }\n\n private isWriteTarget(node: TypeScript.Node): boolean {\n const { typescript: ts } = this.options;\n const { parent } = node;\n\n if (ts.isBinaryExpression(parent)) {\n const operator = parent.operatorToken.kind;\n\n return (\n parent.left === node &&\n operator >= ts.SyntaxKind.FirstAssignment &&\n operator <= ts.SyntaxKind.LastAssignment\n );\n }\n\n if (ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent)) {\n return (\n parent.operator === ts.SyntaxKind.PlusPlusToken ||\n parent.operator === ts.SyntaxKind.MinusMinusToken\n );\n }\n\n if (ts.isDeleteExpression(parent)) {\n return true;\n }\n\n if (ts.isCallExpression(parent)) {\n return parent.arguments[0] === node && WRITING_CALLS.has(parent.expression.getText());\n }\n\n if (ts.isForInStatement(parent) || ts.isForOfStatement(parent)) {\n return parent.initializer === node;\n }\n\n // A destructuring assignment: `[a.x] = list`, `({ y: a.x } = value)`.\n if (ts.isArrayLiteralExpression(parent)) {\n return this.isWriteTarget(parent);\n }\n\n return (\n ts.isPropertyAssignment(parent) &&\n parent.initializer === node &&\n this.isWriteTarget(parent.parent)\n );\n }\n\n private errorsOf(\n programs: TypeScript.Program[],\n edits: ReadonlyMap<string, ITextEdit[]>,\n ): IFoundError[] {\n const { typescript: ts, sources } = this.options;\n\n return programs.flatMap((program) => {\n const { declaration } = program.getCompilerOptions();\n\n return this.ownFiles(program).flatMap((file) => {\n const diagnostics = [\n ...program.getSemanticDiagnostics(file),\n ...(declaration ? program.getDeclarationDiagnostics(file) : []),\n ];\n\n return diagnostics\n .filter((item) => item.category === ts.DiagnosticCategory.Error)\n .map((item) => {\n const position = item.start ?? 0;\n const own = edits.get(file.fileName) ?? [];\n const before = TextEdits.toSource({ edits: own, position });\n const source = sources.get(file.fileName) ?? file.text;\n const line = source.slice(0, before).split('\\n').length;\n\n return {\n file: file.fileName,\n position,\n line,\n code: item.code,\n place: `${file.fileName}|${before}`,\n key: `${file.fileName}|${before}|${item.code}`,\n };\n });\n });\n });\n }\n\n /**\n * The candidates a new error leads to: those it points into, else those its statement reads, else those read by the\n * variables and types that statement names, one step further at a time.\n */\n private blamed(opts: {\n programs: TypeScript.Program[];\n error: IFoundError;\n edits: ReadonlyMap<string, ITextEdit[]>;\n }): ISatisfiesCandidate[] {\n const { typescript: ts } = this.options;\n const { programs, error, edits } = opts;\n const own = edits.get(error.file) ?? [];\n const position = TextEdits.toSource({ edits: own, position: error.position });\n const around = [...this.accepted].filter(\n (candidate) =>\n candidate.file === error.file && candidate.start <= position && position <= candidate.end,\n );\n\n if (around.length > 0) {\n return around;\n }\n\n const program = programs.find((item) => item.getSourceFile(error.file));\n const file = program?.getSourceFile(error.file);\n\n if (!program || !file) {\n return [];\n }\n\n let statement: TypeScript.Node = file;\n\n const descend = (node: TypeScript.Node): void => {\n if (node.getStart(file) > error.position || node.getEnd() <= error.position) {\n return;\n }\n\n if (ts.isStatement(node) || ts.isClassElement(node)) {\n statement = node;\n }\n\n ts.forEachChild(node, descend);\n };\n\n ts.forEachChild(file, descend);\n const bindings = this.bindings();\n const seen = new Set<TypeScript.Node>();\n let nodes: TypeScript.Node[] = [statement];\n\n while (nodes.length > 0) {\n const read: ISatisfiesCandidate[] = [];\n\n for (const node of nodes) {\n this.forEachReference({\n program,\n node,\n edits,\n bindings,\n isThroughMembers: true,\n found: (_reference, candidates) => {\n read.push(...candidates);\n },\n });\n }\n\n if (read.length > 0) {\n return [...new Set(read)];\n }\n\n nodes = nodes\n .flatMap((node) => this.namedBy({ program, node }))\n .filter((node) => !seen.has(node) && seen.add(node));\n }\n\n return [];\n }\n\n /** The values and types of the variables, properties and type declarations that `node` names. */\n private namedBy(opts: { program: TypeScript.Program; node: TypeScript.Node }): TypeScript.Node[] {\n const { typescript: ts } = this.options;\n const { program, node } = opts;\n const checker = program.getTypeChecker();\n const own = new Set(this.ownFiles(program));\n const found: TypeScript.Node[] = [];\n\n const visit = (current: TypeScript.Node): void => {\n ts.forEachChild(current, visit);\n\n if (!ts.isIdentifier(current)) {\n return;\n }\n\n for (const declaration of this.symbolOf({ checker, name: current })?.declarations ?? []) {\n if (!own.has(declaration.getSourceFile())) {\n continue;\n }\n\n if (ts.isVariableDeclaration(declaration) || ts.isPropertyDeclaration(declaration)) {\n const { initializer, type } = declaration;\n found.push(...[initializer, type].filter((part) => part !== undefined));\n }\n\n if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration)) {\n found.push(declaration);\n }\n\n if (ts.isFunctionDeclaration(declaration)) {\n const { type, body } = declaration;\n found.push(...(type ? [type] : []), ...(body ? this.returnsOf(body) : []));\n }\n }\n };\n\n visit(node);\n\n return found;\n }\n\n /** What a function body returns; the returns of a function inside it are not its own. */\n private returnsOf(node: TypeScript.Node): TypeScript.Expression[] {\n const { typescript: ts } = this.options;\n const found: TypeScript.Expression[] = [];\n\n const visit = (current: TypeScript.Node): void => {\n if (ts.isReturnStatement(current) && current.expression) {\n found.push(current.expression);\n }\n\n if (!ts.isFunctionLike(current)) {\n ts.forEachChild(current, visit);\n }\n };\n\n visit(node);\n\n return found;\n }\n\n /** The files of `errors` and those they import, through any number of `export ... from`. */\n private filesAround(opts: {\n programs: TypeScript.Program[];\n errors: IFoundError[];\n }): Set<string> {\n const { typescript: ts } = this.options;\n const { programs, errors } = opts;\n const found = new Set<string>();\n\n for (const { file } of errors) {\n const program = programs.find((item) => item.getSourceFile(file));\n const source = program?.getSourceFile(file);\n\n if (!program || !source) {\n continue;\n }\n\n const checker = program.getTypeChecker();\n const queue = [source];\n found.add(file);\n\n for (const current of queue) {\n for (const statement of current.statements) {\n const isRead =\n ts.isExportDeclaration(statement) ||\n (current === source && ts.isImportDeclaration(statement));\n const specifier = isRead ? statement.moduleSpecifier : undefined;\n const target = specifier && checker.getSymbolAtLocation(specifier)?.valueDeclaration;\n\n if (target && ts.isSourceFile(target) && !found.has(target.fileName)) {\n found.add(target.fileName);\n queue.push(target);\n }\n }\n }\n }\n\n return found;\n }\n\n /** Typechecks the projects with `candidates` written, and answers the errors that adds. */\n private check(opts: {\n candidates: ISatisfiesCandidate[];\n baseline: ReadonlySet<string>;\n inDoubt: number;\n }) {\n const { candidates, baseline, inDoubt } = opts;\n this.rounds += 1;\n this.options.onRound?.({ round: this.rounds, limit: this.roundLimit, inDoubt });\n const { edits, contents } = TextEdits.writeAll({ sources: this.options.sources, candidates });\n const programs = this.holding(this.options.programs(contents));\n const added = this.errorsOf(programs, edits).filter((error) => !baseline.has(error.key));\n\n return { edits, programs, added };\n }\n\n private whereOf(error: IFoundError): string {\n return `${this.shown(error.file)}:${error.line} TS${error.code}`;\n }\n\n private rejectBroken(opts: { candidate: ISatisfiesCandidate; error: IFoundError }) {\n const reason = `the typecheck fails with it: ${this.whereOf(opts.error)}`;\n this.reject({ candidate: opts.candidate, reason });\n }\n\n private rejectUntried(candidates: ISatisfiesCandidate[]) {\n for (const candidate of candidates) {\n if (this.accepted.delete(candidate)) {\n this.untried.push(candidate);\n }\n }\n }\n\n private get roundLimit(): number {\n return this.options.roundLimit ?? ROUND_LIMIT;\n }\n\n /** Leaves candidates out until the rest add no error to what the projects already had. */\n private dropBreaking(baseline: ReadonlySet<string>) {\n /** The candidates the last round left on an error that led to one alone, with the place of that error. */\n let alone: Array<{ place: string; candidate: ISatisfiesCandidate }> = [];\n\n while (this.accepted.size > 0) {\n if (this.rounds >= this.roundLimit) {\n this.rejectUntried([...this.accepted]);\n\n return;\n }\n\n const { edits, programs, added } = this.check({\n candidates: [...this.accepted],\n baseline,\n inDoubt: this.accepted.size,\n });\n\n if (added.length === 0) {\n return;\n }\n\n const blames = added.map((error) => ({\n error,\n candidates: this.blamed({ programs, error, edits }),\n }));\n // An error still there without the candidate left for it was not that candidate's alone.\n const unsettled = alone.filter(({ place }) => added.some((error) => error.place === place));\n const certain = blames.filter((blame) => blame.candidates.length === 1);\n\n if (unsettled.length === 0 && certain.length > 0) {\n alone = [];\n\n for (const { error, candidates } of certain) {\n for (const candidate of candidates) {\n this.rejectBroken({ candidate, error });\n alone.push({ place: error.place, candidate });\n }\n }\n\n continue;\n }\n\n for (const { candidate } of unsettled) {\n this.restore(candidate);\n }\n\n // Several suspects, or none: which of them it takes is for the typecheck to say.\n const suspects = new Set([\n ...unsettled.map(({ candidate }) => candidate),\n ...blames.flatMap((blame) => blame.candidates),\n ]);\n const around = this.filesAround({ programs, errors: added });\n const [first, rest] = this.split({\n isFirst: (candidate) =>\n suspects.size === 0 ? around.has(candidate.file) : !suspects.has(candidate),\n });\n // The configs no error points near are proved at once, so the rounds are not spent before they are tried;\n // what is left is halved.\n const groups =\n suspects.size === 0 ? [rest, ...this.halves(first)] : [first, ...this.halves(rest)];\n this.bisect({ baseline, groups: groups.filter((group) => group.length > 0) });\n\n return;\n }\n }\n\n /** The accepted candidates `isFirst` holds for, then the others. */\n private split(opts: {\n isFirst: (candidate: ISatisfiesCandidate) => boolean;\n }): [ISatisfiesCandidate[], ISatisfiesCandidate[]] {\n const all = [...this.accepted];\n\n return [all.filter(opts.isFirst), all.filter((candidate) => !opts.isFirst(candidate))];\n }\n\n private halves(group: ISatisfiesCandidate[]): ISatisfiesCandidate[][] {\n const middle = Math.ceil(group.length / 2);\n\n return [group.slice(0, middle), group.slice(middle)].filter((half) => half.length > 0);\n }\n\n /**\n * For errors no single candidate answers for, with all of them known to fail together: adds `groups` to those already\n * proved, halving a group that fails, and leaves each candidate that fails alone on top of them. Which of two that\n * only fail together stays follows the order of the groups.\n */\n private bisect(opts: { baseline: ReadonlySet<string>; groups: ISatisfiesCandidate[][] }) {\n const { baseline } = opts;\n const all = [...this.accepted];\n const proved: ISatisfiesCandidate[] = [];\n const queue = [...opts.groups];\n\n // The one group that is everything is known to fail: halve it without asking.\n if (queue.length === 1 && queue[0]?.length === all.length && all.length > 1) {\n queue.splice(0, 1, ...this.halves(all));\n }\n\n while (this.rounds < this.roundLimit) {\n const group = queue.shift();\n\n if (!group) {\n break;\n }\n\n const [only, ...others] = group;\n const { added } = this.check({\n candidates: [...proved, ...group],\n baseline,\n inDoubt: this.accepted.size - proved.length,\n });\n const [error] = added;\n\n if (!error) {\n proved.push(...group);\n } else if (only && others.length === 0) {\n this.rejectBroken({ candidate: only, error });\n } else {\n queue.unshift(...this.halves(group));\n }\n }\n\n this.rejectUntried(all.filter((candidate) => !proved.includes(candidate)));\n }\n}\n\n/** Writes a config declared as `IAuthRouteConfig` (or a `Record` of it) with `satisfies`, which keeps its schemas. */\nexport class SatisfiesRewrite {\n static scan(opts: { typescript: TTypeScript; fileName: string; source: string }): IScannedFile {\n return opts.source.includes(CONFIG_TYPE)\n ? new ConfigDeclarations(opts).scan()\n : { candidates: [], left: [] };\n }\n\n static prove(opts: {\n typescript: TTypeScript;\n root: string;\n sources: ReadonlyMap<string, string>;\n candidates: ISatisfiesCandidate[];\n programs: (contents: ReadonlyMap<string, string>) => TypeScript.Program[];\n roundLimit?: number;\n onRound?: (round: IProofRound) => void;\n }): IProof {\n return new SatisfiesProof(opts).run();\n }\n}\n"]}
@@ -40,7 +40,17 @@ export declare class TypedRouteContext {
40
40
  root: string;
41
41
  results: ReadonlyMap<string, ITypedRouteContextResult>;
42
42
  }): Map<string, string[]>;
43
- /** Each of `files` with the program of its own project (its nearest tsconfig.json), the rewritten text read. */
43
+ /** The program of each project (a file's nearest tsconfig.json) among `files`, with `contents` read in their place. */
44
+ static programs(opts: {
45
+ typescript: typeof TypeScript;
46
+ root: string;
47
+ files: string[];
48
+ contents: ReadonlyMap<string, string>;
49
+ }): Array<{
50
+ program: TypeScript.Program;
51
+ owned: string[];
52
+ }>;
53
+ /** Each of `files` with the program of its own project, the rewritten text read. */
44
54
  private static check;
45
55
  private static keptIn;
46
56
  }
@@ -49,7 +59,12 @@ export declare class TypedRouteContext {
49
59
  * given. `--check` is the same dry run, and exits 1 while a file would change.
50
60
  */
51
61
  export declare class TypedRouteContextCommand {
52
- static readonly USAGE = "Usage: devz codemod typed-route-context [paths...] [--write [--all] | --check]\n\nTypes route handlers from their route config (TContextOf). In a file that imports the types from @venizia/ignis or\n@venizia/ignis-kernel:\n\n- a decorated method (@api, @get, @post, @put, @patch, @del) whose configs is a name declared or imported in the\n file: its TRouteContext becomes TContextOf<typeof CONFIG>, and valid<T>() on it loses its type argument;\n- the same for a private method that only the handlers of one route config in its class pass their context to;\n- TRouteContext<Env, Body> drops the body, and TRouteHandler<Response, Env> drops the response. What the argument\n checked stays checked: each json() of that context takes \"body satisfies Body\", and a TJsonResponse<X> return type\n of the function becomes TJsonResponse<unknown>, since json() no longer carries the body type.\n\nLeft as they are, for you: a handler of a CRUD override, a method that serves two routes or is also called another\nway, an inline or this.* config, and a context typed through an alias of yours. The typecheck then names each place\nwhere a type you wrote by hand differs from the schema. A valid<T>() keeps its argument\nwhere, without it, the call answers unknown (the route config carries no schema type there) or its method has a type\nerror (your type differs from the schema's). The codemod asks the types of each file's project (its nearest\ntsconfig.json), so upgrade the packages first.\nAn import or a local type that the rewrite leaves unused is removed. Every type error a rewritten file still has is\nlisted as \"check by hand\". Asking the types takes about twice as long as your typecheck.\n\nA config declared as IAuthRouteConfig, or in a Record of it, carries no schema type: change it to\n\"satisfies\" first (the lint rule @venizia/typed-route-context reports each one). A handler of such a config declared\nin the same file is left as it is; one imported from another file cannot be seen, so change those first.\n\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change (for CI)\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed since staged, or untracked): commit, stash or \"git add\" it first, so git can undo the codemod.";
62
+ static readonly USAGE = "Usage: devz codemod typed-route-context [paths...] [--write [--all] | --check]\n\nTypes route handlers from their route config (TContextOf), in two steps of one run.\n\nFirst, a config declared wide is rewritten, so that it keeps its schemas:\n\n- const A: IAuthRouteConfig = {...} becomes const A = {...} satisfies IAuthRouteConfig, and the same for a Record,\n Omit or Readonly of it, a type alias of those in the same file, a readonly class property and \"as IAuthRouteConfig\"\n on an object literal.\n\nListed as \"left\", with the reason, and kept: let, var, a property that is not readonly, no initializer, a value that\nis no object literal, a config typed through import(), a declaration the lint rule is turned off on, a binding that is written to later, a Record\nindexed with a key that is not a literal (without noImplicitAny, also with one it does not hold), and a declaration\nwhose rewrite adds a type error to a project of the run. The error is traced to a declaration through what its statement\nreads, the returns of the functions it names included; where that leads to several or to none, they are written by\nhalves, those of the failing file and its imports first. Each round prints a \"proving\" line. After 40 typecheck rounds\nthe rest are counted on one \"not tried\" line: write the others, \"git add\" or commit them (a file with local changes is\nrefused), then run it again.\nAn empty object filled later is not listed, as the lint rule does not report it. Only the projects (tsconfig.json) of\nthe files the codemod reads are checked, and a package that imports a rewritten config through its build output is\nread as it was last built: rebuild, then typecheck the packages that import it. The summary counts the exported configs\nit rewrites.\n\nThen, in a file that imports the types from @venizia/ignis or @venizia/ignis-kernel:\n\n- a decorated method (@api, @get, @post, @put, @patch, @del) whose configs is a name declared or imported in the\n file: its TRouteContext becomes TContextOf<typeof CONFIG>, and valid<T>() on it loses its type argument;\n- the same for a private method that only the handlers of one route config in its class pass their context to;\n- TRouteContext<Env, Body> drops the body, and TRouteHandler<Response, Env> drops the response. What the argument\n checked stays checked: each json() of that context takes \"body satisfies Body\", and a TJsonResponse<X> return type\n of the function becomes TJsonResponse<unknown>, since json() no longer carries the body type.\n\nLeft as they are, for you: a handler of a CRUD override, a method that serves two routes or is also called another\nway, an inline or this.* config, and a context typed through an alias of yours. The typecheck then names each place\nwhere a type you wrote by hand differs from the schema. A valid<T>() keeps its argument\nwhere, without it, the call answers unknown (the route config carries no schema type there) or its method has a type\nerror (your type differs from the schema's). The codemod asks the types of each file's project (its nearest\ntsconfig.json), so upgrade the packages first.\nAn import or a local type that the rewrite leaves unused is removed. Every type error a rewritten file still has is\nlisted as \"check by hand\". Asking the types typechecks those projects several times: the run takes a few times as long as your typecheck.\n\nA config left declared as IAuthRouteConfig carries no schema type. A handler of such a config declared in the same\nfile is left as it is; one imported from another file keeps the valid<T>() arguments that need it.\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 config is not tried (for CI); a config left as it is\n does not fail it\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files git\nknows (tracked, or untracked and not ignored), and --write refuses a file with local changes (changed since staged, or untracked): commit, stash or \"git add\" it first, so git can undo the codemod.";
63
+ /**
64
+ * The first step: per file, the text with its wide configs written as `satisfies`. A file in `dirtyFiles` is not
65
+ * rewritten (it is added to `refused`), so nothing is proved or typed against a text that will not be written.
66
+ */
67
+ private static satisfy;
53
68
  static run(opts: {
54
69
  root: string;
55
70
  args: string[];
@@ -5,11 +5,32 @@ const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  const binding_keys_1 = require("./binding-keys");
7
7
  const files_1 = require("./files");
8
+ const typed_route_context_satisfies_1 = require("./typed-route-context-satisfies");
8
9
  const cli_output_1 = require("../../common/cli-output");
9
10
  const USAGE = `Usage: devz codemod typed-route-context [paths...] [--write [--all] | --check]
10
11
 
11
- Types route handlers from their route config (TContextOf). In a file that imports the types from @venizia/ignis or
12
- @venizia/ignis-kernel:
12
+ Types route handlers from their route config (TContextOf), in two steps of one run.
13
+
14
+ First, a config declared wide is rewritten, so that it keeps its schemas:
15
+
16
+ - const A: IAuthRouteConfig = {...} becomes const A = {...} satisfies IAuthRouteConfig, and the same for a Record,
17
+ Omit or Readonly of it, a type alias of those in the same file, a readonly class property and "as IAuthRouteConfig"
18
+ on an object literal.
19
+
20
+ Listed as "left", with the reason, and kept: let, var, a property that is not readonly, no initializer, a value that
21
+ is no object literal, a config typed through import(), a declaration the lint rule is turned off on, a binding that is written to later, a Record
22
+ indexed with a key that is not a literal (without noImplicitAny, also with one it does not hold), and a declaration
23
+ whose rewrite adds a type error to a project of the run. The error is traced to a declaration through what its statement
24
+ reads, the returns of the functions it names included; where that leads to several or to none, they are written by
25
+ halves, those of the failing file and its imports first. Each round prints a "proving" line. After 40 typecheck rounds
26
+ the rest are counted on one "not tried" line: write the others, "git add" or commit them (a file with local changes is
27
+ refused), then run it again.
28
+ An empty object filled later is not listed, as the lint rule does not report it. Only the projects (tsconfig.json) of
29
+ the files the codemod reads are checked, and a package that imports a rewritten config through its build output is
30
+ read as it was last built: rebuild, then typecheck the packages that import it. The summary counts the exported configs
31
+ it rewrites.
32
+
33
+ Then, in a file that imports the types from @venizia/ignis or @venizia/ignis-kernel:
13
34
 
14
35
  - a decorated method (@api, @get, @post, @put, @patch, @del) whose configs is a name declared or imported in the
15
36
  file: its TRouteContext becomes TContextOf<typeof CONFIG>, and valid<T>() on it loses its type argument;
@@ -25,15 +46,15 @@ where, without it, the call answers unknown (the route config carries no schema
25
46
  error (your type differs from the schema's). The codemod asks the types of each file's project (its nearest
26
47
  tsconfig.json), so upgrade the packages first.
27
48
  An import or a local type that the rewrite leaves unused is removed. Every type error a rewritten file still has is
28
- listed as "check by hand". Asking the types takes about twice as long as your typecheck.
49
+ listed as "check by hand". Asking the types typechecks those projects several times: the run takes a few times as long as your typecheck.
29
50
 
30
- A config declared as IAuthRouteConfig, or in a Record of it, carries no schema type: change it to
31
- "satisfies" first (the lint rule @venizia/typed-route-context reports each one). A handler of such a config declared
32
- in the same file is left as it is; one imported from another file cannot be seen, so change those first.
51
+ A config left declared as IAuthRouteConfig carries no schema type. A handler of such a config declared in the same
52
+ file is left as it is; one imported from another file keeps the valid<T>() arguments that need it.
33
53
 
34
54
  --write write the changed files (without it, nothing is written); it needs a path, or --all
35
55
  --all with --write and no path: rewrite every source file under the working directory
36
- --check dry run that exits 1 while a file would change (for CI)
56
+ --check dry run that exits 1 while a file would change or a config is not tried (for CI); a config left as it is
57
+ does not fail it
37
58
  --help print this text and exit
38
59
 
39
60
  With no flag it lists what would change and writes nothing. Inside a git repository it reads the files git
@@ -746,17 +767,16 @@ class TypedRouteContext {
746
767
  }
747
768
  return remaining;
748
769
  }
749
- /** Each of `files` with the program of its own project (its nearest tsconfig.json), the rewritten text read. */
750
- static check(opts) {
751
- const { typescript: ts, root, results, files } = opts;
770
+ /** The program of each project (a file's nearest tsconfig.json) among `files`, with `contents` read in their place. */
771
+ static programs(opts) {
772
+ const { typescript: ts, root, files, contents } = opts;
752
773
  const projects = new Map();
753
774
  for (const file of files) {
754
775
  const config = ts.findConfigFile((0, node_path_1.dirname)(file), (path) => ts.sys.fileExists(path));
755
776
  const project = config === undefined ? root : (0, node_path_1.dirname)(config);
756
777
  projects.set(project, [...(projects.get(project) ?? []), file]);
757
778
  }
758
- const contents = new Map([...results].map(([file, result]) => [file, result.output]));
759
- return [...projects].flatMap(([project, owned]) => {
779
+ return [...projects].map(([project, owned]) => {
760
780
  const program = binding_keys_1.BindingKeysCommand.createProgram({
761
781
  typescript: ts,
762
782
  root: project,
@@ -764,9 +784,15 @@ class TypedRouteContext {
764
784
  contents,
765
785
  withProjectFiles: true,
766
786
  });
767
- return owned.map((file) => ({ file, program }));
787
+ return { program, owned };
768
788
  });
769
789
  }
790
+ /** Each of `files` with the program of its own project, the rewritten text read. */
791
+ static check(opts) {
792
+ const { results } = opts;
793
+ const contents = new Map([...results].map(([file, result]) => [file, result.output]));
794
+ return TypedRouteContext.programs({ ...opts, contents }).flatMap(({ program, owned }) => owned.map((file) => ({ file, program })));
795
+ }
770
796
  static keptIn(opts) {
771
797
  const { typescript: ts, program, file, dropped } = opts;
772
798
  const sourceFile = program.getSourceFile(file);
@@ -799,6 +825,57 @@ exports.TypedRouteContext = TypedRouteContext;
799
825
  */
800
826
  class TypedRouteContextCommand {
801
827
  static { this.USAGE = USAGE; }
828
+ /**
829
+ * The first step: per file, the text with its wide configs written as `satisfies`. A file in `dirtyFiles` is not
830
+ * rewritten (it is added to `refused`), so nothing is proved or typed against a text that will not be written.
831
+ */
832
+ static satisfy(opts) {
833
+ const { typescript, root, sources, dirtyFiles, refused } = opts;
834
+ const scanned = [...sources].map(([fileName, source]) => typed_route_context_satisfies_1.SatisfiesRewrite.scan({ typescript, fileName, source }));
835
+ const candidates = scanned
836
+ .flatMap((item) => item.candidates)
837
+ .filter(({ file }) => {
838
+ const isDirty = dirtyFiles.has(file);
839
+ if (isDirty) {
840
+ refused.add(file);
841
+ }
842
+ return !isDirty;
843
+ });
844
+ let proving = [...sources.keys()];
845
+ let roundLimit = 0;
846
+ const proof = typed_route_context_satisfies_1.SatisfiesRewrite.prove({
847
+ typescript,
848
+ root,
849
+ sources,
850
+ candidates,
851
+ // Only a project that reads a candidate is built again for the next round.
852
+ programs: (contents) => {
853
+ const holding = TypedRouteContext.programs({
854
+ typescript,
855
+ root,
856
+ files: proving,
857
+ contents,
858
+ }).filter(({ program }) => candidates.some(({ file }) => program.getSourceFile(file)));
859
+ proving = holding.flatMap(({ owned }) => owned);
860
+ return holding.map(({ program }) => program);
861
+ },
862
+ onRound: ({ round, limit, inDoubt }) => {
863
+ cli_output_1.CliOutput.log(`proving round ${round}/${limit}, ${inDoubt} config(s) in doubt`);
864
+ roundLimit = limit;
865
+ },
866
+ });
867
+ const { contents } = typed_route_context_satisfies_1.TextEdits.writeAll({ sources, candidates: proof.accepted });
868
+ const files = new Map([...contents].map(([file, output]) => {
869
+ const rewritten = proof.accepted.filter((candidate) => candidate.file === file).length;
870
+ return [file, { output, rewritten }];
871
+ }));
872
+ const left = [...scanned.flatMap((item) => item.left), ...proof.left].sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
873
+ // A declaration with several assertions is one config.
874
+ const exported = new Set(proof.accepted
875
+ .filter((candidate) => candidate.isExported)
876
+ .map(({ file, binding, start }) => `${file}:${binding ?? start}`)).size;
877
+ return { files, left, exported, untried: proof.untried, roundLimit };
878
+ }
802
879
  static async run(opts) {
803
880
  const { root, args } = opts;
804
881
  if (args.includes(TypedRouteContextFlags.HELP) ||
@@ -839,10 +916,6 @@ class TypedRouteContextCommand {
839
916
  return 1;
840
917
  }
841
918
  const targets = (paths.length > 0 ? paths : ['.']).map((path) => (0, node_path_1.resolve)(root, path));
842
- let changedCount = 0;
843
- let rewrittenCount = 0;
844
- let refusedCount = 0;
845
- const results = new Map();
846
919
  const sources = new Map();
847
920
  const dirtyFiles = new Set();
848
921
  for (const target of targets) {
@@ -852,21 +925,39 @@ class TypedRouteContextCommand {
852
925
  cli_output_1.CliOutput.warn(`devz codemod: no source files under "${(0, node_path_1.relative)(root, target) || target}" (git ignores the path, or it holds none): nothing was read`);
853
926
  }
854
927
  for (const file of files) {
855
- const source = (0, node_fs_1.readFileSync)(file, 'utf8');
856
- if (!source.includes(CONTEXT) && !source.includes(HANDLER)) {
857
- continue;
858
- }
859
- const result = TypedRouteContext.rewrite({ typescript, fileName: file, source });
860
- if (!result.changed) {
861
- continue;
862
- }
863
- sources.set(file, source);
864
- results.set(file, result);
928
+ sources.set(file, (0, node_fs_1.readFileSync)(file, 'utf8'));
865
929
  if (dirty?.has(file)) {
866
930
  dirtyFiles.add(file);
867
931
  }
868
932
  }
869
933
  }
934
+ const refused = new Set();
935
+ const satisfied = TypedRouteContextCommand.satisfy({
936
+ typescript,
937
+ root,
938
+ sources,
939
+ dirtyFiles,
940
+ refused,
941
+ });
942
+ const results = new Map();
943
+ const inputs = new Map();
944
+ for (const [file, original] of sources) {
945
+ const first = satisfied.files.get(file);
946
+ const source = first?.output ?? original;
947
+ const isRead = source.includes(CONTEXT) || source.includes(HANDLER);
948
+ const result = isRead
949
+ ? TypedRouteContext.rewrite({ typescript, fileName: file, source })
950
+ : undefined;
951
+ if (!result?.changed && !first) {
952
+ continue;
953
+ }
954
+ if (dirtyFiles.has(file)) {
955
+ refused.add(file);
956
+ continue;
957
+ }
958
+ inputs.set(file, source);
959
+ results.set(file, result?.changed ? result : { output: source, changed: true, rewritten: 0, dropped: [] });
960
+ }
870
961
  const kept = TypedRouteContext.keptCalls({ typescript, root, results });
871
962
  const finals = new Map();
872
963
  for (const [file, first] of results) {
@@ -875,23 +966,25 @@ class TypedRouteContextCommand {
875
966
  ? TypedRouteContext.rewrite({
876
967
  typescript,
877
968
  fileName: file,
878
- source: sources.get(file) ?? '',
969
+ source: inputs.get(file) ?? '',
879
970
  keep,
880
971
  })
881
972
  : first);
882
973
  }
883
974
  const remaining = TypedRouteContext.remainingErrors({ typescript, root, results: finals });
975
+ const show = (file) => (0, node_path_1.relative)(root, file).split('\\').join('/') || file;
976
+ let changedCount = 0;
977
+ let rewrittenCount = 0;
978
+ for (const file of refused) {
979
+ cli_output_1.CliOutput.warn(`refused ${show(file)} has local changes (commit, stash or "git add" them, then run again)`);
980
+ }
884
981
  for (const [file, result] of finals) {
885
982
  const keep = kept.get(file);
886
- const shown = (0, node_path_1.relative)(root, file).split('\\').join('/') || file;
887
- if (dirtyFiles.has(file)) {
888
- refusedCount += 1;
889
- cli_output_1.CliOutput.warn(`refused ${shown} has local changes (commit, stash or "git add" them, then run again)`);
890
- continue;
891
- }
983
+ const shown = show(file);
984
+ const rewritten = result.rewritten + (satisfied.files.get(file)?.rewritten ?? 0);
892
985
  changedCount += 1;
893
- rewrittenCount += result.rewritten;
894
- cli_output_1.CliOutput.log(`${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} place(s))`);
986
+ rewrittenCount += rewritten;
987
+ cli_output_1.CliOutput.log(`${isWrite ? 'changed' : 'would change'} ${shown} (${rewritten} place(s))`);
895
988
  if (keep) {
896
989
  cli_output_1.CliOutput.warn(`kept ${shown} ${keep.size} valid<T>() type argument(s): without them the method does not type-check, or a call answers unknown; compare each with the route's schema`);
897
990
  }
@@ -903,15 +996,33 @@ class TypedRouteContextCommand {
903
996
  (0, node_fs_1.writeFileSync)(file, result.output);
904
997
  }
905
998
  }
999
+ for (const { file, line, name, reason } of satisfied.left) {
1000
+ cli_output_1.CliOutput.warn(`left ${show(file)}:${line} ${name}: ${reason}`);
1001
+ }
1002
+ if (satisfied.untried.length > 0) {
1003
+ const files = [...new Set(satisfied.untried.map(({ file }) => show(file)))];
1004
+ const next = isWrite
1005
+ ? '"git add" or commit what it wrote'
1006
+ : 'Run with --write, "git add" or commit what it writes';
1007
+ cli_output_1.CliOutput.warn(`not tried ${satisfied.untried.length} config(s) in ${files.join(', ')}: the codemod stops after ${satisfied.roundLimit} typecheck rounds. ${next}, then run it again`);
1008
+ }
1009
+ const refusedCount = refused.size;
1010
+ const leftCount = satisfied.left.length;
906
1011
  cli_output_1.CliOutput.log(`devz codemod typed-route-context: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${rewrittenCount} place(s) ${isWrite ? 'rewritten' : 'would be rewritten'}` +
1012
+ (leftCount > 0 ? `, ${leftCount} config(s) left as declared` : '') +
1013
+ (satisfied.untried.length > 0 ? `, ${satisfied.untried.length} config(s) not tried` : '') +
907
1014
  (refusedCount > 0 ? `, ${refusedCount} refused` : ''));
1015
+ if (satisfied.exported > 0) {
1016
+ cli_output_1.CliOutput.log(`devz codemod typed-route-context: ${satisfied.exported} exported config(s) ${isWrite ? 'rewritten' : 'would be rewritten'}: typecheck their importers outside this run`);
1017
+ }
908
1018
  if (!isWrite && changedCount > 0) {
909
1019
  cli_output_1.CliOutput.log(`Nothing was written. Run again with ${TypedRouteContextFlags.WRITE} to apply, then run your typecheck.`);
910
1020
  }
911
1021
  if (isWrite && refusedCount > 0) {
912
1022
  return 1;
913
1023
  }
914
- return isCheck && changedCount > 0 ? 1 : 0;
1024
+ // A config not tried is settled by another run, so the work is not finished.
1025
+ return isCheck && (changedCount > 0 || satisfied.untried.length > 0) ? 1 : 0;
915
1026
  }
916
1027
  }
917
1028
  exports.TypedRouteContextCommand = TypedRouteContextCommand;