UNPKG

@nx/vite

Version:

The Nx Plugin for building and testing applications using Vite

57 lines (56 loc) 4.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE = exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE = exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0; exports.warnViteBuildExecutorDeprecation = warnViteBuildExecutorDeprecation; exports.warnViteDevServerExecutorDeprecation = warnViteDevServerExecutorDeprecation; exports.warnVitePreviewServerExecutorDeprecation = warnVitePreviewServerExecutorDeprecation; exports.warnViteExecutorGenerating = warnViteExecutorGenerating; exports.warnNxViteTsPathsDeprecation = warnNxViteTsPathsDeprecation; exports.warnNxCopyAssetsPluginDeprecation = warnNxCopyAssetsPluginDeprecation; const devkit_1 = require("@nx/devkit"); // TODO(v24): Remove the @nx/vite:build, @nx/vite:dev-server, and // @nx/vite:preview-server executors. The inferred plugin (@nx/vite/plugin) // and the convert-to-inferred generator stay supported. (`@nx/vite:test` // is being deprecated in a separate change for the test-runner batch.) exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/vite:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.'; exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/vite:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.'; exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/vite:preview-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.'; function warnViteBuildExecutorDeprecation() { devkit_1.logger.warn(exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE); } function warnViteDevServerExecutorDeprecation() { devkit_1.logger.warn(exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE); } function warnVitePreviewServerExecutorDeprecation() { devkit_1.logger.warn(exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE); } // Fired when the @nx/vite:configuration generator is about to generate // targets that use the deprecated executors — i.e. when @nx/vite/plugin // isn't registered in nx.json. Surfaces the deprecation at generation time // rather than only when the user later runs the generated targets. function warnViteExecutorGenerating() { devkit_1.logger.warn('Generating targets that use the deprecated `@nx/vite:build`, `@nx/vite:dev-server`, and `@nx/vite:preview-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` next to migrate these targets to the `@nx/vite/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 `nxViteTsPaths` and `nxCopyAssetsPlugin` helpers. // The inferred `@nx/vite/plugin` already ensures projects extend the base // tsconfig, so the community `vite-tsconfig-paths` package handles path // resolution end-to-end. Asset copying is covered by Vite's native // `publicDir` option or the `vite-plugin-static-copy` package. exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE = 'The `nxViteTsPaths` plugin from `@nx/vite/plugins/nx-tsconfig-paths.plugin` is deprecated and will be removed in Nx v24. Replace it with `tsconfigPaths()` from the `vite-tsconfig-paths` package. See https://nx.dev/docs/technologies/build-tools/vite/guides/configure-vite for details.'; exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE = "The `nxCopyAssetsPlugin` plugin from `@nx/vite/plugins/nx-copy-assets.plugin` is deprecated and will be removed in Nx v24. Use Vite's native `publicDir` option or the `vite-plugin-static-copy` package instead. See https://nx.dev/docs/technologies/build-tools/vite/guides/configure-vite for details."; let nxViteTsPathsWarned = false; let nxCopyAssetsPluginWarned = false; // Warn-once per process so users don't see the message repeated on every // dev-server HMR reload or vitest run within the same Node process. function warnNxViteTsPathsDeprecation() { if (nxViteTsPathsWarned) return; nxViteTsPathsWarned = true; devkit_1.logger.warn(exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE); } function warnNxCopyAssetsPluginDeprecation() { if (nxCopyAssetsPluginWarned) return; nxCopyAssetsPluginWarned = true; devkit_1.logger.warn(exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE); }