@nx/angular 24.0.0-beta.2 → 24.0.0-beta.4

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.
Files changed (204) hide show
  1. package/dist/executors.d.ts +0 -2
  2. package/dist/executors.js +0 -2
  3. package/dist/fesm2022/nx-angular.mjs +0 -4
  4. package/dist/generators.d.ts +0 -4
  5. package/dist/generators.js +0 -4
  6. package/dist/src/executors/application/schema.json +1 -2
  7. package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +9 -1
  8. package/dist/src/executors/unit-test/schema.json +6 -1
  9. package/dist/src/executors/unit-test/unit-test.impl.js +5 -0
  10. package/dist/src/executors/utilities/ng-packagr/stylesheet-processor.js +35 -10
  11. package/dist/src/generators/add-linting/add-linting.js +0 -2
  12. package/dist/src/generators/add-linting/schema.d.ts +0 -1
  13. package/dist/src/generators/application/application.js +1 -2
  14. package/dist/src/generators/application/lib/add-e2e.js +0 -6
  15. package/dist/src/generators/application/lib/add-linting.js +0 -1
  16. package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
  17. package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
  18. package/dist/src/generators/application/lib/normalize-options.js +1 -8
  19. package/dist/src/generators/application/schema.d.ts +0 -1
  20. package/dist/src/generators/application/schema.json +1 -1
  21. package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +3 -4
  22. package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +1 -2
  23. package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -63
  24. package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.d.ts +2 -0
  25. package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.js +32 -0
  26. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
  27. package/dist/src/generators/init/init.js +1 -2
  28. package/dist/src/generators/init/schema.d.ts +0 -2
  29. package/dist/src/generators/library/schema.d.ts +0 -1
  30. package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
  31. package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
  32. package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
  33. package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
  34. package/dist/src/generators/utils/add-jest.d.ts +0 -1
  35. package/dist/src/generators/utils/add-jest.js +0 -2
  36. package/dist/src/generators/utils/add-vitest.d.ts +0 -1
  37. package/dist/src/generators/utils/add-vitest.js +0 -1
  38. package/dist/src/generators/utils/testing.d.ts +0 -4
  39. package/dist/src/generators/utils/testing.js +0 -12
  40. package/dist/src/migrations/update-23-1-0/add-angular-build.js +7 -3
  41. package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
  42. package/dist/src/migrations/update-23-1-0/add-trust-proxy-headers.js +9 -2
  43. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.d.ts +5 -0
  44. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.js +332 -0
  45. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.md +46 -0
  46. package/dist/src/utils/assert-cypress-component-testing-support.js +10 -0
  47. package/dist/src/utils/backward-compatible-versions.js +0 -8
  48. package/dist/src/utils/versions.d.ts +4 -8
  49. package/dist/src/utils/versions.js +5 -9
  50. package/dist/types/nx-angular.d.ts +1 -3
  51. package/executors.json +0 -10
  52. package/generators.json +0 -35
  53. package/migrations.json +97 -0
  54. package/package.json +11 -20
  55. package/dist/.npmignore +0 -2
  56. package/dist/fesm2022/nx-angular-mf.mjs +0 -193
  57. package/dist/fesm2022/nx-angular-mf.mjs.map +0 -1
  58. package/dist/fesm2022/nx-angular.mjs.map +0 -1
  59. package/dist/mf/package.json +0 -4
  60. package/dist/src/builders/utilities/module-federation.d.ts +0 -11
  61. package/dist/src/builders/utilities/module-federation.js +0 -109
  62. package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
  63. package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
  64. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -2
  65. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -22
  66. package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +0 -5
  67. package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +0 -29
  68. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -4
  69. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -111
  70. package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -38
  71. package/dist/src/executors/module-federation-dev-server/schema.json +0 -171
  72. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -2
  73. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -20
  74. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +0 -5
  75. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.js +0 -30
  76. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -4
  77. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -110
  78. package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -17
  79. package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -124
  80. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +0 -4
  81. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.js +0 -36
  82. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +0 -5
  83. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +0 -448
  84. package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +0 -2
  85. package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.js +0 -22
  86. package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +0 -2
  87. package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +0 -45
  88. package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +0 -2
  89. package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +0 -18
  90. package/dist/src/generators/convert-to-with-mf/lib/index.d.ts +0 -6
  91. package/dist/src/generators/convert-to-with-mf/lib/index.js +0 -9
  92. package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +0 -5
  93. package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +0 -57
  94. package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +0 -2
  95. package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +0 -13
  96. package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +0 -3
  97. package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +0 -50
  98. package/dist/src/generators/convert-to-with-mf/schema.d.ts +0 -4
  99. package/dist/src/generators/convert-to-with-mf/schema.json +0 -33
  100. package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
  101. package/dist/src/generators/federate-module/federate-module.js +0 -49
  102. package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +0 -2
  103. package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +0 -14
  104. package/dist/src/generators/federate-module/lib/add-path-to-exposes.d.ts +0 -8
  105. package/dist/src/generators/federate-module/lib/add-path-to-exposes.js +0 -77
  106. package/dist/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +0 -8
  107. package/dist/src/generators/federate-module/lib/add-path-to-ts-config.js +0 -11
  108. package/dist/src/generators/federate-module/lib/add-remote.d.ts +0 -7
  109. package/dist/src/generators/federate-module/lib/add-remote.js +0 -42
  110. package/dist/src/generators/federate-module/lib/check-remote-exists.d.ts +0 -2
  111. package/dist/src/generators/federate-module/lib/check-remote-exists.js +0 -21
  112. package/dist/src/generators/federate-module/lib/index.d.ts +0 -4
  113. package/dist/src/generators/federate-module/lib/index.js +0 -7
  114. package/dist/src/generators/federate-module/schema.d.ts +0 -13
  115. package/dist/src/generators/federate-module/schema.json +0 -83
  116. package/dist/src/generators/host/files/common/src/main.server.ts__tmpl__ +0 -78
  117. package/dist/src/generators/host/files/js/webpack.server.config.js__tmpl__ +0 -8
  118. package/dist/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +0 -9
  119. package/dist/src/generators/host/host.d.ts +0 -4
  120. package/dist/src/generators/host/host.js +0 -133
  121. package/dist/src/generators/host/lib/index.d.ts +0 -2
  122. package/dist/src/generators/host/lib/index.js +0 -5
  123. package/dist/src/generators/host/lib/update-ssr-setup.d.ts +0 -3
  124. package/dist/src/generators/host/lib/update-ssr-setup.js +0 -54
  125. package/dist/src/generators/host/lib/validate-options.d.ts +0 -3
  126. package/dist/src/generators/host/lib/validate-options.js +0 -12
  127. package/dist/src/generators/host/schema.d.ts +0 -36
  128. package/dist/src/generators/host/schema.json +0 -195
  129. package/dist/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +0 -9
  130. package/dist/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +0 -9
  131. package/dist/src/generators/remote/files/common/src/main.server.ts__tmpl__ +0 -84
  132. package/dist/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +0 -12
  133. package/dist/src/generators/remote/lib/find-next-available-port.d.ts +0 -2
  134. package/dist/src/generators/remote/lib/find-next-available-port.js +0 -16
  135. package/dist/src/generators/remote/lib/index.d.ts +0 -3
  136. package/dist/src/generators/remote/lib/index.js +0 -6
  137. package/dist/src/generators/remote/lib/update-ssr-setup.d.ts +0 -9
  138. package/dist/src/generators/remote/lib/update-ssr-setup.js +0 -82
  139. package/dist/src/generators/remote/lib/validate-options.d.ts +0 -3
  140. package/dist/src/generators/remote/lib/validate-options.js +0 -12
  141. package/dist/src/generators/remote/remote.d.ts +0 -4
  142. package/dist/src/generators/remote/remote.js +0 -114
  143. package/dist/src/generators/remote/schema.d.ts +0 -34
  144. package/dist/src/generators/remote/schema.json +0 -184
  145. package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__ +0 -18
  146. package/dist/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +0 -4
  147. package/dist/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +0 -10
  148. package/dist/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -42
  149. package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +0 -4
  150. package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +0 -11
  151. package/dist/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +0 -27
  152. package/dist/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +0 -12
  153. package/dist/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +0 -9
  154. package/dist/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +0 -21
  155. package/dist/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +0 -23
  156. package/dist/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +0 -9
  157. package/dist/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +0 -21
  158. package/dist/src/generators/setup-mf/lib/add-cypress-workaround.d.ts +0 -3
  159. package/dist/src/generators/setup-mf/lib/add-cypress-workaround.js +0 -52
  160. package/dist/src/generators/setup-mf/lib/add-remote-entry.d.ts +0 -3
  161. package/dist/src/generators/setup-mf/lib/add-remote-entry.js +0 -27
  162. package/dist/src/generators/setup-mf/lib/add-remote-to-host.d.ts +0 -9
  163. package/dist/src/generators/setup-mf/lib/add-remote-to-host.js +0 -127
  164. package/dist/src/generators/setup-mf/lib/change-build-target.d.ts +0 -3
  165. package/dist/src/generators/setup-mf/lib/change-build-target.js +0 -24
  166. package/dist/src/generators/setup-mf/lib/fix-bootstrap.d.ts +0 -3
  167. package/dist/src/generators/setup-mf/lib/fix-bootstrap.js +0 -40
  168. package/dist/src/generators/setup-mf/lib/generate-config.d.ts +0 -6
  169. package/dist/src/generators/setup-mf/lib/generate-config.js +0 -32
  170. package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.d.ts +0 -6
  171. package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.js +0 -20
  172. package/dist/src/generators/setup-mf/lib/index.d.ts +0 -15
  173. package/dist/src/generators/setup-mf/lib/index.js +0 -18
  174. package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.d.ts +0 -2
  175. package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.js +0 -15
  176. package/dist/src/generators/setup-mf/lib/normalize-options.d.ts +0 -3
  177. package/dist/src/generators/setup-mf/lib/normalize-options.js +0 -26
  178. package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +0 -3
  179. package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +0 -61
  180. package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.d.ts +0 -3
  181. package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.js +0 -20
  182. package/dist/src/generators/setup-mf/lib/setup-serve-target.d.ts +0 -3
  183. package/dist/src/generators/setup-mf/lib/setup-serve-target.js +0 -39
  184. package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +0 -3
  185. package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +0 -15
  186. package/dist/src/generators/setup-mf/lib/update-host-app-routes.d.ts +0 -3
  187. package/dist/src/generators/setup-mf/lib/update-host-app-routes.js +0 -39
  188. package/dist/src/generators/setup-mf/lib/update-tsconfig.d.ts +0 -3
  189. package/dist/src/generators/setup-mf/lib/update-tsconfig.js +0 -18
  190. package/dist/src/generators/setup-mf/schema.d.ts +0 -35
  191. package/dist/src/generators/setup-mf/schema.json +0 -99
  192. package/dist/src/generators/setup-mf/setup-mf.d.ts +0 -4
  193. package/dist/src/generators/setup-mf/setup-mf.js +0 -90
  194. package/dist/src/generators/utils/add-mf-env-to-inputs.d.ts +0 -2
  195. package/dist/src/generators/utils/add-mf-env-to-inputs.js +0 -36
  196. package/dist/src/generators/utils/assert-mf-utils.d.ts +0 -1
  197. package/dist/src/generators/utils/assert-mf-utils.js +0 -8
  198. package/dist/src/utils/get-mf-projects.d.ts +0 -4
  199. package/dist/src/utils/get-mf-projects.js +0 -31
  200. package/dist/src/utils/module-federation-deprecation.d.ts +0 -4
  201. package/dist/src/utils/module-federation-deprecation.js +0 -29
  202. package/dist/types/nx-angular-mf.d.ts +0 -72
  203. package/dist/types/nx-angular-mf.d.ts.map +0 -1
  204. package/dist/types/nx-angular.d.ts.map +0 -1
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDynamicRemotes = getDynamicRemotes;
4
- exports.getStaticRemotes = getStaticRemotes;
5
- exports.validateDevRemotes = validateDevRemotes;
6
- exports.getDynamicMfManifestFile = getDynamicMfManifestFile;
7
- const devkit_1 = require("@nx/devkit");
8
- const internal_1 = require("@nx/js/internal");
9
- const fs_1 = require("fs");
10
- const path_1 = require("path");
11
- function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, pathToManifestFile) {
12
- pathToManifestFile ??= getDynamicMfManifestFile(project, context.workspaceRoot);
13
- // check for dynamic remotes
14
- // we should only check for dynamic based on what we generate
15
- // and fallback to empty array
16
- if (!pathToManifestFile || !(0, fs_1.existsSync)(pathToManifestFile)) {
17
- return [];
18
- }
19
- const moduleFederationManifestJson = (0, fs_1.readFileSync)(pathToManifestFile, 'utf-8');
20
- if (!moduleFederationManifestJson) {
21
- return [];
22
- }
23
- // This should have shape of
24
- // {
25
- // "remoteName": "remoteLocation",
26
- // }
27
- const parsedManifest = JSON.parse(moduleFederationManifestJson);
28
- if (!Object.keys(parsedManifest).every((key) => typeof key === 'string' && typeof parsedManifest[key] === 'string')) {
29
- return [];
30
- }
31
- const allDynamicRemotes = Object.entries(parsedManifest)
32
- .map(([remoteName]) => remoteName)
33
- .filter((r) => !remotesToSkip.has(r));
34
- const remotesNotInWorkspace = [];
35
- const dynamicRemotes = allDynamicRemotes.filter((remote) => {
36
- if (!workspaceProjects[remote]) {
37
- remotesNotInWorkspace.push(remote);
38
- return false;
39
- }
40
- return true;
41
- });
42
- if (remotesNotInWorkspace.length > 0) {
43
- devkit_1.logger.warn(`Skipping serving ${remotesNotInWorkspace.join(', ')} as they could not be found in the workspace. Ensure they are served correctly.`);
44
- }
45
- return dynamicRemotes;
46
- }
47
- function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot) {
48
- const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
49
- const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
50
- const isTsConfig = (0, fs_1.existsSync)(moduleFederationConfigPathTS);
51
- const moduleFederationConfigPath = isTsConfig
52
- ? moduleFederationConfigPathTS
53
- : moduleFederationConfigPathJS;
54
- try {
55
- const config = isTsConfig
56
- ? (0, internal_1.loadTsFile)(moduleFederationConfigPath, (0, path_1.join)(workspaceRoot, tsconfigPath))
57
- : require(moduleFederationConfigPath);
58
- return {
59
- mfeConfig: config.default || config,
60
- mfConfigPath: moduleFederationConfigPath,
61
- };
62
- }
63
- catch {
64
- throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/angular:host"?`);
65
- }
66
- }
67
- function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
68
- const { mfeConfig, mfConfigPath } = getModuleFederationConfig(project.targets.build.options.tsConfig, context.workspaceRoot, project.root);
69
- const remotesConfig = Array.isArray(mfeConfig.remotes) && mfeConfig.remotes.length > 0
70
- ? mfeConfig.remotes
71
- : [];
72
- const allStaticRemotes = remotesConfig
73
- .map((remoteDefinition) => Array.isArray(remoteDefinition) ? remoteDefinition[0] : remoteDefinition)
74
- .filter((r) => !remotesToSkip.has(r));
75
- const remotesNotInWorkspace = [];
76
- const staticRemotes = allStaticRemotes.filter((remote) => {
77
- if (!workspaceProjects[remote]) {
78
- remotesNotInWorkspace.push(remote);
79
- return false;
80
- }
81
- return true;
82
- });
83
- if (remotesNotInWorkspace.length > 0) {
84
- devkit_1.logger.warn(`Skipping serving ${remotesNotInWorkspace.join(', ')} as they could not be found in the workspace. Ensure they are served correctly.`);
85
- }
86
- return staticRemotes;
87
- }
88
- function validateDevRemotes(options, workspaceProjects) {
89
- const invalidDevRemotes = options.devRemotes.filter((remote) => !(typeof remote === 'string'
90
- ? workspaceProjects[remote]
91
- : workspaceProjects[remote.remoteName])) ?? [];
92
- if (invalidDevRemotes.length) {
93
- throw new Error(invalidDevRemotes.length === 1
94
- ? `Invalid dev remote provided: ${invalidDevRemotes[0]}.`
95
- : `Invalid dev remotes provided: ${invalidDevRemotes.join(', ')}.`);
96
- }
97
- }
98
- function getDynamicMfManifestFile(project, workspaceRoot) {
99
- // {sourceRoot}/assets/module-federation.manifest.json was the generated
100
- // path for the manifest file in the past. We now generate the manifest
101
- // file at {root}/public/module-federation.manifest.json. This check
102
- // ensures that we can still support the old path for backwards
103
- // compatibility since old projects may still have the manifest file
104
- // at the old path.
105
- return [
106
- (0, path_1.join)(workspaceRoot, project.root, 'public/module-federation.manifest.json'),
107
- (0, path_1.join)(workspaceRoot, (0, internal_1.getProjectSourceRoot)(project), 'assets/module-federation.manifest.json'),
108
- ].find((path) => (0, fs_1.existsSync)(path));
109
- }
@@ -1,2 +0,0 @@
1
- export * from './normalize-options';
2
- export * from './start-dev-remotes';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./normalize-options"), exports);
5
- tslib_1.__exportStar(require("./start-dev-remotes"), exports);
@@ -1,2 +0,0 @@
1
- import type { NormalizedSchema, Schema } from '../schema';
2
- export declare function normalizeOptions(schema: Schema): NormalizedSchema;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeOptions = normalizeOptions;
4
- const path_1 = require("path");
5
- const devkit_1 = require("@nx/devkit");
6
- function normalizeOptions(schema) {
7
- schema.buildLibsFromSource ??= true;
8
- process.env.NX_BUILD_LIBS_FROM_SOURCE = `${schema.buildLibsFromSource}`;
9
- process.env.NX_BUILD_TARGET = `${schema.buildTarget}`;
10
- return {
11
- ...schema,
12
- devRemotes: schema.devRemotes ?? [],
13
- host: schema.host ?? 'localhost',
14
- port: schema.port ?? 4200,
15
- liveReload: schema.liveReload ?? true,
16
- open: schema.open ?? false,
17
- ssl: schema.ssl ?? false,
18
- verbose: schema.verbose ?? false,
19
- sslCert: schema.sslCert ? (0, path_1.join)(devkit_1.workspaceRoot, schema.sslCert) : undefined,
20
- sslKey: schema.sslKey ? (0, path_1.join)(devkit_1.workspaceRoot, schema.sslKey) : undefined,
21
- };
22
- }
@@ -1,5 +0,0 @@
1
- import { type Schema } from '../schema';
2
- import { type ExecutorContext, type ProjectConfiguration } from '@nx/devkit';
3
- export declare function startRemotes(remotes: string[], workspaceProjects: Record<string, ProjectConfiguration>, options: Pick<Schema, 'devRemotes' | 'verbose'>, context: ExecutorContext, target?: 'serve' | 'serve-static'): Promise<AsyncIterable<{
4
- success: boolean;
5
- }>[]>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startRemotes = startRemotes;
4
- const devkit_1 = require("@nx/devkit");
5
- async function startRemotes(remotes, workspaceProjects, options, context, target = 'serve') {
6
- const remoteIters = [];
7
- for (const app of remotes) {
8
- if (!workspaceProjects[app].targets?.[target]) {
9
- throw new Error(`Could not find "${target}" target in "${app}" project.`);
10
- }
11
- else if (!workspaceProjects[app].targets?.[target].executor) {
12
- throw new Error(`Could not find executor for "${target}" target in "${app}" project.`);
13
- }
14
- const [collection, executor] = workspaceProjects[app].targets[target].executor.split(':');
15
- const isUsingModuleFederationDevServerExecutor = executor.includes('module-federation-dev-server');
16
- const configurationOverride = options.devRemotes.find((r) => typeof r !== 'string' && r.remoteName === app)?.configuration;
17
- remoteIters.push(await (0, devkit_1.runExecutor)({
18
- project: app,
19
- target,
20
- configuration: configurationOverride ?? context.configurationName,
21
- }, {
22
- ...(target === 'serve' ? { verbose: options.verbose ?? false } : {}),
23
- ...(isUsingModuleFederationDevServerExecutor
24
- ? { isInitialHost: false }
25
- : {}),
26
- }, context));
27
- }
28
- return remoteIters;
29
- }
@@ -1,4 +0,0 @@
1
- import { type ExecutorContext } from '@nx/devkit';
2
- import { type Schema } from './schema';
3
- export declare function moduleFederationDevServerExecutor(schema: Schema, context: ExecutorContext): AsyncGenerator<any, any, any>;
4
- export default moduleFederationDevServerExecutor;
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moduleFederationDevServerExecutor = moduleFederationDevServerExecutor;
4
- const internal_1 = require("@nx/devkit/internal");
5
- const devkit_1 = require("@nx/devkit");
6
- const builder_package_1 = require("../utilities/builder-package");
7
- const lib_1 = require("./lib");
8
- const internal_2 = require("@nx/web/internal");
9
- const dev_server_impl_1 = require("../../builders/dev-server/dev-server.impl");
10
- const module_federation_1 = require("../../builders/utilities/module-federation");
11
- const path_1 = require("path");
12
- const fs_1 = require("fs");
13
- const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
14
- const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
15
- // This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
16
- const Module = require('module');
17
- const originalResolveFilename = Module._resolveFilename;
18
- const patchedWebpackPath = require.resolve('webpack', {
19
- paths: [require.resolve('@angular-devkit/build-angular')],
20
- });
21
- // Override the resolve function
22
- Module._resolveFilename = function (request, parent, isMain, options) {
23
- // Intercept webpack specifically
24
- if (request === 'webpack') {
25
- // Force webpack to resolve from your specific path
26
- return patchedWebpackPath;
27
- }
28
- // For all other modules, use the original resolver
29
- return originalResolveFilename.call(this, request, parent, isMain, options);
30
- };
31
- async function* moduleFederationDevServerExecutor(schema, context) {
32
- (0, builder_package_1.assertPackageIsInstalled)('@nx/module-federation', '@nx/angular:module-federation-dev-server');
33
- const { startRemoteIterators } = await import('@nx/module-federation/internal');
34
- (0, module_federation_deprecation_1.warnAngularMfDevServerExecutorDeprecation)();
35
- const options = (0, lib_1.normalizeOptions)(schema);
36
- const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
37
- const project = workspaceProjects[context.projectName];
38
- const currIter = options.static
39
- ? (0, internal_2.fileServerExecutor)({
40
- port: options.port,
41
- host: options.host,
42
- ssl: options.ssl,
43
- buildTarget: options.buildTarget,
44
- parallel: false,
45
- spa: false,
46
- withDeps: false,
47
- cors: true,
48
- cacheSeconds: -1,
49
- }, context)
50
- : (0, internal_1.eachValueFrom)((0, dev_server_impl_1.executeDevServerBuilder)(options, await (0, ngcli_adapter_1.createBuilderContext)({
51
- builderName: '@nx/angular:webpack-browser',
52
- description: 'Build a browser application',
53
- optionSchema: require('../../builders/webpack-browser/schema.json'),
54
- }, context)));
55
- if (options.isInitialHost === false) {
56
- return yield* currIter;
57
- }
58
- let pathToManifestFile;
59
- if (!options.pathToManifestFile) {
60
- pathToManifestFile = (0, module_federation_1.getDynamicMfManifestFile)(project, context.root);
61
- }
62
- else {
63
- const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
64
- if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
65
- throw new Error(`The provided Module Federation manifest file path does not exist. Please check the file exists at "${userPathToManifestFile}".`);
66
- }
67
- else if ((0, path_1.extname)(options.pathToManifestFile) !== '.json') {
68
- throw new Error(`The Module Federation manifest file must be a JSON. Please ensure the file at ${userPathToManifestFile} is a JSON.`);
69
- }
70
- pathToManifestFile = userPathToManifestFile;
71
- }
72
- (0, module_federation_1.validateDevRemotes)(options, workspaceProjects);
73
- const { remotes, staticRemotesIter, devRemoteIters } = await startRemoteIterators(options, context, lib_1.startRemotes, pathToManifestFile, 'angular');
74
- const removeBaseUrlEmission = (iter) => (0, internal_1.mapAsyncIterable)(iter, (v) => ({
75
- ...v,
76
- baseUrl: undefined,
77
- }));
78
- return yield* (0, internal_1.combineAsyncIterables)(removeBaseUrlEmission(currIter), ...devRemoteIters.map(removeBaseUrlEmission), ...(staticRemotesIter ? [removeBaseUrlEmission(staticRemotesIter)] : []), (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
79
- if (!options.isInitialHost) {
80
- done();
81
- return;
82
- }
83
- if (remotes.remotePorts.length === 0) {
84
- devkit_1.logger.info(`NX All remotes started, server ready at http://localhost:${options.port}`);
85
- next({ success: true, baseUrl: `http://localhost:${options.port}` });
86
- done();
87
- return;
88
- }
89
- try {
90
- const portsToWaitFor = staticRemotesIter
91
- ? [options.staticRemotesPort, ...remotes.remotePorts]
92
- : [...remotes.remotePorts];
93
- await Promise.all(portsToWaitFor.map((port) => (0, internal_2.waitForPortOpen)(port, {
94
- retries: 480,
95
- retryDelay: 2500,
96
- host: 'localhost',
97
- })));
98
- devkit_1.logger.info(`NX All remotes started, server ready at http://localhost:${options.port}`);
99
- next({ success: true, baseUrl: `http://localhost:${options.port}` });
100
- }
101
- catch (err) {
102
- throw new Error(`Failed to start remotes. Check above for any errors.`, {
103
- cause: err,
104
- });
105
- }
106
- finally {
107
- done();
108
- }
109
- }));
110
- }
111
- exports.default = moduleFederationDevServerExecutor;
@@ -1,38 +0,0 @@
1
- import type { DevRemoteDefinition } from '../../builders/utilities/module-federation';
2
-
3
- interface Schema {
4
- buildTarget: string;
5
- port?: number;
6
- host?: string;
7
- proxyConfig?: string;
8
- ssl?: boolean;
9
- sslKey?: string;
10
- sslCert?: string;
11
- headers?: Record<string, string>;
12
- open?: boolean;
13
- verbose?: boolean;
14
- liveReload?: boolean;
15
- publicHost?: string;
16
- allowedHosts?: string[];
17
- servePath?: string;
18
- disableHostCheck?: boolean;
19
- hmr?: boolean;
20
- watch?: boolean;
21
- poll?: number;
22
- devRemotes?: DevRemoteDefinition[];
23
- skipRemotes?: string[];
24
- pathToManifestFile?: string;
25
- static?: boolean;
26
- isInitialHost?: boolean;
27
- parallel?: number;
28
- staticRemotesPort?: number;
29
- buildLibsFromSource?: boolean;
30
- }
31
-
32
- export type NormalizedSchema = Schema & {
33
- devRemotes: DevRemoteDefinition[];
34
- liveReload: boolean;
35
- open: boolean;
36
- ssl: boolean;
37
- verbose: boolean;
38
- };
@@ -1,171 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "title": "Schema for Module Federation Dev Server",
4
- "x-deprecated": "The `@nx/angular:module-federation-dev-server` executor is deprecated. Angular Module Federation in Nx is no longer supported; use `@angular-architects/native-federation`. Removed in Nx v24.",
5
- "continuous": true,
6
- "outputCapture": "direct-nodejs",
7
- "description": "Serves host [Module Federation](https://module-federation.io/) applications ([webpack](https://webpack.js.org/)-based) allowing to specify which remote applications should be served with the host.",
8
- "type": "object",
9
- "presets": [
10
- {
11
- "name": "Using a Different Port",
12
- "keys": ["buildTarget", "port"]
13
- }
14
- ],
15
- "properties": {
16
- "buildTarget": {
17
- "type": "string",
18
- "description": "A build builder target to serve in the format of `project:target[:configuration]`.",
19
- "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
20
- },
21
- "port": {
22
- "type": "number",
23
- "description": "Port to listen on.",
24
- "default": 4200
25
- },
26
- "host": {
27
- "type": "string",
28
- "description": "Host to listen on.",
29
- "default": "localhost"
30
- },
31
- "proxyConfig": {
32
- "type": "string",
33
- "description": "Proxy configuration file. For more information, see https://angular.dev/tools/cli/serve#proxying-to-a-backend-server."
34
- },
35
- "ssl": {
36
- "type": "boolean",
37
- "description": "Serve using HTTPS.",
38
- "default": false
39
- },
40
- "sslKey": {
41
- "type": "string",
42
- "description": "SSL key to use for serving HTTPS."
43
- },
44
- "sslCert": {
45
- "type": "string",
46
- "description": "SSL certificate to use for serving HTTPS."
47
- },
48
- "headers": {
49
- "type": "object",
50
- "description": "Custom HTTP headers to be added to all responses.",
51
- "propertyNames": {
52
- "pattern": "^[-_A-Za-z0-9]+$"
53
- },
54
- "additionalProperties": {
55
- "type": "string"
56
- }
57
- },
58
- "open": {
59
- "type": "boolean",
60
- "description": "Opens the url in default browser.",
61
- "default": false,
62
- "alias": "o"
63
- },
64
- "verbose": {
65
- "type": "boolean",
66
- "description": "Adds more details to output logging."
67
- },
68
- "liveReload": {
69
- "type": "boolean",
70
- "description": "Whether to reload the page on change, using live-reload.",
71
- "default": true
72
- },
73
- "publicHost": {
74
- "type": "string",
75
- "description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies."
76
- },
77
- "allowedHosts": {
78
- "type": "array",
79
- "description": "List of hosts that are allowed to access the dev server.",
80
- "default": [],
81
- "items": {
82
- "type": "string"
83
- }
84
- },
85
- "servePath": {
86
- "type": "string",
87
- "description": "The pathname where the app will be served."
88
- },
89
- "disableHostCheck": {
90
- "type": "boolean",
91
- "description": "Don't verify connected clients are part of allowed hosts.",
92
- "default": false
93
- },
94
- "hmr": {
95
- "type": "boolean",
96
- "description": "Enable hot module replacement.",
97
- "default": false
98
- },
99
- "watch": {
100
- "type": "boolean",
101
- "description": "Rebuild on change.",
102
- "default": true
103
- },
104
- "poll": {
105
- "type": "number",
106
- "description": "Enable and define the file watching poll time period in milliseconds."
107
- },
108
- "devRemotes": {
109
- "type": "array",
110
- "items": {
111
- "oneOf": [
112
- {
113
- "type": "string"
114
- },
115
- {
116
- "type": "object",
117
- "properties": {
118
- "remoteName": {
119
- "type": "string"
120
- },
121
- "configuration": {
122
- "type": "string"
123
- }
124
- },
125
- "required": ["remoteName"],
126
- "additionalProperties": false
127
- }
128
- ]
129
- },
130
- "description": "List of remote applications to run in development mode (i.e. using serve target).",
131
- "x-priority": "important"
132
- },
133
- "skipRemotes": {
134
- "type": "array",
135
- "items": {
136
- "type": "string"
137
- },
138
- "description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful if you have other means for serving the `remote` application(s).\n**NOTE:** Remotes that are not in the workspace will be skipped automatically."
139
- },
140
- "pathToManifestFile": {
141
- "type": "string",
142
- "description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic remote applications relative to the workspace root."
143
- },
144
- "static": {
145
- "type": "boolean",
146
- "description": "Whether to use a static file server instead of the webpack-dev-server. This should be used for remote applications that are also host applications."
147
- },
148
- "isInitialHost": {
149
- "type": "boolean",
150
- "description": "Whether the host that is running this executor is the first in the project tree to do so.",
151
- "default": true,
152
- "x-priority": "internal"
153
- },
154
- "parallel": {
155
- "type": "number",
156
- "description": "Max number of parallel processes for building static remotes"
157
- },
158
- "staticRemotesPort": {
159
- "type": "number",
160
- "description": "The port at which to serve the file-server for the static remotes."
161
- },
162
- "buildLibsFromSource": {
163
- "type": "boolean",
164
- "description": "Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the `buildTarget` options, or it will default to `true` if it's also not set in the `buildTarget` options.",
165
- "x-priority": "important"
166
- }
167
- },
168
- "additionalProperties": false,
169
- "required": ["buildTarget"],
170
- "examplesFile": "../../../docs/module-federation-dev-server-examples.md"
171
- }
@@ -1,2 +0,0 @@
1
- import type { NormalizedSchema, Schema } from '../schema';
2
- export declare function normalizeOptions(options: Schema): NormalizedSchema;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeOptions = normalizeOptions;
4
- const devkit_1 = require("@nx/devkit");
5
- const path_1 = require("path");
6
- function normalizeOptions(options) {
7
- const devServeRemotes = !options.devRemotes
8
- ? []
9
- : Array.isArray(options.devRemotes)
10
- ? options.devRemotes
11
- : [options.devRemotes];
12
- return {
13
- ...options,
14
- devRemotes: devServeRemotes,
15
- verbose: options.verbose ?? false,
16
- ssl: options.ssl ?? false,
17
- sslCert: options.sslCert ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslCert) : undefined,
18
- sslKey: options.sslKey ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslKey) : undefined,
19
- };
20
- }
@@ -1,5 +0,0 @@
1
- import { type Schema } from '../schema';
2
- import { type ExecutorContext, type ProjectConfiguration } from '@nx/devkit';
3
- export declare function startRemotes(remotes: string[], workspaceProjects: Record<string, ProjectConfiguration>, options: Pick<Schema, 'devRemotes' | 'verbose'>, context: ExecutorContext): Promise<AsyncIterable<{
4
- success: boolean;
5
- }>[]>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startRemotes = startRemotes;
4
- const devkit_1 = require("@nx/devkit");
5
- async function startRemotes(remotes, workspaceProjects, options, context) {
6
- const target = 'serve-ssr';
7
- const remoteIters = [];
8
- for (const app of remotes) {
9
- if (!workspaceProjects[app].targets?.[target]) {
10
- throw new Error(`Could not find "${target}" target in "${app}" project.`);
11
- }
12
- else if (!workspaceProjects[app].targets?.[target].executor) {
13
- throw new Error(`Could not find executor for "${target}" target in "${app}" project.`);
14
- }
15
- const [_, executor] = workspaceProjects[app].targets[target].executor.split(':');
16
- const isUsingModuleFederationSsrDevServerExecutor = executor.includes('module-federation-dev-ssr');
17
- const configurationOverride = options.devRemotes.find((r) => typeof r !== 'string' && r.remoteName === app)?.configuration;
18
- remoteIters.push(await (0, devkit_1.runExecutor)({
19
- project: app,
20
- target,
21
- configuration: configurationOverride ?? context.configurationName,
22
- }, {
23
- ...{ verbose: options.verbose ?? false },
24
- ...(isUsingModuleFederationSsrDevServerExecutor
25
- ? { isInitialHost: false }
26
- : {}),
27
- }, context));
28
- }
29
- return remoteIters;
30
- }
@@ -1,4 +0,0 @@
1
- import { type ExecutorContext } from '@nx/devkit';
2
- import type { Schema } from './schema';
3
- export declare function moduleFederationSsrDevServerExecutor(schema: Schema, context: ExecutorContext): AsyncGenerator<import("@angular-devkit/build-angular").SSRDevServerBuilderOutput, any, any>;
4
- export default moduleFederationSsrDevServerExecutor;