@nx/webpack 19.6.1 → 19.6.3

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/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Nx: Smart Monorepos · Fast CI
24
24
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
25
+ Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
26
26
 
27
27
  This package is a [Webpack plugin for Nx](https://nx.dev/nx-api/webpack).
28
28
 
package/migrations.json CHANGED
@@ -11,6 +11,12 @@
11
11
  "version": "17.2.1-beta.0",
12
12
  "description": "Add webpack.config.js file when webpackConfig is not defined",
13
13
  "implementation": "./src/migrations/update-17-2-1/webpack-config-setup"
14
+ },
15
+ "update-19-6-3-proxy-config": {
16
+ "cli": "nx",
17
+ "version": "19.6.3-beta.0",
18
+ "description": "Migrate proxy config files to match new format from webpack-dev-server v5.",
19
+ "implementation": "./src/migrations/update-19-6-3/proxy-config"
14
20
  }
15
21
  },
16
22
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "19.6.1",
3
+ "version": "19.6.3",
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,9 +69,9 @@
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": "19.6.1",
73
- "@nx/js": "19.6.1",
74
- "@nrwl/webpack": "19.6.1"
72
+ "@nx/devkit": "19.6.3",
73
+ "@nx/js": "19.6.3",
74
+ "@nrwl/webpack": "19.6.3"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
@@ -163,6 +163,10 @@
163
163
  "type": "boolean",
164
164
  "description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
165
165
  },
166
+ "skipPackageManager": {
167
+ "type": "boolean",
168
+ "description": "Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
169
+ },
166
170
  "transformers": {
167
171
  "type": "array",
168
172
  "description": "List of TypeScript Compiler Transfomers Plugins.",
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ async function update(tree) {
7
+ const unmigratedConfigs = [];
8
+ const migrate = (options) => {
9
+ if (!options.proxyConfig)
10
+ return;
11
+ if (options.proxyConfig.endsWith('.json')) {
12
+ (0, devkit_1.updateJson)(tree, options.proxyConfig, (json) => {
13
+ if (Array.isArray(json))
14
+ return json;
15
+ if (typeof json === 'object') {
16
+ return Object.keys(json).map((context) => ({
17
+ context: [context],
18
+ ...json[context],
19
+ }));
20
+ }
21
+ return json;
22
+ });
23
+ }
24
+ else {
25
+ // For non-JSON files, it's not possible to automatically update the proxy config
26
+ // since its content can vary greatly.
27
+ unmigratedConfigs.push(options.proxyConfig);
28
+ }
29
+ };
30
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:dev-server', migrate);
31
+ // React dev-server calls Webpack dev-server.
32
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/react:module-federation-dev-server', migrate);
33
+ if (unmigratedConfigs.length > 0) {
34
+ devkit_1.logger.warn(`Some proxy config files need to be updated manually.
35
+ ${unmigratedConfigs.join('\n ')}
36
+
37
+ Webpack-dev-server v5 changed the proxy config schema to accept only an array.
38
+
39
+ For example, if you had the following:
40
+
41
+ "proxy": {
42
+ "/api": {
43
+ "target": "http://localhost:3000"
44
+ }
45
+ }
46
+
47
+ It needs to be updated to:
48
+
49
+ "proxy": [{
50
+ "context": ["/api"],
51
+ "target": "http://localhost:3000"
52
+ }]
53
+
54
+ More information: https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md
55
+ `);
56
+ }
57
+ }
@@ -3,6 +3,7 @@ import { type ProjectGraph } from '@nx/devkit';
3
3
  export declare class GeneratePackageJsonPlugin implements WebpackPluginInstance {
4
4
  private readonly options;
5
5
  constructor(options: {
6
+ skipPackageManager?: boolean;
6
7
  tsConfig: string;
7
8
  outputFileName: string;
8
9
  root: string;
@@ -32,6 +32,7 @@ class GeneratePackageJsonPlugin {
32
32
  root: this.options.root,
33
33
  isProduction: true,
34
34
  helperDependencies: helperDependencies.map((dep) => dep.target),
35
+ skipPackageManager: this.options.skipPackageManager,
35
36
  });
36
37
  packageJson.main = packageJson.main ?? this.options.outputFileName;
37
38
  compilation.emitAsset('package.json', new webpack_1.sources.RawSource((0, devkit_1.serializeJson)(packageJson)));
@@ -158,6 +158,10 @@ export interface NxAppWebpackPluginOptions {
158
158
  * External scripts that will be included before the main application entry.
159
159
  */
160
160
  scripts?: Array<ExtraEntryPointClass | string>;
161
+ /**
162
+ * Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option.
163
+ */
164
+ skipPackageManager?: boolean;
161
165
  /**
162
166
  * Skip type checking. Default is `false`.
163
167
  */