@openrewrite/recipes-nodejs 0.37.0-20251218-170656 → 0.37.0-20251219-125443
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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/migrate/net-set-simultaneous-accepts.d.ts +9 -0
- package/dist/migrate/net-set-simultaneous-accepts.d.ts.map +1 -0
- package/dist/migrate/net-set-simultaneous-accepts.js +110 -0
- package/dist/migrate/net-set-simultaneous-accepts.js.map +1 -0
- package/dist/migrate/stream-internal-modules.d.ts +9 -0
- package/dist/migrate/stream-internal-modules.d.ts.map +1 -0
- package/dist/migrate/stream-internal-modules.js +110 -0
- package/dist/migrate/stream-internal-modules.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/migrate/net-set-simultaneous-accepts.ts +93 -0
- package/src/migrate/stream-internal-modules.ts +94 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AA0BpD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,cAAc,QAwBhD"}
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ 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
21
|
const tls_internal_modules_1 = require("./migrate/tls-internal-modules");
|
|
22
|
+
const stream_internal_modules_1 = require("./migrate/stream-internal-modules");
|
|
23
|
+
const net_set_simultaneous_accepts_1 = require("./migrate/net-set-simultaneous-accepts");
|
|
22
24
|
const upgrade_node_22_1 = require("./migrate/upgrade-node-22");
|
|
23
25
|
const upgrade_node_24_1 = require("./migrate/upgrade-node-24");
|
|
24
26
|
const security_1 = require("./security");
|
|
@@ -41,6 +43,8 @@ function activate(registry) {
|
|
|
41
43
|
registry.register(fs_truncate_1.ReplaceFsTruncateWithFd);
|
|
42
44
|
registry.register(outgoing_message_headers_1.ReplaceOutgoingMessageHeaders);
|
|
43
45
|
registry.register(tls_internal_modules_1.ReplaceTlsInternalModules);
|
|
46
|
+
registry.register(stream_internal_modules_1.ReplaceStreamInternalModules);
|
|
47
|
+
registry.register(net_set_simultaneous_accepts_1.RemoveNetSetSimultaneousAccepts);
|
|
44
48
|
registry.register(upgrade_node_22_1.UpgradeNode22);
|
|
45
49
|
registry.register(upgrade_node_24_1.UpgradeNode24);
|
|
46
50
|
registry.register(security_1.DependencyVulnerabilityCheck);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AA0BA,4BAwBC;AAjDD,qEAA0E;AAC1E,yDAAoE;AACpE,yEAAwF;AACxF,uEAAwE;AACxE,iDAAkD;AAClD,uDAAwD;AACxD,yEAAyE;AACzE,uDAAwD;AACxD,uDAAwD;AACxD,uEAAuE;AACvE,yEAAwE;AACxE,mEAA4E;AAC5E,uDAAwD;AACxD,+DAA6E;AAC7E,+DAA+D;AAC/D,uDAA8D;AAC9D,iFAAiF;AACjF,yEAAyE;AACzE,+EAA+E;AAC/E,yFAAuF;AACvF,+DAAwD;AACxD,+DAAwD;AACxD,yCAAwD;AAGxD,SAAgB,QAAQ,CAAC,QAAwB;IAC7C,QAAQ,CAAC,QAAQ,CAAC,iDAA4B,CAAC,CAAC;I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, Recipe, TreeVisitor } from "@openrewrite/rewrite";
|
|
2
|
+
export declare class RemoveNetSetSimultaneousAccepts extends Recipe {
|
|
3
|
+
readonly name = "org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts";
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly tags: string[];
|
|
7
|
+
editor(): Promise<TreeVisitor<any, ExecutionContext>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=net-set-simultaneous-accepts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"net-set-simultaneous-accepts.d.ts","sourceRoot":"","sources":["../../src/migrate/net-set-simultaneous-accepts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAI3E,qBAAa,+BAAgC,SAAQ,MAAM;IACvD,QAAQ,CAAC,IAAI,sEAAqE;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAuD;IACnF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAyI;IACrK,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAe;IAEhC,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAkF9D"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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.RemoveNetSetSimultaneousAccepts = 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 RemoveNetSetSimultaneousAccepts extends rewrite_1.Recipe {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = "org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts";
|
|
20
|
+
this.displayName = "Remove deprecated `net._setSimultaneousAccepts()`";
|
|
21
|
+
this.description = "Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary.";
|
|
22
|
+
this.tags = ["DEP0121"];
|
|
23
|
+
}
|
|
24
|
+
editor() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return new class extends javascript_1.JavaScriptVisitor {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.netNamespaceAlias = null;
|
|
30
|
+
this.hasSetSimultaneousAcceptsImport = false;
|
|
31
|
+
}
|
|
32
|
+
visitImportDeclaration(jsImport, p) {
|
|
33
|
+
const _super = Object.create(null, {
|
|
34
|
+
visitImportDeclaration: { get: () => super.visitImportDeclaration }
|
|
35
|
+
});
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const imp = yield _super.visitImportDeclaration.call(this, jsImport, p);
|
|
38
|
+
if (!imp.moduleSpecifier) {
|
|
39
|
+
return imp;
|
|
40
|
+
}
|
|
41
|
+
const moduleSpec = imp.moduleSpecifier.element;
|
|
42
|
+
if (moduleSpec.kind === java_1.J.Kind.Literal) {
|
|
43
|
+
const moduleName = moduleSpec.value;
|
|
44
|
+
if (moduleName === "net" || moduleName === "node:net") {
|
|
45
|
+
const importClause = imp.importClause;
|
|
46
|
+
if (importClause) {
|
|
47
|
+
const namedBindings = importClause.namedBindings;
|
|
48
|
+
if ((namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === javascript_1.JS.Kind.Alias) {
|
|
49
|
+
const alias = namedBindings;
|
|
50
|
+
if (alias.alias.kind === java_1.J.Kind.Identifier) {
|
|
51
|
+
this.netNamespaceAlias = alias.alias.simpleName;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if ((namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === javascript_1.JS.Kind.NamedImports) {
|
|
55
|
+
const namedImports = namedBindings;
|
|
56
|
+
for (const binding of namedImports.elements.elements) {
|
|
57
|
+
const specifier = binding.element;
|
|
58
|
+
if (specifier.specifier.kind === java_1.J.Kind.Identifier) {
|
|
59
|
+
const name = specifier.specifier.simpleName;
|
|
60
|
+
if (name === "_setSimultaneousAccepts") {
|
|
61
|
+
this.hasSetSimultaneousAcceptsImport = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return imp;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
visitMethodInvocation(m, p) {
|
|
73
|
+
const _super = Object.create(null, {
|
|
74
|
+
visitMethodInvocation: { get: () => super.visitMethodInvocation }
|
|
75
|
+
});
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const method = yield _super.visitMethodInvocation.call(this, m, p);
|
|
78
|
+
const methodName = method.name.simpleName;
|
|
79
|
+
if (methodName !== "_setSimultaneousAccepts") {
|
|
80
|
+
return method;
|
|
81
|
+
}
|
|
82
|
+
let isNetMethod = false;
|
|
83
|
+
if (method.select && this.netNamespaceAlias) {
|
|
84
|
+
const select = method.select.element;
|
|
85
|
+
if (select.kind === java_1.J.Kind.Identifier) {
|
|
86
|
+
const selectName = select.simpleName;
|
|
87
|
+
if (selectName === this.netNamespaceAlias) {
|
|
88
|
+
isNetMethod = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (!method.select && this.hasSetSimultaneousAcceptsImport) {
|
|
93
|
+
isNetMethod = true;
|
|
94
|
+
}
|
|
95
|
+
if (isNetMethod) {
|
|
96
|
+
(0, javascript_1.maybeRemoveImport)(this, "net");
|
|
97
|
+
(0, javascript_1.maybeRemoveImport)(this, "node:net");
|
|
98
|
+
(0, javascript_1.maybeRemoveImport)(this, "net", "_setSimultaneousAccepts");
|
|
99
|
+
(0, javascript_1.maybeRemoveImport)(this, "node:net", "_setSimultaneousAccepts");
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return method;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.RemoveNetSetSimultaneousAccepts = RemoveNetSetSimultaneousAccepts;
|
|
110
|
+
//# sourceMappingURL=net-set-simultaneous-accepts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"net-set-simultaneous-accepts.js","sourceRoot":"","sources":["../../src/migrate/net-set-simultaneous-accepts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2E;AAC3E,gEAAyF;AACzF,oDAA4C;AAE5C,MAAa,+BAAgC,SAAQ,gBAAM;IAA3D;;QACa,SAAI,GAAG,kEAAkE,CAAA;QACzE,gBAAW,GAAW,mDAAmD,CAAC;QAC1E,gBAAW,GAAW,qIAAqI,CAAC;QAC5J,SAAI,GAAa,CAAC,SAAS,CAAC,CAAC;IAoF1C,CAAC;IAlFS,MAAM;;YACR,OAAO,IAAI,KAAM,SAAQ,8BAAmC;gBAAjD;;oBACC,sBAAiB,GAAkB,IAAI,CAAC;oBACxC,oCAA+B,GAAG,KAAK,CAAC;gBA6EpD,CAAC;gBA3EmB,sBAAsB,CAAC,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E,KAAK,CAAC,CAAC;4BAC/B,IAAA,8BAAiB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;4BACpC,IAAA,8BAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC;4BAC1D,IAAA,8BAAiB,EAAC,IAAI,EAAE,UAAU,EAAE,yBAAyB,CAAC,CAAC;4BAC/D,OAAO,SAAS,CAAC;wBACrB,CAAC;wBAED,OAAO,MAAM,CAAC;oBAClB,CAAC;iBAAA;aACJ,CAAC;QACN,CAAC;KAAA;CACJ;AAxFD,0EAwFC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
|
|
2
|
+
export declare class ReplaceStreamInternalModules extends Recipe {
|
|
3
|
+
readonly name = "org.openrewrite.node.migrate.stream.replace-internal-modules";
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly tags: string[];
|
|
7
|
+
editor(): Promise<TreeVisitor<any, ExecutionContext>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=stream-internal-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-internal-modules.d.ts","sourceRoot":"","sources":["../../src/migrate/stream-internal-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAgB,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAKzF,qBAAa,4BAA6B,SAAQ,MAAM;IACpD,QAAQ,CAAC,IAAI,kEAAiE;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA4D;IACxF,QAAQ,CAAC,WAAW,EAAE,MAAM,CACgB;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAe;IAEhC,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAiF9D"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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.ReplaceStreamInternalModules = 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 ReplaceStreamInternalModules extends rewrite_1.Recipe {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = "org.openrewrite.node.migrate.stream.replace-internal-modules";
|
|
20
|
+
this.displayName = "Replace deprecated `node:_stream_*` with `node:stream`";
|
|
21
|
+
this.description = "Replace deprecated internal stream module imports like `require('node:_stream_readable')` " +
|
|
22
|
+
"with the public `node:stream` module.";
|
|
23
|
+
this.tags = ["DEP0193"];
|
|
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:_stream_duplex",
|
|
32
|
+
"node:_stream_passthrough",
|
|
33
|
+
"node:_stream_readable",
|
|
34
|
+
"node:_stream_transform",
|
|
35
|
+
"node:_stream_wrap",
|
|
36
|
+
"node:_stream_writable",
|
|
37
|
+
"_stream_duplex",
|
|
38
|
+
"_stream_passthrough",
|
|
39
|
+
"_stream_readable",
|
|
40
|
+
"_stream_transform",
|
|
41
|
+
"_stream_wrap",
|
|
42
|
+
"_stream_writable"
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
getReplacement(moduleName) {
|
|
46
|
+
if (moduleName.startsWith("node:")) {
|
|
47
|
+
return "node:stream";
|
|
48
|
+
}
|
|
49
|
+
return "stream";
|
|
50
|
+
}
|
|
51
|
+
visitImportDeclaration(jsImport, p) {
|
|
52
|
+
const _super = Object.create(null, {
|
|
53
|
+
visitImportDeclaration: { get: () => super.visitImportDeclaration }
|
|
54
|
+
});
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const imp = yield _super.visitImportDeclaration.call(this, jsImport, p);
|
|
57
|
+
if (!imp.moduleSpecifier) {
|
|
58
|
+
return imp;
|
|
59
|
+
}
|
|
60
|
+
const moduleSpec = imp.moduleSpecifier.element;
|
|
61
|
+
if (moduleSpec.kind === java_1.J.Kind.Literal) {
|
|
62
|
+
const literal = moduleSpec;
|
|
63
|
+
const moduleName = literal.value;
|
|
64
|
+
if (this.deprecatedModules.has(moduleName)) {
|
|
65
|
+
const replacement = this.getReplacement(moduleName);
|
|
66
|
+
return (0, rewrite_1.produceAsync)(imp, (draft) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const litDraft = draft.moduleSpecifier.element;
|
|
68
|
+
litDraft.value = replacement;
|
|
69
|
+
litDraft.valueSource = `'${replacement}'`;
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return imp;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
visitMethodInvocation(method, p) {
|
|
77
|
+
const _super = Object.create(null, {
|
|
78
|
+
visitMethodInvocation: { get: () => super.visitMethodInvocation }
|
|
79
|
+
});
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const m = yield _super.visitMethodInvocation.call(this, method, p);
|
|
82
|
+
if (m.name.simpleName !== "require") {
|
|
83
|
+
return m;
|
|
84
|
+
}
|
|
85
|
+
const args = m.arguments.elements;
|
|
86
|
+
if (args.length !== 1) {
|
|
87
|
+
return m;
|
|
88
|
+
}
|
|
89
|
+
const arg = args[0].element;
|
|
90
|
+
if (arg.kind === java_1.J.Kind.Literal) {
|
|
91
|
+
const literal = arg;
|
|
92
|
+
const moduleName = literal.value;
|
|
93
|
+
if (this.deprecatedModules.has(moduleName)) {
|
|
94
|
+
const replacement = this.getReplacement(moduleName);
|
|
95
|
+
return (0, rewrite_1.produceAsync)(m, (draft) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const litDraft = draft.arguments.elements[0].element;
|
|
97
|
+
litDraft.value = replacement;
|
|
98
|
+
litDraft.valueSource = `'${replacement}'`;
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return m;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.ReplaceStreamInternalModules = ReplaceStreamInternalModules;
|
|
110
|
+
//# sourceMappingURL=stream-internal-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-internal-modules.js","sourceRoot":"","sources":["../../src/migrate/stream-internal-modules.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyF;AACzF,gEAAsE;AACtE,oDAA4C;AAG5C,MAAa,4BAA6B,SAAQ,gBAAM;IAAxD;;QACa,SAAI,GAAG,8DAA8D,CAAA;QACrE,gBAAW,GAAW,wDAAwD,CAAC;QAC/E,gBAAW,GAAW,4FAA4F;YACvH,uCAAuC,CAAC;QACnC,SAAI,GAAa,CAAC,SAAS,CAAC,CAAC;IAmF1C,CAAC;IAjFS,MAAM;;YACR,OAAO,IAAI,KAA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wBACL,CAAC;wBAED,OAAO,CAAC,CAAC;oBACb,CAAC;iBAAA;aACJ,CAAC;QACN,CAAC;KAAA;CACJ;AAxFD,oEAwFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrewrite/recipes-nodejs",
|
|
3
|
-
"version": "0.37.0-
|
|
3
|
+
"version": "0.37.0-20251219-125443",
|
|
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
|
@@ -17,6 +17,8 @@ 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
19
|
import {ReplaceTlsInternalModules} from "./migrate/tls-internal-modules";
|
|
20
|
+
import {ReplaceStreamInternalModules} from "./migrate/stream-internal-modules";
|
|
21
|
+
import {RemoveNetSetSimultaneousAccepts} from "./migrate/net-set-simultaneous-accepts";
|
|
20
22
|
import {UpgradeNode22} from "./migrate/upgrade-node-22";
|
|
21
23
|
import {UpgradeNode24} from "./migrate/upgrade-node-24";
|
|
22
24
|
import {DependencyVulnerabilityCheck} from "./security";
|
|
@@ -41,6 +43,8 @@ export function activate(registry: RecipeRegistry) {
|
|
|
41
43
|
registry.register(ReplaceFsTruncateWithFd);
|
|
42
44
|
registry.register(ReplaceOutgoingMessageHeaders);
|
|
43
45
|
registry.register(ReplaceTlsInternalModules);
|
|
46
|
+
registry.register(ReplaceStreamInternalModules);
|
|
47
|
+
registry.register(RemoveNetSetSimultaneousAccepts);
|
|
44
48
|
registry.register(UpgradeNode22);
|
|
45
49
|
registry.register(UpgradeNode24);
|
|
46
50
|
registry.register(DependencyVulnerabilityCheck);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
2
|
+
import {JavaScriptVisitor, JS, maybeRemoveImport} from "@openrewrite/rewrite/javascript";
|
|
3
|
+
import {J} from "@openrewrite/rewrite/java";
|
|
4
|
+
|
|
5
|
+
export class RemoveNetSetSimultaneousAccepts extends Recipe {
|
|
6
|
+
readonly name = "org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts"
|
|
7
|
+
readonly displayName: string = "Remove deprecated `net._setSimultaneousAccepts()`";
|
|
8
|
+
readonly description: string = "Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary.";
|
|
9
|
+
readonly tags: string[] = ["DEP0121"];
|
|
10
|
+
|
|
11
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
12
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
13
|
+
private netNamespaceAlias: string | null = null;
|
|
14
|
+
private hasSetSimultaneousAcceptsImport = false;
|
|
15
|
+
|
|
16
|
+
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
17
|
+
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
18
|
+
|
|
19
|
+
if (!imp.moduleSpecifier) {
|
|
20
|
+
return imp;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const moduleSpec = imp.moduleSpecifier.element;
|
|
24
|
+
if (moduleSpec.kind === J.Kind.Literal) {
|
|
25
|
+
const moduleName = (moduleSpec as J.Literal).value as string;
|
|
26
|
+
if (moduleName === "net" || moduleName === "node:net") {
|
|
27
|
+
const importClause = imp.importClause;
|
|
28
|
+
if (importClause) {
|
|
29
|
+
const namedBindings = importClause.namedBindings;
|
|
30
|
+
|
|
31
|
+
if (namedBindings?.kind === JS.Kind.Alias) {
|
|
32
|
+
const alias = namedBindings as JS.Alias;
|
|
33
|
+
if (alias.alias.kind === J.Kind.Identifier) {
|
|
34
|
+
this.netNamespaceAlias = (alias.alias as J.Identifier).simpleName;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
39
|
+
const namedImports = namedBindings as JS.NamedImports;
|
|
40
|
+
for (const binding of namedImports.elements.elements) {
|
|
41
|
+
const specifier = binding.element;
|
|
42
|
+
if (specifier.specifier.kind === J.Kind.Identifier) {
|
|
43
|
+
const name = (specifier.specifier as J.Identifier).simpleName;
|
|
44
|
+
if (name === "_setSimultaneousAccepts") {
|
|
45
|
+
this.hasSetSimultaneousAcceptsImport = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return imp;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected async visitMethodInvocation(m: J.MethodInvocation, p: ExecutionContext): Promise<J | undefined> {
|
|
58
|
+
const method = await super.visitMethodInvocation(m, p) as J.MethodInvocation;
|
|
59
|
+
|
|
60
|
+
const methodName = method.name.simpleName;
|
|
61
|
+
if (methodName !== "_setSimultaneousAccepts") {
|
|
62
|
+
return method;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let isNetMethod = false;
|
|
66
|
+
|
|
67
|
+
if (method.select && this.netNamespaceAlias) {
|
|
68
|
+
const select = method.select.element;
|
|
69
|
+
if (select.kind === J.Kind.Identifier) {
|
|
70
|
+
const selectName = (select as J.Identifier).simpleName;
|
|
71
|
+
if (selectName === this.netNamespaceAlias) {
|
|
72
|
+
isNetMethod = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!method.select && this.hasSetSimultaneousAcceptsImport) {
|
|
78
|
+
isNetMethod = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (isNetMethod) {
|
|
82
|
+
maybeRemoveImport(this, "net");
|
|
83
|
+
maybeRemoveImport(this, "node:net");
|
|
84
|
+
maybeRemoveImport(this, "net", "_setSimultaneousAccepts");
|
|
85
|
+
maybeRemoveImport(this, "node:net", "_setSimultaneousAccepts");
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return method;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 ReplaceStreamInternalModules extends Recipe {
|
|
7
|
+
readonly name = "org.openrewrite.node.migrate.stream.replace-internal-modules"
|
|
8
|
+
readonly displayName: string = "Replace deprecated `node:_stream_*` with `node:stream`";
|
|
9
|
+
readonly description: string = "Replace deprecated internal stream module imports like `require('node:_stream_readable')` " +
|
|
10
|
+
"with the public `node:stream` module.";
|
|
11
|
+
readonly tags: string[] = ["DEP0193"];
|
|
12
|
+
|
|
13
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
14
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
15
|
+
|
|
16
|
+
private readonly deprecatedModules = new Set([
|
|
17
|
+
"node:_stream_duplex",
|
|
18
|
+
"node:_stream_passthrough",
|
|
19
|
+
"node:_stream_readable",
|
|
20
|
+
"node:_stream_transform",
|
|
21
|
+
"node:_stream_wrap",
|
|
22
|
+
"node:_stream_writable",
|
|
23
|
+
"_stream_duplex",
|
|
24
|
+
"_stream_passthrough",
|
|
25
|
+
"_stream_readable",
|
|
26
|
+
"_stream_transform",
|
|
27
|
+
"_stream_wrap",
|
|
28
|
+
"_stream_writable"
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
private getReplacement(moduleName: string): string {
|
|
32
|
+
if (moduleName.startsWith("node:")) {
|
|
33
|
+
return "node:stream";
|
|
34
|
+
}
|
|
35
|
+
return "stream";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
39
|
+
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
40
|
+
|
|
41
|
+
if (!imp.moduleSpecifier) {
|
|
42
|
+
return imp;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const moduleSpec = imp.moduleSpecifier.element;
|
|
46
|
+
if (moduleSpec.kind === J.Kind.Literal) {
|
|
47
|
+
const literal = moduleSpec as J.Literal;
|
|
48
|
+
const moduleName = literal.value as string;
|
|
49
|
+
|
|
50
|
+
if (this.deprecatedModules.has(moduleName)) {
|
|
51
|
+
const replacement = this.getReplacement(moduleName);
|
|
52
|
+
return produceAsync(imp, async draft => {
|
|
53
|
+
const litDraft = (draft as Draft<JS.Import>).moduleSpecifier!.element as Draft<J.Literal>;
|
|
54
|
+
litDraft.value = replacement;
|
|
55
|
+
litDraft.valueSource = `'${replacement}'`;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return imp;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected async visitMethodInvocation(method: J.MethodInvocation, p: ExecutionContext): Promise<J | undefined> {
|
|
64
|
+
const m = await super.visitMethodInvocation(method, p) as J.MethodInvocation;
|
|
65
|
+
|
|
66
|
+
if (m.name.simpleName !== "require") {
|
|
67
|
+
return m;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const args = m.arguments.elements;
|
|
71
|
+
if (args.length !== 1) {
|
|
72
|
+
return m;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const arg = args[0].element;
|
|
76
|
+
if (arg.kind === J.Kind.Literal) {
|
|
77
|
+
const literal = arg as J.Literal;
|
|
78
|
+
const moduleName = literal.value as string;
|
|
79
|
+
|
|
80
|
+
if (this.deprecatedModules.has(moduleName)) {
|
|
81
|
+
const replacement = this.getReplacement(moduleName);
|
|
82
|
+
return produceAsync(m, async draft => {
|
|
83
|
+
const litDraft = (draft as Draft<J.MethodInvocation>).arguments.elements[0].element as Draft<J.Literal>;
|
|
84
|
+
litDraft.value = replacement;
|
|
85
|
+
litDraft.valueSource = `'${replacement}'`;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return m;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|