@openrewrite/recipes-nodejs 0.35.0-20251205-093309 → 0.36.0-20251205-111002

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAsBpD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,cAAc,QAoBhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAuBpD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,cAAc,QAqBhD"}
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ const util_types_wasm_1 = require("./migrate/util-types-wasm");
18
18
  const zlib_bytes_read_1 = require("./migrate/zlib-bytes-read");
19
19
  const fs_truncate_1 = require("./migrate/fs-truncate");
20
20
  const outgoing_message_headers_1 = require("./migrate/outgoing-message-headers");
21
+ const tls_internal_modules_1 = require("./migrate/tls-internal-modules");
21
22
  const upgrade_node_22_1 = require("./migrate/upgrade-node-22");
22
23
  const upgrade_node_24_1 = require("./migrate/upgrade-node-24");
23
24
  function activate(registry) {
@@ -38,6 +39,7 @@ function activate(registry) {
38
39
  registry.register(zlib_bytes_read_1.ReplaceZlibBytesRead);
39
40
  registry.register(fs_truncate_1.ReplaceFsTruncateWithFd);
40
41
  registry.register(outgoing_message_headers_1.ReplaceOutgoingMessageHeaders);
42
+ registry.register(tls_internal_modules_1.ReplaceTlsInternalModules);
41
43
  registry.register(upgrade_node_22_1.UpgradeNode22);
42
44
  registry.register(upgrade_node_24_1.UpgradeNode24);
43
45
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAsBA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Q,CAAC,QAAQ,CAAC,oDAAkC,CAAC,CAAC;IACtD,QAAQ,CAAC,QAAQ,CAAC,sCAAoB,CAAC,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,qCAAuB,CAAC,CAAC;IAC3C,QAAQ,CAAC,QAAQ,CAAC,wDAA6B,CAAC,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,gDAAyB,CAAC,CAAC;IAC7C,QAAQ,CAAC,QAAQ,CAAC,+BAAa,CAAC,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,+BAAa,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
2
+ export declare class ReplaceTlsInternalModules extends Recipe {
3
+ readonly name = "org.openrewrite.node.migrate.tls.replace-internal-modules";
4
+ readonly displayName: string;
5
+ readonly description: string;
6
+ readonly tags: string[];
7
+ editor(): Promise<TreeVisitor<any, ExecutionContext>>;
8
+ }
9
+ //# sourceMappingURL=tls-internal-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-internal-modules.d.ts","sourceRoot":"","sources":["../../src/migrate/tls-internal-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAgB,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAKzF,qBAAa,yBAA0B,SAAQ,MAAM;IACjD,QAAQ,CAAC,IAAI,+DAA8D;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAgF;IAC5G,QAAQ,CAAC,WAAW,EAAE,MAAM,CACyC;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAe;IAEhC,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAyE9D"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReplaceTlsInternalModules = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ const java_1 = require("@openrewrite/rewrite/java");
16
+ class ReplaceTlsInternalModules extends rewrite_1.Recipe {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.name = "org.openrewrite.node.migrate.tls.replace-internal-modules";
20
+ this.displayName = "Replace deprecated `node:_tls_common` and `node:_tls_wrap` with `node:tls`";
21
+ this.description = "Replace deprecated internal TLS module imports `require('node:_tls_common')` and " +
22
+ "`require('node:_tls_wrap')` with the public `node:tls` module.";
23
+ this.tags = ["DEP0192"];
24
+ }
25
+ editor() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ return new class extends javascript_1.JavaScriptVisitor {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.deprecatedModules = new Set([
31
+ "node:_tls_common",
32
+ "node:_tls_wrap",
33
+ "_tls_common",
34
+ "_tls_wrap"
35
+ ]);
36
+ }
37
+ getReplacement(moduleName) {
38
+ if (moduleName.startsWith("node:")) {
39
+ return "node:tls";
40
+ }
41
+ return "tls";
42
+ }
43
+ visitImportDeclaration(jsImport, p) {
44
+ const _super = Object.create(null, {
45
+ visitImportDeclaration: { get: () => super.visitImportDeclaration }
46
+ });
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const imp = yield _super.visitImportDeclaration.call(this, jsImport, p);
49
+ if (!imp.moduleSpecifier) {
50
+ return imp;
51
+ }
52
+ const moduleSpec = imp.moduleSpecifier.element;
53
+ if (moduleSpec.kind === java_1.J.Kind.Literal) {
54
+ const literal = moduleSpec;
55
+ const moduleName = literal.value;
56
+ if (this.deprecatedModules.has(moduleName)) {
57
+ const replacement = this.getReplacement(moduleName);
58
+ return (0, rewrite_1.produceAsync)(imp, (draft) => __awaiter(this, void 0, void 0, function* () {
59
+ const litDraft = draft.moduleSpecifier.element;
60
+ litDraft.value = replacement;
61
+ litDraft.valueSource = `'${replacement}'`;
62
+ }));
63
+ }
64
+ }
65
+ return imp;
66
+ });
67
+ }
68
+ visitMethodInvocation(method, p) {
69
+ const _super = Object.create(null, {
70
+ visitMethodInvocation: { get: () => super.visitMethodInvocation }
71
+ });
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const m = yield _super.visitMethodInvocation.call(this, method, p);
74
+ if (m.name.simpleName !== "require") {
75
+ return m;
76
+ }
77
+ const args = m.arguments.elements;
78
+ if (args.length !== 1) {
79
+ return m;
80
+ }
81
+ const arg = args[0].element;
82
+ if (arg.kind === java_1.J.Kind.Literal) {
83
+ const literal = arg;
84
+ const moduleName = literal.value;
85
+ if (this.deprecatedModules.has(moduleName)) {
86
+ const replacement = this.getReplacement(moduleName);
87
+ return (0, rewrite_1.produceAsync)(m, (draft) => __awaiter(this, void 0, void 0, function* () {
88
+ const litDraft = draft.arguments.elements[0].element;
89
+ litDraft.value = replacement;
90
+ litDraft.valueSource = `'${replacement}'`;
91
+ }));
92
+ }
93
+ }
94
+ return m;
95
+ });
96
+ }
97
+ };
98
+ });
99
+ }
100
+ }
101
+ exports.ReplaceTlsInternalModules = ReplaceTlsInternalModules;
102
+ //# sourceMappingURL=tls-internal-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-internal-modules.js","sourceRoot":"","sources":["../../src/migrate/tls-internal-modules.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyF;AACzF,gEAAsE;AACtE,oDAA4C;AAG5C,MAAa,yBAA0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C7B,QAAQ,CAAC,WAAW,GAAG,IAAI,WAAW,GAAG,CAAC;gCAC9C,CAAC,CAAA,CAAC,CAAC;4BACP,CAAC;wBACL,CAAC;wBAED,OAAO,CAAC,CAAC;oBACb,CAAC;iBAAA;aACJ,CAAC;QACN,CAAC;KAAA;CACJ;AAhFD,8DAgFC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrewrite/recipes-nodejs",
3
- "version": "0.35.0-20251205-093309",
3
+ "version": "0.36.0-20251205-111002",
4
4
  "license": "Moderne Source Available License",
5
5
  "description": "OpenRewrite recipes for Node.js library migrations.",
6
6
  "homepage": "https://github.com/moderneinc/rewrite-node",
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ import {ReplaceIsWebAssemblyCompiledModule} from "./migrate/util-types-wasm";
16
16
  import {ReplaceZlibBytesRead} from "./migrate/zlib-bytes-read";
17
17
  import {ReplaceFsTruncateWithFd} from "./migrate/fs-truncate";
18
18
  import {ReplaceOutgoingMessageHeaders} from "./migrate/outgoing-message-headers";
19
+ import {ReplaceTlsInternalModules} from "./migrate/tls-internal-modules";
19
20
  import {UpgradeNode22} from "./migrate/upgrade-node-22";
20
21
  import {UpgradeNode24} from "./migrate/upgrade-node-24";
21
22
 
@@ -38,6 +39,7 @@ export function activate(registry: RecipeRegistry) {
38
39
  registry.register(ReplaceZlibBytesRead);
39
40
  registry.register(ReplaceFsTruncateWithFd);
40
41
  registry.register(ReplaceOutgoingMessageHeaders);
42
+ registry.register(ReplaceTlsInternalModules);
41
43
  registry.register(UpgradeNode22);
42
44
  registry.register(UpgradeNode24);
43
45
  }
@@ -0,0 +1,86 @@
1
+ import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
2
+ import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
3
+ import {J} from "@openrewrite/rewrite/java";
4
+ import {Draft} from "immer";
5
+
6
+ export class ReplaceTlsInternalModules extends Recipe {
7
+ readonly name = "org.openrewrite.node.migrate.tls.replace-internal-modules"
8
+ readonly displayName: string = "Replace deprecated `node:_tls_common` and `node:_tls_wrap` with `node:tls`";
9
+ readonly description: string = "Replace deprecated internal TLS module imports `require('node:_tls_common')` and " +
10
+ "`require('node:_tls_wrap')` with the public `node:tls` module.";
11
+ readonly tags: string[] = ["DEP0192"];
12
+
13
+ async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
14
+ return new class extends JavaScriptVisitor<ExecutionContext> {
15
+
16
+ private readonly deprecatedModules = new Set([
17
+ "node:_tls_common",
18
+ "node:_tls_wrap",
19
+ "_tls_common",
20
+ "_tls_wrap"
21
+ ]);
22
+
23
+ private getReplacement(moduleName: string): string {
24
+ if (moduleName.startsWith("node:")) {
25
+ return "node:tls";
26
+ }
27
+ return "tls";
28
+ }
29
+
30
+ protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
31
+ const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
32
+
33
+ if (!imp.moduleSpecifier) {
34
+ return imp;
35
+ }
36
+
37
+ const moduleSpec = imp.moduleSpecifier.element;
38
+ if (moduleSpec.kind === J.Kind.Literal) {
39
+ const literal = moduleSpec as J.Literal;
40
+ const moduleName = literal.value as string;
41
+
42
+ if (this.deprecatedModules.has(moduleName)) {
43
+ const replacement = this.getReplacement(moduleName);
44
+ return produceAsync(imp, async draft => {
45
+ const litDraft = (draft as Draft<JS.Import>).moduleSpecifier!.element as Draft<J.Literal>;
46
+ litDraft.value = replacement;
47
+ litDraft.valueSource = `'${replacement}'`;
48
+ });
49
+ }
50
+ }
51
+
52
+ return imp;
53
+ }
54
+
55
+ protected async visitMethodInvocation(method: J.MethodInvocation, p: ExecutionContext): Promise<J | undefined> {
56
+ const m = await super.visitMethodInvocation(method, p) as J.MethodInvocation;
57
+
58
+ if (m.name.simpleName !== "require") {
59
+ return m;
60
+ }
61
+
62
+ const args = m.arguments.elements;
63
+ if (args.length !== 1) {
64
+ return m;
65
+ }
66
+
67
+ const arg = args[0].element;
68
+ if (arg.kind === J.Kind.Literal) {
69
+ const literal = arg as J.Literal;
70
+ const moduleName = literal.value as string;
71
+
72
+ if (this.deprecatedModules.has(moduleName)) {
73
+ const replacement = this.getReplacement(moduleName);
74
+ return produceAsync(m, async draft => {
75
+ const litDraft = (draft as Draft<J.MethodInvocation>).arguments.elements[0].element as Draft<J.Literal>;
76
+ litDraft.value = replacement;
77
+ litDraft.valueSource = `'${replacement}'`;
78
+ });
79
+ }
80
+ }
81
+
82
+ return m;
83
+ }
84
+ };
85
+ }
86
+ }