@nx/webpack 16.9.0-beta.2 → 16.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "16.9.0-beta.2",
3
+ "version": "16.9.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
6
6
  "repository": {
@@ -30,9 +30,6 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/core": "^7.22.9",
33
- "@nrwl/webpack": "16.9.0-beta.2",
34
- "@nx/devkit": "16.9.0-beta.2",
35
- "@nx/js": "16.9.0-beta.2",
36
33
  "autoprefixer": "^10.4.9",
37
34
  "babel-loader": "^9.1.2",
38
35
  "browserslist": "^4.21.4",
@@ -64,11 +61,13 @@
64
61
  "webpack": "^5.80.0",
65
62
  "webpack-dev-server": "^4.9.3",
66
63
  "webpack-node-externals": "^3.0.0",
67
- "webpack-subresource-integrity": "^5.1.0"
64
+ "webpack-subresource-integrity": "^5.1.0",
65
+ "@nx/devkit": "16.9.0-beta.4",
66
+ "@nx/js": "16.9.0-beta.4",
67
+ "@nrwl/webpack": "*"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "type": "commonjs",
73
- "gitHead": "e11d538fa2c7266066d554d9405abab8e0a65040"
72
+ "type": "commonjs"
74
73
  }
@@ -47,7 +47,7 @@ async function* devServerExecutor(serveOptions, context) {
47
47
  }
48
48
  exports.devServerExecutor = devServerExecutor;
49
49
  function getBuildOptions(options, context) {
50
- const target = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
50
+ const target = (0, devkit_1.parseTargetString)(options.buildTarget, context);
51
51
  const overrides = {
52
52
  watch: false,
53
53
  };
@@ -7,7 +7,7 @@ const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
7
7
  const wait_until_server_is_listening_1 = require("./lib/wait-until-server-is-listening");
8
8
  async function* ssrDevServerExecutor(options, context) {
9
9
  const browserTarget = (0, devkit_1.parseTargetString)(options.browserTarget, context.projectGraph);
10
- const serverTarget = (0, devkit_1.parseTargetString)(options.serverTarget, context.projectGraph);
10
+ const serverTarget = (0, devkit_1.parseTargetString)(options.serverTarget, context);
11
11
  const browserOptions = (0, devkit_1.readTargetOptions)(browserTarget, context);
12
12
  const serverOptions = (0, devkit_1.readTargetOptions)(serverTarget, context);
13
13
  const runBrowser = await (0, devkit_1.runExecutor)(browserTarget, { ...browserOptions, ...options.browserTargetOptions }, context);
@@ -7,7 +7,7 @@ import { Remotes } from './models';
7
7
  * @param remoteEntryExt - The file extension of the remoteEntry file
8
8
  * @param determineRemoteUrl - The function used to lookup the URL of the served remote
9
9
  */
10
- export declare function mapRemotes(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string): Record<string, string>;
10
+ export declare function mapRemotes(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string, isRemoteGlobal?: boolean): Record<string, string>;
11
11
  /**
12
12
  * Map remote names to a format that can be understood and used by Module
13
13
  * Federation.
@@ -10,25 +10,40 @@ const path_1 = require("path");
10
10
  * @param remoteEntryExt - The file extension of the remoteEntry file
11
11
  * @param determineRemoteUrl - The function used to lookup the URL of the served remote
12
12
  */
13
- function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl) {
13
+ function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl, isRemoteGlobal = false) {
14
14
  const mappedRemotes = {};
15
15
  for (const remote of remotes) {
16
16
  if (Array.isArray(remote)) {
17
- const [remoteName, remoteLocation] = remote;
18
- const remoteLocationExt = (0, path_1.extname)(remoteLocation);
19
- mappedRemotes[remoteName] = ['.js', '.mjs'].includes(remoteLocationExt)
20
- ? remoteLocation
21
- : `${remoteLocation.endsWith('/')
22
- ? remoteLocation.slice(0, -1)
23
- : remoteLocation}/remoteEntry.${remoteEntryExt}`;
17
+ mappedRemotes[remote[0]] = handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal);
24
18
  }
25
19
  else if (typeof remote === 'string') {
26
- mappedRemotes[remote] = determineRemoteUrl(remote);
20
+ mappedRemotes[remote] = handleStringRemote(remote, determineRemoteUrl, isRemoteGlobal);
27
21
  }
28
22
  }
29
23
  return mappedRemotes;
30
24
  }
31
25
  exports.mapRemotes = mapRemotes;
26
+ // Helper function to deal with remotes that are arrays
27
+ function handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal) {
28
+ const [remoteName, remoteLocation] = remote;
29
+ const remoteLocationExt = (0, path_1.extname)(remoteLocation);
30
+ // If remote location already has .js or .mjs extension
31
+ if (['.js', '.mjs'].includes(remoteLocationExt)) {
32
+ return remoteLocation;
33
+ }
34
+ const baseRemote = remoteLocation.endsWith('/')
35
+ ? remoteLocation.slice(0, -1)
36
+ : remoteLocation;
37
+ const globalPrefix = isRemoteGlobal
38
+ ? `${remoteName.replace(/-/g, '_')}@`
39
+ : '';
40
+ return `${globalPrefix}${baseRemote}/remoteEntry.${remoteEntryExt}`;
41
+ }
42
+ // Helper function to deal with remotes that are strings
43
+ function handleStringRemote(remote, determineRemoteUrl, isRemoteGlobal) {
44
+ const globalPrefix = isRemoteGlobal ? `${remote.replace(/-/g, '_')}@` : '';
45
+ return `${globalPrefix}${determineRemoteUrl(remote)}`;
46
+ }
32
47
  /**
33
48
  * Map remote names to a format that can be understood and used by Module
34
49
  * Federation.
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
-
7
-
8
- **Note:** Version bump only for package @nx/webpack