miniread 1.8.0 → 1.9.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/transforms/rename-loop-index-variables-v2/get-loop-counter-name.d.ts +5 -0
- package/dist/transforms/rename-loop-index-variables-v2/get-loop-counter-name.js +123 -0
- package/dist/transforms/rename-loop-index-variables-v2/get-renamed-ancestor-loop-count.d.ts +3 -0
- package/dist/transforms/rename-loop-index-variables-v2/get-renamed-ancestor-loop-count.js +19 -0
- package/dist/transforms/rename-loop-index-variables-v2/get-target-index-base-name.d.ts +1 -0
- package/dist/transforms/rename-loop-index-variables-v2/get-target-index-base-name.js +6 -0
- package/dist/transforms/rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.d.ts +2 -0
- package/dist/transforms/rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js +47 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-loop-counter-name.d.ts +5 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-loop-counter-name.js +121 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-renamed-ancestor-loop-count.d.ts +3 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-renamed-ancestor-loop-count.js +19 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-target-index-base-name.d.ts +1 -0
- package/dist/transforms/rename-loop-index-variables-v3/get-target-index-base-name.js +6 -0
- package/dist/transforms/rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.d.ts +2 -0
- package/dist/transforms/rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js +47 -0
- package/dist/transforms/transform-registry.js +4 -0
- package/package.json +1 -1
- package/transform-manifest.json +24 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodePath } from "@babel/traverse";
|
|
2
|
+
import type { ForStatement } from "@babel/types";
|
|
3
|
+
export declare const LOOP_INDEX_BASE_NAME = "index";
|
|
4
|
+
export declare const getStableRenamedIndexLoopCounterName: (path: NodePath<ForStatement>) => string | undefined;
|
|
5
|
+
export declare const getLoopCounterNameIfEligible: (path: NodePath<ForStatement>) => string | undefined;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { isStableRenamed } from "../../core/stable-naming.js";
|
|
2
|
+
export const LOOP_INDEX_BASE_NAME = "index";
|
|
3
|
+
const isEligibleVariableDeclarationKind = (kind) => {
|
|
4
|
+
return kind === "let" || kind === "var";
|
|
5
|
+
};
|
|
6
|
+
const isStableRenamedIndexLoopCounterName = (name) => {
|
|
7
|
+
if (!isStableRenamed(name))
|
|
8
|
+
return false;
|
|
9
|
+
return name.startsWith(`$${LOOP_INDEX_BASE_NAME}`);
|
|
10
|
+
};
|
|
11
|
+
const isLoopCounterDeclarator = (loopCounterName, path) => {
|
|
12
|
+
const test = path.node.test;
|
|
13
|
+
if (!test)
|
|
14
|
+
return false;
|
|
15
|
+
if (test.type !== "BinaryExpression")
|
|
16
|
+
return false;
|
|
17
|
+
if (test.operator !== "<" && test.operator !== "<=")
|
|
18
|
+
return false;
|
|
19
|
+
if (test.left.type !== "Identifier")
|
|
20
|
+
return false;
|
|
21
|
+
if (test.left.name !== loopCounterName)
|
|
22
|
+
return false;
|
|
23
|
+
if (test.right.type !== "MemberExpression")
|
|
24
|
+
return false;
|
|
25
|
+
if (test.right.computed)
|
|
26
|
+
return false;
|
|
27
|
+
if (test.right.property.type !== "Identifier")
|
|
28
|
+
return false;
|
|
29
|
+
if (test.right.property.name !== "length")
|
|
30
|
+
return false;
|
|
31
|
+
const update = path.node.update;
|
|
32
|
+
if (!update)
|
|
33
|
+
return false;
|
|
34
|
+
if (update.type === "UpdateExpression") {
|
|
35
|
+
if (update.operator !== "++")
|
|
36
|
+
return false;
|
|
37
|
+
if (update.argument.type !== "Identifier")
|
|
38
|
+
return false;
|
|
39
|
+
if (update.argument.name !== loopCounterName)
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
else if (update.type === "AssignmentExpression") {
|
|
43
|
+
if (update.operator !== "+=")
|
|
44
|
+
return false;
|
|
45
|
+
if (update.left.type !== "Identifier")
|
|
46
|
+
return false;
|
|
47
|
+
if (update.left.name !== loopCounterName)
|
|
48
|
+
return false;
|
|
49
|
+
if (update.right.type !== "NumericLiteral")
|
|
50
|
+
return false;
|
|
51
|
+
if (update.right.value <= 0)
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
export const getStableRenamedIndexLoopCounterName = (path) => {
|
|
60
|
+
const init = path.node.init;
|
|
61
|
+
if (!init)
|
|
62
|
+
return;
|
|
63
|
+
if (init.type !== "VariableDeclaration")
|
|
64
|
+
return;
|
|
65
|
+
if (!isEligibleVariableDeclarationKind(init.kind))
|
|
66
|
+
return;
|
|
67
|
+
if (init.declarations.length === 0)
|
|
68
|
+
return;
|
|
69
|
+
let stableName;
|
|
70
|
+
for (const declarator of init.declarations) {
|
|
71
|
+
if (declarator.id.type !== "Identifier")
|
|
72
|
+
continue;
|
|
73
|
+
const loopCounterName = declarator.id.name;
|
|
74
|
+
if (!isStableRenamedIndexLoopCounterName(loopCounterName))
|
|
75
|
+
continue;
|
|
76
|
+
if (!declarator.init)
|
|
77
|
+
continue;
|
|
78
|
+
if (declarator.init.type !== "NumericLiteral")
|
|
79
|
+
continue;
|
|
80
|
+
if (declarator.init.value !== 0)
|
|
81
|
+
continue;
|
|
82
|
+
if (!isLoopCounterDeclarator(loopCounterName, path))
|
|
83
|
+
continue;
|
|
84
|
+
if (stableName !== undefined)
|
|
85
|
+
return;
|
|
86
|
+
stableName = loopCounterName;
|
|
87
|
+
}
|
|
88
|
+
return stableName;
|
|
89
|
+
};
|
|
90
|
+
export const getLoopCounterNameIfEligible = (path) => {
|
|
91
|
+
const init = path.node.init;
|
|
92
|
+
if (!init)
|
|
93
|
+
return;
|
|
94
|
+
if (init.type !== "VariableDeclaration")
|
|
95
|
+
return;
|
|
96
|
+
if (!isEligibleVariableDeclarationKind(init.kind))
|
|
97
|
+
return;
|
|
98
|
+
if (init.declarations.length === 0)
|
|
99
|
+
return;
|
|
100
|
+
if (init.kind === "let" && init.declarations.length < 2)
|
|
101
|
+
return;
|
|
102
|
+
const eligibleNames = [];
|
|
103
|
+
for (const declarator of init.declarations) {
|
|
104
|
+
if (declarator.id.type !== "Identifier")
|
|
105
|
+
continue;
|
|
106
|
+
if (!declarator.init)
|
|
107
|
+
continue;
|
|
108
|
+
if (declarator.init.type !== "NumericLiteral")
|
|
109
|
+
continue;
|
|
110
|
+
if (declarator.init.value !== 0)
|
|
111
|
+
continue;
|
|
112
|
+
const loopCounterName = declarator.id.name;
|
|
113
|
+
if (!isLoopCounterDeclarator(loopCounterName, path))
|
|
114
|
+
continue;
|
|
115
|
+
eligibleNames.push(loopCounterName);
|
|
116
|
+
if (eligibleNames.length > 1)
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const name0 = eligibleNames[0];
|
|
120
|
+
if (!name0)
|
|
121
|
+
return;
|
|
122
|
+
return name0;
|
|
123
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getStableRenamedIndexLoopCounterName } from "./get-loop-counter-name.js";
|
|
2
|
+
export const getRenamedAncestorLoopCount = (path, renamedLoops) => {
|
|
3
|
+
let count = 0;
|
|
4
|
+
for (const ancestor of path.getAncestry()) {
|
|
5
|
+
if (ancestor === path)
|
|
6
|
+
continue;
|
|
7
|
+
if (!ancestor.isForStatement())
|
|
8
|
+
continue;
|
|
9
|
+
if (renamedLoops.has(ancestor.node)) {
|
|
10
|
+
count++;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const stableName = getStableRenamedIndexLoopCounterName(ancestor);
|
|
14
|
+
if (!stableName)
|
|
15
|
+
continue;
|
|
16
|
+
count++;
|
|
17
|
+
}
|
|
18
|
+
return count;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTargetIndexBaseName: (renamedAncestorLoopCount: number) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LOOP_INDEX_BASE_NAME } from "./get-loop-counter-name.js";
|
|
2
|
+
export const getTargetIndexBaseName = (renamedAncestorLoopCount) => {
|
|
3
|
+
if (renamedAncestorLoopCount === 0)
|
|
4
|
+
return LOOP_INDEX_BASE_NAME;
|
|
5
|
+
return `${LOOP_INDEX_BASE_NAME}${renamedAncestorLoopCount + 1}`;
|
|
6
|
+
};
|
package/dist/transforms/rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { isStableRenamed, RenameGroup } from "../../core/stable-naming.js";
|
|
3
|
+
import { getFilesToProcess, } from "../../core/types.js";
|
|
4
|
+
import { getLoopCounterNameIfEligible } from "./get-loop-counter-name.js";
|
|
5
|
+
import { getRenamedAncestorLoopCount } from "./get-renamed-ancestor-loop-count.js";
|
|
6
|
+
import { getTargetIndexBaseName } from "./get-target-index-base-name.js";
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
9
|
+
const traverse = require("@babel/traverse").default;
|
|
10
|
+
export const renameLoopIndexVariablesV2Transform = {
|
|
11
|
+
id: "rename-loop-index-variables-v2",
|
|
12
|
+
description: "Renames numeric for-loop counters in `for (var ...)` (single or multi-declarator) and `for (let ...)` (multi-declarator) to $index/$index2/...",
|
|
13
|
+
scope: "file",
|
|
14
|
+
parallelizable: true,
|
|
15
|
+
transform(context) {
|
|
16
|
+
let nodesVisited = 0;
|
|
17
|
+
let transformationsApplied = 0;
|
|
18
|
+
for (const fileInfo of getFilesToProcess(context)) {
|
|
19
|
+
const group = new RenameGroup();
|
|
20
|
+
const eligibleLoops = new WeakMap();
|
|
21
|
+
traverse(fileInfo.ast, {
|
|
22
|
+
ForStatement(path) {
|
|
23
|
+
nodesVisited++;
|
|
24
|
+
const loopCounterName = getLoopCounterNameIfEligible(path);
|
|
25
|
+
if (!loopCounterName)
|
|
26
|
+
return;
|
|
27
|
+
// Skip already-stable names
|
|
28
|
+
if (isStableRenamed(loopCounterName))
|
|
29
|
+
return;
|
|
30
|
+
const renamedAncestorLoopCount = getRenamedAncestorLoopCount(path, eligibleLoops);
|
|
31
|
+
const baseName = getTargetIndexBaseName(renamedAncestorLoopCount);
|
|
32
|
+
eligibleLoops.set(path.node, baseName);
|
|
33
|
+
group.add({
|
|
34
|
+
scope: path.scope,
|
|
35
|
+
currentName: loopCounterName,
|
|
36
|
+
baseName,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
transformationsApplied += group.apply();
|
|
41
|
+
}
|
|
42
|
+
return Promise.resolve({
|
|
43
|
+
nodesVisited,
|
|
44
|
+
transformationsApplied,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodePath } from "@babel/traverse";
|
|
2
|
+
import type { ForStatement } from "@babel/types";
|
|
3
|
+
export declare const LOOP_INDEX_BASE_NAME = "index";
|
|
4
|
+
export declare const getStableRenamedIndexLoopCounterName: (path: NodePath<ForStatement>) => string | undefined;
|
|
5
|
+
export declare const getLoopCounterNameIfEligible: (path: NodePath<ForStatement>) => string | undefined;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { isStableRenamed } from "../../core/stable-naming.js";
|
|
2
|
+
export const LOOP_INDEX_BASE_NAME = "index";
|
|
3
|
+
const isEligibleVariableDeclarationKind = (kind) => {
|
|
4
|
+
return kind === "let" || kind === "var";
|
|
5
|
+
};
|
|
6
|
+
const isStableRenamedIndexLoopCounterName = (name) => {
|
|
7
|
+
if (!isStableRenamed(name))
|
|
8
|
+
return false;
|
|
9
|
+
return name.startsWith(`$${LOOP_INDEX_BASE_NAME}`);
|
|
10
|
+
};
|
|
11
|
+
const isLoopCounterDeclarator = (loopCounterName, path) => {
|
|
12
|
+
const test = path.node.test;
|
|
13
|
+
if (!test)
|
|
14
|
+
return false;
|
|
15
|
+
if (test.type !== "BinaryExpression")
|
|
16
|
+
return false;
|
|
17
|
+
if (test.operator !== "<" && test.operator !== "<=")
|
|
18
|
+
return false;
|
|
19
|
+
if (test.left.type !== "Identifier")
|
|
20
|
+
return false;
|
|
21
|
+
if (test.left.name !== loopCounterName)
|
|
22
|
+
return false;
|
|
23
|
+
if (test.right.type !== "MemberExpression")
|
|
24
|
+
return false;
|
|
25
|
+
if (test.right.computed)
|
|
26
|
+
return false;
|
|
27
|
+
if (test.right.property.type !== "Identifier")
|
|
28
|
+
return false;
|
|
29
|
+
if (test.right.property.name !== "length")
|
|
30
|
+
return false;
|
|
31
|
+
const update = path.node.update;
|
|
32
|
+
if (!update)
|
|
33
|
+
return false;
|
|
34
|
+
if (update.type === "UpdateExpression") {
|
|
35
|
+
if (update.operator !== "++")
|
|
36
|
+
return false;
|
|
37
|
+
if (update.argument.type !== "Identifier")
|
|
38
|
+
return false;
|
|
39
|
+
if (update.argument.name !== loopCounterName)
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
else if (update.type === "AssignmentExpression") {
|
|
43
|
+
if (update.operator !== "+=")
|
|
44
|
+
return false;
|
|
45
|
+
if (update.left.type !== "Identifier")
|
|
46
|
+
return false;
|
|
47
|
+
if (update.left.name !== loopCounterName)
|
|
48
|
+
return false;
|
|
49
|
+
if (update.right.type !== "NumericLiteral")
|
|
50
|
+
return false;
|
|
51
|
+
if (update.right.value <= 0)
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
export const getStableRenamedIndexLoopCounterName = (path) => {
|
|
60
|
+
const init = path.node.init;
|
|
61
|
+
if (!init)
|
|
62
|
+
return;
|
|
63
|
+
if (init.type !== "VariableDeclaration")
|
|
64
|
+
return;
|
|
65
|
+
if (!isEligibleVariableDeclarationKind(init.kind))
|
|
66
|
+
return;
|
|
67
|
+
if (init.declarations.length === 0)
|
|
68
|
+
return;
|
|
69
|
+
let stableName;
|
|
70
|
+
for (const declarator of init.declarations) {
|
|
71
|
+
if (declarator.id.type !== "Identifier")
|
|
72
|
+
continue;
|
|
73
|
+
const loopCounterName = declarator.id.name;
|
|
74
|
+
if (!isStableRenamedIndexLoopCounterName(loopCounterName))
|
|
75
|
+
continue;
|
|
76
|
+
if (!declarator.init)
|
|
77
|
+
continue;
|
|
78
|
+
if (declarator.init.type !== "NumericLiteral")
|
|
79
|
+
continue;
|
|
80
|
+
if (declarator.init.value !== 0)
|
|
81
|
+
continue;
|
|
82
|
+
if (!isLoopCounterDeclarator(loopCounterName, path))
|
|
83
|
+
continue;
|
|
84
|
+
if (stableName !== undefined)
|
|
85
|
+
return;
|
|
86
|
+
stableName = loopCounterName;
|
|
87
|
+
}
|
|
88
|
+
return stableName;
|
|
89
|
+
};
|
|
90
|
+
export const getLoopCounterNameIfEligible = (path) => {
|
|
91
|
+
const init = path.node.init;
|
|
92
|
+
if (!init)
|
|
93
|
+
return;
|
|
94
|
+
if (init.type !== "VariableDeclaration")
|
|
95
|
+
return;
|
|
96
|
+
if (!isEligibleVariableDeclarationKind(init.kind))
|
|
97
|
+
return;
|
|
98
|
+
if (init.declarations.length === 0)
|
|
99
|
+
return;
|
|
100
|
+
const eligibleNames = [];
|
|
101
|
+
for (const declarator of init.declarations) {
|
|
102
|
+
if (declarator.id.type !== "Identifier")
|
|
103
|
+
continue;
|
|
104
|
+
if (!declarator.init)
|
|
105
|
+
continue;
|
|
106
|
+
if (declarator.init.type !== "NumericLiteral")
|
|
107
|
+
continue;
|
|
108
|
+
if (declarator.init.value !== 0)
|
|
109
|
+
continue;
|
|
110
|
+
const loopCounterName = declarator.id.name;
|
|
111
|
+
if (!isLoopCounterDeclarator(loopCounterName, path))
|
|
112
|
+
continue;
|
|
113
|
+
eligibleNames.push(loopCounterName);
|
|
114
|
+
if (eligibleNames.length > 1)
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const name0 = eligibleNames[0];
|
|
118
|
+
if (!name0)
|
|
119
|
+
return;
|
|
120
|
+
return name0;
|
|
121
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getStableRenamedIndexLoopCounterName } from "./get-loop-counter-name.js";
|
|
2
|
+
export const getRenamedAncestorLoopCount = (path, renamedLoops) => {
|
|
3
|
+
let count = 0;
|
|
4
|
+
for (const ancestor of path.getAncestry()) {
|
|
5
|
+
if (ancestor === path)
|
|
6
|
+
continue;
|
|
7
|
+
if (!ancestor.isForStatement())
|
|
8
|
+
continue;
|
|
9
|
+
if (renamedLoops.has(ancestor.node)) {
|
|
10
|
+
count++;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const stableName = getStableRenamedIndexLoopCounterName(ancestor);
|
|
14
|
+
if (!stableName)
|
|
15
|
+
continue;
|
|
16
|
+
count++;
|
|
17
|
+
}
|
|
18
|
+
return count;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTargetIndexBaseName: (renamedAncestorLoopCount: number) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LOOP_INDEX_BASE_NAME } from "./get-loop-counter-name.js";
|
|
2
|
+
export const getTargetIndexBaseName = (renamedAncestorLoopCount) => {
|
|
3
|
+
if (renamedAncestorLoopCount === 0)
|
|
4
|
+
return LOOP_INDEX_BASE_NAME;
|
|
5
|
+
return `${LOOP_INDEX_BASE_NAME}${renamedAncestorLoopCount + 1}`;
|
|
6
|
+
};
|
package/dist/transforms/rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { isStableRenamed, RenameGroup } from "../../core/stable-naming.js";
|
|
3
|
+
import { getFilesToProcess, } from "../../core/types.js";
|
|
4
|
+
import { getLoopCounterNameIfEligible } from "./get-loop-counter-name.js";
|
|
5
|
+
import { getRenamedAncestorLoopCount } from "./get-renamed-ancestor-loop-count.js";
|
|
6
|
+
import { getTargetIndexBaseName } from "./get-target-index-base-name.js";
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
9
|
+
const traverse = require("@babel/traverse").default;
|
|
10
|
+
export const renameLoopIndexVariablesV3Transform = {
|
|
11
|
+
id: "rename-loop-index-variables-v3",
|
|
12
|
+
description: "Renames numeric for-loop counters (single or multi-declarator `for (var/let ...)`) to $index/$index2/... based on nesting depth",
|
|
13
|
+
scope: "file",
|
|
14
|
+
parallelizable: true,
|
|
15
|
+
transform(context) {
|
|
16
|
+
let nodesVisited = 0;
|
|
17
|
+
let transformationsApplied = 0;
|
|
18
|
+
for (const fileInfo of getFilesToProcess(context)) {
|
|
19
|
+
const group = new RenameGroup();
|
|
20
|
+
const eligibleLoops = new WeakMap();
|
|
21
|
+
traverse(fileInfo.ast, {
|
|
22
|
+
ForStatement(path) {
|
|
23
|
+
nodesVisited++;
|
|
24
|
+
const loopCounterName = getLoopCounterNameIfEligible(path);
|
|
25
|
+
if (!loopCounterName)
|
|
26
|
+
return;
|
|
27
|
+
// Skip already-stable names
|
|
28
|
+
if (isStableRenamed(loopCounterName))
|
|
29
|
+
return;
|
|
30
|
+
const renamedAncestorLoopCount = getRenamedAncestorLoopCount(path, eligibleLoops);
|
|
31
|
+
const baseName = getTargetIndexBaseName(renamedAncestorLoopCount);
|
|
32
|
+
eligibleLoops.set(path.node, baseName);
|
|
33
|
+
group.add({
|
|
34
|
+
scope: path.scope,
|
|
35
|
+
currentName: loopCounterName,
|
|
36
|
+
baseName,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
transformationsApplied += group.apply();
|
|
41
|
+
}
|
|
42
|
+
return Promise.resolve({
|
|
43
|
+
nodesVisited,
|
|
44
|
+
transformationsApplied,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -6,6 +6,8 @@ import { renameCatchParametersTransform } from "./rename-catch-parameters/rename
|
|
|
6
6
|
import { renameDestructuredAliasesTransform } from "./rename-destructured-aliases/rename-destructured-aliases-transform.js";
|
|
7
7
|
import { renameEventParametersTransform } from "./rename-event-parameters/rename-event-parameters-transform.js";
|
|
8
8
|
import { renameLoopIndexVariablesTransform } from "./rename-loop-index-variables/rename-loop-index-variables-transform.js";
|
|
9
|
+
import { renameLoopIndexVariablesV2Transform } from "./rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js";
|
|
10
|
+
import { renameLoopIndexVariablesV3Transform } from "./rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js";
|
|
9
11
|
import { renamePromiseExecutorParametersTransform } from "./rename-promise-executor-parameters/rename-promise-executor-parameters-transform.js";
|
|
10
12
|
import { renameTimeoutIdsTransform } from "./rename-timeout-ids/rename-timeout-ids-transform.js";
|
|
11
13
|
import { renameUseReferenceGuardsTransform } from "./rename-use-reference-guards/rename-use-reference-guards-transform.js";
|
|
@@ -20,6 +22,8 @@ export const transformRegistry = {
|
|
|
20
22
|
[renameDestructuredAliasesTransform.id]: renameDestructuredAliasesTransform,
|
|
21
23
|
[renameEventParametersTransform.id]: renameEventParametersTransform,
|
|
22
24
|
[renameLoopIndexVariablesTransform.id]: renameLoopIndexVariablesTransform,
|
|
25
|
+
[renameLoopIndexVariablesV2Transform.id]: renameLoopIndexVariablesV2Transform,
|
|
26
|
+
[renameLoopIndexVariablesV3Transform.id]: renameLoopIndexVariablesV3Transform,
|
|
23
27
|
[renamePromiseExecutorParametersTransform.id]: renamePromiseExecutorParametersTransform,
|
|
24
28
|
[renameTimeoutIdsTransform.id]: renameTimeoutIdsTransform,
|
|
25
29
|
[renameUseReferenceGuardsTransform.id]: renameUseReferenceGuardsTransform,
|
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.9.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",
|
package/transform-manifest.json
CHANGED
|
@@ -26,9 +26,31 @@
|
|
|
26
26
|
"scope": "file",
|
|
27
27
|
"parallelizable": true,
|
|
28
28
|
"diffReductionImpact": 0,
|
|
29
|
-
"recommended":
|
|
29
|
+
"recommended": false,
|
|
30
30
|
"evaluatedAt": "2026-01-21T21:06:19.512Z",
|
|
31
|
-
"notes": "
|
|
31
|
+
"notes": "Superseded by rename-loop-index-variables-v3.",
|
|
32
|
+
"supersededBy": "rename-loop-index-variables-v3"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "rename-loop-index-variables-v2",
|
|
36
|
+
"description": "Renames numeric for-loop counters in `for (var ...)` (single or multi-declarator) and `for (let ...)` (multi-declarator) inits to index/index2/...",
|
|
37
|
+
"scope": "file",
|
|
38
|
+
"parallelizable": true,
|
|
39
|
+
"diffReductionImpact": 0,
|
|
40
|
+
"recommended": false,
|
|
41
|
+
"evaluatedAt": "2026-01-23T16:34:06.000Z",
|
|
42
|
+
"notes": "Superseded by rename-loop-index-variables-v3.",
|
|
43
|
+
"supersededBy": "rename-loop-index-variables-v3"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "rename-loop-index-variables-v3",
|
|
47
|
+
"description": "Renames numeric for-loop counters (single or multi-declarator `for (var/let ...)`) to index/index2/... based on nesting depth",
|
|
48
|
+
"scope": "file",
|
|
49
|
+
"parallelizable": true,
|
|
50
|
+
"diffReductionImpact": 0,
|
|
51
|
+
"recommended": true,
|
|
52
|
+
"evaluatedAt": "2026-01-23T17:09:04.000Z",
|
|
53
|
+
"notes": "Unifies rename-loop-index-variables and rename-loop-index-variables-v2 without modifying older transforms. Measured with baseline none: 0.00%."
|
|
32
54
|
},
|
|
33
55
|
{
|
|
34
56
|
"id": "rename-catch-parameters",
|