@openrewrite/recipes-angular 1.1.4 → 1.1.5
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 +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -1
- package/dist/index.js.map +1 -1
- package/dist/libraries/primeng/18/add-primeng-provider.d.ts +45 -0
- package/dist/libraries/primeng/18/add-primeng-provider.d.ts.map +1 -0
- package/dist/libraries/primeng/18/add-primeng-provider.js +354 -0
- package/dist/libraries/primeng/18/add-primeng-provider.js.map +1 -0
- package/dist/libraries/primeng/18/index.d.ts +19 -0
- package/dist/libraries/primeng/18/index.d.ts.map +1 -0
- package/dist/libraries/primeng/18/index.js +45 -0
- package/dist/libraries/primeng/18/index.js.map +1 -0
- package/dist/libraries/primeng/18/manual-migration-steps.d.ts +19 -0
- package/dist/libraries/primeng/18/manual-migration-steps.d.ts.map +1 -0
- package/dist/libraries/primeng/18/manual-migration-steps.js +45 -0
- package/dist/libraries/primeng/18/manual-migration-steps.js.map +1 -0
- package/dist/libraries/primeng/18/mark-deprecated-components.d.ts +9 -0
- package/dist/libraries/primeng/18/mark-deprecated-components.d.ts.map +1 -0
- package/dist/libraries/primeng/18/mark-deprecated-components.js +125 -0
- package/dist/libraries/primeng/18/mark-deprecated-components.js.map +1 -0
- package/dist/libraries/primeng/18/mark-deprecated-css-classes.d.ts +15 -0
- package/dist/libraries/primeng/18/mark-deprecated-css-classes.d.ts.map +1 -0
- package/dist/libraries/primeng/18/mark-deprecated-css-classes.js +108 -0
- package/dist/libraries/primeng/18/mark-deprecated-css-classes.js.map +1 -0
- package/dist/libraries/primeng/18/mark-drawer-size.d.ts +16 -0
- package/dist/libraries/primeng/18/mark-drawer-size.d.ts.map +1 -0
- package/dist/libraries/primeng/18/mark-drawer-size.js +90 -0
- package/dist/libraries/primeng/18/mark-drawer-size.js.map +1 -0
- package/dist/libraries/primeng/18/mark-removed-primeng-modules.d.ts +9 -0
- package/dist/libraries/primeng/18/mark-removed-primeng-modules.d.ts.map +1 -0
- package/dist/libraries/primeng/18/mark-removed-primeng-modules.js +186 -0
- package/dist/libraries/primeng/18/mark-removed-primeng-modules.js.map +1 -0
- package/dist/libraries/primeng/18/migrate-messages-to-message-loop.d.ts +15 -0
- package/dist/libraries/primeng/18/migrate-messages-to-message-loop.d.ts.map +1 -0
- package/dist/libraries/primeng/18/migrate-messages-to-message-loop.js +78 -0
- package/dist/libraries/primeng/18/migrate-messages-to-message-loop.js.map +1 -0
- package/dist/libraries/primeng/18/migrate-p-fluid-to-wrapper.d.ts +27 -0
- package/dist/libraries/primeng/18/migrate-p-fluid-to-wrapper.d.ts.map +1 -0
- package/dist/libraries/primeng/18/migrate-p-fluid-to-wrapper.js +495 -0
- package/dist/libraries/primeng/18/migrate-p-fluid-to-wrapper.js.map +1 -0
- package/dist/libraries/primeng/18/migrate-primeng-config.d.ts +8 -0
- package/dist/libraries/primeng/18/migrate-primeng-config.d.ts.map +1 -0
- package/dist/libraries/primeng/18/migrate-primeng-config.js +154 -0
- package/dist/libraries/primeng/18/migrate-primeng-config.js.map +1 -0
- package/dist/libraries/primeng/18/migrate-primeng-signal-assignments.d.ts +12 -0
- package/dist/libraries/primeng/18/migrate-primeng-signal-assignments.d.ts.map +1 -0
- package/dist/libraries/primeng/18/migrate-primeng-signal-assignments.js +112 -0
- package/dist/libraries/primeng/18/migrate-primeng-signal-assignments.js.map +1 -0
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.js +114 -0
- package/dist/libraries/primeng/18/rename-calendar-to-datepicker.js.map +1 -0
- package/dist/libraries/primeng/18/rename-dropdown-to-select.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-dropdown-to-select.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-dropdown-to-select.js +114 -0
- package/dist/libraries/primeng/18/rename-dropdown-to-select.js.map +1 -0
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.js +114 -0
- package/dist/libraries/primeng/18/rename-inputswitch-to-toggleswitch.js.map +1 -0
- package/dist/libraries/primeng/18/rename-message-interface.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-message-interface.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-message-interface.js +107 -0
- package/dist/libraries/primeng/18/rename-message-interface.js.map +1 -0
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.js +114 -0
- package/dist/libraries/primeng/18/rename-overlaypanel-to-popover.js.map +1 -0
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.d.ts +8 -0
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.js +114 -0
- package/dist/libraries/primeng/18/rename-sidebar-to-drawer.js.map +1 -0
- package/dist/libraries/primeng/18/rename-template-selectors.d.ts +12 -0
- package/dist/libraries/primeng/18/rename-template-selectors.d.ts.map +1 -0
- package/dist/libraries/primeng/18/rename-template-selectors.js +79 -0
- package/dist/libraries/primeng/18/rename-template-selectors.js.map +1 -0
- package/dist/libraries/primeng/18/upgrade-components-to-18.d.ts +8 -0
- package/dist/libraries/primeng/18/upgrade-components-to-18.d.ts.map +1 -0
- package/dist/libraries/primeng/18/upgrade-components-to-18.js +73 -0
- package/dist/libraries/primeng/18/upgrade-components-to-18.js.map +1 -0
- package/dist/libraries/primeng/18/upgrade-to-primeng-18.d.ts +8 -0
- package/dist/libraries/primeng/18/upgrade-to-primeng-18.d.ts.map +1 -0
- package/dist/libraries/primeng/18/upgrade-to-primeng-18.js +68 -0
- package/dist/libraries/primeng/18/upgrade-to-primeng-18.js.map +1 -0
- package/dist/migration/replace-untyped-forms.d.ts +14 -2
- package/dist/migration/replace-untyped-forms.d.ts.map +1 -1
- package/dist/migration/replace-untyped-forms.js +108 -36
- package/dist/migration/replace-untyped-forms.js.map +1 -1
- package/dist/migration/upgrade-angular-peer-libs-to-18.d.ts +17 -0
- package/dist/migration/upgrade-angular-peer-libs-to-18.d.ts.map +1 -0
- package/dist/migration/upgrade-angular-peer-libs-to-18.js +49 -0
- package/dist/migration/upgrade-angular-peer-libs-to-18.js.map +1 -0
- package/dist/migration/upgrade-to-angular-18.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-18.js +16 -7
- package/dist/migration/upgrade-to-angular-18.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +57 -0
- package/src/libraries/primeng/18/add-primeng-provider.ts +359 -0
- package/src/libraries/primeng/18/index.ts +24 -0
- package/src/libraries/primeng/18/manual-migration-steps.ts +37 -0
- package/src/libraries/primeng/18/mark-deprecated-components.ts +128 -0
- package/src/libraries/primeng/18/mark-deprecated-css-classes.ts +109 -0
- package/src/libraries/primeng/18/mark-drawer-size.ts +85 -0
- package/src/libraries/primeng/18/mark-removed-primeng-modules.ts +198 -0
- package/src/libraries/primeng/18/migrate-messages-to-message-loop.ts +72 -0
- package/src/libraries/primeng/18/migrate-p-fluid-to-wrapper.ts +439 -0
- package/src/libraries/primeng/18/migrate-primeng-config.ts +112 -0
- package/src/libraries/primeng/18/migrate-primeng-signal-assignments.ts +83 -0
- package/src/libraries/primeng/18/rename-calendar-to-datepicker.ts +81 -0
- package/src/libraries/primeng/18/rename-dropdown-to-select.ts +81 -0
- package/src/libraries/primeng/18/rename-inputswitch-to-toggleswitch.ts +81 -0
- package/src/libraries/primeng/18/rename-message-interface.ts +78 -0
- package/src/libraries/primeng/18/rename-overlaypanel-to-popover.ts +81 -0
- package/src/libraries/primeng/18/rename-sidebar-to-drawer.ts +81 -0
- package/src/libraries/primeng/18/rename-template-selectors.ts +63 -0
- package/src/libraries/primeng/18/upgrade-components-to-18.ts +57 -0
- package/src/libraries/primeng/18/upgrade-to-primeng-18.ts +52 -0
- package/src/migration/replace-untyped-forms.ts +111 -39
- package/src/migration/upgrade-angular-peer-libs-to-18.ts +33 -0
- package/src/migration/upgrade-to-angular-18.ts +16 -7
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
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
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RenameCalendarToDatePicker extends Recipe {
|
|
58
|
+
readonly name = "org.openrewrite.primeng.RenameCalendarToDatePicker";
|
|
59
|
+
readonly displayName = "Rename `Calendar` to `DatePicker`";
|
|
60
|
+
readonly description = "Renames `Calendar` and `CalendarModule` imports from `primeng/calendar` " +
|
|
61
|
+
"to `DatePicker` and `DatePickerModule` from `primeng/datepicker`, and updates all identifier usages. " +
|
|
62
|
+
"The old names are deprecated in PrimeNG 18.";
|
|
63
|
+
|
|
64
|
+
async recipeList(): Promise<Recipe[]> {
|
|
65
|
+
return [
|
|
66
|
+
new RenameCalendarIdentifiers(),
|
|
67
|
+
new ChangeImport({
|
|
68
|
+
oldModule: "primeng/calendar",
|
|
69
|
+
oldMember: "CalendarModule",
|
|
70
|
+
newModule: "primeng/datepicker",
|
|
71
|
+
newMember: "DatePickerModule",
|
|
72
|
+
}),
|
|
73
|
+
new ChangeImport({
|
|
74
|
+
oldModule: "primeng/calendar",
|
|
75
|
+
oldMember: "Calendar",
|
|
76
|
+
newModule: "primeng/datepicker",
|
|
77
|
+
newMember: "DatePicker",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
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
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RenameDropdownToSelect extends Recipe {
|
|
58
|
+
readonly name = "org.openrewrite.primeng.RenameDropdownToSelect";
|
|
59
|
+
readonly displayName = "Rename `Dropdown` to `Select`";
|
|
60
|
+
readonly description = "Renames `Dropdown` and `DropdownModule` imports from `primeng/dropdown` " +
|
|
61
|
+
"to `Select` and `SelectModule` from `primeng/select`, and updates all identifier usages. " +
|
|
62
|
+
"The old names are deprecated in PrimeNG 18.";
|
|
63
|
+
|
|
64
|
+
async recipeList(): Promise<Recipe[]> {
|
|
65
|
+
return [
|
|
66
|
+
new RenameDropdownIdentifiers(),
|
|
67
|
+
new ChangeImport({
|
|
68
|
+
oldModule: "primeng/dropdown",
|
|
69
|
+
oldMember: "DropdownModule",
|
|
70
|
+
newModule: "primeng/select",
|
|
71
|
+
newMember: "SelectModule",
|
|
72
|
+
}),
|
|
73
|
+
new ChangeImport({
|
|
74
|
+
oldModule: "primeng/dropdown",
|
|
75
|
+
oldMember: "Dropdown",
|
|
76
|
+
newModule: "primeng/select",
|
|
77
|
+
newMember: "Select",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
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
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RenameInputSwitchToToggleSwitch extends Recipe {
|
|
58
|
+
readonly name = "org.openrewrite.primeng.RenameInputSwitchToToggleSwitch";
|
|
59
|
+
readonly displayName = "Rename `InputSwitch` to `ToggleSwitch`";
|
|
60
|
+
readonly description = "Renames `InputSwitch` and `InputSwitchModule` imports from `primeng/inputswitch` " +
|
|
61
|
+
"to `ToggleSwitch` and `ToggleSwitchModule` from `primeng/toggleswitch`, and updates all identifier usages. " +
|
|
62
|
+
"The old names are deprecated in PrimeNG 18.";
|
|
63
|
+
|
|
64
|
+
async recipeList(): Promise<Recipe[]> {
|
|
65
|
+
return [
|
|
66
|
+
new RenameInputSwitchIdentifiers(),
|
|
67
|
+
new ChangeImport({
|
|
68
|
+
oldModule: "primeng/inputswitch",
|
|
69
|
+
oldMember: "InputSwitchModule",
|
|
70
|
+
newModule: "primeng/toggleswitch",
|
|
71
|
+
newMember: "ToggleSwitchModule",
|
|
72
|
+
}),
|
|
73
|
+
new ChangeImport({
|
|
74
|
+
oldModule: "primeng/inputswitch",
|
|
75
|
+
oldMember: "InputSwitch",
|
|
76
|
+
newModule: "primeng/toggleswitch",
|
|
77
|
+
newMember: "ToggleSwitch",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
|
+
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
+
|
|
11
|
+
class RenameMessageIdentifiers extends Recipe {
|
|
12
|
+
readonly name = "org.openrewrite.primeng.RenameMessageInterface.rename-identifiers";
|
|
13
|
+
readonly displayName = "Rename `Message` identifiers to `ToastMessageOptions`";
|
|
14
|
+
readonly description = "Renames all `Message` identifier usages originating from `primeng/api` to `ToastMessageOptions`.";
|
|
15
|
+
|
|
16
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
17
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
18
|
+
private hasMessageImport = false;
|
|
19
|
+
|
|
20
|
+
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
21
|
+
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
22
|
+
if (!imp?.moduleSpecifier) return imp;
|
|
23
|
+
|
|
24
|
+
const moduleSpec = imp.moduleSpecifier.element;
|
|
25
|
+
if (moduleSpec.kind !== J.Kind.Literal) return imp;
|
|
26
|
+
|
|
27
|
+
const moduleName = (moduleSpec as J.Literal).value as string;
|
|
28
|
+
if (moduleName !== 'primeng/api') return imp;
|
|
29
|
+
|
|
30
|
+
const namedBindings = imp.importClause?.namedBindings;
|
|
31
|
+
if (namedBindings?.kind === JS.Kind.NamedImports) {
|
|
32
|
+
const named = namedBindings as JS.NamedImports;
|
|
33
|
+
for (const specifier of named.elements.elements) {
|
|
34
|
+
const spec = specifier.element as JS.ImportSpecifier;
|
|
35
|
+
if (isIdentifier(spec.specifier) && spec.specifier.simpleName === 'Message') {
|
|
36
|
+
this.hasMessageImport = true;
|
|
37
|
+
}
|
|
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
|
+
|
|
48
|
+
if (this.hasMessageImport && id.simpleName === 'Message') {
|
|
49
|
+
return produceAsync(id, async draft => {
|
|
50
|
+
draft.simpleName = 'ToastMessageOptions';
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return id;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class RenameMessageInterface extends Recipe {
|
|
61
|
+
readonly name = "org.openrewrite.primeng.RenameMessageInterface";
|
|
62
|
+
readonly displayName = "Rename `Message` interface to `ToastMessageOptions`";
|
|
63
|
+
readonly description = "Renames the `Message` interface import from `primeng/api` to `ToastMessageOptions` " +
|
|
64
|
+
"and updates all identifier usages. " +
|
|
65
|
+
"The `Message` interface was renamed in PrimeNG 18 due to name collision with the `Message` component.";
|
|
66
|
+
|
|
67
|
+
async recipeList(): Promise<Recipe[]> {
|
|
68
|
+
return [
|
|
69
|
+
new RenameMessageIdentifiers(),
|
|
70
|
+
new ChangeImport({
|
|
71
|
+
oldModule: "primeng/api",
|
|
72
|
+
oldMember: "Message",
|
|
73
|
+
newModule: "primeng/api",
|
|
74
|
+
newMember: "ToastMessageOptions",
|
|
75
|
+
}),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
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
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RenameOverlayPanelToPopover extends Recipe {
|
|
58
|
+
readonly name = "org.openrewrite.primeng.RenameOverlayPanelToPopover";
|
|
59
|
+
readonly displayName = "Rename `OverlayPanel` to `Popover`";
|
|
60
|
+
readonly description = "Renames `OverlayPanel` and `OverlayPanelModule` imports from `primeng/overlaypanel` " +
|
|
61
|
+
"to `Popover` and `PopoverModule` from `primeng/popover`, and updates all identifier usages. " +
|
|
62
|
+
"The old names are deprecated in PrimeNG 18.";
|
|
63
|
+
|
|
64
|
+
async recipeList(): Promise<Recipe[]> {
|
|
65
|
+
return [
|
|
66
|
+
new RenameOverlayPanelIdentifiers(),
|
|
67
|
+
new ChangeImport({
|
|
68
|
+
oldModule: "primeng/overlaypanel",
|
|
69
|
+
oldMember: "OverlayPanelModule",
|
|
70
|
+
newModule: "primeng/popover",
|
|
71
|
+
newMember: "PopoverModule",
|
|
72
|
+
}),
|
|
73
|
+
new ChangeImport({
|
|
74
|
+
oldModule: "primeng/overlaypanel",
|
|
75
|
+
oldMember: "OverlayPanel",
|
|
76
|
+
newModule: "primeng/popover",
|
|
77
|
+
newMember: "Popover",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, produceAsync, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
|
+
import {J, isIdentifier} from "@openrewrite/rewrite/java";
|
|
10
|
+
|
|
11
|
+
const RENAMES: Record<string, string> = {
|
|
12
|
+
Sidebar: "Drawer",
|
|
13
|
+
SidebarModule: "DrawerModule",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class RenameSidebarIdentifiers extends Recipe {
|
|
17
|
+
readonly name = "org.openrewrite.primeng.RenameSidebarToDrawer.identifiers";
|
|
18
|
+
readonly displayName = "Rename `Sidebar` identifiers to `Drawer`";
|
|
19
|
+
readonly description = "Renames `Sidebar` and `SidebarModule` identifier usages in files importing them from `primeng/sidebar`.";
|
|
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/sidebar") 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
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RenameSidebarToDrawer extends Recipe {
|
|
58
|
+
readonly name = "org.openrewrite.primeng.RenameSidebarToDrawer";
|
|
59
|
+
readonly displayName = "Rename `Sidebar` to `Drawer`";
|
|
60
|
+
readonly description = "Renames `Sidebar` and `SidebarModule` imports from `primeng/sidebar` " +
|
|
61
|
+
"to `Drawer` and `DrawerModule` from `primeng/drawer`, and updates all identifier usages. " +
|
|
62
|
+
"The old names are deprecated in PrimeNG 18.";
|
|
63
|
+
|
|
64
|
+
async recipeList(): Promise<Recipe[]> {
|
|
65
|
+
return [
|
|
66
|
+
new RenameSidebarIdentifiers(),
|
|
67
|
+
new ChangeImport({
|
|
68
|
+
oldModule: "primeng/sidebar",
|
|
69
|
+
oldMember: "SidebarModule",
|
|
70
|
+
newModule: "primeng/drawer",
|
|
71
|
+
newMember: "DrawerModule",
|
|
72
|
+
}),
|
|
73
|
+
new ChangeImport({
|
|
74
|
+
oldModule: "primeng/sidebar",
|
|
75
|
+
oldMember: "Sidebar",
|
|
76
|
+
newModule: "primeng/drawer",
|
|
77
|
+
newMember: "Drawer",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {PlainText, PlainTextVisitor} from "@openrewrite/rewrite/text";
|
|
9
|
+
|
|
10
|
+
// v17 → v18 selector renames. Each entry is a pair of [old, new] tag names (without `<`).
|
|
11
|
+
// We rewrite both opening and closing tags.
|
|
12
|
+
const SELECTOR_RENAMES: Array<[string, string]> = [
|
|
13
|
+
['p-calendar', 'p-datepicker'],
|
|
14
|
+
['p-dropdown', 'p-select'],
|
|
15
|
+
['p-inputSwitch', 'p-toggleSwitch'],
|
|
16
|
+
['p-overlayPanel', 'p-popover'],
|
|
17
|
+
['p-sidebar', 'p-drawer'],
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Rewrite PrimeNG component selectors in HTML templates from their v17 names to v18 names.
|
|
22
|
+
* Operates on PlainText source files whose path ends in `.html`.
|
|
23
|
+
*/
|
|
24
|
+
export class RenameTemplateSelectors extends Recipe {
|
|
25
|
+
readonly name = "org.openrewrite.primeng.RenameTemplateSelectors";
|
|
26
|
+
readonly displayName = "Rename PrimeNG selectors in HTML templates to their v18 equivalents";
|
|
27
|
+
readonly description = "Renames v17 PrimeNG component selectors in `.html` templates to their v18 names: " +
|
|
28
|
+
"`<p-calendar>` → `<p-datepicker>`, `<p-dropdown>` → `<p-select>`, " +
|
|
29
|
+
"`<p-inputSwitch>` → `<p-toggleSwitch>`, `<p-overlayPanel>` → `<p-popover>`, " +
|
|
30
|
+
"`<p-sidebar>` → `<p-drawer>`. Both opening and closing tags are rewritten.";
|
|
31
|
+
|
|
32
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
33
|
+
return new class extends PlainTextVisitor<ExecutionContext> {
|
|
34
|
+
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
35
|
+
const t = await super.visitText(text, p) as PlainText;
|
|
36
|
+
if (!t) return t;
|
|
37
|
+
if (!t.sourcePath.endsWith('.html')) return t;
|
|
38
|
+
|
|
39
|
+
let updated = t.text;
|
|
40
|
+
let modified = false;
|
|
41
|
+
for (const [oldName, newName] of SELECTOR_RENAMES) {
|
|
42
|
+
// Match opening tag: <oldName followed by space, >, /, or end-of-string
|
|
43
|
+
const openRe = new RegExp(`<${oldName}(?=[\\s/>])`, 'g');
|
|
44
|
+
// Match closing tag: </oldName>
|
|
45
|
+
const closeRe = new RegExp(`</${oldName}>`, 'g');
|
|
46
|
+
if (openRe.test(updated) || closeRe.test(updated)) {
|
|
47
|
+
updated = updated.replace(new RegExp(`<${oldName}(?=[\\s/>])`, 'g'), `<${newName}`);
|
|
48
|
+
updated = updated.replace(new RegExp(`</${oldName}>`, 'g'), `</${newName}>`);
|
|
49
|
+
modified = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!modified) return t;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
...t,
|
|
57
|
+
text: updated,
|
|
58
|
+
snippets: [],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {RenameCalendarToDatePicker} from "./rename-calendar-to-datepicker";
|
|
9
|
+
import {RenameDropdownToSelect} from "./rename-dropdown-to-select";
|
|
10
|
+
import {RenameInputSwitchToToggleSwitch} from "./rename-inputswitch-to-toggleswitch";
|
|
11
|
+
import {RenameOverlayPanelToPopover} from "./rename-overlaypanel-to-popover";
|
|
12
|
+
import {RenameSidebarToDrawer} from "./rename-sidebar-to-drawer";
|
|
13
|
+
import {RenameMessageInterface} from "./rename-message-interface";
|
|
14
|
+
import {RenameTemplateSelectors} from "./rename-template-selectors";
|
|
15
|
+
import {MigrateMessagesToMessageLoop} from "./migrate-messages-to-message-loop";
|
|
16
|
+
import {MigratePFluidToWrapper} from "./migrate-p-fluid-to-wrapper";
|
|
17
|
+
import {MarkRemovedPrimengModules} from "./mark-removed-primeng-modules";
|
|
18
|
+
import {MarkDeprecatedPrimengComponents} from "./mark-deprecated-components";
|
|
19
|
+
import {MarkDeprecatedPrimengCssClasses} from "./mark-deprecated-css-classes";
|
|
20
|
+
import {MarkDrawerSize} from "./mark-drawer-size";
|
|
21
|
+
|
|
22
|
+
export class UpgradeComponentsTo18 extends Recipe {
|
|
23
|
+
readonly name = "org.openrewrite.primeng.UpgradeComponentsTo18";
|
|
24
|
+
readonly displayName = "Upgrade PrimeNG components to 18";
|
|
25
|
+
readonly description = "Handles component renames, deprecations, and removals for PrimeNG 18. " +
|
|
26
|
+
"Renames Calendar to DatePicker, Dropdown to Select, InputSwitch to ToggleSwitch, " +
|
|
27
|
+
"OverlayPanel to Popover, and Sidebar to Drawer (TS imports + identifier usages + HTML selectors). " +
|
|
28
|
+
"Migrates the `Messages` template usage to the `<p-message>` + `@for` loop. " +
|
|
29
|
+
"Marks removed modules (Chips, TriStateCheckbox, Messages, DataViewLayoutOptions, pAnimate) with " +
|
|
30
|
+
"TODO stubs, marks deprecated components (TabMenu, Steps, InlineMessage, TabView, pDefer) with " +
|
|
31
|
+
"TODO comments on their imports, and marks deprecated CSS classes (`.p-link`, `.p-highlight`, " +
|
|
32
|
+
"`.p-fluid`) and `<p-drawer>`/`<p-sidebar>` `size` usages with HTML TODO comments. All marked " +
|
|
33
|
+
"sites are written to the `ManualMigrationSteps` data table.";
|
|
34
|
+
|
|
35
|
+
async recipeList(): Promise<Recipe[]> {
|
|
36
|
+
return [
|
|
37
|
+
// 1. TS-side renames (imports + identifier usages)
|
|
38
|
+
new RenameCalendarToDatePicker(),
|
|
39
|
+
new RenameDropdownToSelect(),
|
|
40
|
+
new RenameInputSwitchToToggleSwitch(),
|
|
41
|
+
new RenameOverlayPanelToPopover(),
|
|
42
|
+
new RenameSidebarToDrawer(),
|
|
43
|
+
new RenameMessageInterface(),
|
|
44
|
+
// 2. HTML-side selector renames
|
|
45
|
+
new RenameTemplateSelectors(),
|
|
46
|
+
// 3. Structural template migration
|
|
47
|
+
new MigrateMessagesToMessageLoop(),
|
|
48
|
+
// `<div class="…p-fluid…">` → `<p-fluid class="…">` (+ FluidModule import)
|
|
49
|
+
new MigratePFluidToWrapper(),
|
|
50
|
+
// 4. Marks (TODO comments + ManualMigrationSteps rows)
|
|
51
|
+
new MarkRemovedPrimengModules(),
|
|
52
|
+
new MarkDeprecatedPrimengComponents(),
|
|
53
|
+
new MarkDeprecatedPrimengCssClasses(),
|
|
54
|
+
new MarkDrawerSize(),
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {AddDependency, UpgradeDependencyVersion} from "@openrewrite/rewrite/javascript";
|
|
9
|
+
import {UpgradeToAngular18} from "../../../migration/upgrade-to-angular-18";
|
|
10
|
+
import {UpgradeComponentsTo18} from "./upgrade-components-to-18";
|
|
11
|
+
import {MigratePrimeNgConfigToPrimeNG} from "./migrate-primeng-config";
|
|
12
|
+
import {MigratePrimeNGSignalAssignments} from "./migrate-primeng-signal-assignments";
|
|
13
|
+
import {AddPrimengProvider} from "./add-primeng-provider";
|
|
14
|
+
|
|
15
|
+
export class UpgradeToPrimeNG18 extends Recipe {
|
|
16
|
+
readonly name = "org.openrewrite.primeng.UpgradeTo18";
|
|
17
|
+
readonly displayName = "Upgrade to PrimeNG 18";
|
|
18
|
+
readonly description = "Migrates PrimeNG 17.x applications to PrimeNG 18. " +
|
|
19
|
+
"Renames components, migrates `PrimeNGConfig` to `PrimeNG` (with signal-backed setters), " +
|
|
20
|
+
"comments out the obsolete `primeng/resources` style entries in `angular.json`, wires " +
|
|
21
|
+
"`providePrimeNG({ theme: { preset: Aura } })` into the root NgModule and adds " +
|
|
22
|
+
"`@primeng/themes` to `package.json`. Anything that can't be deterministically migrated " +
|
|
23
|
+
"(removed-and-no-direct-replacement components, deprecated CSS classes, structural " +
|
|
24
|
+
"template changes) gets a TODO comment in source plus a row in the `ManualMigrationSteps` " +
|
|
25
|
+
"data table for an agent or human to finish.";
|
|
26
|
+
|
|
27
|
+
async recipeList(): Promise<Recipe[]> {
|
|
28
|
+
return [
|
|
29
|
+
// First, upgrade Angular framework to 18 (chains all prior Angular majors).
|
|
30
|
+
// PrimeNG 18 requires Angular 18, so this must run before any PrimeNG-specific
|
|
31
|
+
// bumps: the @primeng/themes addition and the primeng@18 bump need an Angular-18
|
|
32
|
+
// peer environment to install cleanly.
|
|
33
|
+
new UpgradeToAngular18(),
|
|
34
|
+
// Component changes (TS imports, HTML selectors, marks)
|
|
35
|
+
new UpgradeComponentsTo18(),
|
|
36
|
+
// Configuration migration
|
|
37
|
+
new MigratePrimeNgConfigToPrimeNG(),
|
|
38
|
+
// Convert direct field assignments on PrimeNG to .set() (signal-backed in v18)
|
|
39
|
+
new MigratePrimeNGSignalAssignments(),
|
|
40
|
+
// Wire in the new styled-mode provider, choosing the v18 preset based on the v17
|
|
41
|
+
// theme path it scans out of angular.json (Aura/Lara/Nora/Material). This recipe
|
|
42
|
+
// also folds in a sub-recipe that comments out the now-defunct `primeng/resources`
|
|
43
|
+
// entries from angular.json — provider addition + style-cleanup go together.
|
|
44
|
+
new AddPrimengProvider(),
|
|
45
|
+
// Add @primeng/themes (provides Aura/Lara/Nora/Material presets) — uses the framework
|
|
46
|
+
// recipe so it also updates package-lock / yarn.lock via the package manager.
|
|
47
|
+
new AddDependency({packageName: "@primeng/themes", version: "^18.0.0", scope: "dependencies"}),
|
|
48
|
+
// Dependency version upgrade
|
|
49
|
+
new UpgradeDependencyVersion({packageName: "primeng", newVersion: "18.x"}),
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
}
|