miniread 1.17.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/scripts/evaluate/check-expected-evaluations.d.ts +1 -1
  2. package/dist/scripts/evaluate/check-expected-evaluations.js +8 -7
  3. package/dist/scripts/evaluate/create-evaluate-command.js +1 -2
  4. package/dist/scripts/evaluate/parse-evaluate-cli-options.d.ts +2 -2
  5. package/dist/scripts/evaluate/parse-evaluate-cli-options.js +4 -2
  6. package/dist/scripts/evaluate/run-check-mode.d.ts +1 -1
  7. package/dist/scripts/evaluate/run-check-mode.js +9 -4
  8. package/dist/scripts/evaluate/run-evaluate-cli.js +6 -3
  9. package/dist/scripts/evaluate/transform-manifest.d.ts +3 -1
  10. package/dist/scripts/evaluate/transform-manifest.js +43 -36
  11. package/dist/scripts/snapshot/format-code.d.ts +1 -0
  12. package/dist/scripts/snapshot/format-code.js +4 -0
  13. package/dist/scripts/snapshot/print-snapshot-diff.d.ts +6 -0
  14. package/dist/scripts/snapshot/print-snapshot-diff.js +26 -0
  15. package/dist/scripts/snapshot/resolve-testcase-input.d.ts +16 -0
  16. package/dist/scripts/snapshot/resolve-testcase-input.js +30 -0
  17. package/dist/scripts/snapshot/run-snapshot-cli.js +67 -119
  18. package/dist/scripts/snapshot/run-testcase-transform.d.ts +13 -0
  19. package/dist/scripts/snapshot/run-testcase-transform.js +46 -0
  20. package/dist/transforms/_generated/manifest.d.ts +14 -0
  21. package/dist/transforms/_generated/manifest.js +173 -0
  22. package/dist/transforms/_generated/registry.d.ts +3 -0
  23. package/dist/transforms/_generated/registry.js +55 -0
  24. package/dist/transforms/expand-boolean-literals/manifest.json +6 -0
  25. package/dist/transforms/expand-sequence-expressions-v4/manifest.json +7 -0
  26. package/dist/transforms/expand-sequence-expressions-v5/manifest.json +5 -0
  27. package/dist/transforms/expand-special-number-literals/manifest.json +6 -0
  28. package/dist/transforms/expand-undefined-literals/manifest.json +6 -0
  29. package/dist/transforms/preset-stats.json +6 -0
  30. package/dist/transforms/remove-redundant-else/manifest.json +6 -0
  31. package/dist/transforms/rename-catch-parameters/manifest.json +6 -0
  32. package/dist/transforms/rename-char-code-at/manifest.json +6 -0
  33. package/dist/transforms/rename-charcode-variables/manifest.json +7 -0
  34. package/dist/transforms/rename-charcode-variables-v2/manifest.json +6 -0
  35. package/dist/transforms/rename-comparison-flags/manifest.json +6 -0
  36. package/dist/transforms/rename-destructured-aliases/manifest.json +6 -0
  37. package/dist/transforms/rename-event-parameters/manifest.json +5 -0
  38. package/dist/transforms/rename-loop-index-variables/manifest.json +7 -0
  39. package/dist/transforms/rename-loop-index-variables-v2/manifest.json +7 -0
  40. package/dist/transforms/rename-loop-index-variables-v3/manifest.json +6 -0
  41. package/dist/transforms/rename-parameters-to-match-properties/manifest.json +5 -0
  42. package/dist/transforms/rename-promise-executor-parameters/manifest.json +6 -0
  43. package/dist/transforms/rename-replace-child-parameters/manifest.json +6 -0
  44. package/dist/transforms/rename-this-aliases/manifest.json +6 -0
  45. package/dist/transforms/rename-timeout-ids/manifest.json +6 -0
  46. package/dist/transforms/rename-use-reference-guards/manifest.json +7 -0
  47. package/dist/transforms/rename-use-reference-guards-v2/manifest.json +5 -0
  48. package/dist/transforms/simplify-boolean-negations/manifest.json +5 -0
  49. package/dist/transforms/simplify-boolean-negations/simplify-boolean-negations-transform.d.ts +2 -0
  50. package/dist/transforms/simplify-boolean-negations/simplify-boolean-negations-transform.js +90 -0
  51. package/dist/transforms/split-variable-declarations/manifest.json +6 -0
  52. package/dist/transforms/transform-presets.js +2 -17
  53. package/dist/transforms/transform-registry.d.ts +1 -3
  54. package/dist/transforms/transform-registry.js +1 -51
  55. package/package.json +5 -6
  56. package/dist/scripts/evaluate/parse-transform-manifest.d.ts +0 -22
  57. package/dist/scripts/evaluate/parse-transform-manifest.js +0 -29
  58. package/transform-manifest.json +0 -251
@@ -0,0 +1,46 @@
1
+ import { createRequire } from "node:module";
2
+ import * as fs from "node:fs/promises";
3
+ import { buildProjectGraph } from "../../core/project-graph.js";
4
+ import { transformPresets } from "../../transforms/transform-presets.js";
5
+ import { transformRegistry } from "../../transforms/transform-registry.js";
6
+ import { formatCode } from "./format-code.js";
7
+ const require = createRequire(import.meta.url);
8
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
9
+ const generate = require("@babel/generator").default;
10
+ const runTransform = async (inputPath, transformId) => {
11
+ const content = await fs.readFile(inputPath, "utf8");
12
+ const transformIds = transformId === "recommended"
13
+ ? transformPresets.recommended
14
+ : [transformId];
15
+ const transforms = transformIds.map((id) => {
16
+ const transform = transformRegistry[id];
17
+ if (!transform) {
18
+ throw new Error(`Unknown transform: ${id}. Run 'miniread --list-transforms' to see available transforms.`);
19
+ }
20
+ return transform;
21
+ });
22
+ const projectGraph = buildProjectGraph([{ path: inputPath, content }]);
23
+ for (const transform of transforms) {
24
+ await transform.transform({
25
+ projectGraph,
26
+ currentFile: undefined,
27
+ options: {},
28
+ });
29
+ }
30
+ const fileInfo = projectGraph.files.get(inputPath);
31
+ if (!fileInfo)
32
+ return content;
33
+ return generate(fileInfo.ast).code;
34
+ };
35
+ export const runTestcaseTransform = async (options) => {
36
+ const { inputPath, transformId } = options;
37
+ try {
38
+ const rawOutput = await runTransform(inputPath, transformId);
39
+ const output = await formatCode(rawOutput);
40
+ return { ok: true, value: output };
41
+ }
42
+ catch (error) {
43
+ const message = error instanceof Error ? error.message : String(error);
44
+ return { ok: false, error: new Error(message) };
45
+ }
46
+ };
@@ -0,0 +1,14 @@
1
+ import type { Transform } from "../../core/types.js";
2
+ export type TransformManifestEntry = {
3
+ id: string;
4
+ description: string;
5
+ scope: Transform["scope"];
6
+ parallelizable: boolean;
7
+ diffReductionImpact: number;
8
+ recommended: boolean;
9
+ evaluatedAt?: string;
10
+ notes?: string;
11
+ supersededBy?: string;
12
+ };
13
+ export declare const manifestEntries: TransformManifestEntry[];
14
+ export declare const recommendedTransformIds: string[];
@@ -0,0 +1,173 @@
1
+ // THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
2
+ // Run `pnpm run build` to regenerate.
3
+ import { transformRegistry } from "./registry.js";
4
+ const manifestData = {
5
+ "expand-boolean-literals": {
6
+ diffReductionImpact: 0,
7
+ recommended: true,
8
+ evaluatedAt: "2026-01-21T15:01:23.708Z",
9
+ notes: "Improves readability but does not reduce diffs (boolean literals are already deterministic)",
10
+ },
11
+ "expand-sequence-expressions-v4": {
12
+ diffReductionImpact: -0.01730809158000035,
13
+ recommended: false,
14
+ evaluatedAt: "2026-01-23T10:57:45.082Z",
15
+ notes: "Measured with baseline none: -1.73%. Supersedes all prior sequence expression transforms. Superseded by expand-sequence-expressions-v5.",
16
+ supersededBy: "expand-sequence-expressions-v5",
17
+ },
18
+ "expand-sequence-expressions-v5": {
19
+ diffReductionImpact: -0.020243106019139034,
20
+ recommended: true,
21
+ notes: "Extends expand-sequence-expressions-v4 by also expanding `if ((a, b)) ...` style tests.",
22
+ },
23
+ "expand-special-number-literals": {
24
+ diffReductionImpact: 0,
25
+ recommended: true,
26
+ evaluatedAt: "2026-01-23T08:17:45.579Z",
27
+ notes: "Auto-added by evaluation script.",
28
+ },
29
+ "expand-undefined-literals": {
30
+ diffReductionImpact: 0,
31
+ recommended: true,
32
+ evaluatedAt: "2026-01-21T16:27:42.316Z",
33
+ notes: "Auto-added by evaluation script.",
34
+ },
35
+ "remove-redundant-else": {
36
+ diffReductionImpact: 0,
37
+ recommended: true,
38
+ evaluatedAt: "2026-01-23T18:15:00.000Z",
39
+ notes: "Added manually; improves readability by reducing nesting.",
40
+ },
41
+ "rename-catch-parameters": {
42
+ diffReductionImpact: 0.0007738623280043599,
43
+ recommended: true,
44
+ evaluatedAt: "2026-01-23T07:48:59.087Z",
45
+ notes: "Auto-added by evaluation script.",
46
+ },
47
+ "rename-char-code-at": {
48
+ diffReductionImpact: 0,
49
+ recommended: true,
50
+ evaluatedAt: "2026-01-23T18:00:00.000Z",
51
+ notes: "Measured with baseline none: 0.00%. Renames variables used in charCodeAt to improve readability.",
52
+ },
53
+ "rename-charcode-variables": {
54
+ diffReductionImpact: 0,
55
+ recommended: false,
56
+ evaluatedAt: "2026-01-23T17:59:00.000Z",
57
+ notes: "Superseded by rename-charcode-variables-v2.",
58
+ supersededBy: "rename-charcode-variables-v2",
59
+ },
60
+ "rename-charcode-variables-v2": {
61
+ diffReductionImpact: 0,
62
+ recommended: true,
63
+ evaluatedAt: "2026-01-23T18:10:00.000Z",
64
+ notes: "Derives names from charCodeAt argument for better stability (e.g., $charCodeAtIndex, $charCodeAtIndexPlus1).",
65
+ },
66
+ "rename-comparison-flags": {
67
+ diffReductionImpact: 0,
68
+ recommended: true,
69
+ evaluatedAt: "2026-01-23T17:54:14.000Z",
70
+ notes: "Measured with baseline none: 0%. Improves readability by renaming minified variables like 'saA === \"darwin\"' to '$isDarwin'.",
71
+ },
72
+ "rename-destructured-aliases": {
73
+ diffReductionImpact: 0.000943734546346775,
74
+ recommended: true,
75
+ evaluatedAt: "2026-01-22T12:49:10.952Z",
76
+ notes: "Auto-added by evaluation script. Measured with baseline none: 0.09%.",
77
+ },
78
+ "rename-event-parameters": {
79
+ diffReductionImpact: 0,
80
+ recommended: true,
81
+ notes: "Added manually; recommended based on high-confidence heuristics (not yet evaluated).",
82
+ },
83
+ "rename-loop-index-variables": {
84
+ diffReductionImpact: 0,
85
+ recommended: false,
86
+ evaluatedAt: "2026-01-21T21:06:19.512Z",
87
+ notes: "Superseded by rename-loop-index-variables-v3.",
88
+ supersededBy: "rename-loop-index-variables-v3",
89
+ },
90
+ "rename-loop-index-variables-v2": {
91
+ diffReductionImpact: 0,
92
+ recommended: false,
93
+ evaluatedAt: "2026-01-23T16:34:06.000Z",
94
+ notes: "Superseded by rename-loop-index-variables-v3.",
95
+ supersededBy: "rename-loop-index-variables-v3",
96
+ },
97
+ "rename-loop-index-variables-v3": {
98
+ diffReductionImpact: 0,
99
+ recommended: true,
100
+ evaluatedAt: "2026-01-23T17:09:04.000Z",
101
+ notes: "Unifies rename-loop-index-variables and rename-loop-index-variables-v2 without modifying older transforms. Measured with baseline none: 0.00%.",
102
+ },
103
+ "rename-parameters-to-match-properties": {
104
+ diffReductionImpact: 0.00003774938185385768,
105
+ recommended: true,
106
+ notes: "Added manually based on high-confidence heuristic.",
107
+ },
108
+ "rename-promise-executor-parameters": {
109
+ diffReductionImpact: 0,
110
+ recommended: true,
111
+ evaluatedAt: "2026-01-22T21:39:53.578Z",
112
+ notes: "Auto-added by evaluation script.",
113
+ },
114
+ "rename-replace-child-parameters": {
115
+ diffReductionImpact: 0,
116
+ recommended: false,
117
+ evaluatedAt: "2026-01-23T17:28:09.184Z",
118
+ notes: "Measured with baseline none: 0.00%.",
119
+ },
120
+ "rename-this-aliases": {
121
+ diffReductionImpact: 0.00003774938185385768,
122
+ recommended: true,
123
+ evaluatedAt: "2026-01-23T17:57:26.908Z",
124
+ notes: "Measured with baseline none: 0.00%. Improves readability by stabilizing `this` aliases used for closures.",
125
+ },
126
+ "rename-timeout-ids": {
127
+ diffReductionImpact: 0.00003774938185385768,
128
+ recommended: true,
129
+ evaluatedAt: "2026-01-23T10:29:23.279Z",
130
+ notes: "Measured with baseline none: 0.00%. Added to recommended for readability.",
131
+ },
132
+ "rename-use-reference-guards": {
133
+ diffReductionImpact: 0,
134
+ recommended: false,
135
+ evaluatedAt: "2026-01-22T17:03:19.826Z",
136
+ notes: "Superseded by rename-use-reference-guards-v2.",
137
+ supersededBy: "rename-use-reference-guards-v2",
138
+ },
139
+ "rename-use-reference-guards-v2": {
140
+ diffReductionImpact: 0,
141
+ recommended: true,
142
+ notes: "Supersedes rename-use-reference-guards and also covers guards that reset to false.",
143
+ },
144
+ "simplify-boolean-negations": {
145
+ diffReductionImpact: 0,
146
+ recommended: true,
147
+ notes: "Added manually; improves readability and cleans up `expand-boolean-literals` output.",
148
+ },
149
+ "split-variable-declarations": {
150
+ diffReductionImpact: -0.0027651422207961573,
151
+ recommended: true,
152
+ evaluatedAt: "2026-01-23T05:45:27.981Z",
153
+ notes: "Auto-added by evaluation script. Measured with baseline none: -0.28%. Enabled in the recommended preset for readability and to normalize variable declarations even when line diffs increase.",
154
+ },
155
+ };
156
+ export const manifestEntries = Object.entries(transformRegistry)
157
+ .map(([id, transform]) => {
158
+ const data = manifestData[id];
159
+ if (!data) {
160
+ throw new Error(`Missing manifest data for transform: ${id}`);
161
+ }
162
+ return {
163
+ id,
164
+ description: transform.description,
165
+ scope: transform.scope,
166
+ parallelizable: transform.parallelizable,
167
+ ...data,
168
+ };
169
+ })
170
+ .toSorted((a, b) => a.id.localeCompare(b.id));
171
+ export const recommendedTransformIds = manifestEntries
172
+ .filter((entry) => entry.recommended)
173
+ .map((entry) => entry.id);
@@ -0,0 +1,3 @@
1
+ import type { Transform } from "../../core/types.js";
2
+ export declare const transformRegistry: Record<string, Transform>;
3
+ export declare const allTransformIds: string[];
@@ -0,0 +1,55 @@
1
+ // THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
2
+ // Run `pnpm run build` to regenerate.
3
+ import { expandBooleanLiteralsTransform } from "../expand-boolean-literals/expand-boolean-literals-transform.js";
4
+ import { expandSequenceExpressionsV4Transform } from "../expand-sequence-expressions-v4/expand-sequence-expressions-v4-transform.js";
5
+ import { expandSequenceExpressionsV5Transform } from "../expand-sequence-expressions-v5/expand-sequence-expressions-v5-transform.js";
6
+ import { expandSpecialNumberLiteralsTransform } from "../expand-special-number-literals/expand-special-number-literals-transform.js";
7
+ import { expandUndefinedLiteralsTransform } from "../expand-undefined-literals/expand-undefined-literals-transform.js";
8
+ import { removeRedundantElseTransform } from "../remove-redundant-else/remove-redundant-else-transform.js";
9
+ import { renameCatchParametersTransform } from "../rename-catch-parameters/rename-catch-parameters-transform.js";
10
+ import { renameCharCodeAtTransform } from "../rename-char-code-at/rename-char-code-at-transform.js";
11
+ import { renameCharcodeVariablesTransform } from "../rename-charcode-variables/rename-charcode-variables-transform.js";
12
+ import { renameCharcodeVariablesV2Transform } from "../rename-charcode-variables-v2/rename-charcode-variables-v2-transform.js";
13
+ import { renameComparisonFlagsTransform } from "../rename-comparison-flags/rename-comparison-flags-transform.js";
14
+ import { renameDestructuredAliasesTransform } from "../rename-destructured-aliases/rename-destructured-aliases-transform.js";
15
+ import { renameEventParametersTransform } from "../rename-event-parameters/rename-event-parameters-transform.js";
16
+ import { renameLoopIndexVariablesTransform } from "../rename-loop-index-variables/rename-loop-index-variables-transform.js";
17
+ import { renameLoopIndexVariablesV2Transform } from "../rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js";
18
+ import { renameLoopIndexVariablesV3Transform } from "../rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js";
19
+ import { renameParametersToMatchPropertiesTransform } from "../rename-parameters-to-match-properties/rename-parameters-to-match-properties-transform.js";
20
+ import { renamePromiseExecutorParametersTransform } from "../rename-promise-executor-parameters/rename-promise-executor-parameters-transform.js";
21
+ import { renameReplaceChildParametersTransform } from "../rename-replace-child-parameters/rename-replace-child-parameters-transform.js";
22
+ import { renameThisAliasesTransform } from "../rename-this-aliases/rename-this-aliases-transform.js";
23
+ import { renameTimeoutIdsTransform } from "../rename-timeout-ids/rename-timeout-ids-transform.js";
24
+ import { renameUseReferenceGuardsTransform } from "../rename-use-reference-guards/rename-use-reference-guards-transform.js";
25
+ import { renameUseReferenceGuardsV2Transform } from "../rename-use-reference-guards-v2/rename-use-reference-guards-v2-transform.js";
26
+ import { simplifyBooleanNegationsTransform } from "../simplify-boolean-negations/simplify-boolean-negations-transform.js";
27
+ import { splitVariableDeclarationsTransform } from "../split-variable-declarations/split-variable-declarations-transform.js";
28
+ export const transformRegistry = {
29
+ [expandBooleanLiteralsTransform.id]: expandBooleanLiteralsTransform,
30
+ [expandSequenceExpressionsV4Transform.id]: expandSequenceExpressionsV4Transform,
31
+ [expandSequenceExpressionsV5Transform.id]: expandSequenceExpressionsV5Transform,
32
+ [expandSpecialNumberLiteralsTransform.id]: expandSpecialNumberLiteralsTransform,
33
+ [expandUndefinedLiteralsTransform.id]: expandUndefinedLiteralsTransform,
34
+ [removeRedundantElseTransform.id]: removeRedundantElseTransform,
35
+ [renameCatchParametersTransform.id]: renameCatchParametersTransform,
36
+ [renameCharCodeAtTransform.id]: renameCharCodeAtTransform,
37
+ [renameCharcodeVariablesTransform.id]: renameCharcodeVariablesTransform,
38
+ [renameCharcodeVariablesV2Transform.id]: renameCharcodeVariablesV2Transform,
39
+ [renameComparisonFlagsTransform.id]: renameComparisonFlagsTransform,
40
+ [renameDestructuredAliasesTransform.id]: renameDestructuredAliasesTransform,
41
+ [renameEventParametersTransform.id]: renameEventParametersTransform,
42
+ [renameLoopIndexVariablesTransform.id]: renameLoopIndexVariablesTransform,
43
+ [renameLoopIndexVariablesV2Transform.id]: renameLoopIndexVariablesV2Transform,
44
+ [renameLoopIndexVariablesV3Transform.id]: renameLoopIndexVariablesV3Transform,
45
+ [renameParametersToMatchPropertiesTransform.id]: renameParametersToMatchPropertiesTransform,
46
+ [renamePromiseExecutorParametersTransform.id]: renamePromiseExecutorParametersTransform,
47
+ [renameReplaceChildParametersTransform.id]: renameReplaceChildParametersTransform,
48
+ [renameThisAliasesTransform.id]: renameThisAliasesTransform,
49
+ [renameTimeoutIdsTransform.id]: renameTimeoutIdsTransform,
50
+ [renameUseReferenceGuardsTransform.id]: renameUseReferenceGuardsTransform,
51
+ [renameUseReferenceGuardsV2Transform.id]: renameUseReferenceGuardsV2Transform,
52
+ [simplifyBooleanNegationsTransform.id]: simplifyBooleanNegationsTransform,
53
+ [splitVariableDeclarationsTransform.id]: splitVariableDeclarationsTransform,
54
+ };
55
+ export const allTransformIds = Object.keys(transformRegistry);
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-21T15:01:23.708Z",
5
+ "notes": "Improves readability but does not reduce diffs (boolean literals are already deterministic)"
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "diffReductionImpact": -0.01730809158000035,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-23T10:57:45.082Z",
5
+ "notes": "Measured with baseline none: -1.73%. Supersedes all prior sequence expression transforms. Superseded by expand-sequence-expressions-v5.",
6
+ "supersededBy": "expand-sequence-expressions-v5"
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "diffReductionImpact": -0.020243106019139034,
3
+ "recommended": true,
4
+ "notes": "Extends expand-sequence-expressions-v4 by also expanding `if ((a, b)) ...` style tests."
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T08:17:45.579Z",
5
+ "notes": "Auto-added by evaluation script."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-21T16:27:42.316Z",
5
+ "notes": "Auto-added by evaluation script."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommended": {
3
+ "diffReductionImpact": 0.003690002076215948,
4
+ "notes": "Measured with baseline none: 0.37%."
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T18:15:00.000Z",
5
+ "notes": "Added manually; improves readability by reducing nesting."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0.0007738623280043599,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T07:48:59.087Z",
5
+ "notes": "Auto-added by evaluation script."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T18:00:00.000Z",
5
+ "notes": "Measured with baseline none: 0.00%. Renames variables used in charCodeAt to improve readability."
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-23T17:59:00.000Z",
5
+ "notes": "Superseded by rename-charcode-variables-v2.",
6
+ "supersededBy": "rename-charcode-variables-v2"
7
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T18:10:00.000Z",
5
+ "notes": "Derives names from charCodeAt argument for better stability (e.g., $charCodeAtIndex, $charCodeAtIndexPlus1)."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T17:54:14.000Z",
5
+ "notes": "Measured with baseline none: 0%. Improves readability by renaming minified variables like 'saA === \"darwin\"' to '$isDarwin'."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0.000943734546346775,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-22T12:49:10.952Z",
5
+ "notes": "Auto-added by evaluation script. Measured with baseline none: 0.09%."
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "notes": "Added manually; recommended based on high-confidence heuristics (not yet evaluated)."
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-21T21:06:19.512Z",
5
+ "notes": "Superseded by rename-loop-index-variables-v3.",
6
+ "supersededBy": "rename-loop-index-variables-v3"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-23T16:34:06.000Z",
5
+ "notes": "Superseded by rename-loop-index-variables-v3.",
6
+ "supersededBy": "rename-loop-index-variables-v3"
7
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T17:09:04.000Z",
5
+ "notes": "Unifies rename-loop-index-variables and rename-loop-index-variables-v2 without modifying older transforms. Measured with baseline none: 0.00%."
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "diffReductionImpact": 0.00003774938185385768,
3
+ "recommended": true,
4
+ "notes": "Added manually based on high-confidence heuristic."
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-22T21:39:53.578Z",
5
+ "notes": "Auto-added by evaluation script."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-23T17:28:09.184Z",
5
+ "notes": "Measured with baseline none: 0.00%."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0.00003774938185385768,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T17:57:26.908Z",
5
+ "notes": "Measured with baseline none: 0.00%. Improves readability by stabilizing `this` aliases used for closures."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": 0.00003774938185385768,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T10:29:23.279Z",
5
+ "notes": "Measured with baseline none: 0.00%. Added to recommended for readability."
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": false,
4
+ "evaluatedAt": "2026-01-22T17:03:19.826Z",
5
+ "notes": "Superseded by rename-use-reference-guards-v2.",
6
+ "supersededBy": "rename-use-reference-guards-v2"
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "notes": "Supersedes rename-use-reference-guards and also covers guards that reset to false."
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "diffReductionImpact": 0,
3
+ "recommended": true,
4
+ "notes": "Added manually; improves readability and cleans up `expand-boolean-literals` output."
5
+ }
@@ -0,0 +1,2 @@
1
+ import type { Transform } from "../../core/types.js";
2
+ export declare const simplifyBooleanNegationsTransform: Transform;
@@ -0,0 +1,90 @@
1
+ import { createRequire } from "node:module";
2
+ import { getFilesToProcess } from "../../core/types.js";
3
+ const require = createRequire(import.meta.url);
4
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5
+ const traverse = require("@babel/traverse").default;
6
+ const t = require("@babel/types");
7
+ const isInBooleanTestContext = (path) => {
8
+ let current = path;
9
+ // A `!!x` node is safe to rewrite as `x` only when its value is consumed
10
+ // purely for truthiness (control-flow tests and boolean operator chains).
11
+ // If we encounter any other parent expression before reaching the test
12
+ // boundary, the expression value is being used (e.g. as a call argument),
13
+ // and rewriting would be unsafe.
14
+ for (;;) {
15
+ const parent = current.parentPath;
16
+ if (!parent)
17
+ return false;
18
+ if ((parent.isIfStatement() ||
19
+ parent.isWhileStatement() ||
20
+ parent.isDoWhileStatement() ||
21
+ parent.isForStatement() ||
22
+ parent.isConditionalExpression()) &&
23
+ current.key === "test") {
24
+ return true;
25
+ }
26
+ if (parent.isLogicalExpression()) {
27
+ if (current.key !== "left" && current.key !== "right")
28
+ return false;
29
+ current = parent;
30
+ continue;
31
+ }
32
+ if (parent.isUnaryExpression({ operator: "!" })) {
33
+ if (current.key !== "argument")
34
+ return false;
35
+ current = parent;
36
+ continue;
37
+ }
38
+ if (parent.isSequenceExpression()) {
39
+ if (current.listKey !== "expressions")
40
+ return false;
41
+ const expressions = parent.node.expressions;
42
+ const lastExpression = expressions.at(-1);
43
+ if (!lastExpression)
44
+ return false;
45
+ if (lastExpression !== current.node)
46
+ return false;
47
+ current = parent;
48
+ continue;
49
+ }
50
+ if (parent.isParenthesizedExpression()) {
51
+ if (current.key !== "expression")
52
+ return false;
53
+ current = parent;
54
+ continue;
55
+ }
56
+ return false;
57
+ }
58
+ };
59
+ export const simplifyBooleanNegationsTransform = {
60
+ id: "simplify-boolean-negations",
61
+ description: "Simplifies redundant boolean negations: !true/!false and !!x in control-flow tests",
62
+ scope: "file",
63
+ parallelizable: true,
64
+ transform(context) {
65
+ let nodesVisited = 0;
66
+ let transformationsApplied = 0;
67
+ for (const fileInfo of getFilesToProcess(context)) {
68
+ traverse(fileInfo.ast, {
69
+ UnaryExpression(path) {
70
+ nodesVisited++;
71
+ if (path.node.operator !== "!")
72
+ return;
73
+ const argument = path.node.argument;
74
+ if (argument.type === "BooleanLiteral") {
75
+ path.replaceWith(t.booleanLiteral(!argument.value));
76
+ transformationsApplied++;
77
+ return;
78
+ }
79
+ if (argument.type === "UnaryExpression" &&
80
+ argument.operator === "!" &&
81
+ isInBooleanTestContext(path)) {
82
+ path.replaceWith(argument.argument);
83
+ transformationsApplied++;
84
+ }
85
+ },
86
+ });
87
+ }
88
+ return Promise.resolve({ nodesVisited, transformationsApplied });
89
+ },
90
+ };
@@ -0,0 +1,6 @@
1
+ {
2
+ "diffReductionImpact": -0.0027651422207961573,
3
+ "recommended": true,
4
+ "evaluatedAt": "2026-01-23T05:45:27.981Z",
5
+ "notes": "Auto-added by evaluation script. Measured with baseline none: -0.28%. Enabled in the recommended preset for readability and to normalize variable declarations even when line diffs increase."
6
+ }
@@ -1,19 +1,4 @@
1
- import transformManifestJson from "../../transform-manifest.json" with { type: "json" };
2
- import * as z from "zod";
3
- const TransformManifestEntry = z
4
- .object({
5
- id: z.string().min(1),
6
- recommended: z.boolean(),
7
- })
8
- .loose();
9
- const TransformManifest = z
10
- .object({
11
- transforms: z.array(TransformManifestEntry),
12
- })
13
- .loose();
14
- const transformManifest = TransformManifest.parse(transformManifestJson);
1
+ import { recommendedTransformIds } from "./_generated/manifest.js";
15
2
  export const transformPresets = {
16
- recommended: transformManifest.transforms
17
- .filter((transform) => transform.recommended)
18
- .map((transform) => transform.id),
3
+ recommended: recommendedTransformIds,
19
4
  };
@@ -1,3 +1 @@
1
- import type { Transform } from "../core/types.js";
2
- export declare const transformRegistry: Record<string, Transform>;
3
- export declare const allTransformIds: string[];
1
+ export { transformRegistry, allTransformIds } from "./_generated/registry.js";