@venizia/dev-configs 0.5.0-0 → 0.5.0-10

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 (177) hide show
  1. package/README.md +18 -13
  2. package/dist/checks/purity/manifest.js +11 -3
  3. package/dist/checks/purity/manifest.js.map +1 -1
  4. package/dist/checks/purity/probe.js +19 -2
  5. package/dist/checks/purity/probe.js.map +1 -1
  6. package/dist/checks/split-report.js +2 -1
  7. package/dist/checks/split-report.js.map +1 -1
  8. package/dist/checks/test-controls.d.ts +9 -1
  9. package/dist/checks/test-controls.js +9 -3
  10. package/dist/checks/test-controls.js.map +1 -1
  11. package/dist/checks/test-dead-code.d.ts +9 -1
  12. package/dist/checks/test-dead-code.js +13 -2
  13. package/dist/checks/test-dead-code.js.map +1 -1
  14. package/dist/checks/test-mutate.d.ts +9 -1
  15. package/dist/checks/test-mutate.js +12 -6
  16. package/dist/checks/test-mutate.js.map +1 -1
  17. package/dist/cli/check.js +42 -38
  18. package/dist/cli/check.js.map +1 -1
  19. package/dist/cli/clean.js +3 -2
  20. package/dist/cli/clean.js.map +1 -1
  21. package/dist/cli/codemod/any-aliases.d.ts +1 -1
  22. package/dist/cli/codemod/any-aliases.js +14 -13
  23. package/dist/cli/codemod/any-aliases.js.map +1 -1
  24. package/dist/cli/codemod/async-style.d.ts +1 -1
  25. package/dist/cli/codemod/async-style.js +18 -17
  26. package/dist/cli/codemod/async-style.js.map +1 -1
  27. package/dist/cli/codemod/binding-keys.d.ts +32 -1
  28. package/dist/cli/codemod/binding-keys.js +251 -68
  29. package/dist/cli/codemod/binding-keys.js.map +1 -1
  30. package/dist/cli/codemod/class-renames.d.ts +39 -0
  31. package/dist/cli/codemod/class-renames.js +297 -0
  32. package/dist/cli/codemod/class-renames.js.map +1 -0
  33. package/dist/cli/codemod/connector-imports.d.ts +1 -1
  34. package/dist/cli/codemod/connector-imports.js +13 -12
  35. package/dist/cli/codemod/connector-imports.js.map +1 -1
  36. package/dist/cli/codemod/const-class-sets.d.ts +55 -0
  37. package/dist/cli/codemod/const-class-sets.js +219 -0
  38. package/dist/cli/codemod/const-class-sets.js.map +1 -0
  39. package/dist/cli/codemod/const-classes.d.ts +21 -3
  40. package/dist/cli/codemod/const-classes.js +151 -36
  41. package/dist/cli/codemod/const-classes.js.map +1 -1
  42. package/dist/cli/codemod/drop-redundant-casts.d.ts +6 -1
  43. package/dist/cli/codemod/drop-redundant-casts.js +27 -19
  44. package/dist/cli/codemod/drop-redundant-casts.js.map +1 -1
  45. package/dist/cli/codemod/env-get.d.ts +3 -3
  46. package/dist/cli/codemod/env-get.js +19 -18
  47. package/dist/cli/codemod/env-get.js.map +1 -1
  48. package/dist/cli/codemod/files.d.ts +4 -2
  49. package/dist/cli/codemod/files.js +7 -8
  50. package/dist/cli/codemod/files.js.map +1 -1
  51. package/dist/cli/codemod/function-to-arrow.d.ts +76 -0
  52. package/dist/cli/codemod/function-to-arrow.js +357 -0
  53. package/dist/cli/codemod/function-to-arrow.js.map +1 -0
  54. package/dist/cli/codemod/index.js +25 -4
  55. package/dist/cli/codemod/index.js.map +1 -1
  56. package/dist/cli/codemod/namespace-functions/index.d.ts +1 -1
  57. package/dist/cli/codemod/namespace-functions/index.js +14 -13
  58. package/dist/cli/codemod/namespace-functions/index.js.map +1 -1
  59. package/dist/cli/codemod/namespace-functions/mappings/dev-configs.js +3 -3
  60. package/dist/cli/codemod/namespace-functions/mappings/dev-configs.js.map +1 -1
  61. package/dist/cli/codemod/namespace-functions/mappings/helpers.js +1 -1
  62. package/dist/cli/codemod/namespace-functions/mappings/helpers.js.map +1 -1
  63. package/dist/cli/codemod/typed-route-context.d.ts +58 -0
  64. package/dist/cli/codemod/typed-route-context.js +918 -0
  65. package/dist/cli/codemod/typed-route-context.js.map +1 -0
  66. package/dist/cli/index.js +5 -4
  67. package/dist/cli/index.js.map +1 -1
  68. package/dist/common/cli-output.d.ts +16 -0
  69. package/dist/common/cli-output.js +49 -0
  70. package/dist/common/cli-output.js.map +1 -0
  71. package/dist/compilers/bun.js +1 -1
  72. package/dist/compilers/bun.js.map +1 -1
  73. package/dist/linters/eslint.js +1 -1
  74. package/dist/linters/eslint.js.map +1 -1
  75. package/dist/linters/house/browser-api-patterns.d.ts +43 -0
  76. package/dist/linters/house/browser-api-patterns.js +87 -0
  77. package/dist/linters/house/browser-api-patterns.js.map +1 -0
  78. package/dist/linters/house/common.d.ts +17 -2
  79. package/dist/linters/house/common.js +18 -2
  80. package/dist/linters/house/common.js.map +1 -1
  81. package/dist/linters/house/configs.js +25 -0
  82. package/dist/linters/house/configs.js.map +1 -1
  83. package/dist/linters/house/const-class-values.rule.d.ts +2 -2
  84. package/dist/linters/house/const-class-values.rule.js +14 -5
  85. package/dist/linters/house/const-class-values.rule.js.map +1 -1
  86. package/dist/linters/house/effect-cleanup-consistency.rule.d.ts +2 -2
  87. package/dist/linters/house/effect-cleanup-consistency.rule.js +1 -1
  88. package/dist/linters/house/effect-cleanup-consistency.rule.js.map +1 -1
  89. package/dist/linters/house/framework-api-patterns.d.ts +54 -0
  90. package/dist/linters/house/framework-api-patterns.js +62 -0
  91. package/dist/linters/house/framework-api-patterns.js.map +1 -0
  92. package/dist/linters/house/framework-exports.d.ts +62 -0
  93. package/dist/linters/house/framework-exports.js +325 -0
  94. package/dist/linters/house/framework-exports.js.map +1 -0
  95. package/dist/linters/house/import-support.d.ts +56 -0
  96. package/dist/linters/house/import-support.js +179 -0
  97. package/dist/linters/house/import-support.js.map +1 -0
  98. package/dist/linters/house/index.d.ts +12 -0
  99. package/dist/linters/house/index.js +15 -1
  100. package/dist/linters/house/index.js.map +1 -1
  101. package/dist/linters/house/max-params-own.rule.d.ts +2 -2
  102. package/dist/linters/house/max-params-own.rule.js +1 -1
  103. package/dist/linters/house/max-params-own.rule.js.map +1 -1
  104. package/dist/linters/house/no-async-hook-callback.rule.d.ts +2 -2
  105. package/dist/linters/house/no-async-hook-callback.rule.js +1 -1
  106. package/dist/linters/house/no-async-hook-callback.rule.js.map +1 -1
  107. package/dist/linters/house/no-await-new-chain.rule.d.ts +2 -2
  108. package/dist/linters/house/no-await-new-chain.rule.js +1 -1
  109. package/dist/linters/house/no-await-new-chain.rule.js.map +1 -1
  110. package/dist/linters/house/no-await-promise-chain.rule.d.ts +2 -2
  111. package/dist/linters/house/no-await-promise-chain.rule.js +5 -5
  112. package/dist/linters/house/no-await-promise-chain.rule.js.map +1 -1
  113. package/dist/linters/house/no-inline-await.rule.d.ts +2 -2
  114. package/dist/linters/house/no-inline-await.rule.js +1 -1
  115. package/dist/linters/house/no-inline-await.rule.js.map +1 -1
  116. package/dist/linters/house/no-leaked-render.rule.d.ts +2 -2
  117. package/dist/linters/house/no-leaked-render.rule.js +1 -1
  118. package/dist/linters/house/no-leaked-render.rule.js.map +1 -1
  119. package/dist/linters/house/no-new-error.rule.d.ts +2 -2
  120. package/dist/linters/house/no-new-error.rule.js +2 -2
  121. package/dist/linters/house/no-new-error.rule.js.map +1 -1
  122. package/dist/linters/house/no-parent-import.rule.d.ts +45 -0
  123. package/dist/linters/house/no-parent-import.rule.js +176 -0
  124. package/dist/linters/house/no-parent-import.rule.js.map +1 -0
  125. package/dist/linters/house/no-return-await.rule.d.ts +2 -2
  126. package/dist/linters/house/no-return-await.rule.js +1 -1
  127. package/dist/linters/house/no-return-await.rule.js.map +1 -1
  128. package/dist/linters/house/no-shadow-framework-type.rule.d.ts +24 -0
  129. package/dist/linters/house/no-shadow-framework-type.rule.js +100 -0
  130. package/dist/linters/house/no-shadow-framework-type.rule.js.map +1 -0
  131. package/dist/linters/house/no-silent-catch.rule.d.ts +2 -2
  132. package/dist/linters/house/no-silent-catch.rule.js +3 -3
  133. package/dist/linters/house/no-silent-catch.rule.js.map +1 -1
  134. package/dist/linters/house/no-unbraced-case.rule.d.ts +2 -2
  135. package/dist/linters/house/no-unbraced-case.rule.js +1 -1
  136. package/dist/linters/house/no-unbraced-case.rule.js.map +1 -1
  137. package/dist/linters/house/plugin.d.ts +1 -1
  138. package/dist/linters/house/plugin.js +18 -2
  139. package/dist/linters/house/plugin.js.map +1 -1
  140. package/dist/linters/house/prefer-framework-api.rule.d.ts +83 -0
  141. package/dist/linters/house/prefer-framework-api.rule.js +562 -0
  142. package/dist/linters/house/prefer-framework-api.rule.js.map +1 -0
  143. package/dist/linters/house/prefer-http-method.rule.d.ts +22 -0
  144. package/dist/linters/house/prefer-http-method.rule.js +182 -0
  145. package/dist/linters/house/prefer-http-method.rule.js.map +1 -0
  146. package/dist/linters/house/prefer-promise-sleep.rule.d.ts +26 -0
  147. package/dist/linters/house/prefer-promise-sleep.rule.js +155 -0
  148. package/dist/linters/house/prefer-promise-sleep.rule.js.map +1 -0
  149. package/dist/linters/house/prefer-tnullable.rule.d.ts +25 -0
  150. package/dist/linters/house/prefer-tnullable.rule.js +124 -0
  151. package/dist/linters/house/prefer-tnullable.rule.js.map +1 -0
  152. package/dist/linters/house/typed-route-context.rule.d.ts +19 -0
  153. package/dist/linters/house/typed-route-context.rule.js +334 -0
  154. package/dist/linters/house/typed-route-context.rule.js.map +1 -0
  155. package/dist/linters/house/zod-schema-convention.rule.d.ts +82 -0
  156. package/dist/linters/house/zod-schema-convention.rule.js +477 -0
  157. package/dist/linters/house/zod-schema-convention.rule.js.map +1 -0
  158. package/dist/linters/oxlint.js +11 -1
  159. package/dist/linters/oxlint.js.map +1 -1
  160. package/dist/linters/react-eslint.js.map +1 -1
  161. package/dist/linters/rules/naming-convention.rule.d.ts +4 -1
  162. package/dist/linters/rules/naming-convention.rule.js +30 -1
  163. package/dist/linters/rules/naming-convention.rule.js.map +1 -1
  164. package/dist/linters/rules/no-restricted-properties.rule.js +1 -1
  165. package/dist/linters/rules/no-restricted-properties.rule.js.map +1 -1
  166. package/dist/testing/index.d.ts +2 -2
  167. package/dist/testing/index.js +2 -2
  168. package/dist/testing/index.js.map +1 -1
  169. package/dist/testing/{rejection.helper.d.ts → rejection.utility.d.ts} +4 -4
  170. package/dist/testing/{rejection.helper.js → rejection.utility.js} +7 -7
  171. package/dist/testing/rejection.utility.js.map +1 -0
  172. package/dist/testing/{spawn.helper.d.ts → spawn.utility.d.ts} +2 -2
  173. package/dist/testing/{spawn.helper.js → spawn.utility.js} +6 -6
  174. package/dist/testing/spawn.utility.js.map +1 -0
  175. package/package.json +7 -7
  176. package/dist/testing/rejection.helper.js.map +0 -1
  177. package/dist/testing/spawn.helper.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-route-context.js","sourceRoot":"","sources":["../../../src/cli/codemod/typed-route-context.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,yCAAuD;AAEvD,iDAAoD;AACpD,mCAAuC;AACvC,wDAAoD;AAEpD,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qMA+BuL,CAAC;AAEtM,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,sBAAsB;aACV,UAAK,GAAG,SAAS,CAAC;aAClB,QAAG,GAAG,OAAO,CAAC;aACd,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,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;;AAGH,MAAM,QAAQ,GAAG,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;AAC7D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC1E,M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esContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, relative, resolve } from 'node:path';\nimport type TypeScript from 'typescript';\nimport { BindingKeysCommand } from './binding-keys';\nimport { CodemodFiles } from './files';\nimport { CliOutput } from '../../common/cli-output';\n\nconst 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.`;\n\n/** A usage error: nothing was read or written. */\nconst USAGE_ERROR_CODE = 2;\n\nclass TypedRouteContextFlags {\n static readonly WRITE = '--write';\n static readonly ALL = '--all';\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.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\nconst PACKAGES = ['@venizia/ignis', '@venizia/ignis-kernel'];\nconst DECORATORS = new Set(['api', 'get', 'post', 'put', 'patch', 'del']);\nconst CONTEXT = 'TRouteContext';\nconst HANDLER = 'TRouteHandler';\nconst TYPED = 'TContextOf';\nconst RESPONSE = 'TJsonResponse';\n\n/** A `valid<T>()` whose type argument was dropped: where the call and its method are, in the source and the output. */\nexport interface IDroppedTypeArgument {\n source: number;\n output: number;\n /** The span of the method that holds the call, in the output. */\n method: { start: number; end: number };\n}\n\nexport interface ITypedRouteContextResult {\n output: string;\n changed: boolean;\n /** How many places were rewritten. */\n rewritten: number;\n dropped: IDroppedTypeArgument[];\n}\n\n/** One file's rewrite: the edits found so far, applied from the end of the file. */\nclass RouteContextFile {\n private static readonly IDENTIFIER = /^[A-Za-z_$][\\w$]*$/;\n private readonly file: TypeScript.SourceFile;\n private readonly edits = new Map<string, { start: number; end: number; text: string }>();\n /** Where each call that lost its type argument starts. */\n private readonly droppedAt: Array<{ call: number; method: TypeScript.Node }> = [];\n /** The local names the framework's types were imported under. */\n private readonly locals = new Map<string, string>();\n /** The names a `typeof` at the top of the file can read. */\n private readonly topLevel = new Set<string>();\n /** The configs this file declares as `IAuthRouteConfig`, as a name or `Class.member`: their type holds no schema. */\n private readonly wide = new Set<string>();\n\n constructor(\n private readonly options: {\n typescript: typeof TypeScript;\n fileName: string;\n source: string;\n /** The calls, by where they start, that keep their type argument. */\n keep?: ReadonlySet<number>;\n },\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 rewrite(): ITypedRouteContextResult {\n const { typescript: ts, source } = this.options;\n this.readTopLevel();\n\n if (this.locals.size === 0) {\n return { output: source, changed: false, rewritten: 0, dropped: [] };\n }\n\n const visit = (node: TypeScript.Node): void => {\n if (ts.isClassLike(node)) {\n this.typeClass(node);\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(this.file);\n this.keepBodyChecks(this.file);\n this.dropRemovedArguments(this.file);\n const rewritten = this.edits.size;\n\n if (rewritten === 0) {\n return { output: source, changed: false, rewritten, dropped: [] };\n }\n\n this.fixDeclarations();\n let output = source;\n\n for (const edit of [...this.edits.values()].sort((a, b) => b.start - a.start)) {\n output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);\n }\n\n // An edit before a position moves it by what the edit adds or takes away.\n const moved = (position: number) =>\n [...this.edits.values()]\n .filter((edit) => edit.end <= position)\n .reduce((total, edit) => total + edit.text.length - (edit.end - edit.start), position);\n const dropped = this.droppedAt.map(({ call, method }) => ({\n source: call,\n output: moved(call),\n method: { start: moved(method.getStart(this.file)), end: moved(method.getEnd()) },\n }));\n\n return { output, changed: output !== source, rewritten, dropped };\n }\n\n private replace(opts: { start: number; end: number; text: string }) {\n this.edits.set(`${opts.start}:${opts.end}`, opts);\n }\n\n private isReplaced(node: TypeScript.Node): boolean {\n return this.edits.has(`${node.getStart(this.file)}:${node.getEnd()}`);\n }\n\n private readTopLevel() {\n const { typescript: ts } = this.options;\n\n for (const statement of this.file.statements) {\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n const name = declaration.name.getText(this.file);\n this.topLevel.add(name);\n\n if (this.isWideDeclaration(declaration)) {\n this.wide.add(name);\n }\n\n this.readWideMembers({ owner: name, value: declaration.initializer });\n }\n }\n\n if (ts.isClassDeclaration(statement) && statement.name) {\n const owner = statement.name.text;\n this.topLevel.add(owner);\n\n for (const member of statement.members) {\n if (ts.isPropertyDeclaration(member) && this.isWideDeclaration(member)) {\n this.wide.add(`${owner}.${member.name.getText(this.file)}`);\n }\n }\n }\n\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const specifier = statement.moduleSpecifier.getText(this.file).slice(1, -1);\n const bindings = statement.importClause?.namedBindings;\n const defaultName = statement.importClause?.name;\n\n if (defaultName) {\n this.topLevel.add(defaultName.text);\n }\n\n if (!bindings) {\n continue;\n }\n\n if (ts.isNamespaceImport(bindings)) {\n this.topLevel.add(bindings.name.text);\n continue;\n }\n\n const isFramework = PACKAGES.some(\n (name) => specifier === name || specifier.startsWith(`${name}/`),\n );\n\n for (const element of bindings.elements) {\n this.topLevel.add(element.name.text);\n const imported = (element.propertyName ?? element.name).text;\n\n if (isFramework && [CONTEXT, HANDLER, TYPED, RESPONSE].includes(imported)) {\n this.locals.set(element.name.text, imported);\n }\n }\n }\n }\n\n /** The members of an object literal asserted wide one by one: `{ A: { ... } as IAuthRouteConfig }`. */\n private readWideMembers(opts: { owner: string; value: TypeScript.Expression | undefined }) {\n const { typescript: ts } = this.options;\n let { value } = opts;\n\n while (value && (ts.isAsExpression(value) || ts.isSatisfiesExpression(value))) {\n value = value.expression;\n }\n\n if (!value || !ts.isObjectLiteralExpression(value)) {\n return;\n }\n\n for (const property of value.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n ts.isAsExpression(property.initializer) &&\n this.isWideType(property.initializer.type)\n ) {\n const key = ts.isStringLiteralLike(property.name)\n ? property.name.text\n : property.name.getText(this.file);\n this.wide.add(`${opts.owner}.${key}`);\n }\n }\n }\n\n /** Whether a declaration is typed `IAuthRouteConfig`, in an `Omit` or a `Record` too, by annotation or by `as`. */\n private isWideDeclaration(\n declaration: TypeScript.VariableDeclaration | TypeScript.PropertyDeclaration,\n ): boolean {\n const { typescript: ts } = this.options;\n const { initializer } = declaration;\n const asserted = initializer && ts.isAsExpression(initializer) ? initializer.type : undefined;\n\n return this.isWideType(declaration.type) || this.isWideType(asserted);\n }\n\n private isWideType(type: TypeScript.TypeNode | undefined): boolean {\n const { typescript: ts } = this.options;\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.isWideType(second);\n }\n\n return name === 'Omit' || name === 'Readonly'\n ? this.isWideType(first)\n : name === 'IAuthRouteConfig';\n }\n\n /** The framework type a type reference names. */\n private frameworkType(node: TypeScript.Node): string | undefined {\n const { typescript: ts } = this.options;\n\n return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName)\n ? this.locals.get(node.typeName.text)\n : undefined;\n }\n\n /**\n * The type of a `configs` expression a `typeof` can read here (`typeof Routes.CREATE`, `(typeof Routes)['/create']`);\n * `undefined` for anything else.\n */\n private configOf(options: TypeScript.Expression | undefined): string | undefined {\n const { typescript: ts } = this.options;\n\n if (!options || !ts.isObjectLiteralExpression(options)) {\n return undefined;\n }\n\n const property = options.properties.find((item) => item.name?.getText(this.file) === 'configs');\n\n if (!property || !ts.isPropertyAssignment(property)) {\n return undefined;\n }\n\n const keys: string[] = [];\n let current: TypeScript.Expression = property.initializer;\n\n while (ts.isPropertyAccessExpression(current) || ts.isElementAccessExpression(current)) {\n if (ts.isPropertyAccessExpression(current)) {\n keys.unshift(current.name.text);\n } else if (ts.isStringLiteralLike(current.argumentExpression)) {\n keys.unshift(current.argumentExpression.text);\n } else {\n return undefined;\n }\n\n current = current.expression;\n }\n\n if (!ts.isIdentifier(current) || !this.topLevel.has(current.text)) {\n return undefined;\n }\n\n if (this.wide.has(current.text) || this.wide.has(`${current.text}.${keys[0]}`)) {\n return undefined;\n }\n\n const firstQuoted = keys.findIndex((key) => !RouteContextFile.IDENTIFIER.test(key));\n const dotted = firstQuoted === -1 ? keys : keys.slice(0, firstQuoted);\n const query = `typeof ${[current.text, ...dotted].join('.')}`;\n\n if (firstQuoted === -1) {\n return query;\n }\n\n const indexed = keys\n .slice(firstQuoted)\n .map((key) => `['${key.replaceAll('\\\\', '\\\\\\\\').replaceAll(\"'\", \"\\\\'\")}']`);\n\n return `(${query})${indexed.join('')}`;\n }\n\n /** Types the decorated methods of a class, and the methods only one route's handlers pass their context to. */\n private typeClass(node: TypeScript.ClassLikeDeclaration) {\n const { typescript: ts } = this.options;\n const forwarded = this.forwardsOf(node);\n\n for (const member of node.members) {\n if (!ts.isMethodDeclaration(member)) {\n continue;\n }\n\n const decorated = (ts.getDecorators(member) ?? []).flatMap((decorator) => {\n const call = decorator.expression;\n\n return ts.isCallExpression(call) && DECORATORS.has(call.expression.getText(this.file))\n ? [this.configOf(call.arguments[0])]\n : [];\n });\n const isPrivate =\n ts.isPrivateIdentifier(member.name) ||\n member.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword) ===\n true;\n\n // Only a private method is known to be reached from this class alone.\n if (decorated.length === 0 && !isPrivate) {\n continue;\n }\n\n const routes = [...decorated, ...(forwarded.get(member.name.getText(this.file)) ?? [])];\n const [config] = routes;\n\n if (config !== undefined && routes.every((route) => route === config)) {\n this.typeMethod({ method: member, config });\n }\n }\n }\n\n /**\n * The routes whose handlers pass their context straight to each method of the class. A method also reached another\n * way gets an `undefined` route, which keeps it as it is.\n */\n private forwardsOf(node: TypeScript.ClassLikeDeclaration) {\n const { typescript: ts } = this.options;\n const routes = new Map<string, Array<string | undefined>>();\n const passed = new Set<TypeScript.Node>();\n\n const add = (method: string, route: string | undefined) => {\n routes.set(method, [...(routes.get(method) ?? []), route]);\n };\n\n const visit = (current: TypeScript.Node): void => {\n if (ts.isCallExpression(current) && ts.isPropertyAccessExpression(current.expression)) {\n const forward = this.forwardOf(current);\n\n if (forward) {\n passed.add(forward.access);\n add(forward.method, forward.config);\n }\n }\n\n if (\n ts.isPropertyAccessExpression(current) &&\n current.expression.kind === ts.SyntaxKind.ThisKeyword &&\n !passed.has(current)\n ) {\n add(current.name.text, undefined);\n }\n\n ts.forEachChild(current, visit);\n };\n\n ts.forEachChild(node, visit);\n\n return routes;\n }\n\n /** The method a `defineRoute`, `defineJSXRoute` or `bindRoute().to` call forwards its context to. */\n private forwardOf(call: TypeScript.CallExpression) {\n const { typescript: ts } = this.options;\n const callee = call.expression;\n\n if (!ts.isPropertyAccessExpression(callee)) {\n return undefined;\n }\n\n const name = callee.name.text;\n const [options] = call.arguments;\n let routeOptions: TypeScript.Expression | undefined;\n\n if (name === 'defineRoute' || name === 'defineJSXRoute') {\n routeOptions = options;\n } else if (\n name === 'to' &&\n ts.isCallExpression(callee.expression) &&\n ts.isPropertyAccessExpression(callee.expression.expression) &&\n callee.expression.expression.name.text === 'bindRoute'\n ) {\n routeOptions = callee.expression.arguments[0];\n }\n\n if (!routeOptions || !options || !ts.isObjectLiteralExpression(options)) {\n return undefined;\n }\n\n const handler = options.properties.find((item) => item.name?.getText(this.file) === 'handler');\n\n if (!handler || !ts.isPropertyAssignment(handler) || !ts.isArrowFunction(handler.initializer)) {\n return undefined;\n }\n\n const [parameter] = handler.initializer.parameters;\n let body: TypeScript.Node | undefined = handler.initializer.body;\n\n if (ts.isBlock(body)) {\n const [only, ...others] = body.statements;\n body =\n only && others.length === 0 && ts.isReturnStatement(only) ? only.expression : undefined;\n }\n\n if (body && ts.isAwaitExpression(body)) {\n body = body.expression;\n }\n\n if (\n !parameter ||\n !body ||\n !ts.isCallExpression(body) ||\n !ts.isPropertyAccessExpression(body.expression) ||\n body.expression.expression.kind !== ts.SyntaxKind.ThisKeyword\n ) {\n return undefined;\n }\n\n const context = parameter.name.getText(this.file);\n const passes = body.arguments.some((argument) => {\n if (!ts.isObjectLiteralExpression(argument)) {\n return argument.getText(this.file) === context;\n }\n\n return argument.properties.some(\n (item) =>\n item.name?.getText(this.file) === 'context' &&\n (ts.isShorthandPropertyAssignment(item)\n ? context === 'context'\n : ts.isPropertyAssignment(item) && item.initializer.getText(this.file) === context),\n );\n });\n\n return passes\n ? {\n access: body.expression,\n method: body.expression.name.text,\n config: this.configOf(routeOptions),\n }\n : undefined;\n }\n\n /** Writes `TContextOf<typeof config>` on the method's context, and drops the type arguments of its `valid()`. */\n private typeMethod(opts: { method: TypeScript.MethodDeclaration; config: string }) {\n const { typescript: ts } = this.options;\n const { method, config } = opts;\n /** The paths that hold the retyped context, as written: `context`, `opts.context`. */\n const holders = new Set<string>();\n\n for (const parameter of method.parameters) {\n let type = parameter.type;\n let path = parameter.name.getText(this.file);\n\n if (type && ts.isTypeLiteralNode(type)) {\n const member = type.members.find((item) => item.name?.getText(this.file) === 'context');\n type = member && ts.isPropertySignature(member) ? member.type : undefined;\n path = ts.isIdentifier(parameter.name) ? `${path}.context` : 'context';\n }\n\n if (!type || !ts.isTypeReferenceNode(type) || this.frameworkType(type) !== CONTEXT) {\n continue;\n }\n\n const environment = type.typeArguments?.[0]?.getText(this.file);\n const suffix = environment ? `, ${environment}` : '';\n this.replace({\n start: type.getStart(this.file),\n end: type.getEnd(),\n text: `${this.localName(TYPED)}<${config}${suffix}>`,\n });\n holders.add(path);\n }\n\n if (holders.size === 0 || !method.body) {\n return;\n }\n\n const visit = (node: TypeScript.Node): void => {\n if (\n ts.isVariableDeclaration(node) &&\n ts.isObjectBindingPattern(node.name) &&\n node.initializer &&\n holders.has(`${node.initializer.getText(this.file)}.context`)\n ) {\n holders.add('context');\n }\n\n if (\n ts.isCallExpression(node) &&\n node.typeArguments &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'valid' &&\n ts.isPropertyAccessExpression(node.expression.expression) &&\n node.expression.expression.name.text === 'req' &&\n holders.has(node.expression.expression.expression.getText(this.file)) &&\n !this.options.keep?.has(node.getStart(this.file))\n ) {\n this.droppedAt.push({ call: node.getStart(this.file), method });\n this.replace({\n start: node.expression.getEnd(),\n end: node.typeArguments.end + 1,\n text: '',\n });\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(method.body);\n }\n\n /**\n * Keeps what the removed body argument checked. In a function whose context, or whose `TRouteHandler` type, names a\n * body: each `json()` of that context takes `body satisfies Body`, and a `TJsonResponse<X>` return type becomes\n * `TJsonResponse<unknown>`, since `json()` no longer carries the body type.\n */\n private keepBodyChecks(node: TypeScript.Node) {\n const { typescript: ts } = this.options;\n\n if (ts.isFunctionLike(node)) {\n const holders = new Map<string, string>();\n\n for (const parameter of node.parameters) {\n let type = parameter.type;\n let path = parameter.name.getText(this.file);\n\n if (type && ts.isTypeLiteralNode(type)) {\n const member = type.members.find((item) => item.name?.getText(this.file) === 'context');\n type = member && ts.isPropertySignature(member) ? member.type : undefined;\n path = ts.isIdentifier(parameter.name) ? `${path}.context` : 'context';\n }\n\n const body = this.bodyOf({ type, of: CONTEXT });\n\n if (body !== undefined) {\n holders.set(path, body);\n }\n }\n\n const { parent } = node;\n const handled = ts.isVariableDeclaration(parent)\n ? this.bodyOf({ type: parent.type, of: HANDLER })\n : undefined;\n const [first] = node.parameters;\n\n if (handled !== undefined && first && !first.type) {\n holders.set(first.name.getText(this.file), handled);\n }\n\n if (holders.size > 0) {\n this.checkBodies({ node, holders });\n this.widenResponses(node.type);\n }\n }\n\n ts.forEachChild(node, (child) => this.keepBodyChecks(child));\n }\n\n /** The body argument a `TRouteContext<Env, Body>` or `TRouteHandler<Body, Env>` names, unless it says nothing. */\n private bodyOf(opts: { type: TypeScript.TypeNode | undefined; of: string }): string | undefined {\n const { typescript: ts } = this.options;\n const { type, of } = opts;\n\n if (!type || !ts.isTypeReferenceNode(type) || this.frameworkType(type) !== of) {\n return undefined;\n }\n\n const [first, second] = type.typeArguments ?? [];\n const body = second ? (of === CONTEXT ? second : first) : undefined;\n const text = body?.getText(this.file);\n\n return text === 'unknown' || text === 'any' ? undefined : text;\n }\n\n /** Writes `satisfies Body` on the argument of each `json()` of a context that named a body. */\n private checkBodies(opts: { node: TypeScript.Node; holders: Map<string, string> }) {\n const { typescript: ts } = this.options;\n const { node, holders } = opts;\n\n const visit = (current: TypeScript.Node): void => {\n if (\n ts.isVariableDeclaration(current) &&\n ts.isObjectBindingPattern(current.name) &&\n current.initializer\n ) {\n const body = holders.get(`${current.initializer.getText(this.file)}.context`);\n\n if (body !== undefined) {\n holders.set('context', body);\n }\n }\n\n if (\n ts.isCallExpression(current) &&\n ts.isPropertyAccessExpression(current.expression) &&\n current.expression.name.text === 'json'\n ) {\n const body = holders.get(current.expression.expression.getText(this.file));\n const [value] = current.arguments;\n\n const isCheckable = value && !ts.isSatisfiesExpression(value) && !ts.isSpreadElement(value);\n\n if (body !== undefined && isCheckable) {\n this.writeSatisfies({ value, body });\n }\n }\n\n ts.forEachChild(current, visit);\n };\n\n ts.forEachChild(node, visit);\n }\n\n private writeSatisfies(opts: { value: TypeScript.Expression; body: string }) {\n const { typescript: ts } = this.options;\n const { value, body } = opts;\n // `satisfies` binds tighter than these.\n const isLoose =\n ts.isConditionalExpression(value) ||\n ts.isBinaryExpression(value) ||\n ts.isArrowFunction(value);\n const start = value.getStart(this.file);\n const end = value.getEnd();\n\n if (isLoose) {\n this.replace({ start, end: start, text: '(' });\n }\n\n this.replace({ start: end, end, text: `${isLoose ? ')' : ''} satisfies ${body}` });\n }\n\n /** `TJsonResponse<X, Status>` in a return type becomes `TJsonResponse<unknown, Status>`. */\n private widenResponses(type: TypeScript.TypeNode | undefined) {\n const { typescript: ts } = this.options;\n\n const visit = (node: TypeScript.Node): void => {\n if (\n ts.isTypeReferenceNode(node) &&\n this.frameworkType(node) === RESPONSE &&\n node.typeArguments?.[0]\n ) {\n const [body] = node.typeArguments;\n this.replace({ start: body.getStart(this.file), end: body.getEnd(), text: 'unknown' });\n\n return;\n }\n\n ts.forEachChild(node, visit);\n };\n\n if (type) {\n visit(type);\n }\n }\n\n /** Drops the response arguments the framework's types no longer take, outside the contexts already retyped. */\n private dropRemovedArguments(node: TypeScript.Node) {\n const { typescript: ts } = this.options;\n\n if (\n ts.isTypeReferenceNode(node) &&\n node.typeArguments?.length === 2 &&\n !this.isReplaced(node)\n ) {\n const type = this.frameworkType(node);\n const [first, second] = node.typeArguments;\n const kept = type === CONTEXT ? first : type === HANDLER ? second : undefined;\n\n if (kept) {\n this.replace({\n start: node.getStart(this.file),\n end: node.getEnd(),\n text: `${node.typeName.getText(this.file)}<${kept.getText(this.file)}>`,\n });\n }\n }\n\n ts.forEachChild(node, (child) => this.dropRemovedArguments(child));\n }\n\n /** The local name of a framework type, or its own name when the file does not import it yet. */\n private localName(type: string): string {\n return [...this.locals].find(([, imported]) => imported === type)?.[0] ?? type;\n }\n\n /** Whether an edit takes this node away: one that writes the name back (`TRouteContext<Env>`) does not. */\n private isRemoved(node: TypeScript.Node, name: string): boolean {\n return [...this.edits.values()].some(\n (edit) =>\n edit.start <= node.getStart(this.file) &&\n edit.end >= node.getEnd() &&\n !edit.text.split(/[^\\w$]+/).includes(name),\n );\n }\n\n /** Whether the edits take away every read of a name that was read: it is unused now, and was not before. */\n private isLeftUnused(name: string): boolean {\n const { typescript: ts } = this.options;\n let reads = 0;\n let removed = 0;\n\n // An edit that writes the name keeps it read.\n if ([...this.edits.values()].some((edit) => edit.text.split(/[^\\w$]+/).includes(name))) {\n return false;\n }\n\n const visit = (node: TypeScript.Node): void => {\n if (ts.isImportDeclaration(node)) {\n return;\n }\n\n if (ts.isIdentifier(node) && node.text === name && !this.isNaming(node)) {\n reads += 1;\n removed += this.isRemoved(node.parent, name) || this.isRemoved(node, name) ? 1 : 0;\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(this.file);\n\n return reads > 0 && reads === removed;\n }\n\n /** Whether an identifier names a member or a declaration, and reads nothing. */\n private isNaming(node: TypeScript.Identifier): boolean {\n const { typescript: ts } = this.options;\n const { parent } = node;\n\n if (ts.isQualifiedName(parent)) {\n return parent.right === node;\n }\n\n return (\n (ts.isPropertyAccessExpression(parent) ||\n ts.isPropertyAssignment(parent) ||\n ts.isPropertySignature(parent) ||\n ts.isPropertyDeclaration(parent) ||\n ts.isMethodDeclaration(parent) ||\n ts.isTypeAliasDeclaration(parent) ||\n ts.isInterfaceDeclaration(parent)) &&\n parent.name === node\n );\n }\n\n /** Removes the local types the edits leave unused; one removal can leave another unused. */\n private dropUnusedTypes() {\n const { typescript: ts } = this.options;\n let isChanged = true;\n\n while (isChanged) {\n isChanged = false;\n\n for (const statement of this.file.statements) {\n if (!ts.isTypeAliasDeclaration(statement) && !ts.isInterfaceDeclaration(statement)) {\n continue;\n }\n\n // Its own text and its JSDoc: a comment above that belongs to the file or to a section stays.\n const start = statement.getStart(this.file, true);\n const end = this.pastLineBreak(statement.getEnd());\n const isExported = statement.modifiers?.some(\n (modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword,\n );\n\n const isDropped = this.edits.has(`${start}:${end}`);\n\n if (isExported || isDropped || !this.isLeftUnused(statement.name.text)) {\n continue;\n }\n\n this.replace({ start, end, text: '' });\n isChanged = true;\n }\n }\n }\n\n /** The position after the line break at `position`, or `position` when none is there. */\n private pastLineBreak(position: number): number {\n const { source } = this.options;\n const found = ['\\r\\n', '\\n'].find((lineBreak) => source.startsWith(lineBreak, position));\n\n return position + (found?.length ?? 0);\n }\n\n /**\n * Imports `TContextOf` beside the type it replaced, and removes the imports and local types the edits leave unused.\n */\n private fixDeclarations() {\n const { typescript: ts, source } = this.options;\n this.dropUnusedTypes();\n const contextName = this.localName(CONTEXT);\n const usesTyped = [...this.edits.values()].some((edit) =>\n edit.text.startsWith(`${this.localName(TYPED)}<`),\n );\n let needsImport = usesTyped && ![...this.locals.values()].includes(TYPED);\n\n for (const statement of this.file.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n\n const clause = statement.importClause;\n const bindings = clause?.namedBindings;\n\n if (!clause || !bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n let isChanged = false;\n const names = bindings.elements.flatMap((element) => {\n const isGone = this.isLeftUnused(element.name.text);\n const isReplaced = needsImport && element.name.text === contextName;\n const kept = isGone ? [] : [element.getText(this.file)];\n\n if (isReplaced) {\n needsImport = false;\n kept.push(clause.isTypeOnly ? TYPED : `type ${TYPED}`);\n }\n\n isChanged ||= isGone || isReplaced;\n\n return kept;\n });\n\n if (!isChanged) {\n continue;\n }\n\n if (names.length === 0 && !clause.name) {\n this.replace({\n start: statement.getStart(this.file),\n end: this.pastLineBreak(statement.getEnd()),\n text: '',\n });\n continue;\n }\n\n // A default import stays without the braces and the comma before them.\n if (names.length === 0 && clause.name) {\n this.replace({ start: clause.name.getEnd(), end: bindings.getEnd(), text: '' });\n continue;\n }\n\n const lineBreak = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const isSpread = bindings.getText(this.file).includes('\\n');\n this.replace({\n start: bindings.getStart(this.file),\n end: bindings.getEnd(),\n text: isSpread\n ? `{${lineBreak} ${names.join(`,${lineBreak} `)},${lineBreak}}`\n : `{ ${names.join(', ')} }`,\n });\n }\n }\n}\n\n/** Types route handlers from their route configs. */\nexport class TypedRouteContext {\n static rewrite(opts: {\n typescript: typeof TypeScript;\n fileName: string;\n source: string;\n keep?: ReadonlySet<number>;\n }): ITypedRouteContextResult {\n return new RouteContextFile(opts).rewrite();\n }\n\n /**\n * Which of the dropped type arguments must stay, per file: those whose call answers `unknown` or `any` once the files\n * are rewritten, and all of a method where the rewritten file has a type error, since the type written there may\n * differ from the schema's.\n */\n static keptCalls(opts: {\n typescript: typeof TypeScript;\n root: string;\n results: ReadonlyMap<string, ITypedRouteContextResult>;\n }): Map<string, Set<number>> {\n const asked = [...opts.results].filter(([, result]) => result.dropped.length > 0);\n const kept = new Map<string, Set<number>>();\n\n for (const { file, program } of TypedRouteContext.check({\n ...opts,\n files: asked.map(([path]) => path),\n })) {\n const found = TypedRouteContext.keptIn({\n typescript: opts.typescript,\n program,\n file,\n dropped: opts.results.get(file)?.dropped ?? [],\n });\n\n if (found.size > 0) {\n kept.set(file, found);\n }\n }\n\n return kept;\n }\n\n /** The type errors the rewritten files still have, as `line TScode`, per file that has any. */\n static remainingErrors(opts: {\n typescript: typeof TypeScript;\n root: string;\n results: ReadonlyMap<string, ITypedRouteContextResult>;\n }): Map<string, string[]> {\n const remaining = new Map<string, string[]>();\n\n for (const { file, program } of TypedRouteContext.check({\n ...opts,\n files: [...opts.results.keys()],\n })) {\n const sourceFile = program.getSourceFile(file);\n const found = sourceFile\n ? program.getSemanticDiagnostics(sourceFile).map((error) => {\n const { line } = sourceFile.getLineAndCharacterOfPosition(error.start ?? 0);\n\n return `${line + 1} TS${error.code}`;\n })\n : [];\n\n if (found.length > 0) {\n remaining.set(file, found);\n }\n }\n\n return remaining;\n }\n\n /** Each of `files` with the program of its own project (its nearest tsconfig.json), the rewritten text read. */\n private static check(opts: {\n typescript: typeof TypeScript;\n root: string;\n results: ReadonlyMap<string, ITypedRouteContextResult>;\n files: string[];\n }): Array<{ file: string; program: TypeScript.Program }> {\n const { typescript: ts, root, results, files } = opts;\n const projects = new Map<string, string[]>();\n\n for (const file of files) {\n const config = ts.findConfigFile(dirname(file), (path) => ts.sys.fileExists(path));\n const project = config === undefined ? root : dirname(config);\n projects.set(project, [...(projects.get(project) ?? []), file]);\n }\n\n const contents = new Map([...results].map(([file, result]) => [file, result.output]));\n\n return [...projects].flatMap(([project, owned]) => {\n const program = BindingKeysCommand.createProgram({\n typescript: ts,\n root: project,\n files: owned,\n contents,\n withProjectFiles: true,\n });\n\n return owned.map((file) => ({ file, program }));\n });\n }\n\n private static keptIn(opts: {\n typescript: typeof TypeScript;\n program: TypeScript.Program;\n file: string;\n dropped: IDroppedTypeArgument[];\n }): Set<number> {\n const { typescript: ts, program, file, dropped } = opts;\n const sourceFile = program.getSourceFile(file);\n const kept = new Set<number>();\n\n if (!sourceFile) {\n return new Set(dropped.map((call) => call.source));\n }\n\n const checker = program.getTypeChecker();\n const errors = program.getSemanticDiagnostics(sourceFile).map((error) => error.start ?? 0);\n const positions = new Map(dropped.map((call) => [call.output, call]));\n\n const visit = (node: TypeScript.Node): void => {\n const call = positions.get(node.getStart(sourceFile));\n\n if (call && ts.isCallExpression(node)) {\n const isUntyped =\n checker.getTypeAtLocation(node).flags & (ts.TypeFlags.Unknown | ts.TypeFlags.Any);\n const isBroken = errors.some(\n (error) => error >= call.method.start && error < call.method.end,\n );\n\n if (isUntyped || isBroken) {\n kept.add(call.source);\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n return kept;\n }\n}\n\n/**\n * `devz codemod typed-route-context [paths...] [--write [--all] | --check]`. It is a dry run unless `--write` is\n * given. `--check` is the same dry run, and exits 1 while a file would change.\n */\nexport class TypedRouteContextCommand {\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 (\n args.includes(TypedRouteContextFlags.HELP) ||\n args.includes(TypedRouteContextFlags.HELP_SHORT)\n ) {\n CliOutput.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) => !TypedRouteContextFlags.isValid(flag));\n\n if (unknown.length > 0) {\n CliOutput.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(TypedRouteContextFlags.WRITE);\n const isCheck = flags.includes(TypedRouteContextFlags.CHECK);\n\n if (isWrite && isCheck) {\n CliOutput.error(\n `devz codemod: ${TypedRouteContextFlags.WRITE} and ${TypedRouteContextFlags.CHECK} contradict each other\\n${USAGE}`,\n );\n\n return USAGE_ERROR_CODE;\n }\n\n const refusal = CodemodFiles.refusal({\n command: 'typed-route-context',\n isWrite,\n isAll: flags.includes(TypedRouteContextFlags.ALL),\n paths,\n });\n\n if (refusal) {\n CliOutput.error(`${refusal}\\n${USAGE}`);\n\n return USAGE_ERROR_CODE;\n }\n\n let typescript: typeof TypeScript;\n\n try {\n const loaded = await import('typescript');\n typescript = loaded.default;\n } catch {\n CliOutput.error('devz codemod: the \"typescript\" package is required to read your sources');\n\n return 1;\n }\n\n const targets = (paths.length > 0 ? paths : ['.']).map((path) => resolve(root, path));\n let changedCount = 0;\n let rewrittenCount = 0;\n let refusedCount = 0;\n\n const results = new Map<string, ITypedRouteContextResult>();\n const sources = new Map<string, string>();\n const dirtyFiles = new Set<string>();\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 CliOutput.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 (!source.includes(CONTEXT) && !source.includes(HANDLER)) {\n continue;\n }\n\n const result = TypedRouteContext.rewrite({ typescript, fileName: file, source });\n\n if (!result.changed) {\n continue;\n }\n\n sources.set(file, source);\n results.set(file, result);\n\n if (dirty?.has(file)) {\n dirtyFiles.add(file);\n }\n }\n }\n\n const kept = TypedRouteContext.keptCalls({ typescript, root, results });\n const finals = new Map<string, ITypedRouteContextResult>();\n\n for (const [file, first] of results) {\n const keep = kept.get(file);\n finals.set(\n file,\n keep\n ? TypedRouteContext.rewrite({\n typescript,\n fileName: file,\n source: sources.get(file) ?? '',\n keep,\n })\n : first,\n );\n }\n\n const remaining = TypedRouteContext.remainingErrors({ typescript, root, results: finals });\n\n for (const [file, result] of finals) {\n const keep = kept.get(file);\n const shown = relative(root, file).split('\\\\').join('/') || file;\n\n if (dirtyFiles.has(file)) {\n refusedCount += 1;\n CliOutput.warn(\n `refused ${shown} has local changes (commit, stash or \"git add\" them, then run again)`,\n );\n continue;\n }\n\n changedCount += 1;\n rewrittenCount += result.rewritten;\n CliOutput.log(\n `${isWrite ? 'changed' : 'would change'} ${shown} (${result.rewritten} place(s))`,\n );\n\n if (keep) {\n CliOutput.warn(\n `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`,\n );\n }\n\n for (const error of remaining.get(file) ?? []) {\n const [line, code] = error.split(' ');\n CliOutput.warn(`check by hand ${shown}:${line} ${code}`);\n }\n\n if (isWrite) {\n writeFileSync(file, result.output);\n }\n }\n\n CliOutput.log(\n `devz codemod typed-route-context: ${changedCount} file(s) ${isWrite ? 'changed' : 'would change'}, ${rewrittenCount} place(s) ${isWrite ? 'rewritten' : 'would be rewritten'}` +\n (refusedCount > 0 ? `, ${refusedCount} refused` : ''),\n );\n\n if (!isWrite && changedCount > 0) {\n CliOutput.log(\n `Nothing was written. Run again with ${TypedRouteContextFlags.WRITE} to apply, then run your typecheck.`,\n );\n }\n\n if (isWrite && refusedCount > 0) {\n return 1;\n }\n\n return isCheck && changedCount > 0 ? 1 : 0;\n }\n}\n"]}
package/dist/cli/index.js CHANGED
@@ -5,6 +5,7 @@ const check_1 = require("./check");
5
5
  const clean_1 = require("./clean");
6
6
  const codemod_1 = require("./codemod");
7
7
  const lint_1 = require("./lint");
8
+ const cli_output_1 = require("../common/cli-output");
8
9
  const USAGE = `Usage: devz <command> [options]
9
10
 
10
11
  Commands:
@@ -17,14 +18,14 @@ Commands:
17
18
  codemod async-style [paths...] apply the async-style lint fixers and list the rest (dry run unless --write)
18
19
  codemod namespace-functions [paths...] move calls of a function that moved into a class to the class form (dry run unless --write)
19
20
  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 env-get [paths...] strip the type arguments of AppEnvs.get() for the string-reading get() (dry run unless --write)
21
22
  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)
22
23
 
23
24
  Run \`devz clean --help\` or \`devz codemod --help\` for a command's options.`;
24
25
  const main = async (opts) => {
25
26
  const [command, ...args] = opts.argv;
26
27
  if (command === undefined || command === '--help' || command === '-h') {
27
- console.log(USAGE);
28
+ cli_output_1.CliOutput.log(USAGE);
28
29
  return 0;
29
30
  }
30
31
  if (command === 'lint') {
@@ -39,11 +40,11 @@ const main = async (opts) => {
39
40
  if (command === 'codemod') {
40
41
  return codemod_1.CodemodCommand.run({ root: process.cwd(), args });
41
42
  }
42
- console.error(`devz: unknown command "${command ?? ''}"\n${USAGE}`);
43
+ cli_output_1.CliOutput.error(`devz: unknown command "${command ?? ''}"\n${USAGE}`);
43
44
  return 1;
44
45
  };
45
46
  main({ argv: process.argv.slice(2) }).then((exitCode) => process.exit(exitCode), (error) => {
46
- console.error(error);
47
+ cli_output_1.CliOutput.error(error);
47
48
  process.exit(1);
48
49
  });
49
50
  //# sourceMappingURL=index.js.map
@@ -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;;;;;;;;;;;;;;;8EAegE,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 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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AACA,mCAAuC;AACvC,mCAAuC;AACvC,uCAA2C;AAC3C,iCAAqC;AACrC,qDAAiD;AAEjD,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,IAAI,CAAC;IAErC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;Q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ommand } from './check';\nimport { CleanCommand } from './clean';\nimport { CodemodCommand } from './codemod';\nimport { LintCommand } from './lint';\nimport { CliOutput } from '../common/cli-output';\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 AppEnvs.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 CliOutput.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 CliOutput.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 CliOutput.error(error);\n process.exit(1);\n },\n);\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * What a `devz` command prints: its result on stdout, its warnings and errors on stderr, formatted as `console` does.
3
+ *
4
+ * The writes are synchronous and complete before the call returns. `process.stdout.write` queues on a pipe in Bun, and
5
+ * what is still queued when the process exits is lost.
6
+ */
7
+ export declare class CliOutput {
8
+ private static readonly STDOUT;
9
+ private static readonly STDERR;
10
+ private static readonly pause;
11
+ private static write;
12
+ static log(...parts: Array<unknown>): void;
13
+ static warn(...parts: Array<unknown>): void;
14
+ static error(...parts: Array<unknown>): void;
15
+ }
16
+ //# sourceMappingURL=cli-output.d.ts.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliOutput = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_util_1 = require("node:util");
6
+ /**
7
+ * What a `devz` command prints: its result on stdout, its warnings and errors on stderr, formatted as `console` does.
8
+ *
9
+ * The writes are synchronous and complete before the call returns. `process.stdout.write` queues on a pipe in Bun, and
10
+ * what is still queued when the process exits is lost.
11
+ */
12
+ class CliOutput {
13
+ static { this.STDOUT = 1; }
14
+ static { this.STDERR = 2; }
15
+ static { this.pause = new Int32Array(new SharedArrayBuffer(4)); }
16
+ static write(opts) {
17
+ const bytes = Buffer.from(`${(0, node_util_1.format)(...opts.parts)}\n`);
18
+ let written = 0;
19
+ while (written < bytes.length) {
20
+ try {
21
+ // A pipe another writer made non-blocking takes only what fits its buffer.
22
+ written += (0, node_fs_1.writeSync)(opts.fd, bytes, written);
23
+ }
24
+ catch (error) {
25
+ const code = error instanceof Error && 'code' in error ? error.code : undefined;
26
+ // The reader closed the pipe (`devz ... | head`): there is nobody left to tell.
27
+ if (code === 'EPIPE') {
28
+ return;
29
+ }
30
+ if (code !== 'EAGAIN') {
31
+ throw error;
32
+ }
33
+ // The buffer is full: wait a millisecond for the reader.
34
+ Atomics.wait(CliOutput.pause, 0, 0, 1);
35
+ }
36
+ }
37
+ }
38
+ static log(...parts) {
39
+ CliOutput.write({ fd: CliOutput.STDOUT, parts });
40
+ }
41
+ static warn(...parts) {
42
+ CliOutput.write({ fd: CliOutput.STDERR, parts });
43
+ }
44
+ static error(...parts) {
45
+ CliOutput.write({ fd: CliOutput.STDERR, parts });
46
+ }
47
+ }
48
+ exports.CliOutput = CliOutput;
49
+ //# sourceMappingURL=cli-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-output.js","sourceRoot":"","sources":["../../src/common/cli-output.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AACpC,yCAAmC;AAEnC;;;;;GAKG;AACH,MAAa,SAAS;aACI,WAAM,GAAG,CAAC,CAAC;aACX,WAAM,GAAG,CAAC,CAAC;aACX,UAAK,GAAG,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjE,MAAM,CAAC,KAAK,CAAC,IAA2C;QAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAA,kBAAM,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,OAAO,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,2EAA2E;gBAC3E,OAAO,IAAI,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBAEhF,gFAAgF;gBAChF,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;oBACrB,OAAO;gBACT,CAAC;gBAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACtB,MAAM,KAAK,CAAC;gBACd,CAAC;gBAED,yDAAyD;gBACzD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,GAAG,KAAqB;QACjC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,KAAqB;QAClC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,KAAqB;QACnC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;;AAzCH,8BA0CC","sourcesContent":["import { writeSync } from 'node:fs';\nimport { format } from 'node:util';\n\n/**\n * What a `devz` command prints: its result on stdout, its warnings and errors on stderr, formatted as `console` does.\n *\n * The writes are synchronous and complete before the call returns. `process.stdout.write` queues on a pipe in Bun, and\n * what is still queued when the process exits is lost.\n */\nexport class CliOutput {\n private static readonly STDOUT = 1;\n private static readonly STDERR = 2;\n private static readonly pause = new Int32Array(new SharedArrayBuffer(4));\n\n private static write(opts: { fd: number; parts: Array<unknown> }): void {\n const bytes = Buffer.from(`${format(...opts.parts)}\\n`);\n let written = 0;\n\n while (written < bytes.length) {\n try {\n // A pipe another writer made non-blocking takes only what fits its buffer.\n written += writeSync(opts.fd, bytes, written);\n } catch (error) {\n const code = error instanceof Error && 'code' in error ? error.code : undefined;\n\n // The reader closed the pipe (`devz ... | head`): there is nobody left to tell.\n if (code === 'EPIPE') {\n return;\n }\n\n if (code !== 'EAGAIN') {\n throw error;\n }\n\n // The buffer is full: wait a millisecond for the reader.\n Atomics.wait(CliOutput.pause, 0, 0, 1);\n }\n }\n }\n\n static log(...parts: Array<unknown>): void {\n CliOutput.write({ fd: CliOutput.STDOUT, parts });\n }\n\n static warn(...parts: Array<unknown>): void {\n CliOutput.write({ fd: CliOutput.STDERR, parts });\n }\n\n static error(...parts: Array<unknown>): void {\n CliOutput.write({ fd: CliOutput.STDERR, parts });\n }\n}\n"]}
@@ -30,7 +30,7 @@ class BunCompiler {
30
30
  if (!built.success) {
31
31
  // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would
32
32
  // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.
33
- // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
33
+ // eslint-disable-next-line @venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
34
34
  throw new Error([
35
35
  `[BunCompiler] compile failed for entrypoint "${entrypoint}":`,
36
36
  ...built.logs.map((log) => `[${log.level}] ${log.message}`),
@@ -1 +1 @@
1
- {"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAWI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,KAAK,GACd,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;YACrC,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE,MAAiC;gBACzC,OAAO;aACR;YACD,MAAM;YACN,OAAO;YACP,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,sGAAsG;YACtG,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAzDD,kCAyDC","sourcesContent":["const DEFAULT_ENTRYPOINT = './dist/index.js';\nconst DEFAULT_OUTFILE = './dist/bin';\nconst DEFAULT_COMPILE_TARGET = 'bun-linux-x64';\n\n/** Bundles and compiles a single Bun executable: minified, linked sourcemaps, target read from `BUN_TARGET`. */\nexport class BunCompiler {\n /**\n * `plugins` is a parameter, never resolved here - `dev-configs` sits below every other IGNIS\n * package (see the Makefile chain) and must not import a plugin factory such as\n * `PlatformaticKafkaPlugins.build()` from `helpers`, which would invert that chain.\n */\n static async compile(\n opts: {\n entrypoint?: string;\n /** Bun Worker files the entrypoint starts (`new Worker('./x.worker.ts')`): compiled into the same binary. */\n workers?: string[];\n outfile?: string;\n target?: string;\n plugins?: Bun.BunPlugin[];\n /** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */\n define?: Record<string, string>;\n /** Type-check the bundle first; a type error stops the compile. */\n check?: boolean;\n } = {},\n ): Promise<void> {\n const {\n entrypoint = DEFAULT_ENTRYPOINT,\n workers = [],\n outfile = DEFAULT_OUTFILE,\n target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET,\n plugins = [],\n define = {},\n check = false,\n } = opts;\n\n const built = await Bun.build({\n entrypoints: [entrypoint, ...workers],\n target: 'bun',\n minify: { whitespace: true, syntax: true },\n sourcemap: 'linked',\n throw: false,\n compile: {\n target: target as Bun.Build.CompileTarget,\n outfile,\n },\n define,\n plugins,\n check,\n });\n\n if (!built.success) {\n // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would\n // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.\n // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n [\n `[BunCompiler] compile failed for entrypoint \"${entrypoint}\":`,\n ...built.logs.map((log) => `[${log.level}] ${log.message}`),\n ].join('\\n'),\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAWI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,KAAK,GACd,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;YACrC,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE,MAAiC;gBACzC,OAAO;aACR;YACD,MAAM;YACN,OAAO;YACP,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,uGAAuG;YACvG,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAzDD,kCAyDC","sourcesContent":["const DEFAULT_ENTRYPOINT = './dist/index.js';\nconst DEFAULT_OUTFILE = './dist/bin';\nconst DEFAULT_COMPILE_TARGET = 'bun-linux-x64';\n\n/** Bundles and compiles a single Bun executable: minified, linked sourcemaps, target read from `BUN_TARGET`. */\nexport class BunCompiler {\n /**\n * `plugins` is a parameter, never resolved here - `dev-configs` sits below every other IGNIS\n * package (see the Makefile chain) and must not import a plugin factory such as\n * `PlatformaticKafkaPlugins.build()` from `helpers`, which would invert that chain.\n */\n static async compile(\n opts: {\n entrypoint?: string;\n /** Bun Worker files the entrypoint starts (`new Worker('./x.worker.ts')`): compiled into the same binary. */\n workers?: string[];\n outfile?: string;\n target?: string;\n plugins?: Bun.BunPlugin[];\n /** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */\n define?: Record<string, string>;\n /** Type-check the bundle first; a type error stops the compile. */\n check?: boolean;\n } = {},\n ): Promise<void> {\n const {\n entrypoint = DEFAULT_ENTRYPOINT,\n workers = [],\n outfile = DEFAULT_OUTFILE,\n target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET,\n plugins = [],\n define = {},\n check = false,\n } = opts;\n\n const built = await Bun.build({\n entrypoints: [entrypoint, ...workers],\n target: 'bun',\n minify: { whitespace: true, syntax: true },\n sourcemap: 'linked',\n throw: false,\n compile: {\n target: target as Bun.Build.CompileTarget,\n outfile,\n },\n define,\n plugins,\n check,\n });\n\n if (!built.success) {\n // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would\n // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.\n // eslint-disable-next-line @venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n [\n `[BunCompiler] compile failed for entrypoint \"${entrypoint}\":`,\n ...built.logs.map((log) => `[${log.level}] ${log.message}`),\n ].join('\\n'),\n );\n }\n }\n}\n"]}
@@ -68,7 +68,7 @@ const STRICT_RULES = {
68
68
  'no-caller': 'error',
69
69
  '@typescript-eslint/adjacent-overload-signatures': 'error',
70
70
  '@typescript-eslint/prefer-for-of': 'error',
71
- '@typescript-eslint/unified-signatures': 'error',
71
+ '@typescript-eslint/unified-signatures': ['error', { ignoreOverloadsWithDifferentJSDoc: true }],
72
72
  '@typescript-eslint/no-invalid-this': ['error'],
73
73
  '@typescript-eslint/no-use-before-define': 'error',
74
74
  '@typescript-eslint/no-shadow': 'error',
@@ -1 +1 @@
1
- {"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../src/linters/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,0CAA6C;AAC7C,0EAAyC;AACzC,2CAAwD;AACxD,yEAAmE;AACnE,2CAAmD;AACnD,uCAA2C;AAC3C,mCAA0F;AAE1F,mCAAmC;AACnC,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAEF,qGAAqG;AACrG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f,oBAAoB;YACpB,gBAAgB;SACjB;KACF;CACF,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACU,QAAA,uBAAuB,GAAoB;IACtD,6FAA6F;IAC7F,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE;IAC9F;QACE,KAAK,EAAE,CAAC,uBAAuB,CAAC;QAChC,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,4FAA4F;QAC5F,aAAa,EAAE,EAAE,6BAA6B,EAAE,KAAK,EAAE;QACvD,KAAK,EAAE,EAAE,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAE,EAAE;KACrE;CACF,CAAC","sourcesContent":["import js from '@eslint/js';\nimport type { Linter } from 'eslint';\nimport { defineConfig } from 'eslint/config';\nimport tseslint from 'typescript-eslint';\nimport { HOUSE_PLUGIN_NAMESPACE } from './house/common';\nimport { NoUnbracedCaseRule } from './house/no-unbraced-case.rule';\nimport { houseEslintPlugin } from './house/plugin';\nimport { paddingConfigs } from './padding';\nimport { NamingConventionRule, NoRestrictedImportsRule, NoUnusedVarsRule } from './rules';\n\n/** Every file the preset lints. */\nconst SOURCE_FILES = [\n '**/*.js',\n '**/*.cjs',\n '**/*.mjs',\n '**/*.jsx',\n '**/*.ts',\n '**/*.cts',\n '**/*.mts',\n '**/*.tsx',\n];\n\n/** Rules that stay off: the type checker, the formatter or the framework's own style covers them. */\nconst OFF_RULES: Linter.RulesRecord = {\n 'no-constant-condition': 'off',\n 'no-undef': 'off',\n 'no-unused-vars': 'off',\n 'no-mixed-operators': 'off',\n 'no-inner-declarations': 'off',\n 'no-dupe-class-members': 'off',\n 'no-redeclare': 'off',\n 'no-invalid-this': 'off',\n 'no-shadow': 'off',\n 'no-return-await': 'off',\n camelcase: 'off',\n '@typescript-eslint/no-explicit-any': 'off',\n '@typescript-eslint/no-unsafe-function-type': 'off',\n '@typescript-eslint/no-this-alias': 'off',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-invalid-void-type': 'off',\n '@typescript-eslint/no-confusing-void-expression': 'off',\n '@typescript-eslint/no-extraneous-class': 'off',\n '@typescript-eslint/no-require-imports': 'off',\n '@typescript-eslint/strict-boolean-expressions': 'off',\n '@typescript-eslint/explicit-function-return-type': 'off',\n '@typescript-eslint/explicit-member-accessibility': 'off',\n '@typescript-eslint/explicit-module-boundary-types': 'off',\n '@typescript-eslint/array-type': 'off',\n '@typescript-eslint/no-non-null-assertion': 'off',\n '@typescript-eslint/no-empty-function': 'off',\n '@typescript-eslint/consistent-type-assertions': 'off',\n '@typescript-eslint/no-misused-promises': 'off',\n};\n\n/** The LoopBack 4 rule set, on top of the recommended presets. */\nconst STRICT_RULES: Linter.RulesRecord = {\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n 'no-unused-expressions': 'error',\n eqeqeq: ['error', 'smart'],\n 'no-void': 'error',\n 'no-useless-escape': 'warn',\n 'no-caller': 'error',\n '@typescript-eslint/adjacent-overload-signatures': 'error',\n '@typescript-eslint/prefer-for-of': 'error',\n '@typescript-eslint/unified-signatures': 'error',\n '@typescript-eslint/no-invalid-this': ['error'],\n '@typescript-eslint/no-use-before-define': 'error',\n '@typescript-eslint/no-shadow': 'error',\n '@typescript-eslint/ban-ts-comment': 'error',\n '@typescript-eslint/no-namespace': 'error',\n '@typescript-eslint/await-thenable': 'error',\n '@typescript-eslint/no-floating-promises': 'error',\n '@typescript-eslint/prefer-optional-chain': 'error',\n // `||` on a string is mostly an intentional empty-string fallback (`value?.trim() || fallback`); `??` keeps `''`.\n // The same exception as the oxlint preset: objects, numbers and booleans still report.\n '@typescript-eslint/prefer-nullish-coalescing': [\n 'error',\n {\n allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true,\n ignorePrimitives: { string: true },\n },\n ],\n '@typescript-eslint/return-await': 'error',\n};\n\n/**\n * The full ESLint preset, owned here: the LoopBack 4 rule set on the ESLint and typescript-eslint\n * recommended presets, type-aware through the project service. A project on oxlint uses\n * `oxlintConfigs` + `namingConventionConfigs` instead.\n */\nexport const eslintConfigs: Linter.Config[] = defineConfig([\n js.configs.recommended,\n tseslint.configs.recommended,\n {\n files: SOURCE_FILES,\n languageOptions: {\n parserOptions: {\n // Finds each file's tsconfig; the default project covers root-level scripts and configs.\n projectService: { allowDefaultProject: ['*.js', '*.cjs', '*.mjs', '.*.js'] },\n },\n },\n plugins: { [HOUSE_PLUGIN_NAMESPACE]: houseEslintPlugin },\n rules: {\n ...OFF_RULES,\n ...STRICT_RULES,\n [NoUnbracedCaseRule.NAME]: NoUnbracedCaseRule.build(),\n '@typescript-eslint/no-unused-vars': NoUnusedVarsRule.build() as Linter.RuleEntry,\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build() as Linter.RuleEntry,\n [NamingConventionRule.NAME]: NamingConventionRule.build(),\n },\n },\n ...paddingConfigs,\n {\n ignores: [\n '**/node_modules/',\n '**/*.d.ts',\n '**/build/',\n '**/dist/',\n '**/release/',\n '**/babel.config.*',\n '**/.babelrc.*',\n '**/eslint.config.*',\n '**/.eslintrc.*',\n ],\n },\n]);\n\n/**\n * The one rule of `eslintConfigs` that oxlint cannot run yet, as a standalone ESLint preset to run\n * next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.\n *\n * ```js\n * // .configs/lints/eslint.config.mjs\n * import { namingConventionConfigs } from '@venizia/dev-configs/linters';\n *\n * export default namingConventionConfigs;\n * ```\n */\nexport const namingConventionConfigs: Linter.Config[] = [\n // Global: ESLint does not read .gitignore, and still walks plain .js files no config claims.\n { ignores: ['**/dist/**', '**/build/**', '**/coverage/**', '**/*.d.ts', '**/*.{js,cjs,mjs}'] },\n {\n files: ['**/*.{ts,tsx,mts,cts}'],\n languageOptions: { parser: tseslint.parser as Linter.Parser },\n plugins: { '@typescript-eslint': tseslint.plugin as never },\n // oxlint owns every other rule, so the disable comments for them are not ESLint's to judge.\n linterOptions: { reportUnusedDisableDirectives: 'off' },\n rules: { [NamingConventionRule.NAME]: NamingConventionRule.build() },\n },\n];\n"]}
1
+ {"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../src/linters/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,0CAA6C;AAC7C,0EAAyC;AACzC,2CAAwD;AACxD,yEAAmE;AACnE,2CAAmD;AACnD,uCAA2C;AAC3C,mCAA0F;AAE1F,mCAAmC;AACnC,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAEF,qGAAqG;AACrG,MAAM,SAAS,GAAuB;IACpC,uBAAuB,EAAE,KAAK;IAC9B,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,KAAK;IAC3B,uBAAuB,EAAE,KAAK;IAC9B,uBAAuB,EAAE,KAAK;IAC9B,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,KAAK;IAChB,oCAAoC,EAAE,KAAK;IAC3C,4CAA4C,EAAE,KAAK;IACnD,kCAAkC,EAAE,KAAK;IACzC,yCAAyC,EAAE,KAAK;IAChD,yCAAyC,EAAE,KAAK;IAChD,iDAAiD,EAAE,KAAK;IACxD,wCAAwC,EAAE,KAAK;IAC/C,uCAAuC,EAAE,KAAK;IAC9C,+CAA+C,EAAE,KAAK;IACtD,kDAAkD,EAAE,KAAK;IACzD,kDAAkD,EAAE,KAAK;IACzD,mDAAmD,EAAE,KAAK;IAC1D,+BAA+B,EAAE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port type { Linter } from 'eslint';\nimport { defineConfig } from 'eslint/config';\nimport tseslint from 'typescript-eslint';\nimport { HOUSE_PLUGIN_NAMESPACE } from './house/common';\nimport { NoUnbracedCaseRule } from './house/no-unbraced-case.rule';\nimport { houseEslintPlugin } from './house/plugin';\nimport { paddingConfigs } from './padding';\nimport { NamingConventionRule, NoRestrictedImportsRule, NoUnusedVarsRule } from './rules';\n\n/** Every file the preset lints. */\nconst SOURCE_FILES = [\n '**/*.js',\n '**/*.cjs',\n '**/*.mjs',\n '**/*.jsx',\n '**/*.ts',\n '**/*.cts',\n '**/*.mts',\n '**/*.tsx',\n];\n\n/** Rules that stay off: the type checker, the formatter or the framework's own style covers them. */\nconst OFF_RULES: Linter.RulesRecord = {\n 'no-constant-condition': 'off',\n 'no-undef': 'off',\n 'no-unused-vars': 'off',\n 'no-mixed-operators': 'off',\n 'no-inner-declarations': 'off',\n 'no-dupe-class-members': 'off',\n 'no-redeclare': 'off',\n 'no-invalid-this': 'off',\n 'no-shadow': 'off',\n 'no-return-await': 'off',\n camelcase: 'off',\n '@typescript-eslint/no-explicit-any': 'off',\n '@typescript-eslint/no-unsafe-function-type': 'off',\n '@typescript-eslint/no-this-alias': 'off',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-invalid-void-type': 'off',\n '@typescript-eslint/no-confusing-void-expression': 'off',\n '@typescript-eslint/no-extraneous-class': 'off',\n '@typescript-eslint/no-require-imports': 'off',\n '@typescript-eslint/strict-boolean-expressions': 'off',\n '@typescript-eslint/explicit-function-return-type': 'off',\n '@typescript-eslint/explicit-member-accessibility': 'off',\n '@typescript-eslint/explicit-module-boundary-types': 'off',\n '@typescript-eslint/array-type': 'off',\n '@typescript-eslint/no-non-null-assertion': 'off',\n '@typescript-eslint/no-empty-function': 'off',\n '@typescript-eslint/consistent-type-assertions': 'off',\n '@typescript-eslint/no-misused-promises': 'off',\n};\n\n/** The LoopBack 4 rule set, on top of the recommended presets. */\nconst STRICT_RULES: Linter.RulesRecord = {\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n 'no-unused-expressions': 'error',\n eqeqeq: ['error', 'smart'],\n 'no-void': 'error',\n 'no-useless-escape': 'warn',\n 'no-caller': 'error',\n '@typescript-eslint/adjacent-overload-signatures': 'error',\n '@typescript-eslint/prefer-for-of': 'error',\n '@typescript-eslint/unified-signatures': ['error', { ignoreOverloadsWithDifferentJSDoc: true }],\n '@typescript-eslint/no-invalid-this': ['error'],\n '@typescript-eslint/no-use-before-define': 'error',\n '@typescript-eslint/no-shadow': 'error',\n '@typescript-eslint/ban-ts-comment': 'error',\n '@typescript-eslint/no-namespace': 'error',\n '@typescript-eslint/await-thenable': 'error',\n '@typescript-eslint/no-floating-promises': 'error',\n '@typescript-eslint/prefer-optional-chain': 'error',\n // `||` on a string is mostly an intentional empty-string fallback (`value?.trim() || fallback`); `??` keeps `''`.\n // The same exception as the oxlint preset: objects, numbers and booleans still report.\n '@typescript-eslint/prefer-nullish-coalescing': [\n 'error',\n {\n allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true,\n ignorePrimitives: { string: true },\n },\n ],\n '@typescript-eslint/return-await': 'error',\n};\n\n/**\n * The full ESLint preset, owned here: the LoopBack 4 rule set on the ESLint and typescript-eslint\n * recommended presets, type-aware through the project service. A project on oxlint uses\n * `oxlintConfigs` + `namingConventionConfigs` instead.\n */\nexport const eslintConfigs: Linter.Config[] = defineConfig([\n js.configs.recommended,\n tseslint.configs.recommended,\n {\n files: SOURCE_FILES,\n languageOptions: {\n parserOptions: {\n // Finds each file's tsconfig; the default project covers root-level scripts and configs.\n projectService: { allowDefaultProject: ['*.js', '*.cjs', '*.mjs', '.*.js'] },\n },\n },\n plugins: { [HOUSE_PLUGIN_NAMESPACE]: houseEslintPlugin },\n rules: {\n ...OFF_RULES,\n ...STRICT_RULES,\n [NoUnbracedCaseRule.NAME]: NoUnbracedCaseRule.build(),\n '@typescript-eslint/no-unused-vars': NoUnusedVarsRule.build() as Linter.RuleEntry,\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build() as Linter.RuleEntry,\n [NamingConventionRule.NAME]: NamingConventionRule.build(),\n },\n },\n ...paddingConfigs,\n {\n ignores: [\n '**/node_modules/',\n '**/*.d.ts',\n '**/build/',\n '**/dist/',\n '**/release/',\n '**/babel.config.*',\n '**/.babelrc.*',\n '**/eslint.config.*',\n '**/.eslintrc.*',\n ],\n },\n]);\n\n/**\n * The one rule of `eslintConfigs` that oxlint cannot run yet, as a standalone ESLint preset to run\n * next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.\n *\n * ```js\n * // .configs/lints/eslint.config.mjs\n * import { namingConventionConfigs } from '@venizia/dev-configs/linters';\n *\n * export default namingConventionConfigs;\n * ```\n */\nexport const namingConventionConfigs: Linter.Config[] = [\n // Global: ESLint does not read .gitignore, and still walks plain .js files no config claims.\n { ignores: ['**/dist/**', '**/build/**', '**/coverage/**', '**/*.d.ts', '**/*.{js,cjs,mjs}'] },\n {\n files: ['**/*.{ts,tsx,mts,cts}'],\n languageOptions: { parser: tseslint.parser },\n plugins: { '@typescript-eslint': tseslint.plugin },\n // oxlint owns every other rule, so the disable comments for them are not ESLint's to judge.\n linterOptions: { reportUnusedDisableDirectives: 'off' },\n rules: { [NamingConventionRule.NAME]: NamingConventionRule.build() },\n },\n];\n"]}
@@ -0,0 +1,43 @@
1
+ /** How a hand-written browser API shows up in code. */
2
+ export type TBrowserApiMatch =
3
+ /** A property of the global object read or called: `window.matchMedia(...)`, `matchMedia(...)`. */
4
+ {
5
+ type: 'global';
6
+ names: ReadonlyArray<string>;
7
+ }
8
+ /** A member path under a global: `navigator.onLine`, `navigator.clipboard.writeText`. */
9
+ | {
10
+ type: 'path';
11
+ paths: ReadonlyArray<string>;
12
+ }
13
+ /** `new X(...)` of a global class. */
14
+ | {
15
+ type: 'new';
16
+ callees: ReadonlyArray<string>;
17
+ }
18
+ /** `<object>.addEventListener('<event>', ...)`; `objects` names the objects it counts for (the globals `window`, `document`, `self` and `globalThis` when absent). */
19
+ | {
20
+ type: 'listener';
21
+ events: ReadonlyArray<string>;
22
+ objects?: ReadonlyArray<string>;
23
+ };
24
+ /** One browser API the framework already wraps, and what to use instead. */
25
+ export interface IBrowserApiPattern {
26
+ /** The name `ignore` takes to switch the pattern off. */
27
+ id: string;
28
+ match: TBrowserApiMatch;
29
+ /** What to use: the hooks, named as the message prints them. */
30
+ hooks: string;
31
+ /** The hand-written form, as the message prints it. */
32
+ written: string;
33
+ }
34
+ /**
35
+ * The browser APIs ARDOR (`@venizia/ardor-react`) wraps in a hook, one row each. `@venizia/prefer-framework-api` reads this
36
+ * table, so adding a pattern is adding a row here. Only forms a rule can tell apart reliably are rows: a hand-rolled
37
+ * debounce or a draft-saving timer is not.
38
+ */
39
+ export declare class BrowserApiPatterns {
40
+ static readonly PACKAGE = "@venizia/ardor-react";
41
+ static readonly TABLE: ReadonlyArray<IBrowserApiPattern>;
42
+ }
43
+ //# sourceMappingURL=browser-api-patterns.d.ts.map
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrowserApiPatterns = void 0;
4
+ /**
5
+ * The browser APIs ARDOR (`@venizia/ardor-react`) wraps in a hook, one row each. `@venizia/prefer-framework-api` reads this
6
+ * table, so adding a pattern is adding a row here. Only forms a rule can tell apart reliably are rows: a hand-rolled
7
+ * debounce or a draft-saving timer is not.
8
+ */
9
+ class BrowserApiPatterns {
10
+ static { this.PACKAGE = '@venizia/ardor-react'; }
11
+ static { this.TABLE = [
12
+ {
13
+ id: 'match-media',
14
+ match: { type: 'global', names: ['matchMedia'] },
15
+ hooks: '`useMediaQuery` (a media query) or `useBreakpoint` (a screen size)',
16
+ written: '`window.matchMedia`',
17
+ },
18
+ {
19
+ id: 'window-size',
20
+ match: { type: 'global', names: ['innerWidth', 'innerHeight'] },
21
+ hooks: '`useWindowDimensions`',
22
+ written: '`window.innerWidth` / `window.innerHeight`',
23
+ },
24
+ {
25
+ id: 'window-resize',
26
+ match: { type: 'listener', events: ['resize'], objects: ['window', 'self', 'globalThis'] },
27
+ hooks: '`useWindowDimensions`',
28
+ written: "a window `addEventListener('resize', ...)`",
29
+ },
30
+ {
31
+ id: 'resize-observer',
32
+ match: { type: 'new', callees: ['ResizeObserver'] },
33
+ hooks: '`useElementSize` (measure an element) or `useResizeEffect` (react to its resize)',
34
+ written: '`new ResizeObserver(...)`',
35
+ },
36
+ {
37
+ id: 'intersection-observer',
38
+ match: { type: 'new', callees: ['IntersectionObserver'] },
39
+ hooks: '`useIntersection`',
40
+ written: '`new IntersectionObserver(...)`',
41
+ },
42
+ {
43
+ id: 'online-status',
44
+ match: { type: 'path', paths: ['navigator.onLine'] },
45
+ hooks: '`useOnlineStatus`',
46
+ written: '`navigator.onLine`',
47
+ },
48
+ {
49
+ id: 'online-listener',
50
+ match: { type: 'listener', events: ['online', 'offline'] },
51
+ hooks: '`useOnlineStatus`',
52
+ written: 'an `online` / `offline` `addEventListener`',
53
+ },
54
+ {
55
+ id: 'document-visibility',
56
+ match: { type: 'path', paths: ['document.visibilityState', 'document.hidden'] },
57
+ hooks: '`useDocumentVisibility`',
58
+ written: '`document.visibilityState`',
59
+ },
60
+ {
61
+ id: 'visibility-listener',
62
+ match: { type: 'listener', events: ['visibilitychange'] },
63
+ hooks: '`useDocumentVisibility`',
64
+ written: 'a `visibilitychange` `addEventListener`',
65
+ },
66
+ {
67
+ id: 'before-unload',
68
+ match: { type: 'listener', events: ['beforeunload'] },
69
+ hooks: '`useBeforeUnload`',
70
+ written: 'a `beforeunload` `addEventListener`',
71
+ },
72
+ {
73
+ id: 'clipboard-write',
74
+ match: { type: 'path', paths: ['navigator.clipboard.writeText'] },
75
+ hooks: '`useCopyToClipboard`',
76
+ written: '`navigator.clipboard.writeText`',
77
+ },
78
+ {
79
+ id: 'confirm',
80
+ match: { type: 'global', names: ['confirm'] },
81
+ hooks: '`useConfirm`',
82
+ written: '`window.confirm`',
83
+ },
84
+ ]; }
85
+ }
86
+ exports.BrowserApiPatterns = BrowserApiPatterns;
87
+ //# sourceMappingURL=browser-api-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-api-patterns.js","sourceRoot":"","sources":["../../../src/linters/house/browser-api-patterns.ts"],"names":[],"mappings":";;;AAsBA;;;;GAIG;AACH,MAAa,kBAAkB;aACb,YAAO,GAAG,sBAAsB,CAAC;aAEjC,UAAK,GAAsC;QACzD;YACE,EAAE,EAAE,aAAa;YACjB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE;YAChD,KAAK,EAAE,oEAAoE;YAC3E,OAAO,EAAE,qBAAqB;SAC/B;QACD;YACE,EAAE,EAAE,aAAa;YACjB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,EAAE;YAC/D,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,4CAA4C;SACtD;QACD;YACE,EAAE,EAAE,eAAe;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE;YAC1F,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,4CAA4C;SACtD;QACD;YACE,EAAE,EAAE,iBAAiB;YACrB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE;YACnD,KAAK,EAAE,kFAAkF;YACzF,OAAO,EAAE,2BAA2B;SACrC;QACD;YACE,EAAE,EAAE,uBAAuB;YAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,sBAAsB,CAAC,EAAE;YACzD,KAAK,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CAAC,EAAE;YAC7C,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,kBAAkB;SAC5B;KACF,CAAC;;AA5EJ,gDA6EC","sourcesContent":["/** How a hand-written browser API shows up in code. */\nexport type TBrowserApiMatch =\n /** A property of the global object read or called: `window.matchMedia(...)`, `matchMedia(...)`. */\n | { type: 'global'; names: ReadonlyArray<string> }\n /** A member path under a global: `navigator.onLine`, `navigator.clipboard.writeText`. */\n | { type: 'path'; paths: ReadonlyArray<string> }\n /** `new X(...)` of a global class. */\n | { type: 'new'; callees: ReadonlyArray<string> }\n /** `<object>.addEventListener('<event>', ...)`; `objects` names the objects it counts for (the globals `window`, `document`, `self` and `globalThis` when absent). */\n | { type: 'listener'; events: ReadonlyArray<string>; objects?: ReadonlyArray<string> };\n\n/** One browser API the framework already wraps, and what to use instead. */\nexport interface IBrowserApiPattern {\n /** The name `ignore` takes to switch the pattern off. */\n id: string;\n match: TBrowserApiMatch;\n /** What to use: the hooks, named as the message prints them. */\n hooks: string;\n /** The hand-written form, as the message prints it. */\n written: string;\n}\n\n/**\n * The browser APIs ARDOR (`@venizia/ardor-react`) wraps in a hook, one row each. `@venizia/prefer-framework-api` reads this\n * table, so adding a pattern is adding a row here. Only forms a rule can tell apart reliably are rows: a hand-rolled\n * debounce or a draft-saving timer is not.\n */\nexport class BrowserApiPatterns {\n static readonly PACKAGE = '@venizia/ardor-react';\n\n static readonly TABLE: ReadonlyArray<IBrowserApiPattern> = [\n {\n id: 'match-media',\n match: { type: 'global', names: ['matchMedia'] },\n hooks: '`useMediaQuery` (a media query) or `useBreakpoint` (a screen size)',\n written: '`window.matchMedia`',\n },\n {\n id: 'window-size',\n match: { type: 'global', names: ['innerWidth', 'innerHeight'] },\n hooks: '`useWindowDimensions`',\n written: '`window.innerWidth` / `window.innerHeight`',\n },\n {\n id: 'window-resize',\n match: { type: 'listener', events: ['resize'], objects: ['window', 'self', 'globalThis'] },\n hooks: '`useWindowDimensions`',\n written: \"a window `addEventListener('resize', ...)`\",\n },\n {\n id: 'resize-observer',\n match: { type: 'new', callees: ['ResizeObserver'] },\n hooks: '`useElementSize` (measure an element) or `useResizeEffect` (react to its resize)',\n written: '`new ResizeObserver(...)`',\n },\n {\n id: 'intersection-observer',\n match: { type: 'new', callees: ['IntersectionObserver'] },\n hooks: '`useIntersection`',\n written: '`new IntersectionObserver(...)`',\n },\n {\n id: 'online-status',\n match: { type: 'path', paths: ['navigator.onLine'] },\n hooks: '`useOnlineStatus`',\n written: '`navigator.onLine`',\n },\n {\n id: 'online-listener',\n match: { type: 'listener', events: ['online', 'offline'] },\n hooks: '`useOnlineStatus`',\n written: 'an `online` / `offline` `addEventListener`',\n },\n {\n id: 'document-visibility',\n match: { type: 'path', paths: ['document.visibilityState', 'document.hidden'] },\n hooks: '`useDocumentVisibility`',\n written: '`document.visibilityState`',\n },\n {\n id: 'visibility-listener',\n match: { type: 'listener', events: ['visibilitychange'] },\n hooks: '`useDocumentVisibility`',\n written: 'a `visibilitychange` `addEventListener`',\n },\n {\n id: 'before-unload',\n match: { type: 'listener', events: ['beforeunload'] },\n hooks: '`useBeforeUnload`',\n written: 'a `beforeunload` `addEventListener`',\n },\n {\n id: 'clipboard-write',\n match: { type: 'path', paths: ['navigator.clipboard.writeText'] },\n hooks: '`useCopyToClipboard`',\n written: '`navigator.clipboard.writeText`',\n },\n {\n id: 'confirm',\n match: { type: 'global', names: ['confirm'] },\n hooks: '`useConfirm`',\n written: '`window.confirm`',\n },\n ];\n}\n"]}