@openrewrite/recipes-nodejs 0.34.0-20251113-170355 → 0.34.0-20251114-152923
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 +2 -0
- package/dist/index.js.map +1 -1
- package/dist/migrate/process-features-tls.d.ts +9 -0
- package/dist/migrate/process-features-tls.d.ts.map +1 -0
- package/dist/migrate/process-features-tls.js +45 -0
- package/dist/migrate/process-features-tls.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/migrate/process-features-tls.ts +27 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAIpD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,cAAc,QAIhD"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.activate = activate;
|
|
4
4
|
const util_type_checking_1 = require("./migrate/util-type-checking");
|
|
5
5
|
const buffer_slice_1 = require("./migrate/buffer-slice");
|
|
6
|
+
const process_features_tls_1 = require("./migrate/process-features-tls");
|
|
6
7
|
function activate(registry) {
|
|
7
8
|
registry.register(util_type_checking_1.UseNativeTypeCheckingMethods);
|
|
8
9
|
registry.register(buffer_slice_1.ReplaceDeprecatedBufferSlice);
|
|
10
|
+
registry.register(process_features_tls_1.RemoveUsageOfProcessFeaturesTlsConstants);
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
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":";;AAMA,4BAIC;AAVD,qEAA0E;AAC1E,yDAAoE;AAEpE,yEAAwF;AAGxF,SAAgB,QAAQ,CAAC,QAAwB;IAC7C,QAAQ,CAAC,QAAQ,CAAC,iDAA4B,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,2CAA4B,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,+DAAwC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
|
|
2
|
+
export declare class RemoveUsageOfProcessFeaturesTlsConstants extends Recipe {
|
|
3
|
+
readonly name = "org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants";
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly tags: string[];
|
|
7
|
+
editor(): Promise<TreeVisitor<any, ExecutionContext>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=process-features-tls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-features-tls.d.ts","sourceRoot":"","sources":["../../src/migrate/process-features-tls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAOlF,qBAAa,wCAAyC,SAAQ,MAAM;IAChE,QAAQ,CAAC,IAAI,4FAA2F;IACxG,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAoE;IAChG,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA+G;IAC3I,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAe;IAEhC,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAa9D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.RemoveUsageOfProcessFeaturesTlsConstants = void 0;
|
|
13
|
+
const rewrite_1 = require("@openrewrite/rewrite");
|
|
14
|
+
const javascript_1 = require("@openrewrite/rewrite/javascript");
|
|
15
|
+
class RemoveUsageOfProcessFeaturesTlsConstants extends rewrite_1.Recipe {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.name = "org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants";
|
|
19
|
+
this.displayName = "Remove usage of deprecated `process.features.tls_*` properties";
|
|
20
|
+
this.description = "Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`.";
|
|
21
|
+
this.tags = ["DEP0189"];
|
|
22
|
+
}
|
|
23
|
+
editor() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return new class extends javascript_1.JavaScriptVisitor {
|
|
26
|
+
visitExpression(expression, p) {
|
|
27
|
+
const _super = Object.create(null, {
|
|
28
|
+
visitExpression: { get: () => super.visitExpression }
|
|
29
|
+
});
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const ret = yield _super.visitExpression.call(this, expression, p);
|
|
32
|
+
if ((yield (0, javascript_1.pattern) `process.features.tls_alpn`.match(ret))
|
|
33
|
+
|| (yield (0, javascript_1.pattern) `process.features.tls_ocsp`.match(ret))
|
|
34
|
+
|| (yield (0, javascript_1.pattern) `process.features.tls_sni`.match(ret))) {
|
|
35
|
+
return yield (0, javascript_1.template) `process.features.tls`.apply(this.cursor, ret);
|
|
36
|
+
}
|
|
37
|
+
return ret;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.RemoveUsageOfProcessFeaturesTlsConstants = RemoveUsageOfProcessFeaturesTlsConstants;
|
|
45
|
+
//# sourceMappingURL=process-features-tls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-features-tls.js","sourceRoot":"","sources":["../../src/migrate/process-features-tls.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAkF;AAClF,gEAAiG;AAMjG,MAAa,wCAAyC,SAAQ,gBAAM;IAApE;;QACa,SAAI,GAAG,wFAAwF,CAAA;QAC/F,gBAAW,GAAW,gEAAgE,CAAC;QACvF,gBAAW,GAAW,2GAA2G,CAAC;QAClI,SAAI,GAAa,CAAC,SAAS,CAAC,CAAC;IAe1C,CAAC;IAbS,MAAM;;YACR,OAAO,IAAI,KAAM,SAAQ,8BAAmC;gBACxC,eAAe,CAAC,UAAsB,EAAE,CAAmB;;;;;wBACvE,MAAM,GAAG,GAAG,MAAM,OAAM,eAAe,YAAC,UAAU,EAAE,CAAC,CAAe,CAAC;wBACrE,IAAI,CAAA,MAAM,IAAA,oBAAO,EAAA,2BAA2B,CAAC,KAAK,CAAC,GAAG,CAAC;gCAChD,MAAM,IAAA,oBAAO,EAAA,2BAA2B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gCACnD,MAAM,IAAA,oBAAO,EAAA,0BAA0B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA,EAAE,CAAC;4BACxD,OAAO,MAAM,IAAA,qBAAQ,EAAA,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;wBACxE,CAAC;wBACD,OAAO,GAAG,CAAC;oBACf,CAAC;iBAAA;aACJ,CAAA;QACL,CAAC;KAAA;CACJ;AAnBD,4FAmBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrewrite/recipes-nodejs",
|
|
3
|
-
"version": "0.34.0-
|
|
3
|
+
"version": "0.34.0-20251114-152923",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ci:test": "jest"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@openrewrite/rewrite": "^8.
|
|
26
|
+
"@openrewrite/rewrite": "^8.66.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/jest": "^29.5.13",
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {UseNativeTypeCheckingMethods} from "./migrate/util-type-checking";
|
|
2
2
|
import {ReplaceDeprecatedBufferSlice} from "./migrate/buffer-slice";
|
|
3
3
|
import {RecipeRegistry} from "@openrewrite/rewrite";
|
|
4
|
+
import {RemoveUsageOfProcessFeaturesTlsConstants} from "./migrate/process-features-tls";
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
export function activate(registry: RecipeRegistry) {
|
|
7
8
|
registry.register(UseNativeTypeCheckingMethods);
|
|
8
9
|
registry.register(ReplaceDeprecatedBufferSlice);
|
|
10
|
+
registry.register(RemoveUsageOfProcessFeaturesTlsConstants);
|
|
9
11
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {check, ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
2
|
+
import {JavaScriptVisitor, pattern, template, usesMethod} from "@openrewrite/rewrite/javascript";
|
|
3
|
+
import {Expression, J, TypedTree} from "@openrewrite/rewrite/java";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Remove usage of deprecated process.features.tls_* properties
|
|
7
|
+
*/
|
|
8
|
+
export class RemoveUsageOfProcessFeaturesTlsConstants extends Recipe {
|
|
9
|
+
readonly name = "org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants"
|
|
10
|
+
readonly displayName: string = "Remove usage of deprecated `process.features.tls_*` properties";
|
|
11
|
+
readonly description: string = "Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`.";
|
|
12
|
+
readonly tags: string[] = ["DEP0189"];
|
|
13
|
+
|
|
14
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
15
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
16
|
+
protected async visitExpression(expression: Expression, p: ExecutionContext): Promise<J | undefined> {
|
|
17
|
+
const ret = await super.visitExpression(expression, p) as Expression;
|
|
18
|
+
if (await pattern`process.features.tls_alpn`.match(ret)
|
|
19
|
+
|| await pattern`process.features.tls_ocsp`.match(ret)
|
|
20
|
+
|| await pattern`process.features.tls_sni`.match(ret)) {
|
|
21
|
+
return await template`process.features.tls`.apply(this.cursor, ret);
|
|
22
|
+
}
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|