Skip to content

Commit 81892b5

Browse files
authored
feat(misc)!: handle v20 deprecations in plugins (#28222)
This PR removes these from v20 since they were deprecated and slated for removal: - `executeWebpackDevServerBuilder` export from `@nx/angular/executors`, users should use `executeDevServerBuilder` - `withStylus` util from `@nx/next/plugins/with-stylus` since it was deprecated in v17 and has just throw an error that users need to use SASS with Next.js The `getRollupOptions` function from `@nx/react/plugins/bundle-rollup` has been deprecated as mention previously and slated for removal in v22. New users are using inferred targets from Rollup, and existing projects using this module should run `nx g @nx/rollup:convert-to-inferred` or manually update rollup config to use `withNx` function. Also, bumped some deprecation for later in v21: - Remove inline builds from tsc/swc - Changes to SVGR to align with Webpack v5 (e.g. `import ReactComponent from './img.svg?svgr'`) - Remove `isolatedConfig` from Webpack executor -- requires a migration that extracts to a standard webpack config just in case (different from the original one that extracts to `withNx`) The ESLint TODOs were rescoped to `TODO(eslint)` and we'll look at it in further flat config work rather than tying it to an Nx release. <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent 69109e4 commit 81892b5

File tree

17 files changed

+22
-49
lines changed

17 files changed

+22
-49
lines changed

docs/shared/mental-model/large-tasks.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18495,11 +18495,6 @@
1849518495
"hash": "d750a6f13f1172e9c033370ead717b3f16d9f93b",
1849618496
"deps": ["npm:next", "devkit", "npm:@nrwl/next"]
1849718497
},
18498-
{
18499-
"file": "packages/next/plugins/with-stylus.ts",
18500-
"hash": "f3a6bbd478d02c0e9940e4ebe3ab662456b53ebe",
18501-
"deps": ["npm:webpack-merge", "npm:next"]
18502-
},
1850318498
{
1850418499
"file": "packages/next/project.json",
1850518500
"hash": "171f3c8158b2682525ffb65dac39edf04578460c"

packages/angular/executors.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,4 @@ export * from './src/executors/application/application.impl';
99
export * from './src/executors/extract-i18n/extract-i18n.impl';
1010
export * from './src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl';
1111

12-
import { executeDevServerBuilder } from './src/builders/dev-server/dev-server.impl';
13-
14-
export {
15-
// TODO(v20): remove this alias
16-
/**
17-
* @deprecated Use executeDevServerBuilder instead. It will be removed in Nx v20.
18-
*/
19-
executeDevServerBuilder as executeWebpackDevServerBuilder,
20-
executeDevServerBuilder,
21-
};
12+
export { executeDevServerBuilder } from './src/builders/dev-server/dev-server.impl';

packages/eslint-plugin/src/configs/javascript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default {
5555
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
5656
* changed how configurations are defined.
5757
*
58-
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
58+
* TODO(eslint): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
5959
*/
6060
'@typescript-eslint/no-non-null-assertion': 'warn',
6161
'@typescript-eslint/adjacent-overload-signatures': 'error',
@@ -70,7 +70,7 @@ export default {
7070
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
7171
* this rule would have created a lot of noise, so we are disabling it by default for now.
7272
*
73-
* TODO(v20): we should make this part of what we re-evaluate in v20
73+
* TODO(eslint): we should make this part of what we re-evaluate in v20
7474
*/
7575
'@typescript-eslint/no-require-imports': 'off',
7676
},

packages/eslint-plugin/src/configs/typescript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default {
3838
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
3939
* changed how configurations are defined.
4040
*
41-
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
41+
* TODO(eslint): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
4242
*/
4343
'@typescript-eslint/no-non-null-assertion': 'warn',
4444
'@typescript-eslint/adjacent-overload-signatures': 'error',
@@ -53,7 +53,7 @@ export default {
5353
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
5454
* this rule would have created a lot of noise, so we are disabling it by default for now.
5555
*
56-
* TODO(v20): we should make this part of what we re-evaluate in v20
56+
* TODO(eslint): we should make this part of what we re-evaluate in v20
5757
*/
5858
'@typescript-eslint/no-require-imports': 'off',
5959
},

packages/eslint-plugin/src/flat-configs/javascript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default tseslint.config(
5959
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
6060
* changed how configurations are defined.
6161
*
62-
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
62+
* TODO(eslint): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
6363
*/
6464
'@typescript-eslint/no-non-null-assertion': 'warn',
6565
'@typescript-eslint/adjacent-overload-signatures': 'error',
@@ -74,7 +74,7 @@ export default tseslint.config(
7474
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
7575
* this rule would have created a lot of noise, so we are disabling it by default for now.
7676
*
77-
* TODO(v20): we should make this part of what we re-evaluate in v20
77+
* TODO(eslint): we should make this part of what we re-evaluate in v20
7878
*/
7979
'@typescript-eslint/no-require-imports': 'off',
8080
},

packages/eslint-plugin/src/flat-configs/typescript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default tseslint.config(
4343
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
4444
* changed how configurations are defined.
4545
*
46-
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
46+
* TODO(eslint): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
4747
*/
4848
'@typescript-eslint/no-non-null-assertion': 'warn',
4949
'@typescript-eslint/adjacent-overload-signatures': 'error',
@@ -58,7 +58,7 @@ export default tseslint.config(
5858
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
5959
* this rule would have created a lot of noise, so we are disabling it by default for now.
6060
*
61-
* TODO(v20): we should make this part of what we re-evaluate in v20
61+
* TODO(eslint): we should make this part of what we re-evaluate in v20
6262
*/
6363
'@typescript-eslint/no-require-imports': 'off',
6464
},

packages/js/babel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = function (api: any, options: NxWebBabelPresetOptions = {}) {
3737

3838
// Determine settings for `@babel//babel-plugin-transform-class-properties`,
3939
// so that we can sync the `loose` option with `@babel/preset-env`.
40-
// TODO(v20): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
40+
// TODO(v21): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
4141
const loose = options.classProperties?.loose ?? options.loose ?? true;
4242
if (options.classProperties) {
4343
logger.warn(

packages/js/src/utils/schema.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ export interface NormalizedSwcExecutorOptions
5454
swcCliOptions: SwcCliOptions;
5555
tmpSwcrcPath: string;
5656
sourceRoot?: string;
57-
// TODO(v20): remove inline feature
57+
// TODO(v21): remove inline feature
5858
inline?: boolean;
5959
}

packages/js/src/utils/swc/compile-swc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function getSwcCmd(
2121
) {
2222
const swcCLI = require.resolve('@swc/cli/bin/swc.js');
2323
let inputDir: string;
24-
// TODO(v20): remove inline feature
24+
// TODO(v21): remove inline feature
2525
if (inline) {
2626
inputDir = originalProjectRoot.split('/')[0];
2727
} else {

packages/next/plugins/with-nx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export function getNextConfig(
363363

364364
const svgrOptions =
365365
typeof nx?.svgr === 'object' ? nx.svgr : defaultSvgrOptions;
366-
// TODO(v20): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
366+
// TODO(v21): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
367367
// It should be:
368368
// use: [{
369369
// test: /\.svg$/i,

packages/next/plugins/with-stylus.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/react/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NxReactWebpackPlugin as _NxReactWebpackPlugin } from './plugins/nx-react-webpack-plugin/nx-react-webpack-plugin';
22

3-
// TODO(v20): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
3+
// TODO(v21): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
44
/** @deprecated Use '@nx/react/webpack-plugin' instead. */
55
export const NxReactWebpackPlugin = _NxReactWebpackPlugin;
66

packages/react/plugins/bundle-rollup.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as rollup from 'rollup';
22

3-
// TODO(v20): This should be deprecated and removed in v22.
3+
// TODO(v22): Remove this in Nx 22 and migrate to explicit rollup.config.js files.
4+
/**
5+
* @deprecated Use `withNx` function from `@nx/rollup/with-nx` in your rollup.config.js file instead. Use `nx g @nx/rollup:convert-to-inferred` to generate the rollup.config.js file if it does not exist.
6+
*/
47
function getRollupOptions(options: rollup.RollupOptions) {
58
const extraGlobals = {
69
react: 'React',

packages/react/plugins/component-testing/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function buildTargetWebpack(
283283

284284
return async () => {
285285
customWebpack = await customWebpack;
286-
// TODO(v20): Component testing need to be agnostic of the underlying executor. With Crystal, we're not using `@nx/webpack:webpack` by default.
286+
// TODO(v21): Component testing need to be agnostic of the underlying executor. With Crystal, we're not using `@nx/webpack:webpack` by default.
287287
// We need to decouple CT from the build target of the app, we just care about bundler config (e.g. webpack.config.js).
288288
// The generated setup should support both Webpack and Vite as documented here: https://docs.cypress.io/guides/component-testing/react/overview
289289
// Related issue: https://github.com/nrwl/nx/issues/21546

packages/react/plugins/nx-react-webpack-plugin/lib/apply-react-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function applyReactConfig(
2121
const svgrOptions =
2222
typeof options.svgr === 'object' ? options.svgr : defaultSvgrOptions;
2323

24-
// TODO(v20): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
24+
// TODO(v21): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
2525
// It should be:
2626
// use: [{
2727
// test: /\.svg$/i,

packages/webpack/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export {
1414
/** @deprecated Use `configurationGenerator` instead. */
1515
export const webpackProjectGenerator = configurationGenerator;
1616

17-
// TODO(v20): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
17+
// TODO(v21): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
1818
/** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead. */
1919
export const NxWebpackPlugin = NxAppWebpackPlugin;
2020
/** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */

packages/webpack/src/executors/webpack/schema.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface WebpackExecutorOptions {
4747
extractLicenses?: boolean;
4848
fileReplacements?: FileReplacement[];
4949
generatePackageJson?: boolean;
50-
// TODO(v20): Remove this option
50+
// TODO(v21): Remove this option
5151
/** @deprecated set webpackConfig and provide an explicit webpack.config.js file (See: https://nx.dev/recipes/webpack/webpack-config-setup) */
5252
isolatedConfig?: boolean;
5353
standardWebpackConfigFunction?: boolean;

0 commit comments

Comments
 (0)