@nx/next 23.0.0-beta.21 → 23.0.0-beta.23
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.
- package/package.json +10 -10
- package/plugins/with-nx.d.ts.map +1 -1
- package/plugins/with-nx.js +7 -0
- package/src/generators/application/files/common/next.config.js__tmpl__ +12 -1
- package/src/plugins/plugin.d.ts +3 -3
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/utils/compose-plugins.d.ts.map +1 -1
- package/src/utils/compose-plugins.js +2 -0
- package/src/utils/deprecation.d.ts +7 -0
- package/src/utils/deprecation.d.ts.map +1 -1
- package/src/utils/deprecation.js +36 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"next": ">=14.0.0 <17.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "23.0.0-beta.
|
|
39
|
+
"@nx/devkit": "23.0.0-beta.23",
|
|
40
40
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
41
41
|
"@svgr/webpack": "^8.0.1",
|
|
42
42
|
"copy-webpack-plugin": "^14.0.0",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"semver": "^7.6.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "23.0.0-beta.
|
|
48
|
-
"@nx/eslint": "23.0.0-beta.
|
|
49
|
-
"@nx/react": "23.0.0-beta.
|
|
50
|
-
"@nx/web": "23.0.0-beta.
|
|
51
|
-
"@nx/webpack": "23.0.0-beta.
|
|
47
|
+
"@nx/js": "23.0.0-beta.23",
|
|
48
|
+
"@nx/eslint": "23.0.0-beta.23",
|
|
49
|
+
"@nx/react": "23.0.0-beta.23",
|
|
50
|
+
"@nx/web": "23.0.0-beta.23",
|
|
51
|
+
"@nx/webpack": "23.0.0-beta.23",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~6.2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@nx/cypress": "23.0.0-beta.
|
|
56
|
-
"@nx/playwright": "23.0.0-beta.
|
|
57
|
-
"nx": "23.0.0-beta.
|
|
55
|
+
"@nx/cypress": "23.0.0-beta.23",
|
|
56
|
+
"@nx/playwright": "23.0.0-beta.23",
|
|
57
|
+
"nx": "23.0.0-beta.23"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
package/plugins/with-nx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,CAAC,EAAE;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,gBAAgB,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B,kBAAkB,CAChC,IAAI,EAAE,uBAAuB,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,IAAI,GAAG,MAAM,CAcf;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,QAM3D;AASD,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/plugins/with-nx.js
CHANGED
|
@@ -113,6 +113,13 @@ function withNx(_nextConfig = {}, context = getWithNxContext()) {
|
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
const { readCachedProjectGraph, joinPathFragments, offsetFromRoot, workspaceRoot, } = require('@nx/devkit');
|
|
116
|
+
// Resolved from the workspace (not bundled) so the deprecation warning is
|
|
117
|
+
// not inlined into production builds. Reached only on the active Nx-task
|
|
118
|
+
// path; the production-server phase returns above.
|
|
119
|
+
const { warnWithNxDeprecation } = require(require.resolve('@nx/next/src/utils/deprecation', {
|
|
120
|
+
paths: [workspaceRoot],
|
|
121
|
+
}));
|
|
122
|
+
warnWithNxDeprecation();
|
|
116
123
|
// Since this is invoked by an Nx task, the graph is already cached.
|
|
117
124
|
const graph = readCachedProjectGraph();
|
|
118
125
|
const originalTarget = {
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
//@ts-check
|
|
2
|
+
<% if (addPlugin) { -%>
|
|
3
|
+
|
|
4
|
+
/** @type {import('next').NextConfig} */
|
|
5
|
+
const nextConfig = {
|
|
6
|
+
// Next.js options go here
|
|
7
|
+
// See: https://nextjs.org/docs/app/api-reference/config/next-config-js
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
module.exports = nextConfig;
|
|
11
|
+
<% } else { -%>
|
|
2
12
|
|
|
3
13
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
14
|
const { composePlugins, withNx } = require('@nx/next');
|
|
@@ -8,7 +18,7 @@ const { composePlugins, withNx } = require('@nx/next');
|
|
|
8
18
|
**/
|
|
9
19
|
const nextConfig = {
|
|
10
20
|
// Use this to set Nx-specific options
|
|
11
|
-
// See: https://nx.dev/
|
|
21
|
+
// See: https://nx.dev/docs/technologies/react/next/Guides/next-config-setup
|
|
12
22
|
nx: {},
|
|
13
23
|
};
|
|
14
24
|
|
|
@@ -18,3 +28,4 @@ const plugins = [
|
|
|
18
28
|
];
|
|
19
29
|
|
|
20
30
|
module.exports = composePlugins(...plugins)(nextConfig);
|
|
31
|
+
<% } -%>
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateDependencies,
|
|
1
|
+
import { CreateDependencies, CreateNodes } from '@nx/devkit';
|
|
2
2
|
export interface NextPluginOptions {
|
|
3
3
|
buildTargetName?: string;
|
|
4
4
|
devTargetName?: string;
|
|
@@ -14,6 +14,6 @@ export interface NextPluginOptions {
|
|
|
14
14
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
15
15
|
*/
|
|
16
16
|
export declare const createDependencies: CreateDependencies;
|
|
17
|
-
export declare const createNodes:
|
|
18
|
-
export declare const createNodesV2:
|
|
17
|
+
export declare const createNodes: CreateNodes<NextPluginOptions>;
|
|
18
|
+
export declare const createNodesV2: CreateNodes<NextPluginOptions>;
|
|
19
19
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,kBAAkB,EAIlB,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,kBAAkB,EAIlB,WAAW,EAKZ,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,iBAAiB,CA6DtD,CAAC;AAEF,eAAO,MAAM,aAAa,gCAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-plugins.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/compose-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"compose-plugins.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/compose-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAGlB,wBAAgB,cAAc,CAC5B,GAAG,OAAO,EAAE,CAAC,UAAU,GAAG,6BAA6B,CAAC,EAAE,GACzD,CAAC,UAAU,EAAE,UAAU,KAAK,YAAY,CAqB1C"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.composePlugins = composePlugins;
|
|
4
|
+
const deprecation_1 = require("./deprecation");
|
|
4
5
|
function composePlugins(...plugins) {
|
|
5
6
|
return function (baseConfig) {
|
|
6
7
|
return async function combined(phase, context) {
|
|
8
|
+
(0, deprecation_1.warnComposePluginsDeprecation)(phase);
|
|
7
9
|
let config = baseConfig;
|
|
8
10
|
for (const plugin of plugins) {
|
|
9
11
|
const fn = await plugin;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
var NX_GRAPH_CREATION: boolean;
|
|
3
|
+
}
|
|
1
4
|
export declare const NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/next:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
5
|
export declare const NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/next:server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
6
|
export declare function warnNextBuildExecutorDeprecation(): void;
|
|
4
7
|
export declare function warnNextServerExecutorDeprecation(): void;
|
|
5
8
|
export declare function warnNextExecutorGenerating(): void;
|
|
9
|
+
export declare const WITHNX_DEPRECATION_MESSAGE: string;
|
|
10
|
+
export declare const COMPOSE_PLUGINS_DEPRECATION_MESSAGE: string;
|
|
11
|
+
export declare function warnWithNxDeprecation(): void;
|
|
12
|
+
export declare function warnComposePluginsDeprecation(phase: string): void;
|
|
6
13
|
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/deprecation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/deprecation.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IAGb,IAAI,iBAAiB,EAAE,OAAO,CAAC;CAChC;AAKD,eAAO,MAAM,uCAAuC,4PACuM,CAAC;AAE5P,eAAO,MAAM,wCAAwC,6PACuM,CAAC;AAE7P,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAMD,wBAAgB,0BAA0B,IAAI,IAAI,CAIjD;AAKD,eAAO,MAAM,0BAA0B,QAG+D,CAAC;AAEvG,eAAO,MAAM,mCAAmC,QAGsD,CAAC;AAGvG,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAOD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAYjE"}
|
package/src/utils/deprecation.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
3
|
+
exports.COMPOSE_PLUGINS_DEPRECATION_MESSAGE = exports.WITHNX_DEPRECATION_MESSAGE = exports.NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
4
|
exports.warnNextBuildExecutorDeprecation = warnNextBuildExecutorDeprecation;
|
|
5
5
|
exports.warnNextServerExecutorDeprecation = warnNextServerExecutorDeprecation;
|
|
6
6
|
exports.warnNextExecutorGenerating = warnNextExecutorGenerating;
|
|
7
|
+
exports.warnWithNxDeprecation = warnWithNxDeprecation;
|
|
8
|
+
exports.warnComposePluginsDeprecation = warnComposePluginsDeprecation;
|
|
7
9
|
const devkit_1 = require("@nx/devkit");
|
|
8
10
|
// TODO(v24): Remove the @nx/next:build and @nx/next:server executors. The
|
|
9
11
|
// inferred plugin (@nx/next/plugin) and the convert-to-inferred generator
|
|
@@ -23,3 +25,36 @@ function warnNextServerExecutorDeprecation() {
|
|
|
23
25
|
function warnNextExecutorGenerating() {
|
|
24
26
|
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/next:build` and `@nx/next:server` executors. These executors will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` next to migrate these targets to the `@nx/next/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
25
27
|
}
|
|
28
|
+
// TODO(v24): Remove the `withNx`/`composePlugins` config wrappers. Modern
|
|
29
|
+
// workspaces resolve libraries via package manager workspaces and Next.js
|
|
30
|
+
// transpiles workspace source automatically, so a plain `next.config.js` works.
|
|
31
|
+
exports.WITHNX_DEPRECATION_MESSAGE = '[Nx] `withNx()` from `@nx/next` is deprecated and will be removed in Nx v24. ' +
|
|
32
|
+
'A plain `next.config.js` is now the recommended pattern; Next.js transpiles workspace libraries automatically. ' +
|
|
33
|
+
'See https://nx.dev/docs/technologies/react/next/Guides/next-config-setup for the migration recipe.';
|
|
34
|
+
exports.COMPOSE_PLUGINS_DEPRECATION_MESSAGE = '[Nx] `composePlugins()` from `@nx/next` is deprecated and will be removed in Nx v24. ' +
|
|
35
|
+
'Compose Next.js plugins directly in your `next.config.js` and remove the `@nx/next` import. ' +
|
|
36
|
+
'See https://nx.dev/docs/technologies/react/next/Guides/next-config-setup for the migration recipe.';
|
|
37
|
+
let warnedWithNx = false;
|
|
38
|
+
function warnWithNxDeprecation() {
|
|
39
|
+
if (warnedWithNx)
|
|
40
|
+
return;
|
|
41
|
+
warnedWithNx = true;
|
|
42
|
+
devkit_1.logger.warn(exports.WITHNX_DEPRECATION_MESSAGE);
|
|
43
|
+
}
|
|
44
|
+
let warnedComposePlugins = false;
|
|
45
|
+
// Only nudge during interactive Nx task execution: skip production server start
|
|
46
|
+
// (PHASE_PRODUCTION_SERVER), internal graph-creation passes, and direct
|
|
47
|
+
// (non-Nx) `next` invocations. `next/constants` is required lazily so the helper
|
|
48
|
+
// stays loadable in contexts where Next is not present.
|
|
49
|
+
function warnComposePluginsDeprecation(phase) {
|
|
50
|
+
if (warnedComposePlugins)
|
|
51
|
+
return;
|
|
52
|
+
const { PHASE_PRODUCTION_SERVER } = require('next/constants');
|
|
53
|
+
if (phase === PHASE_PRODUCTION_SERVER ||
|
|
54
|
+
global.NX_GRAPH_CREATION ||
|
|
55
|
+
!process.env.NX_TASK_TARGET_TARGET) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
warnedComposePlugins = true;
|
|
59
|
+
devkit_1.logger.warn(exports.COMPOSE_PLUGINS_DEPRECATION_MESSAGE);
|
|
60
|
+
}
|