miniread 1.71.0 → 1.73.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.
@@ -140,6 +140,10 @@ const manifestData = {
140
140
  notes: "Measured with baseline none: 100.00%. Added to recommended for readability.",
141
141
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-05T18:46:50.023Z", "changedLines": 4, "durationSeconds": 165.60063108, "stableNames": 1358 } },
142
142
  },
143
+ "rename-file-reader-variables": {
144
+ recommended: true,
145
+ evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-05T18:45:30.224Z", "changedLines": 56, "durationSeconds": 179.39064335899997, "stableNames": 1358 } },
146
+ },
143
147
  "rename-fs-sync-variables": {
144
148
  recommended: true,
145
149
  notes: "Auto-added by evaluation script. Note: rename transforms can slightly increase diff size in isolation (longer identifiers), but the goal here is stability/readability and improved alignment when composed with other transforms in the recommended preset. Safety: skips files with obvious dynamic name-lookup patterns (e.g. free `eval` / `Function` / `with`) since string-based lookups are not rewritten by renames.",
@@ -323,6 +327,11 @@ const manifestData = {
323
327
  recommended: true,
324
328
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-01T22:24:10.587Z", "changedLines": 8, "durationSeconds": 154.843114025, "stableNames": 1358 } },
325
329
  },
330
+ "rename-zod-check-parameters": {
331
+ recommended: true,
332
+ notes: "Auto-added by evaluation script.",
333
+ evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-05T18:47:17.374Z", "changedLines": 198, "durationSeconds": 166.72227692599998, "stableNames": 1358 } },
334
+ },
326
335
  "replace-dynamic-require-eval": {
327
336
  recommended: true,
328
337
  notes: "Rewrites the obfuscated Node.js dynamic require pattern `eval(\"quire\".replace(/^/, \"re\"))(x)` into a direct call to the local `createRequire(import.meta.url)` function (e.g. `require(x)`). This reduces direct-eval usage for this specific case and can unblock other transforms that conservatively bail out when `eval` is present.",
@@ -422,6 +431,7 @@ export const recommendedTransformIds = [
422
431
  "rename-destructured-aliases",
423
432
  "rename-rest-parameters",
424
433
  "rename-execfile-arguments",
434
+ "rename-file-reader-variables",
425
435
  "rename-error-first-callback-parameters",
426
436
  "rename-error-variables",
427
437
  "rename-event-parameters",
@@ -453,6 +463,7 @@ export const recommendedTransformIds = [
453
463
  "rename-use-reference-guards-v2",
454
464
  "rename-use-reference-sets",
455
465
  "rename-worker-handles",
466
+ "rename-zod-check-parameters",
456
467
  "simplify-boolean-negations",
457
468
  "simplify-string-trim",
458
469
  "split-variable-declarations",
@@ -28,6 +28,7 @@ import { renameErrorVariablesTransform } from "../rename-error-variables/rename-
28
28
  import { renameEventParametersTransform } from "../rename-event-parameters/rename-event-parameters-transform.js";
29
29
  import { renameExecfileArgumentsTransform } from "../rename-execfile-arguments/rename-execfile-arguments-transform.js";
30
30
  import { renameFileExtensionVariablesTransform } from "../rename-file-extension-variables/rename-file-extension-variables-transform.js";
31
+ import { renameFileReaderVariablesTransform } from "../rename-file-reader-variables/rename-file-reader-variables-transform.js";
31
32
  import { renameFsSyncVariablesTransform } from "../rename-fs-sync-variables/rename-fs-sync-variables-transform.js";
32
33
  import { renameHttpMethodParametersTransform } from "../rename-http-method-parameters/rename-http-method-parameters-transform.js";
33
34
  import { renameHttpServerParametersTransform } from "../rename-http-server-parameters/rename-http-server-parameters-transform.js";
@@ -66,6 +67,7 @@ import { renameUseReferenceGuardsTransform } from "../rename-use-reference-guard
66
67
  import { renameUseReferenceGuardsV2Transform } from "../rename-use-reference-guards-v2/rename-use-reference-guards-v2-transform.js";
67
68
  import { renameUseReferenceSetsTransform } from "../rename-use-reference-sets/rename-use-reference-sets-transform.js";
68
69
  import { renameWorkerHandlesTransform } from "../rename-worker-handles/rename-worker-handles-transform.js";
70
+ import { renameZodCheckParametersTransform } from "../rename-zod-check-parameters/rename-zod-check-parameters-transform.js";
69
71
  import { replaceDynamicRequireEvalTransform } from "../replace-dynamic-require-eval/replace-dynamic-require-eval-transform.js";
70
72
  import { simplifyBooleanNegationsTransform } from "../simplify-boolean-negations/simplify-boolean-negations-transform.js";
71
73
  import { simplifyStringTrimTransform } from "../simplify-string-trim/simplify-string-trim-transform.js";
@@ -106,6 +108,7 @@ export const transformRegistry = {
106
108
  [renameEventParametersTransform.id]: renameEventParametersTransform,
107
109
  [renameExecfileArgumentsTransform.id]: renameExecfileArgumentsTransform,
108
110
  [renameFileExtensionVariablesTransform.id]: renameFileExtensionVariablesTransform,
111
+ [renameFileReaderVariablesTransform.id]: renameFileReaderVariablesTransform,
109
112
  [renameFsSyncVariablesTransform.id]: renameFsSyncVariablesTransform,
110
113
  [renameHttpMethodParametersTransform.id]: renameHttpMethodParametersTransform,
111
114
  [renameHttpServerParametersTransform.id]: renameHttpServerParametersTransform,
@@ -144,6 +147,7 @@ export const transformRegistry = {
144
147
  [renameUseReferenceGuardsV2Transform.id]: renameUseReferenceGuardsV2Transform,
145
148
  [renameUseReferenceSetsTransform.id]: renameUseReferenceSetsTransform,
146
149
  [renameWorkerHandlesTransform.id]: renameWorkerHandlesTransform,
150
+ [renameZodCheckParametersTransform.id]: renameZodCheckParametersTransform,
147
151
  [replaceDynamicRequireEvalTransform.id]: replaceDynamicRequireEvalTransform,
148
152
  [simplifyBooleanNegationsTransform.id]: simplifyBooleanNegationsTransform,
149
153
  [simplifyStringTrimTransform.id]: simplifyStringTrimTransform,
@@ -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", "stabilize-nested-bindings", "stabilize-deferred-top-level-bindings", "stabilize-deferred-stable-rhs", "expand-boolean-literals", "expand-sequence-expressions-v5", "expand-special-number-literals", "expand-typeof-undefined-comparisons", "expand-undefined-literals", "remove-redundant-else", "rename-arguments-length-flags", "rename-asap-wrappers", "rename-awaiter-parameters", "rename-awaiter-helper-functions", "rename-buffer-variables", "rename-to-buffer-results", "rename-catch-parameters", "rename-promise-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-rest-parameters", "rename-execfile-arguments", "rename-error-first-callback-parameters", "rename-error-variables", "rename-event-parameters", "rename-http-server-parameters", "rename-fs-sync-variables", "rename-http-method-parameters", "rename-interval-ids", "rename-loop-index-variables-v3", "rename-loop-length-variables", "rename-document-fragment-variables", "rename-object-keys-variables", "rename-object-keys-iterator-variables", "rename-parameters-to-match-properties-v2", "rename-promise-executor-parameters-v2", "rename-range-parameters", "rename-read-file-lines", "rename-regex-builders", "rename-regex-source-parameters", "rename-search-parameters-variables", "rename-file-extension-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", "rename-worker-handles", "simplify-boolean-negations", "simplify-string-trim", "split-variable-declarations", "use-optional-chaining", "use-object-property-shorthand", "use-object-shorthand", "replace-dynamic-require-eval"];
7
+ export declare const recommendedTransformOrder: readonly ["stabilize-top-level-bindings", "stabilize-nested-bindings", "stabilize-deferred-top-level-bindings", "stabilize-deferred-stable-rhs", "expand-boolean-literals", "expand-sequence-expressions-v5", "expand-special-number-literals", "expand-typeof-undefined-comparisons", "expand-undefined-literals", "remove-redundant-else", "rename-arguments-length-flags", "rename-asap-wrappers", "rename-awaiter-parameters", "rename-awaiter-helper-functions", "rename-buffer-variables", "rename-to-buffer-results", "rename-catch-parameters", "rename-promise-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-rest-parameters", "rename-execfile-arguments", "rename-file-reader-variables", "rename-error-first-callback-parameters", "rename-error-variables", "rename-event-parameters", "rename-http-server-parameters", "rename-fs-sync-variables", "rename-http-method-parameters", "rename-interval-ids", "rename-loop-index-variables-v3", "rename-loop-length-variables", "rename-document-fragment-variables", "rename-object-keys-variables", "rename-object-keys-iterator-variables", "rename-parameters-to-match-properties-v2", "rename-promise-executor-parameters-v2", "rename-range-parameters", "rename-read-file-lines", "rename-regex-builders", "rename-regex-source-parameters", "rename-search-parameters-variables", "rename-file-extension-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", "rename-worker-handles", "rename-zod-check-parameters", "simplify-boolean-negations", "simplify-string-trim", "split-variable-declarations", "use-optional-chaining", "use-object-property-shorthand", "use-object-shorthand", "replace-dynamic-require-eval"];
@@ -42,6 +42,7 @@ export const recommendedTransformOrder = [
42
42
  "rename-destructured-aliases",
43
43
  "rename-rest-parameters",
44
44
  "rename-execfile-arguments",
45
+ "rename-file-reader-variables",
45
46
  "rename-error-first-callback-parameters",
46
47
  "rename-error-variables",
47
48
  "rename-event-parameters",
@@ -76,6 +77,7 @@ export const recommendedTransformOrder = [
76
77
  "rename-use-reference-guards-v2",
77
78
  "rename-use-reference-sets",
78
79
  "rename-worker-handles",
80
+ "rename-zod-check-parameters",
79
81
  "simplify-boolean-negations",
80
82
  "simplify-string-trim",
81
83
  "split-variable-declarations",
@@ -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-05T18:45:30.224Z",
7
+ "changedLines": 56,
8
+ "durationSeconds": 179.39064335899997,
9
+ "stableNames": 1358
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ import { type Transform } from "../../core/types.js";
2
+ export declare const renameFileReaderVariablesTransform: Transform;
@@ -0,0 +1,111 @@
1
+ import { createRequire } from "node:module";
2
+ import { collectExportedNames } from "../../core/collect-exported-names.js";
3
+ import { RenameGroup, isStableRenamed } from "../../core/stable-naming.js";
4
+ import { getFilesToProcess, } from "../../core/types.js";
5
+ const require = createRequire(import.meta.url);
6
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
7
+ const traverse = require("@babel/traverse").default;
8
+ const isTypeOnlyImportSpecifier = (binding, node) => {
9
+ const declaration = binding.path.parent;
10
+ if (declaration.type !== "ImportDeclaration") {
11
+ return false;
12
+ }
13
+ if (node.type === "ImportSpecifier" && node.importKind === "type") {
14
+ return true;
15
+ }
16
+ return declaration.importKind === "type";
17
+ };
18
+ const isTypeOnlyFileReaderBinding = (binding) => {
19
+ const node = binding.path.node;
20
+ const declaration = binding.path.parent;
21
+ if (node.type === "ImportSpecifier" ||
22
+ node.type === "ImportDefaultSpecifier") {
23
+ return isTypeOnlyImportSpecifier(binding, node);
24
+ }
25
+ if (declaration.type === "VariableDeclaration" && declaration.declare) {
26
+ return true;
27
+ }
28
+ if (node.type === "TSDeclareFunction" ||
29
+ (node.type === "ClassDeclaration" && node.declare === true) ||
30
+ (node.type === "FunctionDeclaration" && node.declare === true)) {
31
+ return true;
32
+ }
33
+ return (node.type === "TSTypeAliasDeclaration" ||
34
+ node.type === "TSInterfaceDeclaration");
35
+ };
36
+ const hasRuntimeFileReaderShadowing = (path) => {
37
+ const binding = path.scope.getBinding("FileReader");
38
+ // Ambient declarations like `declare class FileReader` typically do not
39
+ // produce bindings in Babel's TS scope model, so `binding` is often absent.
40
+ if (!binding) {
41
+ return false;
42
+ }
43
+ // Keep using getBinding so we can inspect and ignore type-only TS bindings.
44
+ if (isTypeOnlyFileReaderBinding(binding)) {
45
+ return false;
46
+ }
47
+ return true;
48
+ };
49
+ const isFileReaderConstructor = (path) => {
50
+ const { callee } = path.node;
51
+ if (callee.type !== "Identifier")
52
+ return false;
53
+ if (callee.name !== "FileReader")
54
+ return false;
55
+ if (hasRuntimeFileReaderShadowing(path))
56
+ return false;
57
+ return true;
58
+ };
59
+ export const renameFileReaderVariablesTransform = {
60
+ id: "rename-file-reader-variables",
61
+ description: "Rename variables initialized with new FileReader() to stable fileReader-derived names",
62
+ scope: "file",
63
+ parallelizable: true,
64
+ transform(context) {
65
+ let nodesVisited = 0;
66
+ let transformationsApplied = 0;
67
+ for (const fileInfo of getFilesToProcess(context)) {
68
+ const renameGroup = new RenameGroup();
69
+ const exportedNames = collectExportedNames(fileInfo.ast.program);
70
+ traverse(fileInfo.ast, {
71
+ VariableDeclarator(path) {
72
+ nodesVisited++;
73
+ const { id } = path.node;
74
+ if (id.type !== "Identifier") {
75
+ return;
76
+ }
77
+ const initPath = path.get("init");
78
+ if (Array.isArray(initPath) || !initPath.isNewExpression()) {
79
+ return;
80
+ }
81
+ if (!isFileReaderConstructor(initPath)) {
82
+ return;
83
+ }
84
+ const currentName = id.name;
85
+ if (isStableRenamed(currentName)) {
86
+ return;
87
+ }
88
+ // Preserve already-semantic names (e.g. myFileReader) to avoid needless churn.
89
+ if (currentName.toLowerCase().includes("filereader")) {
90
+ return;
91
+ }
92
+ const binding = path.scope.getBinding(currentName);
93
+ if (!binding?.constant) {
94
+ return;
95
+ }
96
+ if (binding.scope.block.type === "Program" &&
97
+ exportedNames.has(currentName)) {
98
+ return;
99
+ }
100
+ renameGroup.add({
101
+ scope: path.scope,
102
+ currentName,
103
+ baseName: "fileReader",
104
+ });
105
+ },
106
+ });
107
+ transformationsApplied += renameGroup.apply();
108
+ }
109
+ return Promise.resolve({ nodesVisited, transformationsApplied });
110
+ },
111
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "recommended": true,
3
+ "evaluations": {
4
+ "claude-code-2.1.10:claude-code-2.1.11": {
5
+ "diffSizePercent": 100,
6
+ "evaluatedAt": "2026-02-05T18:47:17.374Z",
7
+ "changedLines": 198,
8
+ "durationSeconds": 166.72227692599998,
9
+ "stableNames": 1358
10
+ }
11
+ },
12
+ "notes": "Auto-added by evaluation script."
13
+ }
@@ -0,0 +1,2 @@
1
+ import { type Transform } from "../../core/types.js";
2
+ export declare const renameZodCheckParametersTransform: Transform;
@@ -0,0 +1,105 @@
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 = "ctx";
8
+ const isIdentifierProperty = (property, name) => property.type === "Identifier" && property.name === name;
9
+ const isZodCheckMember = (node) => {
10
+ if (node.computed)
11
+ return false;
12
+ if (!isIdentifierProperty(node.property, "check"))
13
+ return false;
14
+ const object = node.object;
15
+ if (object.type !== "MemberExpression")
16
+ return false;
17
+ if (object.computed)
18
+ return false;
19
+ return isIdentifierProperty(object.property, "_zod");
20
+ };
21
+ const getCheckHandlerParameter = (path) => {
22
+ if (path.node.left.type !== "MemberExpression")
23
+ return undefined;
24
+ if (!isZodCheckMember(path.node.left))
25
+ return undefined;
26
+ const rightPath = path.get("right");
27
+ if (!rightPath.isFunctionExpression() &&
28
+ !rightPath.isArrowFunctionExpression()) {
29
+ return undefined;
30
+ }
31
+ if (rightPath.node.params.length !== 1)
32
+ return undefined;
33
+ const firstParameter = rightPath.node.params[0];
34
+ if (firstParameter?.type !== "Identifier")
35
+ return undefined;
36
+ return firstParameter;
37
+ };
38
+ const isIssuesPushCall = (referencePath) => {
39
+ if (!referencePath.isIdentifier())
40
+ return false;
41
+ // Binding.referencePaths are concrete identifier usages with parent paths,
42
+ // so we intentionally rely on direct parentPath traversal here.
43
+ const issuesMemberPath = referencePath.parentPath;
44
+ if (!issuesMemberPath.isMemberExpression())
45
+ return false;
46
+ if (issuesMemberPath.node.object !== referencePath.node)
47
+ return false;
48
+ if (issuesMemberPath.node.computed)
49
+ return false;
50
+ if (!isIdentifierProperty(issuesMemberPath.node.property, "issues")) {
51
+ return false;
52
+ }
53
+ const pushMemberPath = issuesMemberPath.parentPath;
54
+ if (!pushMemberPath.isMemberExpression())
55
+ return false;
56
+ if (pushMemberPath.node.object !== issuesMemberPath.node)
57
+ return false;
58
+ if (pushMemberPath.node.computed)
59
+ return false;
60
+ if (!isIdentifierProperty(pushMemberPath.node.property, "push"))
61
+ return false;
62
+ const callPath = pushMemberPath.parentPath;
63
+ if (!callPath.isCallExpression())
64
+ return false;
65
+ return callPath.node.callee === pushMemberPath.node;
66
+ };
67
+ const hasIssuesPushCall = (binding) => binding.referencePaths.some((referencePath) => isIssuesPushCall(referencePath));
68
+ export const renameZodCheckParametersTransform = {
69
+ id: "rename-zod-check-parameters",
70
+ description: "Renames Zod _zod.check callback parameters to $ctx when issues are pushed",
71
+ scope: "file",
72
+ parallelizable: true,
73
+ transform(context) {
74
+ let nodesVisited = 0;
75
+ let transformationsApplied = 0;
76
+ for (const fileInfo of getFilesToProcess(context)) {
77
+ const renameGroup = new RenameGroup();
78
+ traverse(fileInfo.ast, {
79
+ AssignmentExpression(path) {
80
+ nodesVisited++;
81
+ const parameter = getCheckHandlerParameter(path);
82
+ if (!parameter)
83
+ return;
84
+ if (isStableRenamed(parameter.name))
85
+ return;
86
+ const rightPath = path.get("right");
87
+ const binding = rightPath.scope.getBinding(parameter.name);
88
+ if (!binding)
89
+ return;
90
+ if (!binding.constant)
91
+ return;
92
+ if (!hasIssuesPushCall(binding))
93
+ return;
94
+ renameGroup.add({
95
+ scope: binding.scope,
96
+ currentName: parameter.name,
97
+ baseName: BASE_NAME,
98
+ });
99
+ },
100
+ });
101
+ transformationsApplied += renameGroup.apply();
102
+ }
103
+ return Promise.resolve({ nodesVisited, transformationsApplied });
104
+ },
105
+ };
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.71.0",
5
+ "version": "1.73.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",