@nx/webpack 0.0.0-pr-27957-a99d5ea → 0.0.0-pr-28229-afe192c

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": "0.0.0-pr-27957-a99d5ea",
3
+ "version": "0.0.0-pr-28229-afe192c",
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,13 +69,12 @@
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": "0.0.0-pr-27957-a99d5ea",
73
- "@nx/js": "0.0.0-pr-27957-a99d5ea",
74
- "@nrwl/webpack": "0.0.0-pr-27957-a99d5ea"
72
+ "@nx/devkit": "0.0.0-pr-28229-afe192c",
73
+ "@nx/js": "0.0.0-pr-28229-afe192c"
75
74
  },
76
75
  "publishConfig": {
77
76
  "access": "public"
78
77
  },
79
78
  "type": "commonjs",
80
79
  "types": "./index.d.ts"
81
- }
80
+ }
@@ -46,7 +46,9 @@ class WebpackNxBuildCoordinationPlugin {
46
46
  this.currentlyRunning = 'nx-build';
47
47
  try {
48
48
  return await new Promise((res) => {
49
- this.buildCmdProcess = (0, child_process_1.exec)(this.buildCmd);
49
+ this.buildCmdProcess = (0, child_process_1.exec)(this.buildCmd, {
50
+ windowsHide: true,
51
+ });
50
52
  this.buildCmdProcess.stdout.pipe(process.stdout);
51
53
  this.buildCmdProcess.stderr.pipe(process.stderr);
52
54
  this.buildCmdProcess.on('exit', () => {
@@ -76,6 +76,26 @@ function recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion
76
76
  recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pkgRoot, mainEntryPointExports, subDirs, collectedPackages);
77
77
  }
78
78
  }
79
+ function collectPackagesFromExports(pkgName, pkgVersion, exports, collectedPackages) {
80
+ for (const [relativeEntryPoint, exportOptions] of Object.entries(exports)) {
81
+ const defaultExportOptions = typeof exportOptions?.['default'] === 'string'
82
+ ? exportOptions?.['default']
83
+ : exportOptions?.['default']?.['default'];
84
+ if (defaultExportOptions?.search(/\.(js|mjs|cjs)$/)) {
85
+ let entryPointName = (0, devkit_1.joinPathFragments)(pkgName, relativeEntryPoint);
86
+ if (entryPointName.endsWith('.json')) {
87
+ entryPointName = (0, path_1.dirname)(entryPointName);
88
+ }
89
+ if (entryPointName === '.') {
90
+ continue;
91
+ }
92
+ if (collectedPackages.find((p) => p.name === entryPointName)) {
93
+ continue;
94
+ }
95
+ collectedPackages.push({ name: entryPointName, version: pkgVersion });
96
+ }
97
+ }
98
+ }
79
99
  function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackages) {
80
100
  let pathToPackage;
81
101
  let packageJsonPath;
@@ -97,6 +117,9 @@ function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackag
97
117
  packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
98
118
  }
99
119
  const { exports } = packageJson;
120
+ if (exports) {
121
+ collectPackagesFromExports(pkgName, pkgVersion, exports, collectedPackages);
122
+ }
100
123
  const subDirs = getNonNodeModulesSubDirs(pathToPackage);
101
124
  recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pathToPackage, exports, subDirs, collectedPackages);
102
125
  }
@@ -222,8 +222,12 @@ function addStringDependencyToSharedConfig(sharedConfig, dependency, projectGrap
222
222
  sharedConfig[dependency] = config;
223
223
  }
224
224
  else {
225
- throw new Error(`The specified dependency "${dependency}" in the additionalShared configuration does not exist in the project graph. ` +
226
- `Please check your additionalShared configuration and make sure you are including valid workspace projects or npm packages.`);
225
+ const pkgJsonPath = require.resolve(`${dependency}/package.json`);
226
+ if (!pkgJsonPath) {
227
+ throw new Error(`Could not find package ${dependency} when applying it as a shared package. Are you sure it has been installed?`);
228
+ }
229
+ const pkgJson = (0, devkit_1.readJsonFile)(pkgJsonPath);
230
+ const config = getNpmPackageSharedConfig(dependency, pkgJson.version);
227
231
  }
228
232
  }
229
233
  function getEmptySharedLibrariesConfig() {