@nx/module-federation 23.2.0-beta.4 → 23.2.0-beta.6

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.
@@ -4,9 +4,9 @@ exports.buildStaticRemotes = buildStaticRemotes;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const path_1 = require("path");
7
- const cache_directory_1 = require("nx/src/utils/cache-directory");
8
7
  const fs_1 = require("fs");
9
8
  const is_serve_mode_1 = require("../../utils/is-serve-mode");
9
+ const internal_1 = require("@nx/devkit/internal");
10
10
  async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options, buildTarget = 'build') {
11
11
  if (!staticRemotesConfig.remotes.length) {
12
12
  return;
@@ -31,7 +31,7 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options,
31
31
  env: (0, is_serve_mode_1.childBuildEnv)(),
32
32
  });
33
33
  // File to debug build failures e.g. 2024-01-01T00_00_0_0Z-build.log'
34
- const remoteBuildLogFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `${new Date().toISOString().replace(/[:\.]/g, '_')}-build.log`);
34
+ const remoteBuildLogFile = (0, path_1.join)(internal_1.workspaceDataDirectory, `${new Date().toISOString().replace(/[:\.]/g, '_')}-build.log`);
35
35
  const stdoutStream = (0, fs_1.createWriteStream)(remoteBuildLogFile);
36
36
  staticProcess.stdout.on('data', (data) => {
37
37
  const ANSII_CODE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
@@ -4,9 +4,9 @@ exports.buildStaticRemotes = buildStaticRemotes;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const path_1 = require("path");
6
6
  const node_fs_1 = require("node:fs");
7
- const cache_directory_1 = require("nx/src/utils/cache-directory");
8
7
  const devkit_1 = require("@nx/devkit");
9
8
  const is_serve_mode_1 = require("../../utils/is-serve-mode");
9
+ const internal_1 = require("@nx/devkit/internal");
10
10
  async function buildStaticRemotes(staticRemotesConfig, options, nxBin) {
11
11
  const remotes = Object.keys(staticRemotesConfig);
12
12
  if (!remotes.length) {
@@ -29,7 +29,7 @@ async function buildStaticRemotes(staticRemotesConfig, options, nxBin) {
29
29
  env: (0, is_serve_mode_1.childBuildEnv)(),
30
30
  });
31
31
  // File to debug build failures e.g. 2024-01-01T00_00_0_0Z-build.log'
32
- const remoteBuildLogFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `${new Date().toISOString().replace(/[:\.]/g, '_')}-build.log`);
32
+ const remoteBuildLogFile = (0, path_1.join)(internal_1.workspaceDataDirectory, `${new Date().toISOString().replace(/[:\.]/g, '_')}-build.log`);
33
33
  const stdoutStream = (0, node_fs_1.createWriteStream)(remoteBuildLogFile);
34
34
  staticProcess.stdout?.on('data', (data) => {
35
35
  const ANSII_CODE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseRemotesConfig = parseRemotesConfig;
4
4
  const path_1 = require("path");
5
- const devkit_internals_1 = require("nx/src/devkit-internals");
6
5
  const devkit_1 = require("@nx/devkit");
6
+ const internal_1 = require("@nx/devkit/internal");
7
7
  function parseRemotesConfig(remotes, workspaceRoot, projectGraph, isServer) {
8
8
  if (!remotes?.length) {
9
9
  return { remotes: [], config: undefined };
@@ -11,7 +11,7 @@ function parseRemotesConfig(remotes, workspaceRoot, projectGraph, isServer) {
11
11
  const config = {};
12
12
  for (const app of remotes) {
13
13
  const projectRoot = projectGraph.nodes[app].data.root;
14
- let outputPath = (0, devkit_internals_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
14
+ let outputPath = (0, internal_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
15
15
  projectGraph.nodes[app].data.targets?.['build']?.outputs?.[0] ??
16
16
  `${workspaceRoot ? `${workspaceRoot}/` : ''}${projectGraph.nodes[app].data.root}/dist`, {
17
17
  projectName: projectGraph.nodes[app].data.name,
@@ -5,7 +5,7 @@ const path_1 = require("path");
5
5
  const fs_1 = require("fs");
6
6
  const node_child_process_1 = require("node:child_process");
7
7
  const devkit_1 = require("@nx/devkit");
8
- const devkit_internals_1 = require("nx/src/devkit-internals");
8
+ const internal_1 = require("@nx/devkit/internal");
9
9
  function startStaticRemotesFileServer(staticRemotesConfig, root, staticRemotesPort) {
10
10
  const remotes = Object.keys(staticRemotesConfig);
11
11
  if (!remotes || remotes.length === 0) {
@@ -22,7 +22,7 @@ function startStaticRemotesFileServer(staticRemotesConfig, root, staticRemotesPo
22
22
  });
23
23
  }
24
24
  }
25
- const { path: pathToHttpServerPkgJson, packageJson } = (0, devkit_internals_1.readModulePackageJson)('http-server', module.paths);
25
+ const { path: pathToHttpServerPkgJson, packageJson } = (0, internal_1.readModulePackageJson)('http-server', module.paths);
26
26
  const pathToHttpServerBin = packageJson.bin['http-server'];
27
27
  const pathToHttpServer = (0, path_1.resolve)(pathToHttpServerPkgJson.replace('package.json', ''), pathToHttpServerBin);
28
28
  const httpServerProcess = (0, node_child_process_1.fork)(pathToHttpServer, [
@@ -6,10 +6,10 @@ exports.getModuleFederationConfig = getModuleFederationConfig;
6
6
  const tslib_1 = require("tslib");
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const internal_1 = require("@nx/js/internal");
9
- const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
10
9
  const pc = tslib_1.__importStar(require("picocolors"));
11
10
  const path_1 = require("path");
12
11
  const fs_1 = require("fs");
12
+ const internal_2 = require("@nx/devkit/internal");
13
13
  function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
14
14
  const remotes = [];
15
15
  const dynamicRemotes = [];
@@ -72,7 +72,7 @@ function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile
72
72
  const collectedRemotes = new Set();
73
73
  const { remotes, dynamicRemotes } = extractRemoteProjectsFromConfig(config, pathToManifestFile);
74
74
  remotes.forEach((r) => collectRemoteProjects(r, collectedRemotes, context));
75
- const remotesToSkip = new Set((0, find_matching_projects_1.findMatchingProjects)(skipRemotes, context.projectGraph.nodes) ?? []);
75
+ const remotesToSkip = new Set((0, internal_2.findMatchingProjects)(skipRemotes, context.projectGraph.nodes) ?? []);
76
76
  if (remotesToSkip.size > 0) {
77
77
  devkit_1.logger.info(`Remotes not served automatically: ${[...remotesToSkip.values()].join(', ')}`);
78
78
  }
@@ -90,7 +90,7 @@ function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile
90
90
  // Normalize devRemotes to array and call findMatchingProjects once
91
91
  const devServeApps = new Set(!devRemotes
92
92
  ? []
93
- : (0, find_matching_projects_1.findMatchingProjects)(Array.isArray(devRemotes) ? devRemotes : [devRemotes], context.projectGraph.nodes));
93
+ : (0, internal_2.findMatchingProjects)(Array.isArray(devRemotes) ? devRemotes : [devRemotes], context.projectGraph.nodes));
94
94
  const staticRemotes = knownRemotes.filter((r) => !devServeApps.has(r));
95
95
  const devServeRemotes = [...knownRemotes, ...knownDynamicRemotes].filter((r) => devServeApps.has(r));
96
96
  const staticDynamicRemotes = knownDynamicRemotes.filter((r) => !devServeApps.has(r));
@@ -83,7 +83,7 @@ function getStaticRemotesFromEnv() {
83
83
  * This is extracted to avoid code duplication across bundler utils.
84
84
  */
85
85
  function createDefaultRemoteUrlResolver(isServer = false, remoteEntryExt = 'js') {
86
- const { readCachedProjectConfiguration, } = require('nx/src/project-graph/project-graph');
86
+ const { readCachedProjectConfiguration } = require('@nx/devkit/internal');
87
87
  const target = 'serve';
88
88
  const remoteEntry = isServer
89
89
  ? 'server/remoteEntry.js'
@@ -1,2 +1,2 @@
1
- import type { PackageJson } from 'nx/src/utils/package-json';
1
+ import { type PackageJson } from '@nx/devkit/internal';
2
2
  export declare function readRootPackageJson(): PackageJson;
@@ -4,7 +4,7 @@ exports.parseStaticRemotesConfig = parseStaticRemotesConfig;
4
4
  exports.parseStaticSsrRemotesConfig = parseStaticSsrRemotesConfig;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const path_1 = require("path");
7
- const utils_1 = require("nx/src/tasks-runner/utils");
7
+ const internal_1 = require("@nx/devkit/internal");
8
8
  function parseStaticRemotesConfig(staticRemotes, context) {
9
9
  if (!staticRemotes?.length) {
10
10
  return { remotes: [], config: undefined };
@@ -13,7 +13,7 @@ function parseStaticRemotesConfig(staticRemotes, context) {
13
13
  for (const app of staticRemotes) {
14
14
  const projectGraph = context.projectGraph;
15
15
  const projectRoot = projectGraph.nodes[app].data.root;
16
- let outputPath = (0, utils_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
16
+ let outputPath = (0, internal_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
17
17
  projectGraph.nodes[app].data.targets?.['build']?.outputs?.[0] ??
18
18
  `${context.root}/${projectGraph.nodes[app].data.root}/dist`, {
19
19
  projectName: projectGraph.nodes[app].data.name,
@@ -40,7 +40,7 @@ function parseStaticSsrRemotesConfig(staticRemotes, context) {
40
40
  for (const app of staticRemotes) {
41
41
  const projectGraph = context.projectGraph;
42
42
  const projectRoot = projectGraph.nodes[app].data.root;
43
- let outputPath = (0, utils_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
43
+ let outputPath = (0, internal_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
44
44
  projectGraph.nodes[app].data.targets?.['build']?.outputs?.[0] ??
45
45
  `${context.root}/${projectGraph.nodes[app].data.root}/dist`, {
46
46
  projectName: projectGraph.nodes[app].data.name,
@@ -7,7 +7,7 @@ exports.collectPackageSecondaryEntryPoints = collectPackageSecondaryEntryPoints;
7
7
  const path_1 = require("path");
8
8
  const fs_1 = require("fs");
9
9
  const devkit_1 = require("@nx/devkit");
10
- const package_json_1 = require("nx/src/utils/package-json");
10
+ const internal_1 = require("@nx/devkit/internal");
11
11
  function collectWorkspaceLibrarySecondaryEntryPoints(library, tsconfigPathAliases) {
12
12
  const libraryRoot = (0, path_1.join)(devkit_1.workspaceRoot, library.root);
13
13
  const needsSecondaryEntryPointsCollected = (0, fs_1.existsSync)((0, path_1.join)(libraryRoot, 'ng-package.json'));
@@ -101,7 +101,7 @@ function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackag
101
101
  let packageJsonPath;
102
102
  let packageJson;
103
103
  try {
104
- ({ path: packageJsonPath, packageJson } = (0, package_json_1.readModulePackageJson)(pkgName));
104
+ ({ path: packageJsonPath, packageJson } = (0, internal_1.readModulePackageJson)(pkgName));
105
105
  pathToPackage = (0, path_1.dirname)(packageJsonPath);
106
106
  }
107
107
  catch {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/module-federation",
3
3
  "description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
4
- "version": "23.2.0-beta.4",
4
+ "version": "23.2.0-beta.6",
5
5
  "type": "commonjs",
6
6
  "files": [
7
7
  "dist",
@@ -126,17 +126,17 @@
126
126
  "dependencies": {
127
127
  "@rspack/core": "^2.0.4",
128
128
  "express": "^4.21.2",
129
- "http-proxy-middleware": "^3.0.5",
129
+ "http-proxy-middleware": "^3.0.7",
130
130
  "picocolors": "^1.1.0",
131
131
  "tslib": "^2.3.0",
132
- "webpack": "5.105.2",
133
- "@nx/devkit": "23.2.0-beta.4",
134
- "@nx/js": "23.2.0-beta.4",
135
- "@nx/web": "23.2.0-beta.4"
132
+ "@nx/devkit": "23.2.0-beta.6",
133
+ "@nx/js": "23.2.0-beta.6",
134
+ "@nx/web": "23.2.0-beta.6"
136
135
  },
137
136
  "peerDependencies": {
138
137
  "@module-federation/enhanced": "^2.0.0",
139
- "@module-federation/node": "^2.0.0"
138
+ "@module-federation/node": "^2.0.0",
139
+ "webpack": "^5.0.0"
140
140
  },
141
141
  "peerDependenciesMeta": {
142
142
  "@module-federation/enhanced": {
@@ -144,10 +144,14 @@
144
144
  },
145
145
  "@module-federation/node": {
146
146
  "optional": true
147
+ },
148
+ "webpack": {
149
+ "optional": true
147
150
  }
148
151
  },
149
152
  "devDependencies": {
150
- "nx": "23.2.0-beta.4"
153
+ "webpack": "5.105.2",
154
+ "nx": "23.2.0-beta.6"
151
155
  },
152
156
  "nx-migrations": {
153
157
  "migrations": "./migrations.json",