miniread 1.54.0 → 1.55.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.
@@ -118,6 +118,10 @@ const manifestData = {
118
118
  notes: "Added manually; recommended based on high-confidence heuristics. Evaluated diff-neutral on claude-code-2.1.10→2.1.11.",
119
119
  evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:01:29.649Z", "changedLines": 8, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-29T14:35:18.029Z", "changedLines": 8, "durationSeconds": 34.694468833, "stableNames": 1358 } },
120
120
  },
121
+ "rename-interval-ids": {
122
+ recommended: true,
123
+ evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-01T09:30:55.276Z", "changedLines": 58, "durationSeconds": 201.398360841, "stableNames": 1358 } },
124
+ },
121
125
  "rename-loop-index-variables": {
122
126
  recommended: false,
123
127
  notes: "Superseded by rename-loop-index-variables-v3.",
@@ -338,6 +342,7 @@ export const recommendedTransformIds = [
338
342
  "rename-error-first-callback-parameters",
339
343
  "rename-error-variables",
340
344
  "rename-event-parameters",
345
+ "rename-interval-ids",
341
346
  "rename-loop-index-variables-v3",
342
347
  "rename-loop-length-variables",
343
348
  "rename-object-keys-variables",
@@ -23,6 +23,7 @@ import { renameDestructuredAliasesTransform } from "../rename-destructured-alias
23
23
  import { renameErrorFirstCallbackParametersTransform } from "../rename-error-first-callback-parameters/rename-error-first-callback-parameters-transform.js";
24
24
  import { renameErrorVariablesTransform } from "../rename-error-variables/rename-error-variables-transform.js";
25
25
  import { renameEventParametersTransform } from "../rename-event-parameters/rename-event-parameters-transform.js";
26
+ import { renameIntervalIdsTransform } from "../rename-interval-ids/rename-interval-ids-transform.js";
26
27
  import { renameLoopIndexVariablesTransform } from "../rename-loop-index-variables/rename-loop-index-variables-transform.js";
27
28
  import { renameLoopIndexVariablesV2Transform } from "../rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js";
28
29
  import { renameLoopIndexVariablesV3Transform } from "../rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js";
@@ -83,6 +84,7 @@ export const transformRegistry = {
83
84
  [renameErrorFirstCallbackParametersTransform.id]: renameErrorFirstCallbackParametersTransform,
84
85
  [renameErrorVariablesTransform.id]: renameErrorVariablesTransform,
85
86
  [renameEventParametersTransform.id]: renameEventParametersTransform,
87
+ [renameIntervalIdsTransform.id]: renameIntervalIdsTransform,
86
88
  [renameLoopIndexVariablesTransform.id]: renameLoopIndexVariablesTransform,
87
89
  [renameLoopIndexVariablesV2Transform.id]: renameLoopIndexVariablesV2Transform,
88
90
  [renameLoopIndexVariablesV3Transform.id]: renameLoopIndexVariablesV3Transform,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "recommended": {
3
- "diffSizePercent": 83.6526599845798,
4
- "notes": "Measured with baseline none: 83.65% of original diff."
3
+ "diffSizePercent": 78.49967015361418,
4
+ "notes": "Measured with baseline none: 78.50% of original diff."
5
5
  }
6
6
  }
@@ -4,4 +4,4 @@
4
4
  * This lets us tune transform interactions intentionally instead of relying on
5
5
  * alphabetical ID sorting.
6
6
  */
7
- export declare const recommendedTransformOrder: readonly ["stabilize-top-level-bindings", "expand-boolean-literals", "expand-sequence-expressions-v5", "expand-special-number-literals", "expand-undefined-literals", "remove-redundant-else", "rename-arguments-length-flags", "rename-asap-wrappers", "rename-awaiter-parameters", "rename-buffer-variables", "rename-catch-parameters", "rename-char-code-at", "rename-charcode-variables-v2", "rename-client-aliases", "rename-comparison-flags", "rename-date-now-start-times", "rename-default-options-parameters", "rename-deferred-resolve-parameters", "rename-destructured-aliases", "rename-error-first-callback-parameters", "rename-error-variables", "rename-event-parameters", "rename-loop-index-variables-v3", "rename-loop-length-variables", "rename-object-keys-variables", "rename-parameters-to-match-properties-v2", "rename-promise-executor-parameters-v2", "rename-range-parameters", "rename-read-file-lines", "rename-regex-builders", "rename-rest-parameters", "rename-search-parameters-variables", "rename-string-split-variables", "rename-this-aliases", "rename-timeout-ids", "rename-typeof-variables", "rename-typescript-helper-aliases", "rename-uint8array-concat-variables", "rename-url-parameters", "rename-url-variables", "rename-use-reference-guards-v2", "rename-use-reference-sets", "simplify-boolean-negations", "simplify-string-trim", "split-variable-declarations", "use-object-property-shorthand", "use-object-shorthand", "replace-dynamic-require-eval"];
7
+ export declare const recommendedTransformOrder: readonly ["stabilize-top-level-bindings", "expand-boolean-literals", "expand-sequence-expressions-v5", "expand-special-number-literals", "expand-undefined-literals", "remove-redundant-else", "rename-arguments-length-flags", "rename-asap-wrappers", "rename-awaiter-parameters", "rename-buffer-variables", "rename-catch-parameters", "rename-char-code-at", "rename-charcode-variables-v2", "rename-client-aliases", "rename-comparison-flags", "rename-date-now-start-times", "rename-default-options-parameters", "rename-deferred-resolve-parameters", "rename-destructured-aliases", "rename-error-first-callback-parameters", "rename-error-variables", "rename-event-parameters", "rename-interval-ids", "rename-loop-index-variables-v3", "rename-loop-length-variables", "rename-object-keys-variables", "rename-parameters-to-match-properties-v2", "rename-promise-executor-parameters-v2", "rename-range-parameters", "rename-read-file-lines", "rename-regex-builders", "rename-rest-parameters", "rename-search-parameters-variables", "rename-string-split-variables", "rename-this-aliases", "rename-timeout-ids", "rename-typeof-variables", "rename-typescript-helper-aliases", "rename-uint8array-concat-variables", "rename-url-parameters", "rename-url-variables", "rename-use-reference-guards-v2", "rename-use-reference-sets", "simplify-boolean-negations", "simplify-string-trim", "split-variable-declarations", "use-object-property-shorthand", "use-object-shorthand", "replace-dynamic-require-eval"];
@@ -29,6 +29,7 @@ export const recommendedTransformOrder = [
29
29
  "rename-error-first-callback-parameters",
30
30
  "rename-error-variables",
31
31
  "rename-event-parameters",
32
+ "rename-interval-ids",
32
33
  "rename-loop-index-variables-v3",
33
34
  "rename-loop-length-variables",
34
35
  "rename-object-keys-variables",
@@ -0,0 +1,12 @@
1
+ {
2
+ "recommended": true,
3
+ "evaluations": {
4
+ "claude-code-2.1.10:claude-code-2.1.11": {
5
+ "diffSizePercent": 100,
6
+ "evaluatedAt": "2026-02-01T09:30:55.276Z",
7
+ "changedLines": 58,
8
+ "durationSeconds": 201.398360841,
9
+ "stableNames": 1358
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ import { type Transform } from "../../core/types.js";
2
+ export declare const renameIntervalIdsTransform: Transform;
@@ -0,0 +1,85 @@
1
+ import { createRequire } from "node:module";
2
+ import { isStableRenamed, RenameGroup } from "../../core/stable-naming.js";
3
+ import { getFilesToProcess, } from "../../core/types.js";
4
+ const require = createRequire(import.meta.url);
5
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6
+ const traverse = require("@babel/traverse").default;
7
+ const BASE_NAME = "intervalId";
8
+ const isSetIntervalCall = (path, init) => {
9
+ if (init.callee.type !== "Identifier")
10
+ return false;
11
+ if (init.callee.name !== "setInterval")
12
+ return false;
13
+ // If setInterval is locally bound (imported or declared), semantics may differ.
14
+ if (path.scope.hasBinding("setInterval", true))
15
+ return false;
16
+ return true;
17
+ };
18
+ const isClearIntervalCallArgument = (referencePath, bindingName) => {
19
+ if (!referencePath.isIdentifier())
20
+ return false;
21
+ const callPath = referencePath.parentPath;
22
+ if (!callPath.isCallExpression())
23
+ return false;
24
+ const call = callPath.node;
25
+ if (call.callee.type !== "Identifier")
26
+ return false;
27
+ if (call.callee.name !== "clearInterval")
28
+ return false;
29
+ // If clearInterval is locally bound (imported or declared), semantics may differ.
30
+ if (callPath.scope.hasBinding("clearInterval", true))
31
+ return false;
32
+ const argument0 = call.arguments[0];
33
+ if (argument0?.type !== "Identifier")
34
+ return false;
35
+ if (argument0 !== referencePath.node)
36
+ return false;
37
+ if (argument0.name !== bindingName)
38
+ return false;
39
+ return true;
40
+ };
41
+ export const renameIntervalIdsTransform = {
42
+ id: "rename-interval-ids",
43
+ description: "Renames setInterval handle variables to $intervalId/$intervalId2/... or intervalId/intervalId2/... when usage is only clearInterval(...)",
44
+ scope: "file",
45
+ parallelizable: true,
46
+ transform(context) {
47
+ let nodesVisited = 0;
48
+ let transformationsApplied = 0;
49
+ for (const fileInfo of getFilesToProcess(context)) {
50
+ const group = new RenameGroup();
51
+ traverse(fileInfo.ast, {
52
+ VariableDeclarator(path) {
53
+ nodesVisited++;
54
+ const id = path.node.id;
55
+ if (id.type !== "Identifier")
56
+ return;
57
+ // Skip already-stable names
58
+ if (isStableRenamed(id.name))
59
+ return;
60
+ const init = path.node.init;
61
+ if (init?.type !== "CallExpression")
62
+ return;
63
+ if (!isSetIntervalCall(path, init))
64
+ return;
65
+ const binding = path.scope.getBinding(id.name);
66
+ if (!binding)
67
+ return;
68
+ if (!binding.constant)
69
+ return;
70
+ if (binding.referencePaths.length === 0)
71
+ return;
72
+ if (!binding.referencePaths.every((referencePath) => isClearIntervalCallArgument(referencePath, id.name)))
73
+ return;
74
+ group.add({
75
+ scope: path.scope,
76
+ currentName: id.name,
77
+ baseName: BASE_NAME,
78
+ });
79
+ },
80
+ });
81
+ transformationsApplied += group.apply();
82
+ }
83
+ return Promise.resolve({ nodesVisited, transformationsApplied });
84
+ },
85
+ };
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.54.0",
5
+ "version": "1.55.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",