@nx/webpack 18.0.0-beta.0 → 18.0.0-beta.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": "18.0.0-beta.0",
3
+ "version": "18.0.0-beta.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": {
@@ -29,7 +29,7 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@babel/core": "^7.22.9",
32
+ "@babel/core": "^7.23.2",
33
33
  "autoprefixer": "^10.4.9",
34
34
  "babel-loader": "^9.1.2",
35
35
  "browserslist": "^4.21.4",
@@ -62,9 +62,9 @@
62
62
  "webpack-dev-server": "^4.9.3",
63
63
  "webpack-node-externals": "^3.0.0",
64
64
  "webpack-subresource-integrity": "^5.1.0",
65
- "@nx/devkit": "18.0.0-beta.0",
66
- "@nx/js": "18.0.0-beta.0",
67
- "@nrwl/webpack": "18.0.0-beta.0"
65
+ "@nx/devkit": "18.0.0-beta.1",
66
+ "@nx/js": "18.0.0-beta.1",
67
+ "@nrwl/webpack": "18.0.0-beta.1"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
@@ -47,7 +47,7 @@ export interface WebpackExecutorOptions {
47
47
  extractLicenses?: boolean;
48
48
  fileReplacements?: FileReplacement[];
49
49
  generatePackageJson?: boolean;
50
- // TODO(v18): Remove this option
50
+ // TODO(v19): Remove this option
51
51
  /** @deprecated set webpackConfig and provide an explicit webpack.config.js file (See: https://nx.dev/recipes/webpack/webpack-config-setup) */
52
52
  isolatedConfig?: boolean;
53
53
  standardWebpackConfigFunction?: boolean;
@@ -235,7 +235,7 @@
235
235
  "type": "boolean",
236
236
  "description": "Do not apply Nx webpack plugins automatically. Plugins need to be applied in the project's webpack.config.js file (e.g. withNx, withReact, etc.).",
237
237
  "default": true,
238
- "x-deprecated": "Automatic configuration of Webpack is deprecated in favor of an explicit 'webpack.config.js' file. This option will be removed in Nx 18. See https://nx.dev/recipes/webpack/webpack-config-setup."
238
+ "x-deprecated": "Automatic configuration of Webpack is deprecated in favor of an explicit 'webpack.config.js' file. This option will be removed in Nx 19. See https://nx.dev/recipes/webpack/webpack-config-setup."
239
239
  },
240
240
  "standardWebpackConfigFunction": {
241
241
  "type": "boolean",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxWebpackProject",
4
4
  "cli": "nx",
5
5
  "title": "Add Webpack Configuration to a project",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxWebpackInit",
4
4
  "cli": "nx",
5
5
  "title": "Init Webpack Plugin",
@@ -6,7 +6,7 @@ const fs_1 = require("fs");
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  const nx_1 = require("@nx/devkit/nx");
8
8
  let { readModulePackageJson } = (0, nx_1.requireNx)();
9
- // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
9
+ // TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
10
10
  readModulePackageJson =
11
11
  readModulePackageJson ??
12
12
  require('nx/src/utils/package-json').readModulePackageJson;
@@ -4,18 +4,23 @@ exports.getRootTsConfigPath = exports.readTsConfig = exports.readTsPathMappings
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
6
  const devkit_1 = require("@nx/devkit");
7
- let tsConfig;
8
- let tsPathMappings;
7
+ let tsConfig = new Map();
8
+ let tsPathMappings = new Map();
9
9
  function readTsPathMappings(tsConfigPath = process.env.NX_TSCONFIG_PATH ?? getRootTsConfigPath()) {
10
- if (tsPathMappings) {
11
- return tsPathMappings;
10
+ if (tsPathMappings.has(tsConfigPath)) {
11
+ return tsPathMappings.get(tsConfigPath);
12
12
  }
13
- tsConfig ??= readTsConfiguration(tsConfigPath);
14
- tsPathMappings = {};
15
- Object.entries(tsConfig.options?.paths ?? {}).forEach(([alias, paths]) => {
16
- tsPathMappings[alias] = paths.map((path) => path.replace(/^\.\//, ''));
13
+ if (!tsConfig.has(tsConfigPath)) {
14
+ tsConfig.set(tsConfigPath, readTsConfiguration(tsConfigPath));
15
+ }
16
+ tsPathMappings.set(tsConfigPath, {});
17
+ Object.entries(tsConfig.get(tsConfigPath).options?.paths ?? {}).forEach(([alias, paths]) => {
18
+ tsPathMappings.set(tsConfigPath, {
19
+ ...tsPathMappings.get(tsConfigPath),
20
+ [alias]: paths.map((path) => path.replace(/^\.\//, '')),
21
+ });
17
22
  });
18
- return tsPathMappings;
23
+ return tsPathMappings.get(tsConfigPath);
19
24
  }
20
25
  exports.readTsPathMappings = readTsPathMappings;
21
26
  function readTsConfiguration(tsConfigPath) {
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  // @ts-ignore
5
5
  const stylusLoader = require("stylus-loader");
6
- // TOOD(v18): Remove this file and stylus support.
6
+ // TOOD(v19): Remove this file and stylus support.
7
7
  function default_1(source) {
8
- devkit_1.logger.warn(`Stylus is support is deprecated and will be removed in Nx 18. We recommend that you migrate to Sass by renaming \`.styl\` files to \`.scss\` and ensuring that the content is valid Sass.`);
8
+ devkit_1.logger.warn(`Stylus is support is deprecated and will be removed in Nx 19. We recommend that you migrate to Sass by renaming \`.styl\` files to \`.scss\` and ensuring that the content is valid Sass.`);
9
9
  return stylusLoader.call(this, source);
10
10
  }
11
11
  exports.default = default_1;
@@ -122,7 +122,7 @@ function PostcssCliResources(options) {
122
122
  const resourceCache = new Map();
123
123
  return Promise.all(urlDeclarations.map(async (decl) => {
124
124
  const value = decl.value;
125
- const urlRegex = /url\(\s*(?:"([^"]+)"|'([^']+)'|(.+?))\s*\)/g;
125
+ const urlRegex = /url(?:\(\s*['"]?)(.*?)(?:['"]?\s*\))/g;
126
126
  const segments = [];
127
127
  let match;
128
128
  let lastIndex = 0;
@@ -131,7 +131,7 @@ function PostcssCliResources(options) {
131
131
  const inputFile = decl.source && decl.source.input.file;
132
132
  const context = (inputFile && path.dirname(inputFile)) || loader.context;
133
133
  while ((match = urlRegex.exec(value))) {
134
- const originalUrl = match[1] || match[2] || match[3];
134
+ const originalUrl = match[1];
135
135
  let processedUrl;
136
136
  try {
137
137
  processedUrl = await process(originalUrl, context, resourceCache);