@nx/webpack 20.0.0-rc.0 → 20.0.1

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": "20.0.0-rc.0",
3
+ "version": "20.0.1",
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": {
@@ -69,8 +69,8 @@
69
69
  "webpack-dev-server": "^5.0.4",
70
70
  "webpack-node-externals": "^3.0.0",
71
71
  "webpack-subresource-integrity": "^5.1.0",
72
- "@nx/devkit": "20.0.0-rc.0",
73
- "@nx/js": "20.0.0-rc.0"
72
+ "@nx/devkit": "20.0.1",
73
+ "@nx/js": "20.0.1"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"
@@ -13,32 +13,32 @@ const path_1 = require("path");
13
13
  */
14
14
  function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl, isRemoteGlobal = false) {
15
15
  const mappedRemotes = {};
16
- for (const remote of remotes) {
17
- if (Array.isArray(remote)) {
18
- const remoteName = normalizeRemoteName(remote[0]);
19
- mappedRemotes[remoteName] = handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal);
16
+ for (const nxRemoteProjectName of remotes) {
17
+ if (Array.isArray(nxRemoteProjectName)) {
18
+ const mfRemoteName = normalizeRemoteName(nxRemoteProjectName[0]);
19
+ mappedRemotes[mfRemoteName] = handleArrayRemote(nxRemoteProjectName, remoteEntryExt, isRemoteGlobal);
20
20
  }
21
- else if (typeof remote === 'string') {
22
- const remoteName = normalizeRemoteName(remote);
23
- mappedRemotes[remoteName] = handleStringRemote(remoteName, determineRemoteUrl, isRemoteGlobal);
21
+ else if (typeof nxRemoteProjectName === 'string') {
22
+ const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
23
+ mappedRemotes[mfRemoteName] = handleStringRemote(nxRemoteProjectName, determineRemoteUrl, isRemoteGlobal);
24
24
  }
25
25
  }
26
26
  return mappedRemotes;
27
27
  }
28
28
  // Helper function to deal with remotes that are arrays
29
29
  function handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal) {
30
- let [remoteName, remoteLocation] = remote;
31
- remoteName = normalizeRemoteName(remoteName);
30
+ let [nxRemoteProjectName, remoteLocation] = remote;
31
+ const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
32
32
  const remoteLocationExt = (0, path_1.extname)(remoteLocation);
33
33
  // If remote location already has .js or .mjs extension
34
- if (['.js', '.mjs'].includes(remoteLocationExt)) {
34
+ if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
35
35
  return remoteLocation;
36
36
  }
37
37
  const baseRemote = remoteLocation.endsWith('/')
38
38
  ? remoteLocation.slice(0, -1)
39
39
  : remoteLocation;
40
40
  const globalPrefix = isRemoteGlobal
41
- ? `${remoteName.replace(/-/g, '_')}@`
41
+ ? `${normalizeRemoteName(nxRemoteProjectName)}@`
42
42
  : '';
43
43
  // if the remote is defined with anything other than http then we assume it's a promise based remote
44
44
  // In that case we should use what the user provides as the remote location
@@ -50,9 +50,11 @@ function handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal) {
50
50
  }
51
51
  }
52
52
  // Helper function to deal with remotes that are strings
53
- function handleStringRemote(remote, determineRemoteUrl, isRemoteGlobal) {
54
- const globalPrefix = isRemoteGlobal ? `${remote.replace(/-/g, '_')}@` : '';
55
- return `${globalPrefix}${determineRemoteUrl(remote)}`;
53
+ function handleStringRemote(nxRemoteProjectName, determineRemoteUrl, isRemoteGlobal) {
54
+ const globalPrefix = isRemoteGlobal
55
+ ? `${normalizeRemoteName(nxRemoteProjectName)}@`
56
+ : '';
57
+ return `${globalPrefix}${determineRemoteUrl(nxRemoteProjectName)}`;
56
58
  }
57
59
  /**
58
60
  * Map remote names to a format that can be understood and used by Module
@@ -66,18 +68,18 @@ function mapRemotesForSSR(remotes, remoteEntryExt, determineRemoteUrl) {
66
68
  const mappedRemotes = {};
67
69
  for (const remote of remotes) {
68
70
  if (Array.isArray(remote)) {
69
- let [remoteName, remoteLocation] = remote;
70
- remoteName = normalizeRemoteName(remoteName);
71
+ let [nxRemoteProjectName, remoteLocation] = remote;
72
+ const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
71
73
  const remoteLocationExt = (0, path_1.extname)(remoteLocation);
72
- mappedRemotes[remoteName] = `${remoteName}@${['.js', '.mjs'].includes(remoteLocationExt)
74
+ mappedRemotes[mfRemoteName] = `${mfRemoteName}@${['.js', '.mjs', '.json'].includes(remoteLocationExt)
73
75
  ? remoteLocation
74
76
  : `${remoteLocation.endsWith('/')
75
77
  ? remoteLocation.slice(0, -1)
76
78
  : remoteLocation}/remoteEntry.${remoteEntryExt}`}`;
77
79
  }
78
80
  else if (typeof remote === 'string') {
79
- const remoteName = normalizeRemoteName(remote);
80
- mappedRemotes[remoteName] = `${remoteName}@${determineRemoteUrl(remote)}`;
81
+ const mfRemoteName = normalizeRemoteName(remote);
82
+ mappedRemotes[mfRemoteName] = `${mfRemoteName}@${determineRemoteUrl(remote)}`;
81
83
  }
82
84
  }
83
85
  return mappedRemotes;