@nx/angular 24.0.0-pr.37405.acdaf31 → 24.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.host = host;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const internal_2 = require("@nx/eslint/internal");
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const js_1 = require("@nx/js");
|
|
9
|
-
const internal_3 = require("@nx/js/internal");
|
|
10
|
-
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
11
|
-
const test_runners_1 = require("../../utils/test-runners");
|
|
12
|
-
const application_1 = tslib_1.__importDefault(require("../application/application"));
|
|
13
|
-
const convert_to_rspack_1 = tslib_1.__importDefault(require("../convert-to-rspack/convert-to-rspack"));
|
|
14
|
-
const remote_1 = tslib_1.__importDefault(require("../remote/remote"));
|
|
15
|
-
const setup_mf_1 = require("../setup-mf/setup-mf");
|
|
16
|
-
const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
|
|
17
|
-
const assert_mf_utils_1 = require("../utils/assert-mf-utils");
|
|
18
|
-
const validations_1 = require("../utils/validations");
|
|
19
|
-
const version_utils_1 = require("../utils/version-utils");
|
|
20
|
-
const lib_1 = require("./lib");
|
|
21
|
-
async function host(tree, schema) {
|
|
22
|
-
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
23
|
-
(0, validations_1.assertNotUsingTsSolutionSetup)(tree, 'host');
|
|
24
|
-
(0, lib_1.validateOptions)(tree, schema);
|
|
25
|
-
// TODO: Replace with Rspack when confidence is high enough
|
|
26
|
-
schema.bundler ??= 'webpack';
|
|
27
|
-
const isRspack = schema.bundler === 'rspack';
|
|
28
|
-
(0, assert_mf_utils_1.assertRspackIsCSR)(schema.bundler, schema.ssr ?? false);
|
|
29
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
30
|
-
schema.zoneless ??= angularMajorVersion >= 21 ? true : false;
|
|
31
|
-
const { typescriptConfiguration = true, ...options } = schema;
|
|
32
|
-
options.standalone = options.standalone ?? true;
|
|
33
|
-
// Resolved before delegating so the host and every generated remote share one
|
|
34
|
-
// answer. `applicationGenerator` returns a new object rather than mutating
|
|
35
|
-
// this one, so resolving there would ask again for each remote.
|
|
36
|
-
options.linter = await (0, internal_3.normalizeLinterOption)(tree, options.linter);
|
|
37
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
38
|
-
const remotesToGenerate = [];
|
|
39
|
-
const remotesToIntegrate = [];
|
|
40
|
-
// Check to see if remotes are provided and also check if --dynamic is provided
|
|
41
|
-
// if both are check that the remotes are valid names else throw an error.
|
|
42
|
-
if (options.dynamic && options.remotes?.length > 0) {
|
|
43
|
-
options.remotes.forEach((remote) => {
|
|
44
|
-
const isValidRemote = (0, js_1.isValidVariable)(remote);
|
|
45
|
-
if (!isValidRemote.isValid) {
|
|
46
|
-
throw new Error(`Invalid remote name provided: ${remote}. ${isValidRemote.message}`);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (options.remotes && options.remotes.length > 0) {
|
|
51
|
-
options.remotes.forEach((remote) => {
|
|
52
|
-
if (!projects.has(remote)) {
|
|
53
|
-
remotesToGenerate.push(remote);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
remotesToIntegrate.push(remote);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
61
|
-
const { projectName: hostProjectName, projectRoot: appRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
62
|
-
name: options.name,
|
|
63
|
-
projectType: 'application',
|
|
64
|
-
directory: options.directory,
|
|
65
|
-
});
|
|
66
|
-
const hostPort = options.port ?? 4200;
|
|
67
|
-
const appInstallTask = await (0, application_1.default)(tree, {
|
|
68
|
-
...options,
|
|
69
|
-
standalone: options.standalone,
|
|
70
|
-
routing: true,
|
|
71
|
-
port: hostPort,
|
|
72
|
-
skipFormat: true,
|
|
73
|
-
bundler: 'webpack',
|
|
74
|
-
});
|
|
75
|
-
const skipE2E = !options.e2eTestRunner || options.e2eTestRunner === test_runners_1.E2eTestRunner.None;
|
|
76
|
-
await (0, setup_mf_1.setupMf)(tree, {
|
|
77
|
-
appName: hostProjectName,
|
|
78
|
-
mfType: 'host',
|
|
79
|
-
routing: true,
|
|
80
|
-
port: hostPort,
|
|
81
|
-
remotes: remotesToIntegrate ?? [],
|
|
82
|
-
federationType: options.dynamic ? 'dynamic' : 'static',
|
|
83
|
-
skipPackageJson: options.skipPackageJson,
|
|
84
|
-
skipFormat: true,
|
|
85
|
-
skipE2E,
|
|
86
|
-
e2eProjectName: skipE2E ? undefined : `${hostProjectName}-e2e`,
|
|
87
|
-
prefix: options.prefix,
|
|
88
|
-
typescriptConfiguration,
|
|
89
|
-
standalone: options.standalone,
|
|
90
|
-
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
91
|
-
});
|
|
92
|
-
let installTasks = [appInstallTask];
|
|
93
|
-
if (options.ssr) {
|
|
94
|
-
let ssrInstallTask = await (0, lib_1.updateSsrSetup)(tree, options, hostProjectName, typescriptConfiguration);
|
|
95
|
-
installTasks.push(ssrInstallTask);
|
|
96
|
-
}
|
|
97
|
-
for (let i = 0; i < remotesToGenerate.length; i++) {
|
|
98
|
-
const remote = remotesToGenerate[i];
|
|
99
|
-
const remoteDirectory = options.directory
|
|
100
|
-
? (0, devkit_1.joinPathFragments)(options.directory, '..', remote)
|
|
101
|
-
: appRoot === '.'
|
|
102
|
-
? remote
|
|
103
|
-
: (0, devkit_1.joinPathFragments)(appRoot, '..', remote);
|
|
104
|
-
await (0, remote_1.default)(tree, {
|
|
105
|
-
...options,
|
|
106
|
-
name: remote,
|
|
107
|
-
directory: remoteDirectory,
|
|
108
|
-
host: hostProjectName,
|
|
109
|
-
port: isRspack ? hostPort + i + 1 : undefined,
|
|
110
|
-
skipFormat: true,
|
|
111
|
-
standalone: options.standalone,
|
|
112
|
-
typescriptConfiguration,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
|
|
116
|
-
if (isRspack) {
|
|
117
|
-
await (0, convert_to_rspack_1.default)(tree, {
|
|
118
|
-
project: hostProjectName,
|
|
119
|
-
skipInstall: options.skipPackageJson,
|
|
120
|
-
skipFormat: true,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, hostProjectName);
|
|
124
|
-
project.targets.serve ??= {};
|
|
125
|
-
project.targets.serve.options ??= {};
|
|
126
|
-
project.targets.serve.options.port = hostPort;
|
|
127
|
-
(0, devkit_1.updateProjectConfiguration)(tree, hostProjectName, project);
|
|
128
|
-
if (!options.skipFormat) {
|
|
129
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
130
|
-
}
|
|
131
|
-
return (0, devkit_1.runTasksInSerial)(...installTasks);
|
|
132
|
-
}
|
|
133
|
-
exports.default = host;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateSsrSetup = updateSsrSetup;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const versions_1 = require("../../../utils/versions");
|
|
8
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
9
|
-
async function updateSsrSetup(tree, options, appName, typescriptConfiguration) {
|
|
10
|
-
let project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
|
11
|
-
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
12
|
-
tree.rename((0, devkit_1.joinPathFragments)(sourceRoot, 'main.server.ts'), (0, devkit_1.joinPathFragments)(sourceRoot, 'bootstrap.server.ts'));
|
|
13
|
-
const pathToServerEntry = (0, devkit_1.joinPathFragments)(sourceRoot, 'server.ts');
|
|
14
|
-
tree.write(pathToServerEntry, `import('./main.server');`);
|
|
15
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
16
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files/common'), project.root, {
|
|
17
|
-
appName,
|
|
18
|
-
browserBundleOutput: project.targets.build.options.outputPath,
|
|
19
|
-
standalone: options.standalone,
|
|
20
|
-
zoneless: options.zoneless,
|
|
21
|
-
useDefaultImport: angularMajorVersion >= 21,
|
|
22
|
-
angularMajorVersion,
|
|
23
|
-
supportsAllowedHosts: (0, version_utils_1.supportsSsrAllowedHosts)(tree),
|
|
24
|
-
tmpl: '',
|
|
25
|
-
});
|
|
26
|
-
const pathToTemplateFiles = typescriptConfiguration ? 'ts' : 'js';
|
|
27
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files', pathToTemplateFiles), project.root, {
|
|
28
|
-
tmpl: '',
|
|
29
|
-
});
|
|
30
|
-
// update project.json
|
|
31
|
-
project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
|
32
|
-
project.targets.server.executor = '@nx/angular:webpack-server';
|
|
33
|
-
project.targets.server.options.customWebpackConfig = {
|
|
34
|
-
path: (0, devkit_1.joinPathFragments)(project.root, `webpack.server.config.${pathToTemplateFiles}`),
|
|
35
|
-
};
|
|
36
|
-
if (project.targets.server.configurations &&
|
|
37
|
-
project.targets.server.configurations.development) {
|
|
38
|
-
if ('vendorChunk' in project.targets.server.configurations.development) {
|
|
39
|
-
delete project.targets.server.configurations.development.vendorChunk;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
project.targets['serve-ssr'].executor =
|
|
43
|
-
'@nx/angular:module-federation-dev-ssr';
|
|
44
|
-
(0, devkit_1.updateProjectConfiguration)(tree, appName, project);
|
|
45
|
-
if (!options.skipPackageJson) {
|
|
46
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
47
|
-
cors: versions_1.corsVersion,
|
|
48
|
-
'@module-federation/node': versions_1.moduleFederationNodeVersion,
|
|
49
|
-
}, {
|
|
50
|
-
'@types/cors': versions_1.typesCorsVersion,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return () => { };
|
|
54
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOptions = validateOptions;
|
|
4
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
5
|
-
function validateOptions(tree, options) {
|
|
6
|
-
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
7
|
-
if (angularMajorVersion < 21) {
|
|
8
|
-
if (options.zoneless) {
|
|
9
|
-
throw new Error(`The "zoneless" option is only supported for Angular versions >= 21.0.0. You are using Angular ${angularVersion}.`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { LinterType } from '@nx/js';
|
|
2
|
-
import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
|
3
|
-
import type { Styles } from '../utils/types';
|
|
4
|
-
|
|
5
|
-
export interface Schema {
|
|
6
|
-
directory: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
bundler?: 'webpack' | 'rspack';
|
|
9
|
-
port?: number;
|
|
10
|
-
remotes?: string[];
|
|
11
|
-
dynamic?: boolean;
|
|
12
|
-
enableTypedLinting?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
15
|
-
*/
|
|
16
|
-
setParserOptionsProject?: boolean;
|
|
17
|
-
skipPackageJson?: boolean;
|
|
18
|
-
skipPostInstall?: boolean;
|
|
19
|
-
prefix?: string;
|
|
20
|
-
style?: Styles;
|
|
21
|
-
skipTests?: boolean;
|
|
22
|
-
tags?: string;
|
|
23
|
-
linter?: LinterType;
|
|
24
|
-
unitTestRunner?: Exclude<UnitTestRunner, UnitTestRunner.VitestAngular>;
|
|
25
|
-
e2eTestRunner?: E2eTestRunner;
|
|
26
|
-
backendProject?: string;
|
|
27
|
-
strict?: boolean;
|
|
28
|
-
inlineStyle?: boolean;
|
|
29
|
-
inlineTemplate?: boolean;
|
|
30
|
-
viewEncapsulation?: 'Emulated' | 'Native' | 'None';
|
|
31
|
-
skipFormat?: boolean;
|
|
32
|
-
standalone?: boolean;
|
|
33
|
-
ssr?: boolean;
|
|
34
|
-
zoneless?: boolean;
|
|
35
|
-
typescriptConfiguration?: boolean;
|
|
36
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxMFHost",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "Nx Module Federation Consumer (Host) Application",
|
|
6
|
-
"description": "Create an Angular Consumer (Host) Module Federation Application.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"examples": [
|
|
9
|
-
{
|
|
10
|
-
"command": "nx g @nx/angular:host appName --remotes=remote1",
|
|
11
|
-
"description": "Create an Angular application with configuration in place for Module Federation. If the `remotes` option is provided, attach the Producer (remote) application to this application's configuration"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"command": "nx g @nx/angular:consumer appName --producers=remote1",
|
|
15
|
-
"description": "Create an Angular application with configuration in place for Module Federation. If the `producers` option is provided, attach the Producer (remote) application to this application's configuration"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"properties": {
|
|
19
|
-
"directory": {
|
|
20
|
-
"description": "The directory of the new application.",
|
|
21
|
-
"type": "string",
|
|
22
|
-
"$default": {
|
|
23
|
-
"$source": "argv",
|
|
24
|
-
"index": 0
|
|
25
|
-
},
|
|
26
|
-
"x-prompt": "Which directory do you want to create the application in?"
|
|
27
|
-
},
|
|
28
|
-
"name": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The name to give to the Consumer (host) Angular application.",
|
|
31
|
-
"pattern": "^[a-zA-Z][^:]*$",
|
|
32
|
-
"x-priority": "important"
|
|
33
|
-
},
|
|
34
|
-
"remotes": {
|
|
35
|
-
"type": "array",
|
|
36
|
-
"description": "The names of the Producers (remote) applications to add to the Consumer (host).",
|
|
37
|
-
"x-priority": "important",
|
|
38
|
-
"alias": "producers"
|
|
39
|
-
},
|
|
40
|
-
"bundler": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "The bundler to use for the host application.",
|
|
43
|
-
"default": "webpack",
|
|
44
|
-
"enum": ["webpack", "rspack"]
|
|
45
|
-
},
|
|
46
|
-
"port": {
|
|
47
|
-
"type": "number",
|
|
48
|
-
"description": "The port at which the Consumer (host) application should be served. Defaults to 4200."
|
|
49
|
-
},
|
|
50
|
-
"dynamic": {
|
|
51
|
-
"type": "boolean",
|
|
52
|
-
"description": "Should the host application use dynamic federation?",
|
|
53
|
-
"default": false
|
|
54
|
-
},
|
|
55
|
-
"style": {
|
|
56
|
-
"description": "The file extension to be used for style files.",
|
|
57
|
-
"type": "string",
|
|
58
|
-
"default": "css",
|
|
59
|
-
"enum": ["css", "scss", "sass", "less"],
|
|
60
|
-
"x-prompt": {
|
|
61
|
-
"message": "Which stylesheet format would you like to use?",
|
|
62
|
-
"type": "list",
|
|
63
|
-
"items": [
|
|
64
|
-
{
|
|
65
|
-
"value": "css",
|
|
66
|
-
"label": "CSS"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"value": "scss",
|
|
70
|
-
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"value": "sass",
|
|
74
|
-
"label": "SASS(.sass) [ https://sass-lang.com ]"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"value": "less",
|
|
78
|
-
"label": "LESS [ https://lesscss.org ]"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"inlineStyle": {
|
|
84
|
-
"description": "Specifies if the style will be in the ts file.",
|
|
85
|
-
"type": "boolean",
|
|
86
|
-
"default": false,
|
|
87
|
-
"alias": "s"
|
|
88
|
-
},
|
|
89
|
-
"inlineTemplate": {
|
|
90
|
-
"description": "Specifies if the template will be in the ts file.",
|
|
91
|
-
"type": "boolean",
|
|
92
|
-
"default": false,
|
|
93
|
-
"alias": "t"
|
|
94
|
-
},
|
|
95
|
-
"viewEncapsulation": {
|
|
96
|
-
"description": "Specifies the view encapsulation strategy.",
|
|
97
|
-
"enum": ["Emulated", "None", "ShadowDom"],
|
|
98
|
-
"type": "string"
|
|
99
|
-
},
|
|
100
|
-
"prefix": {
|
|
101
|
-
"type": "string",
|
|
102
|
-
"format": "html-selector",
|
|
103
|
-
"description": "The prefix to apply to generated selectors.",
|
|
104
|
-
"alias": "p"
|
|
105
|
-
},
|
|
106
|
-
"skipTests": {
|
|
107
|
-
"description": "Skip creating spec files.",
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"default": false,
|
|
110
|
-
"alias": "S"
|
|
111
|
-
},
|
|
112
|
-
"skipPackageJson": {
|
|
113
|
-
"type": "boolean",
|
|
114
|
-
"default": false,
|
|
115
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
116
|
-
"x-priority": "internal"
|
|
117
|
-
},
|
|
118
|
-
"skipPostInstall": {
|
|
119
|
-
"type": "boolean",
|
|
120
|
-
"default": false,
|
|
121
|
-
"description": "Do not add or append `ngcc` to the `postinstall` script in `package.json`.",
|
|
122
|
-
"x-priority": "internal"
|
|
123
|
-
},
|
|
124
|
-
"unitTestRunner": {
|
|
125
|
-
"type": "string",
|
|
126
|
-
"enum": ["vitest-analog", "jest", "none"],
|
|
127
|
-
"description": "Test runner to use for unit tests. `vitest-analog` uses AnalogJS-based setup with `@nx/vitest`. It defaults to `vitest-analog` for Angular versions >= 21.0.0, otherwise `jest`.",
|
|
128
|
-
"x-prompt": "Which unit test runner would you like to use?"
|
|
129
|
-
},
|
|
130
|
-
"e2eTestRunner": {
|
|
131
|
-
"type": "string",
|
|
132
|
-
"enum": ["playwright", "cypress", "none"],
|
|
133
|
-
"description": "Test runner to use for end to end (E2E) tests.",
|
|
134
|
-
"x-prompt": "Which E2E test runner would you like to use?",
|
|
135
|
-
"default": "playwright"
|
|
136
|
-
},
|
|
137
|
-
"tags": {
|
|
138
|
-
"type": "string",
|
|
139
|
-
"description": "Add tags to the application (used for linting)."
|
|
140
|
-
},
|
|
141
|
-
"linter": {
|
|
142
|
-
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
143
|
-
"type": "string",
|
|
144
|
-
"enum": ["eslint", "oxlint", "none"]
|
|
145
|
-
},
|
|
146
|
-
"backendProject": {
|
|
147
|
-
"type": "string",
|
|
148
|
-
"description": "Backend project that provides data to this application. This sets up `proxy.config.json`."
|
|
149
|
-
},
|
|
150
|
-
"strict": {
|
|
151
|
-
"type": "boolean",
|
|
152
|
-
"description": "Create an application with stricter type checking and build optimization options.",
|
|
153
|
-
"default": true
|
|
154
|
-
},
|
|
155
|
-
"enableTypedLinting": {
|
|
156
|
-
"type": "boolean",
|
|
157
|
-
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
158
|
-
"default": false
|
|
159
|
-
},
|
|
160
|
-
"setParserOptionsProject": {
|
|
161
|
-
"type": "boolean",
|
|
162
|
-
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
163
|
-
"default": false,
|
|
164
|
-
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
165
|
-
},
|
|
166
|
-
"skipFormat": {
|
|
167
|
-
"description": "Skip formatting files.",
|
|
168
|
-
"type": "boolean",
|
|
169
|
-
"default": false,
|
|
170
|
-
"x-priority": "internal"
|
|
171
|
-
},
|
|
172
|
-
"standalone": {
|
|
173
|
-
"type": "boolean",
|
|
174
|
-
"description": "Whether to generate a Consumer (host) application that uses standalone components.",
|
|
175
|
-
"default": true
|
|
176
|
-
},
|
|
177
|
-
"ssr": {
|
|
178
|
-
"description": "Whether to configure SSR for the Consumer (host) application",
|
|
179
|
-
"type": "boolean",
|
|
180
|
-
"default": false,
|
|
181
|
-
"x-priority": "important"
|
|
182
|
-
},
|
|
183
|
-
"zoneless": {
|
|
184
|
-
"description": "Generate an application that does not use `zone.js`. It defaults to `true`. _Note: this is only supported in Angular versions >= 21.0.0_",
|
|
185
|
-
"type": "boolean"
|
|
186
|
-
},
|
|
187
|
-
"typescriptConfiguration": {
|
|
188
|
-
"type": "boolean",
|
|
189
|
-
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
|
|
190
|
-
"default": true
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
"additionalProperties": false,
|
|
194
|
-
"required": ["directory"]
|
|
195
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const { withModuleFederationForSSR } = 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 = withModuleFederationForSSR(config, { dts: false })
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { withModuleFederationForSSR } 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 withModuleFederationForSSR(config, { dts: false });
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<%_ if (!zoneless && angularMajorVersion < 21) { _%>
|
|
2
|
-
import 'zone.js/node';
|
|
3
|
-
|
|
4
|
-
<%_ } _%>
|
|
5
|
-
import { APP_BASE_HREF } from '@angular/common';
|
|
6
|
-
import { CommonEngine } from '@angular/ssr/node';
|
|
7
|
-
<%_ if (useDefaultImport) { _%>
|
|
8
|
-
import express from 'express';
|
|
9
|
-
import cors from 'cors';
|
|
10
|
-
<%_ } else { _%>
|
|
11
|
-
import * as express from 'express';
|
|
12
|
-
import * as cors from 'cors';
|
|
13
|
-
<%_ } _%>
|
|
14
|
-
import { existsSync } from 'node:fs';
|
|
15
|
-
import { join } from 'node:path';
|
|
16
|
-
import<% if(standalone) { %> bootstrap <% } else { %> { AppServerModule } <% } %>from './bootstrap.server';
|
|
17
|
-
|
|
18
|
-
// The Express app is exported so that it can be used by serverless Functions.
|
|
19
|
-
export function app(): express.Express {
|
|
20
|
-
const server = express();
|
|
21
|
-
const browserBundles = join(process.cwd(), '<%= browserBundleOutput %>');
|
|
22
|
-
const serverBundles = join(process.cwd(), '<%= serverBundleOutput %>');
|
|
23
|
-
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
|
|
24
|
-
? join(browserBundles, 'index.original.html')
|
|
25
|
-
: join(browserBundles, 'index.html');
|
|
26
|
-
|
|
27
|
-
server.use(cors());
|
|
28
|
-
|
|
29
|
-
const commonEngine = new CommonEngine(<%_ if (supportsAllowedHosts) { _%>{
|
|
30
|
-
// The engine rejects any host that is not listed here. Add the hosts this
|
|
31
|
-
// server is reached through before deploying it, or set NG_ALLOWED_HOSTS.
|
|
32
|
-
allowedHosts: ['localhost', '127.0.0.1', '[::1]'],
|
|
33
|
-
}<%_ } _%>);
|
|
34
|
-
|
|
35
|
-
server.set('view engine', 'html');
|
|
36
|
-
server.set('views', browserBundles);
|
|
37
|
-
|
|
38
|
-
// Example Express Rest API endpoints
|
|
39
|
-
// server.get('/api/**', (req, res) => { });
|
|
40
|
-
// Serve static files from /browser
|
|
41
|
-
server.get('*.*', express.static(browserBundles, { maxAge: '1y' }));
|
|
42
|
-
// Serve static files from /server
|
|
43
|
-
server.use('/server', express.static(serverBundles, { maxAge: '1y' }));
|
|
44
|
-
|
|
45
|
-
// All regular routes use the Angular engine
|
|
46
|
-
server.get('*', (req, res, next) => {
|
|
47
|
-
const { protocol, originalUrl, baseUrl, headers } = req;
|
|
48
|
-
|
|
49
|
-
commonEngine
|
|
50
|
-
.render({
|
|
51
|
-
bootstrap<% if (!standalone) { %>: AppServerModule<% } %>,
|
|
52
|
-
documentFilePath: indexHtml,
|
|
53
|
-
url: `${protocol}://${headers.host}${originalUrl}`,
|
|
54
|
-
publicPath: browserBundles,
|
|
55
|
-
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
|
|
56
|
-
})
|
|
57
|
-
.then((html) => res.send(html))
|
|
58
|
-
.catch((err) => next(err));
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return server;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function run(): void {
|
|
65
|
-
const port = process.env['PORT'] || 4000;
|
|
66
|
-
|
|
67
|
-
// Start up the Node server
|
|
68
|
-
const server = app();
|
|
69
|
-
server.listen(port, () => {
|
|
70
|
-
console.log(`Node Express server listening on http://localhost:${port}`);
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* DO NOT REMOVE IF USING @nx/angular:module-federation-dev-ssr executor
|
|
74
|
-
* to serve your Host application with this Remote application.
|
|
75
|
-
* This message allows Nx to determine when the Remote is ready to be
|
|
76
|
-
* consumed by the Host.
|
|
77
|
-
*/
|
|
78
|
-
process.send && process.send('nx.server.ready');
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
run();
|
|
83
|
-
|
|
84
|
-
export default <% if (standalone) { %>bootstrap<% } else { %>AppServerModule<% } %>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { <% if (useBootstrapContext) { %>BootstrapContext, <% } %>bootstrapApplication } from '@angular/platform-browser';
|
|
2
|
-
import { RemoteEntry<%= componentType %> } from './app/remote-entry/entry<%= componentFileSuffix %>';
|
|
3
|
-
import { config } from './app/app.config.server';
|
|
4
|
-
|
|
5
|
-
<%_ if (useBootstrapContext) { _%>
|
|
6
|
-
const bootstrap = (context: BootstrapContext) =>
|
|
7
|
-
bootstrapApplication(RemoteEntry<%= componentType %>, config, context);
|
|
8
|
-
<%_ } else { _%>
|
|
9
|
-
const bootstrap = () => bootstrapApplication(RemoteEntry<%= componentType %>, config);
|
|
10
|
-
<%_ } _%>
|
|
11
|
-
|
|
12
|
-
export default bootstrap;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findNextAvailablePort = findNextAvailablePort;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const get_mf_projects_1 = require("../../../utils/get-mf-projects");
|
|
6
|
-
function findNextAvailablePort(tree) {
|
|
7
|
-
const mfProjects = (0, get_mf_projects_1.getMFProjects)(tree);
|
|
8
|
-
const ports = new Set([4200]);
|
|
9
|
-
for (const mfProject of mfProjects) {
|
|
10
|
-
const { targets } = (0, devkit_1.readProjectConfiguration)(tree, mfProject);
|
|
11
|
-
const port = targets?.serve?.options?.port ?? 4200;
|
|
12
|
-
ports.add(port);
|
|
13
|
-
}
|
|
14
|
-
const nextAvailablePort = Math.max(...ports) + 1;
|
|
15
|
-
return nextAvailablePort;
|
|
16
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./find-next-available-port"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./update-ssr-setup"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./validate-options"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function updateSsrSetup(tree: Tree, { appName, port, standalone, typescriptConfiguration, zoneless, skipPackageJson, }: {
|
|
3
|
-
appName: string;
|
|
4
|
-
port: number;
|
|
5
|
-
standalone: boolean;
|
|
6
|
-
typescriptConfiguration: boolean;
|
|
7
|
-
zoneless: boolean;
|
|
8
|
-
skipPackageJson?: boolean;
|
|
9
|
-
}): Promise<import("@nx/devkit").GeneratorCallback>;
|