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

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 (187) hide show
  1. package/dist/executors.d.ts +0 -2
  2. package/dist/executors.js +0 -2
  3. package/dist/generators.d.ts +0 -4
  4. package/dist/generators.js +0 -4
  5. package/dist/src/generators/add-linting/add-linting.js +0 -2
  6. package/dist/src/generators/add-linting/schema.d.ts +0 -1
  7. package/dist/src/generators/application/application.js +1 -2
  8. package/dist/src/generators/application/lib/add-e2e.js +0 -6
  9. package/dist/src/generators/application/lib/add-linting.js +0 -1
  10. package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
  11. package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
  12. package/dist/src/generators/application/lib/normalize-options.js +1 -8
  13. package/dist/src/generators/application/schema.d.ts +0 -1
  14. package/dist/src/generators/application/schema.json +1 -1
  15. package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +3 -4
  16. package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +1 -2
  17. package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -63
  18. package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.d.ts +2 -0
  19. package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.js +32 -0
  20. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
  21. package/dist/src/generators/init/init.js +1 -2
  22. package/dist/src/generators/init/schema.d.ts +0 -2
  23. package/dist/src/generators/library/schema.d.ts +0 -1
  24. package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
  25. package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
  26. package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
  27. package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
  28. package/dist/src/generators/utils/add-jest.d.ts +0 -1
  29. package/dist/src/generators/utils/add-jest.js +0 -2
  30. package/dist/src/generators/utils/add-vitest.d.ts +0 -1
  31. package/dist/src/generators/utils/add-vitest.js +0 -1
  32. package/dist/src/generators/utils/testing.d.ts +0 -4
  33. package/dist/src/generators/utils/testing.js +0 -12
  34. package/dist/src/utils/backward-compatible-versions.js +0 -8
  35. package/dist/src/utils/versions.d.ts +0 -4
  36. package/dist/src/utils/versions.js +1 -5
  37. package/executors.json +0 -10
  38. package/generators.json +0 -35
  39. package/package.json +11 -20
  40. package/dist/.npmignore +0 -2
  41. package/dist/fesm2022/nx-angular-mf.mjs +0 -193
  42. package/dist/fesm2022/nx-angular-mf.mjs.map +0 -1
  43. package/dist/mf/package.json +0 -4
  44. package/dist/src/builders/utilities/module-federation.d.ts +0 -11
  45. package/dist/src/builders/utilities/module-federation.js +0 -109
  46. package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
  47. package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
  48. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -2
  49. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -22
  50. package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +0 -5
  51. package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +0 -29
  52. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -4
  53. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -111
  54. package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -38
  55. package/dist/src/executors/module-federation-dev-server/schema.json +0 -171
  56. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -2
  57. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -20
  58. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +0 -5
  59. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.js +0 -30
  60. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -4
  61. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -110
  62. package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -17
  63. package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -124
  64. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +0 -4
  65. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.js +0 -36
  66. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +0 -5
  67. package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +0 -448
  68. package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +0 -2
  69. package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.js +0 -22
  70. package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +0 -2
  71. package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +0 -45
  72. package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +0 -2
  73. package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +0 -18
  74. package/dist/src/generators/convert-to-with-mf/lib/index.d.ts +0 -6
  75. package/dist/src/generators/convert-to-with-mf/lib/index.js +0 -9
  76. package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +0 -5
  77. package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +0 -57
  78. package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +0 -2
  79. package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +0 -13
  80. package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +0 -3
  81. package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +0 -50
  82. package/dist/src/generators/convert-to-with-mf/schema.d.ts +0 -4
  83. package/dist/src/generators/convert-to-with-mf/schema.json +0 -33
  84. package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
  85. package/dist/src/generators/federate-module/federate-module.js +0 -49
  86. package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +0 -2
  87. package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +0 -14
  88. package/dist/src/generators/federate-module/lib/add-path-to-exposes.d.ts +0 -8
  89. package/dist/src/generators/federate-module/lib/add-path-to-exposes.js +0 -77
  90. package/dist/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +0 -8
  91. package/dist/src/generators/federate-module/lib/add-path-to-ts-config.js +0 -11
  92. package/dist/src/generators/federate-module/lib/add-remote.d.ts +0 -7
  93. package/dist/src/generators/federate-module/lib/add-remote.js +0 -42
  94. package/dist/src/generators/federate-module/lib/check-remote-exists.d.ts +0 -2
  95. package/dist/src/generators/federate-module/lib/check-remote-exists.js +0 -21
  96. package/dist/src/generators/federate-module/lib/index.d.ts +0 -4
  97. package/dist/src/generators/federate-module/lib/index.js +0 -7
  98. package/dist/src/generators/federate-module/schema.d.ts +0 -13
  99. package/dist/src/generators/federate-module/schema.json +0 -83
  100. package/dist/src/generators/host/files/common/src/main.server.ts__tmpl__ +0 -78
  101. package/dist/src/generators/host/files/js/webpack.server.config.js__tmpl__ +0 -8
  102. package/dist/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +0 -9
  103. package/dist/src/generators/host/host.d.ts +0 -4
  104. package/dist/src/generators/host/host.js +0 -133
  105. package/dist/src/generators/host/lib/index.d.ts +0 -2
  106. package/dist/src/generators/host/lib/index.js +0 -5
  107. package/dist/src/generators/host/lib/update-ssr-setup.d.ts +0 -3
  108. package/dist/src/generators/host/lib/update-ssr-setup.js +0 -54
  109. package/dist/src/generators/host/lib/validate-options.d.ts +0 -3
  110. package/dist/src/generators/host/lib/validate-options.js +0 -12
  111. package/dist/src/generators/host/schema.d.ts +0 -36
  112. package/dist/src/generators/host/schema.json +0 -195
  113. package/dist/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +0 -9
  114. package/dist/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +0 -9
  115. package/dist/src/generators/remote/files/common/src/main.server.ts__tmpl__ +0 -84
  116. package/dist/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +0 -12
  117. package/dist/src/generators/remote/lib/find-next-available-port.d.ts +0 -2
  118. package/dist/src/generators/remote/lib/find-next-available-port.js +0 -16
  119. package/dist/src/generators/remote/lib/index.d.ts +0 -3
  120. package/dist/src/generators/remote/lib/index.js +0 -6
  121. package/dist/src/generators/remote/lib/update-ssr-setup.d.ts +0 -9
  122. package/dist/src/generators/remote/lib/update-ssr-setup.js +0 -82
  123. package/dist/src/generators/remote/lib/validate-options.d.ts +0 -3
  124. package/dist/src/generators/remote/lib/validate-options.js +0 -12
  125. package/dist/src/generators/remote/remote.d.ts +0 -4
  126. package/dist/src/generators/remote/remote.js +0 -114
  127. package/dist/src/generators/remote/schema.d.ts +0 -34
  128. package/dist/src/generators/remote/schema.json +0 -184
  129. package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__ +0 -18
  130. package/dist/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +0 -4
  131. package/dist/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +0 -10
  132. package/dist/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -42
  133. package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +0 -4
  134. package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +0 -11
  135. package/dist/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +0 -27
  136. package/dist/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +0 -12
  137. package/dist/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +0 -9
  138. package/dist/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +0 -21
  139. package/dist/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +0 -23
  140. package/dist/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +0 -9
  141. package/dist/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +0 -21
  142. package/dist/src/generators/setup-mf/lib/add-cypress-workaround.d.ts +0 -3
  143. package/dist/src/generators/setup-mf/lib/add-cypress-workaround.js +0 -52
  144. package/dist/src/generators/setup-mf/lib/add-remote-entry.d.ts +0 -3
  145. package/dist/src/generators/setup-mf/lib/add-remote-entry.js +0 -27
  146. package/dist/src/generators/setup-mf/lib/add-remote-to-host.d.ts +0 -9
  147. package/dist/src/generators/setup-mf/lib/add-remote-to-host.js +0 -127
  148. package/dist/src/generators/setup-mf/lib/change-build-target.d.ts +0 -3
  149. package/dist/src/generators/setup-mf/lib/change-build-target.js +0 -24
  150. package/dist/src/generators/setup-mf/lib/fix-bootstrap.d.ts +0 -3
  151. package/dist/src/generators/setup-mf/lib/fix-bootstrap.js +0 -40
  152. package/dist/src/generators/setup-mf/lib/generate-config.d.ts +0 -6
  153. package/dist/src/generators/setup-mf/lib/generate-config.js +0 -32
  154. package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.d.ts +0 -6
  155. package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.js +0 -20
  156. package/dist/src/generators/setup-mf/lib/index.d.ts +0 -15
  157. package/dist/src/generators/setup-mf/lib/index.js +0 -18
  158. package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.d.ts +0 -2
  159. package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.js +0 -15
  160. package/dist/src/generators/setup-mf/lib/normalize-options.d.ts +0 -3
  161. package/dist/src/generators/setup-mf/lib/normalize-options.js +0 -26
  162. package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +0 -3
  163. package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +0 -61
  164. package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.d.ts +0 -3
  165. package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.js +0 -20
  166. package/dist/src/generators/setup-mf/lib/setup-serve-target.d.ts +0 -3
  167. package/dist/src/generators/setup-mf/lib/setup-serve-target.js +0 -39
  168. package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +0 -3
  169. package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +0 -15
  170. package/dist/src/generators/setup-mf/lib/update-host-app-routes.d.ts +0 -3
  171. package/dist/src/generators/setup-mf/lib/update-host-app-routes.js +0 -39
  172. package/dist/src/generators/setup-mf/lib/update-tsconfig.d.ts +0 -3
  173. package/dist/src/generators/setup-mf/lib/update-tsconfig.js +0 -18
  174. package/dist/src/generators/setup-mf/schema.d.ts +0 -35
  175. package/dist/src/generators/setup-mf/schema.json +0 -99
  176. package/dist/src/generators/setup-mf/setup-mf.d.ts +0 -4
  177. package/dist/src/generators/setup-mf/setup-mf.js +0 -90
  178. package/dist/src/generators/utils/add-mf-env-to-inputs.d.ts +0 -2
  179. package/dist/src/generators/utils/add-mf-env-to-inputs.js +0 -36
  180. package/dist/src/generators/utils/assert-mf-utils.d.ts +0 -1
  181. package/dist/src/generators/utils/assert-mf-utils.js +0 -8
  182. package/dist/src/utils/get-mf-projects.d.ts +0 -4
  183. package/dist/src/utils/get-mf-projects.js +0 -31
  184. package/dist/src/utils/module-federation-deprecation.d.ts +0 -4
  185. package/dist/src/utils/module-federation-deprecation.js +0 -29
  186. package/dist/types/nx-angular-mf.d.ts +0 -72
  187. package/dist/types/nx-angular-mf.d.ts.map +0 -1
@@ -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;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moduleFederationSsrDevServerExecutor = moduleFederationSsrDevServerExecutor;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const internal_2 = require("@nx/web/internal");
7
- const fs_1 = require("fs");
8
- const path_1 = require("path");
9
- const module_federation_1 = require("../../builders/utilities/module-federation");
10
- const builder_package_1 = require("../utilities/builder-package");
11
- const normalize_options_1 = require("./lib/normalize-options");
12
- const start_dev_remotes_1 = require("./lib/start-dev-remotes");
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* moduleFederationSsrDevServerExecutor(schema, context) {
32
- (0, builder_package_1.assertPackageIsInstalled)('@nx/module-federation', '@nx/angular:module-federation-dev-ssr');
33
- const { startRemoteIterators } = await import('@nx/module-federation/internal');
34
- (0, module_federation_deprecation_1.warnAngularMfDevSsrExecutorDeprecation)();
35
- const options = (0, normalize_options_1.normalizeOptions)(schema);
36
- (0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:module-federation-dev-ssr');
37
- const { executeSSRDevServerBuilder } = await import('@angular-devkit/build-angular');
38
- const currIter = (0, internal_1.eachValueFrom)(executeSSRDevServerBuilder(options, await (0, ngcli_adapter_1.createBuilderContext)({
39
- builderName: '@nx/angular:webpack-server',
40
- description: 'Build a ssr application',
41
- optionSchema: require('../../builders/webpack-server/schema.json'),
42
- }, context)));
43
- if (options.isInitialHost === false) {
44
- return yield* currIter;
45
- }
46
- const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
47
- const project = workspaceProjects[context.projectName];
48
- let pathToManifestFile;
49
- if (options.pathToManifestFile) {
50
- const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
51
- if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
52
- throw new Error(`The provided Module Federation manifest file path does not exist. Please check the file exists at "${userPathToManifestFile}".`);
53
- }
54
- else if ((0, path_1.extname)(options.pathToManifestFile) !== '.json') {
55
- throw new Error(`The Module Federation manifest file must be a JSON. Please ensure the file at ${userPathToManifestFile} is a JSON.`);
56
- }
57
- pathToManifestFile = userPathToManifestFile;
58
- }
59
- else {
60
- pathToManifestFile = (0, module_federation_1.getDynamicMfManifestFile)(project, context.root);
61
- }
62
- (0, module_federation_1.validateDevRemotes)({ devRemotes: options.devRemotes }, workspaceProjects);
63
- const { remotes, staticRemotesIter, devRemoteIters } = await startRemoteIterators(options, context, start_dev_remotes_1.startRemotes, pathToManifestFile, 'angular', true);
64
- const removeBaseUrlEmission = (iter) => (0, internal_1.mapAsyncIterable)(iter, (v) => ({
65
- ...v,
66
- baseUrl: undefined,
67
- }));
68
- const combined = (0, internal_1.combineAsyncIterables)(removeBaseUrlEmission(staticRemotesIter), ...(devRemoteIters ? devRemoteIters.map(removeBaseUrlEmission) : []), (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
69
- if (!options.isInitialHost) {
70
- done();
71
- return;
72
- }
73
- if (remotes.remotePorts.length) {
74
- devkit_1.logger.info(`Nx All remotes started, server ready at http://localhost:${options.port}`);
75
- next({ success: true, baseUrl: `http://localhost:${options.port}` });
76
- done();
77
- return;
78
- }
79
- try {
80
- const portsToWaitFor = staticRemotesIter && options.staticRemotesPort
81
- ? [options.staticRemotesPort, ...remotes.remotePorts]
82
- : [...remotes.remotePorts];
83
- await Promise.all(portsToWaitFor.map((port) => (0, internal_2.waitForPortOpen)(port, {
84
- retries: 480,
85
- retryDelay: 2500,
86
- host: 'localhost',
87
- })));
88
- next({ success: true, baseUrl: `http://localhost:${options.port}` });
89
- }
90
- catch (error) {
91
- throw new Error(`Failed to start remotes. Check above for any errors.`, {
92
- cause: error,
93
- });
94
- }
95
- finally {
96
- done();
97
- }
98
- }));
99
- let refs = 2 + (devRemoteIters?.length ?? 0);
100
- for await (const result of combined) {
101
- if (result.success === false)
102
- throw new Error('Remotes failed to start');
103
- if (result.success)
104
- refs--;
105
- if (refs === 0)
106
- break;
107
- }
108
- return yield* currIter;
109
- }
110
- exports.default = moduleFederationSsrDevServerExecutor;
@@ -1,17 +0,0 @@
1
- import { type DevRemoteDefinition } from '../../builders/utilities/module-federation';
2
- import type { SSRDevServerBuilderOptions } from '@angular-devkit/build-angular';
3
-
4
- export interface Schema extends SSRDevServerBuilderOptions {
5
- devRemotes?: DevRemoteDefinition[];
6
- skipRemotes?: string[];
7
- pathToManifestFile?: string;
8
- parallel?: number;
9
- staticRemotesPort?: number;
10
- isInitialHost?: boolean;
11
- }
12
-
13
- export interface NormalizedSchema extends Schema {
14
- devRemotes: DevRemoteDefinition[];
15
- ssl: boolean;
16
- verbose: boolean;
17
- }