@nx/webpack 20.0.0-beta.7 → 20.0.0-beta.8

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-beta.7",
3
+ "version": "20.0.0-beta.8",
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-beta.7",
73
- "@nx/js": "20.0.0-beta.7"
72
+ "@nx/devkit": "20.0.0-beta.8",
73
+ "@nx/js": "20.0.0-beta.8"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"
@@ -11,7 +11,7 @@ import type { Compiler, Configuration } from 'webpack';
11
11
  return config;
12
12
  }
13
13
  );
14
-
14
+
15
15
  Since composePlugins is async, this function is used to wrap the legacy plugin function to be async.
16
16
  Using the nxUseLegacyPlugin function, the first argument is the legacy plugin function and the second argument is the options.
17
17
  The context options are created and passed to the legacy plugin function.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLegacyNxPlugin = useLegacyNxPlugin;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const normalize_options_1 = require("../nx-webpack-plugin/lib/normalize-options");
6
+ const configuration_1 = require("nx/src/config/configuration");
6
7
  /**
7
8
  * This function is used to wrap the legacy plugin function to be used with the `composePlugins` function.
8
9
  * Initially the webpack config would be passed to the legacy plugin function and the options would be passed as a second argument.
@@ -13,7 +14,7 @@ const normalize_options_1 = require("../nx-webpack-plugin/lib/normalize-options"
13
14
  return config;
14
15
  }
15
16
  );
16
-
17
+
17
18
  Since composePlugins is async, this function is used to wrap the legacy plugin function to be async.
18
19
  Using the nxUseLegacyPlugin function, the first argument is the legacy plugin function and the second argument is the options.
19
20
  The context options are created and passed to the legacy plugin function.
@@ -40,8 +41,10 @@ async function useLegacyNxPlugin(fn, executorOptions) {
40
41
  const context = {
41
42
  cwd: process.cwd(),
42
43
  isVerbose: process.env.NX_VERBOSE_LOGGING === 'true',
43
- root: project.data.root,
44
- projectGraph: (0, devkit_1.readCachedProjectGraph)(),
44
+ root: devkit_1.workspaceRoot,
45
+ projectGraph,
46
+ projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
47
+ nxJsonConfiguration: (0, configuration_1.readNxJson)(devkit_1.workspaceRoot),
45
48
  target: project.data.targets[targetName],
46
49
  targetName: targetName,
47
50
  projectName: projectName,
@@ -5,6 +5,7 @@ exports.isNxWebpackComposablePlugin = isNxWebpackComposablePlugin;
5
5
  exports.composePlugins = composePlugins;
6
6
  exports.composePluginsSync = composePluginsSync;
7
7
  const devkit_1 = require("@nx/devkit");
8
+ const configuration_1 = require("nx/src/config/configuration");
8
9
  exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
9
10
  function isNxWebpackComposablePlugin(a) {
10
11
  return a?.[exports.nxWebpackComposablePlugin] === true;
@@ -59,6 +60,8 @@ function ensureNxWebpackExecutionContext(ctx) {
59
60
  projectName,
60
61
  targetName,
61
62
  configurationName,
63
+ projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
64
+ nxJsonConfiguration: (0, configuration_1.readNxJson)(devkit_1.workspaceRoot),
62
65
  cwd: process.cwd(),
63
66
  root: devkit_1.workspaceRoot,
64
67
  isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readWebpackOptions = readWebpackOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const config_1 = require("../config");
6
+ const devkit_internals_1 = require("nx/src/devkit-internals");
6
7
  /**
7
8
  * Reads the webpack options from a give webpack configuration. The configuration can be:
8
9
  * 1. A standard config object
@@ -25,7 +26,14 @@ async function readWebpackOptions(webpackConfig) {
25
26
  outputPath: undefined,
26
27
  assets: undefined,
27
28
  },
28
- context: { root: devkit_1.workspaceRoot, cwd: undefined, isVerbose: false },
29
+ context: {
30
+ root: devkit_1.workspaceRoot,
31
+ cwd: undefined,
32
+ isVerbose: false,
33
+ projectsConfigurations: null,
34
+ projectGraph: null,
35
+ nxJsonConfiguration: (0, devkit_internals_1.readNxJsonFromDisk)(devkit_1.workspaceRoot),
36
+ },
29
37
  });
30
38
  }
31
39
  else if (typeof webpackConfig === 'function') {