@openrewrite/rewrite 8.65.0-20251023-160625 → 8.65.0-20251023-181533
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/javascript/migrate/typescript/export-assignment-to-export-default.d.ts +10 -0
- package/dist/javascript/migrate/typescript/export-assignment-to-export-default.d.ts.map +1 -0
- package/dist/javascript/migrate/typescript/export-assignment-to-export-default.js +57 -0
- package/dist/javascript/migrate/typescript/export-assignment-to-export-default.js.map +1 -0
- package/dist/javascript/migrate/typescript/index.d.ts +2 -0
- package/dist/javascript/migrate/typescript/index.d.ts.map +1 -0
- package/dist/javascript/migrate/typescript/index.js +21 -0
- package/dist/javascript/migrate/typescript/index.js.map +1 -0
- package/dist/version.txt +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/javascript/migrate/typescript/export-assignment-to-export-default.ts +43 -0
- package/src/javascript/migrate/typescript/index.ts +17 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAExC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AAGtB,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAExC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AAGtB,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE"}
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,8 @@ function activate(registry) {
|
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
62
|
const { OrderImports } = yield import("./recipe/index.js");
|
|
63
63
|
const { ModernizeOctalLiterals, RemoveDuplicateObjectKeys } = yield import("./javascript/migrate/es6/index.js");
|
|
64
|
+
const { ExportAssignmentToExportDefault } = yield import("./javascript/migrate/typescript/index.js");
|
|
65
|
+
registry.register(ExportAssignmentToExportDefault);
|
|
64
66
|
registry.register(OrderImports);
|
|
65
67
|
registry.register(ModernizeOctalLiterals);
|
|
66
68
|
registry.register(RemoveDuplicateObjectKeys);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA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C,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC1C,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;KAAA;IACK,UAAU,CAAC,MAA4B,EAAE,CAAkB;;YAC7D,MAAM,KAAK,GAAgC,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAC;YAC/D,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACtC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACtD,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5D,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAChD,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClD,OAAO,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Recipe } from "../../../recipe";
|
|
2
|
+
import { TreeVisitor } from "../../../visitor";
|
|
3
|
+
import { ExecutionContext } from "../../../execution";
|
|
4
|
+
export declare class ExportAssignmentToExportDefault extends Recipe {
|
|
5
|
+
name: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
description: string;
|
|
8
|
+
editor(): Promise<TreeVisitor<any, ExecutionContext>>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=export-assignment-to-export-default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-assignment-to-export-default.d.ts","sourceRoot":"","sources":["../../../../src/javascript/migrate/typescript/export-assignment-to-export-default.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAKpD,qBAAa,+BAAgC,SAAQ,MAAM;IACvD,IAAI,SAAuF;IAC3F,WAAW,SAA4C;IACvD,WAAW,SAA2H;IAEhI,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAc9D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 the original author or authors.
|
|
4
|
+
* <p>
|
|
5
|
+
* Licensed under the Moderne Source Available License (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* <p>
|
|
9
|
+
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
10
|
+
* <p>
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ExportAssignmentToExportDefault = void 0;
|
|
28
|
+
const recipe_1 = require("../../../recipe");
|
|
29
|
+
const javascript_1 = require("../../../javascript");
|
|
30
|
+
const immer_1 = require("immer");
|
|
31
|
+
class ExportAssignmentToExportDefault extends recipe_1.Recipe {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.name = "org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default";
|
|
35
|
+
this.displayName = "Convert `export =` to `export default`";
|
|
36
|
+
this.description = "Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules.";
|
|
37
|
+
}
|
|
38
|
+
editor() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return new class extends javascript_1.JavaScriptVisitor {
|
|
41
|
+
visitExportAssignment(exportAssignment, p) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
// Only transform export = to export default
|
|
44
|
+
if (exportAssignment.exportEquals) {
|
|
45
|
+
return (0, immer_1.produce)(exportAssignment, draft => {
|
|
46
|
+
draft.exportEquals = false;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return exportAssignment;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ExportAssignmentToExportDefault = ExportAssignmentToExportDefault;
|
|
57
|
+
//# sourceMappingURL=export-assignment-to-export-default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-assignment-to-export-default.js","sourceRoot":"","sources":["../../../../src/javascript/migrate/typescript/export-assignment-to-export-default.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,4CAAuC;AAGvC,oDAA0D;AAE1D,iCAA8B;AAE9B,MAAa,+BAAgC,SAAQ,eAAM;IAA3D;;QACI,SAAI,GAAG,mFAAmF,CAAC;QAC3F,gBAAW,GAAG,wCAAwC,CAAC;QACvD,gBAAW,GAAG,uHAAuH,CAAC;IAgB1I,CAAC;IAdS,MAAM;;YACR,OAAO,IAAI,KAAM,SAAQ,8BAAmC;gBAExC,qBAAqB,CAAC,gBAAqC,EAAE,CAAmB;;wBAC5F,4CAA4C;wBAC5C,IAAI,gBAAgB,CAAC,YAAY,EAAE,CAAC;4BAChC,OAAO,IAAA,eAAO,EAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE;gCACrC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;4BAC/B,CAAC,CAAC,CAAC;wBACP,CAAC;wBACD,OAAO,gBAAgB,CAAC;oBAC5B,CAAC;iBAAA;aACJ,CAAA;QACL,CAAC;KAAA;CACJ;AAnBD,0EAmBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/javascript/migrate/typescript/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,+BAA+B,EAAC,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 the original author or authors.
|
|
4
|
+
* <p>
|
|
5
|
+
* Licensed under the Moderne Source Available License (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* <p>
|
|
9
|
+
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
10
|
+
* <p>
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ExportAssignmentToExportDefault = void 0;
|
|
19
|
+
var export_assignment_to_export_default_1 = require("./export-assignment-to-export-default");
|
|
20
|
+
Object.defineProperty(exports, "ExportAssignmentToExportDefault", { enumerable: true, get: function () { return export_assignment_to_export_default_1.ExportAssignmentToExportDefault; } });
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/javascript/migrate/typescript/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6FAAsF;AAA9E,sJAAA,+BAA+B,OAAA"}
|
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
8.65.0-20251023-
|
|
1
|
+
8.65.0-20251023-181131
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -37,6 +37,8 @@ export * from "./run";
|
|
|
37
37
|
export async function activate(registry: RecipeRegistry): Promise<void> {
|
|
38
38
|
const {OrderImports} = await import("./recipe/index.js");
|
|
39
39
|
const {ModernizeOctalLiterals, RemoveDuplicateObjectKeys} = await import("./javascript/migrate/es6/index.js");
|
|
40
|
+
const {ExportAssignmentToExportDefault} = await import("./javascript/migrate/typescript/index.js");
|
|
41
|
+
registry.register(ExportAssignmentToExportDefault);
|
|
40
42
|
registry.register(OrderImports);
|
|
41
43
|
registry.register(ModernizeOctalLiterals);
|
|
42
44
|
registry.register(RemoveDuplicateObjectKeys);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 the original author or authors.
|
|
3
|
+
* <p>
|
|
4
|
+
* Licensed under the Moderne Source Available License (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
* <p>
|
|
8
|
+
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
9
|
+
* <p>
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {Recipe} from "../../../recipe";
|
|
18
|
+
import {TreeVisitor} from "../../../visitor";
|
|
19
|
+
import {ExecutionContext} from "../../../execution";
|
|
20
|
+
import {JavaScriptVisitor, JS} from "../../../javascript";
|
|
21
|
+
import {J} from "../../../java";
|
|
22
|
+
import {produce} from "immer";
|
|
23
|
+
|
|
24
|
+
export class ExportAssignmentToExportDefault extends Recipe {
|
|
25
|
+
name = "org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default";
|
|
26
|
+
displayName = "Convert `export =` to `export default`";
|
|
27
|
+
description = "Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules.";
|
|
28
|
+
|
|
29
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
30
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
31
|
+
|
|
32
|
+
protected async visitExportAssignment(exportAssignment: JS.ExportAssignment, p: ExecutionContext): Promise<J | undefined> {
|
|
33
|
+
// Only transform export = to export default
|
|
34
|
+
if (exportAssignment.exportEquals) {
|
|
35
|
+
return produce(exportAssignment, draft => {
|
|
36
|
+
draft.exportEquals = false;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return exportAssignment;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 the original author or authors.
|
|
3
|
+
* <p>
|
|
4
|
+
* Licensed under the Moderne Source Available License (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
* <p>
|
|
8
|
+
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
9
|
+
* <p>
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export {ExportAssignmentToExportDefault} from "./export-assignment-to-export-default";
|