@nx/webpack 24.0.0-beta.2 → 24.0.0-beta.4

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 (61) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/internal.d.ts +3 -0
  4. package/dist/internal.js +7 -1
  5. package/dist/ready-check.d.ts +1 -0
  6. package/dist/ready-check.js +9 -0
  7. package/dist/ready-signal.d.ts +1 -0
  8. package/dist/ready-signal.js +5 -0
  9. package/dist/src/executors/dev-server/dev-server.impl.js +38 -30
  10. package/dist/src/generators/configuration/configuration.js +14 -132
  11. package/dist/src/generators/configuration/schema.d.ts +0 -1
  12. package/dist/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +82 -49
  13. package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts +1 -0
  14. package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js +31 -2
  15. package/dist/src/generators/convert-config-to-webpack-plugin/schema.json +2 -2
  16. package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +5 -4
  17. package/dist/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +13 -5
  18. package/dist/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +8 -14
  19. package/dist/src/generators/init/init.js +45 -54
  20. package/dist/src/generators/init/schema.d.ts +0 -1
  21. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +11 -0
  22. package/dist/src/migrations/update-24-0-0/inventory.d.ts +9 -0
  23. package/dist/src/migrations/update-24-0-0/inventory.js +53 -0
  24. package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.d.ts +10 -0
  25. package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.js +60 -0
  26. package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.md +98 -0
  27. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  28. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +36 -0
  29. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +92 -0
  30. package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +6 -0
  31. package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.js +29 -24
  32. package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts +2 -0
  33. package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +18 -1
  34. package/dist/src/plugins/plugin.js +24 -0
  35. package/dist/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.js +3 -0
  36. package/dist/src/utils/config.d.ts +8 -12
  37. package/dist/src/utils/config.js +15 -68
  38. package/dist/src/utils/deprecation.d.ts +1 -6
  39. package/dist/src/utils/deprecation.js +4 -27
  40. package/dist/src/utils/dev-server-ready-check.d.ts +48 -0
  41. package/dist/src/utils/dev-server-ready-check.js +325 -0
  42. package/dist/src/utils/dev-server-ready-signal.d.ts +29 -0
  43. package/dist/src/utils/dev-server-ready-signal.js +60 -0
  44. package/dist/src/utils/e2e-web-server-info-utils.d.ts +1 -1
  45. package/dist/src/utils/e2e-web-server-info-utils.js +2 -2
  46. package/dist/src/utils/webpack/read-webpack-options.d.ts +1 -1
  47. package/dist/src/utils/webpack/read-webpack-options.js +4 -4
  48. package/dist/src/utils/with-nx.d.ts +5 -9
  49. package/dist/src/utils/with-nx.js +5 -32
  50. package/dist/src/utils/with-web.d.ts +5 -9
  51. package/dist/src/utils/with-web.js +5 -24
  52. package/executors.json +0 -10
  53. package/migrations.json +13 -0
  54. package/package.json +20 -4
  55. package/dist/src/executors/webpack/lib/run-webpack.d.ts +0 -3
  56. package/dist/src/executors/webpack/lib/run-webpack.js +0 -36
  57. package/dist/src/executors/webpack/schema.json +0 -459
  58. package/dist/src/executors/webpack/webpack.impl.d.ts +0 -13
  59. package/dist/src/executors/webpack/webpack.impl.js +0 -117
  60. package/dist/src/utils/has-plugin.d.ts +0 -2
  61. package/dist/src/utils/has-plugin.js +0 -10
@@ -1,5 +1,6 @@
1
1
  import type { Compiler } from 'webpack';
2
2
  import { NxAppWebpackPluginOptions } from './nx-app-webpack-plugin-options';
3
+ import { READY_SIGNAL_PLUGIN } from '../../utils/dev-server-ready-signal';
3
4
  /**
4
5
  * This plugin provides features to build Node and Web applications.
5
6
  * - TS support (including tsconfig paths)
@@ -12,6 +13,7 @@ import { NxAppWebpackPluginOptions } from './nx-app-webpack-plugin-options';
12
13
  */
13
14
  export declare class NxAppWebpackPlugin {
14
15
  private readonly options;
16
+ readonly [READY_SIGNAL_PLUGIN] = true;
15
17
  constructor(options?: NxAppWebpackPluginOptions);
16
18
  apply(compiler: Compiler): void;
17
19
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.NxAppWebpackPlugin = void 0;
4
5
  const normalize_options_1 = require("./lib/normalize-options");
6
+ const dev_server_ready_signal_1 = require("../../utils/dev-server-ready-signal");
5
7
  /**
6
8
  * This plugin provides features to build Node and Web applications.
7
9
  * - TS support (including tsconfig paths)
@@ -14,6 +16,7 @@ const normalize_options_1 = require("./lib/normalize-options");
14
16
  */
15
17
  class NxAppWebpackPlugin {
16
18
  constructor(options = {}) {
19
+ this[_a] = true;
17
20
  // If we're building inferred targets, skip normalizing build options.
18
21
  if (!global.NX_GRAPH_CREATION) {
19
22
  this.options = (0, normalize_options_1.normalizeOptions)(options);
@@ -23,19 +26,32 @@ class NxAppWebpackPlugin {
23
26
  // Lazy-required so a generator can load this without the webpack bundler.
24
27
  const { applyBaseConfig } = require('./lib/apply-base-config');
25
28
  const { applyWebConfig } = require('./lib/apply-web-config');
29
+ const { applyDevServerReadySignal } = require('../../utils/dev-server-ready-signal');
30
+ applyDevServerReadySignal(compiler);
26
31
  // Defaults to 'web' if not specified to match Webpack's default.
27
32
  const target = this.options.target ?? compiler.options.target ?? 'web';
28
33
  this.options.outputPath ??= compiler.options.output?.path;
29
34
  if (typeof target === 'string') {
30
35
  this.options.target = target;
31
36
  }
37
+ // Cypress supplies its own `main` entry and index.html, and license
38
+ // extraction fails with ENOENT for buildable libraries under component
39
+ // testing.
40
+ if (process.env.NX_CYPRESS_COMPONENT_TEST === 'true') {
41
+ this.options.main = undefined;
42
+ this.options.generateIndexHtml = false;
43
+ this.options.extractLicenses = false;
44
+ }
32
45
  applyBaseConfig(this.options, compiler.options, {
33
46
  useNormalizedEntry: true,
34
47
  });
48
+ compiler.context = compiler.options.context;
35
49
  if (compiler.options.target) {
36
50
  this.options.target = compiler.options.target;
37
51
  }
38
- if (this.options.target === 'web' || this.options.target === 'webworker') {
52
+ if (this.options.target === 'web' ||
53
+ this.options.target === 'webworker' ||
54
+ this.options.ssr) {
39
55
  applyWebConfig(this.options, compiler.options, {
40
56
  useNormalizedEntry: true,
41
57
  });
@@ -43,3 +59,4 @@ class NxAppWebpackPlugin {
43
59
  }
44
60
  }
45
61
  exports.NxAppWebpackPlugin = NxAppWebpackPlugin;
62
+ _a = dev_server_ready_signal_1.READY_SIGNAL_PLUGIN;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = void 0;
4
4
  const internal_1 = require("@nx/devkit/internal");
5
+ const dev_server_ready_signal_1 = require("../utils/dev-server-ready-signal");
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  const js_1 = require("@nx/js");
7
8
  const internal_2 = require("@nx/js/internal");
@@ -121,6 +122,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
121
122
  },
122
123
  },
123
124
  };
125
+ const devServerReadyWhen = getDevServerReadyWhen(configFilePath, webpackOptions);
124
126
  targets[options.serveTargetName] = {
125
127
  continuous: true,
126
128
  inputs: [...buildInputs],
@@ -129,6 +131,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
129
131
  cwd: projectRoot,
130
132
  env: { NODE_ENV: 'development' },
131
133
  },
134
+ readyWhen: devServerReadyWhen,
132
135
  metadata: {
133
136
  technologies: ['webpack'],
134
137
  description: 'Starts Webpack dev server',
@@ -150,6 +153,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
150
153
  cwd: projectRoot,
151
154
  env: { NODE_ENV: 'production' },
152
155
  },
156
+ readyWhen: devServerReadyWhen,
153
157
  metadata: {
154
158
  technologies: ['webpack'],
155
159
  description: 'Starts Webpack dev server in production mode',
@@ -172,6 +176,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
172
176
  buildTarget: options.buildTargetName,
173
177
  spa: true,
174
178
  },
179
+ readyWhen: { port: '{options.port}', host: '{options.host ?? localhost}' },
175
180
  };
176
181
  // for `convert-to-inferred` we need to leave the port undefined or the options will not match
177
182
  if (webpackConfig.devServer?.port && webpackConfig.devServer?.port !== 4200) {
@@ -255,3 +260,22 @@ function normalizeOptions(options) {
255
260
  watchDepsTargetName: 'watch-deps',
256
261
  };
257
262
  }
263
+ // A dev server whose config loads NxAppWebpackPlugin or NxReadySignalPlugin reports
264
+ // when it listens. Otherwise the check reads the config when the task runs,
265
+ // with the task's env and options, and waits for the dev server's port.
266
+ function getDevServerReadyWhen(configFilePath, configs) {
267
+ // webpack-cli starts a dev server for each config with devServer. Only the
268
+ // first one to listen would signal, so several get the check that waits
269
+ // for each of them.
270
+ const withDevServer = configs.filter((config) => config.devServer);
271
+ const signals = withDevServer.length === 1 && (0, dev_server_ready_signal_1.sendsReadySignal)(withDevServer[0]);
272
+ return signals
273
+ ? { signal: true }
274
+ : {
275
+ // Unquoted: the plugin's glob fixes the file name. Quote it if it ever
276
+ // becomes user-chosen, since the shell expands $, backticks and %.
277
+ command: `node -e "require('@nx/webpack/ready-check').waitForDevServer(process.argv[1])" ${(0, path_1.basename)(configFilePath)}`,
278
+ // Each attempt loads the config
279
+ interval: 1000,
280
+ };
281
+ }
@@ -59,6 +59,9 @@ async function useLegacyNxPlugin(fn, executorOptions) {
59
59
  apply(compiler) {
60
60
  compiler.hooks.beforeCompile.tapPromise('NxLegacyAsyncPlugin', () => {
61
61
  return new Promise((resolve) => {
62
+ // Legacy functions are typed to take `Configuration` but mutate the
63
+ // normalized options in place. From webpack 5.111 the two types
64
+ // conflict (`output.copy`), and the public signature can't widen.
62
65
  fn(compiler.options, ctx).then((updated) => {
63
66
  // Merge options back shallowly since it's a fully functional configuration.
64
67
  // Most likely, the user modified the config in place, but this guarantees that updates are applied if users did something like:
@@ -1,6 +1,6 @@
1
- import { ExecutorContext } from '@nx/devkit';
1
+ import type { ExecutorContext } from '@nx/devkit';
2
2
  import type { Configuration } from 'webpack';
3
- import { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
3
+ import type { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
4
4
  export declare const nxWebpackComposablePlugin = "nxWebpackComposablePlugin";
5
5
  export declare function isNxWebpackComposablePlugin(a: unknown): a is AsyncNxComposableWebpackPlugin;
6
6
  export interface NxWebpackExecutionContext {
@@ -15,20 +15,16 @@ export interface AsyncNxComposableWebpackPlugin {
15
15
  (config: Configuration, ctx: NxWebpackExecutionContext): Configuration | Promise<Configuration>;
16
16
  }
17
17
  /**
18
- * @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
19
- * `@nx/webpack/app-plugin` in a standard webpack config and run
20
- * `nx g @nx/webpack:convert-to-inferred`. See
21
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
18
+ * @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
19
+ * This inert stub will be removed in Nx v25.
22
20
  */
23
- export declare function composePlugins(...plugins: (NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin | Promise<NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin>)[]): ((config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>) & {
21
+ export declare function composePlugins(..._plugins: (NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin | Promise<NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin>)[]): ((config?: Configuration, ctx?: NxWebpackExecutionContext) => Promise<Configuration>) & {
24
22
  nxWebpackComposablePlugin: boolean;
25
23
  };
26
24
  /**
27
- * @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
28
- * `@nx/webpack/app-plugin` in a standard webpack config and run
29
- * `nx g @nx/webpack:convert-to-inferred`. See
30
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
25
+ * @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
26
+ * This inert stub will be removed in Nx v25.
31
27
  */
32
- export declare function composePluginsSync(...plugins: NxComposableWebpackPlugin[]): ((config: Configuration, ctx: NxWebpackExecutionContext) => Configuration) & {
28
+ export declare function composePluginsSync(..._plugins: NxComposableWebpackPlugin[]): ((config?: Configuration, ctx?: NxWebpackExecutionContext) => Configuration) & {
33
29
  nxWebpackComposablePlugin: boolean;
34
30
  };
@@ -4,84 +4,31 @@ exports.nxWebpackComposablePlugin = void 0;
4
4
  exports.isNxWebpackComposablePlugin = isNxWebpackComposablePlugin;
5
5
  exports.composePlugins = composePlugins;
6
6
  exports.composePluginsSync = composePluginsSync;
7
- const devkit_1 = require("@nx/devkit");
8
- const internal_1 = require("@nx/js/internal");
9
7
  const deprecation_1 = require("./deprecation");
10
- const internal_2 = require("@nx/devkit/internal");
11
8
  exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
12
9
  function isNxWebpackComposablePlugin(a) {
13
10
  return a?.[exports.nxWebpackComposablePlugin] === true;
14
11
  }
12
+ // TODO(v25): remove the inert config-helper stubs in this file.
15
13
  /**
16
- * @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
17
- * `@nx/webpack/app-plugin` in a standard webpack config and run
18
- * `nx g @nx/webpack:convert-to-inferred`. See
19
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
14
+ * @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
15
+ * This inert stub will be removed in Nx v25.
20
16
  */
21
- function composePlugins(...plugins) {
17
+ function composePlugins(..._plugins) {
22
18
  (0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
23
- return Object.assign(async function combined(config, ctx) {
24
- // Webpack may be calling us as a standard config function.
25
- // Build up Nx context from environment variables.
26
- // This is to enable `@nx/webpack/plugin` to work with existing projects.
27
- if (ctx['env']) {
28
- ensureNxWebpackExecutionContext(ctx);
29
- // Build this from scratch since what webpack passes us is the env, not config,
30
- // and `withNX()` creates a new config object anyway.
31
- config = {};
32
- }
33
- for (const plugin of plugins) {
34
- const fn = await plugin;
35
- config = await fn(config, ctx);
36
- }
37
- return config;
38
- }, {
39
- [exports.nxWebpackComposablePlugin]: true,
40
- });
19
+ return Object.assign(async (config = {}, ctx) => {
20
+ // Only the legacy Nx executor passes a config; CLIs pass (env, argv).
21
+ return ctx?.context && typeof ctx.context === 'object' ? config : {};
22
+ }, { [exports.nxWebpackComposablePlugin]: true });
41
23
  }
42
24
  /**
43
- * @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
44
- * `@nx/webpack/app-plugin` in a standard webpack config and run
45
- * `nx g @nx/webpack:convert-to-inferred`. See
46
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
25
+ * @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
26
+ * This inert stub will be removed in Nx v25.
47
27
  */
48
- function composePluginsSync(...plugins) {
28
+ function composePluginsSync(..._plugins) {
49
29
  (0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
50
- return Object.assign(function combined(config, ctx) {
51
- for (const plugin of plugins) {
52
- config = plugin(config, ctx);
53
- }
54
- return config;
55
- }, {
56
- [exports.nxWebpackComposablePlugin]: true,
57
- });
58
- }
59
- function ensureNxWebpackExecutionContext(ctx) {
60
- const projectName = process.env.NX_TASK_TARGET_PROJECT;
61
- const targetName = process.env.NX_TASK_TARGET_TARGET;
62
- const configurationName = process.env.NX_TASK_TARGET_CONFIGURATION;
63
- const projectGraph = (0, devkit_1.readCachedProjectGraph)();
64
- const projectNode = projectGraph.nodes[projectName];
65
- ctx.options ??= {
66
- root: devkit_1.workspaceRoot,
67
- projectRoot: projectNode.data.root,
68
- sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
69
- // These aren't actually needed since NxWebpackPlugin and withNx both support them being undefined.
70
- assets: undefined,
71
- outputPath: undefined,
72
- tsConfig: undefined,
73
- outputFileName: undefined,
74
- useTsconfigPaths: undefined,
75
- };
76
- ctx.context ??= {
77
- projectName,
78
- targetName,
79
- configurationName,
80
- projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
81
- nxJsonConfiguration: (0, internal_2.readNxJsonFromDisk)(devkit_1.workspaceRoot),
82
- cwd: process.cwd(),
83
- root: devkit_1.workspaceRoot,
84
- isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
85
- projectGraph,
86
- };
30
+ return Object.assign((config = {}, ctx) => {
31
+ // Only the legacy Nx executor passes a config; CLIs pass (env, argv).
32
+ return ctx?.context && typeof ctx.context === 'object' ? config : {};
33
+ }, { [exports.nxWebpackComposablePlugin]: true });
87
34
  }
@@ -1,8 +1,3 @@
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
- export declare const WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
1
+ export declare const WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The compose config helpers from `@nx/webpack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard webpack config using `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.";
7
2
  export declare function suppressWebpackComposeHelperWarnings<T>(fn: () => T): T;
8
3
  export declare function warnWebpackComposeHelpersDeprecation(): void;
@@ -1,35 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 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;
3
+ exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = void 0;
7
4
  exports.suppressWebpackComposeHelperWarnings = suppressWebpackComposeHelperWarnings;
8
5
  exports.warnWebpackComposeHelpersDeprecation = warnWebpackComposeHelpersDeprecation;
9
6
  const devkit_1 = require("@nx/devkit");
10
- // TODO(v24): Remove the @nx/webpack:webpack and @nx/webpack:dev-server
11
- // executors. The inferred plugin (@nx/webpack/plugin) and the
12
- // convert-to-inferred generator stay supported.
13
- 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.';
14
- 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.';
15
- function warnWebpackExecutorDeprecation() {
16
- devkit_1.logger.warn(exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE);
17
- }
18
- function warnWebpackDevServerExecutorDeprecation() {
19
- devkit_1.logger.warn(exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
20
- }
21
- // Fired when the @nx/webpack:configuration generator is about to generate
22
- // targets that use the deprecated executors — i.e. when @nx/webpack/plugin
23
- // isn't registered in nx.json. Surfaces the deprecation at generation time
24
- // rather than only when the user later runs the generated targets.
25
- function warnWebpackExecutorGenerating() {
26
- 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.');
27
- }
28
- // TODO(v24): Remove the composePlugins/withNx/withWeb config helpers. They emit
29
- // an Nx-specific config function that only runs under the @nx/webpack:webpack
30
- // executor; the inferred @nx/webpack/plugin works with standard webpack configs
31
- // built around NxAppWebpackPlugin instead.
32
- exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
7
+ // Helper behavior was removed in v24; exports remain only as inert stubs.
8
+ // Keep their exports loadable so old configs do not block graph creation.
9
+ exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The compose config helpers from `@nx/webpack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard webpack config using `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.';
33
10
  let composeHelpersWarned = false;
34
11
  let suppressDepth = 0;
35
12
  // Nx-internal entry points compose these helpers themselves (e.g. the rspack
@@ -0,0 +1,48 @@
1
+ export interface ServeFlags {
2
+ port?: string;
3
+ host?: string;
4
+ configNames: string[];
5
+ configs: string[];
6
+ merge: boolean;
7
+ env: Record<string, unknown>;
8
+ extends: string[];
9
+ }
10
+ /**
11
+ * The flags `webpack-cli serve` gets from the target's options, in the order
12
+ * run-commands passes them: named options, `args`, then overrides.
13
+ */
14
+ export declare function parseServeFlags(options: Record<string, unknown>): ServeFlags;
15
+ /**
16
+ * The `argv` webpack-cli passes to a function config: its commander options,
17
+ * with `env` set by the caller. Values stay strings except `--port`, which
18
+ * webpack-cli converts to a number when it is numeric.
19
+ */
20
+ export declare function parseServeArgv(options: Record<string, unknown>, env: Record<string, unknown>): Record<string, unknown>;
21
+ export type DevServerAddress = {
22
+ port: number;
23
+ host?: string;
24
+ };
25
+ /**
26
+ * Where a dev server listens, or null when it picks its port or listens on a
27
+ * socket. Returns null for those, since nothing can be probed ahead of them.
28
+ */
29
+ export declare function getDevServerAddress(devServer: {
30
+ port?: unknown;
31
+ host?: unknown;
32
+ ipc?: unknown;
33
+ } | undefined, flags: ServeFlags, basePort: string | undefined): DevServerAddress | null;
34
+ /** Resolves once every address accepts a TCP connection. */
35
+ export declare function waitForAddresses(addresses: DevServerAddress[]): Promise<void>;
36
+ export declare function readTaskOptions(): Record<string, unknown> & {
37
+ cwd?: string;
38
+ };
39
+ export declare function enterTaskCwd(options: {
40
+ cwd?: string;
41
+ }): void;
42
+ /**
43
+ * The readyWhen of the inferred serve targets when the config doesn't load the
44
+ * signal plugin. Runs in the env and with the options of the serve task, reads
45
+ * the config the way `webpack-cli serve` does, and waits for each dev server it
46
+ * starts.
47
+ */
48
+ export declare function waitForWebpackDevServer(configPath: string): Promise<void>;