@nx/rspack 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 (92) hide show
  1. package/dist/ready-check.d.ts +1 -0
  2. package/dist/ready-check.js +9 -0
  3. package/dist/ready-signal.d.ts +1 -0
  4. package/dist/ready-signal.js +5 -0
  5. package/dist/src/executors/dev-server/dev-server.impl.js +0 -2
  6. package/dist/src/executors/rspack/lib/config.js +18 -8
  7. package/dist/src/generators/configuration/configuration.js +5 -29
  8. package/dist/src/generators/configuration/schema.json +2 -2
  9. package/dist/src/generators/convert-config-to-rspack-plugin/convert-config-to-rspack-plugin.js +78 -45
  10. package/dist/src/generators/convert-config-to-rspack-plugin/lib/extract-rspack-options.d.ts +1 -0
  11. package/dist/src/generators/convert-config-to-rspack-plugin/lib/extract-rspack-options.js +31 -2
  12. package/dist/src/generators/convert-config-to-rspack-plugin/schema.json +2 -2
  13. package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +5 -4
  14. package/dist/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +13 -5
  15. package/dist/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +8 -14
  16. package/dist/src/generators/convert-webpack/convert-webpack.js +20 -74
  17. package/dist/src/generators/convert-webpack/lib/transform-plugin-config.d.ts +1 -1
  18. package/dist/src/generators/convert-webpack/lib/transform-plugin-config.js +47 -69
  19. package/dist/src/generators/init/init.js +38 -44
  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 +95 -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 +90 -0
  30. package/dist/src/plugins/nx-app-rspack-plugin/nx-app-rspack-plugin.d.ts +2 -0
  31. package/dist/src/plugins/nx-app-rspack-plugin/nx-app-rspack-plugin.js +10 -1
  32. package/dist/src/plugins/plugin.js +21 -0
  33. package/dist/src/utils/config.d.ts +10 -14
  34. package/dist/src/utils/config.js +17 -70
  35. package/dist/src/utils/deprecation.d.ts +1 -6
  36. package/dist/src/utils/deprecation.js +4 -23
  37. package/dist/src/utils/dev-server-ready-check.d.ts +48 -0
  38. package/dist/src/utils/dev-server-ready-check.js +339 -0
  39. package/dist/src/utils/dev-server-ready-signal.d.ts +29 -0
  40. package/dist/src/utils/dev-server-ready-signal.js +60 -0
  41. package/dist/src/utils/e2e-web-server-info-utils.d.ts +1 -1
  42. package/dist/src/utils/e2e-web-server-info-utils.js +2 -2
  43. package/dist/src/utils/generator-utils.d.ts +1 -2
  44. package/dist/src/utils/generator-utils.js +69 -185
  45. package/dist/src/utils/read-rspack-options.d.ts +1 -1
  46. package/dist/src/utils/read-rspack-options.js +4 -4
  47. package/dist/src/utils/with-nx.d.ts +5 -9
  48. package/dist/src/utils/with-nx.js +5 -32
  49. package/dist/src/utils/with-react.d.ts +5 -8
  50. package/dist/src/utils/with-react.js +5 -15
  51. package/dist/src/utils/with-web.d.ts +5 -8
  52. package/dist/src/utils/with-web.js +5 -44
  53. package/executors.json +0 -25
  54. package/migrations.json +13 -0
  55. package/package.json +39 -26
  56. package/dist/module-federation.d.ts +0 -4
  57. package/dist/module-federation.js +0 -9
  58. package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
  59. package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
  60. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -4
  61. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -19
  62. package/dist/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +0 -5
  63. package/dist/src/executors/module-federation-dev-server/lib/start-remotes.js +0 -33
  64. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -6
  65. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -74
  66. package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -25
  67. package/dist/src/executors/module-federation-dev-server/schema.json +0 -104
  68. package/dist/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +0 -2
  69. package/dist/src/executors/module-federation-ssr-dev-server/lib/index.js +0 -5
  70. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -4
  71. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -23
  72. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +0 -5
  73. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +0 -34
  74. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -5
  75. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -65
  76. package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -29
  77. package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -85
  78. package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +0 -12
  79. package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +0 -237
  80. package/dist/src/executors/module-federation-static-server/schema.d.ts +0 -3
  81. package/dist/src/executors/module-federation-static-server/schema.json +0 -16
  82. package/dist/src/executors/rspack/rspack.impl.d.ts +0 -7
  83. package/dist/src/executors/rspack/rspack.impl.js +0 -127
  84. package/dist/src/executors/rspack/schema.json +0 -410
  85. package/dist/src/generators/convert-webpack/lib/transform-cjs.d.ts +0 -2
  86. package/dist/src/generators/convert-webpack/lib/transform-cjs.js +0 -263
  87. package/dist/src/generators/convert-webpack/lib/transform-esm.d.ts +0 -2
  88. package/dist/src/generators/convert-webpack/lib/transform-esm.js +0 -263
  89. package/dist/src/utils/has-plugin.d.ts +0 -2
  90. package/dist/src/utils/has-plugin.js +0 -10
  91. package/dist/src/utils/module-federation-deprecation.d.ts +0 -6
  92. package/dist/src/utils/module-federation-deprecation.js +0 -30
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.NxAppRspackPlugin = void 0;
4
5
  const normalize_options_1 = require("../utils/plugins/normalize-options");
6
+ const dev_server_ready_signal_1 = require("../../utils/dev-server-ready-signal");
5
7
  const apply_base_config_1 = require("../utils/apply-base-config");
6
8
  const apply_web_config_1 = require("../utils/apply-web-config");
7
9
  /**
@@ -15,12 +17,15 @@ const apply_web_config_1 = require("../utils/apply-web-config");
15
17
  */
16
18
  class NxAppRspackPlugin {
17
19
  constructor(options = {}) {
20
+ this[_a] = true;
18
21
  // If we're building inferred targets, skip normalizing the build options
19
22
  if (!global.NX_GRAPH_CREATION) {
20
23
  this.options = (0, normalize_options_1.normalizeOptions)(options);
21
24
  }
22
25
  }
23
26
  apply(compiler) {
27
+ const { applyDevServerReadySignal } = require('../../utils/dev-server-ready-signal');
28
+ applyDevServerReadySignal(compiler);
24
29
  // Default's to web
25
30
  const target = this.options.target ?? compiler.options.target;
26
31
  this.options.outputPath ??= compiler.options.output?.path;
@@ -37,10 +42,13 @@ class NxAppRspackPlugin {
37
42
  useNormalizedEntry: true,
38
43
  compiler,
39
44
  });
45
+ compiler.context = compiler.options.context;
40
46
  if (compiler.options.target) {
41
47
  this.options.target = compiler.options.target;
42
48
  }
43
- if (this.options.target === 'web' || this.options.target === 'webworker') {
49
+ if (this.options.target === 'web' ||
50
+ this.options.target === 'webworker' ||
51
+ this.options.ssr) {
44
52
  (0, apply_web_config_1.applyWebConfig)(this.options, compiler.options, {
45
53
  useNormalizedEntry: true,
46
54
  compiler,
@@ -49,3 +57,4 @@ class NxAppRspackPlugin {
49
57
  }
50
58
  }
51
59
  exports.NxAppRspackPlugin = NxAppRspackPlugin;
60
+ _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");
@@ -124,6 +125,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
124
125
  ],
125
126
  outputs,
126
127
  };
128
+ const devServerReadyWhen = getDevServerReadyWhen(configFilePath, rspackOptions);
127
129
  targets[options.serveTargetName] = {
128
130
  continuous: true,
129
131
  inputs: [...buildInputs],
@@ -133,6 +135,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
133
135
  args: ['--node-env=development'],
134
136
  env,
135
137
  },
138
+ readyWhen: devServerReadyWhen,
136
139
  };
137
140
  targets[options.previewTargetName] = {
138
141
  continuous: true,
@@ -143,6 +146,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
143
146
  args: ['--node-env=production'],
144
147
  env,
145
148
  },
149
+ readyWhen: devServerReadyWhen,
146
150
  };
147
151
  targets[options.serveStaticTargetName] = {
148
152
  dependsOn: [`${options.buildTargetName}`],
@@ -153,6 +157,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
153
157
  buildTarget: options.buildTargetName,
154
158
  spa: true,
155
159
  },
160
+ readyWhen: { port: '{options.port}', host: '{options.host ?? localhost}' },
156
161
  };
157
162
  // for `convert-to-inferred` we need to leave the port undefined or the options will not match
158
163
  if (rspackConfig.devServer?.port && rspackConfig.devServer?.port !== 4200) {
@@ -212,3 +217,19 @@ function normalizeOutputPath(outputPath, projectRoot) {
212
217
  }
213
218
  }
214
219
  }
220
+ // A dev server whose config loads NxAppRspackPlugin or NxReadySignalPlugin reports
221
+ // when it listens. Otherwise the check reads the config when the task runs,
222
+ // with the task's env and options, and waits for the dev server's port.
223
+ function getDevServerReadyWhen(configFilePath, configs) {
224
+ // `rspack serve` starts one dev server, for the first config with devServer
225
+ const signals = (0, dev_server_ready_signal_1.sendsReadySignal)(configs.find((config) => config.devServer) ?? configs[0] ?? {});
226
+ return signals
227
+ ? { signal: true }
228
+ : {
229
+ // Unquoted: the plugin's glob fixes the file name. Quote it if it ever
230
+ // becomes user-chosen, since the shell expands $, backticks and %.
231
+ command: `node -e "require('@nx/rspack/ready-check').waitForDevServer(process.argv[1])" ${(0, path_1.basename)(configFilePath)}`,
232
+ // Each attempt loads the config
233
+ interval: 1000,
234
+ };
235
+ }
@@ -1,6 +1,6 @@
1
- import { ExecutorContext } from '@nx/devkit';
1
+ import type { ExecutorContext } from '@nx/devkit';
2
2
  import type { Configuration } from '@rspack/core';
3
- import { NormalizedRspackExecutorSchema } from '../executors/rspack/schema';
3
+ import type { NormalizedRspackExecutorSchema } from '../executors/rspack/schema';
4
4
  export declare const nxRspackComposablePlugin = "nxRspackComposablePlugin";
5
5
  export declare function isNxRspackComposablePlugin(a: unknown): a is AsyncNxComposableRspackPlugin;
6
6
  export interface NxRspackExecutionContext {
@@ -15,22 +15,18 @@ export interface AsyncNxComposableRspackPlugin {
15
15
  (config: Configuration, ctx: NxRspackExecutionContext): Configuration | Promise<Configuration>;
16
16
  }
17
17
  /**
18
- * @deprecated Will be removed in Nx v24. Use `NxAppRspackPlugin` from
19
- * `@nx/rspack/app-plugin` (or `NxReactRspackPlugin` from
20
- * `@nx/rspack/react-plugin`) in a standard rspack config and run
21
- * `nx g @nx/rspack:convert-to-inferred`. See
22
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
18
+ * @deprecated Use `NxAppRspackPlugin` from `@nx/rspack/app-plugin` (or `NxReactRspackPlugin`
19
+ * from `@nx/rspack/react-plugin`).
20
+ * This inert stub will be removed in Nx v25.
23
21
  */
24
- export declare function composePlugins(...plugins: (NxComposableRspackPlugin | AsyncNxComposableRspackPlugin | Promise<NxComposableRspackPlugin | AsyncNxComposableRspackPlugin>)[]): ((config: Configuration, ctx: NxRspackExecutionContext) => Promise<Configuration>) & {
22
+ export declare function composePlugins(..._plugins: (NxComposableRspackPlugin | AsyncNxComposableRspackPlugin | Promise<NxComposableRspackPlugin | AsyncNxComposableRspackPlugin>)[]): ((config?: Configuration, ctx?: NxRspackExecutionContext) => Promise<Configuration>) & {
25
23
  nxRspackComposablePlugin: boolean;
26
24
  };
27
25
  /**
28
- * @deprecated Will be removed in Nx v24. Use `NxAppRspackPlugin` from
29
- * `@nx/rspack/app-plugin` (or `NxReactRspackPlugin` from
30
- * `@nx/rspack/react-plugin`) in a standard rspack config and run
31
- * `nx g @nx/rspack:convert-to-inferred`. See
32
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
26
+ * @deprecated Use `NxAppRspackPlugin` from `@nx/rspack/app-plugin` (or `NxReactRspackPlugin`
27
+ * from `@nx/rspack/react-plugin`).
28
+ * This inert stub will be removed in Nx v25.
33
29
  */
34
- export declare function composePluginsSync(...plugins: NxComposableRspackPlugin[]): ((config: Configuration, ctx: NxRspackExecutionContext) => Configuration) & {
30
+ export declare function composePluginsSync(..._plugins: NxComposableRspackPlugin[]): ((config?: Configuration, ctx?: NxRspackExecutionContext) => Configuration) & {
35
31
  nxRspackComposablePlugin: boolean;
36
32
  };
@@ -4,86 +4,33 @@ exports.nxRspackComposablePlugin = void 0;
4
4
  exports.isNxRspackComposablePlugin = isNxRspackComposablePlugin;
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.nxRspackComposablePlugin = 'nxRspackComposablePlugin';
12
9
  function isNxRspackComposablePlugin(a) {
13
10
  return a?.[exports.nxRspackComposablePlugin] === 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 `NxAppRspackPlugin` from
17
- * `@nx/rspack/app-plugin` (or `NxReactRspackPlugin` from
18
- * `@nx/rspack/react-plugin`) in a standard rspack config and run
19
- * `nx g @nx/rspack:convert-to-inferred`. See
20
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
14
+ * @deprecated Use `NxAppRspackPlugin` from `@nx/rspack/app-plugin` (or `NxReactRspackPlugin`
15
+ * from `@nx/rspack/react-plugin`).
16
+ * This inert stub will be removed in Nx v25.
21
17
  */
22
- function composePlugins(...plugins) {
18
+ function composePlugins(..._plugins) {
23
19
  (0, deprecation_1.warnRspackComposeHelpersDeprecation)();
24
- return Object.assign(async function combined(config, ctx) {
25
- // Rspack may be calling us as a standard config function.
26
- // Build up Nx context from environment variables.
27
- // This is to enable `@nx/rspack/plugin` to work with existing projects.
28
- if (ctx['env']) {
29
- ensureNxRspackExecutionContext(ctx);
30
- // Build this from scratch since what rspack passes us is the env, not config,
31
- // and `withNX()` creates a new config object anyway.
32
- config = {};
33
- }
34
- for (const plugin of plugins) {
35
- const fn = await plugin;
36
- config = await fn(config, ctx);
37
- }
38
- return config;
39
- }, {
40
- [exports.nxRspackComposablePlugin]: true,
41
- });
20
+ return Object.assign(async (config = {}, ctx) => {
21
+ // Only the legacy Nx executor passes a config; CLIs pass (env, argv).
22
+ return ctx?.context && typeof ctx.context === 'object' ? config : {};
23
+ }, { [exports.nxRspackComposablePlugin]: true });
42
24
  }
43
25
  /**
44
- * @deprecated Will be removed in Nx v24. Use `NxAppRspackPlugin` from
45
- * `@nx/rspack/app-plugin` (or `NxReactRspackPlugin` from
46
- * `@nx/rspack/react-plugin`) in a standard rspack config and run
47
- * `nx g @nx/rspack:convert-to-inferred`. See
48
- * https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
26
+ * @deprecated Use `NxAppRspackPlugin` from `@nx/rspack/app-plugin` (or `NxReactRspackPlugin`
27
+ * from `@nx/rspack/react-plugin`).
28
+ * This inert stub will be removed in Nx v25.
49
29
  */
50
- function composePluginsSync(...plugins) {
30
+ function composePluginsSync(..._plugins) {
51
31
  (0, deprecation_1.warnRspackComposeHelpersDeprecation)();
52
- return Object.assign(function combined(config, ctx) {
53
- for (const plugin of plugins) {
54
- config = plugin(config, ctx);
55
- }
56
- return config;
57
- }, {
58
- [exports.nxRspackComposablePlugin]: true,
59
- });
60
- }
61
- function ensureNxRspackExecutionContext(ctx) {
62
- const projectName = process.env.NX_TASK_TARGET_PROJECT;
63
- const targetName = process.env.NX_TASK_TARGET_TARGET;
64
- const configurationName = process.env.NX_TASK_TARGET_CONFIGURATION;
65
- const projectGraph = (0, devkit_1.readCachedProjectGraph)();
66
- const projectNode = projectGraph.nodes[projectName];
67
- ctx.options ??= {
68
- root: devkit_1.workspaceRoot,
69
- projectRoot: projectNode.data.root,
70
- sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
71
- // These aren't actually needed since NxRspackPlugin and withNx both support them being undefined.
72
- assets: undefined,
73
- outputFileName: undefined,
74
- outputPath: undefined,
75
- rspackConfig: undefined,
76
- useTsconfigPaths: undefined,
77
- };
78
- ctx.context ??= {
79
- projectName,
80
- targetName,
81
- configurationName,
82
- projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
83
- nxJsonConfiguration: (0, internal_2.readNxJsonFromDisk)(devkit_1.workspaceRoot),
84
- cwd: process.cwd(),
85
- root: devkit_1.workspaceRoot,
86
- isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
87
- projectGraph,
88
- };
32
+ return Object.assign((config = {}, ctx) => {
33
+ // Only the legacy Nx executor passes a config; CLIs pass (env, argv).
34
+ return ctx?.context && typeof ctx.context === 'object' ? config : {};
35
+ }, { [exports.nxRspackComposablePlugin]: true });
89
36
  }
@@ -1,8 +1,3 @@
1
- export declare const RSPACK_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/rspack:rspack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
- export declare const RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/rspack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
3
- export declare function warnRspackExecutorDeprecation(): void;
4
- export declare function warnRspackDevServerExecutorDeprecation(): void;
5
- export declare function warnRspackExecutorGenerating(): void;
6
- export declare const RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The `composePlugins`, `withNx`, `withWeb`, and `withReact` config helpers from `@nx/rspack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/rspack:rspack` executor. Migrate to a standard rspack config that uses `NxAppRspackPlugin` (from `@nx/rspack/app-plugin`) or `NxReactRspackPlugin` (from `@nx/rspack/react-plugin`) under the inferred `@nx/rspack/plugin` by running `nx g @nx/rspack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
1
+ export declare const RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The compose config helpers from `@nx/rspack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard rspack config using `NxAppRspackPlugin` from `@nx/rspack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.";
7
2
  export declare function suppressRspackComposeHelperWarnings<T>(fn: () => T): T;
8
3
  export declare function warnRspackComposeHelpersDeprecation(): void;
@@ -1,31 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
- exports.warnRspackExecutorDeprecation = warnRspackExecutorDeprecation;
5
- exports.warnRspackDevServerExecutorDeprecation = warnRspackDevServerExecutorDeprecation;
6
- exports.warnRspackExecutorGenerating = warnRspackExecutorGenerating;
3
+ exports.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = void 0;
7
4
  exports.suppressRspackComposeHelperWarnings = suppressRspackComposeHelperWarnings;
8
5
  exports.warnRspackComposeHelpersDeprecation = warnRspackComposeHelpersDeprecation;
9
6
  const devkit_1 = require("@nx/devkit");
10
- // TODO(v24): Remove the @nx/rspack:rspack and @nx/rspack:dev-server
11
- // executors. The inferred plugin (@nx/rspack/plugin) and the
12
- // convert-to-inferred generator stay supported.
13
- exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/rspack:rspack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
14
- exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/rspack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
15
- function warnRspackExecutorDeprecation() {
16
- devkit_1.logger.warn(exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE);
17
- }
18
- function warnRspackDevServerExecutorDeprecation() {
19
- devkit_1.logger.warn(exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
20
- }
21
- function warnRspackExecutorGenerating() {
22
- devkit_1.logger.warn('Generating targets that use the deprecated `@nx/rspack:rspack` and `@nx/rspack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` next to migrate these targets to the `@nx/rspack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
23
- }
24
- // TODO(v24): Remove the composePlugins/withNx/withWeb/withReact config helpers.
25
- // They emit an Nx-specific config function that only runs under the
26
- // @nx/rspack:rspack executor; the inferred @nx/rspack/plugin works with standard
27
- // rspack configs built around NxAppRspackPlugin/NxReactRspackPlugin instead.
28
- exports.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The `composePlugins`, `withNx`, `withWeb`, and `withReact` config helpers from `@nx/rspack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/rspack:rspack` executor. Migrate to a standard rspack config that uses `NxAppRspackPlugin` (from `@nx/rspack/app-plugin`) or `NxReactRspackPlugin` (from `@nx/rspack/react-plugin`) under the inferred `@nx/rspack/plugin` by running `nx g @nx/rspack: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.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The compose config helpers from `@nx/rspack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard rspack config using `NxAppRspackPlugin` from `@nx/rspack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.';
29
10
  let composeHelpersWarned = false;
30
11
  let suppressDepth = 0;
31
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
+ nodeEnv?: string;
5
+ config?: string;
6
+ configNames: string[];
7
+ env: string[];
8
+ }
9
+ /**
10
+ * The flags `rspack serve` takes from the target's options. run-commands
11
+ * forwards named options, then `args`, then overrides, and a later source wins.
12
+ */
13
+ export declare function parseServeFlags(options: Record<string, unknown>): ServeFlags;
14
+ /**
15
+ * The `argv` @rspack/cli passes to a function config: its parsed options,
16
+ * with `env` set by the caller. Values follow its mri parser: a numeric value
17
+ * is a number, a bare flag is true, `--no-x` is false, a repeated flag is an
18
+ * array.
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 `rspack serve` does, and waits for the dev server it
46
+ * starts.
47
+ */
48
+ export declare function waitForRspackDevServer(configPath: string): Promise<void>;