@nx/angular 24.0.0-pr.37405.acdaf31 → 24.0.0-rc.1
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/executors.d.ts +0 -2
- package/dist/executors.js +0 -2
- package/dist/fesm2022/nx-angular.mjs +0 -4
- package/dist/generators.d.ts +0 -8
- package/dist/generators.js +0 -8
- package/dist/ready-check.d.ts +1 -0
- package/dist/ready-check.js +8 -0
- package/dist/src/executors/application/schema.json +1 -2
- package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +9 -1
- package/dist/src/executors/unit-test/schema.json +6 -1
- package/dist/src/executors/unit-test/unit-test.impl.js +5 -0
- package/dist/src/executors/utilities/ng-packagr/stylesheet-processor.js +35 -10
- package/dist/src/generators/add-linting/add-linting.js +1 -3
- package/dist/src/generators/add-linting/schema.d.ts +0 -5
- package/dist/src/generators/add-linting/schema.json +0 -6
- package/dist/src/generators/application/application.js +1 -2
- package/dist/src/generators/application/lib/add-e2e.js +3 -8
- package/dist/src/generators/application/lib/add-linting.js +1 -3
- package/dist/src/generators/application/lib/add-serve-static-target.js +2 -0
- package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
- package/dist/src/generators/application/lib/create-project.js +2 -0
- package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/dist/src/generators/application/lib/normalize-options.js +1 -8
- package/dist/src/generators/application/schema.d.ts +0 -5
- package/dist/src/generators/application/schema.json +1 -7
- package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +9 -4
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +1 -2
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -63
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.d.ts +2 -0
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.js +32 -0
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
- package/dist/src/generators/init/init.js +1 -2
- package/dist/src/generators/init/schema.d.ts +0 -2
- package/dist/src/generators/library/lib/normalized-schema.d.ts +0 -4
- package/dist/src/generators/library/library.js +3 -4
- package/dist/src/generators/library/schema.d.ts +0 -5
- package/dist/src/generators/library/schema.json +0 -6
- package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.d.ts +1 -0
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.js +22 -0
- package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
- package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
- package/dist/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +15 -1
- package/dist/src/generators/setup-ssr/lib/add-dependencies.js +4 -0
- package/dist/src/generators/setup-ssr/lib/update-project-config.js +1 -0
- package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
- package/dist/src/generators/utils/add-jest.d.ts +0 -1
- package/dist/src/generators/utils/add-jest.js +0 -2
- package/dist/src/generators/utils/add-vitest.d.ts +0 -1
- package/dist/src/generators/utils/add-vitest.js +0 -1
- package/dist/src/generators/utils/testing.d.ts +4 -4
- package/dist/src/generators/utils/testing.js +19 -12
- package/dist/src/migrations/update-23-1-0/add-angular-build.js +7 -3
- package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
- package/dist/src/migrations/update-23-1-0/add-trust-proxy-headers.js +9 -2
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.js +12 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.md +59 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.d.ts +2 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.js +85 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.md +48 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.d.ts +5 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.js +332 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.md +46 -0
- package/dist/src/plugins/plugin.js +3 -5
- package/dist/src/plugins/utils/dev-server-ready-check.d.ts +17 -0
- package/dist/src/plugins/utils/dev-server-ready-check.js +213 -0
- package/dist/src/utils/assert-cypress-component-testing-support.js +10 -0
- package/dist/src/utils/backward-compatible-versions.js +0 -8
- package/dist/src/utils/versions.d.ts +4 -8
- package/dist/src/utils/versions.js +5 -9
- package/dist/types/nx-angular.d.ts +1 -3
- package/executors.json +0 -10
- package/generators.json +0 -59
- package/migrations.json +109 -0
- package/package.json +13 -21
- package/dist/.npmignore +0 -2
- package/dist/fesm2022/nx-angular-mf.mjs +0 -193
- package/dist/fesm2022/nx-angular-mf.mjs.map +0 -1
- package/dist/fesm2022/nx-angular.mjs.map +0 -1
- package/dist/mf/package.json +0 -4
- package/dist/src/builders/utilities/module-federation.d.ts +0 -11
- package/dist/src/builders/utilities/module-federation.js +0 -109
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -22
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +0 -29
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -111
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -38
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -171
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -20
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.js +0 -30
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -110
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -17
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -124
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.js +0 -36
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +0 -448
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.js +0 -22
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +0 -45
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +0 -18
- package/dist/src/generators/convert-to-with-mf/lib/index.d.ts +0 -6
- package/dist/src/generators/convert-to-with-mf/lib/index.js +0 -9
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +0 -57
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +0 -13
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +0 -3
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +0 -50
- package/dist/src/generators/convert-to-with-mf/schema.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/schema.json +0 -33
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -49
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +0 -14
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.js +0 -77
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.js +0 -11
- package/dist/src/generators/federate-module/lib/add-remote.d.ts +0 -7
- package/dist/src/generators/federate-module/lib/add-remote.js +0 -42
- package/dist/src/generators/federate-module/lib/check-remote-exists.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/check-remote-exists.js +0 -21
- package/dist/src/generators/federate-module/lib/index.d.ts +0 -4
- package/dist/src/generators/federate-module/lib/index.js +0 -7
- package/dist/src/generators/federate-module/schema.d.ts +0 -13
- package/dist/src/generators/federate-module/schema.json +0 -83
- package/dist/src/generators/host/files/common/src/main.server.ts__tmpl__ +0 -78
- package/dist/src/generators/host/files/js/webpack.server.config.js__tmpl__ +0 -8
- package/dist/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -133
- package/dist/src/generators/host/lib/index.d.ts +0 -2
- package/dist/src/generators/host/lib/index.js +0 -5
- package/dist/src/generators/host/lib/update-ssr-setup.d.ts +0 -3
- package/dist/src/generators/host/lib/update-ssr-setup.js +0 -54
- package/dist/src/generators/host/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/host/lib/validate-options.js +0 -12
- package/dist/src/generators/host/schema.d.ts +0 -36
- package/dist/src/generators/host/schema.json +0 -195
- package/dist/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/remote/files/common/src/main.server.ts__tmpl__ +0 -84
- package/dist/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +0 -12
- package/dist/src/generators/remote/lib/find-next-available-port.d.ts +0 -2
- package/dist/src/generators/remote/lib/find-next-available-port.js +0 -16
- package/dist/src/generators/remote/lib/index.d.ts +0 -3
- package/dist/src/generators/remote/lib/index.js +0 -6
- package/dist/src/generators/remote/lib/update-ssr-setup.d.ts +0 -9
- package/dist/src/generators/remote/lib/update-ssr-setup.js +0 -82
- package/dist/src/generators/remote/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/remote/lib/validate-options.js +0 -12
- package/dist/src/generators/remote/remote.d.ts +0 -4
- package/dist/src/generators/remote/remote.js +0 -114
- package/dist/src/generators/remote/schema.d.ts +0 -34
- package/dist/src/generators/remote/schema.json +0 -184
- package/dist/src/generators/scam/lib/convert-component-to-scam.d.ts +0 -3
- package/dist/src/generators/scam/lib/convert-component-to-scam.js +0 -41
- package/dist/src/generators/scam/lib/index.d.ts +0 -2
- package/dist/src/generators/scam/lib/index.js +0 -5
- package/dist/src/generators/scam/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam/scam.d.ts +0 -7
- package/dist/src/generators/scam/scam.js +0 -28
- package/dist/src/generators/scam/schema.d.ts +0 -30
- package/dist/src/generators/scam/schema.json +0 -126
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.js +0 -41
- package/dist/src/generators/scam-directive/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-directive/lib/index.js +0 -5
- package/dist/src/generators/scam-directive/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam-directive/scam-directive.d.ts +0 -7
- package/dist/src/generators/scam-directive/scam-directive.js +0 -28
- package/dist/src/generators/scam-directive/schema.d.ts +0 -23
- package/dist/src/generators/scam-directive/schema.json +0 -89
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +0 -41
- package/dist/src/generators/scam-pipe/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-pipe/lib/index.js +0 -5
- package/dist/src/generators/scam-pipe/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/normalize-options.js +0 -36
- package/dist/src/generators/scam-pipe/scam-pipe.d.ts +0 -7
- package/dist/src/generators/scam-pipe/scam-pipe.js +0 -28
- package/dist/src/generators/scam-pipe/schema.d.ts +0 -21
- package/dist/src/generators/scam-pipe/schema.json +0 -67
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +0 -3
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +0 -35
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +0 -6
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.js +0 -15
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.d.ts +0 -9
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.js +0 -51
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.js +0 -13
- package/dist/src/generators/scam-to-standalone/lib/index.d.ts +0 -8
- package/dist/src/generators/scam-to-standalone/lib/index.js +0 -11
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.js +0 -20
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.js +0 -7
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.js +0 -10
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.d.ts +0 -1
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.js +0 -11
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.d.ts +0 -7
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.js +0 -31
- package/dist/src/generators/scam-to-standalone/schema.d.ts +0 -5
- package/dist/src/generators/scam-to-standalone/schema.json +0 -32
- package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__ +0 -18
- package/dist/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +0 -10
- package/dist/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -42
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +0 -11
- package/dist/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +0 -27
- package/dist/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +0 -12
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +0 -23
- package/dist/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.js +0 -52
- package/dist/src/generators/setup-mf/lib/add-remote-entry.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-remote-entry.js +0 -27
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.d.ts +0 -9
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.js +0 -127
- package/dist/src/generators/setup-mf/lib/change-build-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/change-build-target.js +0 -24
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.js +0 -40
- package/dist/src/generators/setup-mf/lib/generate-config.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/generate-config.js +0 -32
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.js +0 -20
- package/dist/src/generators/setup-mf/lib/index.d.ts +0 -15
- package/dist/src/generators/setup-mf/lib/index.js +0 -18
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.d.ts +0 -2
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.js +0 -15
- package/dist/src/generators/setup-mf/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/normalize-options.js +0 -26
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +0 -61
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.js +0 -20
- package/dist/src/generators/setup-mf/lib/setup-serve-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-serve-target.js +0 -39
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +0 -15
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.js +0 -39
- package/dist/src/generators/setup-mf/lib/update-tsconfig.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-tsconfig.js +0 -18
- package/dist/src/generators/setup-mf/schema.d.ts +0 -35
- package/dist/src/generators/setup-mf/schema.json +0 -99
- package/dist/src/generators/setup-mf/setup-mf.d.ts +0 -4
- package/dist/src/generators/setup-mf/setup-mf.js +0 -90
- package/dist/src/generators/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/generators/utils/add-mf-env-to-inputs.js +0 -36
- package/dist/src/generators/utils/assert-mf-utils.d.ts +0 -1
- package/dist/src/generators/utils/assert-mf-utils.js +0 -8
- package/dist/src/generators/utils/export-scam.d.ts +0 -11
- package/dist/src/generators/utils/export-scam.js +0 -35
- package/dist/src/utils/get-mf-projects.d.ts +0 -4
- package/dist/src/utils/get-mf-projects.js +0 -31
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -4
- package/dist/src/utils/module-federation-deprecation.js +0 -29
- package/dist/types/nx-angular-mf.d.ts +0 -72
- package/dist/types/nx-angular-mf.d.ts.map +0 -1
- package/dist/types/nx-angular.d.ts.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getComponentDataFromAST = getComponentDataFromAST;
|
|
4
|
-
function getComponentDataFromAST(tree, normalizedComponentPath) {
|
|
5
|
-
const COMPONENT_CONTENT_SELECTOR = 'ClassDeclaration:has(Decorator > CallExpression:has(Identifier[name=Component]))';
|
|
6
|
-
const COMPONENT_NAME_SELECTOR = 'ClassDeclaration:has(Decorator > CallExpression:has(Identifier[name=Component])) > Identifier';
|
|
7
|
-
const componentFileContents = tree.read(normalizedComponentPath, 'utf-8');
|
|
8
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
9
|
-
const componentAST = ast(componentFileContents);
|
|
10
|
-
const componentNode = query(componentAST, COMPONENT_CONTENT_SELECTOR)[0];
|
|
11
|
-
const componentContents = componentFileContents.slice(componentNode.getStart(), componentNode.getEnd());
|
|
12
|
-
const componentNameNode = query(ast(componentContents), COMPONENT_NAME_SELECTOR)[0];
|
|
13
|
-
const componentName = componentNameNode.getText();
|
|
14
|
-
return { componentFileContents, componentAST, componentName };
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SourceFile } from 'typescript';
|
|
2
|
-
export declare function getModuleMetadataFromAST(componentAST: SourceFile, componentFileContents: string): {
|
|
3
|
-
moduleNodes: any;
|
|
4
|
-
exportsArray: string[];
|
|
5
|
-
importsArray: string[];
|
|
6
|
-
declarationsArray: string[];
|
|
7
|
-
providersArray: string[];
|
|
8
|
-
moduleName: any;
|
|
9
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModuleMetadataFromAST = getModuleMetadataFromAST;
|
|
4
|
-
function getModuleMetadataFromAST(componentAST, componentFileContents) {
|
|
5
|
-
const NGMODULE_CONTENT_SELECTOR = 'ClassDeclaration:has(Decorator > CallExpression:has(Identifier[name=NgModule]))';
|
|
6
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
7
|
-
const moduleNodes = query(componentAST, NGMODULE_CONTENT_SELECTOR);
|
|
8
|
-
const moduleContents = componentFileContents.slice(moduleNodes[0].getStart(), moduleNodes[0].getEnd());
|
|
9
|
-
// verify module is a scam
|
|
10
|
-
const NGMODULE_EXPORTS_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=NgModule]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=exports]) ArrayLiteralExpression';
|
|
11
|
-
const NGMODULE_DECLARATIONS_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=NgModule]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=declarations]) ArrayLiteralExpression';
|
|
12
|
-
const NGMODULE_IMPORTS_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=NgModule]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=imports]) ArrayLiteralExpression';
|
|
13
|
-
const NGMODULE_PROVIDERS_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=NgModule]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=providers]) ArrayLiteralExpression';
|
|
14
|
-
const NGMODULE_NAME_SELECTOR = 'ClassDeclaration:has(Decorator > CallExpression:has(Identifier[name=NgModule])) > Identifier';
|
|
15
|
-
const moduleAST = ast(moduleContents);
|
|
16
|
-
const importsNode = query(moduleAST, NGMODULE_IMPORTS_SELECTOR)[0];
|
|
17
|
-
const exportsNode = query(moduleAST, NGMODULE_EXPORTS_SELECTOR)[0];
|
|
18
|
-
const declarationsNode = query(moduleAST, NGMODULE_DECLARATIONS_SELECTOR)[0];
|
|
19
|
-
const providersNodes = query(moduleAST, NGMODULE_PROVIDERS_SELECTOR);
|
|
20
|
-
const exportsArray = moduleContents
|
|
21
|
-
.slice(exportsNode.getStart(), exportsNode.getEnd())
|
|
22
|
-
.replace('[', '')
|
|
23
|
-
.replace(']', '')
|
|
24
|
-
.split(',');
|
|
25
|
-
const importsArray = moduleContents
|
|
26
|
-
.slice(importsNode.getStart(), importsNode.getEnd())
|
|
27
|
-
.replace('[', '')
|
|
28
|
-
.replace(']', '')
|
|
29
|
-
.split(',');
|
|
30
|
-
const declarationsArray = moduleContents
|
|
31
|
-
.slice(declarationsNode.getStart(), declarationsNode.getEnd())
|
|
32
|
-
.replace('[', '')
|
|
33
|
-
.replace(']', '')
|
|
34
|
-
.split(',');
|
|
35
|
-
const providersArray = providersNodes.length > 0
|
|
36
|
-
? moduleContents
|
|
37
|
-
.slice(providersNodes[0].getStart(), providersNodes[0].getEnd())
|
|
38
|
-
.replace('[', '')
|
|
39
|
-
.replace(']', '')
|
|
40
|
-
.split(',')
|
|
41
|
-
: [];
|
|
42
|
-
const moduleName = query(moduleAST, NGMODULE_NAME_SELECTOR)[0].getText();
|
|
43
|
-
return {
|
|
44
|
-
moduleNodes,
|
|
45
|
-
exportsArray,
|
|
46
|
-
importsArray,
|
|
47
|
-
declarationsArray,
|
|
48
|
-
providersArray,
|
|
49
|
-
moduleName,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTargetProject = getTargetProject;
|
|
4
|
-
function getTargetProject(projectName, projects) {
|
|
5
|
-
let project;
|
|
6
|
-
if (projectName && !projects.has(projectName)) {
|
|
7
|
-
throw new Error(`Project (${projectName}) does not exist in the workspace! Please provide a valid project name.`);
|
|
8
|
-
}
|
|
9
|
-
else if (projectName && projects.has(projectName)) {
|
|
10
|
-
project = projects.get(projectName);
|
|
11
|
-
}
|
|
12
|
-
return project;
|
|
13
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './convert-scam-to-standalone';
|
|
2
|
-
export * from './get-component-data-from-ast';
|
|
3
|
-
export * from './get-module-metadata-from-ast';
|
|
4
|
-
export * from './get-target-project';
|
|
5
|
-
export * from './replace-module-usages-with-component';
|
|
6
|
-
export * from './selector-exists-in-ast';
|
|
7
|
-
export * from './verify-is-inline-scam';
|
|
8
|
-
export * from './verify-module-is-scam';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./convert-scam-to-standalone"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./get-component-data-from-ast"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./get-module-metadata-from-ast"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./get-target-project"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./replace-module-usages-with-component"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./selector-exists-in-ast"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./verify-is-inline-scam"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./verify-module-is-scam"), exports);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceModuleUsagesWithComponent = replaceModuleUsagesWithComponent;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function replaceModuleUsagesWithComponent(tree, moduleName, componentName) {
|
|
7
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
|
|
8
|
-
if ((0, path_1.extname)(path) !== '.ts') {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const fileContents = tree.read(path, 'utf-8');
|
|
12
|
-
if (fileContents.includes(moduleName)) {
|
|
13
|
-
// Word boundary \b ensures that other modules won't be affected.
|
|
14
|
-
// E.g. "MapIconModule" would not be affected when "IconModule" is being migrated.
|
|
15
|
-
const moduleNameRegex = new RegExp(`\\b${moduleName}\\b`, 'g');
|
|
16
|
-
const newFileContents = fileContents.replace(moduleNameRegex, componentName);
|
|
17
|
-
tree.write(path, newFileContents);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.selectorExistsInAST = selectorExistsInAST;
|
|
4
|
-
function selectorExistsInAST(selector, sourceFile) {
|
|
5
|
-
const { query } = require('@phenomnomnominal/tsquery');
|
|
6
|
-
return query(sourceFile, selector).length > 0;
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyIsInlineScam = verifyIsInlineScam;
|
|
4
|
-
const selector_exists_in_ast_1 = require("./selector-exists-in-ast");
|
|
5
|
-
function verifyIsInlineScam(componentAST) {
|
|
6
|
-
const NGMODULE_DECORATOR_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=NgModule])';
|
|
7
|
-
const COMPONENT_DECORATOR_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=Component])';
|
|
8
|
-
return ((0, selector_exists_in_ast_1.selectorExistsInAST)(COMPONENT_DECORATOR_SELECTOR, componentAST) &&
|
|
9
|
-
(0, selector_exists_in_ast_1.selectorExistsInAST)(NGMODULE_DECORATOR_SELECTOR, componentAST));
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function verifyModuleIsScam(exportsArray: string[], componentName: string, declarationsArray: string[]): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyModuleIsScam = verifyModuleIsScam;
|
|
4
|
-
function verifyModuleIsScam(exportsArray, componentName, declarationsArray) {
|
|
5
|
-
// Check exports has 1 export and check export exists in declaration and is the same as the component name
|
|
6
|
-
if (exportsArray.length !== 1 &&
|
|
7
|
-
!(exportsArray.includes(componentName) &&
|
|
8
|
-
declarationsArray.includes(componentName))) {
|
|
9
|
-
throw new Error(`The NgModule is not a SCAM. Please ensure the NgModule only contains one export and that the component is both declared and exported from the NgModule.`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema } from './schema';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Convert any remaining SCAMs before upgrading. It will be removed in Nx v24.
|
|
5
|
-
*/
|
|
6
|
-
export declare function scamToStandalone(tree: Tree, { component, project: projectName, skipFormat }: Schema): Promise<void>;
|
|
7
|
-
export default scamToStandalone;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scamToStandalone = scamToStandalone;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
6
|
-
const lib_1 = require("./lib");
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Convert any remaining SCAMs before upgrading. It will be removed in Nx v24.
|
|
9
|
-
*/
|
|
10
|
-
async function scamToStandalone(tree, { component, project: projectName, skipFormat }) {
|
|
11
|
-
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
12
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
13
|
-
let project = (0, lib_1.getTargetProject)(projectName, projects);
|
|
14
|
-
const normalizedComponentPath = (0, devkit_1.joinPathFragments)(project.root, component);
|
|
15
|
-
if (!tree.exists(normalizedComponentPath)) {
|
|
16
|
-
throw new Error(`The path provided to the component (${normalizedComponentPath}) does not exist. Please ensure the correct path has been provided.`);
|
|
17
|
-
}
|
|
18
|
-
const { componentFileContents, componentAST, componentName } = (0, lib_1.getComponentDataFromAST)(tree, normalizedComponentPath);
|
|
19
|
-
const isInlineScam = (0, lib_1.verifyIsInlineScam)(componentAST);
|
|
20
|
-
if (!isInlineScam) {
|
|
21
|
-
throw new Error('This generator currently only supports inline SCAMs. We could not find an accompanying NgModule within the component file, please ensure the SCAM provided is an inline scam.');
|
|
22
|
-
}
|
|
23
|
-
const { moduleNodes, exportsArray, importsArray, declarationsArray, providersArray, moduleName, } = (0, lib_1.getModuleMetadataFromAST)(componentAST, componentFileContents);
|
|
24
|
-
(0, lib_1.verifyModuleIsScam)(exportsArray, componentName, declarationsArray);
|
|
25
|
-
(0, lib_1.convertScamToStandalone)(componentAST, componentFileContents, importsArray, providersArray, moduleNodes, tree, normalizedComponentPath, componentName);
|
|
26
|
-
(0, lib_1.replaceModuleUsagesWithComponent)(tree, moduleName, componentName);
|
|
27
|
-
if (!skipFormat) {
|
|
28
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.default = scamToStandalone;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "GeneratorAngularScamToStandalone",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "Convert an Inline SCAM to Standalone Component",
|
|
6
|
-
"description": "Convert an Inline SCAM to a Standalone Component.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"component": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "The path to the SCAM component file, relative to the root of the project containing the SCAM.",
|
|
12
|
-
"$default": {
|
|
13
|
-
"$source": "argv",
|
|
14
|
-
"index": 0
|
|
15
|
-
},
|
|
16
|
-
"x-priority": "important"
|
|
17
|
-
},
|
|
18
|
-
"project": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The project containing the SCAM.",
|
|
21
|
-
"x-prompt": "What project contains the SCAM?",
|
|
22
|
-
"x-dropdown": "projects",
|
|
23
|
-
"x-priority": "important"
|
|
24
|
-
},
|
|
25
|
-
"skipFormat": {
|
|
26
|
-
"type": "boolean",
|
|
27
|
-
"description": "Skip formatting the workspace after the generator completes.",
|
|
28
|
-
"x-priority": "internal"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"examplesFile": "../../../docs/scam-to-standalone-examples.md"
|
|
32
|
-
}
|
package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';<% if(routing) { %>
|
|
3
|
-
import { RouterModule } from '@angular/router';<% } %>
|
|
4
|
-
|
|
5
|
-
import { RemoteEntry<%= componentType %> } from './entry<%= componentFileSuffix %>';
|
|
6
|
-
import { <%= nxWelcomeSymbolName %> } from './<%= nxWelcomeFileName %>';<% if(routing) { %>
|
|
7
|
-
import { remoteRoutes } from './entry.routes';<% } %>
|
|
8
|
-
|
|
9
|
-
@NgModule({
|
|
10
|
-
declarations: [RemoteEntry<%= componentType %>, <%= nxWelcomeSymbolName %>],
|
|
11
|
-
imports: [
|
|
12
|
-
CommonModule,<% if(routing) { %>
|
|
13
|
-
RouterModule.forChild(remoteRoutes),<% } %>
|
|
14
|
-
],
|
|
15
|
-
providers: [],<% if(!routing) { %>
|
|
16
|
-
exports: [RemoteEntry<%= componentType %>],<% } %>
|
|
17
|
-
})
|
|
18
|
-
export class RemoteEntryModule {}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({<% if (prefix) { %>
|
|
4
|
-
selector: '<%= prefix %>-<%= appName %>-entry',
|
|
5
|
-
standalone: false,
|
|
6
|
-
template: `<<%= prefix %>-nx-welcome></<%= prefix %>-nx-welcome>`<% } else { %>
|
|
7
|
-
selector: '<%= appName %>-entry',
|
|
8
|
-
template: `<nx-welcome></nx-welcome>`<% } %>
|
|
9
|
-
})
|
|
10
|
-
export class RemoteEntry<%= componentType %> {}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { <%= appSymbolName %> } from './<%= appFileName %>';
|
|
3
|
-
import { <%= nxWelcomeSymbolName %> } from './<%= nxWelcomeFileName %>';
|
|
4
|
-
import { Router, RouterModule } from '@angular/router';
|
|
5
|
-
|
|
6
|
-
describe('<%= appSymbolName %>', () => {
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
await TestBed.configureTestingModule({
|
|
9
|
-
imports: [
|
|
10
|
-
RouterModule.forRoot([
|
|
11
|
-
{ path: '', component: <%= nxWelcomeSymbolName %> },
|
|
12
|
-
]),<% if (standalone) { %>
|
|
13
|
-
<%= appSymbolName %>,
|
|
14
|
-
<%= nxWelcomeSymbolName %>,<% } %>
|
|
15
|
-
],<% if (!standalone) { %>
|
|
16
|
-
declarations: [<%= appSymbolName %>, <%= nxWelcomeSymbolName %>],<% } %>
|
|
17
|
-
}).compileComponents();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create the app', () => {
|
|
21
|
-
const fixture = TestBed.createComponent(<%= appSymbolName %>);
|
|
22
|
-
const app = fixture.componentInstance;
|
|
23
|
-
expect(app).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it(`should have as title '<%= appName %>'`, () => {
|
|
27
|
-
const fixture = TestBed.createComponent(<%= appSymbolName %>);
|
|
28
|
-
const app = fixture.componentInstance;
|
|
29
|
-
expect(app.title).toEqual('<%= appName %>');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should render title', async () => {
|
|
33
|
-
const fixture = TestBed.createComponent(<%= appSymbolName %>);
|
|
34
|
-
const router = TestBed.inject(Router);
|
|
35
|
-
await router.navigate(['']);
|
|
36
|
-
<%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %>
|
|
37
|
-
const compiled = fixture.nativeElement as HTMLElement;
|
|
38
|
-
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
39
|
-
'Welcome <%= appName %>'
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { <%= nxWelcomeSymbolName %> } from './<%= nxWelcomeFileName %>';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
imports: [<%= nxWelcomeSymbolName %>],<% if (prefix) { %>
|
|
6
|
-
selector: '<%= prefix %>-<%= appName %>-entry',
|
|
7
|
-
template: `<<%= prefix %>-nx-welcome></<%= prefix %>-nx-welcome>`<% } else { %>
|
|
8
|
-
selector: '<%= appName %>-entry',
|
|
9
|
-
template: `<nx-welcome></nx-welcome>`<% } %>
|
|
10
|
-
})
|
|
11
|
-
export class RemoteEntry<%= componentType %> {}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ModuleFederationConfig } from '@nx/module-federation';
|
|
2
|
-
|
|
3
|
-
const config: ModuleFederationConfig = {
|
|
4
|
-
name: '<%= name %>',<% if(type === 'host') { %>
|
|
5
|
-
/**
|
|
6
|
-
* To use a remote that does not exist in your current Nx Workspace
|
|
7
|
-
* You can use the tuple-syntax to define your remote
|
|
8
|
-
*
|
|
9
|
-
* remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
|
|
10
|
-
*
|
|
11
|
-
* You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
|
|
12
|
-
* following content:
|
|
13
|
-
*
|
|
14
|
-
* declare module 'my-external-remote';
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
remotes: [<% if (federationType === 'static') { remotes.forEach(function(remote) { %>'<%= remote.remoteName %>',<% }); } %>]<% } %><% if(type === 'remote') { %>
|
|
18
|
-
exposes: {<% if(standalone) { %>
|
|
19
|
-
'./Routes': '<%= projectRoot %>/src/app/remote-entry/entry.routes.ts',<% } else { %>
|
|
20
|
-
'./Module': '<%= projectRoot %>/src/app/remote-entry/<%= entryModuleFileName %>.ts',<% } %>
|
|
21
|
-
},<% } %>
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
26
|
-
**/
|
|
27
|
-
export default config;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "ES2020"
|
|
5
|
-
},
|
|
6
|
-
"include": [
|
|
7
|
-
"src/main.ts",
|
|
8
|
-
<% if(type === "remote") { %> "src/remote-entry/<% if(standalone) { %>entry.routes.ts",<% } else { %><%= entryModuleFileName %>.ts",<% } } %>
|
|
9
|
-
"webpack.config.ts",
|
|
10
|
-
"webpack.prod.config.ts"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { withModuleFederation } from '@nx/module-federation/angular';
|
|
2
|
-
import config from './module-federation.config';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
|
|
6
|
-
* The DTS Plugin can be enabled by setting dts: true
|
|
7
|
-
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
|
|
8
|
-
*/
|
|
9
|
-
export default withModuleFederation(config, { dts: false });
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { withModuleFederation } from '@nx/module-federation/angular';
|
|
2
|
-
import config from './module-federation.config';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
|
|
6
|
-
* The DTS Plugin can be enabled by setting dts: true
|
|
7
|
-
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
|
|
8
|
-
*/
|
|
9
|
-
export default withModuleFederation({
|
|
10
|
-
...config,
|
|
11
|
-
/*
|
|
12
|
-
* Remote overrides for production.
|
|
13
|
-
* Each entry is a pair of a unique name and the URL where it is deployed.
|
|
14
|
-
*
|
|
15
|
-
* e.g.
|
|
16
|
-
* remotes: [
|
|
17
|
-
* ['app1', 'https://app1.example.com'],
|
|
18
|
-
* ['app2', 'https://app2.example.com'],
|
|
19
|
-
* ]
|
|
20
|
-
*/
|
|
21
|
-
}, { dts: false });
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
3
|
-
**/
|
|
4
|
-
module.exports = {
|
|
5
|
-
name: '<%= name %>',<% if(type === 'host') { %>
|
|
6
|
-
/**
|
|
7
|
-
* To use a remote that does not exist in your current Nx Workspace
|
|
8
|
-
* You can use the tuple-syntax to define your remote
|
|
9
|
-
*
|
|
10
|
-
* remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
|
|
11
|
-
*
|
|
12
|
-
* You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
|
|
13
|
-
* following content:
|
|
14
|
-
*
|
|
15
|
-
* declare module 'my-external-remote';
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
remotes: [<% if (federationType === 'static') { remotes.forEach(function(remote) { %>'<%= remote.remoteName %>',<% }); } %>]<% } %><% if(type === 'remote') { %>
|
|
19
|
-
exposes: {<% if(standalone) { %>
|
|
20
|
-
'./Routes': '<%= projectRoot %>/src/app/remote-entry/entry.routes.ts',<% } else { %>
|
|
21
|
-
'./Module': '<%= projectRoot %>/src/app/remote-entry/<%= entryModuleFileName %>.ts',<% } %>
|
|
22
|
-
},<% } %>
|
|
23
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const { withModuleFederation } = require('@nx/module-federation/angular');
|
|
2
|
-
const config = require('./module-federation.config');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
|
|
6
|
-
* The DTS Plugin can be enabled by setting dts: true
|
|
7
|
-
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
|
|
8
|
-
*/
|
|
9
|
-
module.exports = withModuleFederation(config, { dts: false });
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const { withModuleFederation } = require('@nx/module-federation/angular');
|
|
2
|
-
const config = require('./module-federation.config');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
|
|
6
|
-
* The DTS Plugin can be enabled by setting dts: true
|
|
7
|
-
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
|
|
8
|
-
*/
|
|
9
|
-
module.exports = withModuleFederation({
|
|
10
|
-
...config,
|
|
11
|
-
/*
|
|
12
|
-
* Remote overrides for production.
|
|
13
|
-
* Each entry is a pair of a unique name and the URL where it is deployed.
|
|
14
|
-
*
|
|
15
|
-
* e.g.
|
|
16
|
-
* remotes: [
|
|
17
|
-
* ['app1', 'https://app1.example.com'],
|
|
18
|
-
* ['app2', 'https://app2.example.com'],
|
|
19
|
-
* ]
|
|
20
|
-
*/
|
|
21
|
-
}, { dts: false });
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This is a temporary workaround to prevent cypress erroring
|
|
3
|
-
// as Angular attempt to figure out how to fix HMR when styles.js
|
|
4
|
-
// is attached to the index.html with type=module
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addCypressOnErrorWorkaround = addCypressOnErrorWorkaround;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const internal_1 = require("@nx/js/internal");
|
|
9
|
-
function addCypressOnErrorWorkaround(tree, schema) {
|
|
10
|
-
if (!schema.e2eProjectName) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const e2eProjectName = schema.e2eProjectName;
|
|
14
|
-
let e2eProject;
|
|
15
|
-
try {
|
|
16
|
-
e2eProject = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
devkit_1.logger.warn((0, devkit_1.stripIndents) `Could not find an associated e2e project for ${schema.appName} with name ${e2eProjectName}.
|
|
20
|
-
If there is an associated e2e project for this application, and it uses Cypress, you will need to add a workaround to allow Cypress to test correctly.
|
|
21
|
-
An error will be thrown in the console when you serve the application, coming from styles.js. It is an error that can be safely ignored and will not reach production due to how production builds of Angular are created.
|
|
22
|
-
You can find how to implement that workaround here: https://docs.cypress.io/api/events/catalog-of-events#Uncaught-Exceptions
|
|
23
|
-
`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (e2eProject.targets?.e2e?.executor !== '@nx/cypress:cypress') {
|
|
27
|
-
try {
|
|
28
|
-
// don't ensure package is installed, if it's not installed, we don't need to add the workaround
|
|
29
|
-
const { CYPRESS_CONFIG_FILE_NAME_PATTERN, } = require('@nx/cypress/internal');
|
|
30
|
-
if (!(0, devkit_1.glob)(tree, [`${e2eProject.root}/${CYPRESS_CONFIG_FILE_NAME_PATTERN}`])
|
|
31
|
-
.length) {
|
|
32
|
-
// Not a cypress e2e project, skip
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// assume cypress is not installed
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const commandToAdd = `Cypress.on('uncaught:exception', err => {
|
|
42
|
-
if (err.message.includes(\`Cannot use 'import.meta' outside a module\`)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
});`;
|
|
47
|
-
const pathToCommandsFile = (0, devkit_1.joinPathFragments)((0, internal_1.getProjectSourceRoot)(e2eProject, tree), 'support/e2e.ts');
|
|
48
|
-
const commandsContent = tree.exists(pathToCommandsFile)
|
|
49
|
-
? tree.read(pathToCommandsFile, 'utf-8')
|
|
50
|
-
: '';
|
|
51
|
-
tree.write(pathToCommandsFile, `${commandsContent}\n${commandToAdd}`);
|
|
52
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addRemoteEntry = addRemoteEntry;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const route_utils_1 = require("../../../utils/nx-devkit/route-utils");
|
|
6
|
-
function addRemoteEntry(tree, options, appRoot) {
|
|
7
|
-
const { appName, routing, prefix, standalone, componentType, componentFileSuffix, nxWelcomeComponentInfo, entryModuleFileName, } = options;
|
|
8
|
-
(0, devkit_1.generateFiles)(tree, standalone
|
|
9
|
-
? (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-entry-component-files')
|
|
10
|
-
: (0, devkit_1.joinPathFragments)(__dirname, '../files/entry-module-files'), `${appRoot}/src/app/remote-entry`, {
|
|
11
|
-
tmpl: '',
|
|
12
|
-
appName,
|
|
13
|
-
routing,
|
|
14
|
-
prefix,
|
|
15
|
-
componentType,
|
|
16
|
-
componentFileSuffix,
|
|
17
|
-
entryModuleFileName,
|
|
18
|
-
nxWelcomeFileName: nxWelcomeComponentInfo.extensionlessFileName,
|
|
19
|
-
nxWelcomeSymbolName: nxWelcomeComponentInfo.symbolName,
|
|
20
|
-
});
|
|
21
|
-
if (standalone && routing) {
|
|
22
|
-
(0, route_utils_1.addRoute)(tree, (0, devkit_1.joinPathFragments)(appRoot, 'src/app/app.routes.ts'), `{path: '', loadChildren: () => import('./remote-entry/entry.routes').then(m => m.remoteRoutes)}`);
|
|
23
|
-
}
|
|
24
|
-
else if (routing) {
|
|
25
|
-
(0, route_utils_1.addRoute)(tree, (0, devkit_1.joinPathFragments)(appRoot, 'src/app/app.routes.ts'), `{ path: '', loadChildren: () => import('./remote-entry/${entryModuleFileName}').then(m => m.RemoteEntryModule) }`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
export type AddRemoteOptions = {
|
|
3
|
-
host: string;
|
|
4
|
-
appName: string;
|
|
5
|
-
standalone: boolean;
|
|
6
|
-
port: number;
|
|
7
|
-
};
|
|
8
|
-
export declare function checkIsCommaNeeded(mfRemoteText: string): boolean;
|
|
9
|
-
export declare function addRemoteToHost(tree: Tree, options: AddRemoteOptions): void;
|