Skip to content

Commit d877f69

Browse files
chargomeclaude
andauthored
feat(platform): Run middleware on node (#16642)
Switches the runtime for middleware invocations from `edge` to `node`. ref https://vercel.com/changelog/middleware-now-supports-node-js --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2809b22 commit d877f69

File tree

9 files changed

+355
-83
lines changed

9 files changed

+355
-83
lines changed

next-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
33
/// <reference types="next/navigation-types/compat/navigation" />
4+
/// <reference path="./.next/types/routes.d.ts" />
45

56
// NOTE: This file should not be edited
67
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

next.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ const nextConfig = {
145145
sassOptions: {
146146
silenceDeprecations: ['legacy-js-api'],
147147
},
148+
experimental: {
149+
nodeMiddleware: true,
150+
},
148151
};
149152

150153
module.exports = withSentryConfig(nextConfig, {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"mdx-bundler": "^10.0.1",
8787
"mermaid": "^11.11.0",
8888
"micromark": "^4.0.0",
89-
"next": "15.1.12",
89+
"next": "15.5.12",
9090
"next-plausible": "^3.12.4",
9191
"next-themes": "^0.3.0",
9292
"nextjs-toploader": "^1.6.6",
@@ -184,4 +184,4 @@
184184
"node": "22.16.0",
185185
"pnpm": "10.30.0"
186186
}
187-
}
187+
}
File renamed without changes.

pnpm-lock.yaml

Lines changed: 341 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/codeTabs.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ const showSigninNote = (children: ReactNode) => {
5050
};
5151

5252
export function CodeTabs({children}: CodeTabProps) {
53-
const codeBlocks = Array.isArray(children) ? [...children] : [children];
53+
const codeBlocks = (Array.isArray(children) ? [...children] : [children]).filter(
54+
child => child?.props
55+
);
5456

5557
// The title is what we use for sorting and also for remembering the
5658
// selection. If there is no title fall back to the title cased language name

src/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const config = {
1818
// - favicon.ico (favicon file)
1919
'/((?!api|_next/static|_next/image|favicon.ico).*)',
2020
],
21+
runtime: 'nodejs',
2122
};
2223

2324
// This function can be marked `async` if using `await` inside

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// "removeComments": true, /* Do not emit comments to output. */
2222
"noEmit": true, /* Do not emit outputs. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
2323
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
24-
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */// "strict": true /* Enable all strict type-checking options. */
24+
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ // "strict": true /* Enable all strict type-checking options. */
2525
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2626
// "strictNullChecks": true, /* Enable strict null checks. */
2727
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -76,9 +76,9 @@
7676
".cache"
7777
],
7878
"include": [
79-
"next-env.d.ts",
80-
".next/types/**/*.ts",
8179
"**/*.ts",
82-
"**/*.tsx"
80+
"**/*.tsx",
81+
"next-env.d.ts",
82+
".next/types/**/*.ts"
8383
]
8484
}

0 commit comments

Comments
 (0)