Skip to content

Commit f4a378b

Browse files
authored
chore: upgrade nextjs to 16.1.0 (#404)
- replaces the webpack config with turbopack equivalent - requires introduction of a new `web` entrypoint, that doesn't export things that rely on nodejs
1 parent d3232f4 commit f4a378b

File tree

17 files changed

+791
-2261
lines changed

17 files changed

+791
-2261
lines changed

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"devDependencies": {
2828
"@jest/globals": "^30.2.0",
2929
"@nahkies/openapi-code-generator": "workspace:*",
30-
"@types/express": "^5.0.5",
30+
"@types/express": "^5.0.6",
3131
"@types/koa": "^3.0.1",
3232
"@types/koa__router": "^12.0.5",
3333
"expect": "^30.2.0",

integration-tests/typescript-express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"zod": "^3.25.74"
1919
},
2020
"devDependencies": {
21-
"@types/express": "^5.0.5",
21+
"@types/express": "^5.0.6",
2222
"typescript": "^5.9.3"
2323
}
2424
}

packages/documentation/next.config.mjs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import nextra from "nextra"
2-
import NodePolyfillPlugin from "node-polyfill-webpack-plugin"
32

43
/** @type {import('next').NextConfig} */
54
const nextConfig = {
@@ -9,33 +8,10 @@ const nextConfig = {
98
images: {
109
unoptimized: true,
1110
},
12-
webpack: (config) => {
13-
config.experiments = {...config.experiments, syncWebAssembly: true}
14-
15-
/**
16-
* Webpack doesn't support `node:` prefixed imports, so rewrite them to be
17-
* plain imports, allowing the NodePolyfillPlugin to do its job correctly.
18-
*/
19-
config.plugins.push({
20-
apply(compiler) {
21-
compiler.hooks.normalModuleFactory.tap("RewriteNodeProtocol", (nmf) => {
22-
nmf.hooks.beforeResolve.tap("RewriteNodeProtocol", (result) => {
23-
if (result?.request?.startsWith("node:")) {
24-
result.request = result.request.replace(/^node:/, "")
25-
}
26-
})
27-
})
28-
},
29-
})
30-
31-
config.plugins.push(new NodePolyfillPlugin())
32-
33-
config.module.rules.push({
34-
test: /@biomejs\/wasm-nodejs/i,
35-
use: "null-loader",
36-
})
37-
38-
return config
11+
turbopack: {
12+
resolveAlias: {
13+
"next-mdx-import-source-file": "./src/mdx-components.tsx",
14+
},
3915
},
4016
}
4117

packages/documentation/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,21 @@
3232
"lodash": "^4.17.21",
3333
"monaco-editor": "^0.55.1",
3434
"monaco-editor-auto-typings": "^0.4.6",
35-
"next": "15.5.9",
35+
"next": "^16.1.0",
3636
"nextra": "^4.6.1",
3737
"nextra-theme-docs": "^4.6.1",
38-
"node-polyfill-webpack-plugin": "^4.1.0",
3938
"react": "19.2.3",
4039
"react-dom": "19.2.3",
41-
"react-hook-form": "^7.66.1",
40+
"react-hook-form": "^7.68.0",
4241
"tslib": "^2.8.1",
4342
"zod": "^3.25.74"
4443
},
4544
"devDependencies": {
46-
"@types/lodash": "^4.17.20",
45+
"@types/lodash": "^4.17.21",
4746
"@types/node": "22.16.5",
48-
"@types/react": "^19.2.2",
47+
"@types/react": "^19.2.7",
4948
"@types/react-dom": "^19.2.2",
5049
"gh-pages": "^6.3.0",
51-
"null-loader": "^4.0.1",
5250
"tsx": "^4.21.0",
5351
"typescript": "^5.9.3",
5452
"webpack": "5.103.0"

packages/documentation/src/lib/playground.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {zodResolver} from "@hookform/resolvers/zod"
44
import {Editor, type Monaco, useMonaco} from "@monaco-editor/react"
5-
import {type Config, WebFsAdaptor} from "@nahkies/openapi-code-generator"
5+
import {type Config, WebFsAdaptor} from "@nahkies/openapi-code-generator/web"
66
import type {editor} from "monaco-editor"
77
import type {AutoTypingsCore} from "monaco-editor-auto-typings/lib/AutoTypingsCore"
88
import {Callout} from "nextra/components"

packages/documentation/src/lib/playground/config-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {zodResolver} from "@hookform/resolvers/zod"
2-
import {type Config, configSchema} from "@nahkies/openapi-code-generator"
2+
import {type Config, configSchema} from "@nahkies/openapi-code-generator/web"
33
import type React from "react"
44
import {useEffect} from "react"
55
import {useForm} from "react-hook-form"

packages/documentation/src/lib/playground/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {Monaco} from "@monaco-editor/react"
2-
import type {WebFsAdaptor} from "@nahkies/openapi-code-generator"
2+
import type {WebFsAdaptor} from "@nahkies/openapi-code-generator/web"
33

44
export function createOrUpdateModel(
55
{filename, value}: {filename: string; value: string},

packages/documentation/src/lib/playground/worker/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Config} from "@nahkies/openapi-code-generator"
1+
import type {Config} from "@nahkies/openapi-code-generator/web"
22

33
export type WorkerMessage = {type: "generate"; config: Config; input: string}
44
export type WorkerResult = {files: Map<string, string>; elapsed: number}

packages/documentation/src/lib/playground/worker/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
TypescriptFormatterPrettier,
66
TypespecLoader,
77
WebFsAdaptor,
8-
} from "@nahkies/openapi-code-generator"
8+
} from "@nahkies/openapi-code-generator/web"
99
import _ from "lodash"
1010
import type {
1111
Monad,

packages/documentation/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"moduleResolution": "bundler",
1212
"resolveJsonModule": true,
1313
"isolatedModules": true,
14-
"jsx": "preserve",
14+
"jsx": "react-jsx",
1515
"incremental": true,
1616
"plugins": [
1717
{
@@ -27,7 +27,8 @@
2727
"**/*.tsx",
2828
".next/types/**/*.ts",
2929
"next-env.d.ts",
30-
"dist/types/**/*.ts"
30+
"dist/types/**/*.ts",
31+
".next/dev/types/**/*.ts"
3132
],
3233
"exclude": ["node_modules"]
3334
}

0 commit comments

Comments
 (0)