miniread 1.71.0 → 1.72.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.
@@ -323,6 +323,11 @@ const manifestData = {
323
323
  recommended: true,
324
324
  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
325
  },
326
+ "rename-zod-check-parameters": {
327
+ recommended: true,
328
+ notes: "Auto-added by evaluation script.",
329
+ 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 } },
330
+ },
326
331
  "replace-dynamic-require-eval": {
327
332
  recommended: true,
328
333
  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.",
@@ -453,6 +458,7 @@ export const recommendedTransformIds = [
453
458
  "rename-use-reference-guards-v2",
454
459
  "rename-use-reference-sets",
455
460
  "rename-worker-handles",
461
+ "rename-zod-check-parameters",
456
462
  "simplify-boolean-negations",
457
463
  "simplify-string-trim",
458
464
  "split-variable-declarations",
@@ -66,6 +66,7 @@ import { renameUseReferenceGuardsTransform } from "../rename-use-reference-guard
66
66
  import { renameUseReferenceGuardsV2Transform } from "../rename-use-reference-guards-v2/rename-use-reference-guards-v2-transform.js";
67
67
  import { renameUseReferenceSetsTransform } from "../rename-use-reference-sets/rename-use-reference-sets-transform.js";
68
68
  import { renameWorkerHandlesTransform } from "../rename-worker-handles/rename-worker-handles-transform.js";
69
+ import { renameZodCheckParametersTransform } from "../rename-zod-check-parameters/rename-zod-check-parameters-transform.js";
69
70
  import { replaceDynamicRequireEvalTransform } from "../replace-dynamic-require-eval/replace-dynamic-require-eval-transform.js";
70
71
  import { simplifyBooleanNegationsTransform } from "../simplify-boolean-negations/simplify-boolean-negations-transform.js";
71
72
  import { simplifyStringTrimTransform } from "../simplify-string-trim/simplify-string-trim-transform.js";
@@ -144,6 +145,7 @@ export const transformRegistry = {
144
145
  [renameUseReferenceGuardsV2Transform.id]: renameUseReferenceGuardsV2Transform,
145
146
  [renameUseReferenceSetsTransform.id]: renameUseReferenceSetsTransform,
146
147
  [renameWorkerHandlesTransform.id]: renameWorkerHandlesTransform,
148
+ [renameZodCheckParametersTransform.id]: renameZodCheckParametersTransform,
147
149
  [replaceDynamicRequireEvalTransform.id]: replaceDynamicRequireEvalTransform,
148
150
  [simplifyBooleanNegationsTransform.id]: simplifyBooleanNegationsTransform,
149
151
  [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-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"];
@@ -76,6 +76,7 @@ export const recommendedTransformOrder = [
76
76
  "rename-use-reference-guards-v2",
77
77
  "rename-use-reference-sets",
78
78
  "rename-worker-handles",
79
+ "rename-zod-check-parameters",
79
80
  "simplify-boolean-negations",
80
81
  "simplify-string-trim",
81
82
  "split-variable-declarations",
@@ -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.72.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",