@nx/next 23.0.0 → 23.1.0-beta.1

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/README.md CHANGED
@@ -7,13 +7,12 @@
7
7
 
8
8
  <div style="text-align: center;">
9
9
 
10
- [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
10
  [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
11
  [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
13
12
  [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
13
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
- [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
14
  [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
15
+ [![Nx Sandboxing](https://staging.nx.app/workspaces/62d013ea0852fe0a2df74438/sandbox-badge.svg)](https://nx.dev/docs/features/ci-features/sandboxing)
17
16
 
18
17
  </div>
19
18
 
@@ -1,3 +1,4 @@
1
+ /// <reference types="@nx/next/typings/style.d.ts" />
1
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
3
  declare module '*.svg' {
3
4
  const content: any;
@@ -29,6 +29,7 @@
29
29
  "<%= layoutTypeSrcPath %>",
30
30
  "<%= layoutTypeDistPath %>",
31
31
  <% } %>
32
+ "index.d.ts",
32
33
  "next-env.d.ts"
33
34
  ],
34
35
  "exclude": ["node_modules", "jest.config.ts", "jest.config.cts", "<%= rootPath %>**/*.spec.ts", "<%= rootPath %>**/*.test.ts"]
@@ -0,0 +1,57 @@
1
+ # Next.js 14 -> 15 Migration Instructions for LLM
2
+
3
+ Migrate the Nx workspace's Next.js projects from 14 to 15. Run the codemod first, fix the rest by hand, build after each project.
4
+
5
+ ## Step 1: Codemod
6
+
7
+ ```bash
8
+ npx @next/codemod@canary upgrade 15
9
+ ```
10
+
11
+ Pin to `15` (not `latest` - that now resolves to 16). The `@canary` tag is what Next ships the upgrade codemod on. Handles most async-API rewrites. Review the diff.
12
+
13
+ ## Step 2: React 19 (App Router only)
14
+
15
+ Next 15 App Router requires React 19. Page Router can stay on React 18. For App Router projects, also run the React 18 -> 19 migration.
16
+
17
+ ## Step 3: Async request APIs (main breaking change)
18
+
19
+ `cookies`, `headers`, `draftMode`, `params`, `searchParams` are now async. Codemod covers most; fix leftovers.
20
+
21
+ ```tsx
22
+ // before
23
+ const { slug } = params;
24
+ // after
25
+ const { slug } = await props.params;
26
+ ```
27
+
28
+ Make the component / handler `async` and `await` the value.
29
+
30
+ App Router only - Pages Router `getServerSideProps` / `getStaticProps` / `getStaticPaths` `context.params` is NOT async; leave it unchanged.
31
+
32
+ ## Step 4: Caching defaults changed
33
+
34
+ No longer cached by default: `fetch`, GET route handlers, client navigations. Re-add caching where you relied on it.
35
+
36
+ - `fetch(url, { cache: 'force-cache' })`
37
+ - Route handler: `export const dynamic = 'force-static'`
38
+
39
+ ## Step 5: Misc
40
+
41
+ - `@next/font` removed -> import from `next/font`.
42
+ - Route `runtime: 'experimental-edge'` -> `runtime: 'edge'`.
43
+ - `next.config` renames: `experimental.bundlePagesExternals` -> top-level `bundlePagesRouterDependencies`; `experimental.serverComponentsExternalPackages` -> top-level `serverExternalPackages`.
44
+ - `NextRequest.geo` / `request.ip` removed (e.g. in middleware) -> read from headers (`x-forwarded-for`, platform geo headers).
45
+
46
+ ## Validate
47
+
48
+ ```bash
49
+ nx run PROJECT:build
50
+ nx affected -t build,lint,test
51
+ ```
52
+
53
+ ## Notes for LLM
54
+
55
+ - Codemod first, then manual.
56
+ - One project at a time, build after each.
57
+ - Skip Step 2 for Page Router projects.
@@ -0,0 +1,33 @@
1
+ #### Upgrade Next.js 14 to 15
2
+
3
+ Bumps Next.js from 14 to 15 (and `eslint-config-next` to match). The main breaking change is that the request APIs (`params`, `searchParams`, `cookies`, `headers`, `draftMode`) are now asynchronous. App Router projects also require React 19; Page Router projects can stay on React 18. Read more in the [Next.js 15 upgrade guide](https://nextjs.org/docs/app/guides/upgrading/version-15).
4
+
5
+ The paired AI instructions migration walks an agent through the full set of changes. The common ones are shown below.
6
+
7
+ #### Examples
8
+
9
+ ##### Before
10
+
11
+ ```tsx title="app/blog/[slug]/page.tsx"
12
+ export default function Page({ params, searchParams }) {
13
+ const { slug } = params;
14
+ const query = searchParams.q;
15
+ return <h1>{slug}</h1>;
16
+ }
17
+ ```
18
+
19
+ ##### After
20
+
21
+ ```tsx title="app/blog/[slug]/page.tsx"
22
+ export default async function Page(props) {
23
+ const { slug } = await props.params;
24
+ const { q: query } = await props.searchParams;
25
+ return <h1>{slug}</h1>;
26
+ }
27
+ ```
28
+
29
+ `cookies`, `headers`, and `draftMode` are awaited the same way (`const store = await cookies();`).
30
+
31
+ #### Page Router
32
+
33
+ Pages Router data functions are not affected: `getServerSideProps` / `getStaticProps` / `getStaticPaths` `context.params` stays synchronous - leave it unchanged.
@@ -6,7 +6,7 @@ export declare const next14Version = "~14.2.35";
6
6
  export declare const nextVersion = "~16.1.6";
7
7
  export declare const eslintConfigNext16Version = "^16.1.6";
8
8
  export declare const eslintConfigNext15Version = "^15.5.18";
9
- export declare const eslintConfigNext14Version = "~14.2.35";
9
+ export declare const eslintConfigNext14Version = "^15.5.18";
10
10
  export declare const eslintConfigNextVersion = "^16.1.6";
11
11
  export declare const sassVersion = "1.97.2";
12
12
  export declare const tsLibVersion = "^2.3.0";
@@ -10,7 +10,8 @@ exports.next14Version = '~14.2.35';
10
10
  exports.nextVersion = exports.next16Version;
11
11
  exports.eslintConfigNext16Version = '^16.1.6';
12
12
  exports.eslintConfigNext15Version = '^15.5.18';
13
- exports.eslintConfigNext14Version = '~14.2.35';
13
+ // eslint-config-next 14 lacks ESLint v9 support, so Next.js 14 (being removed) uses 15.
14
+ exports.eslintConfigNext14Version = '^15.5.18';
14
15
  exports.eslintConfigNextVersion = exports.eslintConfigNext16Version;
15
16
  exports.sassVersion = '1.97.2';
16
17
  exports.tsLibVersion = '^2.3.0';
@@ -0,0 +1,21 @@
1
+ // TS 6.0 enables `noUncheckedSideEffectImports`, which errors on plain
2
+ // `import './x.css'` unless the module is declared. Equally-specific wildcard
3
+ // patterns resolve by registration order, so this bare '*.css' can shadow
4
+ // next's own typed '*.module.css'; the class-map default export keeps
5
+ // CSS-module property access working even when it shadows.
6
+ declare module '*.css' {
7
+ const classes: { readonly [key: string]: string };
8
+ export default classes;
9
+ }
10
+ declare module '*.scss' {
11
+ const classes: { readonly [key: string]: string };
12
+ export default classes;
13
+ }
14
+ declare module '*.sass' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+ declare module '*.less' {
19
+ const classes: { readonly [key: string]: string };
20
+ export default classes;
21
+ }
package/migrations.json CHANGED
@@ -20,6 +20,15 @@
20
20
  "description": "Rename imports of `createNodesV2` from `@nx/next/plugin` to the canonical `createNodes` export.",
21
21
  "implementation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes",
22
22
  "documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
23
+ },
24
+ "update-23-1-0-create-ai-instructions-for-next-15": {
25
+ "version": "23.1.0-beta.0",
26
+ "requires": {
27
+ "next": ">=15.0.0 <16.0.0"
28
+ },
29
+ "description": "Create AI instructions to help migrate workspaces from Next.js 14 to 15.",
30
+ "prompt": "./dist/src/migrations/update-23-1-0/ai-instructions-for-next-15.md",
31
+ "documentation": "./dist/src/migrations/update-23-1-0/upgrade-to-next-15.md"
23
32
  }
24
33
  },
25
34
  "packageJsonUpdates": {
@@ -55,6 +64,22 @@
55
64
  "alwaysAddToPackageJson": false
56
65
  }
57
66
  }
67
+ },
68
+ "23.1.0": {
69
+ "version": "23.1.0-beta.0",
70
+ "requires": {
71
+ "next": ">=14.0.0 <15.0.0"
72
+ },
73
+ "packages": {
74
+ "next": {
75
+ "version": "~15.5.18",
76
+ "alwaysAddToPackageJson": false
77
+ },
78
+ "eslint-config-next": {
79
+ "version": "^15.5.18",
80
+ "alwaysAddToPackageJson": false
81
+ }
82
+ }
58
83
  }
59
84
  }
60
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "23.0.0",
3
+ "version": "23.1.0-beta.1",
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": {
@@ -78,17 +78,17 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack-merge": "^5.8.0",
80
80
  "@phenomnomnominal/tsquery": "~6.2.0",
81
- "@nx/devkit": "23.0.0",
82
- "@nx/js": "23.0.0",
83
- "@nx/eslint": "23.0.0",
84
- "@nx/react": "23.0.0",
85
- "@nx/web": "23.0.0",
86
- "@nx/webpack": "23.0.0"
81
+ "@nx/devkit": "23.1.0-beta.1",
82
+ "@nx/js": "23.1.0-beta.1",
83
+ "@nx/eslint": "23.1.0-beta.1",
84
+ "@nx/react": "23.1.0-beta.1",
85
+ "@nx/web": "23.1.0-beta.1",
86
+ "@nx/webpack": "23.1.0-beta.1"
87
87
  },
88
88
  "devDependencies": {
89
- "@nx/cypress": "23.0.0",
90
- "@nx/playwright": "23.0.0",
91
- "nx": "23.0.0"
89
+ "@nx/cypress": "23.1.0-beta.1",
90
+ "@nx/playwright": "23.1.0-beta.1",
91
+ "nx": "23.1.0-beta.1"
92
92
  },
93
93
  "publishConfig": {
94
94
  "access": "public"
@@ -0,0 +1,21 @@
1
+ // TS 6.0 enables `noUncheckedSideEffectImports`, which errors on plain
2
+ // `import './x.css'` unless the module is declared. Equally-specific wildcard
3
+ // patterns resolve by registration order, so this bare '*.css' can shadow
4
+ // next's own typed '*.module.css'; the class-map default export keeps
5
+ // CSS-module property access working even when it shadows.
6
+ declare module '*.css' {
7
+ const classes: { readonly [key: string]: string };
8
+ export default classes;
9
+ }
10
+ declare module '*.scss' {
11
+ const classes: { readonly [key: string]: string };
12
+ export default classes;
13
+ }
14
+ declare module '*.sass' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+ declare module '*.less' {
19
+ const classes: { readonly [key: string]: string };
20
+ export default classes;
21
+ }