miniread 1.100.3 → 1.100.4
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.
|
@@ -213,7 +213,7 @@ const manifestData = {
|
|
|
213
213
|
"rename-object-property-value-variables": {
|
|
214
214
|
recommended: true,
|
|
215
215
|
notes: "Measured with baseline none: 2.11%. Added to recommended for readability.",
|
|
216
|
-
evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent":
|
|
216
|
+
evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-07T14:06:04.463Z", "changedLines": 12500, "durationSeconds": 27.3519195, "stableNames": 1357 } },
|
|
217
217
|
},
|
|
218
218
|
"rename-parameters-to-match-properties-v2": {
|
|
219
219
|
recommended: true,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"recommended": true,
|
|
3
3
|
"evaluations": {
|
|
4
4
|
"claude-code-2.1.10:claude-code-2.1.11": {
|
|
5
|
-
"diffSizePercent":
|
|
6
|
-
"evaluatedAt": "2026-02-
|
|
5
|
+
"diffSizePercent": 100,
|
|
6
|
+
"evaluatedAt": "2026-02-07T14:06:04.463Z",
|
|
7
7
|
"changedLines": 12500,
|
|
8
|
-
"durationSeconds":
|
|
9
|
-
"stableNames":
|
|
8
|
+
"durationSeconds": 27.3519195,
|
|
9
|
+
"stableNames": 1357
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"notes": "Measured with baseline none: 2.11%. Added to recommended for readability."
|
package/dist/transforms/rename-promise-catch-parameters/rename-promise-catch-parameters-transform.js
CHANGED
|
@@ -17,15 +17,16 @@ const isCatchMemberExpression = (callee) => {
|
|
|
17
17
|
return false;
|
|
18
18
|
return property.name === "catch";
|
|
19
19
|
};
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
if (!isCatchMemberExpression(node.callee))
|
|
20
|
+
const getCatchCallbackPath = (path) => {
|
|
21
|
+
if (!isCatchMemberExpression(path.node.callee))
|
|
23
22
|
return;
|
|
24
|
-
|
|
23
|
+
// Intentionally match only canonical `.catch(onRejected)` usage:
|
|
24
|
+
// this transform does not verify the callee object is a real Promise.
|
|
25
|
+
if (path.node.arguments.length !== 1)
|
|
25
26
|
return;
|
|
26
|
-
const argument = node.arguments
|
|
27
|
-
if (argument
|
|
28
|
-
argument
|
|
27
|
+
const [argument] = path.node.arguments;
|
|
28
|
+
if (argument.type !== "FunctionExpression" &&
|
|
29
|
+
argument.type !== "ArrowFunctionExpression") {
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
if (argument.params.length !== 1)
|
|
@@ -33,48 +34,57 @@ const getCatchCallbackInfo = (path) => {
|
|
|
33
34
|
const parameter = argument.params[0];
|
|
34
35
|
if (parameter?.type !== "Identifier")
|
|
35
36
|
return;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const callback = path.get("arguments.0");
|
|
38
|
+
if (Array.isArray(callback))
|
|
39
|
+
return;
|
|
40
|
+
if (!callback.isFunctionExpression() &&
|
|
41
|
+
!callback.isArrowFunctionExpression()) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return callback;
|
|
40
45
|
};
|
|
41
|
-
const addCatchRename = (group, callbackPath
|
|
46
|
+
const addCatchRename = (group, callbackPath) => {
|
|
47
|
+
const parameter = callbackPath.node.params[0];
|
|
42
48
|
const currentName = parameter.name;
|
|
43
49
|
if (isStableRenamed(currentName))
|
|
44
|
-
return;
|
|
45
|
-
group
|
|
50
|
+
return group;
|
|
51
|
+
const nextGroup = group ?? new RenameGroup();
|
|
52
|
+
nextGroup.add({
|
|
46
53
|
scope: callbackPath.scope,
|
|
47
54
|
currentName,
|
|
48
55
|
baseName: BASE_NAME,
|
|
49
56
|
});
|
|
57
|
+
return nextGroup;
|
|
50
58
|
};
|
|
51
59
|
export const renamePromiseCatchParametersTransform = {
|
|
52
60
|
id: "rename-promise-catch-parameters",
|
|
53
|
-
description: "Renames
|
|
61
|
+
description: "Renames canonical `.catch(onRejected)` callback parameters to $caughtError/$caughtError2/..., intentionally skipping multi-argument catch-like APIs.",
|
|
54
62
|
scope: "file",
|
|
55
63
|
parallelizable: true,
|
|
56
64
|
transform(context) {
|
|
57
65
|
let nodesVisited = 0;
|
|
58
66
|
let transformationsApplied = 0;
|
|
59
67
|
for (const fileInfo of getFilesToProcess(context)) {
|
|
60
|
-
|
|
68
|
+
let group;
|
|
61
69
|
traverse(fileInfo.ast, {
|
|
62
70
|
CallExpression(path) {
|
|
63
71
|
nodesVisited++;
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
72
|
+
const callbackPath = getCatchCallbackPath(path);
|
|
73
|
+
if (!callbackPath)
|
|
66
74
|
return;
|
|
67
|
-
addCatchRename(group,
|
|
75
|
+
group = addCatchRename(group, callbackPath);
|
|
68
76
|
},
|
|
69
77
|
OptionalCallExpression(path) {
|
|
70
78
|
nodesVisited++;
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
79
|
+
const callbackPath = getCatchCallbackPath(path);
|
|
80
|
+
if (!callbackPath)
|
|
73
81
|
return;
|
|
74
|
-
addCatchRename(group,
|
|
82
|
+
group = addCatchRename(group, callbackPath);
|
|
75
83
|
},
|
|
76
84
|
});
|
|
77
|
-
|
|
85
|
+
if (group) {
|
|
86
|
+
transformationsApplied += group.apply();
|
|
87
|
+
}
|
|
78
88
|
}
|
|
79
89
|
return Promise.resolve({
|
|
80
90
|
nodesVisited,
|
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.100.
|
|
5
|
+
"version": "1.100.4",
|
|
6
6
|
"description": "Transform minified JavaScript/TypeScript into a more readable form using deterministic AST-based transforms.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -55,8 +55,6 @@
|
|
|
55
55
|
"rebuild": "pnpm run clean && pnpm run build",
|
|
56
56
|
"pretest": "node --experimental-strip-types scripts/generate-registry.ts",
|
|
57
57
|
"test": "vitest run",
|
|
58
|
-
"test:coverage": "vitest run --coverage",
|
|
59
|
-
"test:watch": "vitest",
|
|
60
58
|
"typecheck": "tsc -b --noEmit"
|
|
61
59
|
},
|
|
62
60
|
"keywords": [],
|