@openrewrite/recipes-nodejs 0.51.0 → 0.51.2

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 (140) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +16 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/migrate/angular-animations/remove-angular-animations-providers.js +7 -7
  5. package/dist/migrate/angular-animations/remove-angular-animations-providers.js.map +1 -1
  6. package/dist/migrate/express-request-id/migrate-express-request-id-to-native.d.ts.map +1 -1
  7. package/dist/migrate/express-request-id/migrate-express-request-id-to-native.js +3 -2
  8. package/dist/migrate/express-request-id/migrate-express-request-id-to-native.js.map +1 -1
  9. package/dist/migrate/express-request-id/remove-unused-express-request-id-dependency.d.ts +3 -6
  10. package/dist/migrate/express-request-id/remove-unused-express-request-id-dependency.d.ts.map +1 -1
  11. package/dist/migrate/express-request-id/remove-unused-express-request-id-dependency.js +5 -11
  12. package/dist/migrate/express-request-id/remove-unused-express-request-id-dependency.js.map +1 -1
  13. package/dist/migrate/find-aead-decipheriv-without-auth-tag-length.d.ts +9 -0
  14. package/dist/migrate/find-aead-decipheriv-without-auth-tag-length.d.ts.map +1 -0
  15. package/dist/migrate/find-aead-decipheriv-without-auth-tag-length.js +89 -0
  16. package/dist/migrate/find-aead-decipheriv-without-auth-tag-length.js.map +1 -0
  17. package/dist/migrate/find-crypto-default-encoding.d.ts +9 -0
  18. package/dist/migrate/find-crypto-default-encoding.d.ts.map +1 -0
  19. package/dist/migrate/find-crypto-default-encoding.js +61 -0
  20. package/dist/migrate/find-crypto-default-encoding.js.map +1 -0
  21. package/dist/migrate/find-duplex-to-web-type.d.ts +9 -0
  22. package/dist/migrate/find-duplex-to-web-type.d.ts.map +1 -0
  23. package/dist/migrate/find-duplex-to-web-type.js +86 -0
  24. package/dist/migrate/find-duplex-to-web-type.js.map +1 -0
  25. package/dist/migrate/find-module-register.d.ts +9 -0
  26. package/dist/migrate/find-module-register.d.ts.map +1 -0
  27. package/dist/migrate/find-module-register.js +50 -0
  28. package/dist/migrate/find-module-register.js.map +1 -0
  29. package/dist/migrate/find-process-assert.js +2 -2
  30. package/dist/migrate/find-process-assert.js.map +1 -1
  31. package/dist/migrate/fs-extra/migrate-fs-extra-to-node-fs.d.ts.map +1 -1
  32. package/dist/migrate/fs-extra/migrate-fs-extra-to-node-fs.js +4 -2
  33. package/dist/migrate/fs-extra/migrate-fs-extra-to-node-fs.js.map +1 -1
  34. package/dist/migrate/fs-extra/remove-unused-fs-extra-dependency.d.ts +4 -6
  35. package/dist/migrate/fs-extra/remove-unused-fs-extra-dependency.d.ts.map +1 -1
  36. package/dist/migrate/fs-extra/remove-unused-fs-extra-dependency.js +6 -14
  37. package/dist/migrate/fs-extra/remove-unused-fs-extra-dependency.js.map +1 -1
  38. package/dist/migrate/fs-extra/replace-fs-extra-native-methods.js +1 -1
  39. package/dist/migrate/fs-extra/replace-fs-extra-native-methods.js.map +1 -1
  40. package/dist/migrate/hpagent/migrate-hpagent-to-https-proxy-agent.d.ts.map +1 -1
  41. package/dist/migrate/hpagent/migrate-hpagent-to-https-proxy-agent.js +3 -7
  42. package/dist/migrate/hpagent/migrate-hpagent-to-https-proxy-agent.js.map +1 -1
  43. package/dist/migrate/hpagent/replace-hpagent.d.ts.map +1 -1
  44. package/dist/migrate/hpagent/replace-hpagent.js +68 -2
  45. package/dist/migrate/hpagent/replace-hpagent.js.map +1 -1
  46. package/dist/migrate/hpagent/swap-hpagent-dependency.d.ts +3 -15
  47. package/dist/migrate/hpagent/swap-hpagent-dependency.d.ts.map +1 -1
  48. package/dist/migrate/hpagent/swap-hpagent-dependency.js +11 -62
  49. package/dist/migrate/hpagent/swap-hpagent-dependency.js.map +1 -1
  50. package/dist/migrate/package-json-support.d.ts +6 -0
  51. package/dist/migrate/package-json-support.d.ts.map +1 -0
  52. package/dist/migrate/package-json-support.js +31 -0
  53. package/dist/migrate/package-json-support.js.map +1 -0
  54. package/dist/migrate/path/remove-path-dependency.js +8 -8
  55. package/dist/migrate/path/remove-path-dependency.js.map +1 -1
  56. package/dist/migrate/process-exit-code.js +3 -3
  57. package/dist/migrate/process-exit-code.js.map +1 -1
  58. package/dist/migrate/process-features-tls.js +1 -1
  59. package/dist/migrate/process-features-tls.js.map +1 -1
  60. package/dist/migrate/prop-types/remove-prop-types.js +8 -8
  61. package/dist/migrate/prop-types/remove-prop-types.js.map +1 -1
  62. package/dist/migrate/remove-dependencies.d.ts +6 -0
  63. package/dist/migrate/remove-dependencies.d.ts.map +1 -0
  64. package/dist/migrate/remove-dependencies.js +23 -0
  65. package/dist/migrate/remove-dependencies.js.map +1 -0
  66. package/dist/migrate/server-response-write-header.d.ts +9 -0
  67. package/dist/migrate/server-response-write-header.d.ts.map +1 -0
  68. package/dist/migrate/server-response-write-header.js +62 -0
  69. package/dist/migrate/server-response-write-header.js.map +1 -0
  70. package/dist/migrate/source-map-support/enable-source-maps-at-launch.d.ts +19 -0
  71. package/dist/migrate/source-map-support/enable-source-maps-at-launch.d.ts.map +1 -0
  72. package/dist/migrate/source-map-support/enable-source-maps-at-launch.js +311 -0
  73. package/dist/migrate/source-map-support/enable-source-maps-at-launch.js.map +1 -0
  74. package/dist/migrate/source-map-support/migrate-source-map-support-to-native.d.ts.map +1 -1
  75. package/dist/migrate/source-map-support/migrate-source-map-support-to-native.js +9 -4
  76. package/dist/migrate/source-map-support/migrate-source-map-support-to-native.js.map +1 -1
  77. package/dist/migrate/source-map-support/register-flag.d.ts +4 -0
  78. package/dist/migrate/source-map-support/register-flag.d.ts.map +1 -1
  79. package/dist/migrate/source-map-support/register-flag.js +35 -0
  80. package/dist/migrate/source-map-support/register-flag.js.map +1 -1
  81. package/dist/migrate/source-map-support/remove-unused-source-map-support-dependency.d.ts +3 -6
  82. package/dist/migrate/source-map-support/remove-unused-source-map-support-dependency.d.ts.map +1 -1
  83. package/dist/migrate/source-map-support/remove-unused-source-map-support-dependency.js +5 -12
  84. package/dist/migrate/source-map-support/remove-unused-source-map-support-dependency.js.map +1 -1
  85. package/dist/migrate/source-map-support/source-map-support-rewrites.d.ts.map +1 -1
  86. package/dist/migrate/source-map-support/source-map-support-rewrites.js +2 -0
  87. package/dist/migrate/source-map-support/source-map-support-rewrites.js.map +1 -1
  88. package/dist/migrate/upgrade-node-20.d.ts +8 -0
  89. package/dist/migrate/upgrade-node-20.d.ts.map +1 -0
  90. package/dist/migrate/upgrade-node-20.js +42 -0
  91. package/dist/migrate/upgrade-node-20.js.map +1 -0
  92. package/dist/migrate/upgrade-node-22.d.ts +1 -1
  93. package/dist/migrate/upgrade-node-22.d.ts.map +1 -1
  94. package/dist/migrate/upgrade-node-22.js +7 -5
  95. package/dist/migrate/upgrade-node-22.js.map +1 -1
  96. package/dist/migrate/upgrade-node-24.d.ts.map +1 -1
  97. package/dist/migrate/upgrade-node-24.js +2 -0
  98. package/dist/migrate/upgrade-node-24.js.map +1 -1
  99. package/dist/migrate/upgrade-node-26.d.ts +8 -0
  100. package/dist/migrate/upgrade-node-26.d.ts.map +1 -0
  101. package/dist/migrate/upgrade-node-26.js +53 -0
  102. package/dist/migrate/upgrade-node-26.js.map +1 -0
  103. package/dist/resources/advisories-npm.csv +278 -20
  104. package/package.json +2 -2
  105. package/src/index.ts +16 -0
  106. package/src/migrate/angular-animations/remove-angular-animations-providers.ts +1 -1
  107. package/src/migrate/express-request-id/migrate-express-request-id-to-native.ts +3 -2
  108. package/src/migrate/express-request-id/remove-unused-express-request-id-dependency.ts +5 -13
  109. package/src/migrate/find-aead-decipheriv-without-auth-tag-length.ts +76 -0
  110. package/src/migrate/find-crypto-default-encoding.ts +47 -0
  111. package/src/migrate/find-duplex-to-web-type.ts +71 -0
  112. package/src/migrate/find-module-register.ts +36 -0
  113. package/src/migrate/find-process-assert.ts +2 -2
  114. package/src/migrate/fs-extra/migrate-fs-extra-to-node-fs.ts +4 -2
  115. package/src/migrate/fs-extra/remove-unused-fs-extra-dependency.ts +6 -16
  116. package/src/migrate/fs-extra/replace-fs-extra-native-methods.ts +1 -1
  117. package/src/migrate/hpagent/migrate-hpagent-to-https-proxy-agent.ts +3 -7
  118. package/src/migrate/hpagent/replace-hpagent.ts +82 -3
  119. package/src/migrate/hpagent/swap-hpagent-dependency.ts +13 -68
  120. package/src/migrate/package-json-support.ts +34 -0
  121. package/src/migrate/path/remove-path-dependency.ts +1 -1
  122. package/src/migrate/process-exit-code.ts +3 -3
  123. package/src/migrate/process-features-tls.ts +1 -1
  124. package/src/migrate/prop-types/remove-prop-types.ts +1 -1
  125. package/src/migrate/remove-dependencies.ts +21 -0
  126. package/src/migrate/server-response-write-header.ts +51 -0
  127. package/src/migrate/source-map-support/enable-source-maps-at-launch.ts +289 -0
  128. package/src/migrate/source-map-support/migrate-source-map-support-to-native.ts +9 -4
  129. package/src/migrate/source-map-support/register-flag.ts +48 -0
  130. package/src/migrate/source-map-support/remove-unused-source-map-support-dependency.ts +5 -14
  131. package/src/migrate/source-map-support/source-map-support-rewrites.ts +3 -0
  132. package/src/migrate/upgrade-node-20.ts +32 -0
  133. package/src/migrate/upgrade-node-22.ts +8 -6
  134. package/src/migrate/upgrade-node-24.ts +2 -0
  135. package/src/migrate/upgrade-node-26.ts +45 -0
  136. package/dist/migrate/remove-unused-dependency.d.ts +0 -43
  137. package/dist/migrate/remove-unused-dependency.d.ts.map +0 -1
  138. package/dist/migrate/remove-unused-dependency.js +0 -257
  139. package/dist/migrate/remove-unused-dependency.js.map +0 -1
  140. package/src/migrate/remove-unused-dependency.ts +0 -275
@@ -4,23 +4,14 @@
4
4
  * Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
5
5
  */
6
6
 
7
- import {Recipe} from "@openrewrite/rewrite";
8
- import {RemoveUnusedDependency} from "../remove-unused-dependency";
9
- import {sourceMapSupportRewriteRecipes} from "./source-map-support-rewrites";
7
+ import {RemoveDependencies} from "../remove-dependencies";
10
8
 
11
- export class RemoveUnusedSourceMapSupportDependency extends RemoveUnusedDependency {
9
+ export class RemoveUnusedSourceMapSupportDependency extends RemoveDependencies {
12
10
  readonly name = "org.openrewrite.node.migrate.source-map-support.remove-unused-source-map-support-dependency";
13
- readonly displayName = "Remove unused `source-map-support` dependency";
14
- readonly description = "Removes `source-map-support` and `@types/source-map-support` from each `package.json` whose " +
15
- "package no longer references it from a JavaScript or TypeScript source, a `package.json` script or tool " +
16
- "configuration, or a `.mocharc`/`mocha.opts` file. A webpack banner that injects `require(\"source-map-support\")` " +
17
- "into a bundle counts as a use. Lock files are not regenerated; run the package manager's install afterwards.";
11
+ readonly displayName = "Remove the `source-map-support` dependency";
12
+ readonly description = "Removes `source-map-support` and `@types/source-map-support` from each `package.json` " +
13
+ "that declares them, and updates the lock file to match.";
18
14
  readonly tags = ["source-map-support"];
19
15
 
20
- protected readonly module = 'source-map-support';
21
16
  protected readonly packages = ['source-map-support', '@types/source-map-support'];
22
-
23
- protected migrationRecipes(): Recipe[] {
24
- return sourceMapSupportRewriteRecipes();
25
- }
26
17
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import {Recipe} from "@openrewrite/rewrite";
8
+ import {EnableSourceMapsAtLaunch} from "./enable-source-maps-at-launch";
8
9
  import {ReplaceSourceMapSupportInstall} from "./replace-source-map-support-install";
9
10
  import {ReplaceSourceMapSupportRegisterInPackageJson} from "./replace-source-map-support-register-in-package-json";
10
11
  import {ReplaceSourceMapSupportRegisterInMochaConfig} from "./replace-source-map-support-register-in-mocha-config";
@@ -15,5 +16,7 @@ export function sourceMapSupportRewriteRecipes(): Recipe[] {
15
16
  new ReplaceSourceMapSupportRegisterInPackageJson(),
16
17
  new ReplaceSourceMapSupportRegisterInMochaConfig(),
17
18
  new ReplaceSourceMapSupportInstall(),
19
+ // Last of the rewrites: it takes the entry points the in-place rewrite turned down.
20
+ new EnableSourceMapsAtLaunch(),
18
21
  ];
19
22
  }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright 2026 the original author or authors.
3
+ *
4
+ * Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
5
+ */
6
+ import {Recipe} from "@openrewrite/rewrite";
7
+ import {prepareJavaRecipe} from "@openrewrite/rewrite/rpc";
8
+ import {AvoidImplicitCoercionOfExitCode} from "./process-exit-code";
9
+ import {FindCryptoDefaultEncoding} from "./find-crypto-default-encoding";
10
+ import {IncreaseNodeEngineVersion} from "./increase-node-engine-version";
11
+ import {IncreaseNodeEngineVersionInGithubActions} from "./increase-node-engine-version-in-github-actions";
12
+
13
+ // Node 20 End-of-Life deprecations
14
+ const node20EolDeprecations: Recipe[] = [
15
+ new AvoidImplicitCoercionOfExitCode(), // DEP0164: process.exit(code) (v20 EOL)
16
+ new FindCryptoDefaultEncoding(), // DEP0091: crypto.DEFAULT_ENCODING (v20 EOL)
17
+ ];
18
+
19
+ export class UpgradeNode20 extends Recipe {
20
+ readonly name = "org.openrewrite.node.migrate.upgrade-node-20";
21
+ readonly displayName = "Upgrade to Node.js 20";
22
+ readonly description = "Migrate deprecated APIs for Node.js 20 compatibility. Addresses deprecations that are end-of-life in Node 20.";
23
+
24
+ async recipeList(): Promise<Recipe[]> {
25
+ return [
26
+ new IncreaseNodeEngineVersion({version: "20"}),
27
+ new IncreaseNodeEngineVersionInGithubActions({version: "20"}),
28
+ await prepareJavaRecipe("org.openrewrite.nodejs.migrate.UpgradeNodeVersion", {version: "20"}),
29
+ ...node20EolDeprecations,
30
+ ];
31
+ }
32
+ }
@@ -4,6 +4,7 @@
4
4
  * Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
5
5
  */
6
6
  import {Recipe} from "@openrewrite/rewrite";
7
+ import {prepareJavaRecipe} from "@openrewrite/rewrite/rpc";
7
8
  import {RemovePromisifyOnPromise} from "./promisify-on-promise";
8
9
  import {ReplaceIsWebAssemblyCompiledModule} from "./util-types-wasm";
9
10
  import {ReplaceCryptoConstructors} from "./crypto-constructors";
@@ -11,7 +12,7 @@ import {RemoveUsageOfProcessFeaturesTlsConstants} from "./process-features-tls";
11
12
  import {UseNativeTypeCheckingMethods} from "./util-type-checking";
12
13
  import {ReplaceUtilExtend} from "./util-extend";
13
14
  import {ReplaceDeprecatedBufferSlice} from "./buffer-slice";
14
- import {AvoidImplicitCoercionOfExitCode} from "./process-exit-code";
15
+ import {UpgradeNode20} from "./upgrade-node-20";
15
16
  import {IncreaseNodeEngineVersion} from "./increase-node-engine-version";
16
17
  import {IncreaseNodeEngineVersionInGithubActions} from "./increase-node-engine-version-in-github-actions";
17
18
  import {FindPunycodeUsage} from "./find-punycode-usage";
@@ -31,9 +32,8 @@ const node22RuntimeDeprecations: Recipe[] = [
31
32
  new ReplaceCryptoConstructors(), // DEP0179, DEP0181: Hash/Hmac constructors
32
33
  ];
33
34
 
34
- // Deprecations from earlier versions (incl. EOL before v22)
35
- const olderDeprecations: Recipe[] = [
36
- new AvoidImplicitCoercionOfExitCode(), // DEP0164: process.exit(code) (v20 EOL)
35
+ // Doc-only deprecations (no fixed EOL version) bundled with the v22 upgrade
36
+ const docOnlyDeprecations: Recipe[] = [
37
37
  new ReplaceDeprecatedBufferSlice(), // DEP0158: buffer.slice (doc-only)
38
38
  new RemoveUsageOfProcessFeaturesTlsConstants(), // DEP0189: process.features.tls_* (doc-only)
39
39
  new RemovePromisifyOnPromise(), // DEP0174: promisify on promise (doc-only)
@@ -42,15 +42,17 @@ const olderDeprecations: Recipe[] = [
42
42
  export class UpgradeNode22 extends Recipe {
43
43
  readonly name = "org.openrewrite.node.migrate.upgrade-node-22";
44
44
  readonly displayName = "Upgrade to Node.js 22";
45
- readonly description = "Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions.";
45
+ readonly description = "Migrate deprecated APIs for Node.js 22 compatibility. Includes all migrations from Node.js 20, plus Node 21 and Node 22 deprecations.";
46
46
 
47
47
  async recipeList(): Promise<Recipe[]> {
48
48
  return [
49
49
  new IncreaseNodeEngineVersion({version: "22"}),
50
50
  new IncreaseNodeEngineVersionInGithubActions({version: "22"}),
51
+ await prepareJavaRecipe("org.openrewrite.nodejs.migrate.UpgradeNodeVersion", {version: "22"}),
52
+ new UpgradeNode20(),
51
53
  ...node22EolDeprecations,
52
54
  ...node22RuntimeDeprecations,
53
- ...olderDeprecations,
55
+ ...docOnlyDeprecations,
54
56
  ];
55
57
  }
56
58
  }
@@ -4,6 +4,7 @@
4
4
  * Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
5
5
  */
6
6
  import {Recipe} from "@openrewrite/rewrite";
7
+ import {prepareJavaRecipe} from "@openrewrite/rewrite/rpc";
7
8
  import {ReplaceUtilLog} from "./util-log";
8
9
  import {ReplaceZlibBytesRead} from "./zlib-bytes-read";
9
10
  import {ReplaceCryptoFips} from "./crypto-fips";
@@ -43,6 +44,7 @@ export class UpgradeNode24 extends Recipe {
43
44
  return [
44
45
  new IncreaseNodeEngineVersion({version: "24"}),
45
46
  new IncreaseNodeEngineVersionInGithubActions({version: "24"}),
47
+ await prepareJavaRecipe("org.openrewrite.nodejs.migrate.UpgradeNodeVersion", {version: "24"}),
46
48
  new UpgradeNode22(),
47
49
  ...node24EolDeprecations,
48
50
  ...node24RuntimeDeprecations,
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright 2026 the original author or authors.
3
+ *
4
+ * Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
5
+ */
6
+ import {Recipe} from "@openrewrite/rewrite";
7
+ import {prepareJavaRecipe} from "@openrewrite/rewrite/rpc";
8
+ import {UpgradeNode24} from "./upgrade-node-24";
9
+ import {IncreaseNodeEngineVersion} from "./increase-node-engine-version";
10
+ import {IncreaseNodeEngineVersionInGithubActions} from "./increase-node-engine-version-in-github-actions";
11
+ import {ReplaceStreamInternalModules} from "./stream-internal-modules";
12
+ import {ReplaceServerResponseWriteHeader} from "./server-response-write-header";
13
+ import {FindAeadDecipherivWithoutAuthTagLength} from "./find-aead-decipheriv-without-auth-tag-length";
14
+ import {FindDuplexToWebType} from "./find-duplex-to-web-type";
15
+ import {FindModuleRegister} from "./find-module-register";
16
+
17
+ // Node 26 End-of-Life deprecations (fully removed in v26)
18
+ const node26EolDeprecations: Recipe[] = [
19
+ new ReplaceServerResponseWriteHeader(), // DEP0063: ServerResponse.writeHeader() (v26 EOL)
20
+ new ReplaceStreamInternalModules(), // DEP0125: legacy _stream_* modules (v26 EOL)
21
+ new FindAeadDecipherivWithoutAuthTagLength(), // DEP0182: short GCM auth tags (v26 EOL)
22
+ ];
23
+
24
+ // Node 26 Runtime deprecations
25
+ const node26RuntimeDeprecations: Recipe[] = [
26
+ new FindDuplexToWebType(), // DEP0201: Duplex.toWeb options.type
27
+ new FindModuleRegister(), // DEP0205: module.register()
28
+ ];
29
+
30
+ export class UpgradeNode26 extends Recipe {
31
+ readonly name = "org.openrewrite.node.migrate.upgrade-node-26";
32
+ readonly displayName = "Upgrade to Node.js 26";
33
+ readonly description = "Migrate deprecated APIs for Node.js 26 compatibility. Includes all migrations from Node.js 24, plus Node 25 and Node 26 deprecations.";
34
+
35
+ async recipeList(): Promise<Recipe[]> {
36
+ return [
37
+ new IncreaseNodeEngineVersion({version: "26"}),
38
+ new IncreaseNodeEngineVersionInGithubActions({version: "26"}),
39
+ await prepareJavaRecipe("org.openrewrite.nodejs.migrate.UpgradeNodeVersion", {version: "26"}),
40
+ new UpgradeNode24(),
41
+ ...node26EolDeprecations,
42
+ ...node26RuntimeDeprecations,
43
+ ];
44
+ }
45
+ }
@@ -1,43 +0,0 @@
1
- import { DataTable, ExecutionContext, Recipe, ScanningRecipe, TreeVisitor } from "@openrewrite/rewrite";
2
- import { Json } from "@openrewrite/rewrite/json";
3
- interface Accumulator {
4
- referencingFiles: string[];
5
- parsedFiles: string[];
6
- replacementFiles: string[];
7
- }
8
- export declare class DependencyKept {
9
- sourcePath: string;
10
- recipe: string;
11
- package: string;
12
- reason: string;
13
- evidence: string;
14
- }
15
- export declare function dependenciesKept(): DataTable<DependencyKept>;
16
- export declare const KEPT_REASONS: {
17
- projen: (module: string) => string;
18
- referenced: (module: string) => string;
19
- unparsed: string;
20
- };
21
- export declare function dirOf(path: string): string;
22
- export declare function isPackageJson(path: string): boolean;
23
- export declare function anyBeneath(dir: string, files: string[]): boolean;
24
- export declare function removeMembers(obj: Json.Object, keys: Set<string>): Json.Object;
25
- export declare abstract class RemoveUnusedDependency extends ScanningRecipe<Accumulator> {
26
- protected abstract readonly module: string;
27
- protected abstract readonly packages: string[];
28
- protected abstract migrationRecipes(): Recipe[];
29
- protected replacementModules(): string[];
30
- private readonly kept;
31
- protected mockFile(): RegExp;
32
- private readonly precedingRecipes;
33
- accountForMigration?: boolean;
34
- constructor(options?: {
35
- precedingRecipes?: Recipe[];
36
- accountForMigration?: boolean;
37
- });
38
- initialValue(_ctx: ExecutionContext): Accumulator;
39
- scanner(acc: Accumulator): Promise<TreeVisitor<any, ExecutionContext>>;
40
- editorWithData(acc: Accumulator): Promise<TreeVisitor<any, ExecutionContext>>;
41
- }
42
- export {};
43
- //# sourceMappingURL=remove-unused-dependency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove-unused-dependency.d.ts","sourceRoot":"","sources":["../../src/migrate/remove-unused-dependency.ts"],"names":[],"mappings":"AAMA,OAAO,EAAS,SAAS,EAAgB,gBAAgB,EAAoB,MAAM,EAAE,cAAc,EAAkC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAC9K,OAAO,EAAuC,IAAI,EAAkC,MAAM,2BAA2B,CAAC;AAkBtH,UAAU,WAAW;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,qBAAa,cAAc;IAEvB,UAAU,EAAG,MAAM,CAAC;IAGpB,MAAM,EAAG,MAAM,CAAC;IAGhB,OAAO,EAAG,MAAM,CAAC;IAGjB,MAAM,EAAG,MAAM,CAAC;IAGhB,QAAQ,EAAG,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB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AAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CA0CtF"}
@@ -1,257 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
- return new (P || (P = Promise))(function (resolve, reject) {
11
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
- step((generator = generator.apply(thisArg, _arguments || [])).next());
15
- });
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.RemoveUnusedDependency = exports.KEPT_REASONS = exports.DependencyKept = void 0;
19
- exports.dependenciesKept = dependenciesKept;
20
- exports.dirOf = dirOf;
21
- exports.isPackageJson = isPackageJson;
22
- exports.anyBeneath = anyBeneath;
23
- exports.removeMembers = removeMembers;
24
- const rewrite_1 = require("@openrewrite/rewrite");
25
- const json_1 = require("@openrewrite/rewrite/json");
26
- const javascript_1 = require("@openrewrite/rewrite/javascript");
27
- const text_1 = require("@openrewrite/rewrite/text");
28
- const SECTIONS = new Set(['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']);
29
- const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
30
- const CONFIG_FILE = /(^|\/)(package\.json|mocha\.opts|\.mocharc(\.[a-z]+)?|[^/]+\.(json|ya?ml))$/;
31
- const DOCUMENT = /(\.(md|markdown|mdx|txt|rst|adoc|svg|log|csv|map)|(^|\/)(LICENSE|LICENCE|CHANGELOG|CHANGES|HISTORY|README|AUTHORS|NOTICE)[^/]*|(^|\/)\.(cursor|windsurf|cline)rules)$/i;
32
- const LOCK_FILE = /(^|\/)(package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?)$/;
33
- const DECLARATIONS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies',
34
- 'peerDependenciesMeta', 'bundledDependencies', 'bundleDependencies', 'overrides', 'resolutions', 'pnpm'];
35
- const PARSE_ERROR = "org.openrewrite.tree.ParseError";
36
- const PROJEN_DEPS = /(^|\/)\.projen\/deps\.json$/;
37
- class DependencyKept {
38
- }
39
- exports.DependencyKept = DependencyKept;
40
- __decorate([
41
- (0, rewrite_1.Column)({ displayName: "Source path", description: "Path of the `package.json` still declaring the package." })
42
- ], DependencyKept.prototype, "sourcePath", void 0);
43
- __decorate([
44
- (0, rewrite_1.Column)({ displayName: "Recipe", description: "Recipe that left the declaration in place." })
45
- ], DependencyKept.prototype, "recipe", void 0);
46
- __decorate([
47
- (0, rewrite_1.Column)({ displayName: "Package", description: "The package that was not removed, e.g. `fs-extra`." })
48
- ], DependencyKept.prototype, "package", void 0);
49
- __decorate([
50
- (0, rewrite_1.Column)({ displayName: "Reason", description: "Why the declaration couldn't be removed." })
51
- ], DependencyKept.prototype, "reason", void 0);
52
- __decorate([
53
- (0, rewrite_1.Column)({ displayName: "Evidence", description: "Files that kept it, up to the first few." })
54
- ], DependencyKept.prototype, "evidence", void 0);
55
- function dependenciesKept() {
56
- return new rewrite_1.DataTable("org.openrewrite.node.table.DependenciesKept", "Dependencies kept", "Packages the migration could not remove from a `package.json`, and what kept them.", DependencyKept);
57
- }
58
- exports.KEPT_REASONS = {
59
- projen: (module) => `This package's dependencies are generated by projen: \`.projen/deps.json\` still ` +
60
- `lists \`${module}\`, and nothing else beneath this \`package.json\` references it. Editing \`package.json\` ` +
61
- "here would be undone by the next `npx projen`, so it is left alone. Remove the entry from `.projenrc.ts` " +
62
- "(the arrays passed to the projen project, where it reads as `'" + module + "@<range>'`) and re-run projen.",
63
- referenced: (module) => `\`${module}\` is still referenced beneath this \`package.json\` once the ` +
64
- "migration has run — a usage it left in place, a test mock, or tool configuration naming the module. The " +
65
- "library's own find recipe reports each site.",
66
- unparsed: "No source beneath this `package.json` was parsed, so there is nothing to judge usage by. A JavaScript " +
67
- "parse failure or an unbuilt LST leaves the declaration alone rather than guessing.",
68
- };
69
- function dirOf(path) {
70
- const i = path.lastIndexOf('/');
71
- return i < 0 ? '' : path.substring(0, i);
72
- }
73
- function isPackageJson(path) {
74
- return (path === 'package.json' || path.endsWith('/package.json')) && !path.includes('node_modules/');
75
- }
76
- function anyBeneath(dir, files) {
77
- return files.some(file => dir === '' || file.startsWith(dir + '/'));
78
- }
79
- function withoutDeclarations(packageJson) {
80
- try {
81
- const parsed = JSON.parse(packageJson);
82
- for (const section of DECLARATIONS)
83
- delete parsed[section];
84
- return JSON.stringify(parsed);
85
- }
86
- catch (_a) {
87
- return packageJson;
88
- }
89
- }
90
- function escapeRegExp(s) {
91
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
92
- }
93
- function removeMembers(obj, keys) {
94
- const kept = obj.members.filter(rp => { var _a; return !((0, json_1.isMember)(rp.element) && keys.has((_a = (0, json_1.getMemberKeyName)(rp.element)) !== null && _a !== void 0 ? _a : '')); });
95
- if (kept.length === obj.members.length)
96
- return obj;
97
- if (kept.length === 0) {
98
- const empty = { kind: json_1.Json.Kind.Empty, id: (0, rewrite_1.randomId)(), prefix: (0, json_1.space)(''), markers: rewrite_1.emptyMarkers };
99
- return Object.assign(Object.assign({}, obj), { members: [(0, json_1.rightPadded)(empty, (0, json_1.space)(''))] });
100
- }
101
- const closing = obj.members[obj.members.length - 1].after;
102
- kept[kept.length - 1] = Object.assign(Object.assign({}, kept[kept.length - 1]), { after: closing });
103
- return Object.assign(Object.assign({}, obj), { members: kept });
104
- }
105
- function declaredPackages(root, packages) {
106
- var _a, _b;
107
- const found = [];
108
- for (const rp of root.members) {
109
- if (!(0, json_1.isMember)(rp.element))
110
- continue;
111
- const member = rp.element;
112
- if (!SECTIONS.has((_a = (0, json_1.getMemberKeyName)(member)) !== null && _a !== void 0 ? _a : '') || !(0, json_1.isObject)(member.value))
113
- continue;
114
- for (const entry of member.value.members) {
115
- if (!(0, json_1.isMember)(entry.element))
116
- continue;
117
- const name = (_b = (0, json_1.getMemberKeyName)(entry.element)) !== null && _b !== void 0 ? _b : '';
118
- if (packages.has(name) && !found.includes(name))
119
- found.push(name);
120
- }
121
- }
122
- return found;
123
- }
124
- function editingRecipes(recipes) {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- const flat = [];
127
- for (const r of recipes) {
128
- if (!(r instanceof rewrite_1.ScanningRecipe))
129
- flat.push(r);
130
- flat.push(...yield editingRecipes(yield r.recipeList()));
131
- }
132
- return flat;
133
- });
134
- }
135
- class RemoveUnusedDependency extends rewrite_1.ScanningRecipe {
136
- replacementModules() {
137
- return [];
138
- }
139
- mockFile() {
140
- return new RegExp(`(^|/)__mocks__/${escapeRegExp(this.module)}\\.[cm]?[jt]sx?$`);
141
- }
142
- constructor(options) {
143
- var _a;
144
- super({ accountForMigration: options === null || options === void 0 ? void 0 : options.accountForMigration });
145
- this.kept = dependenciesKept();
146
- this.precedingRecipes = (_a = options === null || options === void 0 ? void 0 : options.precedingRecipes) !== null && _a !== void 0 ? _a : [];
147
- }
148
- initialValue(_ctx) {
149
- return { referencingFiles: [], parsedFiles: [], replacementFiles: [] };
150
- }
151
- scanner(acc) {
152
- return __awaiter(this, void 0, void 0, function* () {
153
- const preceding = yield editingRecipes(this.accountForMigration ? this.migrationRecipes() : this.precedingRecipes);
154
- const reference = new RegExp(`['"\`]${escapeRegExp(this.module)}(/[^'"\`]*)?['"\`]`);
155
- const configReference = new RegExp(`(^|[\\s'"\`=,:(\\[/])${escapeRegExp(this.module)}(?=[/'"\`\\s,)\\]]|$)`, 'm');
156
- const mockFile = this.mockFile();
157
- const replacements = this.replacementModules();
158
- const replacementReference = replacements.length === 0 ? undefined
159
- : new RegExp(`['"\`](?:${replacements.map(escapeRegExp).join('|')})(/[^'"\`]*)?['"\`]`);
160
- return new class extends rewrite_1.TreeVisitor {
161
- accept(tree, ctx) {
162
- return __awaiter(this, void 0, void 0, function* () {
163
- var _a;
164
- const sourcePath = tree.sourcePath;
165
- if (!sourcePath)
166
- return tree;
167
- if (tree.kind === PARSE_ERROR && SOURCE_FILE.test(sourcePath)) {
168
- acc.referencingFiles.push(sourcePath);
169
- }
170
- else if (tree.kind === javascript_1.JS.Kind.CompilationUnit || (!LOCK_FILE.test(sourcePath) && !sourcePath.includes('node_modules/') &&
171
- (CONFIG_FILE.test(sourcePath) || (tree.kind === text_1.PlainText.Kind.PlainText && !DOCUMENT.test(sourcePath))))) {
172
- const isSource = tree.kind === javascript_1.JS.Kind.CompilationUnit;
173
- if (isSource)
174
- acc.parsedFiles.push(sourcePath);
175
- let migrated = tree;
176
- for (const recipe of preceding) {
177
- const editor = yield recipe.editor();
178
- if (yield editor.isAcceptable(migrated, ctx)) {
179
- migrated = (_a = yield editor.visit(migrated, ctx)) !== null && _a !== void 0 ? _a : migrated;
180
- }
181
- }
182
- let printed = yield rewrite_1.TreePrinters.print(migrated);
183
- if (isPackageJson(sourcePath))
184
- printed = withoutDeclarations(printed);
185
- if (isSource ? mockFile.test(sourcePath) || reference.test(printed) : configReference.test(printed)) {
186
- acc.referencingFiles.push(sourcePath);
187
- }
188
- if (replacementReference === null || replacementReference === void 0 ? void 0 : replacementReference.test(printed))
189
- acc.replacementFiles.push(sourcePath);
190
- }
191
- return tree;
192
- });
193
- }
194
- };
195
- });
196
- }
197
- editorWithData(acc) {
198
- return __awaiter(this, void 0, void 0, function* () {
199
- const packages = new Set(this.packages);
200
- const module = this.module;
201
- const recipeName = this.name;
202
- const kept = this.kept;
203
- return new class extends json_1.JsonVisitor {
204
- visitDocument(doc, ctx) {
205
- return __awaiter(this, void 0, void 0, function* () {
206
- const dir = dirOf(doc.sourcePath);
207
- if (!isPackageJson(doc.sourcePath) || !(0, json_1.isObject)(doc.value))
208
- return doc;
209
- const referencing = acc.referencingFiles.filter(file => dir === '' || file.startsWith(dir + '/'));
210
- if (referencing.length > 0 || !anyBeneath(dir, acc.parsedFiles)) {
211
- for (const name of declaredPackages(doc.value, packages)) {
212
- const projen = referencing.length > 0 && referencing.every(file => PROJEN_DEPS.test(file));
213
- kept.insertRow(ctx, {
214
- sourcePath: doc.sourcePath,
215
- recipe: recipeName,
216
- package: name,
217
- reason: referencing.length === 0 ? exports.KEPT_REASONS.unparsed
218
- : projen ? exports.KEPT_REASONS.projen(module)
219
- : exports.KEPT_REASONS.referenced(module),
220
- evidence: referencing.slice(0, 5).join(' '),
221
- });
222
- }
223
- return doc;
224
- }
225
- const root = doc.value;
226
- let changed = false;
227
- const members = root.members.map(rp => {
228
- var _a;
229
- if (!(0, json_1.isMember)(rp.element))
230
- return rp;
231
- const member = rp.element;
232
- if (!SECTIONS.has((_a = (0, json_1.getMemberKeyName)(member)) !== null && _a !== void 0 ? _a : '') || !(0, json_1.isObject)(member.value))
233
- return rp;
234
- const section = member.value;
235
- const updated = removeMembers(section, packages);
236
- if (updated === section)
237
- return rp;
238
- changed = true;
239
- return Object.assign(Object.assign({}, rp), { element: Object.assign(Object.assign({}, member), { value: updated }) });
240
- });
241
- return changed ? Object.assign(Object.assign({}, doc), { value: Object.assign(Object.assign({}, root), { members }) }) : doc;
242
- });
243
- }
244
- };
245
- });
246
- }
247
- }
248
- exports.RemoveUnusedDependency = RemoveUnusedDependency;
249
- __decorate([
250
- (0, rewrite_1.Option)({
251
- displayName: "Account for the migration",
252
- description: "Judge library usage as it will be once the migration recipes have run, so the dependency " +
253
- "is dropped in the same run. Only enable alongside those recipes, as the composite migration does.",
254
- required: false
255
- })
256
- ], RemoveUnusedDependency.prototype, "accountForMigration", void 0);
257
- //# sourceMappingURL=remove-unused-dependency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove-unused-dependency.js","sourceRoot":"","sources":["../../src/migrate/remove-unused-dependency.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,4CAOC;AAcD,sBAGC;AAED,sCAEC;AAED,gCAEC;AAkBD,sCAUC;AAvGD,kDAA8K;AAC9K,oDAAsH;AACtH,gEAAmD;AACnD,oDAAoD;AAEpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAC1G,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,WAAW,GAAG,6EAA6E,CAAC;AAElG,MAAM,QAAQ,GAAG,wKAAwK,CAAC;AAC1L,MAAM,SAAS,GAAG,yFAAyF,CAAC;AAE5G,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB;IAC/F,sBAAsB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AAC7G,MAAM,WAAW,GAAG,iCAAiC,CAAC;AAEtD,MAAM,WAAW,GAAG,6BAA6B,CAAC;AASlD,MAAa,cAAc;CAe1B;AAfD,wCAeC;AAbG;IADC,IAAA,gBAAM,EAAC,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,yDAAyD,EAAC,CAAC;kDACzF;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,4CAA4C,EAAC,CAAC;8CAC3E;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAC,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,oDAAoD,EAAC,CAAC;+CACnF;AAGjB;I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