@openrewrite/recipes-angular 1.25.0 → 1.27.0
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/libraries/primeng/18/migrate-primeng-config.d.ts.map +1 -1
- package/dist/libraries/primeng/18/migrate-primeng-config.js +0 -59
- package/dist/libraries/primeng/18/migrate-primeng-config.js.map +1 -1
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.d.ts.map +1 -1
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.js +0 -65
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.js.map +1 -1
- package/dist/libraries/primeng/18/rename-dropdown-to-select.d.ts.map +1 -1
- package/dist/libraries/primeng/18/rename-dropdown-to-select.js +0 -65
- package/dist/libraries/primeng/18/rename-dropdown-to-select.js.map +1 -1
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.d.ts.map +1 -1
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.js +0 -65
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.js.map +1 -1
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.d.ts.map +1 -1
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.js +0 -65
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.js.map +1 -1
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.d.ts.map +1 -1
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.js +0 -65
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.js.map +1 -1
- package/dist/migration/rename-after-render.d.ts +2 -2
- package/dist/migration/rename-after-render.d.ts.map +1 -1
- package/dist/migration/rename-after-render.js +9 -25
- package/dist/migration/rename-after-render.js.map +1 -1
- package/dist/migration/rename-check-no-changes.d.ts +2 -2
- package/dist/migration/rename-check-no-changes.d.ts.map +1 -1
- package/dist/migration/rename-check-no-changes.js +23 -19
- package/dist/migration/rename-check-no-changes.js.map +1 -1
- package/dist/migration/rename-pending-tasks.d.ts +2 -2
- package/dist/migration/rename-pending-tasks.d.ts.map +1 -1
- package/dist/migration/rename-pending-tasks.js +9 -22
- package/dist/migration/rename-pending-tasks.js.map +1 -1
- package/dist/migration/rename-zoneless-provider.d.ts +2 -2
- package/dist/migration/rename-zoneless-provider.d.ts.map +1 -1
- package/dist/migration/rename-zoneless-provider.js +9 -21
- package/dist/migration/rename-zoneless-provider.js.map +1 -1
- package/package.json +1 -1
- package/src/libraries/primeng/18/migrate-primeng-config.ts +2 -43
- package/src/libraries/primeng/18/rename-calendar-to-datepicker.ts +2 -50
- package/src/libraries/primeng/18/rename-dropdown-to-select.ts +2 -50
- package/src/libraries/primeng/18/rename-inputswitch-to-toggleswitch.ts +2 -50
- package/src/libraries/primeng/18/rename-overlaypanel-to-popover.ts +2 -50
- package/src/libraries/primeng/18/rename-sidebar-to-drawer.ts +2 -50
- package/src/migration/rename-after-render.ts +11 -24
- package/src/migration/rename-check-no-changes.ts +21 -18
- package/src/migration/rename-pending-tasks.ts +11 -22
- package/src/migration/rename-zoneless-provider.ts +11 -21
|
@@ -17,7 +17,6 @@ exports.RenameAfterRender = void 0;
|
|
|
17
17
|
*/
|
|
18
18
|
const rewrite_1 = require("@openrewrite/rewrite");
|
|
19
19
|
const javascript_1 = require("@openrewrite/rewrite/javascript");
|
|
20
|
-
const java_1 = require("@openrewrite/rewrite/java");
|
|
21
20
|
class RenameAfterRender extends rewrite_1.Recipe {
|
|
22
21
|
constructor() {
|
|
23
22
|
super(...arguments);
|
|
@@ -25,31 +24,16 @@ class RenameAfterRender extends rewrite_1.Recipe {
|
|
|
25
24
|
this.displayName = "Rename `afterRender` to `afterEveryRender`";
|
|
26
25
|
this.description = "Renames `afterRender` to `afterEveryRender` in imports and usages. The `afterRender` function was renamed to `afterEveryRender` in Angular 20, and Angular provides no migration schematic for this change.";
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
recipeList() {
|
|
29
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (m.name.simpleName === 'afterRender') {
|
|
39
|
-
const methodType = m.methodType;
|
|
40
|
-
if (((_a = methodType === null || methodType === void 0 ? void 0 : methodType.declaringType) === null || _a === void 0 ? void 0 : _a.kind) === java_1.Type.Kind.Class
|
|
41
|
-
&& methodType.declaringType.fullyQualifiedName === '@angular/core') {
|
|
42
|
-
(0, javascript_1.maybeAddImport)(this, { module: '@angular/core', member: 'afterEveryRender' });
|
|
43
|
-
(0, javascript_1.maybeRemoveImport)(this, '@angular/core', 'afterRender');
|
|
44
|
-
return (0, rewrite_1.produceAsync)(m, (draft) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
draft.name.simpleName = 'afterEveryRender';
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return m;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
29
|
+
return [
|
|
30
|
+
new javascript_1.ChangeImport({
|
|
31
|
+
oldModule: "@angular/core",
|
|
32
|
+
oldMember: "afterRender",
|
|
33
|
+
newModule: "@angular/core",
|
|
34
|
+
newMember: "afterEveryRender",
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
53
37
|
});
|
|
54
38
|
}
|
|
55
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-after-render.js","sourceRoot":"","sources":["../../src/migration/rename-after-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"rename-after-render.js","sourceRoot":"","sources":["../../src/migration/rename-after-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAA4C;AAC5C,gEAA6D;AAE7D,MAAa,iBAAkB,SAAQ,gBAAM;IAA7C;;QACa,SAAI,GAAG,uDAAuD,CAAC;QAC/D,gBAAW,GAAW,4CAA4C,CAAC;QACnE,gBAAW,GAAW,6MAA6M,CAAC;IAYjP,CAAC;IAVS,UAAU;;YACZ,OAAO;gBACH,IAAI,yBAAY,CAAC;oBACb,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,aAAa;oBACxB,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,kBAAkB;iBAChC,CAAC;aACL,CAAC;QACN,CAAC;KAAA;CACJ;AAfD,8CAeC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Recipe } from "@openrewrite/rewrite";
|
|
2
2
|
export declare class RenameCheckNoChanges extends Recipe {
|
|
3
3
|
readonly name = "org.openrewrite.angular.migration.rename-check-no-changes";
|
|
4
4
|
readonly displayName: string;
|
|
5
5
|
readonly description: string;
|
|
6
|
-
|
|
6
|
+
recipeList(): Promise<Recipe[]>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=rename-check-no-changes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-check-no-changes.d.ts","sourceRoot":"","sources":["../../src/migration/rename-check-no-changes.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"rename-check-no-changes.d.ts","sourceRoot":"","sources":["../../src/migration/rename-check-no-changes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAa3E,qBAAa,oBAAqB,SAAQ,MAAM;IAC5C,QAAQ,CAAC,IAAI,+DAA+D;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAyF;IACrH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAGoB;IAE1C,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAWxC"}
|
|
@@ -31,27 +31,32 @@ class RenameCheckNoChanges extends rewrite_1.Recipe {
|
|
|
31
31
|
"required, so it is added as `true` to match the Angular 19 default, dropped `useNgZoneOnStable`, and no longer accepts " +
|
|
32
32
|
"`interval` alongside `exhaustive: false`.";
|
|
33
33
|
}
|
|
34
|
+
recipeList() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return [
|
|
37
|
+
new MigrateCheckNoChangesOptions(),
|
|
38
|
+
new javascript_1.ChangeImport({
|
|
39
|
+
oldModule: "@angular/core",
|
|
40
|
+
oldMember: EXPERIMENTAL_PROVIDER,
|
|
41
|
+
newModule: "@angular/core",
|
|
42
|
+
newMember: STABLE_PROVIDER,
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.RenameCheckNoChanges = RenameCheckNoChanges;
|
|
49
|
+
class MigrateCheckNoChangesOptions extends rewrite_1.Recipe {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
this.name = "org.openrewrite.angular.migration.rename-check-no-changes.options";
|
|
53
|
+
this.displayName = "Migrate `provideExperimentalCheckNoChangesForDebug` options";
|
|
54
|
+
this.description = "Adds `exhaustive: true` where it is missing, and drops `useNgZoneOnStable` and any `interval` " +
|
|
55
|
+
"next to `exhaustive: false`, neither of which Angular 20's `provideCheckNoChangesConfig` accepts.";
|
|
56
|
+
}
|
|
34
57
|
editor() {
|
|
35
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
59
|
return new class extends javascript_1.JavaScriptVisitor {
|
|
37
|
-
visitIdentifier(identifier, p) {
|
|
38
|
-
const _super = Object.create(null, {
|
|
39
|
-
visitIdentifier: { get: () => super.visitIdentifier }
|
|
40
|
-
});
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
let id = yield _super.visitIdentifier.call(this, identifier, p);
|
|
43
|
-
if (!id)
|
|
44
|
-
return id;
|
|
45
|
-
if (id.simpleName === EXPERIMENTAL_PROVIDER) {
|
|
46
|
-
const bound = (0, javascript_1.maybeAddImport)(this, { module: '@angular/core', member: STABLE_PROVIDER });
|
|
47
|
-
(0, javascript_1.maybeRemoveImport)(this, '@angular/core', EXPERIMENTAL_PROVIDER);
|
|
48
|
-
return (0, rewrite_1.produceAsync)(id, (draft) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
draft.simpleName = bound !== null && bound !== void 0 ? bound : STABLE_PROVIDER;
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
return id;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
60
|
visitMethodInvocation(method, p) {
|
|
56
61
|
const _super = Object.create(null, {
|
|
57
62
|
visitMethodInvocation: { get: () => super.visitMethodInvocation }
|
|
@@ -92,7 +97,6 @@ class RenameCheckNoChanges extends rewrite_1.Recipe {
|
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
|
-
exports.RenameCheckNoChanges = RenameCheckNoChanges;
|
|
96
100
|
/** Reads an object literal's properties, returning `undefined` when any of them is not a plain `name: value` pair. */
|
|
97
101
|
function readProperties(options) {
|
|
98
102
|
const properties = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-check-no-changes.js","sourceRoot":"","sources":["../../src/migration/rename-check-no-changes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"rename-check-no-changes.js","sourceRoot":"","sources":["../../src/migration/rename-check-no-changes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAA2E;AAC3E,gEAA+G;AAC/G,oDAAiF;AACjF,uCAAgC;AAEhC,MAAM,qBAAqB,GAAG,2CAA2C,CAAC;AAC1E,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAOtD,MAAa,oBAAqB,SAAQ,gBAAM;IAAhD;;QACa,SAAI,GAAG,2DAA2D,CAAC;QACnE,gBAAW,GAAW,qFAAqF,CAAC;QAC5G,gBAAW,GAAW,8GAA8G;YACzI,uHAAuH;YACvH,yHAAyH;YACzH,2CA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 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Recipe } from "@openrewrite/rewrite";
|
|
2
2
|
export declare class RenamePendingTasks extends Recipe {
|
|
3
3
|
readonly name = "org.openrewrite.angular.migration.rename-pending-tasks";
|
|
4
4
|
readonly displayName: string;
|
|
5
5
|
readonly description: string;
|
|
6
|
-
|
|
6
|
+
recipeList(): Promise<Recipe[]>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=rename-pending-tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-pending-tasks.d.ts","sourceRoot":"","sources":["../../src/migration/rename-pending-tasks.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"rename-pending-tasks.d.ts","sourceRoot":"","sources":["../../src/migration/rename-pending-tasks.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAG5C,qBAAa,kBAAmB,SAAQ,MAAM;IAC1C,QAAQ,CAAC,IAAI,4DAA4D;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAyD;IACrF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAuI;IAE7J,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAUxC"}
|
|
@@ -17,7 +17,6 @@ exports.RenamePendingTasks = void 0;
|
|
|
17
17
|
*/
|
|
18
18
|
const rewrite_1 = require("@openrewrite/rewrite");
|
|
19
19
|
const javascript_1 = require("@openrewrite/rewrite/javascript");
|
|
20
|
-
const mutative_1 = require("mutative");
|
|
21
20
|
class RenamePendingTasks extends rewrite_1.Recipe {
|
|
22
21
|
constructor() {
|
|
23
22
|
super(...arguments);
|
|
@@ -25,28 +24,16 @@ class RenamePendingTasks extends rewrite_1.Recipe {
|
|
|
25
24
|
this.displayName = "Rename `ExperimentalPendingTasks` to `PendingTasks`";
|
|
26
25
|
this.description = "Renames `ExperimentalPendingTasks` to `PendingTasks` in imports and usages. `ExperimentalPendingTasks` was renamed in Angular 19.";
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
recipeList() {
|
|
29
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return id;
|
|
39
|
-
if (id.simpleName === 'ExperimentalPendingTasks') {
|
|
40
|
-
(0, javascript_1.maybeAddImport)(this, { module: '@angular/core', member: 'PendingTasks' });
|
|
41
|
-
(0, javascript_1.maybeRemoveImport)(this, '@angular/core', 'ExperimentalPendingTasks');
|
|
42
|
-
return (0, mutative_1.create)(id, draft => {
|
|
43
|
-
draft.simpleName = 'PendingTasks';
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return id;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}();
|
|
29
|
+
return [
|
|
30
|
+
new javascript_1.ChangeImport({
|
|
31
|
+
oldModule: "@angular/core",
|
|
32
|
+
oldMember: "ExperimentalPendingTasks",
|
|
33
|
+
newModule: "@angular/core",
|
|
34
|
+
newMember: "PendingTasks",
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
50
37
|
});
|
|
51
38
|
}
|
|
52
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-pending-tasks.js","sourceRoot":"","sources":["../../src/migration/rename-pending-tasks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"rename-pending-tasks.js","sourceRoot":"","sources":["../../src/migration/rename-pending-tasks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAA4C;AAC5C,gEAA6D;AAE7D,MAAa,kBAAmB,SAAQ,gBAAM;IAA9C;;QACa,SAAI,GAAG,wDAAwD,CAAC;QAChE,gBAAW,GAAW,qDAAqD,CAAC;QAC5E,gBAAW,GAAW,mIAAmI,CAAC;IAYvK,CAAC;IAVS,UAAU;;YACZ,OAAO;gBACH,IAAI,yBAAY,CAAC;oBACb,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,0BAA0B;oBACrC,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,cAAc;iBAC5B,CAAC;aACL,CAAC;QACN,CAAC;KAAA;CACJ;AAfD,gDAeC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Recipe } from "@openrewrite/rewrite";
|
|
2
2
|
export declare class RenameZonelessProvider extends Recipe {
|
|
3
3
|
readonly name = "org.openrewrite.angular.migration.rename-zoneless-provider";
|
|
4
4
|
readonly displayName: string;
|
|
5
5
|
readonly description: string;
|
|
6
|
-
|
|
6
|
+
recipeList(): Promise<Recipe[]>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=rename-zoneless-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-zoneless-provider.d.ts","sourceRoot":"","sources":["../../src/migration/rename-zoneless-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"rename-zoneless-provider.d.ts","sourceRoot":"","sources":["../../src/migration/rename-zoneless-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAG5C,qBAAa,sBAAuB,SAAQ,MAAM;IAC9C,QAAQ,CAAC,IAAI,gEAAgE;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA6F;IACzH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA2L;IAEjN,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAUxC"}
|
|
@@ -24,28 +24,16 @@ class RenameZonelessProvider extends rewrite_1.Recipe {
|
|
|
24
24
|
this.displayName = "Rename `provideExperimentalZonelessChangeDetection` to `provideZonelessChangeDetection`";
|
|
25
25
|
this.description = "Renames `provideExperimentalZonelessChangeDetection` to `provideZonelessChangeDetection` in imports and usages. The experimental API was promoted to developer preview in Angular 20.";
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
recipeList() {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return id;
|
|
38
|
-
if (id.simpleName === 'provideExperimentalZonelessChangeDetection') {
|
|
39
|
-
(0, javascript_1.maybeAddImport)(this, { module: '@angular/core', member: 'provideZonelessChangeDetection' });
|
|
40
|
-
(0, javascript_1.maybeRemoveImport)(this, '@angular/core', 'provideExperimentalZonelessChangeDetection');
|
|
41
|
-
return (0, rewrite_1.produceAsync)(id, (draft) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
draft.simpleName = 'provideZonelessChangeDetection';
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
return id;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}();
|
|
29
|
+
return [
|
|
30
|
+
new javascript_1.ChangeImport({
|
|
31
|
+
oldModule: "@angular/core",
|
|
32
|
+
oldMember: "provideExperimentalZonelessChangeDetection",
|
|
33
|
+
newModule: "@angular/core",
|
|
34
|
+
newMember: "provideZonelessChangeDetection",
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
49
37
|
});
|
|
50
38
|
}
|
|
51
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-zoneless-provider.js","sourceRoot":"","sources":["../../src/migration/rename-zoneless-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"rename-zoneless-provider.js","sourceRoot":"","sources":["../../src/migration/rename-zoneless-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAA4C;AAC5C,gEAA6D;AAE7D,MAAa,sBAAuB,SAAQ,gBAAM;IAAlD;;QACa,SAAI,GAAG,4DAA4D,CAAC;QACpE,gBAAW,GAAW,yFAAyF,CAAC;QAChH,gBAAW,GAAW,uLAAuL,CAAC;IAY3N,CAAC;IAVS,UAAU;;YACZ,OAAO;gBACH,IAAI,yBAAY,CAAC;oBACb,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,4CAA4C;oBACvD,SAAS,EAAE,eAAe;oBAC1B,SAAS,EAAE,gCAAgC;iBAC9C,CAAC;aACL,CAAC;QACN,CAAC;KAAA;CACJ;AAfD,wDAeC"}
|
package/package.json
CHANGED
|
@@ -4,52 +4,12 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {ExecutionContext, foundSearchResult,
|
|
8
|
-
import {ChangeImport, JavaScriptVisitor
|
|
7
|
+
import {ExecutionContext, foundSearchResult, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
10
|
|
|
11
11
|
const CONFIG_NAMES = new Set(['PrimeNGConfig', 'PrimeNG']);
|
|
12
12
|
|
|
13
|
-
class RenamePrimeNGConfigIdentifiers extends Recipe {
|
|
14
|
-
readonly name = "org.openrewrite.primeng.MigratePrimeNgConfigToPrimeNG.identifiers";
|
|
15
|
-
readonly displayName = "Rename `PrimeNGConfig` identifiers to `PrimeNG`";
|
|
16
|
-
readonly description = "Renames `PrimeNGConfig` identifier usages in files importing it from `primeng/api`.";
|
|
17
|
-
|
|
18
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
19
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
20
|
-
private hasImport = false;
|
|
21
|
-
|
|
22
|
-
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
23
|
-
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
24
|
-
if (!imp?.moduleSpecifier) return imp;
|
|
25
|
-
const moduleSpec = imp.moduleSpecifier.element;
|
|
26
|
-
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
27
|
-
if ((moduleSpec as J.Literal).value !== "primeng/api") return imp;
|
|
28
|
-
|
|
29
|
-
const namedBindings = imp.importClause?.namedBindings;
|
|
30
|
-
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
31
|
-
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
32
|
-
const spec = specifier.element as JS.ImportSpecifier;
|
|
33
|
-
if (isIdentifier(spec.specifier) && (spec.specifier as J.Identifier).simpleName === 'PrimeNGConfig') {
|
|
34
|
-
this.hasImport = true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return imp;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
override async visitIdentifier(identifier: J.Identifier, p: ExecutionContext): Promise<J | undefined> {
|
|
42
|
-
const id = await super.visitIdentifier(identifier, p) as J.Identifier;
|
|
43
|
-
if (!id) return id;
|
|
44
|
-
if (this.hasImport && id.simpleName === 'PrimeNGConfig') {
|
|
45
|
-
return produceAsync(id, async draft => { draft.simpleName = 'PrimeNG'; });
|
|
46
|
-
}
|
|
47
|
-
return id;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
13
|
class FindPrimeNGConfigInjection extends Recipe {
|
|
54
14
|
readonly name = "org.openrewrite.primeng.MigratePrimeNgConfigToPrimeNG.find-injection";
|
|
55
15
|
readonly displayName = "Find `PrimeNGConfig` / `PrimeNG` service injection";
|
|
@@ -99,7 +59,6 @@ export class MigratePrimeNgConfigToPrimeNG extends Recipe {
|
|
|
99
59
|
|
|
100
60
|
async recipeList(): Promise<Recipe[]> {
|
|
101
61
|
return [
|
|
102
|
-
new RenamePrimeNGConfigIdentifiers(),
|
|
103
62
|
new ChangeImport({
|
|
104
63
|
oldModule: "primeng/api",
|
|
105
64
|
oldMember: "PrimeNGConfig",
|
|
@@ -4,55 +4,8 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {ChangeImport
|
|
9
|
-
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
-
|
|
11
|
-
const RENAMES: Record<string, string> = {
|
|
12
|
-
Calendar: "DatePicker",
|
|
13
|
-
CalendarModule: "DatePickerModule",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
class RenameCalendarIdentifiers extends Recipe {
|
|
17
|
-
readonly name = "org.openrewrite.primeng.RenameCalendarToDatePicker.identifiers";
|
|
18
|
-
readonly displayName = "Rename `Calendar` identifiers to `DatePicker`";
|
|
19
|
-
readonly description = "Renames `Calendar` and `CalendarModule` identifier usages in files importing them from `primeng/calendar`.";
|
|
20
|
-
|
|
21
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
23
|
-
private importedNames = new Set<string>();
|
|
24
|
-
|
|
25
|
-
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
26
|
-
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
27
|
-
if (!imp?.moduleSpecifier) return imp;
|
|
28
|
-
const moduleSpec = imp.moduleSpecifier.element;
|
|
29
|
-
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
30
|
-
if ((moduleSpec as J.Literal).value !== "primeng/calendar") return imp;
|
|
31
|
-
|
|
32
|
-
const namedBindings = imp.importClause?.namedBindings;
|
|
33
|
-
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
34
|
-
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
35
|
-
const spec = specifier.element as JS.ImportSpecifier;
|
|
36
|
-
if (isIdentifier(spec.specifier) && RENAMES[(spec.specifier as J.Identifier).simpleName]) {
|
|
37
|
-
this.importedNames.add((spec.specifier as J.Identifier).simpleName);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return imp;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override async visitIdentifier(identifier: J.Identifier, p: ExecutionContext): Promise<J | undefined> {
|
|
45
|
-
const id = await super.visitIdentifier(identifier, p) as J.Identifier;
|
|
46
|
-
if (!id) return id;
|
|
47
|
-
if (this.importedNames.has(id.simpleName) && RENAMES[id.simpleName]) {
|
|
48
|
-
const newName = RENAMES[id.simpleName];
|
|
49
|
-
return produceAsync(id, async draft => { draft.simpleName = newName; });
|
|
50
|
-
}
|
|
51
|
-
return id;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport} from "@openrewrite/rewrite/javascript";
|
|
56
9
|
|
|
57
10
|
export class RenameCalendarToDatePicker extends Recipe {
|
|
58
11
|
readonly name = "org.openrewrite.primeng.RenameCalendarToDatePicker";
|
|
@@ -63,7 +16,6 @@ export class RenameCalendarToDatePicker extends Recipe {
|
|
|
63
16
|
|
|
64
17
|
async recipeList(): Promise<Recipe[]> {
|
|
65
18
|
return [
|
|
66
|
-
new RenameCalendarIdentifiers(),
|
|
67
19
|
new ChangeImport({
|
|
68
20
|
oldModule: "primeng/calendar",
|
|
69
21
|
oldMember: "CalendarModule",
|
|
@@ -4,55 +4,8 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {ChangeImport
|
|
9
|
-
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
-
|
|
11
|
-
const RENAMES: Record<string, string> = {
|
|
12
|
-
Dropdown: "Select",
|
|
13
|
-
DropdownModule: "SelectModule",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
class RenameDropdownIdentifiers extends Recipe {
|
|
17
|
-
readonly name = "org.openrewrite.primeng.RenameDropdownToSelect.identifiers";
|
|
18
|
-
readonly displayName = "Rename `Dropdown` identifiers to `Select`";
|
|
19
|
-
readonly description = "Renames `Dropdown` and `DropdownModule` identifier usages in files importing them from `primeng/dropdown`.";
|
|
20
|
-
|
|
21
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
23
|
-
private importedNames = new Set<string>();
|
|
24
|
-
|
|
25
|
-
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
26
|
-
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
27
|
-
if (!imp?.moduleSpecifier) return imp;
|
|
28
|
-
const moduleSpec = imp.moduleSpecifier.element;
|
|
29
|
-
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
30
|
-
if ((moduleSpec as J.Literal).value !== "primeng/dropdown") return imp;
|
|
31
|
-
|
|
32
|
-
const namedBindings = imp.importClause?.namedBindings;
|
|
33
|
-
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
34
|
-
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
35
|
-
const spec = specifier.element as JS.ImportSpecifier;
|
|
36
|
-
if (isIdentifier(spec.specifier) && RENAMES[(spec.specifier as J.Identifier).simpleName]) {
|
|
37
|
-
this.importedNames.add((spec.specifier as J.Identifier).simpleName);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return imp;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override async visitIdentifier(identifier: J.Identifier, p: ExecutionContext): Promise<J | undefined> {
|
|
45
|
-
const id = await super.visitIdentifier(identifier, p) as J.Identifier;
|
|
46
|
-
if (!id) return id;
|
|
47
|
-
if (this.importedNames.has(id.simpleName) && RENAMES[id.simpleName]) {
|
|
48
|
-
const newName = RENAMES[id.simpleName];
|
|
49
|
-
return produceAsync(id, async draft => { draft.simpleName = newName; });
|
|
50
|
-
}
|
|
51
|
-
return id;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport} from "@openrewrite/rewrite/javascript";
|
|
56
9
|
|
|
57
10
|
export class RenameDropdownToSelect extends Recipe {
|
|
58
11
|
readonly name = "org.openrewrite.primeng.RenameDropdownToSelect";
|
|
@@ -63,7 +16,6 @@ export class RenameDropdownToSelect extends Recipe {
|
|
|
63
16
|
|
|
64
17
|
async recipeList(): Promise<Recipe[]> {
|
|
65
18
|
return [
|
|
66
|
-
new RenameDropdownIdentifiers(),
|
|
67
19
|
new ChangeImport({
|
|
68
20
|
oldModule: "primeng/dropdown",
|
|
69
21
|
oldMember: "DropdownModule",
|
|
@@ -4,55 +4,8 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {ChangeImport
|
|
9
|
-
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
-
|
|
11
|
-
const RENAMES: Record<string, string> = {
|
|
12
|
-
InputSwitch: "ToggleSwitch",
|
|
13
|
-
InputSwitchModule: "ToggleSwitchModule",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
class RenameInputSwitchIdentifiers extends Recipe {
|
|
17
|
-
readonly name = "org.openrewrite.primeng.RenameInputSwitchToToggleSwitch.identifiers";
|
|
18
|
-
readonly displayName = "Rename `InputSwitch` identifiers to `ToggleSwitch`";
|
|
19
|
-
readonly description = "Renames `InputSwitch` and `InputSwitchModule` identifier usages in files importing them from `primeng/inputswitch`.";
|
|
20
|
-
|
|
21
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
23
|
-
private importedNames = new Set<string>();
|
|
24
|
-
|
|
25
|
-
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
26
|
-
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
27
|
-
if (!imp?.moduleSpecifier) return imp;
|
|
28
|
-
const moduleSpec = imp.moduleSpecifier.element;
|
|
29
|
-
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
30
|
-
if ((moduleSpec as J.Literal).value !== "primeng/inputswitch") return imp;
|
|
31
|
-
|
|
32
|
-
const namedBindings = imp.importClause?.namedBindings;
|
|
33
|
-
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
34
|
-
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
35
|
-
const spec = specifier.element as JS.ImportSpecifier;
|
|
36
|
-
if (isIdentifier(spec.specifier) && RENAMES[(spec.specifier as J.Identifier).simpleName]) {
|
|
37
|
-
this.importedNames.add((spec.specifier as J.Identifier).simpleName);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return imp;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override async visitIdentifier(identifier: J.Identifier, p: ExecutionContext): Promise<J | undefined> {
|
|
45
|
-
const id = await super.visitIdentifier(identifier, p) as J.Identifier;
|
|
46
|
-
if (!id) return id;
|
|
47
|
-
if (this.importedNames.has(id.simpleName) && RENAMES[id.simpleName]) {
|
|
48
|
-
const newName = RENAMES[id.simpleName];
|
|
49
|
-
return produceAsync(id, async draft => { draft.simpleName = newName; });
|
|
50
|
-
}
|
|
51
|
-
return id;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport} from "@openrewrite/rewrite/javascript";
|
|
56
9
|
|
|
57
10
|
export class RenameInputSwitchToToggleSwitch extends Recipe {
|
|
58
11
|
readonly name = "org.openrewrite.primeng.RenameInputSwitchToToggleSwitch";
|
|
@@ -63,7 +16,6 @@ export class RenameInputSwitchToToggleSwitch extends Recipe {
|
|
|
63
16
|
|
|
64
17
|
async recipeList(): Promise<Recipe[]> {
|
|
65
18
|
return [
|
|
66
|
-
new RenameInputSwitchIdentifiers(),
|
|
67
19
|
new ChangeImport({
|
|
68
20
|
oldModule: "primeng/inputswitch",
|
|
69
21
|
oldMember: "InputSwitchModule",
|
|
@@ -4,55 +4,8 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {ChangeImport
|
|
9
|
-
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
-
|
|
11
|
-
const RENAMES: Record<string, string> = {
|
|
12
|
-
OverlayPanel: "Popover",
|
|
13
|
-
OverlayPanelModule: "PopoverModule",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
class RenameOverlayPanelIdentifiers extends Recipe {
|
|
17
|
-
readonly name = "org.openrewrite.primeng.RenameOverlayPanelToPopover.identifiers";
|
|
18
|
-
readonly displayName = "Rename `OverlayPanel` identifiers to `Popover`";
|
|
19
|
-
readonly description = "Renames `OverlayPanel` and `OverlayPanelModule` identifier usages in files importing them from `primeng/overlaypanel`.";
|
|
20
|
-
|
|
21
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
23
|
-
private importedNames = new Set<string>();
|
|
24
|
-
|
|
25
|
-
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
26
|
-
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
27
|
-
if (!imp?.moduleSpecifier) return imp;
|
|
28
|
-
const moduleSpec = imp.moduleSpecifier.element;
|
|
29
|
-
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
30
|
-
if ((moduleSpec as J.Literal).value !== "primeng/overlaypanel") return imp;
|
|
31
|
-
|
|
32
|
-
const namedBindings = imp.importClause?.namedBindings;
|
|
33
|
-
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
34
|
-
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
35
|
-
const spec = specifier.element as JS.ImportSpecifier;
|
|
36
|
-
if (isIdentifier(spec.specifier) && RENAMES[(spec.specifier as J.Identifier).simpleName]) {
|
|
37
|
-
this.importedNames.add((spec.specifier as J.Identifier).simpleName);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return imp;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override async visitIdentifier(identifier: J.Identifier, p: ExecutionContext): Promise<J | undefined> {
|
|
45
|
-
const id = await super.visitIdentifier(identifier, p) as J.Identifier;
|
|
46
|
-
if (!id) return id;
|
|
47
|
-
if (this.importedNames.has(id.simpleName) && RENAMES[id.simpleName]) {
|
|
48
|
-
const newName = RENAMES[id.simpleName];
|
|
49
|
-
return produceAsync(id, async draft => { draft.simpleName = newName; });
|
|
50
|
-
}
|
|
51
|
-
return id;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport} from "@openrewrite/rewrite/javascript";
|
|
56
9
|
|
|
57
10
|
export class RenameOverlayPanelToPopover extends Recipe {
|
|
58
11
|
readonly name = "org.openrewrite.primeng.RenameOverlayPanelToPopover";
|
|
@@ -63,7 +16,6 @@ export class RenameOverlayPanelToPopover extends Recipe {
|
|
|
63
16
|
|
|
64
17
|
async recipeList(): Promise<Recipe[]> {
|
|
65
18
|
return [
|
|
66
|
-
new RenameOverlayPanelIdentifiers(),
|
|
67
19
|
new ChangeImport({
|
|
68
20
|
oldModule: "primeng/overlaypanel",
|
|
69
21
|
oldMember: "OverlayPanelModule",
|