@venizia/dev-configs 0.4.8-0 → 0.4.8-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 (117) hide show
  1. package/README.md +65 -16
  2. package/dist/checks/catalog.d.ts +15 -2
  3. package/dist/checks/catalog.js +1 -0
  4. package/dist/checks/catalog.js.map +1 -1
  5. package/dist/checks/module-cycles.d.ts +2 -0
  6. package/dist/checks/module-cycles.js +2 -0
  7. package/dist/checks/module-cycles.js.map +1 -1
  8. package/dist/checks/purity/manifest.d.ts +6 -1
  9. package/dist/checks/purity/manifest.js.map +1 -1
  10. package/dist/checks/purity/probe.d.ts +4 -1
  11. package/dist/checks/purity/probe.js +1 -0
  12. package/dist/checks/purity/probe.js.map +1 -1
  13. package/dist/checks/purity/run.d.ts +3 -0
  14. package/dist/checks/purity/run.js +1 -0
  15. package/dist/checks/purity/run.js.map +1 -1
  16. package/dist/checks/split-report.d.ts +1 -0
  17. package/dist/checks/split-report.js +1 -0
  18. package/dist/checks/split-report.js.map +1 -1
  19. package/dist/checks/test-controls.d.ts +11 -2
  20. package/dist/checks/test-controls.js +1 -0
  21. package/dist/checks/test-controls.js.map +1 -1
  22. package/dist/checks/test-dead-code.d.ts +1 -0
  23. package/dist/checks/test-dead-code.js +1 -0
  24. package/dist/checks/test-dead-code.js.map +1 -1
  25. package/dist/checks/test-mutate.d.ts +14 -2
  26. package/dist/checks/test-mutate.js +1 -0
  27. package/dist/checks/test-mutate.js.map +1 -1
  28. package/dist/checks/test-weight.d.ts +3 -0
  29. package/dist/checks/test-weight.js +1 -0
  30. package/dist/checks/test-weight.js.map +1 -1
  31. package/dist/cli/codemod/any-aliases.d.ts +35 -0
  32. package/dist/cli/codemod/any-aliases.js +544 -0
  33. package/dist/cli/codemod/any-aliases.js.map +1 -0
  34. package/dist/cli/codemod/async-style.d.ts +2 -2
  35. package/dist/cli/codemod/async-style.js +4 -2
  36. package/dist/cli/codemod/async-style.js.map +1 -1
  37. package/dist/cli/codemod/connector-imports.d.ts +5 -1
  38. package/dist/cli/codemod/connector-imports.js +21 -7
  39. package/dist/cli/codemod/connector-imports.js.map +1 -1
  40. package/dist/cli/codemod/env-get.d.ts +56 -0
  41. package/dist/cli/codemod/env-get.js +599 -0
  42. package/dist/cli/codemod/env-get.js.map +1 -0
  43. package/dist/cli/codemod/index.js +31 -2
  44. package/dist/cli/codemod/index.js.map +1 -1
  45. package/dist/cli/codemod/namespace-functions/index.d.ts +2 -1
  46. package/dist/cli/codemod/namespace-functions/index.js +14 -5
  47. package/dist/cli/codemod/namespace-functions/index.js.map +1 -1
  48. package/dist/cli/codemod/namespace-functions/mappings/core-server.js +6 -14
  49. package/dist/cli/codemod/namespace-functions/mappings/core-server.js.map +1 -1
  50. package/dist/cli/codemod/namespace-functions/mappings/helpers.d.ts +3 -0
  51. package/dist/cli/codemod/namespace-functions/mappings/helpers.js +4 -9
  52. package/dist/cli/codemod/namespace-functions/mappings/helpers.js.map +1 -1
  53. package/dist/cli/codemod/namespace-functions/mappings/kernel.js +1 -1
  54. package/dist/cli/codemod/namespace-functions/mappings/kernel.js.map +1 -1
  55. package/dist/cli/codemod/namespace-functions/reverse.d.ts +40 -0
  56. package/dist/cli/codemod/namespace-functions/reverse.js +348 -0
  57. package/dist/cli/codemod/namespace-functions/reverse.js.map +1 -0
  58. package/dist/cli/codemod/namespace-functions/rewriter.d.ts +21 -2
  59. package/dist/cli/codemod/namespace-functions/rewriter.js +1 -1
  60. package/dist/cli/codemod/namespace-functions/rewriter.js.map +1 -1
  61. package/dist/cli/index.js +2 -0
  62. package/dist/cli/index.js.map +1 -1
  63. package/dist/linters/eslint.js +6 -1
  64. package/dist/linters/eslint.js.map +1 -1
  65. package/dist/linters/house/async-rules.d.ts +1 -1
  66. package/dist/linters/house/async-rules.js +3 -1
  67. package/dist/linters/house/async-rules.js.map +1 -1
  68. package/dist/linters/house/await-support.js +45 -38
  69. package/dist/linters/house/await-support.js.map +1 -1
  70. package/dist/linters/house/common.d.ts +43 -0
  71. package/dist/linters/house/common.js +43 -0
  72. package/dist/linters/house/common.js.map +1 -1
  73. package/dist/linters/house/const-class-values.rule.js +9 -8
  74. package/dist/linters/house/const-class-values.rule.js.map +1 -1
  75. package/dist/linters/house/hook-support.js +11 -7
  76. package/dist/linters/house/hook-support.js.map +1 -1
  77. package/dist/linters/house/index.d.ts +1 -0
  78. package/dist/linters/house/index.js +1 -0
  79. package/dist/linters/house/index.js.map +1 -1
  80. package/dist/linters/house/max-params-own.rule.d.ts +3 -1
  81. package/dist/linters/house/max-params-own.rule.js +13 -12
  82. package/dist/linters/house/max-params-own.rule.js.map +1 -1
  83. package/dist/linters/house/no-await-new-chain.rule.d.ts +37 -0
  84. package/dist/linters/house/no-await-new-chain.rule.js +179 -0
  85. package/dist/linters/house/no-await-new-chain.rule.js.map +1 -0
  86. package/dist/linters/house/no-await-promise-chain.rule.js +23 -22
  87. package/dist/linters/house/no-await-promise-chain.rule.js.map +1 -1
  88. package/dist/linters/house/no-inline-await.rule.js +4 -3
  89. package/dist/linters/house/no-inline-await.rule.js.map +1 -1
  90. package/dist/linters/house/no-leaked-render.rule.js +3 -3
  91. package/dist/linters/house/no-leaked-render.rule.js.map +1 -1
  92. package/dist/linters/house/no-new-error.rule.js +1 -1
  93. package/dist/linters/house/no-new-error.rule.js.map +1 -1
  94. package/dist/linters/house/no-return-await.rule.js +5 -4
  95. package/dist/linters/house/no-return-await.rule.js.map +1 -1
  96. package/dist/linters/house/no-silent-catch.rule.js +4 -3
  97. package/dist/linters/house/no-silent-catch.rule.js.map +1 -1
  98. package/dist/linters/house/plugin.js +2 -0
  99. package/dist/linters/house/plugin.js.map +1 -1
  100. package/dist/linters/house/promise-chain-support.js +25 -25
  101. package/dist/linters/house/promise-chain-support.js.map +1 -1
  102. package/dist/linters/oxlint.d.ts +11 -5
  103. package/dist/linters/oxlint.js +8 -3
  104. package/dist/linters/oxlint.js.map +1 -1
  105. package/dist/linters/rules/no-unused-vars.rule.d.ts +6 -1
  106. package/dist/linters/rules/no-unused-vars.rule.js +1 -1
  107. package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
  108. package/dist/testing/rejection.helper.d.ts +1 -0
  109. package/dist/testing/rejection.helper.js +1 -0
  110. package/dist/testing/rejection.helper.js.map +1 -1
  111. package/dist/testing/repo-tmp.d.ts +1 -0
  112. package/dist/testing/repo-tmp.js +18 -10
  113. package/dist/testing/repo-tmp.js.map +1 -1
  114. package/dist/testing/spawn.helper.d.ts +1 -0
  115. package/dist/testing/spawn.helper.js +1 -0
  116. package/dist/testing/spawn.helper.js.map +1 -1
  117. package/package.json +1 -1
@@ -22,6 +22,7 @@ const FILE_SUITE = /<testsuite name="([^"]+\.(?:test|spec)\.[cm]?[jt]sx?)" file=
22
22
  const CASE = /<testcase name="([^"]*)" classname="([^"]*)" time="([\d.eE+-]+)" file="([^"]+)"/g;
23
23
  const LIGHT_FILE_MILLISECONDS = 100;
24
24
  const HEAVY_SHARE = 0.8;
25
+ /** Reads JUnit reports of `bun test` and shows where the test time and the test count are. */
25
26
  class TestWeightCheck {
26
27
  /** Reads the JUnit reports of a test run into one weight report: which files carry the time, and what looks wrong. */
27
28
  static analyseJunit(opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"test-weight.js","sourceRoot":"","sources":["../../src/checks/test-weight.ts"],"names":[],"mappings":";;;AA4CA,MAAM,QAAQ,GAA2B;IACvC,GAAG,EAAE,GAAG;IACR,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAC9C,IAAI,CAAC,OAAO,CAAC,iCAAiC,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;IACtE,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,C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M,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EACjK,6BAA6B,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CACxI,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtID,0CAsIC","sourcesContent":["/**\n * Reads the JUnit report of `bun test --reporter=junit` and says where the test time and the test\n * count are: per file, per package, the heaviest files, duplicates by name, files that assert nothing,\n * and skips. The first step of the trim-tests method (`.agents/knowledge/process/trimming-tests.md`).\n *\n * The numbers are only as good as the run that made them: a `--parallel` run times each file under\n * contention, so a file that takes 7 s there can take 1 s alone. Re-time a suspect file alone.\n */\nexport interface ITestWeightInput {\n /** Names the report in the output: the package. */\n label: string;\n xml: string;\n}\n\nexport interface ITestFileWeight {\n label: string;\n file: string;\n milliseconds: number;\n cases: number;\n assertions: number;\n skipped: number;\n slowestCase: string;\n slowestMilliseconds: number;\n}\n\nexport interface ITestWeightReport {\n files: ITestFileWeight[];\n totalMilliseconds: number;\n totalCases: number;\n totalAssertions: number;\n totalSkipped: number;\n perLabel: Array<{ label: string; files: number; cases: number; milliseconds: number }>;\n /** Heaviest first. */\n heaviest: ITestFileWeight[];\n /** How many of the heaviest files hold 80% of the time. */\n filesFor80Percent: number;\n /** Files that take under 100 ms, and what they cost together. */\n lightFiles: { count: number; milliseconds: number };\n /** The same suite and case name in more than one file. */\n sameNameAcrossFiles: Array<{ name: string; files: string[] }>;\n zeroAssertionFiles: string[];\n skippedFiles: Array<{ file: string; skipped: number }>;\n}\n\nconst ENTITIES: Record<string, string> = {\n amp: '&',\n lt: '<',\n gt: '>',\n quot: '\"',\n apos: \"'\",\n};\n\nconst decodeEntities = (text: string): string =>\n text.replace(/&(#x[0-9a-fA-F]+|#\\d+|[a-z]+);/g, (whole, body: string) => {\n if (body.startsWith('#x')) {\n return String.fromCodePoint(Number.parseInt(body.slice(2), 16));\n }\n\n if (body.startsWith('#')) {\n return String.fromCodePoint(Number.parseInt(body.slice(1), 10));\n }\n\n return ENTITIES[body] ?? whole;\n });\n\n/** Bun writes a file as a top-level suite whose `name` equals its `file`. */\nconst FILE_SUITE =\n /<testsuite name=\"([^\"]+\\.(?:test|spec)\\.[cm]?[jt]sx?)\" file=\"[^\"]+\" tests=\"(\\d+)\" assertions=\"(\\d+)\" failures=\"\\d+\" skipped=\"(\\d+)\" time=\"([\\d.eE+-]+)\"/g;\nconst CASE = /<testcase name=\"([^\"]*)\" classname=\"([^\"]*)\" time=\"([\\d.eE+-]+)\" file=\"([^\"]+)\"/g;\n\nconst LIGHT_FILE_MILLISECONDS = 100;\nconst HEAVY_SHARE = 0.8;\n\nexport class TestWeightCheck {\n /** Reads the JUnit reports of a test run into one weight report: which files carry the time, and what looks wrong. */\n static analyseJunit(opts: { reports: ITestWeightInput[] }): ITestWeightReport {\n const files: ITestFileWeight[] = [];\n const names = new Map<string, Set<string>>();\n\n for (const { label, xml } of opts.reports) {\n const start = files.length;\n\n for (const match of xml.matchAll(FILE_SUITE)) {\n files.push({\n label,\n file: match[1],\n milliseconds: Number(match[5]) * 1000,\n cases: Number(match[2]),\n assertions: Number(match[3]),\n skipped: Number(match[4]),\n slowestCase: '',\n slowestMilliseconds: 0,\n });\n }\n\n const byFile = new Map(files.slice(start).map((entry) => [entry.file, entry]));\n\n for (const match of xml.matchAll(CASE)) {\n const caseName = decodeEntities(match[1]);\n const suiteName = decodeEntities(match[2]);\n const entry = byFile.get(match[4]);\n const milliseconds = Number(match[3]) * 1000;\n\n if (entry && milliseconds > entry.slowestMilliseconds) {\n entry.slowestMilliseconds = milliseconds;\n entry.slowestCase = caseName;\n }\n\n const key = `${suiteName} > ${caseName}`;\n const where = names.get(key) ?? new Set<string>();\n where.add(`${label}/${match[4]}`);\n names.set(key, where);\n }\n }\n\n const heaviest = [...files].sort((left, right) => right.milliseconds - left.milliseconds);\n const totalMilliseconds = files.reduce((sum, entry) => sum + entry.milliseconds, 0);\n\n let accumulated = 0;\n let filesFor80Percent = 0;\n\n for (const entry of heaviest) {\n accumulated += entry.milliseconds;\n filesFor80Percent += 1;\n\n if (accumulated >= totalMilliseconds * HEAVY_SHARE) {\n break;\n }\n }\n\n const light = files.filter((entry) => entry.milliseconds < LIGHT_FILE_MILLISECONDS);\n const labels = [...new Set(files.map((entry) => entry.label))];\n\n return {\n files,\n totalMilliseconds,\n totalCases: files.reduce((sum, entry) => sum + entry.cases, 0),\n totalAssertions: files.reduce((sum, entry) => sum + entry.assertions, 0),\n totalSkipped: files.reduce((sum, entry) => sum + entry.skipped, 0),\n perLabel: labels.map((label) => {\n const own = files.filter((entry) => entry.label === label);\n\n return {\n label,\n files: own.length,\n cases: own.reduce((sum, entry) => sum + entry.cases, 0),\n milliseconds: own.reduce((sum, entry) => sum + entry.milliseconds, 0),\n };\n }),\n heaviest,\n filesFor80Percent,\n lightFiles: {\n count: light.length,\n milliseconds: light.reduce((sum, entry) => sum + entry.milliseconds, 0),\n },\n sameNameAcrossFiles: [...names.entries()]\n .filter(([, where]) => where.size > 1)\n .map(([name, where]) => ({ name, files: [...where].sort() })),\n zeroAssertionFiles: files\n .filter((entry) => entry.assertions === 0)\n .map((entry) => entry.file),\n skippedFiles: files\n .filter((entry) => entry.skipped > 0)\n .map((entry) => ({ file: `${entry.label}/${entry.file}`, skipped: entry.skipped })),\n };\n }\n\n /** The report as the lines `devz check test-weight` prints. */\n static formatReport(opts: { report: ITestWeightReport; top?: number }): string[] {\n const { report, top = 25 } = opts;\n const seconds = (milliseconds: number): string => (milliseconds / 1000).toFixed(1);\n const lines: string[] = [\n `files ${report.files.length} | cases ${report.totalCases} | assertions ${report.totalAssertions} | skipped ${report.totalSkipped} | sum of file times ${seconds(report.totalMilliseconds)} s`,\n ];\n\n for (const row of report.perLabel) {\n lines.push(\n ` ${row.label.padEnd(14)} files ${String(row.files).padStart(4)} cases ${String(row.cases).padStart(5)} time ${seconds(row.milliseconds).padStart(7)} s`,\n );\n }\n\n lines.push('', `heaviest ${top} files:`);\n\n for (const entry of report.heaviest.slice(0, top)) {\n lines.push(\n `${entry.milliseconds.toFixed(0).padStart(8)} ms ${String(entry.cases).padStart(5)} cases slowest ${entry.slowestMilliseconds.toFixed(0).padStart(7)} ms ${entry.label}/${entry.file}`,\n );\n }\n\n lines.push(\n '',\n `80% of the time is in the ${report.filesFor80Percent} heaviest files of ${report.files.length}`,\n `files under ${LIGHT_FILE_MILLISECONDS} ms: ${report.lightFiles.count}, together ${seconds(report.lightFiles.milliseconds)} s`,\n `same suite and case name in more than one file: ${report.sameNameAcrossFiles.length}`,\n );\n\n for (const duplicate of report.sameNameAcrossFiles.slice(0, 10)) {\n lines.push(` ${duplicate.name.slice(0, 90)} -> ${duplicate.files.join(', ')}`);\n }\n\n lines.push(\n `files with 0 assertions: ${report.zeroAssertionFiles.length}${report.zeroAssertionFiles.length ? ` (${report.zeroAssertionFiles.slice(0, 3).join(', ')})` : ''}`,\n `files with skipped cases: ${report.skippedFiles.length} (${report.skippedFiles.reduce((sum, entry) => sum + entry.skipped, 0)} cases)`,\n );\n\n return lines;\n }\n}\n"]}
1
+ {"version":3,"file":"test-weight.js","sourceRoot":"","sources":["../../src/checks/test-weight.ts"],"names":[],"mappings":";;;AA8CA,MAAM,QAAQ,GAA2B;IACvC,GAAG,EAAE,GAAG;IACR,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAC9C,IAAI,CAAC,OAAO,CAAC,iCAAiC,EAAE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,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,KAAK,CAAC,IAAI,CACR,4BAA4B,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EACjK,6BAA6B,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CACxI,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtID,0CAsIC","sourcesContent":["/**\n * Reads the JUnit report of `bun test --reporter=junit` and says where the test time and the test\n * count are: per file, per package, the heaviest files, duplicates by name, files that assert nothing,\n * and skips. The first step of the trim-tests method (`.agents/knowledge/process/trimming-tests.md`).\n *\n * The numbers are only as good as the run that made them: a `--parallel` run times each file under\n * contention, so a file that takes 7 s there can take 1 s alone. Re-time a suspect file alone.\n */\nexport interface ITestWeightInput {\n /** Names the report in the output: the package. */\n label: string;\n xml: string;\n}\n\n/** Time and counts of one test file from a JUnit report. */\nexport interface ITestFileWeight {\n label: string;\n file: string;\n milliseconds: number;\n cases: number;\n assertions: number;\n skipped: number;\n slowestCase: string;\n slowestMilliseconds: number;\n}\n\n/** Result of `TestWeightCheck.analyseJunit`: totals, per-package sums, the heaviest files and the suspect ones. */\nexport interface ITestWeightReport {\n files: ITestFileWeight[];\n totalMilliseconds: number;\n totalCases: number;\n totalAssertions: number;\n totalSkipped: number;\n perLabel: Array<{ label: string; files: number; cases: number; milliseconds: number }>;\n /** Heaviest first. */\n heaviest: ITestFileWeight[];\n /** How many of the heaviest files hold 80% of the time. */\n filesFor80Percent: number;\n /** Files that take under 100 ms, and what they cost together. */\n lightFiles: { count: number; milliseconds: number };\n /** The same suite and case name in more than one file. */\n sameNameAcrossFiles: Array<{ name: string; files: string[] }>;\n zeroAssertionFiles: string[];\n skippedFiles: Array<{ file: string; skipped: number }>;\n}\n\nconst ENTITIES: Record<string, string> = {\n amp: '&',\n lt: '<',\n gt: '>',\n quot: '\"',\n apos: \"'\",\n};\n\nconst decodeEntities = (text: string): string =>\n text.replace(/&(#x[0-9a-fA-F]+|#\\d+|[a-z]+);/g, (whole, body: string) => {\n if (body.startsWith('#x')) {\n return String.fromCodePoint(Number.parseInt(body.slice(2), 16));\n }\n\n if (body.startsWith('#')) {\n return String.fromCodePoint(Number.parseInt(body.slice(1), 10));\n }\n\n return ENTITIES[body] ?? whole;\n });\n\n/** Bun writes a file as a top-level suite whose `name` equals its `file`. */\nconst FILE_SUITE =\n /<testsuite name=\"([^\"]+\\.(?:test|spec)\\.[cm]?[jt]sx?)\" file=\"[^\"]+\" tests=\"(\\d+)\" assertions=\"(\\d+)\" failures=\"\\d+\" skipped=\"(\\d+)\" time=\"([\\d.eE+-]+)\"/g;\nconst CASE = /<testcase name=\"([^\"]*)\" classname=\"([^\"]*)\" time=\"([\\d.eE+-]+)\" file=\"([^\"]+)\"/g;\n\nconst LIGHT_FILE_MILLISECONDS = 100;\nconst HEAVY_SHARE = 0.8;\n\n/** Reads JUnit reports of `bun test` and shows where the test time and the test count are. */\nexport class TestWeightCheck {\n /** Reads the JUnit reports of a test run into one weight report: which files carry the time, and what looks wrong. */\n static analyseJunit(opts: { reports: ITestWeightInput[] }): ITestWeightReport {\n const files: ITestFileWeight[] = [];\n const names = new Map<string, Set<string>>();\n\n for (const { label, xml } of opts.reports) {\n const start = files.length;\n\n for (const match of xml.matchAll(FILE_SUITE)) {\n files.push({\n label,\n file: match[1],\n milliseconds: Number(match[5]) * 1000,\n cases: Number(match[2]),\n assertions: Number(match[3]),\n skipped: Number(match[4]),\n slowestCase: '',\n slowestMilliseconds: 0,\n });\n }\n\n const byFile = new Map(files.slice(start).map((entry) => [entry.file, entry]));\n\n for (const match of xml.matchAll(CASE)) {\n const caseName = decodeEntities(match[1]);\n const suiteName = decodeEntities(match[2]);\n const entry = byFile.get(match[4]);\n const milliseconds = Number(match[3]) * 1000;\n\n if (entry && milliseconds > entry.slowestMilliseconds) {\n entry.slowestMilliseconds = milliseconds;\n entry.slowestCase = caseName;\n }\n\n const key = `${suiteName} > ${caseName}`;\n const where = names.get(key) ?? new Set<string>();\n where.add(`${label}/${match[4]}`);\n names.set(key, where);\n }\n }\n\n const heaviest = [...files].sort((left, right) => right.milliseconds - left.milliseconds);\n const totalMilliseconds = files.reduce((sum, entry) => sum + entry.milliseconds, 0);\n\n let accumulated = 0;\n let filesFor80Percent = 0;\n\n for (const entry of heaviest) {\n accumulated += entry.milliseconds;\n filesFor80Percent += 1;\n\n if (accumulated >= totalMilliseconds * HEAVY_SHARE) {\n break;\n }\n }\n\n const light = files.filter((entry) => entry.milliseconds < LIGHT_FILE_MILLISECONDS);\n const labels = [...new Set(files.map((entry) => entry.label))];\n\n return {\n files,\n totalMilliseconds,\n totalCases: files.reduce((sum, entry) => sum + entry.cases, 0),\n totalAssertions: files.reduce((sum, entry) => sum + entry.assertions, 0),\n totalSkipped: files.reduce((sum, entry) => sum + entry.skipped, 0),\n perLabel: labels.map((label) => {\n const own = files.filter((entry) => entry.label === label);\n\n return {\n label,\n files: own.length,\n cases: own.reduce((sum, entry) => sum + entry.cases, 0),\n milliseconds: own.reduce((sum, entry) => sum + entry.milliseconds, 0),\n };\n }),\n heaviest,\n filesFor80Percent,\n lightFiles: {\n count: light.length,\n milliseconds: light.reduce((sum, entry) => sum + entry.milliseconds, 0),\n },\n sameNameAcrossFiles: [...names.entries()]\n .filter(([, where]) => where.size > 1)\n .map(([name, where]) => ({ name, files: [...where].sort() })),\n zeroAssertionFiles: files\n .filter((entry) => entry.assertions === 0)\n .map((entry) => entry.file),\n skippedFiles: files\n .filter((entry) => entry.skipped > 0)\n .map((entry) => ({ file: `${entry.label}/${entry.file}`, skipped: entry.skipped })),\n };\n }\n\n /** The report as the lines `devz check test-weight` prints. */\n static formatReport(opts: { report: ITestWeightReport; top?: number }): string[] {\n const { report, top = 25 } = opts;\n const seconds = (milliseconds: number): string => (milliseconds / 1000).toFixed(1);\n const lines: string[] = [\n `files ${report.files.length} | cases ${report.totalCases} | assertions ${report.totalAssertions} | skipped ${report.totalSkipped} | sum of file times ${seconds(report.totalMilliseconds)} s`,\n ];\n\n for (const row of report.perLabel) {\n lines.push(\n ` ${row.label.padEnd(14)} files ${String(row.files).padStart(4)} cases ${String(row.cases).padStart(5)} time ${seconds(row.milliseconds).padStart(7)} s`,\n );\n }\n\n lines.push('', `heaviest ${top} files:`);\n\n for (const entry of report.heaviest.slice(0, top)) {\n lines.push(\n `${entry.milliseconds.toFixed(0).padStart(8)} ms ${String(entry.cases).padStart(5)} cases slowest ${entry.slowestMilliseconds.toFixed(0).padStart(7)} ms ${entry.label}/${entry.file}`,\n );\n }\n\n lines.push(\n '',\n `80% of the time is in the ${report.filesFor80Percent} heaviest files of ${report.files.length}`,\n `files under ${LIGHT_FILE_MILLISECONDS} ms: ${report.lightFiles.count}, together ${seconds(report.lightFiles.milliseconds)} s`,\n `same suite and case name in more than one file: ${report.sameNameAcrossFiles.length}`,\n );\n\n for (const duplicate of report.sameNameAcrossFiles.slice(0, 10)) {\n lines.push(` ${duplicate.name.slice(0, 90)} -> ${duplicate.files.join(', ')}`);\n }\n\n lines.push(\n `files with 0 assertions: ${report.zeroAssertionFiles.length}${report.zeroAssertionFiles.length ? ` (${report.zeroAssertionFiles.slice(0, 3).join(', ')})` : ''}`,\n `files with skipped cases: ${report.skippedFiles.length} (${report.skippedFiles.reduce((sum, entry) => sum + entry.skipped, 0)} cases)`,\n );\n\n return lines;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ export interface IAnyAliasesResult {
2
+ output: string;
3
+ changed: boolean;
4
+ /** How many type references were rewritten. */
5
+ rewritten: number;
6
+ /** What the codemod cannot place: file line (1-based) and why. */
7
+ manual: Array<{
8
+ line: number;
9
+ reason: string;
10
+ }>;
11
+ /** Same-named types that are not the IGNIS aliases: file line (1-based) and the name. */
12
+ local: Array<{
13
+ line: number;
14
+ name: string;
15
+ }>;
16
+ }
17
+ /** Replaces the deleted `AnyType` and `AnyObject` aliases by what they stood for (`any`), or with `isStrict` by the tighter types. */
18
+ export declare class AnyAliases {
19
+ static rewrite(opts: {
20
+ typescript: typeof import('typescript');
21
+ fileName: string;
22
+ source: string;
23
+ /** Write `unknown` and `Record<string, unknown>` instead of `any`. */
24
+ isStrict?: boolean;
25
+ }): IAnyAliasesResult;
26
+ }
27
+ /** `devz codemod any-aliases`: reads the sources, prints what changes, writes with `--write`. */
28
+ export declare class AnyAliasesCommand {
29
+ static readonly USAGE = "Usage: devz codemod any-aliases [paths...] [--strict] [--write [--all] | --check]\n\nReplaces the AnyType and AnyObject aliases the @venizia/ignis-helpers and @venizia/ignis-inversion\nreleases deleted, by what they stood for, so a bump changes no type in your code:\n\n AnyType becomes any\n AnyObject becomes Record<string | symbol | number, any>\n\nin every file that imports them from @venizia/ignis, @venizia/ignis-helpers, @venizia/ignis-inversion,\n@venizia/ardor or @venizia/ardor-kernel (ARDOR re-exported the same two names; a sub-path such as\n@venizia/ignis-helpers/common too), whatever local name the import gives them\n(import { AnyType as Loose } ...). The names leave the import, and an import left empty is dropped.\n\nWith --strict it writes the tighter types instead of the default ones, for code that wants to stop using any:\n\n AnyType becomes unknown\n AnyObject becomes Record<string, unknown>\n\n--strict surfaces errors that any hid: an unknown value cannot be read, or passed as a narrower type, without a\ncheck; an interface-typed value is not assignable to Record<string, unknown> (an interface has no implicit\nindex signature); and a symbol key on a former AnyObject fails (TS2538). Declare the shape as a type\nalias, spread the value, or narrow it; run your typecheck after it.\n--strict acts only on the alias names: a file already rewritten to any is left alone, so run it instead of\nthe default run, on a path at a time, and tighten the rest by hand.\n\nIt lists, and leaves alone:\n manual a re-export (export { AnyType }, export type { AnyObject } from ...), an import(\"...\").AnyType\n type, and AnyType in a heritage clause (extends any and extends unknown are not valid)\n local a same-named type the file declares (in any scope: a namespace, a function, a block, a type\n parameter) or imports from somewhere else; a use that such a declaration shadows is left alone\n\nA name used in a heritage clause keeps its import, and so keeps all its other uses in that file: once you\nreplace the heritage use by hand, run the codemod again and the other uses are rewritten.\n\nIt reads TypeScript files (.ts, .tsx, .mts, .cts) and is idempotent: a second run changes nothing.\n\n --strict write unknown and Record<string, unknown> instead of any\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change or a manual case is left (for CI)\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the files\ngit knows, and --write refuses a file with local changes: commit or stash it first, so git can undo it.\nThere is no --reverse: a downgrade restores the files from git.";
30
+ static run(opts: {
31
+ root: string;
32
+ args: string[];
33
+ }): Promise<number>;
34
+ }
35
+ //# sourceMappingURL=any-aliases.d.ts.map