miniread 1.18.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.
- package/dist/scripts/evaluate/check-expected-evaluations.d.ts +1 -1
- package/dist/scripts/evaluate/check-expected-evaluations.js +8 -7
- package/dist/scripts/evaluate/create-evaluate-command.js +1 -2
- package/dist/scripts/evaluate/parse-evaluate-cli-options.d.ts +2 -2
- package/dist/scripts/evaluate/parse-evaluate-cli-options.js +4 -2
- package/dist/scripts/evaluate/run-check-mode.d.ts +1 -1
- package/dist/scripts/evaluate/run-check-mode.js +9 -4
- package/dist/scripts/evaluate/run-evaluate-cli.js +6 -3
- package/dist/scripts/evaluate/transform-manifest.d.ts +3 -1
- package/dist/scripts/evaluate/transform-manifest.js +43 -36
- package/dist/transforms/_generated/manifest.d.ts +14 -0
- package/dist/transforms/_generated/manifest.js +173 -0
- package/dist/transforms/_generated/registry.d.ts +3 -0
- package/dist/transforms/_generated/registry.js +55 -0
- package/dist/transforms/expand-boolean-literals/manifest.json +6 -0
- package/dist/transforms/expand-sequence-expressions-v4/manifest.json +7 -0
- package/dist/transforms/expand-sequence-expressions-v5/manifest.json +5 -0
- package/dist/transforms/expand-special-number-literals/manifest.json +6 -0
- package/dist/transforms/expand-undefined-literals/manifest.json +6 -0
- package/dist/transforms/preset-stats.json +6 -0
- package/dist/transforms/remove-redundant-else/manifest.json +6 -0
- package/dist/transforms/rename-catch-parameters/manifest.json +6 -0
- package/dist/transforms/rename-char-code-at/manifest.json +6 -0
- package/dist/transforms/rename-charcode-variables/manifest.json +7 -0
- package/dist/transforms/rename-charcode-variables-v2/manifest.json +6 -0
- package/dist/transforms/rename-comparison-flags/manifest.json +6 -0
- package/dist/transforms/rename-destructured-aliases/manifest.json +6 -0
- package/dist/transforms/rename-event-parameters/manifest.json +5 -0
- package/dist/transforms/rename-loop-index-variables/manifest.json +7 -0
- package/dist/transforms/rename-loop-index-variables-v2/manifest.json +7 -0
- package/dist/transforms/rename-loop-index-variables-v3/manifest.json +6 -0
- package/dist/transforms/rename-parameters-to-match-properties/manifest.json +5 -0
- package/dist/transforms/rename-promise-executor-parameters/manifest.json +6 -0
- package/dist/transforms/rename-replace-child-parameters/manifest.json +6 -0
- package/dist/transforms/rename-this-aliases/manifest.json +6 -0
- package/dist/transforms/rename-timeout-ids/manifest.json +6 -0
- package/dist/transforms/rename-use-reference-guards/manifest.json +7 -0
- package/dist/transforms/rename-use-reference-guards-v2/manifest.json +5 -0
- package/dist/transforms/simplify-boolean-negations/manifest.json +5 -0
- package/dist/transforms/split-variable-declarations/manifest.json +6 -0
- package/dist/transforms/transform-presets.js +2 -17
- package/dist/transforms/transform-registry.d.ts +1 -3
- package/dist/transforms/transform-registry.js +1 -53
- package/package.json +5 -6
- package/dist/scripts/evaluate/parse-transform-manifest.d.ts +0 -22
- package/dist/scripts/evaluate/parse-transform-manifest.js +0 -29
- package/transform-manifest.json +0 -260
|
@@ -10,7 +10,7 @@ type CheckExpectedEvaluationsResult = {
|
|
|
10
10
|
allPresent: boolean;
|
|
11
11
|
};
|
|
12
12
|
type CheckExpectedEvaluationsOptions = {
|
|
13
|
-
|
|
13
|
+
transformsDirectory: string;
|
|
14
14
|
testCasesDirectory: string;
|
|
15
15
|
};
|
|
16
16
|
export declare const checkExpectedEvaluations: (options: CheckExpectedEvaluationsOptions) => Promise<CheckExpectedEvaluationsResult>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { allTransformIds } from "../../transforms/transform-registry.js";
|
|
3
4
|
import { transformRegistry } from "../../transforms/transform-registry.js";
|
|
4
5
|
import { transformPresets } from "../../transforms/transform-presets.js";
|
|
5
|
-
import { parseTransformManifest } from "./parse-transform-manifest.js";
|
|
6
6
|
import { checkAllSnapshots } from "./check-snapshots.js";
|
|
7
7
|
export const checkExpectedEvaluations = async (options) => {
|
|
8
|
-
const {
|
|
8
|
+
const { transformsDirectory, testCasesDirectory } = options;
|
|
9
9
|
const transformIds = allTransformIds.toSorted();
|
|
10
10
|
const missingManifestEntries = [];
|
|
11
|
-
// Check manifest
|
|
12
|
-
const manifestContent = await fs.readFile(manifestPath, "utf8");
|
|
13
|
-
const manifest = parseTransformManifest(manifestContent);
|
|
14
|
-
const manifestIds = new Set(manifest.transforms.map((t) => t.id));
|
|
11
|
+
// Check that each transform has a manifest.json file
|
|
15
12
|
for (const transformId of transformIds) {
|
|
16
|
-
|
|
13
|
+
const manifestPath = path.join(transformsDirectory, transformId, "manifest.json");
|
|
14
|
+
try {
|
|
15
|
+
await fs.access(manifestPath);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
17
18
|
missingManifestEntries.push({
|
|
18
19
|
transformId,
|
|
19
20
|
path: manifestPath,
|
|
@@ -22,8 +22,7 @@ export const createEvaluateCommand = (options) => {
|
|
|
22
22
|
.option("--write-metrics", "Write metrics JSON to the evaluation directory")
|
|
23
23
|
.option("--metrics-file <path>", "Write metrics JSON to a specific path")
|
|
24
24
|
.option("--write-patches", "Write baseline/test diff patches to the evaluation directory")
|
|
25
|
-
.option("-u, --update-manifest", "Update
|
|
26
|
-
.option("--manifest-file <path>", "Path to transform-manifest.json", "transform-manifest.json")
|
|
25
|
+
.option("-u, --update-manifest", "Update manifest.json metrics for transforms (does not add new entries or edit notes)")
|
|
27
26
|
.option("-f, --overwrite", "Overwrite existing metrics/patch files")
|
|
28
27
|
.option("--no-format-code", "Skip formatting temp directories with Prettier before diffing")
|
|
29
28
|
.option("--check", "Check that all expected evaluation metrics files exist (does not run evaluations)");
|
|
@@ -12,7 +12,6 @@ export type EvaluateCliRawOptions = {
|
|
|
12
12
|
metricsFile?: string;
|
|
13
13
|
writePatches?: boolean;
|
|
14
14
|
updateManifest?: boolean;
|
|
15
|
-
manifestFile: string;
|
|
16
15
|
overwrite?: boolean;
|
|
17
16
|
formatCode: boolean;
|
|
18
17
|
check?: boolean;
|
|
@@ -30,7 +29,8 @@ export type EvaluateCliOptions = {
|
|
|
30
29
|
shouldWritePatches: boolean;
|
|
31
30
|
shouldUpdateManifest: boolean;
|
|
32
31
|
metricsPath: string;
|
|
33
|
-
|
|
32
|
+
transformsDirectory: string;
|
|
33
|
+
presetStatsPath: string;
|
|
34
34
|
overwrite: boolean;
|
|
35
35
|
formatCode: boolean;
|
|
36
36
|
baselineSlug: string;
|
|
@@ -77,7 +77,8 @@ export const parseEvaluateCliOptions = (options) => {
|
|
|
77
77
|
});
|
|
78
78
|
const sourcesDirectory = path.resolve(cwd, rawOptions.sources);
|
|
79
79
|
const evaluationDirectory = path.resolve(cwd, rawOptions.evaluationDir);
|
|
80
|
-
const
|
|
80
|
+
const transformsDirectory = path.resolve(cwd, "src/transforms");
|
|
81
|
+
const presetStatsPath = path.resolve(cwd, "src/transforms/preset-stats.json");
|
|
81
82
|
const shouldWriteMetrics = Boolean(rawOptions.writeMetrics || rawOptions.metricsFile);
|
|
82
83
|
const shouldWritePatches = Boolean(rawOptions.writePatches);
|
|
83
84
|
const shouldUpdateManifest = Boolean(rawOptions.updateManifest);
|
|
@@ -97,7 +98,8 @@ export const parseEvaluateCliOptions = (options) => {
|
|
|
97
98
|
shouldWritePatches,
|
|
98
99
|
shouldUpdateManifest,
|
|
99
100
|
metricsPath,
|
|
100
|
-
|
|
101
|
+
transformsDirectory,
|
|
102
|
+
presetStatsPath,
|
|
101
103
|
overwrite,
|
|
102
104
|
formatCode,
|
|
103
105
|
baselineSlug,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { checkExpectedEvaluations } from "./check-expected-evaluations.js";
|
|
3
3
|
export const runCheckMode = async (options) => {
|
|
4
|
-
const {
|
|
4
|
+
const { transformsDirectory, rootDirectory, format } = options;
|
|
5
5
|
const checkResult = await checkExpectedEvaluations({
|
|
6
|
-
|
|
6
|
+
transformsDirectory,
|
|
7
7
|
testCasesDirectory: path.join(rootDirectory, "test-cases"),
|
|
8
8
|
});
|
|
9
9
|
if (format === "json") {
|
|
@@ -33,11 +33,16 @@ export const runCheckMode = async (options) => {
|
|
|
33
33
|
}
|
|
34
34
|
let exitCode = 0;
|
|
35
35
|
if (checkResult.missingManifestEntries.length > 0) {
|
|
36
|
-
console.error(`\n[MISSING MANIFEST
|
|
36
|
+
console.error(`\n[MISSING MANIFEST FILES] ${checkResult.missingManifestEntries.length} transform(s) missing manifest.json:`);
|
|
37
37
|
for (const item of checkResult.missingManifestEntries) {
|
|
38
38
|
console.error(` - ${item.transformId}`);
|
|
39
39
|
}
|
|
40
|
-
console.error(`\n To fix:
|
|
40
|
+
console.error(`\n To fix: Create a manifest.json file in each transform directory with the following structure:`);
|
|
41
|
+
console.error(` {`);
|
|
42
|
+
console.error(` "diffReductionImpact": 0,`);
|
|
43
|
+
console.error(` "recommended": true,`);
|
|
44
|
+
console.error(` "notes": "Description of the transform's impact"`);
|
|
45
|
+
console.error(` }`);
|
|
41
46
|
exitCode = 1;
|
|
42
47
|
}
|
|
43
48
|
const missingSnapshots = checkResult.snapshotIssues.filter((issue) => issue.issue === "missing-required");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import packageJson from "../../../package.json" with { type: "json" };
|
|
3
|
+
import { transformPresets } from "../../transforms/transform-presets.js";
|
|
3
4
|
import { createEvaluateCommand } from "./create-evaluate-command.js";
|
|
4
5
|
import { parseEvaluateCliOptions, } from "./parse-evaluate-cli-options.js";
|
|
5
6
|
import { resolveEvaluateDependencies } from "./resolve-evaluate-dependencies.js";
|
|
@@ -35,7 +36,7 @@ export const runEvaluateCli = async (argv) => {
|
|
|
35
36
|
};
|
|
36
37
|
if (parsedOptions.checkMode) {
|
|
37
38
|
return runCheckMode({
|
|
38
|
-
|
|
39
|
+
transformsDirectory: parsedOptions.transformsDirectory,
|
|
39
40
|
rootDirectory: process.cwd(),
|
|
40
41
|
format: parsedOptions.format,
|
|
41
42
|
});
|
|
@@ -100,15 +101,17 @@ export const runEvaluateCli = async (argv) => {
|
|
|
100
101
|
}
|
|
101
102
|
if (parsedOptions.shouldUpdateManifest) {
|
|
102
103
|
if (errors.length > 0) {
|
|
103
|
-
console.error("Refusing to update
|
|
104
|
+
console.error("Refusing to update manifests because some evaluations failed.");
|
|
104
105
|
exitCode = 1;
|
|
105
106
|
}
|
|
106
107
|
else {
|
|
107
108
|
const updateResult = await updateTransformManifestFromEvaluation({
|
|
108
|
-
|
|
109
|
+
transformsDirectory: parsedOptions.transformsDirectory,
|
|
110
|
+
presetStatsPath: parsedOptions.presetStatsPath,
|
|
109
111
|
baselineTransforms: parsedOptions.baselineTransforms,
|
|
110
112
|
testTransforms: parsedOptions.testTransforms,
|
|
111
113
|
reductionRatios: results.map((r) => r.reductionRatio),
|
|
114
|
+
recommendedTransformIds: transformPresets.recommended,
|
|
112
115
|
});
|
|
113
116
|
console.error(updateResult.message);
|
|
114
117
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
type UpdateTransformManifestOptions = {
|
|
2
|
-
|
|
2
|
+
transformsDirectory: string;
|
|
3
|
+
presetStatsPath: string;
|
|
3
4
|
baselineTransforms: string[];
|
|
4
5
|
testTransforms: string[];
|
|
5
6
|
reductionRatios: number[];
|
|
7
|
+
recommendedTransformIds: string[];
|
|
6
8
|
};
|
|
7
9
|
export declare const updateTransformManifestFromEvaluation: (options: UpdateTransformManifestOptions) => Promise<{
|
|
8
10
|
updated: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { haveSameIds, normalizeTransformIds, uniqueIds, } from "./transform-id-set.js";
|
|
3
|
-
import { parseTransformManifest } from "./parse-transform-manifest.js";
|
|
4
4
|
import { writeJsonFileAtomic } from "./write-text-file-atomic.js";
|
|
5
|
+
import presetStats from "../../transforms/preset-stats.json" with { type: "json" };
|
|
5
6
|
const average = (values) => {
|
|
6
7
|
if (values.length === 0)
|
|
7
8
|
return 0;
|
|
@@ -11,73 +12,79 @@ const average = (values) => {
|
|
|
11
12
|
}
|
|
12
13
|
return total / values.length;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
-
const { manifestPath, baselineTransforms, testTransforms, reductionRatios } = options;
|
|
15
|
+
const loadManifest = async (manifestPath) => {
|
|
16
16
|
try {
|
|
17
|
-
await fs.
|
|
17
|
+
const content = await fs.readFile(manifestPath, "utf8");
|
|
18
|
+
return JSON.parse(content);
|
|
18
19
|
}
|
|
19
|
-
catch {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
};
|
|
27
|
+
export const updateTransformManifestFromEvaluation = async (options) => {
|
|
28
|
+
const { transformsDirectory, presetStatsPath, baselineTransforms, testTransforms, reductionRatios, recommendedTransformIds, } = options;
|
|
27
29
|
const baselineIds = normalizeTransformIds(baselineTransforms);
|
|
28
30
|
const testIds = normalizeTransformIds(testTransforms);
|
|
29
|
-
const idsToUpdate = new Set([...baselineIds, ...testIds]);
|
|
30
|
-
idsToUpdate.delete("none");
|
|
31
|
-
const missingIds = [...idsToUpdate].filter((id) => !existingIds.has(id));
|
|
32
|
-
let updated = false;
|
|
33
31
|
const isBaselineNone = baselineIds.length === 0 ||
|
|
34
32
|
(baselineTransforms.length === 1 && baselineTransforms[0] === "none");
|
|
33
|
+
let updated = false;
|
|
34
|
+
const messages = [];
|
|
35
|
+
// Update individual transform manifest if baseline is none and we have a single test transform
|
|
35
36
|
if (isBaselineNone && testIds.length === 1) {
|
|
36
37
|
const transformId = testIds[0];
|
|
37
38
|
if (transformId) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const manifestPath = path.join(transformsDirectory, transformId, "manifest.json");
|
|
40
|
+
const manifest = await loadManifest(manifestPath);
|
|
41
|
+
if (manifest) {
|
|
42
|
+
const measuredImpact = average(reductionRatios);
|
|
43
|
+
if (manifest.diffReductionImpact !== measuredImpact) {
|
|
44
|
+
manifest.diffReductionImpact = measuredImpact;
|
|
45
|
+
manifest.evaluatedAt = new Date().toISOString();
|
|
46
|
+
await writeJsonFileAtomic(manifestPath, manifest, {
|
|
47
|
+
overwrite: true,
|
|
48
|
+
});
|
|
49
|
+
messages.push(`Updated ${transformId}/manifest.json`);
|
|
50
|
+
updated = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
messages.push(`Skipping update for ${transformId}: manifest.json not found at ${manifestPath}`);
|
|
43
55
|
}
|
|
44
56
|
}
|
|
45
57
|
}
|
|
58
|
+
// Update preset stats if testing the recommended preset
|
|
46
59
|
if (isBaselineNone) {
|
|
47
|
-
const recommendedIds = manifest.transforms
|
|
48
|
-
.filter((entry) => entry.recommended)
|
|
49
|
-
.map((entry) => entry.id);
|
|
50
60
|
const testUniqueIds = uniqueIds(testIds);
|
|
51
|
-
const recommendedUniqueIds = uniqueIds(
|
|
61
|
+
const recommendedUniqueIds = uniqueIds(recommendedTransformIds);
|
|
52
62
|
if (testUniqueIds.length > 0 &&
|
|
53
63
|
haveSameIds(testUniqueIds, recommendedUniqueIds)) {
|
|
54
64
|
const measuredImpact = average(reductionRatios);
|
|
55
|
-
|
|
56
|
-
const existing =
|
|
65
|
+
const currentStats = { ...presetStats };
|
|
66
|
+
const existing = currentStats.recommended;
|
|
57
67
|
if (existing?.diffReductionImpact !== measuredImpact) {
|
|
58
|
-
|
|
68
|
+
currentStats.recommended = {
|
|
59
69
|
diffReductionImpact: measuredImpact,
|
|
60
70
|
notes: `Measured with baseline none: ${(measuredImpact * 100).toFixed(2)}%.`,
|
|
61
71
|
};
|
|
72
|
+
await writeJsonFileAtomic(presetStatsPath, currentStats, {
|
|
73
|
+
overwrite: true,
|
|
74
|
+
});
|
|
75
|
+
messages.push("Updated preset-stats.json");
|
|
62
76
|
updated = true;
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
}
|
|
66
80
|
if (!updated) {
|
|
67
|
-
const missingMessage = missingIds.length > 0
|
|
68
|
-
? ` Missing transform entries: ${missingIds.join(", ")}. Add them to transform-manifest.json manually.`
|
|
69
|
-
: "";
|
|
70
81
|
return {
|
|
71
82
|
updated: false,
|
|
72
|
-
message:
|
|
83
|
+
message: messages.length > 0 ? messages.join("\n") : "No updates needed.",
|
|
73
84
|
};
|
|
74
85
|
}
|
|
75
|
-
await writeJsonFileAtomic(manifestPath, manifest, { overwrite: true });
|
|
76
|
-
const missingMessage = missingIds.length > 0
|
|
77
|
-
? ` Missing transform entries: ${missingIds.join(", ")}. Add them to transform-manifest.json manually.`
|
|
78
|
-
: "";
|
|
79
86
|
return {
|
|
80
87
|
updated: true,
|
|
81
|
-
message:
|
|
88
|
+
message: messages.join("\n"),
|
|
82
89
|
};
|
|
83
90
|
};
|
|
@@ -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,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,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,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
|
|
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:
|
|
17
|
-
.filter((transform) => transform.recommended)
|
|
18
|
-
.map((transform) => transform.id),
|
|
3
|
+
recommended: recommendedTransformIds,
|
|
19
4
|
};
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { expandSpecialNumberLiteralsTransform } from "./expand-special-number-literals/expand-special-number-literals-transform.js";
|
|
3
|
-
import { expandSequenceExpressionsV4Transform } from "./expand-sequence-expressions-v4/expand-sequence-expressions-v4-transform.js";
|
|
4
|
-
import { expandSequenceExpressionsV5Transform } from "./expand-sequence-expressions-v5/expand-sequence-expressions-v5-transform.js";
|
|
5
|
-
import { expandUndefinedLiteralsTransform } from "./expand-undefined-literals/expand-undefined-literals-transform.js";
|
|
6
|
-
import { removeRedundantElseTransform } from "./remove-redundant-else/remove-redundant-else-transform.js";
|
|
7
|
-
import { renameCatchParametersTransform } from "./rename-catch-parameters/rename-catch-parameters-transform.js";
|
|
8
|
-
import { renameCharCodeAtTransform } from "./rename-char-code-at/rename-char-code-at-transform.js";
|
|
9
|
-
import { renameCharcodeVariablesTransform } from "./rename-charcode-variables/rename-charcode-variables-transform.js";
|
|
10
|
-
import { renameCharcodeVariablesV2Transform } from "./rename-charcode-variables-v2/rename-charcode-variables-v2-transform.js";
|
|
11
|
-
import { renameComparisonFlagsTransform } from "./rename-comparison-flags/rename-comparison-flags-transform.js";
|
|
12
|
-
import { renameDestructuredAliasesTransform } from "./rename-destructured-aliases/rename-destructured-aliases-transform.js";
|
|
13
|
-
import { renameEventParametersTransform } from "./rename-event-parameters/rename-event-parameters-transform.js";
|
|
14
|
-
import { renameLoopIndexVariablesTransform } from "./rename-loop-index-variables/rename-loop-index-variables-transform.js";
|
|
15
|
-
import { renameLoopIndexVariablesV2Transform } from "./rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js";
|
|
16
|
-
import { renameLoopIndexVariablesV3Transform } from "./rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js";
|
|
17
|
-
import { renameParametersToMatchPropertiesTransform } from "./rename-parameters-to-match-properties/rename-parameters-to-match-properties-transform.js";
|
|
18
|
-
import { renamePromiseExecutorParametersTransform } from "./rename-promise-executor-parameters/rename-promise-executor-parameters-transform.js";
|
|
19
|
-
import { renameReplaceChildParametersTransform } from "./rename-replace-child-parameters/rename-replace-child-parameters-transform.js";
|
|
20
|
-
import { renameThisAliasesTransform } from "./rename-this-aliases/rename-this-aliases-transform.js";
|
|
21
|
-
import { renameTimeoutIdsTransform } from "./rename-timeout-ids/rename-timeout-ids-transform.js";
|
|
22
|
-
import { renameUseReferenceGuardsTransform } from "./rename-use-reference-guards/rename-use-reference-guards-transform.js";
|
|
23
|
-
import { renameUseReferenceGuardsV2Transform } from "./rename-use-reference-guards-v2/rename-use-reference-guards-v2-transform.js";
|
|
24
|
-
import { simplifyBooleanNegationsTransform } from "./simplify-boolean-negations/simplify-boolean-negations-transform.js";
|
|
25
|
-
import { splitVariableDeclarationsTransform } from "./split-variable-declarations/split-variable-declarations-transform.js";
|
|
26
|
-
export const transformRegistry = {
|
|
27
|
-
[expandBooleanLiteralsTransform.id]: expandBooleanLiteralsTransform,
|
|
28
|
-
[expandSpecialNumberLiteralsTransform.id]: expandSpecialNumberLiteralsTransform,
|
|
29
|
-
[expandSequenceExpressionsV4Transform.id]: expandSequenceExpressionsV4Transform,
|
|
30
|
-
[expandSequenceExpressionsV5Transform.id]: expandSequenceExpressionsV5Transform,
|
|
31
|
-
[expandUndefinedLiteralsTransform.id]: expandUndefinedLiteralsTransform,
|
|
32
|
-
[removeRedundantElseTransform.id]: removeRedundantElseTransform,
|
|
33
|
-
[renameCatchParametersTransform.id]: renameCatchParametersTransform,
|
|
34
|
-
[renameCharCodeAtTransform.id]: renameCharCodeAtTransform,
|
|
35
|
-
[renameCharcodeVariablesTransform.id]: renameCharcodeVariablesTransform,
|
|
36
|
-
[renameCharcodeVariablesV2Transform.id]: renameCharcodeVariablesV2Transform,
|
|
37
|
-
[renameComparisonFlagsTransform.id]: renameComparisonFlagsTransform,
|
|
38
|
-
[renameDestructuredAliasesTransform.id]: renameDestructuredAliasesTransform,
|
|
39
|
-
[renameEventParametersTransform.id]: renameEventParametersTransform,
|
|
40
|
-
[renameLoopIndexVariablesTransform.id]: renameLoopIndexVariablesTransform,
|
|
41
|
-
[renameLoopIndexVariablesV2Transform.id]: renameLoopIndexVariablesV2Transform,
|
|
42
|
-
[renameLoopIndexVariablesV3Transform.id]: renameLoopIndexVariablesV3Transform,
|
|
43
|
-
[renameParametersToMatchPropertiesTransform.id]: renameParametersToMatchPropertiesTransform,
|
|
44
|
-
[renamePromiseExecutorParametersTransform.id]: renamePromiseExecutorParametersTransform,
|
|
45
|
-
[renameReplaceChildParametersTransform.id]: renameReplaceChildParametersTransform,
|
|
46
|
-
[renameThisAliasesTransform.id]: renameThisAliasesTransform,
|
|
47
|
-
[renameTimeoutIdsTransform.id]: renameTimeoutIdsTransform,
|
|
48
|
-
[renameUseReferenceGuardsTransform.id]: renameUseReferenceGuardsTransform,
|
|
49
|
-
[renameUseReferenceGuardsV2Transform.id]: renameUseReferenceGuardsV2Transform,
|
|
50
|
-
[simplifyBooleanNegationsTransform.id]: simplifyBooleanNegationsTransform,
|
|
51
|
-
[splitVariableDeclarationsTransform.id]: splitVariableDeclarationsTransform,
|
|
52
|
-
};
|
|
53
|
-
export const allTransformIds = Object.keys(transformRegistry);
|
|
1
|
+
export { transformRegistry, allTransformIds } from "./_generated/registry.js";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "miniread",
|
|
3
3
|
"author": "Łukasz Jerciński",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.19.0",
|
|
6
6
|
"description": "Transform minified JavaScript/TypeScript into a more readable form using deterministic AST-based transforms.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -30,16 +30,15 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"bin/",
|
|
32
32
|
"dist/",
|
|
33
|
-
"transform-manifest.json",
|
|
34
33
|
"README.md",
|
|
35
34
|
"LICENSE"
|
|
36
35
|
],
|
|
37
36
|
"scripts": {
|
|
38
37
|
"prepare": "git config core.hooksPath .githooks",
|
|
39
38
|
"prepublishOnly": "pnpm run rebuild",
|
|
40
|
-
"build": "tsc -p tsconfig.app.json",
|
|
39
|
+
"build": "node --experimental-strip-types scripts/generate-registry.ts && tsc -p tsconfig.app.json",
|
|
41
40
|
"check": "pnpm -s run rebuild && node bin/miniread-evaluate -- --check",
|
|
42
|
-
"clean": "rm -rf dist *.tsbuildinfo",
|
|
41
|
+
"clean": "rm -rf dist src/transforms/_generated *.tsbuildinfo",
|
|
43
42
|
"format": "prettier --write .",
|
|
44
43
|
"format:check": "prettier --check .",
|
|
45
44
|
"fta": "fta-check",
|
|
@@ -50,6 +49,7 @@
|
|
|
50
49
|
"miniread-sample": "pnpm -s run rebuild && node bin/miniread-sample",
|
|
51
50
|
"snapshot": "pnpm -s run rebuild && node bin/miniread-snapshot",
|
|
52
51
|
"rebuild": "pnpm run clean && pnpm run build",
|
|
52
|
+
"pretest": "node --experimental-strip-types scripts/generate-registry.ts",
|
|
53
53
|
"test": "vitest run",
|
|
54
54
|
"test:coverage": "vitest run --coverage",
|
|
55
55
|
"test:watch": "vitest",
|
|
@@ -69,8 +69,7 @@
|
|
|
69
69
|
"@commander-js/extra-typings": "^14.0.0",
|
|
70
70
|
"commander": "^14.0.2",
|
|
71
71
|
"env-paths": "^3.0.0",
|
|
72
|
-
"p-queue": "^9.1.0"
|
|
73
|
-
"zod": "^4.3.6"
|
|
72
|
+
"p-queue": "^9.1.0"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
75
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Transform } from "../../core/types.js";
|
|
2
|
-
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
|
-
type PresetStatsEntry = {
|
|
14
|
-
diffReductionImpact: number;
|
|
15
|
-
notes?: string;
|
|
16
|
-
};
|
|
17
|
-
type TransformManifest = {
|
|
18
|
-
transforms: TransformManifestEntry[];
|
|
19
|
-
presetStats?: Record<string, PresetStatsEntry>;
|
|
20
|
-
};
|
|
21
|
-
export declare const parseTransformManifest: (raw: string) => TransformManifest;
|
|
22
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
const TransformManifestEntrySchema = z
|
|
3
|
-
.object({
|
|
4
|
-
id: z.string().min(1),
|
|
5
|
-
description: z.string(),
|
|
6
|
-
scope: z.union([z.literal("file"), z.literal("project")]),
|
|
7
|
-
parallelizable: z.boolean(),
|
|
8
|
-
diffReductionImpact: z.number(),
|
|
9
|
-
recommended: z.boolean(),
|
|
10
|
-
evaluatedAt: z.iso.datetime().optional(),
|
|
11
|
-
notes: z.string().optional(),
|
|
12
|
-
supersededBy: z.string().min(1).optional(),
|
|
13
|
-
})
|
|
14
|
-
.loose();
|
|
15
|
-
const PresetStatsEntrySchema = z
|
|
16
|
-
.object({
|
|
17
|
-
diffReductionImpact: z.number(),
|
|
18
|
-
notes: z.string().optional(),
|
|
19
|
-
})
|
|
20
|
-
.loose();
|
|
21
|
-
const TransformManifestSchema = z
|
|
22
|
-
.object({
|
|
23
|
-
transforms: z.array(TransformManifestEntrySchema),
|
|
24
|
-
presetStats: z.record(z.string(), PresetStatsEntrySchema).optional(),
|
|
25
|
-
})
|
|
26
|
-
.loose();
|
|
27
|
-
export const parseTransformManifest = (raw) => {
|
|
28
|
-
return TransformManifestSchema.parse(JSON.parse(raw));
|
|
29
|
-
};
|
package/transform-manifest.json
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"transforms": [
|
|
3
|
-
{
|
|
4
|
-
"id": "expand-boolean-literals",
|
|
5
|
-
"description": "Expands !0 to true and !1 to false",
|
|
6
|
-
"scope": "file",
|
|
7
|
-
"parallelizable": true,
|
|
8
|
-
"diffReductionImpact": 0,
|
|
9
|
-
"recommended": true,
|
|
10
|
-
"evaluatedAt": "2026-01-21T15:01:23.708Z",
|
|
11
|
-
"notes": "Improves readability but does not reduce diffs (boolean literals are already deterministic)"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"id": "simplify-boolean-negations",
|
|
15
|
-
"description": "Simplifies redundant boolean negations: !true/!false and !!x in control-flow tests",
|
|
16
|
-
"scope": "file",
|
|
17
|
-
"parallelizable": true,
|
|
18
|
-
"diffReductionImpact": 0,
|
|
19
|
-
"recommended": true,
|
|
20
|
-
"notes": "Added manually; improves readability and cleans up `expand-boolean-literals` output."
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"id": "expand-undefined-literals",
|
|
24
|
-
"description": "Expands void 0 to undefined (when undefined is not shadowed)",
|
|
25
|
-
"scope": "file",
|
|
26
|
-
"parallelizable": true,
|
|
27
|
-
"diffReductionImpact": 0,
|
|
28
|
-
"recommended": true,
|
|
29
|
-
"evaluatedAt": "2026-01-21T16:27:42.316Z",
|
|
30
|
-
"notes": "Auto-added by evaluation script."
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"id": "rename-loop-index-variables",
|
|
34
|
-
"description": "Renames numeric for-loop counters to index/index2/... based on nesting depth",
|
|
35
|
-
"scope": "file",
|
|
36
|
-
"parallelizable": true,
|
|
37
|
-
"diffReductionImpact": 0,
|
|
38
|
-
"recommended": false,
|
|
39
|
-
"evaluatedAt": "2026-01-21T21:06:19.512Z",
|
|
40
|
-
"notes": "Superseded by rename-loop-index-variables-v3.",
|
|
41
|
-
"supersededBy": "rename-loop-index-variables-v3"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"id": "rename-loop-index-variables-v2",
|
|
45
|
-
"description": "Renames numeric for-loop counters in `for (var ...)` (single or multi-declarator) and `for (let ...)` (multi-declarator) inits to index/index2/...",
|
|
46
|
-
"scope": "file",
|
|
47
|
-
"parallelizable": true,
|
|
48
|
-
"diffReductionImpact": 0,
|
|
49
|
-
"recommended": false,
|
|
50
|
-
"evaluatedAt": "2026-01-23T16:34:06.000Z",
|
|
51
|
-
"notes": "Superseded by rename-loop-index-variables-v3.",
|
|
52
|
-
"supersededBy": "rename-loop-index-variables-v3"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "rename-loop-index-variables-v3",
|
|
56
|
-
"description": "Renames numeric for-loop counters (single or multi-declarator `for (var/let ...)`) to index/index2/... based on nesting depth",
|
|
57
|
-
"scope": "file",
|
|
58
|
-
"parallelizable": true,
|
|
59
|
-
"diffReductionImpact": 0,
|
|
60
|
-
"recommended": true,
|
|
61
|
-
"evaluatedAt": "2026-01-23T17:09:04.000Z",
|
|
62
|
-
"notes": "Unifies rename-loop-index-variables and rename-loop-index-variables-v2 without modifying older transforms. Measured with baseline none: 0.00%."
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"id": "rename-catch-parameters",
|
|
66
|
-
"description": "Renames minified catch clause parameters to caughtError/caughtError2/...",
|
|
67
|
-
"scope": "file",
|
|
68
|
-
"parallelizable": true,
|
|
69
|
-
"diffReductionImpact": 0.0007738623280043599,
|
|
70
|
-
"recommended": true,
|
|
71
|
-
"evaluatedAt": "2026-01-23T07:48:59.087Z",
|
|
72
|
-
"notes": "Auto-added by evaluation script."
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"id": "rename-event-parameters",
|
|
76
|
-
"description": "Renames minified single-parameter event handlers to event/mouseEvent/keyboardEvent when usage is high-confidence",
|
|
77
|
-
"scope": "file",
|
|
78
|
-
"parallelizable": true,
|
|
79
|
-
"diffReductionImpact": 0,
|
|
80
|
-
"recommended": true,
|
|
81
|
-
"notes": "Added manually; recommended based on high-confidence heuristics (not yet evaluated)."
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"id": "rename-destructured-aliases",
|
|
85
|
-
"description": "Renames destructuring aliases to match property names (e.g., { foo: x } → { foo })",
|
|
86
|
-
"scope": "file",
|
|
87
|
-
"parallelizable": true,
|
|
88
|
-
"diffReductionImpact": 0.000943734546346775,
|
|
89
|
-
"recommended": true,
|
|
90
|
-
"evaluatedAt": "2026-01-22T12:49:10.952Z",
|
|
91
|
-
"notes": "Auto-added by evaluation script. Measured with baseline none: 0.09%."
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"id": "rename-this-aliases",
|
|
95
|
-
"description": "Renames `var x = this` aliases to $thisRef (stable when unique) or thisRef/thisRef2/...",
|
|
96
|
-
"scope": "file",
|
|
97
|
-
"parallelizable": true,
|
|
98
|
-
"diffReductionImpact": 0.00003774938185385768,
|
|
99
|
-
"recommended": true,
|
|
100
|
-
"evaluatedAt": "2026-01-23T17:57:26.908Z",
|
|
101
|
-
"notes": "Measured with baseline none: 0.00%. Improves readability by stabilizing `this` aliases used for closures."
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"id": "expand-sequence-expressions-v4",
|
|
105
|
-
"description": "Expands comma operator sequences in returns, throws, statements (including control-flow bodies), and variable initializers",
|
|
106
|
-
"scope": "file",
|
|
107
|
-
"parallelizable": true,
|
|
108
|
-
"diffReductionImpact": -0.01730809158000035,
|
|
109
|
-
"recommended": false,
|
|
110
|
-
"evaluatedAt": "2026-01-23T10:57:45.082Z",
|
|
111
|
-
"notes": "Measured with baseline none: -1.73%. Supersedes all prior sequence expression transforms. Superseded by expand-sequence-expressions-v5.",
|
|
112
|
-
"supersededBy": "expand-sequence-expressions-v5"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"id": "expand-sequence-expressions-v5",
|
|
116
|
-
"description": "Expands comma operator sequences in returns, throws, statements (including control-flow bodies), variable initializers, and `if` tests",
|
|
117
|
-
"scope": "file",
|
|
118
|
-
"parallelizable": true,
|
|
119
|
-
"diffReductionImpact": -0.020243106019139034,
|
|
120
|
-
"recommended": true,
|
|
121
|
-
"notes": "Extends expand-sequence-expressions-v4 by also expanding `if ((a, b)) ...` style tests."
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"id": "rename-use-reference-guards",
|
|
125
|
-
"description": "Renames boolean useRef(false) guard variables to hasRunRef/hasRunRef2/...",
|
|
126
|
-
"scope": "file",
|
|
127
|
-
"parallelizable": true,
|
|
128
|
-
"diffReductionImpact": 0,
|
|
129
|
-
"recommended": false,
|
|
130
|
-
"evaluatedAt": "2026-01-22T17:03:19.826Z",
|
|
131
|
-
"notes": "Superseded by rename-use-reference-guards-v2.",
|
|
132
|
-
"supersededBy": "rename-use-reference-guards-v2"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"id": "rename-use-reference-guards-v2",
|
|
136
|
-
"description": "Renames boolean useRef(false) guard variables (including reset-to-false guards) to hasRunRef/hasRunRef2/...",
|
|
137
|
-
"scope": "file",
|
|
138
|
-
"parallelizable": true,
|
|
139
|
-
"diffReductionImpact": 0,
|
|
140
|
-
"recommended": true,
|
|
141
|
-
"notes": "Supersedes rename-use-reference-guards and also covers guards that reset to false."
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"id": "rename-timeout-ids",
|
|
145
|
-
"description": "Renames setTimeout handle variables to timeoutId/timeoutId2/... when usage is only clearTimeout(...)",
|
|
146
|
-
"scope": "file",
|
|
147
|
-
"parallelizable": true,
|
|
148
|
-
"diffReductionImpact": 0.00003774938185385768,
|
|
149
|
-
"recommended": true,
|
|
150
|
-
"evaluatedAt": "2026-01-23T10:29:23.279Z",
|
|
151
|
-
"notes": "Measured with baseline none: 0.00%. Added to recommended for readability."
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"id": "rename-comparison-flags",
|
|
155
|
-
"description": "Rename boolean variables assigned from string comparisons to descriptive flag names",
|
|
156
|
-
"scope": "file",
|
|
157
|
-
"parallelizable": true,
|
|
158
|
-
"diffReductionImpact": 0,
|
|
159
|
-
"recommended": true,
|
|
160
|
-
"evaluatedAt": "2026-01-23T17:54:14.000Z",
|
|
161
|
-
"notes": "Measured with baseline none: 0%. Improves readability by renaming minified variables like 'saA === \"darwin\"' to '$isDarwin'."
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"id": "split-variable-declarations",
|
|
165
|
-
"description": "Splits multi-declarator variable declarations into separate statements",
|
|
166
|
-
"scope": "file",
|
|
167
|
-
"parallelizable": true,
|
|
168
|
-
"diffReductionImpact": -0.0027651422207961573,
|
|
169
|
-
"recommended": true,
|
|
170
|
-
"evaluatedAt": "2026-01-23T05:45:27.981Z",
|
|
171
|
-
"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."
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"id": "rename-promise-executor-parameters",
|
|
175
|
-
"description": "Renames promise-like executor parameters in `new X(executor)` to resolve/reject when usage is high-confidence",
|
|
176
|
-
"scope": "file",
|
|
177
|
-
"parallelizable": true,
|
|
178
|
-
"diffReductionImpact": 0,
|
|
179
|
-
"recommended": true,
|
|
180
|
-
"evaluatedAt": "2026-01-22T21:39:53.578Z",
|
|
181
|
-
"notes": "Auto-added by evaluation script."
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"id": "rename-replace-child-parameters",
|
|
185
|
-
"description": "Renames replaceChild forwarding wrapper parameters to $newChild and $oldChild",
|
|
186
|
-
"scope": "file",
|
|
187
|
-
"parallelizable": true,
|
|
188
|
-
"diffReductionImpact": 0,
|
|
189
|
-
"recommended": false,
|
|
190
|
-
"evaluatedAt": "2026-01-23T17:28:09.184Z",
|
|
191
|
-
"notes": "Measured with baseline none: 0.00%."
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"id": "expand-special-number-literals",
|
|
195
|
-
"description": "Expands 1/0 to Infinity, -1/0 (and 1/-0) to -Infinity, and 0/0 to NaN (when not shadowed)",
|
|
196
|
-
"scope": "file",
|
|
197
|
-
"parallelizable": true,
|
|
198
|
-
"diffReductionImpact": 0,
|
|
199
|
-
"recommended": true,
|
|
200
|
-
"evaluatedAt": "2026-01-23T08:17:45.579Z",
|
|
201
|
-
"notes": "Auto-added by evaluation script."
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"id": "remove-redundant-else",
|
|
205
|
-
"description": "Removes redundant else blocks after return/throw/break/continue",
|
|
206
|
-
"scope": "file",
|
|
207
|
-
"parallelizable": true,
|
|
208
|
-
"diffReductionImpact": 0,
|
|
209
|
-
"recommended": true,
|
|
210
|
-
"evaluatedAt": "2026-01-23T18:15:00.000Z",
|
|
211
|
-
"notes": "Added manually; improves readability by reducing nesting."
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"id": "rename-char-code-at",
|
|
215
|
-
"description": "Renames variables used in charCodeAt calls (str.charCodeAt(index))",
|
|
216
|
-
"scope": "file",
|
|
217
|
-
"parallelizable": true,
|
|
218
|
-
"diffReductionImpact": 0,
|
|
219
|
-
"recommended": true,
|
|
220
|
-
"evaluatedAt": "2026-01-23T18:00:00.000Z",
|
|
221
|
-
"notes": "Measured with baseline none: 0.00%. Renames variables used in charCodeAt to improve readability."
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"id": "rename-parameters-to-match-properties",
|
|
225
|
-
"description": "Renames parameters that are assigned to object properties of the same name",
|
|
226
|
-
"scope": "file",
|
|
227
|
-
"parallelizable": true,
|
|
228
|
-
"diffReductionImpact": 0.00003774938185385768,
|
|
229
|
-
"recommended": true,
|
|
230
|
-
"notes": "Added manually based on high-confidence heuristic."
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
"id": "rename-charcode-variables",
|
|
234
|
-
"description": "Renames variables assigned from .charCodeAt() to $charCode or charCode/charCode2/...",
|
|
235
|
-
"scope": "file",
|
|
236
|
-
"parallelizable": true,
|
|
237
|
-
"diffReductionImpact": 0,
|
|
238
|
-
"recommended": false,
|
|
239
|
-
"evaluatedAt": "2026-01-23T17:59:00.000Z",
|
|
240
|
-
"notes": "Superseded by rename-charcode-variables-v2.",
|
|
241
|
-
"supersededBy": "rename-charcode-variables-v2"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"id": "rename-charcode-variables-v2",
|
|
245
|
-
"description": "Renames variables assigned from .charCodeAt(arg) to $charCodeAt{Arg} based on the argument",
|
|
246
|
-
"scope": "file",
|
|
247
|
-
"parallelizable": true,
|
|
248
|
-
"diffReductionImpact": 0,
|
|
249
|
-
"recommended": true,
|
|
250
|
-
"evaluatedAt": "2026-01-23T18:10:00.000Z",
|
|
251
|
-
"notes": "Derives names from charCodeAt argument for better stability (e.g., $charCodeAtIndex, $charCodeAtIndexPlus1)."
|
|
252
|
-
}
|
|
253
|
-
],
|
|
254
|
-
"presetStats": {
|
|
255
|
-
"recommended": {
|
|
256
|
-
"diffReductionImpact": 0.003690002076215948,
|
|
257
|
-
"notes": "Measured with baseline none: 0.37%."
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|