@openrewrite/recipes-angular 1.28.0 → 1.30.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/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -6
- package/dist/index.js.map +1 -1
- package/dist/libraries/cdk/find-cdk-signature-changes.d.ts +0 -2
- package/dist/libraries/cdk/find-cdk-signature-changes.d.ts.map +1 -1
- package/dist/libraries/cdk/find-cdk-signature-changes.js +2 -8
- package/dist/libraries/cdk/find-cdk-signature-changes.js.map +1 -1
- package/dist/libraries/cdk/migrate-cdk-sass-imports.d.ts.map +1 -1
- package/dist/libraries/cdk/migrate-cdk-sass-imports.js +4 -7
- package/dist/libraries/cdk/migrate-cdk-sass-imports.js.map +1 -1
- package/dist/libraries/cdk/migrate-cdk-stepper.js +1 -1
- package/dist/libraries/cdk/migrate-cdk-stepper.js.map +1 -1
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.d.ts.map +1 -1
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.js +2 -4
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.js.map +1 -1
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.d.ts.map +1 -1
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.js +2 -1
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.js.map +1 -1
- package/dist/libraries/cdk/remove-cdk-super-arguments.d.ts.map +1 -1
- package/dist/libraries/cdk/remove-cdk-super-arguments.js +1 -2
- package/dist/libraries/cdk/remove-cdk-super-arguments.js.map +1 -1
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.d.ts.map +1 -1
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.js +5 -7
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.js.map +1 -1
- package/dist/libraries/cdk/rename-portal-template-selectors.d.ts.map +1 -1
- package/dist/libraries/cdk/rename-portal-template-selectors.js +3 -4
- package/dist/libraries/cdk/rename-portal-template-selectors.js.map +1 -1
- package/dist/libraries/cdk/upgrade-to-cdk.d.ts.map +1 -1
- package/dist/libraries/cdk/upgrade-to-cdk.js +7 -12
- package/dist/libraries/cdk/upgrade-to-cdk.js.map +1 -1
- package/dist/libraries/components/lst.d.ts +5 -1
- package/dist/libraries/components/lst.d.ts.map +1 -1
- package/dist/libraries/components/lst.js +28 -0
- package/dist/libraries/components/lst.js.map +1 -1
- package/dist/libraries/components/style-sources.d.ts +2 -5
- package/dist/libraries/components/style-sources.d.ts.map +1 -1
- package/dist/libraries/components/style-sources.js +31 -46
- package/dist/libraries/components/style-sources.js.map +1 -1
- package/dist/libraries/components/stylesheets.d.ts +1 -0
- package/dist/libraries/components/stylesheets.d.ts.map +1 -1
- package/dist/libraries/components/stylesheets.js +18 -16
- package/dist/libraries/components/stylesheets.js.map +1 -1
- package/dist/libraries/components/symbols.d.ts +4 -21
- package/dist/libraries/components/symbols.d.ts.map +1 -1
- package/dist/libraries/components/symbols.js +12 -124
- package/dist/libraries/components/symbols.js.map +1 -1
- package/dist/libraries/components/template-elements.d.ts +2 -0
- package/dist/libraries/components/template-elements.d.ts.map +1 -1
- package/dist/libraries/components/template-elements.js +6 -0
- package/dist/libraries/components/template-elements.js.map +1 -1
- package/dist/libraries/components/templates.d.ts +1 -0
- package/dist/libraries/components/templates.d.ts.map +1 -1
- package/dist/libraries/components/templates.js +43 -47
- package/dist/libraries/components/templates.js.map +1 -1
- package/dist/libraries/material/add-system-variables-prefix.d.ts +5 -3
- package/dist/libraries/material/add-system-variables-prefix.d.ts.map +1 -1
- package/dist/libraries/material/add-system-variables-prefix.js +35 -11
- package/dist/libraries/material/add-system-variables-prefix.js.map +1 -1
- package/dist/libraries/material/add-theme-base-mixins.d.ts.map +1 -1
- package/dist/libraries/material/add-theme-base-mixins.js +7 -7
- package/dist/libraries/material/add-theme-base-mixins.js.map +1 -1
- package/dist/libraries/material/find-chip-input-event-without-chip-input.d.ts.map +1 -1
- package/dist/libraries/material/find-chip-input-event-without-chip-input.js +1 -2
- package/dist/libraries/material/find-chip-input-event-without-chip-input.js.map +1 -1
- package/dist/libraries/material/find-legacy-material-usage.d.ts.map +1 -1
- package/dist/libraries/material/find-legacy-material-usage.js +3 -11
- package/dist/libraries/material/find-legacy-material-usage.js.map +1 -1
- package/dist/libraries/material/find-material-constructor-changes.d.ts.map +1 -1
- package/dist/libraries/material/find-material-constructor-changes.js +2 -3
- package/dist/libraries/material/find-material-constructor-changes.js.map +1 -1
- package/dist/libraries/material/find-mdc-breaking-changes.d.ts.map +1 -1
- package/dist/libraries/material/find-mdc-breaking-changes.js +4 -18
- package/dist/libraries/material/find-mdc-breaking-changes.js.map +1 -1
- package/dist/libraries/material/find-mixin-error-state-without-state-changes.js +1 -1
- package/dist/libraries/material/find-mixin-error-state-without-state-changes.js.map +1 -1
- package/dist/libraries/material/find-raw-palette-themes.d.ts.map +1 -1
- package/dist/libraries/material/find-raw-palette-themes.js +3 -5
- package/dist/libraries/material/find-raw-palette-themes.js.map +1 -1
- package/dist/libraries/material/find-removed-material-classes.d.ts.map +1 -1
- package/dist/libraries/material/find-removed-material-classes.js +4 -14
- package/dist/libraries/material/find-removed-material-classes.js.map +1 -1
- package/dist/libraries/material/find-removed-material-members.d.ts.map +1 -1
- package/dist/libraries/material/find-removed-material-members.js +2 -3
- package/dist/libraries/material/find-removed-material-members.js.map +1 -1
- package/dist/libraries/material/find-slide-toggle-drag-options.d.ts +5 -3
- package/dist/libraries/material/find-slide-toggle-drag-options.d.ts.map +1 -1
- package/dist/libraries/material/find-slide-toggle-drag-options.js +7 -13
- package/dist/libraries/material/find-slide-toggle-drag-options.js.map +1 -1
- package/dist/libraries/material/material-version.d.ts +16 -2
- package/dist/libraries/material/material-version.d.ts.map +1 -1
- package/dist/libraries/material/material-version.js +35 -5
- package/dist/libraries/material/material-version.js.map +1 -1
- package/dist/libraries/material/migrate-legacy-material.d.ts.map +1 -1
- package/dist/libraries/material/migrate-legacy-material.js +5 -11
- package/dist/libraries/material/migrate-legacy-material.js.map +1 -1
- package/dist/libraries/material/migrate-m2-theming-api.d.ts.map +1 -1
- package/dist/libraries/material/migrate-m2-theming-api.js +3 -6
- package/dist/libraries/material/migrate-m2-theming-api.js.map +1 -1
- package/dist/libraries/material/migrate-mat-core-to-elevation-classes.d.ts +5 -3
- package/dist/libraries/material/migrate-mat-core-to-elevation-classes.d.ts.map +1 -1
- package/dist/libraries/material/migrate-mat-core-to-elevation-classes.js +15 -3
- package/dist/libraries/material/migrate-mat-core-to-elevation-classes.js.map +1 -1
- package/dist/libraries/material/migrate-material-15-typography.d.ts.map +1 -1
- package/dist/libraries/material/migrate-material-15-typography.js +9 -20
- package/dist/libraries/material/migrate-material-15-typography.js.map +1 -1
- package/dist/libraries/material/migrate-material-secondary-entry-points.d.ts.map +1 -1
- package/dist/libraries/material/migrate-material-secondary-entry-points.js +41 -2
- package/dist/libraries/material/migrate-material-secondary-entry-points.js.map +1 -1
- package/dist/libraries/material/migrate-material-theming-api.d.ts +1 -0
- package/dist/libraries/material/migrate-material-theming-api.d.ts.map +1 -1
- package/dist/libraries/material/migrate-material-theming-api.js +33 -24
- package/dist/libraries/material/migrate-material-theming-api.js.map +1 -1
- package/dist/libraries/material/migrate-mdc-styles.d.ts.map +1 -1
- package/dist/libraries/material/migrate-mdc-styles.js +5 -14
- package/dist/libraries/material/migrate-mdc-styles.js.map +1 -1
- package/dist/libraries/material/migrate-mdc-templates.d.ts.map +1 -1
- package/dist/libraries/material/migrate-mdc-templates.js +54 -30
- package/dist/libraries/material/migrate-mdc-templates.js.map +1 -1
- package/dist/libraries/material/remove-mat-stepper-document-argument.d.ts.map +1 -1
- package/dist/libraries/material/remove-mat-stepper-document-argument.js +1 -2
- package/dist/libraries/material/remove-mat-stepper-document-argument.js.map +1 -1
- package/dist/libraries/material/remove-update-active-link-argument.d.ts.map +1 -1
- package/dist/libraries/material/remove-update-active-link-argument.js +1 -2
- package/dist/libraries/material/remove-update-active-link-argument.js.map +1 -1
- package/dist/libraries/material/rename-material-style-names.d.ts +14 -7
- package/dist/libraries/material/rename-material-style-names.d.ts.map +1 -1
- package/dist/libraries/material/rename-material-style-names.js +69 -35
- package/dist/libraries/material/rename-material-style-names.js.map +1 -1
- package/dist/libraries/material/rename-textarea-autosize-attributes.d.ts +5 -15
- package/dist/libraries/material/rename-textarea-autosize-attributes.d.ts.map +1 -1
- package/dist/libraries/material/rename-textarea-autosize-attributes.js +30 -15
- package/dist/libraries/material/rename-textarea-autosize-attributes.js.map +1 -1
- package/dist/libraries/material/upgrade-to-material.d.ts.map +1 -1
- package/dist/libraries/material/upgrade-to-material.js +19 -31
- package/dist/libraries/material/upgrade-to-material.js.map +1 -1
- package/dist/migration/js-support.d.ts +1 -1
- package/dist/migration/js-support.d.ts.map +1 -1
- package/dist/migration/js-support.js +2 -2
- package/dist/migration/js-support.js.map +1 -1
- package/dist/migration/json-support.d.ts +11 -0
- package/dist/migration/json-support.d.ts.map +1 -1
- package/dist/migration/json-support.js +50 -0
- package/dist/migration/json-support.js.map +1 -1
- package/dist/migration/move-common-engine-to-ssr-node.d.ts +8 -0
- package/dist/migration/move-common-engine-to-ssr-node.d.ts.map +1 -0
- package/dist/migration/move-common-engine-to-ssr-node.js +68 -0
- package/dist/migration/move-common-engine-to-ssr-node.js.map +1 -0
- package/dist/migration/remove-guard-and-resolve-interfaces.d.ts +8 -0
- package/dist/migration/remove-guard-and-resolve-interfaces.d.ts.map +1 -0
- package/dist/migration/remove-guard-and-resolve-interfaces.js +117 -0
- package/dist/migration/remove-guard-and-resolve-interfaces.js.map +1 -0
- package/dist/migration/remove-show-circular-dependencies.d.ts +8 -0
- package/dist/migration/remove-show-circular-dependencies.d.ts.map +1 -0
- package/dist/migration/remove-show-circular-dependencies.js +57 -0
- package/dist/migration/remove-show-circular-dependencies.js.map +1 -0
- package/dist/migration/rename-ssr-experimental-platform.d.ts.map +1 -1
- package/dist/migration/rename-ssr-experimental-platform.js +10 -47
- package/dist/migration/rename-ssr-experimental-platform.js.map +1 -1
- package/dist/migration/replace-browser-target.d.ts +8 -0
- package/dist/migration/replace-browser-target.d.ts.map +1 -0
- package/dist/migration/replace-browser-target.js +62 -0
- package/dist/migration/replace-browser-target.js.map +1 -0
- package/dist/migration/replace-default-collection.d.ts +8 -0
- package/dist/migration/replace-default-collection.d.ts.map +1 -0
- package/dist/migration/replace-default-collection.js +59 -0
- package/dist/migration/replace-default-collection.js.map +1 -0
- package/dist/migration/replace-get-current-navigation.d.ts +8 -0
- package/dist/migration/replace-get-current-navigation.d.ts.map +1 -0
- package/dist/migration/replace-get-current-navigation.js +69 -0
- package/dist/migration/replace-get-current-navigation.js.map +1 -0
- package/dist/migration/replace-initializer-providers.d.ts +8 -0
- package/dist/migration/replace-initializer-providers.d.ts.map +1 -0
- package/dist/migration/replace-initializer-providers.js +169 -0
- package/dist/migration/replace-initializer-providers.js.map +1 -0
- package/dist/migration/replace-preserve-query-params.d.ts +8 -0
- package/dist/migration/replace-preserve-query-params.d.ts.map +1 -0
- package/dist/migration/replace-preserve-query-params.js +115 -0
- package/dist/migration/replace-preserve-query-params.js.map +1 -0
- package/dist/migration/replace-provide-server-routing.d.ts +8 -0
- package/dist/migration/replace-provide-server-routing.d.ts.map +1 -0
- package/dist/migration/replace-provide-server-routing.js +98 -0
- package/dist/migration/replace-provide-server-routing.js.map +1 -0
- package/dist/migration/upgrade-angular-dependencies.d.ts +0 -2
- package/dist/migration/upgrade-angular-dependencies.d.ts.map +1 -1
- package/dist/migration/upgrade-angular-dependencies.js +0 -6
- package/dist/migration/upgrade-angular-dependencies.js.map +1 -1
- package/dist/migration/upgrade-to-angular-10.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-10.js +1 -2
- package/dist/migration/upgrade-to-angular-10.js.map +1 -1
- package/dist/migration/upgrade-to-angular-11.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-11.js +5 -3
- package/dist/migration/upgrade-to-angular-11.js.map +1 -1
- package/dist/migration/upgrade-to-angular-12.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-12.js +1 -2
- package/dist/migration/upgrade-to-angular-12.js.map +1 -1
- package/dist/migration/upgrade-to-angular-13.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-13.js +1 -2
- package/dist/migration/upgrade-to-angular-13.js.map +1 -1
- package/dist/migration/upgrade-to-angular-14.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-14.js +8 -2
- package/dist/migration/upgrade-to-angular-14.js.map +1 -1
- package/dist/migration/upgrade-to-angular-15.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-15.js +1 -2
- package/dist/migration/upgrade-to-angular-15.js.map +1 -1
- package/dist/migration/upgrade-to-angular-16.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-16.js +4 -2
- package/dist/migration/upgrade-to-angular-16.js.map +1 -1
- package/dist/migration/upgrade-to-angular-17.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-17.js +1 -2
- package/dist/migration/upgrade-to-angular-17.js.map +1 -1
- package/dist/migration/upgrade-to-angular-18.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-18.js +1 -2
- package/dist/migration/upgrade-to-angular-18.js.map +1 -1
- package/dist/migration/upgrade-to-angular-19.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-19.js +12 -4
- package/dist/migration/upgrade-to-angular-19.js.map +1 -1
- package/dist/migration/upgrade-to-angular-20.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-20.js +12 -3
- package/dist/migration/upgrade-to-angular-20.js.map +1 -1
- package/dist/migration/upgrade-to-angular-21.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-21.js +4 -2
- package/dist/migration/upgrade-to-angular-21.js.map +1 -1
- package/dist/migration/upgrade-to-angular-22.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-22.js +1 -2
- package/dist/migration/upgrade-to-angular-22.js.map +1 -1
- package/dist/migration/upgrade-to-angular-8.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-8.js +1 -3
- package/dist/migration/upgrade-to-angular-8.js.map +1 -1
- package/dist/migration/upgrade-to-angular-9.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-9.js +1 -2
- package/dist/migration/upgrade-to-angular-9.js.map +1 -1
- package/package.json +6 -5
- package/src/index.ts +27 -0
- package/src/libraries/cdk/find-cdk-signature-changes.ts +1 -6
- package/src/libraries/cdk/migrate-cdk-sass-imports.ts +4 -7
- package/src/libraries/cdk/migrate-cdk-stepper.ts +2 -2
- package/src/libraries/cdk/migrate-deprecated-overlay-sass.ts +2 -4
- package/src/libraries/cdk/migrate-focus-trap-factory-create.ts +2 -1
- package/src/libraries/cdk/remove-cdk-super-arguments.ts +1 -2
- package/src/libraries/cdk/remove-portal-factory-resolver-arguments.ts +4 -6
- package/src/libraries/cdk/rename-portal-template-selectors.ts +3 -4
- package/src/libraries/cdk/upgrade-to-cdk.ts +7 -12
- package/src/libraries/components/lst.ts +17 -1
- package/src/libraries/components/style-sources.ts +20 -31
- package/src/libraries/components/stylesheets.ts +13 -10
- package/src/libraries/components/symbols.ts +12 -96
- package/src/libraries/components/template-elements.ts +5 -0
- package/src/libraries/components/templates.ts +32 -33
- package/src/libraries/material/add-system-variables-prefix.ts +27 -11
- package/src/libraries/material/add-theme-base-mixins.ts +7 -7
- package/src/libraries/material/find-chip-input-event-without-chip-input.ts +1 -2
- package/src/libraries/material/find-legacy-material-usage.ts +5 -11
- package/src/libraries/material/find-material-constructor-changes.ts +2 -3
- package/src/libraries/material/find-mdc-breaking-changes.ts +6 -17
- package/src/libraries/material/find-mixin-error-state-without-state-changes.ts +2 -2
- package/src/libraries/material/find-raw-palette-themes.ts +3 -5
- package/src/libraries/material/find-removed-material-classes.ts +6 -14
- package/src/libraries/material/find-removed-material-members.ts +2 -3
- package/src/libraries/material/find-slide-toggle-drag-options.ts +10 -13
- package/src/libraries/material/material-version.ts +37 -5
- package/src/libraries/material/migrate-legacy-material.ts +5 -11
- package/src/libraries/material/migrate-m2-theming-api.ts +3 -6
- package/src/libraries/material/migrate-mat-core-to-elevation-classes.ts +8 -5
- package/src/libraries/material/migrate-material-15-typography.ts +12 -20
- package/src/libraries/material/migrate-material-secondary-entry-points.ts +35 -3
- package/src/libraries/material/migrate-material-theming-api.ts +30 -22
- package/src/libraries/material/migrate-mdc-styles.ts +6 -13
- package/src/libraries/material/migrate-mdc-templates.ts +51 -28
- package/src/libraries/material/remove-mat-stepper-document-argument.ts +1 -2
- package/src/libraries/material/remove-update-active-link-argument.ts +1 -2
- package/src/libraries/material/rename-material-style-names.ts +79 -31
- package/src/libraries/material/rename-textarea-autosize-attributes.ts +24 -16
- package/src/libraries/material/upgrade-to-material.ts +19 -31
- package/src/migration/js-support.ts +2 -2
- package/src/migration/json-support.ts +50 -1
- package/src/migration/move-common-engine-to-ssr-node.ts +46 -0
- package/src/migration/remove-guard-and-resolve-interfaces.ts +89 -0
- package/src/migration/remove-show-circular-dependencies.ts +40 -0
- package/src/migration/rename-ssr-experimental-platform.ts +8 -49
- package/src/migration/replace-browser-target.ts +45 -0
- package/src/migration/replace-default-collection.ts +45 -0
- package/src/migration/replace-get-current-navigation.ts +50 -0
- package/src/migration/replace-initializer-providers.ts +153 -0
- package/src/migration/replace-preserve-query-params.ts +88 -0
- package/src/migration/replace-provide-server-routing.ts +79 -0
- package/src/migration/upgrade-angular-dependencies.ts +0 -6
- package/src/migration/upgrade-to-angular-10.ts +2 -3
- package/src/migration/upgrade-to-angular-11.ts +6 -4
- package/src/migration/upgrade-to-angular-12.ts +2 -3
- package/src/migration/upgrade-to-angular-13.ts +2 -3
- package/src/migration/upgrade-to-angular-14.ts +9 -3
- package/src/migration/upgrade-to-angular-15.ts +2 -3
- package/src/migration/upgrade-to-angular-16.ts +5 -3
- package/src/migration/upgrade-to-angular-17.ts +2 -3
- package/src/migration/upgrade-to-angular-18.ts +2 -3
- package/src/migration/upgrade-to-angular-19.ts +13 -5
- package/src/migration/upgrade-to-angular-20.ts +13 -4
- package/src/migration/upgrade-to-angular-21.ts +5 -3
- package/src/migration/upgrade-to-angular-22.ts +2 -3
- package/src/migration/upgrade-to-angular-8.ts +1 -3
- package/src/migration/upgrade-to-angular-9.ts +2 -3
|
@@ -78,8 +78,7 @@ class UpgradeToAngular9 extends rewrite_1.Recipe {
|
|
|
78
78
|
"updating `tsconfig.json` module settings for Ivy, " +
|
|
79
79
|
"flagging removed View Engine APIs (`Renderer`, `RenderComponentType`, `RootRenderer`), " +
|
|
80
80
|
"and upgrading Angular, TypeScript, and related dependency versions." +
|
|
81
|
-
" It includes the Angular Material code changes of version 9."
|
|
82
|
-
upgrade_angular_dependencies_1.ANGULAR_DEPENDENCY_UPGRADE;
|
|
81
|
+
" It includes the Angular Material code changes of version 9.";
|
|
83
82
|
}
|
|
84
83
|
recipeList() {
|
|
85
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-to-angular-9.js","sourceRoot":"","sources":["../../src/migration/upgrade-to-angular-9.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,kDAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"upgrade-to-angular-9.js","sourceRoot":"","sources":["../../src/migration/upgrade-to-angular-9.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,kDAA4C;AAC5C,iFAA0E;AAC1E,iEAAoE;AACpE,+DAAwD;AACxD,yDAAkD;AAClD,qEAA8D;AAC9D,uEAAgE;AAChE,iGAAwF;AACxF,iFAAyE;AACzE,yEAAiE;AACjE,+FAAsF;AACtF,6FAAqF;AACrF,+EAAwE;AACxE,+GAAqG;AACrG,uFAA8E;AAC9E,2FAAkF;AAClF,mFAAwF;AAExF,MAAa,4BAA6B,SAAQ,gBAAM;IAAxD;;QACa,SAAI,GAAG,sDAAsD,CAAC;QAC9D,gBAAW,GAAG,qCAAqC,CAAC;QACpD,gBAAW,GAAG,uFAAuF;YAC1G,gFAAgF,CAAC;IAuBzF,CAAC;IArBS,UAAU;;YACZ,OAAO;gBACH,IAAI,mDAA4B,EAAE;gBAClC,uBAAuB;gBACvB,IAAI,uCAAiB,EAAE;gBACvB,IAAI,iCAAc,EAAE;gBACpB,IAAI,6CAAoB,EAAE;gBAC1B,IAAI,6DAA2B,EAAE;gBACjC,IAAI,iEAA6B,EAAE;gBACnC,kCAAkC;gBAClC,IAAI,uCAAiB,EAAE;gBACvB,IAAI,+DAA4B,EAAE;gBAClC,IAAI,gDAAqB,EAAE;gBAC3B,IAAI,wCAAiB,EAAE;gBACvB,IAAI,6DAA2B,EAAE;gBACjC,IAAI,4DAA2B,EAAE;gBACjC,IAAI,+CAAqB,EAAE;gBAC3B,IAAI,4EAAkC,EAAE;gBACxC,IAAI,mDAA6B,EAAE;aACtC,CAAC;QACN,CAAC;KAAA;CACJ;AA3BD,oEA2BC;AAED,MAAa,iBAAkB,SAAQ,gBAAM;IAA7C;;QACa,SAAI,GAAG,2CAA2C,CAAC;QACnD,gBAAW,GAAG,sBAAsB,CAAC;QACrC,gBAAW,GAAG,kDAAkD;YACrE,qFAAqF;YACrF,qDAAqD;YACrD,2DAA2D;YAC3D,8CAA8C;YAC9C,oDAAoD;YACpD,yFAAyF;YACzF,qEAAqE;YACrE,8DAA8D,CAAC;IAoBvE,CAAC;IAlBS,UAAU;;YACZ,OAAO;gBACH,IAAI,4BAA4B,EAAE;gBAClC,oFAAoF;gBACpF,MAAM,IAAA,yDAA0B,EAAC,CAAC,EAAE;oBAChC,sBAAsB,EAAE,KAAK;oBAC7B,4BAA4B,EAAE,KAAK;oBACnC,+BAA+B,EAAE,SAAS;oBAC1C,gCAAgC,EAAE,SAAS;oBAC3C,4BAA4B,EAAE,SAAS;oBACvC,+BAA+B,EAAE,SAAS;oBAC1C,qBAAqB,EAAE,KAAK;oBAC5B,SAAS,EAAE,QAAQ;oBACnB,YAAY,EAAE,OAAO;oBACrB,OAAO,EAAE,KAAK;iBACjB,CAAC;aACL,CAAC;QACN,CAAC;KAAA;CACJ;AA/BD,8CA+BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrewrite/recipes-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"license": "Moderne Proprietary",
|
|
5
5
|
"description": "OpenRewrite recipes for Angular.",
|
|
6
6
|
"homepage": "https://github.com/openrewrite/rewrite",
|
|
@@ -18,18 +18,19 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "rm -rf ./dist tsconfig.build.tsbuildinfo && tsc --build tsconfig.build.json",
|
|
21
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
21
22
|
"dev": "tsc --watch -p tsconfig.json",
|
|
22
|
-
"test": "npm run build && vitest run",
|
|
23
|
-
"ci:test": "NODE_OPTIONS=--max-old-space-size=4096 vitest run"
|
|
23
|
+
"test": "npm run build && npm run typecheck && vitest run",
|
|
24
|
+
"ci:test": "npm run typecheck && NODE_OPTIONS=--max-old-space-size=4096 vitest run"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@openrewrite/rewrite": "^8.
|
|
27
|
+
"@openrewrite/rewrite": "^8.107.3",
|
|
27
28
|
"mutative": "^1.3.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"tmp-promise": "^3.0.3",
|
|
31
32
|
"ts-node": "^10.9.2",
|
|
32
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.8.0",
|
|
33
34
|
"vitest": "^4.1.11"
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,10 +8,13 @@ import {RemoveEmptyNgOnInit} from './migration/remove-empty-ng-on-init';
|
|
|
8
8
|
import {UpdateComponentTemplateUrl} from './migration/update-component-template-url';
|
|
9
9
|
import {RemoveEntryComponents} from './migration/remove-entry-components';
|
|
10
10
|
import {RemoveModuleId} from './migration/remove-module-id';
|
|
11
|
+
import {ReplaceGetCurrentNavigation} from './migration/replace-get-current-navigation';
|
|
12
|
+
import {RemoveGuardAndResolveInterfaces} from './migration/remove-guard-and-resolve-interfaces';
|
|
11
13
|
import {RemoveComponentFactoryResolver} from './migration/remove-component-factory-resolver';
|
|
12
14
|
import {ReplaceRouterLinkWithHref} from './migration/replace-router-link-with-href';
|
|
13
15
|
import {ExplicitStandaloneFlag} from './migration/explicit-standalone-flag';
|
|
14
16
|
import {RenamePendingTasks} from './migration/rename-pending-tasks';
|
|
17
|
+
import {ReplaceInitializerProviders} from './migration/replace-initializer-providers';
|
|
15
18
|
import {RenameZonelessProvider} from './migration/rename-zoneless-provider';
|
|
16
19
|
import {RenameCheckNoChanges} from './migration/rename-check-no-changes';
|
|
17
20
|
import {RenameAfterRender} from './migration/rename-after-render';
|
|
@@ -19,6 +22,8 @@ import {ReplaceInjectFlags} from './migration/replace-inject-flags';
|
|
|
19
22
|
import {MoveDocumentImport, MoveDocumentToCore} from './migration/move-document-to-core';
|
|
20
23
|
import {RemoveStandaloneTrue} from './migration/remove-standalone-true';
|
|
21
24
|
import {RemoveZoneJsPolyfill} from './migration/remove-zone-js-polyfill';
|
|
25
|
+
import {ReplaceProvideServerRouting} from './migration/replace-provide-server-routing';
|
|
26
|
+
import {MoveCommonEngineToSsrNode} from './migration/move-common-engine-to-ssr-node';
|
|
22
27
|
import {RemoveBrowserModuleWithServerTransition} from './migration/remove-browser-module-with-server-transition';
|
|
23
28
|
import {ReplaceAsyncWithWaitForAsync} from './migration/replace-async-with-wait-for-async';
|
|
24
29
|
import {ReplaceHttpClientModule} from './migration/replace-http-client-module';
|
|
@@ -31,7 +36,11 @@ import {RemoveDefaultProject} from './migration/remove-default-project';
|
|
|
31
36
|
import {AddTestBedTeardown} from './migration/add-testbed-teardown';
|
|
32
37
|
import {ReplaceUntypedForms} from './migration/replace-untyped-forms';
|
|
33
38
|
import {ReplaceInitialNavigation} from './migration/replace-initial-navigation';
|
|
39
|
+
import {ReplacePreserveQueryParams} from './migration/replace-preserve-query-params';
|
|
34
40
|
import {RemoveAotSummaries} from './migration/remove-aot-summaries';
|
|
41
|
+
import {ReplaceBrowserTarget} from './migration/replace-browser-target';
|
|
42
|
+
import {RemoveShowCircularDependencies} from './migration/remove-show-circular-dependencies';
|
|
43
|
+
import {ReplaceDefaultCollection} from './migration/replace-default-collection';
|
|
35
44
|
import {FindPathMatchTypeUsage} from './search/find-path-match-type-usage';
|
|
36
45
|
import {FindCompilerFactoryUsage} from './search/find-compiler-factory-usage';
|
|
37
46
|
import {AddDefaultConfiguration} from './migration/add-default-configuration';
|
|
@@ -257,6 +266,7 @@ export async function activate(marketplace: RecipeMarketplace) {
|
|
|
257
266
|
await marketplace.install(UpdateComponentTemplateUrl, AngularMigration);
|
|
258
267
|
await marketplace.install(ExplicitStandaloneFlag, AngularMigration);
|
|
259
268
|
await marketplace.install(RenamePendingTasks, AngularMigration);
|
|
269
|
+
await marketplace.install(ReplaceInitializerProviders, AngularMigration);
|
|
260
270
|
await marketplace.install(RenameZonelessProvider, AngularMigration);
|
|
261
271
|
await marketplace.install(RenameCheckNoChanges, AngularMigration);
|
|
262
272
|
await marketplace.install(RenameAfterRender, AngularMigration);
|
|
@@ -264,10 +274,14 @@ export async function activate(marketplace: RecipeMarketplace) {
|
|
|
264
274
|
await marketplace.install(MoveDocumentImport, AngularMigration);
|
|
265
275
|
await marketplace.install(RemoveStandaloneTrue, AngularMigration);
|
|
266
276
|
await marketplace.install(RemoveZoneJsPolyfill, AngularMigration);
|
|
277
|
+
await marketplace.install(ReplaceProvideServerRouting, AngularMigration);
|
|
278
|
+
await marketplace.install(MoveCommonEngineToSsrNode, AngularMigration);
|
|
267
279
|
await marketplace.install(RemoveBrowserModuleWithServerTransition, AngularMigration);
|
|
268
280
|
await marketplace.install(ReplaceAsyncWithWaitForAsync, AngularMigration);
|
|
269
281
|
await marketplace.install(RemoveEntryComponents, AngularMigration);
|
|
270
282
|
await marketplace.install(RemoveModuleId, AngularMigration);
|
|
283
|
+
await marketplace.install(ReplaceGetCurrentNavigation, AngularMigration);
|
|
284
|
+
await marketplace.install(RemoveGuardAndResolveInterfaces, AngularMigration);
|
|
271
285
|
await marketplace.install(RemoveComponentFactoryResolver, AngularMigration);
|
|
272
286
|
await marketplace.install(ReplaceRouterLinkWithHref, AngularMigration);
|
|
273
287
|
await marketplace.install(ReplaceHttpClientModule, AngularMigration);
|
|
@@ -276,7 +290,11 @@ export async function activate(marketplace: RecipeMarketplace) {
|
|
|
276
290
|
await marketplace.install(ReplaceDeepZoneJsImports, AngularMigration);
|
|
277
291
|
await marketplace.install(ReplaceUntypedForms, AngularMigration);
|
|
278
292
|
await marketplace.install(ReplaceInitialNavigation, AngularMigration);
|
|
293
|
+
await marketplace.install(ReplacePreserveQueryParams, AngularMigration);
|
|
279
294
|
await marketplace.install(RemoveAotSummaries, AngularMigration);
|
|
295
|
+
await marketplace.install(ReplaceBrowserTarget, AngularMigration);
|
|
296
|
+
await marketplace.install(RemoveShowCircularDependencies, AngularMigration);
|
|
297
|
+
await marketplace.install(ReplaceDefaultCollection, AngularMigration);
|
|
280
298
|
await marketplace.install(UpdateTsconfigTarget, AngularMigration);
|
|
281
299
|
await marketplace.install(RemoveIePolyfills, AngularMigration);
|
|
282
300
|
await marketplace.install(RemoveDefaultProject, AngularMigration);
|
|
@@ -495,6 +513,7 @@ export {RemoveEmptyNgOnInit} from './migration/remove-empty-ng-on-init';
|
|
|
495
513
|
export {UpdateComponentTemplateUrl} from './migration/update-component-template-url';
|
|
496
514
|
export {ExplicitStandaloneFlag} from './migration/explicit-standalone-flag';
|
|
497
515
|
export {RenamePendingTasks} from './migration/rename-pending-tasks';
|
|
516
|
+
export {ReplaceInitializerProviders} from './migration/replace-initializer-providers';
|
|
498
517
|
export {RenameZonelessProvider} from './migration/rename-zoneless-provider';
|
|
499
518
|
export {RenameCheckNoChanges} from './migration/rename-check-no-changes';
|
|
500
519
|
export {RenameAfterRender} from './migration/rename-after-render';
|
|
@@ -502,10 +521,14 @@ export {ReplaceInjectFlags} from './migration/replace-inject-flags';
|
|
|
502
521
|
export {MoveDocumentImport, MoveDocumentToCore} from './migration/move-document-to-core';
|
|
503
522
|
export {RemoveStandaloneTrue} from './migration/remove-standalone-true';
|
|
504
523
|
export {RemoveZoneJsPolyfill} from './migration/remove-zone-js-polyfill';
|
|
524
|
+
export {ReplaceProvideServerRouting} from './migration/replace-provide-server-routing';
|
|
525
|
+
export {MoveCommonEngineToSsrNode} from './migration/move-common-engine-to-ssr-node';
|
|
505
526
|
export {RemoveBrowserModuleWithServerTransition} from './migration/remove-browser-module-with-server-transition';
|
|
506
527
|
export {ReplaceAsyncWithWaitForAsync} from './migration/replace-async-with-wait-for-async';
|
|
507
528
|
export {RemoveEntryComponents} from './migration/remove-entry-components';
|
|
508
529
|
export {RemoveModuleId} from './migration/remove-module-id';
|
|
530
|
+
export {ReplaceGetCurrentNavigation} from './migration/replace-get-current-navigation';
|
|
531
|
+
export {RemoveGuardAndResolveInterfaces} from './migration/remove-guard-and-resolve-interfaces';
|
|
509
532
|
export {RemoveComponentFactoryResolver} from './migration/remove-component-factory-resolver';
|
|
510
533
|
export {ReplaceRouterLinkWithHref} from './migration/replace-router-link-with-href';
|
|
511
534
|
export {ReplaceHttpClientModule} from './migration/replace-http-client-module';
|
|
@@ -514,7 +537,11 @@ export {RemoveEnableIvy} from './migration/remove-enable-ivy';
|
|
|
514
537
|
export {ReplaceDeepZoneJsImports} from './migration/replace-deep-zone-js-imports';
|
|
515
538
|
export {ReplaceUntypedForms} from './migration/replace-untyped-forms';
|
|
516
539
|
export {ReplaceInitialNavigation} from './migration/replace-initial-navigation';
|
|
540
|
+
export {ReplacePreserveQueryParams} from './migration/replace-preserve-query-params';
|
|
517
541
|
export {RemoveAotSummaries} from './migration/remove-aot-summaries';
|
|
542
|
+
export {ReplaceBrowserTarget} from './migration/replace-browser-target';
|
|
543
|
+
export {RemoveShowCircularDependencies} from './migration/remove-show-circular-dependencies';
|
|
544
|
+
export {ReplaceDefaultCollection} from './migration/replace-default-collection';
|
|
518
545
|
export {UpdateTsconfigTarget} from './migration/update-tsconfig-target';
|
|
519
546
|
export {RemoveIePolyfills} from './migration/remove-ie-polyfills';
|
|
520
547
|
export {RemoveDefaultProject} from './migration/remove-default-project';
|
|
@@ -8,7 +8,7 @@ import {ExecutionContext, foundSearchResult, Recipe, TreeVisitor} from "@openrew
|
|
|
8
8
|
import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {importedNames} from "../components/symbols";
|
|
11
|
-
import {extendedClassName} from "../components/lst";
|
|
11
|
+
import {argumentCount, extendedClassName} from "../components/lst";
|
|
12
12
|
|
|
13
13
|
/** Whether a type is the named class of an `@angular/cdk` entry point. */
|
|
14
14
|
export function isCdkClass(type: any, className: string): boolean {
|
|
@@ -16,11 +16,6 @@ export function isCdkClass(type: any, className: string): boolean {
|
|
|
16
16
|
return fqn !== undefined && fqn.startsWith('@angular/cdk') && fqn.endsWith(`.${className}`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function argumentCount(container: J.Container<J> | undefined): number {
|
|
20
|
-
const elements = container?.elements ?? [];
|
|
21
|
-
return elements.length === 1 && elements[0].element.kind === J.Kind.Empty ? 0 : elements.length;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
19
|
export class FindOverlayConnectedTo extends Recipe {
|
|
25
20
|
readonly name = "org.openrewrite.angular.cdk.FindOverlayConnectedTo";
|
|
26
21
|
readonly displayName = "Find `OverlayPositionBuilder.connectedTo` calls";
|
|
@@ -51,13 +51,10 @@ interface Accumulator {
|
|
|
51
51
|
export class MigrateCdkSassImports extends ScanningRecipe<Accumulator> {
|
|
52
52
|
readonly name = "org.openrewrite.angular.cdk.MigrateCdkSassImports";
|
|
53
53
|
readonly displayName = "Migrate Angular CDK Sass `@import` to `@use`";
|
|
54
|
-
readonly description = "CDK 17 deleted the `@import` entry points of `@angular/cdk/overlay`,
|
|
55
|
-
"`@angular/cdk/text-field`. Replaces
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"styles does, keep referring to that declaration. A partial that other stylesheets `@import` and that defines " +
|
|
59
|
-
"members next to its own `@import` rules is marked instead, since adding `@use` to it can change which of those " +
|
|
60
|
-
"members its importers see. This ports the CDK part of the theming API migration of `@angular/material` 12.";
|
|
54
|
+
readonly description = "CDK 17 deleted the `@import` entry points of `@angular/cdk/overlay`, " +
|
|
55
|
+
"`@angular/cdk/a11y` and `@angular/cdk/text-field`. Replaces them with `@use '@angular/cdk' as cdk` and " +
|
|
56
|
+
"renames the `cdk-` prefixed members they exposed, such as `cdk-overlay()` to `cdk.overlay()`. A partial " +
|
|
57
|
+
"whose importers could see other members after the change is marked instead.";
|
|
61
58
|
|
|
62
59
|
initialValue(_ctx: ExecutionContext): Accumulator {
|
|
63
60
|
return {declared: new Set(), imported: new Set()};
|
|
@@ -9,8 +9,8 @@ import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
|
9
9
|
import {isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {create} from "mutative";
|
|
11
11
|
import {importedNames} from "../components/symbols";
|
|
12
|
-
import {extendedClassName, isSuperCall} from "../components/lst";
|
|
13
|
-
import {
|
|
12
|
+
import {argumentCount, extendedClassName, isSuperCall} from "../components/lst";
|
|
13
|
+
import {isCdkClass} from "./find-cdk-signature-changes";
|
|
14
14
|
|
|
15
15
|
export class MigrateCdkStepper extends Recipe {
|
|
16
16
|
readonly name = "org.openrewrite.angular.cdk.MigrateCdkStepper";
|
|
@@ -21,10 +21,8 @@ const VARIABLES: Record<string, string> = {
|
|
|
21
21
|
export class MigrateDeprecatedOverlaySass extends StylesheetRecipe {
|
|
22
22
|
readonly name = "org.openrewrite.angular.cdk.MigrateDeprecatedOverlaySass";
|
|
23
23
|
readonly displayName = "Migrate the removed CDK overlay Sass variables";
|
|
24
|
-
readonly description = "CDK 21 deleted `@angular/cdk/overlay/index-deprecated
|
|
25
|
-
"
|
|
26
|
-
"with `@angular/cdk/overlay` and renames the variables to `$overlay-container-z-index`, `$overlay-z-index`, " +
|
|
27
|
-
"`$overlay-backdrop-z-index` and `$overlay-backdrop-color`.";
|
|
24
|
+
readonly description = "CDK 21 deleted `@angular/cdk/overlay/index-deprecated`. Replaces its `@use` with " +
|
|
25
|
+
"`@angular/cdk/overlay` and renames its variables, such as `$z-index-overlay` to `$overlay-z-index`.";
|
|
28
26
|
|
|
29
27
|
protected acceptsPath(sourcePath: string): boolean {
|
|
30
28
|
return sourcePath.endsWith('.scss');
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import {ExecutionContext, foundSearchResult, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
8
|
import {JavaScriptVisitor, Template} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {isLiteral, J, Type} from "@openrewrite/rewrite/java";
|
|
10
|
-
import {argumentCount
|
|
10
|
+
import {argumentCount} from "../components/lst";
|
|
11
|
+
import {isCdkClass} from "./find-cdk-signature-changes";
|
|
11
12
|
|
|
12
13
|
export class MigrateFocusTrapFactoryCreate extends Recipe {
|
|
13
14
|
readonly name = "org.openrewrite.angular.cdk.MigrateFocusTrapFactoryCreate";
|
|
@@ -8,8 +8,7 @@ import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
|
8
8
|
import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {J} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {importedNames} from "../components/symbols";
|
|
11
|
-
import {emptyArguments, extendedClassName, isSuperCall} from "../components/lst";
|
|
12
|
-
import {argumentCount} from "./find-cdk-signature-changes";
|
|
11
|
+
import {argumentCount, emptyArguments, extendedClassName, isSuperCall} from "../components/lst";
|
|
13
12
|
|
|
14
13
|
/** Classes whose constructor was `constructor(...args: unknown[])` in CDK 21 and takes no arguments in CDK 22. */
|
|
15
14
|
const ZERO_ARGUMENT_CONSTRUCTORS: Record<string, string[]> = {
|
|
@@ -8,7 +8,7 @@ import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
|
8
8
|
import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {Expression, isIdentifier, J, Type} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {importedNames} from "../components/symbols";
|
|
11
|
-
import {argumentCount} from "
|
|
11
|
+
import {argumentCount} from "../components/lst";
|
|
12
12
|
|
|
13
13
|
interface RemovedParameters {
|
|
14
14
|
/** Index of the `ComponentFactoryResolver` parameter. */
|
|
@@ -30,11 +30,9 @@ const REMOVED_PARAMETERS: Record<string, RemovedParameters> = {
|
|
|
30
30
|
export class RemovePortalFactoryResolverArguments extends Recipe {
|
|
31
31
|
readonly name = "org.openrewrite.angular.cdk.RemovePortalFactoryResolverArguments";
|
|
32
32
|
readonly displayName = "Remove the `ComponentFactoryResolver` argument of CDK portals";
|
|
33
|
-
readonly description = "CDK 20 removed the
|
|
34
|
-
"constructor and the `ComponentFactoryResolver` and `Document` parameters of the `DomPortalOutlet`
|
|
35
|
-
"Removes those arguments from `new ComponentPortal(...)` and `new DomPortalOutlet(...)
|
|
36
|
-
"line up with the new parameter lists. A call that also fits the new parameter list is only changed when the " +
|
|
37
|
-
"argument is typed or named as a `ComponentFactoryResolver`.";
|
|
33
|
+
readonly description = "CDK 20 removed the `ComponentFactoryResolver` parameter of the `ComponentPortal` " +
|
|
34
|
+
"constructor and the `ComponentFactoryResolver` and `Document` parameters of the `DomPortalOutlet` " +
|
|
35
|
+
"constructor. Removes those arguments from `new ComponentPortal(...)` and `new DomPortalOutlet(...)`.";
|
|
38
36
|
|
|
39
37
|
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
40
38
|
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
@@ -11,10 +11,9 @@ import {RenameTemplateAttributes, renameTemplateAttributes} from "../components/
|
|
|
11
11
|
export class RenamePortalTemplateSelectors extends RenameTemplateAttributes {
|
|
12
12
|
readonly name = "org.openrewrite.angular.cdk.RenamePortalTemplateSelectors";
|
|
13
13
|
readonly displayName = "Rename the removed CDK portal directive selectors";
|
|
14
|
-
readonly description = "CDK 21 removed `PortalHostDirective` and `TemplatePortalDirective`. Renames the
|
|
15
|
-
"only they matched
|
|
16
|
-
"
|
|
17
|
-
"`<ng-template cdkPortal>`, in `.html` templates and inline `template` metadata.";
|
|
14
|
+
readonly description = "CDK 21 removed `PortalHostDirective` and `TemplatePortalDirective`. Renames the " +
|
|
15
|
+
"selectors only they matched in templates, such as `[cdkPortalHost]` to `[cdkPortalOutlet]` and " +
|
|
16
|
+
"`<ng-template cdk-portal>` to `<ng-template cdkPortal>`.";
|
|
18
17
|
|
|
19
18
|
protected readonly attributes = [
|
|
20
19
|
{name: 'cdkPortalHost', newName: 'cdkPortalOutlet'},
|
|
@@ -76,10 +76,8 @@ export class UpgradeToCdk17CodeChanges extends Recipe {
|
|
|
76
76
|
export class UpgradeToCdk20CodeChanges extends Recipe {
|
|
77
77
|
readonly name = "org.openrewrite.angular.cdk.UpgradeToCdk20CodeChanges";
|
|
78
78
|
readonly displayName = "Angular CDK 20 code changes";
|
|
79
|
-
readonly description = "The
|
|
80
|
-
"`*PortalHost` aliases to their `*PortalOutlet` classes
|
|
81
|
-
"portal constructors, migrates `DragDropRegistry` off its type arguments and `scroll` subject, and finds the " +
|
|
82
|
-
"removed dialog, portal and table APIs and the `SelectionModel` overrides that still return `void`. " +
|
|
79
|
+
readonly description = "The source changes of the `@angular/cdk` 20 migration, such as renaming the removed " +
|
|
80
|
+
"`*PortalHost` aliases to their `*PortalOutlet` classes. Removed APIs without a replacement are marked. " +
|
|
83
81
|
"`UpgradeToAngular20` includes this recipe.";
|
|
84
82
|
|
|
85
83
|
async recipeList(): Promise<Recipe[]> {
|
|
@@ -102,10 +100,9 @@ export class UpgradeToCdk20CodeChanges extends Recipe {
|
|
|
102
100
|
export class UpgradeToCdk21CodeChanges extends Recipe {
|
|
103
101
|
readonly name = "org.openrewrite.angular.cdk.UpgradeToCdk21CodeChanges";
|
|
104
102
|
readonly displayName = "Angular CDK 21 code changes";
|
|
105
|
-
readonly description = "The
|
|
106
|
-
"`TemplatePortalDirective` and `PortalHostDirective` with `CdkPortal` and `CdkPortalOutlet
|
|
107
|
-
"
|
|
108
|
-
"`UpgradeToAngular21` includes this recipe.";
|
|
103
|
+
readonly description = "The source changes of the `@angular/cdk` 21 migration, such as replacing " +
|
|
104
|
+
"`TemplatePortalDirective` and `PortalHostDirective` with `CdkPortal` and `CdkPortalOutlet`. Removed APIs " +
|
|
105
|
+
"without a replacement are marked. `UpgradeToAngular21` includes this recipe.";
|
|
109
106
|
|
|
110
107
|
async recipeList(): Promise<Recipe[]> {
|
|
111
108
|
return [
|
|
@@ -125,10 +122,8 @@ export class UpgradeToCdk21CodeChanges extends Recipe {
|
|
|
125
122
|
export class UpgradeToCdk22CodeChanges extends Recipe {
|
|
126
123
|
readonly name = "org.openrewrite.angular.cdk.UpgradeToCdk22CodeChanges";
|
|
127
124
|
readonly displayName = "Angular CDK 22 code changes";
|
|
128
|
-
readonly description = "The
|
|
129
|
-
"to `MenuTracker
|
|
130
|
-
"overload of `ConfigurableFocusTrapFactory.create`, and finds the removed " +
|
|
131
|
-
"`AriaDescriber` constants and the calls missing a now-required `Injector` or `event` argument. " +
|
|
125
|
+
readonly description = "The source changes of the `@angular/cdk` 22 migration, such as renaming " +
|
|
126
|
+
"`ContextMenuTracker` to `MenuTracker`. Removed APIs and calls missing a now-required argument are marked. " +
|
|
132
127
|
"`UpgradeToAngular22` includes this recipe.";
|
|
133
128
|
|
|
134
129
|
async recipeList(): Promise<Recipe[]> {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {emptyMarkers, Markers, MarkersKind, randomId, SearchResult} from "@openrewrite/rewrite";
|
|
7
|
+
import {Cursor, emptyMarkers, ExecutionContext, Markers, MarkersKind, randomId, SearchResult, Tree, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
8
|
import {JS} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {emptySpace, Expression, isIdentifier, isLiteral, J} from "@openrewrite/rewrite/java";
|
|
10
10
|
|
|
@@ -37,6 +37,22 @@ export function extendedClassName(classDecl: J.ClassDeclaration): string | undef
|
|
|
37
37
|
return extended && isIdentifier(extended) ? extended.simpleName : undefined;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/** A visitor that runs `first` and then `second`, each of which returns a source file it does not accept unchanged. */
|
|
41
|
+
export function inSequence(first: TreeVisitor<any, ExecutionContext>, second: TreeVisitor<any, ExecutionContext>): TreeVisitor<any, ExecutionContext> {
|
|
42
|
+
return new class extends TreeVisitor<any, ExecutionContext> {
|
|
43
|
+
async visit<R extends Tree>(tree: Tree, p: ExecutionContext, parent?: Cursor): Promise<R | undefined> {
|
|
44
|
+
const visited = await first.visit<Tree>(tree, p, parent);
|
|
45
|
+
return visited && await second.visit(visited, p, parent) as R | undefined;
|
|
46
|
+
}
|
|
47
|
+
}();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The number of arguments in an argument list, which an empty `()` holds as a single `J.Empty`. */
|
|
51
|
+
export function argumentCount(container: J.Container<J> | undefined): number {
|
|
52
|
+
const elements = container?.elements ?? [];
|
|
53
|
+
return elements.length === 1 && elements[0].element.kind === J.Kind.Empty ? 0 : elements.length;
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
/** Whether a function call is a `super(...)` constructor call. */
|
|
41
57
|
export function isSuperCall(call: JS.FunctionCall): boolean {
|
|
42
58
|
const fn = call.function?.element;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {Cursor, ExecutionContext,
|
|
7
|
+
import {Cursor, ExecutionContext, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
8
|
import {PlainText, PlainTextVisitor} from "@openrewrite/rewrite/text";
|
|
9
9
|
import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
10
10
|
import {J} from "@openrewrite/rewrite/java";
|
|
11
|
-
import {propertyName} from "./lst";
|
|
11
|
+
import {inSequence, propertyName} from "./lst";
|
|
12
12
|
import {isStylesheet} from "./stylesheets";
|
|
13
13
|
import {requote} from "./templates";
|
|
14
14
|
|
|
@@ -38,35 +38,24 @@ export function migrateInlineStyle(literal: J.Literal, cursor: Cursor, migrate:
|
|
|
38
38
|
* Rewrites the text of stylesheets, `.html` templates and TypeScript string literals, which hold inline templates and
|
|
39
39
|
* styles as well as selectors passed to calls such as `querySelector`.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return valueSource === l.valueSource ? l : {...l, valueSource, value: rewrite(l.value)} as J.Literal;
|
|
60
|
-
}
|
|
61
|
-
}();
|
|
62
|
-
// Each visitor returns a source file it does not accept unchanged.
|
|
63
|
-
return new class extends TreeVisitor<any, ExecutionContext> {
|
|
64
|
-
async visit<R extends Tree>(tree: Tree, p: ExecutionContext, parent?: Cursor): Promise<R | undefined> {
|
|
65
|
-
const visited = await files.visit<Tree>(tree, p, parent);
|
|
66
|
-
return visited && await literals.visit(visited, p, parent) as R | undefined;
|
|
67
|
-
}
|
|
68
|
-
}();
|
|
69
|
-
}
|
|
41
|
+
export function styleSourcesEditor(rewrite: (text: string) => string): TreeVisitor<any, ExecutionContext> {
|
|
42
|
+
const files = new class extends PlainTextVisitor<ExecutionContext> {
|
|
43
|
+
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
44
|
+
const t = await super.visitText(text, p) as PlainText;
|
|
45
|
+
if (!t || !(isStylesheet(t.sourcePath) || t.sourcePath.endsWith('.html'))) return t;
|
|
46
|
+
const updated = rewrite(t.text);
|
|
47
|
+
return updated === t.text ? t : {...t, text: updated, snippets: []};
|
|
48
|
+
}
|
|
49
|
+
}();
|
|
50
|
+
const literals = new class extends JavaScriptVisitor<ExecutionContext> {
|
|
51
|
+
protected async visitLiteral(literal: J.Literal, p: ExecutionContext): Promise<J | undefined> {
|
|
52
|
+
const l = await super.visitLiteral(literal, p) as J.Literal;
|
|
53
|
+
if (typeof l.value !== 'string' || !l.valueSource) return l;
|
|
54
|
+
const valueSource = rewrite(l.valueSource);
|
|
55
|
+
return valueSource === l.valueSource ? l : {...l, valueSource, value: rewrite(l.value)} as J.Literal;
|
|
56
|
+
}
|
|
57
|
+
}();
|
|
58
|
+
return inSequence(files, literals);
|
|
70
59
|
}
|
|
71
60
|
|
|
72
61
|
/** Replaces each name with its new name where no name character follows, longest names first. */
|
|
@@ -19,19 +19,22 @@ export abstract class StylesheetRecipe extends Recipe {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
-
|
|
23
|
-
const acceptsPath = (sourcePath: string) => this.acceptsPath(sourcePath);
|
|
24
|
-
return new class extends PlainTextVisitor<ExecutionContext> {
|
|
25
|
-
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
26
|
-
const t = await super.visitText(text, p) as PlainText;
|
|
27
|
-
if (!t || !acceptsPath(t.sourcePath)) return t;
|
|
28
|
-
const updated = migrate(t.text);
|
|
29
|
-
return updated === t.text ? t : {...t, text: updated, snippets: []};
|
|
30
|
-
}
|
|
31
|
-
}();
|
|
22
|
+
return stylesheetEditor(content => this.migrate(content), sourcePath => this.acceptsPath(sourcePath));
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
25
|
|
|
26
|
+
export function stylesheetEditor(migrate: (content: string) => string,
|
|
27
|
+
acceptsPath: (sourcePath: string) => boolean = isStylesheet): TreeVisitor<any, ExecutionContext> {
|
|
28
|
+
return new class extends PlainTextVisitor<ExecutionContext> {
|
|
29
|
+
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
30
|
+
const t = await super.visitText(text, p) as PlainText;
|
|
31
|
+
if (!t || !acceptsPath(t.sourcePath)) return t;
|
|
32
|
+
const updated = migrate(t.text);
|
|
33
|
+
return updated === t.text ? t : {...t, text: updated, snippets: []};
|
|
34
|
+
}
|
|
35
|
+
}();
|
|
36
|
+
}
|
|
37
|
+
|
|
35
38
|
export function isStylesheet(sourcePath: string): boolean {
|
|
36
39
|
return sourcePath.endsWith('.scss') || sourcePath.endsWith('.css');
|
|
37
40
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {ExecutionContext, findMarker, foundSearchResult, MarkersKind,
|
|
7
|
+
import {ExecutionContext, findMarker, foundSearchResult, MarkersKind, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
8
|
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
10
|
|
|
@@ -23,99 +23,14 @@ export interface RemovedSymbol {
|
|
|
23
23
|
message: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* One `ChangeImport` per renamed symbol, which also carries every reference bound to the import, plus a rename of
|
|
28
|
-
* namespace-qualified references and re-exports for symbols that stay in their module.
|
|
29
|
-
*/
|
|
26
|
+
/** One `ChangeImport` per renamed symbol, which also covers namespace-qualified references and re-exports. */
|
|
30
27
|
export function renameSymbols(symbols: RenamedSymbol[]): Recipe[] {
|
|
31
|
-
return symbols.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}),
|
|
38
|
-
...(s.newModule && s.newModule !== s.module ? [] : [new RenameNamespacedSymbol({module: s.module, name: s.name, newName: s.newName})]),
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Renames an exported symbol where `ChangeImport` does not reach it: `ns.Symbol` through a namespace import, and `export {Symbol} from` re-exports. */
|
|
43
|
-
export class RenameNamespacedSymbol extends Recipe {
|
|
44
|
-
readonly name = "org.openrewrite.angular.components.RenameNamespacedSymbol";
|
|
45
|
-
readonly displayName = "Rename a namespace-qualified or re-exported symbol";
|
|
46
|
-
readonly description = "Renames references to an exported symbol through a namespace import of its module, such " +
|
|
47
|
-
"as `ns.Symbol`, and named re-exports of it from that module.";
|
|
48
|
-
|
|
49
|
-
@Option({displayName: "Module", description: "The module that exports the symbol.", example: "@angular/material/button-toggle"})
|
|
50
|
-
module!: string;
|
|
51
|
-
|
|
52
|
-
@Option({displayName: "Name", description: "The current name of the symbol.", example: "MatButtonToggleGroupMultiple"})
|
|
53
|
-
symbolName!: string;
|
|
54
|
-
|
|
55
|
-
@Option({displayName: "New name", description: "The new name of the symbol.", example: "MatButtonToggleGroup"})
|
|
56
|
-
newName!: string;
|
|
57
|
-
|
|
58
|
-
constructor(options?: {module?: string; name?: string; newName?: string}) {
|
|
59
|
-
super();
|
|
60
|
-
this.module = options?.module ?? '';
|
|
61
|
-
this.symbolName = options?.name ?? '';
|
|
62
|
-
this.newName = options?.newName ?? '';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
66
|
-
const {module, symbolName, newName} = this;
|
|
67
|
-
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
68
|
-
private namespaces = new Set<string>();
|
|
69
|
-
|
|
70
|
-
protected async visitJsCompilationUnit(cu: JS.CompilationUnit, p: ExecutionContext): Promise<J | undefined> {
|
|
71
|
-
this.namespaces = new Set(cu.statements.map(s => s.element)
|
|
72
|
-
.filter(s => s.kind === JS.Kind.Import && moduleOf(s as JS.Import) === module)
|
|
73
|
-
.map(s => (s as JS.Import).importClause?.namedBindings)
|
|
74
|
-
.filter((b): b is JS.Alias => b?.kind === JS.Kind.Alias)
|
|
75
|
-
.map(b => b.alias)
|
|
76
|
-
.filter(isIdentifier)
|
|
77
|
-
.map(alias => alias.simpleName));
|
|
78
|
-
return super.visitJsCompilationUnit(cu, p);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected async visitFieldAccess(fieldAccess: J.FieldAccess, p: ExecutionContext): Promise<J | undefined> {
|
|
82
|
-
const f = await super.visitFieldAccess(fieldAccess, p) as J.FieldAccess;
|
|
83
|
-
const name = f.name.element;
|
|
84
|
-
if (name.simpleName !== symbolName || !isIdentifier(f.target) || !this.namespaces.has(f.target.simpleName)) return f;
|
|
85
|
-
return {...f, name: {...f.name, element: {...name, simpleName: newName}}} as J.FieldAccess;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
protected async visitExportDeclaration(exportDeclaration: JS.ExportDeclaration, p: ExecutionContext): Promise<J | undefined> {
|
|
89
|
-
const e = await super.visitExportDeclaration(exportDeclaration, p) as JS.ExportDeclaration;
|
|
90
|
-
const specifier = e.moduleSpecifier?.element;
|
|
91
|
-
if (specifier?.kind !== J.Kind.Literal || (specifier as J.Literal).value !== module) return e;
|
|
92
|
-
if (e.exportClause?.kind !== JS.Kind.NamedExports) return e;
|
|
93
|
-
const named = e.exportClause as JS.NamedExports;
|
|
94
|
-
let changed = false;
|
|
95
|
-
const elements = named.elements.elements.map(element => {
|
|
96
|
-
const spec = element.element as JS.ExportSpecifier;
|
|
97
|
-
if (spec.kind !== JS.Kind.ExportSpecifier) return element;
|
|
98
|
-
const exported = spec.specifier;
|
|
99
|
-
if (isIdentifier(exported) && exported.simpleName === symbolName) {
|
|
100
|
-
changed = true;
|
|
101
|
-
return {...element, element: {...spec, specifier: {...exported, simpleName: newName}}};
|
|
102
|
-
}
|
|
103
|
-
if (exported.kind === JS.Kind.Alias) {
|
|
104
|
-
const alias = exported as JS.Alias;
|
|
105
|
-
const property = alias.propertyName.element;
|
|
106
|
-
if (isIdentifier(property) && property.simpleName === symbolName) {
|
|
107
|
-
changed = true;
|
|
108
|
-
const renamed = {...alias, propertyName: {...alias.propertyName, element: {...property, simpleName: newName}}};
|
|
109
|
-
return {...element, element: {...spec, specifier: renamed}};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return element;
|
|
113
|
-
});
|
|
114
|
-
if (!changed) return e;
|
|
115
|
-
return {...e, exportClause: {...named, elements: {...named.elements, elements}}} as JS.ExportDeclaration;
|
|
116
|
-
}
|
|
117
|
-
}();
|
|
118
|
-
}
|
|
28
|
+
return symbols.map(s => new ChangeImport({
|
|
29
|
+
oldModule: s.module,
|
|
30
|
+
oldMember: s.name,
|
|
31
|
+
newModule: s.newModule ?? s.module,
|
|
32
|
+
newMember: s.newName,
|
|
33
|
+
}));
|
|
119
34
|
}
|
|
120
35
|
|
|
121
36
|
/** Local names that the imports of a compilation unit bind to the given symbols of the given module. */
|
|
@@ -178,12 +93,13 @@ export abstract class FindRemovedSymbols extends Recipe {
|
|
|
178
93
|
}
|
|
179
94
|
}
|
|
180
95
|
|
|
181
|
-
export function moduleOf(
|
|
182
|
-
const specifier =
|
|
96
|
+
export function moduleOf(declaration: JS.Import | JS.ExportDeclaration): string | undefined {
|
|
97
|
+
const specifier = declaration.moduleSpecifier?.element;
|
|
183
98
|
return specifier?.kind === J.Kind.Literal ? (specifier as J.Literal).value as string : undefined;
|
|
184
99
|
}
|
|
185
100
|
|
|
186
|
-
|
|
101
|
+
/** The name taken from the module, such as `Old` in `{Old as New}`. */
|
|
102
|
+
export function importedName(spec: JS.ImportSpecifier | JS.ExportSpecifier): string | undefined {
|
|
187
103
|
const specifier = spec.specifier;
|
|
188
104
|
if (isIdentifier(specifier)) return specifier.simpleName;
|
|
189
105
|
if (specifier.kind === JS.Kind.Alias) {
|
|
@@ -84,6 +84,11 @@ export function attributeNamed(element: TemplateElement, name: string): Template
|
|
|
84
84
|
return element.attributes.find(a => bareName(a) === name);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/** The value of a plain attribute, or of a property binding to a single-quoted word such as `[appearance]="'fill'"`. */
|
|
88
|
+
export function literalValue(attribute: TemplateAttribute): string | undefined {
|
|
89
|
+
return attribute.name.startsWith('[') ? attribute.value?.trim().match(/^'(\w+)'$/)?.[1] : attribute.value?.trim();
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
export function descendants(element: TemplateElement): TemplateElement[] {
|
|
88
93
|
return element.children.flatMap(child => [child, ...descendants(child)]);
|
|
89
94
|
}
|