@nx/webpack 18.1.1 → 18.2.0-beta.0

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.1.1",
3
+ "version": "18.2.0-beta.0",
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": {
@@ -63,9 +63,9 @@
63
63
  "webpack-dev-server": "^4.9.3",
64
64
  "webpack-node-externals": "^3.0.0",
65
65
  "webpack-subresource-integrity": "^5.1.0",
66
- "@nx/devkit": "18.1.1",
67
- "@nx/js": "18.1.1",
68
- "@nrwl/webpack": "18.1.1"
66
+ "@nx/devkit": "18.2.0-beta.0",
67
+ "@nx/js": "18.2.0-beta.0",
68
+ "@nrwl/webpack": "18.2.0-beta.0"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public"
@@ -126,7 +126,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
126
126
  use: [
127
127
  ...(0, stylesheet_loaders_1.getCommonLoadersForCssModules)(options, includePaths),
128
128
  {
129
- loader: path.join(__dirname, 'webpack/deprecated-stylus-loader.js'),
129
+ loader: path.join(__dirname, '../../../utils/webpack/deprecated-stylus-loader.js'),
130
130
  options: {
131
131
  stylusOptions: {
132
132
  include: includePaths,
@@ -185,7 +185,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
185
185
  use: [
186
186
  ...(0, stylesheet_loaders_1.getCommonLoadersForGlobalCss)(options, includePaths),
187
187
  {
188
- loader: path.join(__dirname, 'webpack/deprecated-stylus-loader.js'),
188
+ loader: path.join(__dirname, '../../../utils/webpack/deprecated-stylus-loader.js'),
189
189
  options: {
190
190
  sourceMap: !!options.sourceMap,
191
191
  stylusOptions: {
@@ -245,7 +245,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
245
245
  use: [
246
246
  ...(0, stylesheet_loaders_1.getCommonLoadersForGlobalStyle)(options, includePaths),
247
247
  {
248
- loader: require.resolve('stylus-loader'),
248
+ loader: path.join(__dirname, '../../../utils/webpack/deprecated-stylus-loader.js'),
249
249
  options: {
250
250
  sourceMap: !!options.sourceMap,
251
251
  stylusOptions: {
@@ -335,7 +335,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
335
335
  type: 'asset',
336
336
  parser: {
337
337
  dataUrlCondition: {
338
- maxSize: 10000, // 10 kB
338
+ maxSize: 10_000, // 10 kB
339
339
  },
340
340
  },
341
341
  generator: {
@@ -348,7 +348,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
348
348
  type: 'asset',
349
349
  parser: {
350
350
  dataUrlCondition: {
351
- maxSize: 10000, // 10 kB
351
+ maxSize: 10_000, // 10 kB
352
352
  },
353
353
  },
354
354
  generator: {
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getClientEnvironment = void 0;
4
+ // Prevent sensitive keys from being bundled when source code uses entire `process.env` object rather than individual keys (e.g. `process.env.NX_FOO`).
5
+ // TODO(v19): Only env vars prefixed with NX_PUBLIC should be bundled. This is a breaking change so we won't do it in v18.
6
+ const excludedKeys = ['NX_CLOUD_ACCESS_TOKEN', 'NX_CLOUD_ENCRYPTION_KEY'];
4
7
  function getClientEnvironment(mode) {
5
8
  // Grab NODE_ENV and NX_* environment variables and prepare them to be
6
9
  // injected into the application via DefinePlugin in webpack configuration.
7
10
  const NX_APP = /^NX_/i;
8
11
  const raw = Object.keys(process.env)
9
- .filter((key) => NX_APP.test(key))
12
+ .filter((key) => !excludedKeys.includes(key) && NX_APP.test(key))
10
13
  .reduce((env, key) => {
11
14
  env[key] = process.env[key];
12
15
  return env;
@@ -7,8 +7,11 @@ function interpolateEnvironmentVariablesToIndex(contents, deployUrl) {
7
7
  }
8
8
  exports.interpolateEnvironmentVariablesToIndex = interpolateEnvironmentVariablesToIndex;
9
9
  const NX_PREFIX = /^NX_/i;
10
+ // Prevent sensitive keys from being bundled when source code uses entire `process.env` object rather than individual keys (e.g. `process.env.NX_FOO`).
11
+ // TODO(v19): Only env vars prefixed with NX_PUBLIC should be bundled. This is a breaking change so we won't do it in v18.
12
+ const excludedKeys = ['NX_CLOUD_ACCESS_TOKEN', 'NX_CLOUD_ENCRYPTION_KEY'];
10
13
  function isNxEnvironmentKey(x) {
11
- return NX_PREFIX.test(x);
14
+ return !excludedKeys.includes(x) && NX_PREFIX.test(x);
12
15
  }
13
16
  function getClientEnvironment(deployUrl) {
14
17
  return Object.keys(process.env)