miniread 1.98.0 → 1.98.1

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.
Files changed (92) hide show
  1. package/dist/transforms/_generated/manifest.js +1 -70
  2. package/dist/transforms/_generated/registry.js +0 -24
  3. package/dist/transforms/preset-stats.json +2 -2
  4. package/dist/transforms/rename-timeout-promises/manifest.json +2 -2
  5. package/dist/transforms/rename-timeout-promises/rename-timeout-promises-transform.js +18 -15
  6. package/package.json +2 -1
  7. package/dist/transforms/expand-sequence-expressions-v4/expand-expression-statement-sequence.d.ts +0 -3
  8. package/dist/transforms/expand-sequence-expressions-v4/expand-expression-statement-sequence.js +0 -86
  9. package/dist/transforms/expand-sequence-expressions-v4/expand-return-sequence.d.ts +0 -3
  10. package/dist/transforms/expand-sequence-expressions-v4/expand-return-sequence.js +0 -91
  11. package/dist/transforms/expand-sequence-expressions-v4/expand-sequence-expressions-v4-transform.d.ts +0 -2
  12. package/dist/transforms/expand-sequence-expressions-v4/expand-sequence-expressions-v4-transform.js +0 -48
  13. package/dist/transforms/expand-sequence-expressions-v4/expand-throw-sequence.d.ts +0 -3
  14. package/dist/transforms/expand-sequence-expressions-v4/expand-throw-sequence.js +0 -101
  15. package/dist/transforms/expand-sequence-expressions-v4/expand-variable-declaration-sequence.d.ts +0 -3
  16. package/dist/transforms/expand-sequence-expressions-v4/expand-variable-declaration-sequence.js +0 -99
  17. package/dist/transforms/expand-sequence-expressions-v4/manifest.json +0 -14
  18. package/dist/transforms/rename-charcode-variables/manifest.json +0 -14
  19. package/dist/transforms/rename-charcode-variables/rename-charcode-variables-transform.d.ts +0 -2
  20. package/dist/transforms/rename-charcode-variables/rename-charcode-variables-transform.js +0 -67
  21. package/dist/transforms/rename-default-options-parameters/manifest.json +0 -21
  22. package/dist/transforms/rename-default-options-parameters/rename-default-options-parameters-transform.d.ts +0 -2
  23. package/dist/transforms/rename-default-options-parameters/rename-default-options-parameters-transform.js +0 -110
  24. package/dist/transforms/rename-default-options-parameters-v2/manifest.json +0 -13
  25. package/dist/transforms/rename-default-options-parameters-v2/rename-default-options-parameters-v2-transform.d.ts +0 -2
  26. package/dist/transforms/rename-default-options-parameters-v2/rename-default-options-parameters-v2-transform.js +0 -43
  27. package/dist/transforms/rename-loop-index-variables/manifest.json +0 -21
  28. package/dist/transforms/rename-loop-index-variables/rename-loop-index-variables-transform.d.ts +0 -2
  29. package/dist/transforms/rename-loop-index-variables/rename-loop-index-variables-transform.js +0 -131
  30. package/dist/transforms/rename-loop-index-variables-v2/get-loop-counter-name.d.ts +0 -5
  31. package/dist/transforms/rename-loop-index-variables-v2/get-loop-counter-name.js +0 -123
  32. package/dist/transforms/rename-loop-index-variables-v2/get-renamed-ancestor-loop-count.d.ts +0 -3
  33. package/dist/transforms/rename-loop-index-variables-v2/get-renamed-ancestor-loop-count.js +0 -19
  34. package/dist/transforms/rename-loop-index-variables-v2/get-target-index-base-name.d.ts +0 -1
  35. package/dist/transforms/rename-loop-index-variables-v2/get-target-index-base-name.js +0 -6
  36. package/dist/transforms/rename-loop-index-variables-v2/manifest.json +0 -21
  37. package/dist/transforms/rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.d.ts +0 -2
  38. package/dist/transforms/rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js +0 -47
  39. package/dist/transforms/rename-parameters-to-match-properties/manifest.json +0 -21
  40. package/dist/transforms/rename-parameters-to-match-properties/rename-parameters-to-match-properties-transform.d.ts +0 -2
  41. package/dist/transforms/rename-parameters-to-match-properties/rename-parameters-to-match-properties-transform.js +0 -98
  42. package/dist/transforms/rename-promise-executor-parameters/manifest.json +0 -21
  43. package/dist/transforms/rename-promise-executor-parameters/promise-executor-heuristics.d.ts +0 -5
  44. package/dist/transforms/rename-promise-executor-parameters/promise-executor-heuristics.js +0 -63
  45. package/dist/transforms/rename-promise-executor-parameters/rename-binding-if-safe.d.ts +0 -3
  46. package/dist/transforms/rename-promise-executor-parameters/rename-binding-if-safe.js +0 -11
  47. package/dist/transforms/rename-promise-executor-parameters/rename-promise-executor-parameters-transform.d.ts +0 -2
  48. package/dist/transforms/rename-promise-executor-parameters/rename-promise-executor-parameters-transform.js +0 -84
  49. package/dist/transforms/rename-safe-property-accessor-parameters/get-return-expression.d.ts +0 -3
  50. package/dist/transforms/rename-safe-property-accessor-parameters/get-return-expression.js +0 -21
  51. package/dist/transforms/rename-safe-property-accessor-parameters/get-returned-function.d.ts +0 -3
  52. package/dist/transforms/rename-safe-property-accessor-parameters/get-returned-function.js +0 -22
  53. package/dist/transforms/rename-safe-property-accessor-parameters/is-member-access.d.ts +0 -2
  54. package/dist/transforms/rename-safe-property-accessor-parameters/is-member-access.js +0 -24
  55. package/dist/transforms/rename-safe-property-accessor-parameters/is-nullish-check.d.ts +0 -4
  56. package/dist/transforms/rename-safe-property-accessor-parameters/is-nullish-check.js +0 -74
  57. package/dist/transforms/rename-safe-property-accessor-parameters/manifest.json +0 -13
  58. package/dist/transforms/rename-safe-property-accessor-parameters/match-safe-property-accessor-factory.d.ts +0 -9
  59. package/dist/transforms/rename-safe-property-accessor-parameters/match-safe-property-accessor-factory.js +0 -44
  60. package/dist/transforms/rename-safe-property-accessor-parameters/rename-safe-property-accessor-parameters-transform.d.ts +0 -3
  61. package/dist/transforms/rename-safe-property-accessor-parameters/rename-safe-property-accessor-parameters-transform.js +0 -56
  62. package/dist/transforms/rename-safe-property-accessor-parameters/unwrap-parentheses.d.ts +0 -2
  63. package/dist/transforms/rename-safe-property-accessor-parameters/unwrap-parentheses.js +0 -7
  64. package/dist/transforms/rename-string-split-variables/get-split-helper-info.d.ts +0 -8
  65. package/dist/transforms/rename-string-split-variables/get-split-helper-info.js +0 -40
  66. package/dist/transforms/rename-string-split-variables/manifest.json +0 -14
  67. package/dist/transforms/rename-string-split-variables/rename-string-split-variables-transform.d.ts +0 -2
  68. package/dist/transforms/rename-string-split-variables/rename-string-split-variables-transform.js +0 -69
  69. package/dist/transforms/rename-string-split-variables/split-helper-declarations.d.ts +0 -11
  70. package/dist/transforms/rename-string-split-variables/split-helper-declarations.js +0 -80
  71. package/dist/transforms/rename-string-split-variables/split-helper-guards.d.ts +0 -8
  72. package/dist/transforms/rename-string-split-variables/split-helper-guards.js +0 -73
  73. package/dist/transforms/rename-string-split-variables/split-helper-loop.d.ts +0 -3
  74. package/dist/transforms/rename-string-split-variables/split-helper-loop.js +0 -116
  75. package/dist/transforms/rename-string-split-variables/split-helper-tail-expressions.d.ts +0 -3
  76. package/dist/transforms/rename-string-split-variables/split-helper-tail-expressions.js +0 -86
  77. package/dist/transforms/rename-string-split-variables/split-helper-tail-tests.d.ts +0 -4
  78. package/dist/transforms/rename-string-split-variables/split-helper-tail-tests.js +0 -39
  79. package/dist/transforms/rename-string-split-variables/split-helper-tail.d.ts +0 -3
  80. package/dist/transforms/rename-string-split-variables/split-helper-tail.js +0 -49
  81. package/dist/transforms/rename-timeout-duration-parameters/manifest.json +0 -20
  82. package/dist/transforms/rename-timeout-duration-parameters/rename-timeout-duration-parameters-transform.d.ts +0 -2
  83. package/dist/transforms/rename-timeout-duration-parameters/rename-timeout-duration-parameters-transform.js +0 -137
  84. package/dist/transforms/rename-use-reference-guards/get-member-expression-for-reference.d.ts +0 -3
  85. package/dist/transforms/rename-use-reference-guards/get-member-expression-for-reference.js +0 -10
  86. package/dist/transforms/rename-use-reference-guards/get-reference-usage.d.ts +0 -9
  87. package/dist/transforms/rename-use-reference-guards/get-reference-usage.js +0 -47
  88. package/dist/transforms/rename-use-reference-guards/is-use-reference-false-initializer.d.ts +0 -2
  89. package/dist/transforms/rename-use-reference-guards/is-use-reference-false-initializer.js +0 -25
  90. package/dist/transforms/rename-use-reference-guards/manifest.json +0 -21
  91. package/dist/transforms/rename-use-reference-guards/rename-use-reference-guards-transform.d.ts +0 -3
  92. package/dist/transforms/rename-use-reference-guards/rename-use-reference-guards-transform.js +0 -54
@@ -7,12 +7,6 @@ const manifestData = {
7
7
  notes: "Improves readability but does not reduce diffs (boolean literals are already deterministic)",
8
8
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T22:55:59.511Z", "changedLines": 35954, "durationSeconds": 60.354829125, "stableNames": 1357 } },
9
9
  },
10
- "expand-sequence-expressions-v4": {
11
- recommended: false,
12
- notes: "Measured with baseline none: -1.73%. Supersedes all prior sequence expression transforms. Superseded by expand-sequence-expressions-v5.",
13
- supersededBy: "expand-sequence-expressions-v5",
14
- evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 101.73583550667121, "evaluatedAt": "2026-01-25T22:57:17.477Z", "changedLines": 181675, "durationSeconds": 74.706709875, "stableNames": 1357 } },
15
- },
16
10
  "expand-sequence-expressions-v5": {
17
11
  recommended: true,
18
12
  notes: "Extends expand-sequence-expressions-v4 by also expanding `if ((a, b)) ...` style tests.",
@@ -76,12 +70,6 @@ const manifestData = {
76
70
  notes: "Measured with baseline none: 0.00%. Renames variables used in charCodeAt to improve readability.",
77
71
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:07:16.752Z", "changedLines": 1716, "durationSeconds": 65.4581855, "stableNames": 1362 } },
78
72
  },
79
- "rename-charcode-variables": {
80
- recommended: false,
81
- notes: "Superseded by rename-charcode-variables-v2.",
82
- supersededBy: "rename-charcode-variables-v2",
83
- evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:43:52.967Z", "changedLines": 308, "durationSeconds": 57.065185917, "stableNames": 1359 } },
84
- },
85
73
  "rename-charcode-variables-v2": {
86
74
  recommended: true,
87
75
  notes: "Derives names from charCodeAt argument for better stability (e.g., $charCodeAtIndex, $charCodeAtIndexPlus1).",
@@ -102,17 +90,6 @@ const manifestData = {
102
90
  notes: "Measured with baseline none: 0.00%. Added to recommended for readability.",
103
91
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.99622028196697, "evaluatedAt": "2026-01-25T23:12:36.102Z", "changedLines": 354, "durationSeconds": 62.624233667, "stableNames": 1362 } },
104
92
  },
105
- "rename-default-options-parameters": {
106
- recommended: false,
107
- notes: "Superseded by rename-default-options-parameters-v2.",
108
- supersededBy: "rename-default-options-parameters-v2",
109
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T19:51:46.527Z", "changedLines": 0, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:13:21.099Z", "changedLines": 0, "durationSeconds": 41.827803458, "stableNames": 1357 } },
110
- },
111
- "rename-default-options-parameters-v2": {
112
- recommended: false,
113
- supersededBy: "rename-default-options-parameters-v3",
114
- evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-06T12:59:48.597Z", "changedLines": 774, "durationSeconds": 235.023578515, "stableNames": 1358 } },
115
- },
116
93
  "rename-default-options-parameters-v3": {
117
94
  recommended: true,
118
95
  notes: "Renames defaulted and member-access-only parameters (not limited to semantic options objects) into stable options-style names. Skips files with dynamic name lookup (eval/with) to avoid unsafe renames.",
@@ -196,18 +173,6 @@ const manifestData = {
196
173
  notes: "Added to recommended for readability of invalidParameterError call sites.",
197
174
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.99811516350957, "evaluatedAt": "2026-02-06T12:52:02.935Z", "changedLines": 452, "durationSeconds": 211.048545671, "stableNames": 1381 } },
198
175
  },
199
- "rename-loop-index-variables": {
200
- recommended: false,
201
- notes: "Superseded by rename-loop-index-variables-v3.",
202
- supersededBy: "rename-loop-index-variables-v3",
203
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:02:28.948Z", "changedLines": 1462, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:19:33.960Z", "changedLines": 1462, "durationSeconds": 58.388688125, "stableNames": 1360 } },
204
- },
205
- "rename-loop-index-variables-v2": {
206
- recommended: false,
207
- notes: "Superseded by rename-loop-index-variables-v3.",
208
- supersededBy: "rename-loop-index-variables-v3",
209
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:03:25.815Z", "changedLines": 1522, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:20:34.890Z", "changedLines": 1522, "durationSeconds": 57.805667625000005, "stableNames": 1361 } },
210
- },
211
176
  "rename-loop-index-variables-v3": {
212
177
  recommended: true,
213
178
  notes: "Unifies rename-loop-index-variables and rename-loop-index-variables-v2 without modifying older transforms. Measured with baseline none: 0.00%.",
@@ -240,12 +205,6 @@ const manifestData = {
240
205
  notes: "Measured with baseline none: 2.11%. Added to recommended for readability.",
241
206
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 97.88709829422298, "evaluatedAt": "2026-02-05T19:24:46.607Z", "changedLines": 12500, "durationSeconds": 2175.358991208, "stableNames": 2608 } },
242
207
  },
243
- "rename-parameters-to-match-properties": {
244
- recommended: false,
245
- notes: "Superseded by rename-parameters-to-match-properties-v2.",
246
- supersededBy: "rename-parameters-to-match-properties-v2",
247
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:06:13.642Z", "changedLines": 15823, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 99.99622028196697 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.99622028196697, "evaluatedAt": "2026-01-25T23:23:32.785Z", "changedLines": 15823, "durationSeconds": 56.566717458, "stableNames": 1357 } },
248
- },
249
208
  "rename-parameters-to-match-properties-v2": {
250
209
  recommended: true,
251
210
  notes: "Extends v1 to also handle this.property = param assignments.",
@@ -264,12 +223,6 @@ const manifestData = {
264
223
  recommended: true,
265
224
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.9943454905287, "evaluatedAt": "2026-02-04T13:02:28.995Z", "changedLines": 462, "durationSeconds": 287.68950817700005, "stableNames": 1358 } },
266
225
  },
267
- "rename-promise-executor-parameters": {
268
- recommended: false,
269
- notes: "Superseded by rename-promise-executor-parameters-v2. Known issue: can produce incorrect output for duplicate parameter names in non-strict scripts (e.g. `function (a, a) {}`).",
270
- supersededBy: "rename-promise-executor-parameters-v2",
271
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:08:45.593Z", "changedLines": 970, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:26:26.589Z", "changedLines": 970, "durationSeconds": 63.099434166, "stableNames": 1359 } },
272
- },
273
226
  "rename-promise-executor-parameters-v2": {
274
227
  recommended: true,
275
228
  notes: "Supersedes rename-promise-executor-parameters with improved error-handler detection. Intentionally self-contained (helpers duplicated) per docs/workflow.md §3.6.",
@@ -311,11 +264,6 @@ const manifestData = {
311
264
  recommended: true,
312
265
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-06T17:36:36.948Z", "changedLines": 14, "durationSeconds": 177.13338240899998, "stableNames": 1358 } },
313
266
  },
314
- "rename-safe-property-accessor-parameters": {
315
- recommended: false,
316
- notes: "Negative diff reduction in evaluation; keep optional.",
317
- evaluations: { "legacy:evaluation": { "diffSizePercent": 100.00188483649043, "evaluatedAt": "2026-01-25T10:04:22.417Z", "changedLines": 0, "durationSeconds": 0, "stableNames": 0 } },
318
- },
319
267
  "rename-search-parameters-variables": {
320
268
  recommended: true,
321
269
  notes: "Measured with baseline none: 100.00% of original diff. Added to recommended for readability.",
@@ -326,12 +274,6 @@ const manifestData = {
326
274
  notes: "Added to recommended for readability.",
327
275
  evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-06T14:45:47.110Z", "changedLines": 44, "durationSeconds": 167.840422062, "stableNames": 1358 } },
328
276
  },
329
- "rename-string-split-variables": {
330
- recommended: false,
331
- notes: "Superseded by rename-string-split-variables-v2, which also handles direct split results.",
332
- supersededBy: "rename-string-split-variables-v2",
333
- evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-27T06:41:49.624Z", "changedLines": 0, "durationSeconds": 149.03264720899998, "stableNames": 1357 } },
334
- },
335
277
  "rename-string-split-variables-v2": {
336
278
  recommended: true,
337
279
  notes: "Extends manual split helper renames to include direct split results. v2 helper modules are intentionally self-contained to match the project convention for versioned transforms.",
@@ -342,11 +284,6 @@ const manifestData = {
342
284
  notes: "Measured with baseline none: 0.00%. Improves readability by stabilizing `this` aliases used for closures.",
343
285
  evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:11:56.982Z", "changedLines": 1382, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 99.99622028196697 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.99622028196697, "evaluatedAt": "2026-01-25T23:30:05.259Z", "changedLines": 1382, "durationSeconds": 52.602296167, "stableNames": 1358 } },
344
286
  },
345
- "rename-timeout-duration-parameters": {
346
- recommended: false,
347
- notes: "Negative diff reduction; leaving out of recommended preset.",
348
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:12:50.886Z", "changedLines": 140, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:30:58.631Z", "changedLines": 140, "durationSeconds": 50.385009084, "stableNames": 1358 } },
349
- },
350
287
  "rename-timeout-ids": {
351
288
  recommended: true,
352
289
  notes: "Measured with baseline none: 0.00%. Added to recommended for readability.",
@@ -354,7 +291,7 @@ const manifestData = {
354
291
  },
355
292
  "rename-timeout-promises": {
356
293
  recommended: true,
357
- evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-06T12:55:01.018Z", "changedLines": 20, "durationSeconds": 227.12862355299998, "stableNames": 1358 } },
294
+ evaluations: { "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-02-07T11:09:11.126Z", "changedLines": 20, "durationSeconds": 212.701923797, "stableNames": 1358 } },
358
295
  },
359
296
  "rename-to-buffer-results": {
360
297
  recommended: true,
@@ -383,12 +320,6 @@ const manifestData = {
383
320
  notes: "Measured with baseline none: 0.00%. Added to recommended for readability.",
384
321
  evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-25T20:17:07.056Z", "changedLines": 218, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 99.99811014098348 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 99.99811014098348, "evaluatedAt": "2026-01-25T23:36:02.620Z", "changedLines": 218, "durationSeconds": 61.699322542000004, "stableNames": 1359 } },
385
322
  },
386
- "rename-use-reference-guards": {
387
- recommended: false,
388
- notes: "Superseded by rename-use-reference-guards-v2.",
389
- supersededBy: "rename-use-reference-guards-v2",
390
- evaluations: { "legacy:evaluation": { "evaluatedAt": "2026-01-22T17:03:19.826Z", "changedLines": 0, "durationSeconds": 0, "stableNames": 0, "diffSizePercent": 100 }, "claude-code-2.1.10:claude-code-2.1.11": { "diffSizePercent": 100, "evaluatedAt": "2026-01-25T23:36:57.889Z", "changedLines": 0, "durationSeconds": 51.11069466599999, "stableNames": 1357 } },
391
- },
392
323
  "rename-use-reference-guards-v2": {
393
324
  recommended: true,
394
325
  notes: "Supersedes rename-use-reference-guards and also covers guards that reset to false.",
@@ -1,7 +1,6 @@
1
1
  // THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
2
2
  // Run `pnpm run build` to regenerate.
3
3
  import { expandBooleanLiteralsTransform } from "../expand-boolean-literals/expand-boolean-literals-transform.js";
4
- import { expandSequenceExpressionsV4Transform } from "../expand-sequence-expressions-v4/expand-sequence-expressions-v4-transform.js";
5
4
  import { expandSequenceExpressionsV5Transform } from "../expand-sequence-expressions-v5/expand-sequence-expressions-v5-transform.js";
6
5
  import { expandSpecialNumberLiteralsTransform } from "../expand-special-number-literals/expand-special-number-literals-transform.js";
7
6
  import { expandTypeofUndefinedComparisonsTransform } from "../expand-typeof-undefined-comparisons/expand-typeof-undefined-comparisons-transform.js";
@@ -15,13 +14,10 @@ import { renameAwaiterParametersTransform } from "../rename-awaiter-parameters/r
15
14
  import { renameBufferVariablesTransform } from "../rename-buffer-variables/rename-buffer-variables-transform.js";
16
15
  import { renameCatchParametersTransform } from "../rename-catch-parameters/rename-catch-parameters-transform.js";
17
16
  import { renameCharCodeAtTransform } from "../rename-char-code-at/rename-char-code-at-transform.js";
18
- import { renameCharcodeVariablesTransform } from "../rename-charcode-variables/rename-charcode-variables-transform.js";
19
17
  import { renameCharcodeVariablesV2Transform } from "../rename-charcode-variables-v2/rename-charcode-variables-v2-transform.js";
20
18
  import { renameClientAliasesTransform } from "../rename-client-aliases/rename-client-aliases-transform.js";
21
19
  import { renameComparisonFlagsTransform } from "../rename-comparison-flags/rename-comparison-flags-transform.js";
22
20
  import { renameDateNowStartTimesTransform } from "../rename-date-now-start-times/rename-date-now-start-times-transform.js";
23
- import { renameDefaultOptionsParametersTransform } from "../rename-default-options-parameters/rename-default-options-parameters-transform.js";
24
- import { renameDefaultOptionsParametersV2Transform } from "../rename-default-options-parameters-v2/rename-default-options-parameters-v2-transform.js";
25
21
  import { renameDefaultOptionsParametersV3Transform } from "../rename-default-options-parameters-v3/rename-default-options-parameters-v3-transform.js";
26
22
  import { renameDeferredResolveParametersTransform } from "../rename-deferred-resolve-parameters/rename-deferred-resolve-parameters-transform.js";
27
23
  import { renameDeferredResolveParametersV2Transform } from "../rename-deferred-resolve-parameters-v2/rename-deferred-resolve-parameters-v2-transform.js";
@@ -40,8 +36,6 @@ import { renameHttpServerParametersTransform } from "../rename-http-server-param
40
36
  import { renameIndexeddbRequestVariablesTransform } from "../rename-indexeddb-request-variables/rename-indexeddb-request-variables-transform.js";
41
37
  import { renameIntervalIdsTransform } from "../rename-interval-ids/rename-interval-ids-transform.js";
42
38
  import { renameInvalidParameterArgumentsTransform } from "../rename-invalid-parameter-arguments/rename-invalid-parameter-arguments-transform.js";
43
- import { renameLoopIndexVariablesTransform } from "../rename-loop-index-variables/rename-loop-index-variables-transform.js";
44
- import { renameLoopIndexVariablesV2Transform } from "../rename-loop-index-variables-v2/rename-loop-index-variables-v2-transform.js";
45
39
  import { renameLoopIndexVariablesV3Transform } from "../rename-loop-index-variables-v3/rename-loop-index-variables-v3-transform.js";
46
40
  import { renameLoopLengthVariablesTransform } from "../rename-loop-length-variables/rename-loop-length-variables-transform.js";
47
41
  import { renameObjectEntriesParametersTransform } from "../rename-object-entries-parameters/rename-object-entries-parameters-transform.js";
@@ -49,12 +43,10 @@ import { renameObjectKeysIteratorVariablesTransform } from "../rename-object-key
49
43
  import { renameObjectKeysReducerParametersTransform } from "../rename-object-keys-reducer-parameters/rename-object-keys-reducer-parameters-transform.js";
50
44
  import { renameObjectKeysVariablesTransform } from "../rename-object-keys-variables/rename-object-keys-variables-transform.js";
51
45
  import { renameObjectPropertyValueVariablesTransform } from "../rename-object-property-value-variables/rename-object-property-value-variables-transform.js";
52
- import { renameParametersToMatchPropertiesTransform } from "../rename-parameters-to-match-properties/rename-parameters-to-match-properties-transform.js";
53
46
  import { renameParametersToMatchPropertiesV2Transform } from "../rename-parameters-to-match-properties-v2/rename-parameters-to-match-properties-v2-transform.js";
54
47
  import { renamePlatformWin32FlagsTransform } from "../rename-platform-win32-flags/rename-platform-win32-flags-transform.js";
55
48
  import { renameProcessStdoutHandlersTransform } from "../rename-process-stdout-handlers/rename-process-stdout-handlers-transform.js";
56
49
  import { renamePromiseCatchParametersTransform } from "../rename-promise-catch-parameters/rename-promise-catch-parameters-transform.js";
57
- import { renamePromiseExecutorParametersTransform } from "../rename-promise-executor-parameters/rename-promise-executor-parameters-transform.js";
58
50
  import { renamePromiseExecutorParametersV2Transform } from "../rename-promise-executor-parameters-v2/rename-promise-executor-parameters-v2-transform.js";
59
51
  import { renameQueueTraversalVariablesTransform } from "../rename-queue-traversal-variables/rename-queue-traversal-variables-transform.js";
60
52
  import { renameRangeParametersTransform } from "../rename-range-parameters/rename-range-parameters-transform.js";
@@ -64,13 +56,10 @@ import { renameRegexSourceParametersTransform } from "../rename-regex-source-par
64
56
  import { renameReplaceChildParametersTransform } from "../rename-replace-child-parameters/rename-replace-child-parameters-transform.js";
65
57
  import { renameRestParametersTransform } from "../rename-rest-parameters/rename-rest-parameters-transform.js";
66
58
  import { renameRestPopCallbacksTransform } from "../rename-rest-pop-callbacks/rename-rest-pop-callbacks-transform.js";
67
- import { renameSafePropertyAccessorParametersTransform } from "../rename-safe-property-accessor-parameters/rename-safe-property-accessor-parameters-transform.js";
68
59
  import { renameSearchParametersVariablesTransform } from "../rename-search-parameters-variables/rename-search-parameters-variables-transform.js";
69
60
  import { renameSetstateUpdaterParametersTransform } from "../rename-setstate-updater-parameters/rename-setstate-updater-parameters-transform.js";
70
- import { renameStringSplitVariablesTransform } from "../rename-string-split-variables/rename-string-split-variables-transform.js";
71
61
  import { renameStringSplitVariablesV2Transform } from "../rename-string-split-variables-v2/rename-string-split-variables-v2-transform.js";
72
62
  import { renameThisAliasesTransform } from "../rename-this-aliases/rename-this-aliases-transform.js";
73
- import { renameTimeoutDurationParametersTransform } from "../rename-timeout-duration-parameters/rename-timeout-duration-parameters-transform.js";
74
63
  import { renameTimeoutIdsTransform } from "../rename-timeout-ids/rename-timeout-ids-transform.js";
75
64
  import { renameTimeoutPromisesTransform } from "../rename-timeout-promises/rename-timeout-promises-transform.js";
76
65
  import { renameToBufferResultsTransform } from "../rename-to-buffer-results/rename-to-buffer-results-transform.js";
@@ -79,7 +68,6 @@ import { renameTypescriptHelperAliasesTransform } from "../rename-typescript-hel
79
68
  import { renameUint8arrayConcatVariablesTransform } from "../rename-uint8array-concat-variables/rename-uint8array-concat-variables-transform.js";
80
69
  import { renameUrlParametersTransform } from "../rename-url-parameters/rename-url-parameters-transform.js";
81
70
  import { renameUrlVariablesTransform } from "../rename-url-variables/rename-url-variables-transform.js";
82
- import { renameUseReferenceGuardsTransform } from "../rename-use-reference-guards/rename-use-reference-guards-transform.js";
83
71
  import { renameUseReferenceGuardsV2Transform } from "../rename-use-reference-guards-v2/rename-use-reference-guards-v2-transform.js";
84
72
  import { renameUseReferenceSetsTransform } from "../rename-use-reference-sets/rename-use-reference-sets-transform.js";
85
73
  import { renameWorkerHandlesTransform } from "../rename-worker-handles/rename-worker-handles-transform.js";
@@ -97,7 +85,6 @@ import { useObjectShorthandTransform } from "../use-object-shorthand/use-object-
97
85
  import { useOptionalChainingTransform } from "../use-optional-chaining/use-optional-chaining-transform.js";
98
86
  export const transformRegistry = {
99
87
  [expandBooleanLiteralsTransform.id]: expandBooleanLiteralsTransform,
100
- [expandSequenceExpressionsV4Transform.id]: expandSequenceExpressionsV4Transform,
101
88
  [expandSequenceExpressionsV5Transform.id]: expandSequenceExpressionsV5Transform,
102
89
  [expandSpecialNumberLiteralsTransform.id]: expandSpecialNumberLiteralsTransform,
103
90
  [expandTypeofUndefinedComparisonsTransform.id]: expandTypeofUndefinedComparisonsTransform,
@@ -111,13 +98,10 @@ export const transformRegistry = {
111
98
  [renameBufferVariablesTransform.id]: renameBufferVariablesTransform,
112
99
  [renameCatchParametersTransform.id]: renameCatchParametersTransform,
113
100
  [renameCharCodeAtTransform.id]: renameCharCodeAtTransform,
114
- [renameCharcodeVariablesTransform.id]: renameCharcodeVariablesTransform,
115
101
  [renameCharcodeVariablesV2Transform.id]: renameCharcodeVariablesV2Transform,
116
102
  [renameClientAliasesTransform.id]: renameClientAliasesTransform,
117
103
  [renameComparisonFlagsTransform.id]: renameComparisonFlagsTransform,
118
104
  [renameDateNowStartTimesTransform.id]: renameDateNowStartTimesTransform,
119
- [renameDefaultOptionsParametersTransform.id]: renameDefaultOptionsParametersTransform,
120
- [renameDefaultOptionsParametersV2Transform.id]: renameDefaultOptionsParametersV2Transform,
121
105
  [renameDefaultOptionsParametersV3Transform.id]: renameDefaultOptionsParametersV3Transform,
122
106
  [renameDeferredResolveParametersTransform.id]: renameDeferredResolveParametersTransform,
123
107
  [renameDeferredResolveParametersV2Transform.id]: renameDeferredResolveParametersV2Transform,
@@ -136,8 +120,6 @@ export const transformRegistry = {
136
120
  [renameIndexeddbRequestVariablesTransform.id]: renameIndexeddbRequestVariablesTransform,
137
121
  [renameIntervalIdsTransform.id]: renameIntervalIdsTransform,
138
122
  [renameInvalidParameterArgumentsTransform.id]: renameInvalidParameterArgumentsTransform,
139
- [renameLoopIndexVariablesTransform.id]: renameLoopIndexVariablesTransform,
140
- [renameLoopIndexVariablesV2Transform.id]: renameLoopIndexVariablesV2Transform,
141
123
  [renameLoopIndexVariablesV3Transform.id]: renameLoopIndexVariablesV3Transform,
142
124
  [renameLoopLengthVariablesTransform.id]: renameLoopLengthVariablesTransform,
143
125
  [renameObjectEntriesParametersTransform.id]: renameObjectEntriesParametersTransform,
@@ -145,12 +127,10 @@ export const transformRegistry = {
145
127
  [renameObjectKeysReducerParametersTransform.id]: renameObjectKeysReducerParametersTransform,
146
128
  [renameObjectKeysVariablesTransform.id]: renameObjectKeysVariablesTransform,
147
129
  [renameObjectPropertyValueVariablesTransform.id]: renameObjectPropertyValueVariablesTransform,
148
- [renameParametersToMatchPropertiesTransform.id]: renameParametersToMatchPropertiesTransform,
149
130
  [renameParametersToMatchPropertiesV2Transform.id]: renameParametersToMatchPropertiesV2Transform,
150
131
  [renamePlatformWin32FlagsTransform.id]: renamePlatformWin32FlagsTransform,
151
132
  [renameProcessStdoutHandlersTransform.id]: renameProcessStdoutHandlersTransform,
152
133
  [renamePromiseCatchParametersTransform.id]: renamePromiseCatchParametersTransform,
153
- [renamePromiseExecutorParametersTransform.id]: renamePromiseExecutorParametersTransform,
154
134
  [renamePromiseExecutorParametersV2Transform.id]: renamePromiseExecutorParametersV2Transform,
155
135
  [renameQueueTraversalVariablesTransform.id]: renameQueueTraversalVariablesTransform,
156
136
  [renameRangeParametersTransform.id]: renameRangeParametersTransform,
@@ -160,13 +140,10 @@ export const transformRegistry = {
160
140
  [renameReplaceChildParametersTransform.id]: renameReplaceChildParametersTransform,
161
141
  [renameRestParametersTransform.id]: renameRestParametersTransform,
162
142
  [renameRestPopCallbacksTransform.id]: renameRestPopCallbacksTransform,
163
- [renameSafePropertyAccessorParametersTransform.id]: renameSafePropertyAccessorParametersTransform,
164
143
  [renameSearchParametersVariablesTransform.id]: renameSearchParametersVariablesTransform,
165
144
  [renameSetstateUpdaterParametersTransform.id]: renameSetstateUpdaterParametersTransform,
166
- [renameStringSplitVariablesTransform.id]: renameStringSplitVariablesTransform,
167
145
  [renameStringSplitVariablesV2Transform.id]: renameStringSplitVariablesV2Transform,
168
146
  [renameThisAliasesTransform.id]: renameThisAliasesTransform,
169
- [renameTimeoutDurationParametersTransform.id]: renameTimeoutDurationParametersTransform,
170
147
  [renameTimeoutIdsTransform.id]: renameTimeoutIdsTransform,
171
148
  [renameTimeoutPromisesTransform.id]: renameTimeoutPromisesTransform,
172
149
  [renameToBufferResultsTransform.id]: renameToBufferResultsTransform,
@@ -175,7 +152,6 @@ export const transformRegistry = {
175
152
  [renameUint8arrayConcatVariablesTransform.id]: renameUint8arrayConcatVariablesTransform,
176
153
  [renameUrlParametersTransform.id]: renameUrlParametersTransform,
177
154
  [renameUrlVariablesTransform.id]: renameUrlVariablesTransform,
178
- [renameUseReferenceGuardsTransform.id]: renameUseReferenceGuardsTransform,
179
155
  [renameUseReferenceGuardsV2Transform.id]: renameUseReferenceGuardsV2Transform,
180
156
  [renameUseReferenceSetsTransform.id]: renameUseReferenceSetsTransform,
181
157
  [renameWorkerHandlesTransform.id]: renameWorkerHandlesTransform,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "recommended": {
3
- "diffSizePercent": 26.497973800772783,
4
- "notes": "Measured with baseline none: 26.50% of original diff."
3
+ "diffSizePercent": 30.529727482329815,
4
+ "notes": "Measured with baseline none: 30.53% of original diff."
5
5
  }
6
6
  }
@@ -3,9 +3,9 @@
3
3
  "evaluations": {
4
4
  "claude-code-2.1.10:claude-code-2.1.11": {
5
5
  "diffSizePercent": 100,
6
- "evaluatedAt": "2026-02-06T12:55:01.018Z",
6
+ "evaluatedAt": "2026-02-07T11:09:11.126Z",
7
7
  "changedLines": 20,
8
- "durationSeconds": 227.12862355299998,
8
+ "durationSeconds": 212.701923797,
9
9
  "stableNames": 1358
10
10
  }
11
11
  }
@@ -40,23 +40,26 @@ const isDirectCallOfBinding = (referencePath, bindingName) => {
40
40
  return true;
41
41
  };
42
42
  const isReferenceWithinSetTimeoutCallback = (executorPath, referencePath) => {
43
- const callPath = referencePath.findParent((parent) => {
44
- if (!parent.isCallExpression())
45
- return false;
46
- if (!isSetTimeoutCall(parent))
47
- return false;
48
- const callbackPath = parent.get("arguments.0");
49
- if (!callbackPath.isFunctionExpression() &&
50
- !callbackPath.isArrowFunctionExpression()) {
51
- return false;
43
+ const functionParent = referencePath.getFunctionParent();
44
+ if (!functionParent)
45
+ return false;
46
+ let currentFunction = functionParent;
47
+ while (currentFunction.node !== executorPath.node) {
48
+ const parentPath = currentFunction.parentPath;
49
+ if (parentPath?.isCallExpression() && isSetTimeoutCall(parentPath)) {
50
+ const callbackPath = parentPath.get("arguments.0");
51
+ if ((callbackPath.isFunctionExpression() ||
52
+ callbackPath.isArrowFunctionExpression()) &&
53
+ callbackPath.node === currentFunction.node) {
54
+ return true;
55
+ }
52
56
  }
53
- if (parent.findParent((ancestor) => ancestor.node === executorPath.node) ===
54
- null) {
57
+ const outerFunction = currentFunction.getFunctionParent();
58
+ if (!outerFunction)
55
59
  return false;
56
- }
57
- return (referencePath.findParent((ancestor) => ancestor.node === callbackPath.node) !== null);
58
- });
59
- return Boolean(callPath);
60
+ currentFunction = outerFunction;
61
+ }
62
+ return false;
60
63
  };
61
64
  const getExecutorFunction = (path) => {
62
65
  const executorPath = path.get("arguments.0");
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.98.0",
5
+ "version": "1.98.1",
6
6
  "description": "Transform minified JavaScript/TypeScript into a more readable form using deterministic AST-based transforms.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -40,6 +40,7 @@
40
40
  "prepublishOnly": "pnpm run rebuild",
41
41
  "build": "node --experimental-strip-types scripts/generate-registry.ts && tsc -p tsconfig.app.json",
42
42
  "check": "pnpm -s run rebuild && node bin/miniread-evaluate -- --check",
43
+ "check:changed-lines-no-reduction": "node --experimental-strip-types scripts/check-changed-lines-no-reduction.ts",
43
44
  "clean": "rm -rf dist src/transforms/_generated *.tsbuildinfo",
44
45
  "format": "prettier --write .",
45
46
  "format:check": "prettier --check .",
@@ -1,3 +0,0 @@
1
- import type { NodePath } from "@babel/traverse";
2
- import type { ExpressionStatement } from "@babel/types";
3
- export declare const tryExpandExpressionStatementSequence: (path: NodePath<ExpressionStatement>) => boolean;
@@ -1,86 +0,0 @@
1
- import { createRequire } from "node:module";
2
- const require = createRequire(import.meta.url);
3
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
4
- const t = require("@babel/types");
5
- const canReplaceWithMultiple = (path) => path.parentPath.isProgram() ||
6
- path.parentPath.isBlockStatement() ||
7
- path.parentPath.isStaticBlock() ||
8
- path.parentPath.isSwitchCase();
9
- const canWrapInBlock = (path) => {
10
- const parentPath = path.parentPath;
11
- if (parentPath.isIfStatement() &&
12
- (path.key === "consequent" || path.key === "alternate")) {
13
- return true;
14
- }
15
- if ((parentPath.isForStatement() ||
16
- parentPath.isForInStatement() ||
17
- parentPath.isForOfStatement() ||
18
- parentPath.isWhileStatement() ||
19
- parentPath.isDoWhileStatement() ||
20
- parentPath.isWithStatement() ||
21
- parentPath.isLabeledStatement()) &&
22
- path.key === "body") {
23
- return true;
24
- }
25
- return false;
26
- };
27
- const isDirectiveProloguePosition = (path) => {
28
- const parentPath = path.parentPath;
29
- if (parentPath.isBlockStatement()) {
30
- const grandParent = parentPath.parentPath;
31
- if (parentPath.key !== "body")
32
- return false;
33
- if (!grandParent.isFunction())
34
- return false;
35
- }
36
- else if (!parentPath.isProgram()) {
37
- return false;
38
- }
39
- const siblings = parentPath.get("body");
40
- if (!Array.isArray(siblings))
41
- return false;
42
- const index = siblings.findIndex((sibling) => sibling.node === path.node);
43
- if (index === -1)
44
- return false;
45
- for (let bodyIndex = 0; bodyIndex < index; bodyIndex++) {
46
- const sibling = siblings[bodyIndex];
47
- if (!sibling)
48
- return false;
49
- if (!sibling.isExpressionStatement())
50
- return false;
51
- if (sibling.node.expression.type !== "StringLiteral")
52
- return false;
53
- }
54
- return true;
55
- };
56
- export const tryExpandExpressionStatementSequence = (path) => {
57
- if (!canReplaceWithMultiple(path) && !canWrapInBlock(path))
58
- return false;
59
- const expression = path.node.expression;
60
- if (expression.type !== "SequenceExpression")
61
- return false;
62
- if (expression.expressions.length < 2)
63
- return false;
64
- const firstExpression = expression.expressions[0];
65
- if (firstExpression?.type === "StringLiteral" &&
66
- canReplaceWithMultiple(path) &&
67
- isDirectiveProloguePosition(path)) {
68
- return false;
69
- }
70
- const statements = expression.expressions.map((expr) => {
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
72
- return t.expressionStatement(
73
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
74
- t.cloneNode(expr, true));
75
- });
76
- if (canReplaceWithMultiple(path)) {
77
- path.replaceWithMultiple(statements);
78
- return true;
79
- }
80
- if (canWrapInBlock(path)) {
81
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
82
- path.replaceWith(t.blockStatement(statements));
83
- return true;
84
- }
85
- return false;
86
- };
@@ -1,3 +0,0 @@
1
- import type { NodePath } from "@babel/traverse";
2
- import type { ReturnStatement } from "@babel/types";
3
- export declare const tryExpandReturnSequence: (path: NodePath<ReturnStatement>) => boolean;
@@ -1,91 +0,0 @@
1
- import { createRequire } from "node:module";
2
- const require = createRequire(import.meta.url);
3
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
4
- const t = require("@babel/types");
5
- const canReplaceWithMultiple = (path) => {
6
- return path.parentPath.isBlockStatement() || path.parentPath.isSwitchCase();
7
- };
8
- const canWrapInBlock = (path) => {
9
- const parentPath = path.parentPath;
10
- if (parentPath.isIfStatement() &&
11
- (path.key === "consequent" || path.key === "alternate")) {
12
- return true;
13
- }
14
- if ((parentPath.isForStatement() ||
15
- parentPath.isForInStatement() ||
16
- parentPath.isForOfStatement() ||
17
- parentPath.isWhileStatement() ||
18
- parentPath.isDoWhileStatement() ||
19
- parentPath.isWithStatement() ||
20
- parentPath.isLabeledStatement()) &&
21
- path.key === "body") {
22
- return true;
23
- }
24
- return false;
25
- };
26
- const replaceReturnWithStatements = (path, statements) => {
27
- if (canReplaceWithMultiple(path)) {
28
- path.replaceWithMultiple(statements);
29
- return true;
30
- }
31
- if (canWrapInBlock(path)) {
32
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
33
- path.replaceWith(t.blockStatement(statements));
34
- return true;
35
- }
36
- return false;
37
- };
38
- const isDirectiveProloguePosition = (path) => {
39
- if (!path.parentPath.isBlockStatement())
40
- return false;
41
- if (path.parentPath.key !== "body")
42
- return false;
43
- if (!path.parentPath.parentPath.isFunction())
44
- return false;
45
- const siblings = path.parentPath.get("body");
46
- if (!Array.isArray(siblings))
47
- return false;
48
- const index = siblings.findIndex((sibling) => sibling.node === path.node);
49
- if (index === -1)
50
- return false;
51
- for (let bodyIndex = 0; bodyIndex < index; bodyIndex++) {
52
- const sibling = siblings[bodyIndex];
53
- if (!sibling)
54
- return false;
55
- if (!sibling.isExpressionStatement())
56
- return false;
57
- if (sibling.node.expression.type !== "StringLiteral")
58
- return false;
59
- }
60
- return true;
61
- };
62
- export const tryExpandReturnSequence = (path) => {
63
- if (!canReplaceWithMultiple(path) && !canWrapInBlock(path))
64
- return false;
65
- const argument = path.node.argument;
66
- if (!argument)
67
- return false;
68
- if (argument.type !== "SequenceExpression")
69
- return false;
70
- if (argument.expressions.length < 2)
71
- return false;
72
- const leadingExpressions = argument.expressions.slice(0, -1);
73
- const lastExpression = argument.expressions.at(-1);
74
- if (!lastExpression)
75
- return false;
76
- const firstExpression = leadingExpressions[0];
77
- if (firstExpression?.type === "StringLiteral" &&
78
- isDirectiveProloguePosition(path)) {
79
- return false;
80
- }
81
- const statements = leadingExpressions.map((expression) => {
82
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
83
- return t.expressionStatement(
84
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
85
- t.cloneNode(expression, true));
86
- });
87
- statements.push(
88
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
89
- t.returnStatement(t.cloneNode(lastExpression, true)));
90
- return replaceReturnWithStatements(path, statements);
91
- };
@@ -1,2 +0,0 @@
1
- import type { Transform } from "../../core/types.js";
2
- export declare const expandSequenceExpressionsV4Transform: Transform;
@@ -1,48 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import { tryExpandExpressionStatementSequence } from "./expand-expression-statement-sequence.js";
3
- import { tryExpandReturnSequence } from "./expand-return-sequence.js";
4
- import { tryExpandThrowSequence } from "./expand-throw-sequence.js";
5
- import { tryExpandVariableDeclarationSequenceInitializers } from "./expand-variable-declaration-sequence.js";
6
- const require = createRequire(import.meta.url);
7
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
8
- const traverse = require("@babel/traverse").default;
9
- export const expandSequenceExpressionsV4Transform = {
10
- id: "expand-sequence-expressions-v4",
11
- description: "Expands comma operator sequences in returns, throws, statements (including control-flow bodies), and variable initializers",
12
- scope: "file",
13
- parallelizable: true,
14
- transform(context) {
15
- const { projectGraph } = context;
16
- let nodesVisited = 0;
17
- let transformationsApplied = 0;
18
- for (const [, fileInfo] of projectGraph.files) {
19
- traverse(fileInfo.ast, {
20
- ReturnStatement(path) {
21
- nodesVisited++;
22
- if (!tryExpandReturnSequence(path))
23
- return;
24
- transformationsApplied += 1;
25
- },
26
- ThrowStatement(path) {
27
- nodesVisited++;
28
- if (!tryExpandThrowSequence(path))
29
- return;
30
- transformationsApplied += 1;
31
- },
32
- ExpressionStatement(path) {
33
- nodesVisited++;
34
- if (!tryExpandExpressionStatementSequence(path))
35
- return;
36
- transformationsApplied += 1;
37
- },
38
- VariableDeclaration(path) {
39
- nodesVisited++;
40
- if (!tryExpandVariableDeclarationSequenceInitializers(path))
41
- return;
42
- transformationsApplied += 1;
43
- },
44
- });
45
- }
46
- return Promise.resolve({ nodesVisited, transformationsApplied });
47
- },
48
- };
@@ -1,3 +0,0 @@
1
- import type { NodePath } from "@babel/traverse";
2
- import type { ThrowStatement } from "@babel/types";
3
- export declare const tryExpandThrowSequence: (path: NodePath<ThrowStatement>) => boolean;