@nx/angular 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca
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/LICENSE +1 -1
- package/README.md +1 -1
- package/executors.d.ts +1 -6
- package/executors.js +2 -3
- package/executors.json +2 -2
- package/fesm2022/nx-angular-mf.mjs +64 -0
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs +0 -352
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.d.ts +0 -1
- package/generators.js +0 -1
- package/generators.json +19 -18
- package/index.d.ts +1 -1
- package/mf/mf.d.ts +64 -0
- package/migrations.json +778 -1289
- package/module-federation/index.d.ts +5 -2
- package/module-federation/index.js +3 -4
- package/ng-package.json +2 -2
- package/package.json +17 -29
- package/src/builders/dev-server/dev-server.impl.js +6 -4
- package/src/builders/dev-server/lib/normalize-options.js +3 -0
- package/src/builders/dev-server/lib/validate-options.js +1 -9
- package/src/builders/dev-server/schema.d.ts +3 -0
- package/src/builders/dev-server/schema.json +8 -8
- package/src/builders/webpack-browser/schema.d.ts +0 -5
- package/src/builders/webpack-browser/schema.json +0 -2
- package/src/builders/webpack-browser/webpack-browser.impl.js +3 -4
- package/src/builders/webpack-server/schema.json +0 -1
- package/src/executors/application/application.impl.d.ts +1 -1
- package/src/executors/application/application.impl.js +4 -1
- package/src/executors/application/schema.json +78 -8
- package/src/executors/application/utils/normalize-options.d.ts +2 -0
- package/src/executors/application/utils/normalize-options.js +34 -0
- package/src/executors/application/utils/validate-options.js +18 -4
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +1 -1
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +0 -9
- package/src/executors/browser-esbuild/schema.json +1 -3
- package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -3
- package/src/executors/delegate-build/delegate-build.impl.js +0 -3
- package/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/src/executors/module-federation-dev-server/lib/index.js +0 -2
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -0
- package/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +5 -31
- package/src/executors/module-federation-dev-server/schema.d.ts +4 -0
- package/src/executors/module-federation-dev-server/schema.json +2 -1
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +2 -2
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +1 -0
- package/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +7 -35
- package/src/executors/module-federation-ssr-dev-server/schema.d.ts +8 -14
- package/src/executors/module-federation-ssr-dev-server/schema.json +1 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +3 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +22 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.d.ts +2 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.js +17 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+/ng-package → ng-package}/entry-point/write-bundles.transform.d.ts +3 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +49 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.d.ts +2 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +7 -26
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.d.ts +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +1 -1
- package/src/executors/ng-packagr-lite/schema.json +3 -7
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.d.ts +2 -3
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -21
- package/src/executors/package/package.impl.d.ts +2 -2
- package/src/executors/package/package.impl.js +6 -4
- package/src/executors/package/schema.d.ts +4 -6
- package/src/executors/package/schema.json +4 -10
- package/src/executors/utilities/ng-packagr/ng-packagr-version.d.ts +2 -0
- package/src/executors/utilities/ng-packagr/ng-packagr-version.js +11 -0
- package/src/executors/utilities/ng-packagr/package-imports.d.ts +1 -0
- package/src/executors/utilities/ng-packagr/package-imports.js +10 -0
- package/src/executors/utilities/ng-packagr/{stylesheet-processor.js → pre-v19/stylesheet-processor.js} +4 -4
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +23 -14
- package/src/executors/utilities/ng-packagr/tailwindcss.d.ts +0 -6
- package/src/executors/utilities/ng-packagr/tailwindcss.js +0 -32
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +14 -0
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +99 -0
- package/src/generators/add-linting/add-linting.js +2 -17
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
- package/src/generators/add-linting/schema.d.ts +1 -0
- package/src/generators/application/application.d.ts +0 -1
- package/src/generators/application/application.js +24 -9
- package/src/generators/application/files/ng-module/src/app/app.component.html__tpl__ +8 -1
- package/src/generators/application/files/ng-module/src/app/app.component.ts__tpl__ +4 -5
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
- package/src/generators/application/files/standalone-components/src/app/app.component.html__tpl__ +8 -1
- package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__ +4 -6
- package/src/generators/application/lib/add-e2e.js +2 -9
- package/src/generators/application/lib/add-linting.js +2 -2
- package/src/generators/application/lib/add-serve-static-target.d.ts +1 -1
- package/src/generators/application/lib/add-serve-static-target.js +2 -3
- package/src/generators/application/lib/add-unit-test-runner.js +20 -7
- package/src/generators/application/lib/create-files.js +4 -1
- package/src/generators/application/lib/create-project.js +25 -31
- package/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/src/generators/application/lib/normalize-options.js +14 -15
- package/src/generators/application/schema.d.ts +5 -6
- package/src/generators/application/schema.json +16 -21
- package/src/generators/component/component.d.ts +0 -1
- package/src/generators/component/component.js +4 -7
- package/src/generators/component/files/__fileName__.__style__ +1 -1
- package/src/generators/component/files/__fileName__.spec.ts__tpl__ +1 -1
- package/src/generators/component/files/__fileName__.ts__tpl__ +5 -13
- package/src/generators/component/lib/normalize-options.js +8 -6
- package/src/generators/component/schema.d.ts +3 -18
- package/src/generators/component/schema.json +11 -28
- package/src/generators/component-story/files/__componentFileName__.stories.ts__tmpl__ +4 -4
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +1 -4
- package/src/generators/convert-to-application-executor/schema.json +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +4 -0
- package/src/generators/convert-to-rspack/convert-to-rspack.js +357 -0
- package/src/generators/convert-to-rspack/lib/create-config.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/create-config.js +45 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +6 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +77 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.js +26 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.js +14 -0
- package/src/generators/convert-to-rspack/schema.d.ts +5 -0
- package/src/generators/convert-to-rspack/schema.json +30 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +1 -2
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +1 -7
- package/src/generators/directive/directive.js +5 -0
- package/src/generators/directive/files/__fileName__.ts__tpl__ +2 -2
- package/src/generators/directive/lib/normalize-options.js +6 -7
- package/src/generators/directive/schema.d.ts +2 -17
- package/src/generators/directive/schema.json +20 -28
- package/src/generators/federate-module/lib/add-remote.js +0 -3
- package/src/generators/federate-module/schema.d.ts +0 -2
- package/src/generators/federate-module/schema.json +19 -16
- package/src/generators/host/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
- package/src/generators/host/files/js/webpack.server.config.js__tmpl__ +1 -1
- package/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/host.d.ts +1 -2
- package/src/generators/host/host.js +33 -25
- package/src/generators/host/lib/update-ssr-setup.js +7 -3
- package/src/generators/host/schema.d.ts +4 -5
- package/src/generators/host/schema.json +34 -27
- package/src/generators/init/init.js +3 -1
- package/src/generators/library/files/base/README.md__tpl__ +2 -2
- package/src/generators/library/lib/add-project.d.ts +1 -1
- package/src/generators/library/lib/add-project.js +7 -1
- package/src/generators/library/lib/add-standalone-component.js +4 -3
- package/src/generators/library/lib/normalize-options.js +4 -5
- package/src/generators/library/lib/normalized-schema.d.ts +2 -3
- package/src/generators/library/library.d.ts +0 -1
- package/src/generators/library/library.js +27 -19
- package/src/generators/library/schema.d.ts +2 -5
- package/src/generators/library/schema.json +9 -20
- package/src/generators/move/lib/update-secondary-entry-points.js +1 -0
- package/src/generators/move/move.d.ts +3 -1
- package/src/generators/move/move.js +4 -8
- package/src/generators/move/schema.d.ts +0 -3
- package/src/generators/move/schema.json +0 -5
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
- package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +1 -1
- package/src/generators/ng-add/migrators/builders/builder.migrator.d.ts +2 -2
- package/src/generators/ng-add/migrators/builders/builder.migrator.js +4 -4
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +4 -4
- package/src/generators/ng-add/migrators/projects/project.migrator.js +1 -1
- package/src/generators/ng-add/utilities/validation-logging.js +5 -4
- package/src/generators/ng-add/utilities/workspace.js +5 -2
- package/src/generators/ngrx/ngrx.d.ts +3 -0
- package/src/generators/ngrx/ngrx.js +3 -0
- package/src/generators/ngrx/schema.json +1 -1
- package/src/generators/ngrx-feature-store/schema.d.ts +1 -1
- package/src/generators/ngrx-root-store/lib/add-imports.js +4 -4
- package/src/generators/ngrx-root-store/lib/normalize-options.js +3 -2
- package/src/generators/pipe/files/__fileName__.ts__tpl__ +2 -2
- package/src/generators/pipe/lib/normalize-options.js +6 -7
- package/src/generators/pipe/pipe.js +5 -0
- package/src/generators/pipe/schema.d.ts +2 -17
- package/src/generators/pipe/schema.json +20 -28
- package/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +1 -1
- package/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
- package/src/generators/remote/lib/update-ssr-setup.js +7 -3
- package/src/generators/remote/remote.d.ts +1 -2
- package/src/generators/remote/remote.js +38 -14
- package/src/generators/remote/schema.d.ts +4 -5
- package/src/generators/remote/schema.json +32 -25
- package/src/generators/scam/lib/normalize-options.js +6 -7
- package/src/generators/scam/scam.js +0 -2
- package/src/generators/scam/schema.d.ts +3 -17
- package/src/generators/scam/schema.json +16 -30
- package/src/generators/scam-directive/lib/normalize-options.js +6 -7
- package/src/generators/scam-directive/scam-directive.js +0 -2
- package/src/generators/scam-directive/schema.d.ts +3 -17
- package/src/generators/scam-directive/schema.json +16 -31
- package/src/generators/scam-pipe/lib/normalize-options.js +6 -7
- package/src/generators/scam-pipe/scam-pipe.js +0 -2
- package/src/generators/scam-pipe/schema.d.ts +3 -17
- package/src/generators/scam-pipe/schema.json +16 -31
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +1 -1
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +5 -4
- package/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.js +3 -1
- package/src/generators/setup-mf/files/entry-module-files/entry.component.ts__tmpl__ +2 -1
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.component.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +4 -1
- package/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +3 -0
- package/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.js +5 -0
- package/src/generators/setup-mf/lib/add-remote-to-host.js +21 -8
- package/src/generators/setup-mf/lib/fix-bootstrap.js +3 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js +1 -0
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.js +1 -1
- package/src/generators/setup-mf/schema.json +5 -3
- package/src/generators/setup-mf/setup-mf.js +5 -2
- package/src/generators/setup-ssr/files/{server → pre-v19/server}/application-builder/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/{server/server-builder/v17+ → pre-v19/server/server-builder}/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +13 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +66 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +14 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +67 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/root/tsconfig.server.json.template +16 -0
- package/src/generators/setup-ssr/files/{server/server-builder/pre-v17 → v19+/server-builder/server}/__serverFileName__ +25 -15
- package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
- package/src/generators/setup-ssr/lib/add-dependencies.js +6 -17
- package/src/generators/setup-ssr/lib/add-hydration.d.ts +2 -2
- package/src/generators/setup-ssr/lib/add-hydration.js +10 -2
- package/src/generators/setup-ssr/lib/add-server-file.d.ts +2 -2
- package/src/generators/setup-ssr/lib/add-server-file.js +24 -10
- package/src/generators/setup-ssr/lib/generate-files.d.ts +2 -2
- package/src/generators/setup-ssr/lib/generate-files.js +31 -8
- package/src/generators/setup-ssr/lib/generate-server-ts-config.d.ts +3 -3
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +24 -3
- package/src/generators/setup-ssr/lib/normalize-options.d.ts +3 -14
- package/src/generators/setup-ssr/lib/normalize-options.js +27 -6
- package/src/generators/setup-ssr/lib/set-router-initial-navigation.d.ts +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.d.ts +3 -3
- package/src/generators/setup-ssr/lib/update-project-config.js +37 -24
- package/src/generators/setup-ssr/lib/validate-options.js +5 -0
- package/src/generators/setup-ssr/schema.d.ts +5 -0
- package/src/generators/setup-ssr/schema.json +6 -8
- package/src/generators/setup-ssr/setup-ssr.js +6 -11
- package/src/generators/setup-tailwind/lib/index.d.ts +1 -1
- package/src/generators/setup-tailwind/lib/index.js +1 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +1 -1
- package/src/generators/setup-tailwind/lib/validate-build-target.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/{add-tailwind-config-path-to-project.js → validate-build-target.js} +5 -15
- package/src/generators/setup-tailwind/setup-tailwind.js +4 -1
- package/src/generators/stories/schema.d.ts +0 -2
- package/src/generators/stories/schema.json +0 -10
- package/src/generators/stories/stories.js +2 -21
- package/src/generators/storybook-configuration/lib/generate-stories.js +0 -6
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
- package/src/generators/storybook-configuration/schema.d.ts +0 -3
- package/src/generators/storybook-configuration/schema.json +0 -15
- package/src/generators/storybook-configuration/storybook-configuration.js +0 -3
- package/src/generators/utils/add-jest.d.ts +1 -0
- package/src/generators/utils/add-jest.js +5 -9
- package/src/generators/utils/add-vitest.d.ts +9 -0
- package/src/generators/utils/add-vitest.js +21 -0
- package/src/generators/utils/assert-mf-utils.d.ts +1 -0
- package/src/generators/utils/assert-mf-utils.js +11 -0
- package/src/generators/utils/ensure-angular-dependencies.js +0 -1
- package/src/generators/utils/storybook-ast/component-info.js +13 -3
- package/src/generators/utils/testing.js +15 -28
- package/src/generators/utils/validations.d.ts +1 -0
- package/src/generators/utils/validations.js +10 -0
- package/src/generators/utils/version-utils.d.ts +1 -0
- package/src/generators/utils/version-utils.js +7 -2
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
- package/src/migrations/update-19-6-0/turn-off-dts-by-default.js +2 -2
- package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.d.ts +3 -0
- package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.js +55 -0
- package/src/migrations/{update-14-2-0/remove-show-circular-dependencies-option.d.ts → update-20-2-0/disable-angular-eslint-prefer-standalone.d.ts} +1 -1
- package/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.js +55 -0
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.d.ts +2 -0
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +61 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts +2 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +41 -0
- package/src/migrations/update-20-2-0/remove-angular-eslint-rules.d.ts +3 -0
- package/src/migrations/update-20-2-0/remove-angular-eslint-rules.js +62 -0
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.d.ts +3 -0
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.js +73 -0
- package/src/migrations/{update-14-5-2 → update-20-2-0}/update-angular-cli.d.ts +1 -0
- package/src/migrations/{update-16-1-0 → update-20-2-0}/update-angular-cli.js +1 -1
- package/src/migrations/{update-14-2-0/update-libraries-secondary-entrypoints.d.ts → update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.d.ts} +1 -1
- package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.js +55 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts +2 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +18 -0
- package/src/migrations/{update-14-2-0 → update-20-4-0}/update-angular-cli.d.ts +1 -0
- package/src/migrations/{update-14-2-0 → update-20-4-0}/update-angular-cli.js +4 -3
- package/src/migrations/{update-14-6-0 → update-20-5-0}/update-angular-cli.d.ts +1 -0
- package/src/migrations/{update-14-5-2 → update-20-5-0}/update-angular-cli.js +4 -3
- package/src/migrations/{update-14-2-0/update-ngcc-target.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
- package/src/migrations/update-21-0-0/set-continuous-option.d.ts +3 -0
- package/src/migrations/update-21-0-0/set-continuous-option.js +29 -0
- package/src/plugins/plugin.js +7 -2
- package/src/utils/backward-compatible-versions.d.ts +4 -4
- package/src/utils/backward-compatible-versions.js +27 -23
- package/src/utils/nx-devkit/ast-utils.d.ts +3 -2
- package/src/utils/nx-devkit/ast-utils.js +22 -4
- package/src/utils/test-runners.d.ts +2 -1
- package/src/utils/test-runners.js +1 -0
- package/src/utils/versions.d.ts +13 -11
- package/src/utils/versions.js +14 -12
- package/esm2022/index.mjs +0 -2
- package/esm2022/mf/index.mjs +0 -2
- package/esm2022/mf/mf.mjs +0 -52
- package/esm2022/mf/nx-angular-mf.mjs +0 -5
- package/esm2022/nx-angular.mjs +0 -5
- package/esm2022/src/runtime/nx/data-persistence.mjs +0 -349
- package/esm2022/testing/index.mjs +0 -2
- package/esm2022/testing/nx-angular-testing.mjs +0 -5
- package/esm2022/testing/src/testing-utils.mjs +0 -38
- package/fesm2022/nx-angular-testing.mjs +0 -45
- package/fesm2022/nx-angular-testing.mjs.map +0 -1
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.js +0 -65
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.d.ts +0 -9
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +0 -51
- package/src/executors/module-federation-ssr-dev-server/lib/build-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-ssr-dev-server/lib/build-static-remotes.js +0 -65
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.js +0 -41
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.js +0 -27
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +0 -53
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.d.ts +0 -15
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.js +0 -28
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.d.ts +0 -30
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.js +0 -52
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.js +0 -20
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.d.ts +0 -9
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +0 -320
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +0 -35
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.js +0 -37
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +0 -178
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.d.ts +0 -42
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.d.ts +0 -10
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.js +0 -17
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +0 -201
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-bundles.di.d.ts +0 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-bundles.di.js +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-bundles.transform.js +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.di.d.ts +0 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.di.js +0 -18
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.d.ts +0 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.js +0 -286
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.js +0 -26
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +0 -71
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.d.ts +0 -13
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.js +0 -32
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +0 -35
- package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.js +0 -37
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +0 -13
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +0 -183
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.d.ts +0 -36
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.d.ts +0 -10
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.js +0 -17
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +0 -194
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.d.ts +0 -1
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +0 -9
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +0 -4
- package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -35
- package/src/generators/component-cypress-spec/files/__componentFileName__.__fileExt__ +0 -17
- package/src/generators/component-cypress-spec/lib/get-args-default-value.d.ts +0 -2
- package/src/generators/component-cypress-spec/lib/get-args-default-value.js +0 -24
- package/src/generators/component-cypress-spec/lib/get-component-selector.d.ts +0 -2
- package/src/generators/component-cypress-spec/lib/get-component-selector.js +0 -23
- package/src/generators/component-cypress-spec/schema.d.ts +0 -10
- package/src/generators/component-cypress-spec/schema.json +0 -66
- package/src/generators/host/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -66
- package/src/generators/remote/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -72
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.d.ts +0 -3
- package/src/generators/stories/lib/get-e2e-project.d.ts +0 -2
- package/src/generators/stories/lib/get-e2e-project.js +0 -14
- package/src/generators/storybook-configuration/lib/validate-options.d.ts +0 -2
- package/src/generators/storybook-configuration/lib/validate-options.js +0 -8
- package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +0 -23
- package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +0 -34
- package/src/migrations/update-14-2-0/update-ngcc-target.js +0 -17
- package/src/migrations/update-14-2-0/update-router-initial-navigation.d.ts +0 -2
- package/src/migrations/update-14-2-0/update-router-initial-navigation.js +0 -73
- package/src/migrations/update-14-2-0/update-tsconfig-target.d.ts +0 -2
- package/src/migrations/update-14-2-0/update-tsconfig-target.js +0 -155
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.d.ts +0 -5
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +0 -90
- package/src/migrations/update-14-6-0/update-angular-cli.js +0 -22
- package/src/migrations/update-14-8-0/rename-webpack-server.d.ts +0 -2
- package/src/migrations/update-14-8-0/rename-webpack-server.js +0 -21
- package/src/migrations/update-15-0-0/add-karma-inputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/add-karma-inputs.js +0 -41
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.d.ts +0 -2
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +0 -102
- package/src/migrations/update-15-2-0/remove-browserlist-config.d.ts +0 -4
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +0 -59
- package/src/migrations/update-15-2-0/remove-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +0 -62
- package/src/migrations/update-15-2-0/update-angular-cli.d.ts +0 -2
- package/src/migrations/update-15-2-0/update-angular-cli.js +0 -22
- package/src/migrations/update-15-2-0/update-karma-main-file.d.ts +0 -2
- package/src/migrations/update-15-2-0/update-karma-main-file.js +0 -72
- package/src/migrations/update-15-2-0/update-typescript-target.d.ts +0 -2
- package/src/migrations/update-15-2-0/update-typescript-target.js +0 -52
- package/src/migrations/update-15-2-0/update-workspace-config.d.ts +0 -2
- package/src/migrations/update-15-2-0/update-workspace-config.js +0 -24
- package/src/migrations/update-15-5-0/update-angular-cli.d.ts +0 -2
- package/src/migrations/update-15-5-0/update-angular-cli.js +0 -22
- package/src/migrations/update-15-7-0/install-required-packages.d.ts +0 -2
- package/src/migrations/update-15-7-0/install-required-packages.js +0 -36
- package/src/migrations/update-15-8-0/update-angular-cli.d.ts +0 -2
- package/src/migrations/update-15-8-0/update-angular-cli.js +0 -22
- package/src/migrations/update-15-9-0/update-file-server-executor.d.ts +0 -2
- package/src/migrations/update-15-9-0/update-file-server-executor.js +0 -42
- package/src/migrations/update-15-9-0/update-testing-tsconfig.d.ts +0 -3
- package/src/migrations/update-15-9-0/update-testing-tsconfig.js +0 -32
- package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
- package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
- package/src/migrations/update-16-1-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
- package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
- package/src/runtime/nx/data-persistence.d.ts +0 -276
- package/src/utils/mf/utils.d.ts +0 -15
- package/src/utils/mf/utils.js +0 -101
- package/src/utils/mf/with-module-federation-ssr.d.ts +0 -2
- package/src/utils/mf/with-module-federation-ssr.js +0 -68
- package/src/utils/mf/with-module-federation.d.ts +0 -2
- package/src/utils/mf/with-module-federation.js +0 -70
- package/testing/index.d.ts +0 -1
- package/testing/ng-package.json +0 -6
- package/testing/src/testing-utils.d.ts +0 -33
- /package/src/executors/utilities/ng-packagr/{stylesheet-processor.d.ts → pre-v19/stylesheet-processor.d.ts} +0 -0
- /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{root → pre-v19/root}/tsconfig.server.json__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/app/app.config.server.ts__tpl__ +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
-
const typescript_1 = require("typescript");
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
const printer = (0, typescript_1.createPrinter)();
|
|
9
|
-
const projects = await getProjectsWithAngularRouter(tree);
|
|
10
|
-
for (const project of projects) {
|
|
11
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, project.root, (filePath) => {
|
|
12
|
-
// we are only interested in .ts files
|
|
13
|
-
if (!filePath.endsWith('.ts')) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const content = tree.read(filePath, 'utf-8');
|
|
17
|
-
const ast = tsquery_1.tsquery.ast(content);
|
|
18
|
-
const routerModuleForRootCall = getRouterModuleForRootCall(ast);
|
|
19
|
-
if (!routerModuleForRootCall) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const initialNavigationAssignment = getInitialNavigationAssignment(routerModuleForRootCall.arguments[1]);
|
|
23
|
-
if (!initialNavigationAssignment) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const updatedInitialNavigationAssignment = printer.printNode(typescript_1.EmitHint.Unspecified, typescript_1.factory.updatePropertyAssignment(initialNavigationAssignment, initialNavigationAssignment.name, typescript_1.factory.createIdentifier(`'enabledBlocking'`)), initialNavigationAssignment.getSourceFile());
|
|
27
|
-
const updatedContent = `${content.slice(0, initialNavigationAssignment.getStart())}${updatedInitialNavigationAssignment}${content.slice(initialNavigationAssignment.getEnd())}`;
|
|
28
|
-
tree.write(filePath, updatedContent);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
32
|
-
}
|
|
33
|
-
function getInitialNavigationAssignment(extraOptionsLiteral) {
|
|
34
|
-
for (const prop of extraOptionsLiteral.properties) {
|
|
35
|
-
if ((0, typescript_1.isPropertyAssignment)(prop) &&
|
|
36
|
-
((0, typescript_1.isIdentifier)(prop.name) || (0, typescript_1.isStringLiteralLike)(prop.name)) &&
|
|
37
|
-
prop.name.text === 'initialNavigation' &&
|
|
38
|
-
needsMigration(prop)) {
|
|
39
|
-
return prop;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
async function getProjectsWithAngularRouter(tree) {
|
|
45
|
-
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
46
|
-
return Object.entries(projectGraph.dependencies)
|
|
47
|
-
.filter(([node, dep]) => dep.some(({ target }) => target === 'npm:@angular/router' &&
|
|
48
|
-
!projectGraph.externalNodes?.[node]))
|
|
49
|
-
.map(([projectName]) => (0, devkit_1.readProjectConfiguration)(tree, projectName));
|
|
50
|
-
}
|
|
51
|
-
function getRouterModuleForRootCall(sourceFile) {
|
|
52
|
-
// narrow down call expressions
|
|
53
|
-
const routerModuleForRootCalls = (0, tsquery_1.tsquery)(sourceFile, 'CallExpression:has(PropertyAccessExpression:has(Identifier[name=RouterModule]):has(Identifier[name=forRoot]))', { visitAllChildren: true });
|
|
54
|
-
for (const node of routerModuleForRootCalls) {
|
|
55
|
-
if (isRouterModuleForRoot(node) &&
|
|
56
|
-
node.arguments.length >= 2 &&
|
|
57
|
-
(0, typescript_1.isObjectLiteralExpression)(node.arguments[1])) {
|
|
58
|
-
return node;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
function isRouterModuleForRoot(node) {
|
|
64
|
-
// make sure is not an outer call expression (NgModule call)
|
|
65
|
-
return ((0, typescript_1.isPropertyAccessExpression)(node.expression) &&
|
|
66
|
-
(0, typescript_1.isIdentifier)(node.expression.expression) &&
|
|
67
|
-
node.expression.expression.text === 'RouterModule' &&
|
|
68
|
-
(0, typescript_1.isIdentifier)(node.expression.name) &&
|
|
69
|
-
node.expression.name.text === 'forRoot');
|
|
70
|
-
}
|
|
71
|
-
function needsMigration(node) {
|
|
72
|
-
return ((0, typescript_1.isStringLiteralLike)(node.initializer) && node.initializer.text === 'enabled');
|
|
73
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const jestExecutor = '@nrwl/jest:jest';
|
|
9
|
-
const executors = [
|
|
10
|
-
'@angular-devkit/build-angular:browser',
|
|
11
|
-
'@angular-devkit/build-angular:karma',
|
|
12
|
-
'@angular-devkit/build-angular:ng-packagr',
|
|
13
|
-
'@nrwl/angular:webpack-browser',
|
|
14
|
-
'@nrwl/angular:delegate-build',
|
|
15
|
-
'@nrwl/angular:ng-packagr-lite',
|
|
16
|
-
'@nrwl/angular:package',
|
|
17
|
-
];
|
|
18
|
-
const skipTargets = ['es2020', 'es2021', 'es2022', 'esnext'];
|
|
19
|
-
async function default_1(tree) {
|
|
20
|
-
const tsConfigPaths = await collectTsConfigPaths(tree);
|
|
21
|
-
for (const tsConfigPath of tsConfigPaths) {
|
|
22
|
-
(0, devkit_2.updateJson)(tree, tsConfigPath, (json) => {
|
|
23
|
-
if (!json.compilerOptions?.target ||
|
|
24
|
-
(json.compilerOptions?.target &&
|
|
25
|
-
!skipTargets.includes(json.compilerOptions.target.toLowerCase()))) {
|
|
26
|
-
json.compilerOptions ??= {};
|
|
27
|
-
json.compilerOptions.target = 'es2020';
|
|
28
|
-
}
|
|
29
|
-
return json;
|
|
30
|
-
}, {
|
|
31
|
-
allowTrailingComma: true,
|
|
32
|
-
disallowComments: false,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
await (0, devkit_2.formatFiles)(tree);
|
|
36
|
-
}
|
|
37
|
-
async function collectTsConfigPaths(tree) {
|
|
38
|
-
const uniqueTsConfigs = new Set([]);
|
|
39
|
-
const projectGraph = await (0, devkit_2.createProjectGraphAsync)();
|
|
40
|
-
const angularProjects = Object.entries(projectGraph.dependencies)
|
|
41
|
-
.filter(([node, dep]) => dep.some(({ target }) => target === 'npm:@angular/core' && !projectGraph.externalNodes?.[node]))
|
|
42
|
-
.map(([projectName]) => ({
|
|
43
|
-
projectName,
|
|
44
|
-
project: (0, devkit_2.readProjectConfiguration)(tree, projectName),
|
|
45
|
-
}));
|
|
46
|
-
for (const { projectName, project } of angularProjects) {
|
|
47
|
-
const tsConfigPath = (0, devkit_2.joinPathFragments)(project.root, 'tsconfig.json');
|
|
48
|
-
if (tree.exists(tsConfigPath)) {
|
|
49
|
-
uniqueTsConfigs.add(tsConfigPath);
|
|
50
|
-
const targetTsConfigPaths = getProjectTsConfigPaths(tree, project, projectName, false);
|
|
51
|
-
targetTsConfigPaths.forEach((tsConfigPath) => {
|
|
52
|
-
const tsConfig = (0, devkit_1.readJson)(tree, tsConfigPath, {
|
|
53
|
-
allowTrailingComma: true,
|
|
54
|
-
disallowComments: false,
|
|
55
|
-
});
|
|
56
|
-
if (tsConfig.compilerOptions?.target) {
|
|
57
|
-
uniqueTsConfigs.add(tsConfigPath);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const tsConfigPaths = getProjectTsConfigPaths(tree, project, projectName);
|
|
63
|
-
for (const tsConfigPath of tsConfigPaths) {
|
|
64
|
-
uniqueTsConfigs.add(tsConfigPath);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return Array.from(uniqueTsConfigs);
|
|
68
|
-
}
|
|
69
|
-
function getProjectTsConfigPaths(tree, project, projectName, shouldWarn = true) {
|
|
70
|
-
const tsConfigPaths = new Set();
|
|
71
|
-
for (const [targetName, target] of Object.entries(project.targets || {})) {
|
|
72
|
-
if (executors.includes(target.executor)) {
|
|
73
|
-
const tsConfigPathsFromTarget = getPathValuesFromTarget(target, 'tsConfig');
|
|
74
|
-
tsConfigPathsFromTarget.forEach((tsConfigPath) => {
|
|
75
|
-
if (tree.exists(tsConfigPath)) {
|
|
76
|
-
tsConfigPaths.add(tsConfigPath);
|
|
77
|
-
}
|
|
78
|
-
else if (shouldWarn) {
|
|
79
|
-
devkit_2.logger.warn(`The "${tsConfigPath}" file specified in the "${targetName}" target of the "${projectName}" project could not be found. ` +
|
|
80
|
-
'Skipping setting the target to ES2020.');
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else if (target.executor === jestExecutor) {
|
|
85
|
-
const tsConfigPathsFromJestTarget = getTsConfigPathsFromJestTarget(tree, target, targetName, projectName, shouldWarn);
|
|
86
|
-
tsConfigPathsFromJestTarget.forEach((tsConfigPath) => {
|
|
87
|
-
tsConfigPaths.add(tsConfigPath);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
else if (shouldWarn) {
|
|
91
|
-
devkit_2.logger.warn(`The "${targetName}" target of the "${projectName}" project is using an executor not supported by the migration. ` +
|
|
92
|
-
'Skipping setting the TS target to ES2020 for the project.');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return Array.from(tsConfigPaths);
|
|
96
|
-
}
|
|
97
|
-
function getTsConfigPathsFromJestTarget(tree, target, targetName, projectName, shouldWarn) {
|
|
98
|
-
const tsConfigPaths = [];
|
|
99
|
-
const jestConfigPaths = getPathValuesFromTarget(target, 'jestConfig');
|
|
100
|
-
if (!jestConfigPaths.length && shouldWarn) {
|
|
101
|
-
devkit_2.logger.warn(`The "${targetName}" target of the "${projectName}" project is using the "${jestExecutor}" executor but no "jestConfig" property was specified. ` +
|
|
102
|
-
'Skipping setting the TS compilation target to ES2020 for the project.');
|
|
103
|
-
}
|
|
104
|
-
for (const jestConfigPath of jestConfigPaths) {
|
|
105
|
-
const tsConfigPath = getTsConfigFromJestConfig(tree, jestConfigPath, targetName, projectName, shouldWarn);
|
|
106
|
-
if (tsConfigPath) {
|
|
107
|
-
tsConfigPaths.push(tsConfigPath);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return tsConfigPaths;
|
|
111
|
-
}
|
|
112
|
-
function getTsConfigFromJestConfig(tree, jestConfigPath, targetName, projectName, shouldWarn) {
|
|
113
|
-
if (!tree.exists(jestConfigPath)) {
|
|
114
|
-
if (shouldWarn) {
|
|
115
|
-
devkit_2.logger.warn(`The "${jestConfigPath}" file specified in the "${targetName}" target of the "${projectName}" project could not be found. ` +
|
|
116
|
-
`The TS config file used by the target can't be determined. Skipping setting the target to ES2020.`);
|
|
117
|
-
}
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
const jestConfig = tree.read(jestConfigPath, 'utf-8');
|
|
121
|
-
const jestConfigAst = tsquery_1.tsquery.ast(jestConfig);
|
|
122
|
-
const tsJestTsConfigStringLiteral = (0, tsquery_1.tsquery)(jestConfigAst, 'PropertyAssignment:has(Identifier[name=globals]) PropertyAssignment:has(StringLiteral[value=ts-jest]) PropertyAssignment:has(Identifier[name=tsconfig]) > StringLiteral', { visitAllChildren: true })[0];
|
|
123
|
-
if (!tsJestTsConfigStringLiteral) {
|
|
124
|
-
if (shouldWarn) {
|
|
125
|
-
devkit_2.logger.warn(`Couldn't find the "tsconfig" property for "ts-jest" in the Jest configuration file "${jestConfigPath}" specified in the ` +
|
|
126
|
-
`"${targetName}" target of the "${projectName}" project. The TS config file used by the target can't be determined. ` +
|
|
127
|
-
'Skipping setting the target to ES2020.');
|
|
128
|
-
}
|
|
129
|
-
return undefined;
|
|
130
|
-
}
|
|
131
|
-
const tsJestTsConfigValue = tsJestTsConfigStringLiteral
|
|
132
|
-
.getText()
|
|
133
|
-
.replace(/['"]/g, '');
|
|
134
|
-
const tsConfigPath = tsJestTsConfigValue.replace('<rootDir>', (0, path_1.dirname)(jestConfigPath));
|
|
135
|
-
if (!tree.exists(tsConfigPath)) {
|
|
136
|
-
if (shouldWarn) {
|
|
137
|
-
devkit_2.logger.warn(`The "${tsJestTsConfigValue}" file specified in the Jest configuration file "${jestConfigPath}" of the "${targetName}" target ` +
|
|
138
|
-
`of the "${projectName}" project could not be found. Skipping setting the target to ES2020.`);
|
|
139
|
-
}
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
return tsConfigPath;
|
|
143
|
-
}
|
|
144
|
-
function getPathValuesFromTarget(target, option) {
|
|
145
|
-
const values = [];
|
|
146
|
-
if (target.options?.[option]) {
|
|
147
|
-
values.push(target.options[option]);
|
|
148
|
-
}
|
|
149
|
-
Object.values(target.configurations ?? {}).forEach((options) => {
|
|
150
|
-
if (options[option]) {
|
|
151
|
-
values.push(options[option]);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
return values;
|
|
155
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function replaceNrwlAngularMfImport(fileContents: string): string;
|
|
3
|
-
export declare function replaceExportedMFETypes(fileContents: string): string;
|
|
4
|
-
export declare function renameSetupMfeGeneratorUsages(fileContents: string): string;
|
|
5
|
-
export default function (tree: Tree): Promise<void>;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceNrwlAngularMfImport = replaceNrwlAngularMfImport;
|
|
4
|
-
exports.replaceExportedMFETypes = replaceExportedMFETypes;
|
|
5
|
-
exports.renameSetupMfeGeneratorUsages = renameSetupMfeGeneratorUsages;
|
|
6
|
-
exports.default = default_1;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
10
|
-
const NRWL_ANGULAR_MFE_STATIC_IMPORT_SELECTOR = 'ImportDeclaration > StringLiteral[value="@nrwl/angular/mfe"]';
|
|
11
|
-
const NRWL_ANGULAR_MFE_DYNAMIC_IMPORT_SELECTOR = 'CallExpression:has(ImportKeyword) > StringLiteral[value="@nrwl/angular/mfe"]';
|
|
12
|
-
const NRWL_ANGULAR_MFE_TYPES_SELECTOR = 'ImportDeclaration:has(StringLiteral[value=@nrwl/angular/module-federation]) > ImportClause > NamedImports';
|
|
13
|
-
function replaceNrwlAngularMfImport(fileContents) {
|
|
14
|
-
let fileAst = tsquery_1.tsquery.ast(fileContents);
|
|
15
|
-
if (fileContents.includes('@nrwl/angular/mfe')) {
|
|
16
|
-
// This file definitely contains the string, however, we're interested in whether it is an import
|
|
17
|
-
const staticQueryResult = (0, tsquery_1.tsquery)(fileAst, NRWL_ANGULAR_MFE_STATIC_IMPORT_SELECTOR, {
|
|
18
|
-
visitAllChildren: true,
|
|
19
|
-
});
|
|
20
|
-
if (staticQueryResult && staticQueryResult.length > 0) {
|
|
21
|
-
fileContents = `${fileContents.slice(0, staticQueryResult[0].getStart())}'@nrwl/angular/mf'${fileContents.slice(staticQueryResult[0].getEnd())}`;
|
|
22
|
-
}
|
|
23
|
-
fileAst = tsquery_1.tsquery.ast(fileContents);
|
|
24
|
-
const dynamicQueryResult = (0, tsquery_1.tsquery)(fileAst, NRWL_ANGULAR_MFE_DYNAMIC_IMPORT_SELECTOR, {
|
|
25
|
-
visitAllChildren: true,
|
|
26
|
-
});
|
|
27
|
-
if (dynamicQueryResult && dynamicQueryResult.length > 0) {
|
|
28
|
-
fileContents = `${fileContents.slice(0, dynamicQueryResult[0].getStart())}'@nrwl/angular/mf'${fileContents.slice(dynamicQueryResult[0].getEnd())}`;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return fileContents;
|
|
32
|
-
}
|
|
33
|
-
function replaceExportedMFETypes(fileContents) {
|
|
34
|
-
const ast = tsquery_1.tsquery.ast(fileContents);
|
|
35
|
-
const queryResult = (0, tsquery_1.tsquery)(ast, NRWL_ANGULAR_MFE_TYPES_SELECTOR, {
|
|
36
|
-
visitAllChildren: true,
|
|
37
|
-
});
|
|
38
|
-
if (queryResult && queryResult.length > 0) {
|
|
39
|
-
const TYPES_IMPORTED_FROM_NRWL_REGEX = /(MFERemotes|MFEConfig)+.*from+.+(@nrwl\/angular\/module-federation)+/g;
|
|
40
|
-
if (TYPES_IMPORTED_FROM_NRWL_REGEX.test(fileContents)) {
|
|
41
|
-
fileContents = fileContents.replace(/MFERemotes/g, 'MFRemotes');
|
|
42
|
-
fileContents = fileContents.replace(/MFEConfig/g, 'MFConfig');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return fileContents;
|
|
46
|
-
}
|
|
47
|
-
function renameSetupMfeGeneratorUsages(fileContents) {
|
|
48
|
-
// Attempt to update any custom generator usage of the changed generators
|
|
49
|
-
const NRWL_SETUP_MFE_IMPORT_SELECTOR = 'ImportDeclaration:has(StringLiteral[value=@nrwl/angular/generators]) > ImportClause:has(NamedImports:has(ImportSpecifier > Identifier[name=setupMfe]))';
|
|
50
|
-
const SETUP_MFE_IMPORTED_FROM_NRWL_REGEX = /(setupMfe)+.*from+.+(@nrwl\/angular\/generators)+/g;
|
|
51
|
-
const SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR = 'CallExpression:has(Identifier[name=setupMf]) ObjectLiteralExpression > PropertyAssignment > Identifier[name=mfeType]';
|
|
52
|
-
let ast = tsquery_1.tsquery.ast(fileContents);
|
|
53
|
-
let queryResult = (0, tsquery_1.tsquery)(ast, NRWL_SETUP_MFE_IMPORT_SELECTOR, {
|
|
54
|
-
visitAllChildren: true,
|
|
55
|
-
});
|
|
56
|
-
if (queryResult &&
|
|
57
|
-
queryResult.length > 0 &&
|
|
58
|
-
SETUP_MFE_IMPORTED_FROM_NRWL_REGEX.test(fileContents)) {
|
|
59
|
-
fileContents = fileContents.replace(/setupMfe/g, 'setupMf');
|
|
60
|
-
}
|
|
61
|
-
ast = tsquery_1.tsquery.ast(fileContents);
|
|
62
|
-
queryResult = (0, tsquery_1.tsquery)(ast, SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR, {
|
|
63
|
-
visitAllChildren: true,
|
|
64
|
-
});
|
|
65
|
-
while (queryResult && queryResult.length > 0) {
|
|
66
|
-
const node = queryResult[0];
|
|
67
|
-
fileContents = `${fileContents.slice(0, node.getStart())}mfType${fileContents.slice(node.getEnd())}`;
|
|
68
|
-
ast = tsquery_1.tsquery.ast(fileContents);
|
|
69
|
-
queryResult = (0, tsquery_1.tsquery)(ast, SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR, {
|
|
70
|
-
visitAllChildren: true,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return fileContents;
|
|
74
|
-
}
|
|
75
|
-
async function default_1(tree) {
|
|
76
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
|
|
77
|
-
const pathExtName = (0, path_1.extname)(path);
|
|
78
|
-
if (pathExtName !== '.ts' && pathExtName !== '.js') {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
let fileContents = tree.read(path, 'utf-8');
|
|
82
|
-
fileContents = replaceNrwlAngularMfImport(fileContents);
|
|
83
|
-
if (pathExtName === '.ts') {
|
|
84
|
-
// Only TS files can import types and interfaces
|
|
85
|
-
fileContents = replaceExportedMFETypes(fileContents);
|
|
86
|
-
fileContents = renameSetupMfeGeneratorUsages(fileContents);
|
|
87
|
-
}
|
|
88
|
-
tree.write(path, fileContents);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const angularCliVersion = '~14.2.0';
|
|
6
|
-
async function default_1(tree) {
|
|
7
|
-
let shouldFormat = false;
|
|
8
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
9
|
-
if (json.devDependencies?.['@angular/cli']) {
|
|
10
|
-
json.devDependencies['@angular/cli'] = angularCliVersion;
|
|
11
|
-
shouldFormat = true;
|
|
12
|
-
}
|
|
13
|
-
else if (json.dependencies?.['@angular/cli']) {
|
|
14
|
-
json.dependencies['@angular/cli'] = angularCliVersion;
|
|
15
|
-
shouldFormat = true;
|
|
16
|
-
}
|
|
17
|
-
return json;
|
|
18
|
-
});
|
|
19
|
-
if (shouldFormat) {
|
|
20
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = renameWebpackServer;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function renameWebpackServer(tree) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
7
|
-
const oldExecutorName = '@nrwl/angular:webpack-server';
|
|
8
|
-
const newExecutorName = '@nrwl/angular:webpack-dev-server';
|
|
9
|
-
for (const [projectName, project] of projects.entries()) {
|
|
10
|
-
let stringifiedProject = JSON.stringify(project);
|
|
11
|
-
if (!stringifiedProject.includes(oldExecutorName)) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
for (const [targetName, target] of Object.entries(project.targets)) {
|
|
15
|
-
if (target.executor === oldExecutorName) {
|
|
16
|
-
target.executor = newExecutorName;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function default_1(tree) {
|
|
7
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
8
|
-
const karmaTargets = getKarmaTargetNames(tree);
|
|
9
|
-
const hasProductionFileset = !!nxJson.namedInputs?.production;
|
|
10
|
-
if (karmaTargets.size > 0 && hasProductionFileset) {
|
|
11
|
-
const productionFileset = new Set(nxJson.namedInputs.production);
|
|
12
|
-
for (const exclusion of [
|
|
13
|
-
'!{projectRoot}/**/*.spec.[jt]s',
|
|
14
|
-
'!{projectRoot}/tsconfig.spec.json',
|
|
15
|
-
'!{projectRoot}/karma.conf.js',
|
|
16
|
-
]) {
|
|
17
|
-
productionFileset.add(exclusion);
|
|
18
|
-
}
|
|
19
|
-
nxJson.namedInputs.production = Array.from(productionFileset);
|
|
20
|
-
}
|
|
21
|
-
for (const targetName of karmaTargets) {
|
|
22
|
-
nxJson.targetDefaults ??= {};
|
|
23
|
-
const jestTargetDefaults = (nxJson.targetDefaults[targetName] ??= {});
|
|
24
|
-
jestTargetDefaults.inputs ??= [
|
|
25
|
-
'default',
|
|
26
|
-
hasProductionFileset ? '^production' : '^default',
|
|
27
|
-
...(tree.exists('karma.conf.js')
|
|
28
|
-
? ['{workspaceRoot}/karma.conf.js']
|
|
29
|
-
: []),
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
33
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
34
|
-
}
|
|
35
|
-
function getKarmaTargetNames(tree) {
|
|
36
|
-
const karmaTargetNames = new Set();
|
|
37
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@angular-devkit/build-angular:karma', (_, __, target) => {
|
|
38
|
-
karmaTargetNames.add(target);
|
|
39
|
-
});
|
|
40
|
-
return karmaTargetNames;
|
|
41
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = switchToJasmineMarbles;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
|
-
const versions_1 = require("../../utils/versions");
|
|
8
|
-
const semver_1 = require("@nx/devkit/src/utils/semver");
|
|
9
|
-
const semver_2 = require("semver");
|
|
10
|
-
async function switchToJasmineMarbles(tree) {
|
|
11
|
-
const usesJasmineMarbles = await replaceJasmineMarbleUsagesInFiles(tree);
|
|
12
|
-
addJasmineMarblesDevDependencyIfUsed(tree, usesJasmineMarbles);
|
|
13
|
-
}
|
|
14
|
-
async function replaceJasmineMarbleUsagesInFiles(tree) {
|
|
15
|
-
let usesJasmineMarbles = false;
|
|
16
|
-
const projectGraph = await (() => {
|
|
17
|
-
try {
|
|
18
|
-
return (0, devkit_1.readCachedProjectGraph)();
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return (0, devkit_1.createProjectGraphAsync)();
|
|
22
|
-
}
|
|
23
|
-
})();
|
|
24
|
-
const dirsToTraverse = Object.entries(projectGraph.dependencies)
|
|
25
|
-
.filter(([node, dep]) => dep.some(({ target }) => target === 'npm:@nrwl/angular' && !projectGraph.externalNodes?.[node]))
|
|
26
|
-
.map(([projectName]) => (0, devkit_1.readProjectConfiguration)(tree, projectName).root);
|
|
27
|
-
for (const dir of dirsToTraverse) {
|
|
28
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, dir, (path) => {
|
|
29
|
-
if ((0, path_1.extname)(path) !== '.ts') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const fileContents = tree.read(path, 'utf-8');
|
|
33
|
-
if (!fileContents.includes('@nrwl/angular/testing')) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const NRWL_ANGULAR_TESTING_IMPORT_SELECTOR = 'ImportDeclaration:has(StringLiteral[value="@nrwl/angular/testing"])';
|
|
37
|
-
const ast = tsquery_1.tsquery.ast(fileContents);
|
|
38
|
-
const nrwlAngularTestingImportNodes = (0, tsquery_1.tsquery)(ast, NRWL_ANGULAR_TESTING_IMPORT_SELECTOR, { visitAllChildren: true });
|
|
39
|
-
if (!nrwlAngularTestingImportNodes ||
|
|
40
|
-
nrwlAngularTestingImportNodes.length === 0) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const jasmineMarblesExportsRegex = new RegExp(/(hot|cold|getTestScheduler|time)/);
|
|
44
|
-
if (!jasmineMarblesExportsRegex.test(nrwlAngularTestingImportNodes[0].getText())) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const IMPORT_SPECIFIERS_SELECTOR = 'NamedImports > ImportSpecifier';
|
|
48
|
-
const importSpecifierNodes = (0, tsquery_1.tsquery)(nrwlAngularTestingImportNodes[0], IMPORT_SPECIFIERS_SELECTOR, { visitAllChildren: true });
|
|
49
|
-
if (!importSpecifierNodes || importSpecifierNodes.length === 0) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const validNrwlTestingImports = [];
|
|
53
|
-
const validJasmineMarbleImports = [];
|
|
54
|
-
for (const node of importSpecifierNodes) {
|
|
55
|
-
const importSymbol = node.getText();
|
|
56
|
-
if (jasmineMarblesExportsRegex.test(importSymbol)) {
|
|
57
|
-
validJasmineMarbleImports.push(importSymbol);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
validNrwlTestingImports.push(importSymbol);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!usesJasmineMarbles && validJasmineMarbleImports.length > 0) {
|
|
64
|
-
usesJasmineMarbles = true;
|
|
65
|
-
}
|
|
66
|
-
const newFileContents = `${fileContents.slice(0, nrwlAngularTestingImportNodes[0].getStart())}${validNrwlTestingImports.length > 0
|
|
67
|
-
? `import {${validNrwlTestingImports.join(',')}} from '@nrwl/angular/testing';`
|
|
68
|
-
: ''}
|
|
69
|
-
${validJasmineMarbleImports.length > 0
|
|
70
|
-
? `import {${validJasmineMarbleImports.join(',')}} from 'jasmine-marbles';${fileContents.slice(nrwlAngularTestingImportNodes[0].getEnd(), -1)}`
|
|
71
|
-
: ''}`;
|
|
72
|
-
tree.write(path, newFileContents);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return usesJasmineMarbles;
|
|
76
|
-
}
|
|
77
|
-
function addJasmineMarblesDevDependencyIfUsed(tree, usesJasmineMarbles) {
|
|
78
|
-
if (!usesJasmineMarbles) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const pkgJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
82
|
-
const jasmineMarblesDependency = pkgJson.dependencies['jasmine-marbles'];
|
|
83
|
-
const jasmineMarblesDevDependency = pkgJson.devDependencies['jasmine-marbles'];
|
|
84
|
-
if (jasmineMarblesDependency || jasmineMarblesDevDependency) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const jasmineMarblesVersion = getJasmineMarblesVersion(tree);
|
|
88
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
89
|
-
'jasmine-marbles': jasmineMarblesVersion,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function getJasmineMarblesVersion(tree) {
|
|
93
|
-
let rxjsVersion;
|
|
94
|
-
try {
|
|
95
|
-
const { dependencies, devDependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
96
|
-
rxjsVersion = (0, semver_1.checkAndCleanWithSemver)('rxjs', dependencies?.rxjs ?? devDependencies?.rxjs);
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
rxjsVersion = (0, semver_1.checkAndCleanWithSemver)('rxjs', versions_1.rxjsVersion);
|
|
100
|
-
}
|
|
101
|
-
return (0, semver_2.gte)(rxjsVersion, '7.0.0') ? versions_1.jasmineMarblesVersion : '~0.8.3';
|
|
102
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_BROWSERS = void 0;
|
|
4
|
-
exports.default = removeBrowserlistConfig;
|
|
5
|
-
require("nx/src/internal-testing-utils/mock-project-graph");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const validBrowserslistConfigFilenames = new Set([
|
|
9
|
-
'browserslist',
|
|
10
|
-
'.browserslistrc',
|
|
11
|
-
]);
|
|
12
|
-
exports.DEFAULT_BROWSERS = [
|
|
13
|
-
'last 1 Chrome version',
|
|
14
|
-
'last 1 Firefox version',
|
|
15
|
-
'last 2 Edge major versions',
|
|
16
|
-
'last 2 Safari major versions',
|
|
17
|
-
'last 2 iOS major versions',
|
|
18
|
-
'Firefox ESR',
|
|
19
|
-
];
|
|
20
|
-
async function removeBrowserlistConfig(tree) {
|
|
21
|
-
let browserslist;
|
|
22
|
-
try {
|
|
23
|
-
browserslist = await import('browserslist');
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
devkit_1.logger.warn('Skipping migration because the "browserslist" package could not be loaded.');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Set the defaults to match the defaults in build-angular.
|
|
30
|
-
browserslist.defaults = exports.DEFAULT_BROWSERS;
|
|
31
|
-
const defaultSupportedBrowsers = new Set(browserslist(exports.DEFAULT_BROWSERS));
|
|
32
|
-
const es5Browsers = new Set(browserslist(['supports es6-module']));
|
|
33
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
|
|
34
|
-
const fileName = (0, path_1.basename)(path);
|
|
35
|
-
if (!validBrowserslistConfigFilenames.has(fileName) ||
|
|
36
|
-
path.startsWith('node_modules')) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const { defaults: browsersListConfig, ...otherConfigs } = browserslist.parseConfig(tree.read(path, 'utf-8'));
|
|
40
|
-
if (Object.keys(otherConfigs).length) {
|
|
41
|
-
// The config contains additional sections.
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const browserslistInProject = browserslist(
|
|
45
|
-
// Exclude from the list ES5 browsers which are not supported.
|
|
46
|
-
browsersListConfig.map((s) => `${s} and supports es6-module`), {
|
|
47
|
-
ignoreUnknownVersions: true,
|
|
48
|
-
});
|
|
49
|
-
if (defaultSupportedBrowsers.size !== browserslistInProject.length) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const shouldDelete = browserslistInProject.every((browser) => defaultSupportedBrowsers.has(browser));
|
|
53
|
-
if (shouldDelete) {
|
|
54
|
-
// All browsers are the same as the default config.
|
|
55
|
-
// Delete file as it's redundant.
|
|
56
|
-
tree.delete(path);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|