@nx/webpack 23.0.0-beta.2 → 23.0.0-beta.20

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.
Files changed (50) hide show
  1. package/index.d.ts +0 -3
  2. package/index.d.ts.map +1 -1
  3. package/index.js +1 -4
  4. package/migrations.json +6 -0
  5. package/package.json +7 -7
  6. package/src/executors/dev-server/dev-server.impl.d.ts.map +1 -1
  7. package/src/executors/dev-server/dev-server.impl.js +7 -5
  8. package/src/executors/dev-server/schema.json +1 -0
  9. package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts.map +1 -1
  10. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +2 -2
  11. package/src/executors/webpack/lib/normalize-options.js +2 -2
  12. package/src/executors/webpack/schema.d.ts +1 -1
  13. package/src/executors/webpack/schema.json +1 -0
  14. package/src/executors/webpack/webpack.impl.d.ts.map +1 -1
  15. package/src/executors/webpack/webpack.impl.js +6 -4
  16. package/src/generators/configuration/configuration.d.ts.map +1 -1
  17. package/src/generators/configuration/configuration.js +6 -4
  18. package/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.d.ts.map +1 -1
  19. package/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +3 -3
  20. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
  21. package/src/generators/convert-to-inferred/convert-to-inferred.js +4 -5
  22. package/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +8 -8
  23. package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts.map +1 -1
  24. package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +4 -4
  25. package/src/generators/convert-to-inferred/utils/types.d.ts +1 -1
  26. package/src/generators/convert-to-inferred/utils/types.d.ts.map +1 -1
  27. package/src/generators/init/init.d.ts.map +1 -1
  28. package/src/generators/init/init.js +2 -2
  29. package/src/migrations/update-21-0-0/remove-isolated-config.d.ts.map +1 -1
  30. package/src/migrations/update-21-0-0/remove-isolated-config.js +2 -2
  31. package/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.d.ts +3 -0
  32. package/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.d.ts.map +1 -0
  33. package/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.js +128 -0
  34. package/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js +5 -5
  35. package/src/plugins/nx-webpack-plugin/lib/apply-base-config.js +2 -2
  36. package/src/plugins/nx-webpack-plugin/lib/normalize-options.js +2 -2
  37. package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +1 -1
  38. package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts.map +1 -1
  39. package/src/plugins/plugin.d.ts.map +1 -1
  40. package/src/plugins/plugin.js +59 -35
  41. package/src/utils/config.js +2 -2
  42. package/src/utils/deprecation.d.ts +6 -0
  43. package/src/utils/deprecation.d.ts.map +1 -0
  44. package/src/utils/deprecation.js +25 -0
  45. package/src/utils/e2e-web-server-info-utils.d.ts +1 -1
  46. package/src/utils/e2e-web-server-info-utils.d.ts.map +1 -1
  47. package/src/utils/e2e-web-server-info-utils.js +6 -5
  48. package/src/utils/ensure-dependencies.js +2 -2
  49. package/src/utils/webpack/resolve-user-defined-webpack-config.d.ts.map +1 -1
  50. package/src/utils/webpack/resolve-user-defined-webpack-config.js +4 -6
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { configurationGenerator } from './src/generators/configuration/configuration';
2
2
  import { NxAppWebpackPlugin } from './src/plugins/nx-webpack-plugin/nx-app-webpack-plugin';
3
- import { NxTsconfigPathsWebpackPlugin as _NxTsconfigPathsWebpackPlugin } from './src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin';
4
3
  import { useLegacyNxPlugin } from './src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin';
5
4
  export declare function convertConfigToWebpackPluginGenerator(...args: Parameters<typeof import('./src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin').convertConfigToWebpackPluginGenerator>): any;
6
5
  export { configurationGenerator, useLegacyNxPlugin };
@@ -8,8 +7,6 @@ export { configurationGenerator, useLegacyNxPlugin };
8
7
  export declare const webpackProjectGenerator: typeof configurationGenerator;
9
8
  /** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead, which can improve graph creation by 150-200ms per file. */
10
9
  export declare const NxWebpackPlugin: typeof NxAppWebpackPlugin;
11
- /** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
12
- export declare const NxTsconfigPathsWebpackPlugin: typeof _NxTsconfigPathsWebpackPlugin;
13
10
  export * from './src/utils/create-copy-plugin';
14
11
  export * from './src/utils/config';
15
12
  export { webpackInitGenerator } from './src/generators/init/init';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/webpack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,4BAA4B,IAAI,6BAA6B,EAAE,MAAM,6EAA6E,CAAC;AAC5J,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAM5F,wBAAgB,qCAAqC,CACnD,GAAG,IAAI,EAAE,UAAU,CACjB,cAAc,oFAAoF,EAAE,qCAAqC,CAC1I,OAKF;AAED,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC;AAGrD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,+BAAyB,CAAC;AAE9D,wIAAwI;AACxI,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAClD,qGAAqG;AACrG,eAAO,MAAM,4BAA4B,sCAAgC,CAAC;AAE1E,cAAc,gCAA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C;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uCAAuC,CAAC"}
package/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.webpackInitGenerator = exports.NxTsconfigPathsWebpackPlugin = exports.NxWebpackPlugin = exports.webpackProjectGenerator = exports.useLegacyNxPlugin = exports.configurationGenerator = void 0;
3
+ exports.webpackInitGenerator = exports.NxWebpackPlugin = exports.webpackProjectGenerator = exports.useLegacyNxPlugin = exports.configurationGenerator = void 0;
4
4
  exports.convertConfigToWebpackPluginGenerator = convertConfigToWebpackPluginGenerator;
5
5
  const tslib_1 = require("tslib");
6
6
  const configuration_1 = require("./src/generators/configuration/configuration");
7
7
  Object.defineProperty(exports, "configurationGenerator", { enumerable: true, get: function () { return configuration_1.configurationGenerator; } });
8
8
  const nx_app_webpack_plugin_1 = require("./src/plugins/nx-webpack-plugin/nx-app-webpack-plugin");
9
- const nx_tsconfig_paths_webpack_plugin_1 = require("./src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
10
9
  const use_legacy_nx_plugin_1 = require("./src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin");
11
10
  Object.defineProperty(exports, "useLegacyNxPlugin", { enumerable: true, get: function () { return use_legacy_nx_plugin_1.useLegacyNxPlugin; } });
12
11
  // Lazy-loaded to avoid requiring typescript before it's installed.
@@ -21,8 +20,6 @@ function convertConfigToWebpackPluginGenerator(...args) {
21
20
  exports.webpackProjectGenerator = configuration_1.configurationGenerator;
22
21
  /** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead, which can improve graph creation by 150-200ms per file. */
23
22
  exports.NxWebpackPlugin = nx_app_webpack_plugin_1.NxAppWebpackPlugin;
24
- /** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
25
- exports.NxTsconfigPathsWebpackPlugin = nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin;
26
23
  tslib_1.__exportStar(require("./src/utils/create-copy-plugin"), exports);
27
24
  tslib_1.__exportStar(require("./src/utils/config"), exports);
28
25
  var init_1 = require("./src/generators/init/init");
package/migrations.json CHANGED
@@ -11,6 +11,12 @@
11
11
  "version": "22.0.0-beta.0",
12
12
  "description": "Remove deprecated deleteOutputPath and sassImplementation options from @nx/webpack:webpack",
13
13
  "implementation": "./src/migrations/update-22-0-0/remove-deprecated-options"
14
+ },
15
+ "update-23-0-0-remove-nx-tsconfig-paths-webpack-plugin-import": {
16
+ "cli": "nx",
17
+ "version": "23.0.0-beta.10",
18
+ "description": "Rewrites imports of NxTsconfigPathsWebpackPlugin from '@nx/webpack' to the sub-path '@nx/webpack/tsconfig-paths-plugin'.",
19
+ "factory": "./src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import"
14
20
  }
15
21
  },
16
22
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "23.0.0-beta.2",
3
+ "version": "23.0.0-beta.20",
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": {
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/core": "^7.23.2",
35
- "@phenomnomnominal/tsquery": "~6.1.4",
36
- "ajv": "^8.12.0",
35
+ "@phenomnomnominal/tsquery": "~6.2.0",
36
+ "ajv": "^8.0.0",
37
37
  "autoprefixer": "^10.4.9",
38
38
  "babel-loader": "^9.1.2",
39
39
  "browserslist": "^4.26.0",
@@ -50,7 +50,7 @@
50
50
  "parse5": "4.0.0",
51
51
  "postcss": "^8.4.38",
52
52
  "postcss-import": "~14.1.0",
53
- "postcss-loader": "^8.2.1",
53
+ "postcss-loader": "^8.1.1",
54
54
  "rxjs": "^7.8.0",
55
55
  "sass": "^1.97.2",
56
56
  "sass-embedded": "^1.97.2",
@@ -65,11 +65,11 @@
65
65
  "webpack-dev-server": "^5.2.1",
66
66
  "webpack-node-externals": "^3.0.0",
67
67
  "webpack-subresource-integrity": "^5.1.0",
68
- "@nx/devkit": "23.0.0-beta.2",
69
- "@nx/js": "23.0.0-beta.2"
68
+ "@nx/devkit": "23.0.0-beta.20",
69
+ "@nx/js": "23.0.0-beta.20"
70
70
  },
71
71
  "devDependencies": {
72
- "nx": "23.0.0-beta.2"
72
+ "nx": "23.0.0-beta.20"
73
73
  },
74
74
  "publishConfig": {
75
75
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/dev-server/dev-server.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAGhB,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAuB,iBAAiB,CACtC,YAAY,EAAE,mBAAmB,EACjC,OAAO,EAAE,eAAe;;;aAoGzB;AA0BD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/dev-server/dev-server.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAGhB,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAuB,iBAAiB,CACtC,YAAY,EAAE,mBAAmB,EACjC,OAAO,EAAE,eAAe;;;aAsGzB;AA0BD,eAAe,iBAAiB,CAAC"}
@@ -2,19 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.devServerExecutor = devServerExecutor;
4
4
  const tslib_1 = require("tslib");
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const webpack_1 = tslib_1.__importDefault(require("webpack"));
6
7
  const devkit_1 = require("@nx/devkit");
7
- const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
8
8
  const operators_1 = require("rxjs/operators");
9
9
  const webpack_dev_server_1 = tslib_1.__importDefault(require("webpack-dev-server"));
10
10
  const get_dev_server_config_1 = require("./lib/get-dev-server-config");
11
- const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
11
+ const internal_2 = require("@nx/js/internal");
12
12
  const run_webpack_1 = require("../../utils/run-webpack");
13
13
  const resolve_user_defined_webpack_config_1 = require("../../utils/webpack/resolve-user-defined-webpack-config");
14
+ const deprecation_1 = require("../../utils/deprecation");
14
15
  const normalize_options_1 = require("../webpack/lib/normalize-options");
15
16
  const config_1 = require("../../utils/config");
16
17
  const js_1 = require("@nx/js");
17
18
  async function* devServerExecutor(serveOptions, context) {
19
+ (0, deprecation_1.warnWebpackDevServerExecutorDeprecation)();
18
20
  // Default to dev mode so builds are faster and HMR mode works better.
19
21
  process.env.NODE_ENV ??= 'development';
20
22
  const { root: projectRoot, sourceRoot } = context.projectsConfigurations.projects[context.projectName];
@@ -26,9 +28,9 @@ async function* devServerExecutor(serveOptions, context) {
26
28
  if (!buildOptions.tsConfig) {
27
29
  throw new Error(`Cannot find "tsConfig" to remap paths for. Set this option in project.json.`);
28
30
  }
29
- const { target, dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, 'build', // should be generalized
31
+ const { target, dependencies } = (0, internal_2.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, 'build', // should be generalized
30
32
  context.configurationName);
31
- buildOptions.tsConfig = (0, buildable_libs_utils_1.createTmpTsConfig)(buildOptions.tsConfig, context.root, target.data.root, dependencies);
33
+ buildOptions.tsConfig = (0, internal_2.createTmpTsConfig)(buildOptions.tsConfig, context.root, target.data.root, dependencies);
32
34
  process.env.NX_TSCONFIG_PATH = buildOptions.tsConfig;
33
35
  }
34
36
  let config;
@@ -61,7 +63,7 @@ async function* devServerExecutor(serveOptions, context) {
61
63
  config.devServer ??= devServer;
62
64
  }
63
65
  }
64
- return yield* (0, rxjs_for_await_1.eachValueFrom)((0, run_webpack_1.runWebpackDevServer)(config, webpack_1.default, webpack_dev_server_1.default).pipe((0, operators_1.tap)(({ stats }) => {
66
+ return yield* (0, internal_1.eachValueFrom)((0, run_webpack_1.runWebpackDevServer)(config, webpack_1.default, webpack_dev_server_1.default).pipe((0, operators_1.tap)(({ stats }) => {
65
67
  console.info(stats.toString(config.stats));
66
68
  }), (0, operators_1.map)(({ baseUrl, stats }) => {
67
69
  return {
@@ -6,6 +6,7 @@
6
6
  "description": "Serve an application using webpack.",
7
7
  "cli": "nx",
8
8
  "type": "object",
9
+ "x-deprecated": "The `@nx/webpack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
9
10
  "properties": {
10
11
  "buildTarget": {
11
12
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"ssr-dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGjE,wBAAuB,oBAAoB,CACzC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,eAAe;;aA0Bb,OAAO;aAEP,aAAa;kBA6BzB;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"ssr-dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGjE,wBAAuB,oBAAoB,CACzC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,eAAe;;aA0Bb,OAAO;aAEP,aAAa;kBA6BzB;AAED,eAAe,oBAAoB,CAAC"}
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ssrDevServerExecutor = ssrDevServerExecutor;
4
4
  const tslib_1 = require("tslib");
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  const pc = tslib_1.__importStar(require("picocolors"));
7
- const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
8
8
  const wait_until_server_is_listening_1 = require("./lib/wait-until-server-is-listening");
9
9
  async function* ssrDevServerExecutor(options, context) {
10
10
  const browserTarget = (0, devkit_1.parseTargetString)(options.browserTarget, context.projectGraph);
@@ -15,7 +15,7 @@ async function* ssrDevServerExecutor(options, context) {
15
15
  const runServer = await (0, devkit_1.runExecutor)(serverTarget, { ...serverOptions, ...options.serverTargetOptions }, context);
16
16
  let browserBuilt = false;
17
17
  let nodeStarted = false;
18
- const combined = (0, async_iterable_1.combineAsyncIterables)(runBrowser, runServer);
18
+ const combined = (0, internal_1.combineAsyncIterables)(runBrowser, runServer);
19
19
  for await (const output of combined) {
20
20
  if (!output.success)
21
21
  throw new Error('Could not build application');
@@ -4,11 +4,11 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.normalizePluginPath = normalizePluginPath;
5
5
  const path_1 = require("path");
6
6
  const normalize_options_1 = require("../../../plugins/nx-webpack-plugin/lib/normalize-options");
7
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const internal_1 = require("@nx/js/internal");
8
8
  function normalizeOptions(options, root, projectRoot, sourceRoot) {
9
9
  const normalizedOptions = {
10
10
  ...options,
11
- useTsconfigPaths: !(0, ts_solution_setup_1.isUsingTsSolutionSetup)(),
11
+ useTsconfigPaths: !(0, internal_1.isUsingTsSolutionSetup)(),
12
12
  root,
13
13
  projectRoot,
14
14
  sourceRoot,
@@ -1,4 +1,4 @@
1
- import { AssetGlob } from '@nx/js/src/utils/assets/assets';
1
+ import { AssetGlob } from '@nx/js/internal';
2
2
 
3
3
  export interface AssetGlobPattern {
4
4
  glob: string;
@@ -5,6 +5,7 @@
5
5
  "description": "Build a project using webpack.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "x-deprecated": "The `@nx/webpack:webpack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
8
9
  "properties": {
9
10
  "crossOrigin": {
10
11
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/webpack/webpack.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAkBpB,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,UAAU,CAAC;AA6ClB,MAAM,MAAM,oBAAoB,GAC5B;IACE,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,GACD;IACE,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,CAAC;AAEN,wBAAuB,eAAe,CACpC,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,CAAC,CA6FvE;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"webpack.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/executors/webpack/webpack.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAkBpB,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,UAAU,CAAC;AA6ClB,MAAM,MAAM,oBAAoB,GAC5B;IACE,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,GACD;IACE,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,CAAC;AAEN,wBAAuB,eAAe,CACpC,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,CAAC,CA+FvE;AAED,eAAe,eAAe,CAAC"}
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackExecutor = webpackExecutor;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
6
6
  const js_1 = require("@nx/js");
7
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const internal_2 = require("@nx/js/internal");
8
8
  const path_1 = require("path");
9
9
  const rxjs_1 = require("rxjs");
10
10
  const operators_1 = require("rxjs/operators");
11
11
  const config_1 = require("../../utils/config");
12
12
  const resolve_user_defined_webpack_config_1 = require("../../utils/webpack/resolve-user-defined-webpack-config");
13
+ const deprecation_1 = require("../../utils/deprecation");
13
14
  const normalize_options_1 = require("./lib/normalize-options");
14
15
  const run_webpack_1 = require("./lib/run-webpack");
15
16
  async function getWebpackConfigs(options, context) {
@@ -46,10 +47,11 @@ async function getWebpackConfigs(options, context) {
46
47
  }
47
48
  }
48
49
  async function* webpackExecutor(_options, context) {
50
+ (0, deprecation_1.warnWebpackExecutorDeprecation)();
49
51
  // Default to production build.
50
52
  process.env['NODE_ENV'] ||= 'production';
51
53
  const metadata = context.projectsConfigurations.projects[context.projectName];
52
- const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(metadata);
54
+ const sourceRoot = (0, internal_2.getProjectSourceRoot)(metadata);
53
55
  const options = (0, normalize_options_1.normalizeOptions)(_options, context.root, metadata.root, sourceRoot);
54
56
  const isScriptOptimizeOn = typeof options.optimization === 'boolean'
55
57
  ? options.optimization
@@ -83,7 +85,7 @@ async function* webpackExecutor(_options, context) {
83
85
  For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).`);
84
86
  }
85
87
  const configs = await getWebpackConfigs(options, context);
86
- return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.of)(configs).pipe((0, operators_1.mergeMap)((config) => (Array.isArray(config) ? (0, rxjs_1.from)(config) : (0, rxjs_1.of)(config))),
88
+ return yield* (0, internal_1.eachValueFrom)((0, rxjs_1.of)(configs).pipe((0, operators_1.mergeMap)((config) => (Array.isArray(config) ? (0, rxjs_1.from)(config) : (0, rxjs_1.of)(config))),
87
89
  // Run build sequentially and bail when first one fails.
88
90
  (0, operators_1.mergeScan)((acc, config) => {
89
91
  if (!acc.hasErrors()) {
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAOxD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAGtC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAoCtC;AA6LD,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAOxD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAGtC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAqCtC;AA6LD,eAAe,sBAAsB,CAAC"}
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configurationGenerator = configurationGenerator;
4
4
  exports.configurationGeneratorInternal = configurationGeneratorInternal;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  const init_1 = require("../init/init");
7
8
  const has_plugin_1 = require("../../utils/has-plugin");
8
- const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
9
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
9
+ const deprecation_1 = require("../../utils/deprecation");
10
+ const internal_2 = require("@nx/js/internal");
10
11
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
11
12
  function configurationGenerator(tree, options) {
12
13
  return configurationGeneratorInternal(tree, { addPlugin: false, ...options });
@@ -28,6 +29,7 @@ async function configurationGeneratorInternal(tree, options) {
28
29
  tasks.push(depsTask);
29
30
  checkForTargetConflicts(tree, options);
30
31
  if (!(0, has_plugin_1.hasPlugin)(tree)) {
32
+ (0, deprecation_1.warnWebpackExecutorGenerating)();
31
33
  addBuildTarget(tree, options);
32
34
  if (options.devServer) {
33
35
  addServeTarget(tree, options);
@@ -128,8 +130,8 @@ module.exports = composePlugins(withNx(), (config) => {
128
130
  }
129
131
  }
130
132
  function addBuildTarget(tree, options) {
131
- (0, target_defaults_utils_1.addBuildTargetDefaults)(tree, '@nx/webpack:webpack', 'build', [
132
- ts_solution_setup_1.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
133
+ (0, internal_1.addBuildTargetDefaults)(tree, '@nx/webpack:webpack', 'build', [
134
+ internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
133
135
  ]);
134
136
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
135
137
  const buildOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"convert-config-to-webpack-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAIL,MAAM,YAAY,CAAC;AAQpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAWD,wBAAsB,qCAAqC,CACzD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,iBAwGhB;AAED,eAAe,qCAAqC,CAAC"}
1
+ {"version":3,"file":"convert-config-to-webpack-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,IAAI,EAIL,MAAM,YAAY,CAAC;AAOpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAWD,wBAAsB,qCAAqC,CACzD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,iBAwGhB;AAED,eAAe,qCAAqC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertConfigToWebpackPluginGenerator = convertConfigToWebpackPluginGenerator;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
6
  const extract_webpack_options_1 = require("./lib/extract-webpack-options");
7
7
  const normalize_path_options_1 = require("./lib/normalize-path-options");
8
8
  const path_1 = require("path");
@@ -18,7 +18,7 @@ const preprocessText = (text) => {
18
18
  async function convertConfigToWebpackPluginGenerator(tree, options) {
19
19
  let migrated = 0;
20
20
  const projects = (0, devkit_1.getProjects)(tree);
21
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (currentTargetOptions, projectName, targetName, configurationName) => {
21
+ (0, internal_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (currentTargetOptions, projectName, targetName, configurationName) => {
22
22
  if (options.project && projectName !== options.project) {
23
23
  return;
24
24
  }
@@ -73,7 +73,7 @@ async function convertConfigToWebpackPluginGenerator(tree, options) {
73
73
  // To enhance configurations after Nx plugins have applied, you can add a new plugin with the \`apply\` method.
74
74
  // e.g. \`{ apply: (compiler) => { /* modify compiler.options */ }\`
75
75
  // eslint-disable-next-line react-hooks/rules-of-hooks
76
- await useLegacyNxPlugin(require('./webpack.config.old'), options),
76
+ await useLegacyNxPlugin(require('./webpack.config.old${ext}'), options),
77
77
  ],
78
78
  });
79
79
  `);
@@ -1 +1 @@
1
- {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE/D,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAyElE;AA6CD,wBAAgB,sBAAsB,IAAI,OAAO,YAAY,GAAG;IAC9D,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC;CAC5D,CAkCA"}
1
+ {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE/D,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAyElE;AA6CD,wBAAgB,sBAAsB,IAAI,OAAO,YAAY,GAAG;IAC9D,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC;CAC5D,CAkCA"}
@@ -2,9 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToInferred = convertToInferred;
4
4
  exports.createCollectingLogger = createCollectingLogger;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
7
- const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
8
7
  const tsquery_1 = require("@phenomnomnominal/tsquery");
9
8
  const plugin_1 = require("../../plugins/plugin");
10
9
  const versions_1 = require("../../utils/versions");
@@ -13,12 +12,12 @@ const devkit_exports_1 = require("nx/src/devkit-exports");
13
12
  async function convertToInferred(tree, options) {
14
13
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
15
14
  const migrationContext = {
16
- logger: new aggregate_log_util_1.AggregatedLog(),
15
+ logger: new internal_1.AggregatedLog(),
17
16
  projectGraph,
18
17
  workspaceRoot: tree.root,
19
18
  };
20
19
  const logger = createCollectingLogger();
21
- const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/webpack/plugin', plugin_1.createNodesV2, {
20
+ const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/webpack/plugin', plugin_1.createNodesV2, {
22
21
  buildTargetName: 'build',
23
22
  previewTargetName: 'preview',
24
23
  serveStaticTargetName: 'serve-static',
@@ -47,7 +46,7 @@ async function convertToInferred(tree, options) {
47
46
  }
48
47
  else {
49
48
  logger.flushLogs();
50
- throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
49
+ throw new internal_1.NoTargetsToMigrateError();
51
50
  }
52
51
  }
53
52
  else {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildPostTargetTransformerFactory = buildPostTargetTransformerFactory;
4
4
  const tslib_1 = require("tslib");
5
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const tsquery_1 = require("@phenomnomnominal/tsquery");
7
7
  const ts = tslib_1.__importStar(require("typescript"));
8
8
  const ast_1 = require("./ast");
@@ -16,7 +16,7 @@ function buildPostTargetTransformerFactory(migrationContext) {
16
16
  const { pluginOptions, webpackConfigPath } = processOptions(target, context);
17
17
  updateWebpackConfig(tree, webpackConfigPath, pluginOptions);
18
18
  if (target.outputs) {
19
- (0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTarget, {
19
+ (0, internal_1.processTargetOutputs)(target, [], inferredTarget, {
20
20
  projectName: projectDetails.projectName,
21
21
  projectRoot: projectDetails.root,
22
22
  });
@@ -51,29 +51,29 @@ function extractPluginOptions(options, context, configName) {
51
51
  const pluginOptions = {};
52
52
  for (const [key, value] of Object.entries(options)) {
53
53
  if (pathOptions.has(key)) {
54
- pluginOptions[key] = (0, plugin_migration_utils_1.toProjectRelativePath)(value, context.projectRoot);
54
+ pluginOptions[key] = (0, internal_1.toProjectRelativePath)(value, context.projectRoot);
55
55
  delete options[key];
56
56
  }
57
57
  else if (assetsOptions.has(key)) {
58
58
  pluginOptions[key] = value.map((asset) => {
59
59
  if (typeof asset === 'string') {
60
- return (0, plugin_migration_utils_1.toProjectRelativePath)(asset, context.projectRoot);
60
+ return (0, internal_1.toProjectRelativePath)(asset, context.projectRoot);
61
61
  }
62
- asset.input = (0, plugin_migration_utils_1.toProjectRelativePath)(asset.input, context.projectRoot);
62
+ asset.input = (0, internal_1.toProjectRelativePath)(asset.input, context.projectRoot);
63
63
  return asset;
64
64
  });
65
65
  delete options[key];
66
66
  }
67
67
  else if (key === 'fileReplacements') {
68
68
  pluginOptions.fileReplacements = value.map((replacement) => ({
69
- replace: (0, plugin_migration_utils_1.toProjectRelativePath)(replacement.replace, context.projectRoot),
70
- with: (0, plugin_migration_utils_1.toProjectRelativePath)(replacement.with, context.projectRoot),
69
+ replace: (0, internal_1.toProjectRelativePath)(replacement.replace, context.projectRoot),
70
+ with: (0, internal_1.toProjectRelativePath)(replacement.with, context.projectRoot),
71
71
  }));
72
72
  delete options.fileReplacements;
73
73
  }
74
74
  else if (key === 'additionalEntryPoints') {
75
75
  pluginOptions.additionalEntryPoints = value.map((entryPoint) => {
76
- entryPoint.entryPath = (0, plugin_migration_utils_1.toProjectRelativePath)(entryPoint.entryPath, context.projectRoot);
76
+ entryPoint.entryPath = (0, internal_1.toProjectRelativePath)(entryPoint.entryPath, context.projectRoot);
77
77
  return entryPoint;
78
78
  });
79
79
  delete options.additionalEntryPoints;
@@ -1 +1 @@
1
- {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/webpack/src/generators/convert-to-inferred/utils/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAYpB,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,SAAS,CAAC;AAEpE,wBAAgB,iCAAiC,CAC/C,gBAAgB,EAAE,gBAAgB,IAGhC,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,gBAAgB,mBAAmB,KAClC,OAAO,CAAC,mBAAmB,CAAC,CAwBhC"}
1
+ {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/webpack/src/generators/convert-to-inferred/utils/serve-post-target-transformer.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,SAAS,CAAC;AAEpE,wBAAgB,iCAAiC,CAC/C,gBAAgB,EAAE,gBAAgB,IAGhC,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,gBAAgB,mBAAmB,KAClC,OAAO,CAAC,mBAAmB,CAAC,CAwBhC"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.servePostTargetTransformerFactory = servePostTargetTransformerFactory;
4
4
  const tslib_1 = require("tslib");
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
7
7
  const tsquery_1 = require("@phenomnomnominal/tsquery");
8
8
  const path_1 = require("path");
9
9
  const ts = tslib_1.__importStar(require("typescript"));
@@ -19,7 +19,7 @@ function servePostTargetTransformerFactory(migrationContext) {
19
19
  const { devServerOptions, webpackConfigPath } = await processOptions(tree, target, context);
20
20
  updateWebpackConfig(tree, webpackConfigPath, devServerOptions, context);
21
21
  if (target.outputs) {
22
- (0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTarget, {
22
+ (0, internal_1.processTargetOutputs)(target, [], inferredTarget, {
23
23
  projectName: projectDetails.projectName,
24
24
  projectRoot: projectDetails.root,
25
25
  });
@@ -87,8 +87,8 @@ function extractDevServerOptions(options, context) {
87
87
  devServerOptions.server = { type: 'https' };
88
88
  if (options.sslCert && options.sslKey) {
89
89
  devServerOptions.server.options = {};
90
- devServerOptions.server.options.cert = (0, plugin_migration_utils_1.toProjectRelativePath)(options.sslCert, context.projectRoot);
91
- devServerOptions.server.options.key = (0, plugin_migration_utils_1.toProjectRelativePath)(options.sslKey, context.projectRoot);
90
+ devServerOptions.server.options.cert = (0, internal_1.toProjectRelativePath)(options.sslCert, context.projectRoot);
91
+ devServerOptions.server.options.key = (0, internal_1.toProjectRelativePath)(options.sslKey, context.projectRoot);
92
92
  }
93
93
  else if (options.sslCert) {
94
94
  context.logger.addLog({
@@ -1,5 +1,5 @@
1
1
  import type { ProjectGraph } from '@nx/devkit';
2
- import type { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import type { AggregatedLog } from '@nx/devkit/internal';
3
3
  export type MigrationContext = {
4
4
  logger: AggregatedLog;
5
5
  projectGraph: ProjectGraph;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/webpack/src/generators/convert-to-inferred/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAEpG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/webpack/src/generators/convert-to-inferred/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAEjB,IAAI,EACL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAE9D;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAkF5E;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAEjB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAE9D;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAkF5E;AAED,eAAe,oBAAoB,CAAC"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackInitGenerator = webpackInitGenerator;
4
4
  exports.webpackInitGeneratorInternal = webpackInitGeneratorInternal;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
8
  const versions_1 = require("../../utils/versions");
9
9
  function webpackInitGenerator(tree, schema) {
@@ -15,7 +15,7 @@ async function webpackInitGeneratorInternal(tree, schema) {
15
15
  nxJson.useInferencePlugins !== false;
16
16
  schema.addPlugin ??= addPluginDefault;
17
17
  if (schema.addPlugin) {
18
- await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/webpack/plugin', plugin_1.createNodesV2, {
18
+ await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/webpack/plugin', plugin_1.createNodesV2, {
19
19
  buildTargetName: [
20
20
  'build',
21
21
  'webpack:build',
@@ -1 +1 @@
1
- {"version":3,"file":"remove-isolated-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-21-0-0/remove-isolated-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,yBAA+B,IAAI,EAAE,IAAI,iBAkDxC"}
1
+ {"version":3,"file":"remove-isolated-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-21-0-0/remove-isolated-config.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,yBAA+B,IAAI,EAAE,IAAI,iBAkDxC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
6
  async function default_1(tree) {
7
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName, configurationName) => {
7
+ (0, internal_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName, configurationName) => {
8
8
  // Only handle webpack config for default configuration
9
9
  if (configurationName)
10
10
  return;
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function removeNxTsconfigPathsWebpackPluginImport(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=remove-nx-tsconfig-paths-webpack-plugin-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-nx-tsconfig-paths-webpack-plugin-import.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAwB,MAAM,YAAY,CAAC;AA8BrE,wBAA8B,wCAAwC,CACpE,IAAI,EAAE,IAAI,iBAwHX"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = removeNxTsconfigPathsWebpackPluginImport;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ const DEPRECATED_SYMBOL = 'NxTsconfigPathsWebpackPlugin';
7
+ const DEPRECATED_PACKAGE = '@nx/webpack';
8
+ const NEW_PACKAGE = '@nx/webpack/tsconfig-paths-plugin';
9
+ // ES module import: import { NxTsconfigPathsWebpackPlugin[, ...] } from '@nx/webpack'
10
+ const ES_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=${DEPRECATED_PACKAGE}]):has(ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}])`;
11
+ const IMPORT_SPECIFIERS_SELECTOR = `ImportClause ImportSpecifier`;
12
+ const TARGET_IMPORT_SPECIFIER_SELECTOR = `ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}]`;
13
+ const ES_MODULE_PATH_SELECTOR = `StringLiteral[value=${DEPRECATED_PACKAGE}]`;
14
+ // CJS require: const { NxTsconfigPathsWebpackPlugin[, ...] } = require('@nx/webpack')
15
+ const CJS_REQUIRE_STMT_SELECTOR = `VariableStatement:has(ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]):has(CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}])`;
16
+ const CJS_BINDING_ELEMENTS_SELECTOR = `ObjectBindingPattern > BindingElement`;
17
+ const CJS_TARGET_BINDING_SELECTOR = `ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]`;
18
+ const CJS_REQUIRE_PATH_SELECTOR = `CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}]`;
19
+ // Walk past whitespace from `fromIndex` to find a trailing comma. Returns the
20
+ // position AFTER the comma if found, otherwise the original index. Handles
21
+ // the `Foo , withReact` shape where the user wrote whitespace before the
22
+ // comma — `node.getEnd()` stops at the identifier and the comma sits one
23
+ // character past the whitespace.
24
+ function endAfterTrailingComma(text, fromIndex) {
25
+ let i = fromIndex;
26
+ while (i < text.length && /\s/.test(text.charAt(i)))
27
+ i++;
28
+ return text.charAt(i) === ',' ? i + 1 : fromIndex;
29
+ }
30
+ async function removeNxTsconfigPathsWebpackPluginImport(tree) {
31
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '', (filePath) => {
32
+ if (!filePath.endsWith('.ts') &&
33
+ !filePath.endsWith('.tsx') &&
34
+ !filePath.endsWith('.js') &&
35
+ !filePath.endsWith('.jsx') &&
36
+ !filePath.endsWith('.cjs') &&
37
+ !filePath.endsWith('.mjs')) {
38
+ return;
39
+ }
40
+ let contents = tree.read(filePath, 'utf-8');
41
+ if (!contents)
42
+ return;
43
+ // Quick check: must contain the deprecated symbol and the deprecated package path
44
+ if (!contents.includes(DEPRECATED_SYMBOL) ||
45
+ (!contents.includes(`'${DEPRECATED_PACKAGE}'`) &&
46
+ !contents.includes(`"${DEPRECATED_PACKAGE}"`))) {
47
+ return;
48
+ }
49
+ let changed = false;
50
+ // Re-parse on every iteration so multiple matches in the same file work
51
+ // correctly. The multi-specifier branch prepends a new declaration which
52
+ // shifts every offset; collected AST positions go stale after one rewrite,
53
+ // so process one match at a time.
54
+ let didRewrite = true;
55
+ while (didRewrite) {
56
+ didRewrite = false;
57
+ const sourceFile = (0, tsquery_1.ast)(contents);
58
+ const importNode = (0, tsquery_1.query)(sourceFile, ES_IMPORT_SELECTOR)[0];
59
+ if (importNode) {
60
+ const specifiers = (0, tsquery_1.query)(importNode, IMPORT_SPECIFIERS_SELECTOR);
61
+ const targetIdentifier = (0, tsquery_1.query)(importNode, TARGET_IMPORT_SPECIFIER_SELECTOR)[0];
62
+ if (targetIdentifier) {
63
+ // Walk to the ImportSpecifier to cover `Foo` and `Foo as Bar`.
64
+ const targetSpec = targetIdentifier.parent;
65
+ if (specifiers.length === 1) {
66
+ const modulePathNode = (0, tsquery_1.query)(importNode, ES_MODULE_PATH_SELECTOR)[0];
67
+ if (modulePathNode) {
68
+ contents =
69
+ contents.slice(0, modulePathNode.getStart()) +
70
+ `'${NEW_PACKAGE}'` +
71
+ contents.slice(modulePathNode.getEnd());
72
+ changed = true;
73
+ didRewrite = true;
74
+ continue;
75
+ }
76
+ }
77
+ else {
78
+ // Extract target spec verbatim (preserves alias)
79
+ const end = endAfterTrailingComma(contents, targetSpec.getEnd());
80
+ contents =
81
+ `import { ${targetSpec.getText()} } from '${NEW_PACKAGE}';\n` +
82
+ contents.slice(0, targetSpec.getStart()) +
83
+ contents.slice(end);
84
+ changed = true;
85
+ didRewrite = true;
86
+ continue;
87
+ }
88
+ }
89
+ }
90
+ const stmtNode = (0, tsquery_1.query)(sourceFile, CJS_REQUIRE_STMT_SELECTOR)[0];
91
+ if (stmtNode) {
92
+ const bindingElements = (0, tsquery_1.query)(stmtNode, CJS_BINDING_ELEMENTS_SELECTOR);
93
+ const targetIdentifier = (0, tsquery_1.query)(stmtNode, CJS_TARGET_BINDING_SELECTOR)[0];
94
+ if (targetIdentifier) {
95
+ // Walk to the BindingElement to cover `Foo` and `Foo: Bar`.
96
+ const targetBinding = targetIdentifier.parent;
97
+ if (bindingElements.length === 1) {
98
+ const requirePathNode = (0, tsquery_1.query)(stmtNode, CJS_REQUIRE_PATH_SELECTOR)[0];
99
+ if (requirePathNode) {
100
+ contents =
101
+ contents.slice(0, requirePathNode.getStart()) +
102
+ `'${NEW_PACKAGE}'` +
103
+ contents.slice(requirePathNode.getEnd());
104
+ changed = true;
105
+ didRewrite = true;
106
+ continue;
107
+ }
108
+ }
109
+ else {
110
+ // Extract target binding verbatim (preserves alias)
111
+ const end = endAfterTrailingComma(contents, targetBinding.getEnd());
112
+ contents =
113
+ `const { ${targetBinding.getText()} } = require('${NEW_PACKAGE}');\n` +
114
+ contents.slice(0, targetBinding.getStart()) +
115
+ contents.slice(end);
116
+ changed = true;
117
+ didRewrite = true;
118
+ continue;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ if (changed) {
124
+ tree.write(filePath, contents);
125
+ }
126
+ });
127
+ await (0, devkit_1.formatFiles)(tree);
128
+ }
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
7
7
  const devkit_1 = require("@nx/devkit");
8
- const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
9
- const ts_config_1 = require("@nx/js/src/utils/typescript/ts-config");
8
+ const internal_1 = require("@nx/js/internal");
9
+ const js_1 = require("@nx/js");
10
10
  const webpack_nx_build_coordination_plugin_1 = require("../webpack-nx-build-coordination-plugin");
11
11
  class NxTsconfigPathsWebpackPlugin {
12
12
  constructor(options) {
@@ -30,7 +30,7 @@ class NxTsconfigPathsWebpackPlugin {
30
30
  : this.options.tsConfig;
31
31
  compiler.options.resolve.plugins.push(new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
32
32
  configFile,
33
- baseUrl: (0, ts_config_1.resolvePathsBaseUrl)(configFile),
33
+ baseUrl: (0, js_1.resolvePathsBaseUrl)(configFile),
34
34
  extensions: Array.from(extensions),
35
35
  mainFields: ['module', 'main'],
36
36
  }));
@@ -38,8 +38,8 @@ class NxTsconfigPathsWebpackPlugin {
38
38
  handleBuildLibsFromSource(config, options) {
39
39
  if (!options.buildLibsFromSource && options.targetName) {
40
40
  const remappedTarget = options.targetName === 'serve' ? 'build' : options.targetName;
41
- const { target, dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(undefined, options.projectGraph, options.root, options.projectName, remappedTarget, options.configurationName);
42
- options.tsConfig = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, options.root, target.data.root, dependencies);
41
+ const { target, dependencies } = (0, internal_1.calculateProjectBuildableDependencies)(undefined, options.projectGraph, options.root, options.projectName, remappedTarget, options.configurationName);
42
+ options.tsConfig = (0, internal_1.createTmpTsConfig)(options.tsConfig, options.root, target.data.root, dependencies);
43
43
  if (options.targetName === 'serve') {
44
44
  const buildableDependencies = dependencies
45
45
  .filter((dependency) => dependency.node.type === 'lib')
@@ -15,7 +15,7 @@ const get_terser_ecma_version_1 = require("./get-terser-ecma-version");
15
15
  const compiler_loaders_1 = require("./compiler-loaders");
16
16
  const TerserPlugin = require("terser-webpack-plugin");
17
17
  const nodeExternals = require("webpack-node-externals");
18
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
18
+ const internal_1 = require("@nx/js/internal");
19
19
  const utils_1 = require("./utils");
20
20
  const IGNORED_WEBPACK_WARNINGS = [
21
21
  /The comment file/i,
@@ -208,7 +208,7 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
208
208
  configurationName: options.configurationName,
209
209
  root: options.root,
210
210
  };
211
- const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
211
+ const isUsingTsSolution = (0, internal_1.isUsingTsSolutionSetup)();
212
212
  options.useTsconfigPaths ??= !isUsingTsSolution;
213
213
  // If the project is using ts solutions setup, the paths are not in tsconfig and we should not use the plugin's paths.
214
214
  if (options.useTsconfigPaths) {
@@ -4,7 +4,7 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.normalizeAssets = normalizeAssets;
5
5
  exports.normalizeFileReplacements = normalizeFileReplacements;
6
6
  const devkit_1 = require("@nx/devkit");
7
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const internal_1 = require("@nx/js/internal");
8
8
  const fs_1 = require("fs");
9
9
  const path_1 = require("path");
10
10
  function normalizeOptions(options) {
@@ -49,7 +49,7 @@ function normalizeOptions(options) {
49
49
  // executor options take precedence (especially for overriding with CLI args)
50
50
  originalTargetOptions);
51
51
  }
52
- const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data);
52
+ const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectNode.data);
53
53
  if (!combinedPluginAndMaybeExecutorOptions.main) {
54
54
  throw new Error(`Missing "main" option for the entry file. Set this option in your Nx webpack plugin.`);
55
55
  }
@@ -1,5 +1,5 @@
1
1
  import { ProjectGraph } from '@nx/devkit';
2
- import { AssetGlob } from '@nx/js/src/utils/assets/assets';
2
+ import { AssetGlob } from '@nx/js/internal';
3
3
  export interface AssetGlobPattern {
4
4
  glob: string;
5
5
  input: string;
@@ -1 +1 @@
1
- {"version":3,"file":"nx-app-webpack-plugin-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,QAAQ,CA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C9C;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG;QAAE,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACxE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,mCACf,SAAQ,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B"}
1
+ {"version":3,"file":"nx-app-webpack-plugin-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB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,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,kBAAkB,EAKlB,aAAa,EAOd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAgE3D,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
@@ -1,31 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
- const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
7
6
  const js_1 = require("@nx/js");
8
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const internal_2 = require("@nx/js/internal");
9
8
  const fs_1 = require("fs");
10
9
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
11
10
  const cache_directory_1 = require("nx/src/utils/cache-directory");
12
11
  const path_1 = require("path");
13
12
  const read_webpack_options_1 = require("../utils/webpack/read-webpack-options");
14
13
  const resolve_user_defined_webpack_config_1 = require("../utils/webpack/resolve-user-defined-webpack-config");
15
- const util_1 = require("@nx/js/src/plugins/typescript/util");
16
- function readTargetsCache(cachePath) {
17
- try {
18
- return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
19
- ? (0, devkit_1.readJsonFile)(cachePath)
20
- : {};
21
- }
22
- catch {
23
- return {};
24
- }
25
- }
26
- function writeTargetsToCache(cachePath, results) {
27
- (0, devkit_1.writeJsonFile)(cachePath, results);
28
- }
29
14
  /**
30
15
  * @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
31
16
  */
@@ -39,30 +24,47 @@ exports.createNodes = [
39
24
  async (configFilePaths, options, context) => {
40
25
  const optionsHash = (0, file_hasher_1.hashObject)(options);
41
26
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `webpack-${optionsHash}.hash`);
42
- const targetsCache = readTargetsCache(cachePath);
27
+ const targetsCache = new internal_1.PluginCache(cachePath);
43
28
  const normalizedOptions = normalizeOptions(options);
44
- const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
45
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
29
+ const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
30
+ const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
31
+ const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
32
+ const lockFileName = (0, js_1.getLockFileName)(packageManager);
46
33
  try {
47
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc), configFilePaths, normalizedOptions, context);
34
+ const { entries, preErrors } = await filterWebpackConfigs(configFilePaths, context);
35
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
36
+ let results = [];
37
+ let nodeErrors = [];
38
+ try {
39
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, opts, ctx, idx) => createNodesInternal(configFile, opts, ctx, targetsCache, isTsSolutionSetup, pmc, projectHashes[idx]), entries.map((e) => e.configFile), normalizedOptions, context);
40
+ }
41
+ catch (e) {
42
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
43
+ results = e.partialResults ?? [];
44
+ nodeErrors = e.errors;
45
+ }
46
+ else {
47
+ throw e;
48
+ }
49
+ }
50
+ const allErrors = [...preErrors, ...nodeErrors];
51
+ if (allErrors.length > 0) {
52
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
53
+ }
54
+ return results;
48
55
  }
49
56
  finally {
50
- writeTargetsToCache(cachePath, targetsCache);
57
+ targetsCache.writeToDisk();
51
58
  }
52
59
  },
53
60
  ];
54
61
  exports.createNodesV2 = exports.createNodes;
55
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
62
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
56
63
  const projectRoot = (0, path_1.dirname)(configFilePath);
57
- // Do not create a project if package.json and project.json isn't there.
58
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
59
- if (!siblingFiles.includes('package.json') &&
60
- !siblingFiles.includes('project.json')) {
61
- return {};
64
+ if (!targetsCache.has(hash)) {
65
+ targetsCache.set(hash, await createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
62
66
  }
63
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
64
- targetsCache[hash] ??= await createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc);
65
- const { targets, metadata } = targetsCache[hash];
67
+ const { targets, metadata } = targetsCache.get(hash);
66
68
  return {
67
69
  projects: {
68
70
  [projectRoot]: {
@@ -74,7 +76,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
74
76
  };
75
77
  }
76
78
  async function createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc) {
77
- const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
79
+ const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
78
80
  const webpackConfig = (0, resolve_user_defined_webpack_config_1.resolveUserDefinedWebpackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
79
81
  const webpackOptions = await (0, read_webpack_options_1.readWebpackOptions)(webpackConfig);
80
82
  const outputs = [];
@@ -96,7 +98,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
96
98
  {
97
99
  externalDependencies: ['webpack-cli'],
98
100
  },
99
- ts_solution_setup_1.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
101
+ internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
100
102
  ]
101
103
  : [
102
104
  'default',
@@ -104,7 +106,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
104
106
  {
105
107
  externalDependencies: ['webpack-cli'],
106
108
  },
107
- ts_solution_setup_1.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
109
+ internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
108
110
  ],
109
111
  outputs,
110
112
  metadata: {
@@ -189,7 +191,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
189
191
  '@nx/js:typescript-sync',
190
192
  ];
191
193
  }
192
- (0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
194
+ (0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
193
195
  return { targets, metadata: {} };
194
196
  }
195
197
  function normalizeOutputPath(outputPath, projectRoot) {
@@ -220,6 +222,28 @@ function normalizeOutputPath(outputPath, projectRoot) {
220
222
  }
221
223
  }
222
224
  }
225
+ async function filterWebpackConfigs(configFiles, context) {
226
+ const preErrors = [];
227
+ const candidates = await Promise.all(configFiles.map(async (configFile) => {
228
+ try {
229
+ const projectRoot = (0, path_1.dirname)(configFile);
230
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
231
+ if (!siblingFiles.includes('package.json') &&
232
+ !siblingFiles.includes('project.json')) {
233
+ return null;
234
+ }
235
+ return { configFile, projectRoot };
236
+ }
237
+ catch (e) {
238
+ preErrors.push([configFile, e]);
239
+ return null;
240
+ }
241
+ }));
242
+ return {
243
+ entries: candidates.filter((c) => c !== null),
244
+ preErrors,
245
+ };
246
+ }
223
247
  function normalizeOptions(options) {
224
248
  return {
225
249
  buildTargetName: options?.buildTargetName ?? 'build',
@@ -5,7 +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 ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
+ const internal_1 = require("@nx/js/internal");
9
9
  const configuration_1 = require("nx/src/config/configuration");
10
10
  exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
11
11
  function isNxWebpackComposablePlugin(a) {
@@ -50,7 +50,7 @@ function ensureNxWebpackExecutionContext(ctx) {
50
50
  ctx.options ??= {
51
51
  root: devkit_1.workspaceRoot,
52
52
  projectRoot: projectNode.data.root,
53
- sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data),
53
+ sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
54
54
  // These aren't actually needed since NxWebpackPlugin and withNx both support them being undefined.
55
55
  assets: undefined,
56
56
  outputPath: undefined,
@@ -0,0 +1,6 @@
1
+ export declare const WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/webpack:webpack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
+ export declare const WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/webpack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
3
+ export declare function warnWebpackExecutorDeprecation(): void;
4
+ export declare function warnWebpackDevServerExecutorDeprecation(): void;
5
+ export declare function warnWebpackExecutorGenerating(): void;
6
+ //# sourceMappingURL=deprecation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/deprecation.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oCAAoC,uQACqN,CAAC;AAEvQ,eAAO,MAAM,+CAA+C,0QAC6M,CAAC;AAE1Q,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D;AAMD,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
+ exports.warnWebpackExecutorDeprecation = warnWebpackExecutorDeprecation;
5
+ exports.warnWebpackDevServerExecutorDeprecation = warnWebpackDevServerExecutorDeprecation;
6
+ exports.warnWebpackExecutorGenerating = warnWebpackExecutorGenerating;
7
+ const devkit_1 = require("@nx/devkit");
8
+ // TODO(v24): Remove the @nx/webpack:webpack and @nx/webpack:dev-server
9
+ // executors. The inferred plugin (@nx/webpack/plugin) and the
10
+ // convert-to-inferred generator stay supported.
11
+ exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/webpack:webpack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
12
+ exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/webpack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
13
+ function warnWebpackExecutorDeprecation() {
14
+ devkit_1.logger.warn(exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE);
15
+ }
16
+ function warnWebpackDevServerExecutorDeprecation() {
17
+ devkit_1.logger.warn(exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
18
+ }
19
+ // Fired when the @nx/webpack:configuration generator is about to generate
20
+ // targets that use the deprecated executors — i.e. when @nx/webpack/plugin
21
+ // isn't registered in nx.json. Surfaces the deprecation at generation time
22
+ // rather than only when the user later runs the generated targets.
23
+ function warnWebpackExecutorGenerating() {
24
+ devkit_1.logger.warn('Generating targets that use the deprecated `@nx/webpack:webpack` and `@nx/webpack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` next to migrate these targets to the `@nx/webpack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
25
+ }
@@ -1,3 +1,3 @@
1
1
  import { type Tree } from '@nx/devkit';
2
- export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/src/generators/e2e-web-server-info-utils").E2EWebServerDetails>;
2
+ export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
3
3
  //# sourceMappingURL=e2e-web-server-info-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAGnD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,8FA8BzB"}
1
+ {"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAMnD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,8DA6BzB"}
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWebpackE2EWebServerInfo = getWebpackE2EWebServerInfo;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  async function getWebpackE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride) {
7
7
  const nxJson = (0, devkit_1.readNxJson)(tree);
8
8
  let e2ePort = e2ePortOverride ?? 4200;
9
- if (nxJson.targetDefaults?.['serve'] &&
10
- nxJson.targetDefaults?.['serve'].options?.port) {
11
- e2ePort = nxJson.targetDefaults?.['serve'].options?.port;
9
+ const servePort = (0, internal_1.readTargetDefaultsForTarget)('serve', nxJson.targetDefaults)
10
+ ?.options?.port;
11
+ if (servePort) {
12
+ e2ePort = servePort;
12
13
  }
13
- return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
14
+ return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
14
15
  plugin: '@nx/webpack/plugin',
15
16
  serveTargetName: 'serveTargetName',
16
17
  serveStaticTargetName: 'serveStaticTargetName',
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureDependencies = ensureDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
5
+ const internal_1 = require("@nx/js/internal");
6
6
  const versions_1 = require("./versions");
7
7
  function ensureDependencies(tree, options) {
8
8
  const tasks = [];
9
9
  const devDependencies = {};
10
10
  if (options.compiler === 'swc') {
11
11
  devDependencies['swc-loader'] = versions_1.swcLoaderVersion;
12
- const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(tree);
12
+ const addSwcTask = (0, internal_1.addSwcDependencies)(tree);
13
13
  tasks.push(addSwcTask);
14
14
  }
15
15
  if (options.compiler === 'tsc') {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-user-defined-webpack-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/utils/webpack/resolve-user-defined-webpack-config.ts"],"names":[],"mappings":"AAGA,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM;AAChB,mDAAmD;AACnD,MAAM,UAAQ,OAmCf"}
1
+ {"version":3,"file":"resolve-user-defined-webpack-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/utils/webpack/resolve-user-defined-webpack-config.ts"],"names":[],"mappings":"AAGA,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM;AAChB,mDAAmD;AACnD,MAAM,UAAQ,OAiCf"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveUserDefinedWebpackConfig = resolveUserDefinedWebpackConfig;
4
- const internal_1 = require("@nx/js/src/internal");
5
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const internal_2 = require("@nx/js/internal");
6
6
  function resolveUserDefinedWebpackConfig(path, tsConfig,
7
7
  /** Skip require cache and return latest content */
8
8
  reload = false) {
@@ -10,7 +10,7 @@ reload = false) {
10
10
  // Clear cache if the path is in the cache
11
11
  if (require.cache[path]) {
12
12
  // Clear all entries because config may import other modules
13
- (0, config_utils_1.clearRequireCache)();
13
+ (0, internal_1.clearRequireCache)();
14
14
  }
15
15
  }
16
16
  // Don't transpile non-TS files. This prevents workspaces libs from being registered via tsconfig-paths.
@@ -18,9 +18,7 @@ reload = false) {
18
18
  if (!/\.(ts|mts|cts)$/.test(path)) {
19
19
  return require(path);
20
20
  }
21
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
22
- const maybeCustomWebpackConfig = require(path);
23
- cleanupTranspiler();
21
+ const maybeCustomWebpackConfig = (0, internal_2.loadTsFile)(path, tsConfig);
24
22
  // If the user provides a configuration in TS file
25
23
  // then there are 3 cases for exporing an object. The first one is:
26
24
  // `module.exports = { ... }`. And the second one is: