@nx/rspack
Version:
51 lines (50 loc) • 3.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
exports.warnRspackExecutorDeprecation = warnRspackExecutorDeprecation;
exports.warnRspackDevServerExecutorDeprecation = warnRspackDevServerExecutorDeprecation;
exports.warnRspackExecutorGenerating = warnRspackExecutorGenerating;
exports.suppressRspackComposeHelperWarnings = suppressRspackComposeHelperWarnings;
exports.warnRspackComposeHelpersDeprecation = warnRspackComposeHelpersDeprecation;
const devkit_1 = require("@nx/devkit");
// TODO(v24): Remove the @nx/rspack:rspack and @nx/rspack:dev-server
// executors. The inferred plugin (@nx/rspack/plugin) and the
// convert-to-inferred generator stay supported.
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.';
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.';
function warnRspackExecutorDeprecation() {
devkit_1.logger.warn(exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE);
}
function warnRspackDevServerExecutorDeprecation() {
devkit_1.logger.warn(exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
}
function warnRspackExecutorGenerating() {
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.');
}
// TODO(v24): Remove the composePlugins/withNx/withWeb/withReact config helpers.
// They emit an Nx-specific config function that only runs under the
// @nx/rspack:rspack executor; the inferred @nx/rspack/plugin works with standard
// rspack configs built around NxAppRspackPlugin/NxReactRspackPlugin instead.
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.';
let composeHelpersWarned = false;
let suppressDepth = 0;
// Nx-internal entry points compose these helpers themselves (e.g. the rspack
// executor). They wrap their synchronous composition in this so the warning
// fires only for user-authored configs.
function suppressRspackComposeHelperWarnings(fn) {
suppressDepth++;
try {
return fn();
}
finally {
suppressDepth--;
}
}
// Warn once per process so a `composePlugins(withNx(), withReact())` chain logs
// a single line, not one per helper, and HMR reloads don't repeat it.
function warnRspackComposeHelpersDeprecation() {
if (suppressDepth > 0 || composeHelpersWarned)
return;
composeHelpersWarned = true;
devkit_1.logger.warn(exports.RSPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE);
}