Skip to content

Commit cafb886

Browse files
authored
Move options to stable (vercel#44195)
This PR moves `allowMiddlewareResponseBody`, `skipMiddlewareUrlNormalize` and `skipTrailingSlashRedirect` to stable. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
1 parent 2b3a38e commit cafb886

File tree

8 files changed

+26
-27
lines changed

8 files changed

+26
-27
lines changed

packages/next/build/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,7 @@ export default async function build(
797797
header: RSC,
798798
varyHeader: RSC_VARY_HEADER,
799799
},
800-
skipMiddlewareUrlNormalize:
801-
config.experimental.skipMiddlewareUrlNormalize,
800+
skipMiddlewareUrlNormalize: config.skipMiddlewareUrlNormalize,
802801
}
803802
})
804803

packages/next/build/webpack-config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,13 @@ export function getDefineEnv({
302302
'process.env.__NEXT_I18N_DOMAINS': JSON.stringify(config.i18n?.domains),
303303
'process.env.__NEXT_ANALYTICS_ID': JSON.stringify(config.analyticsId),
304304
'process.env.__NEXT_ALLOW_MIDDLEWARE_RESPONSE_BODY': JSON.stringify(
305-
config.experimental.allowMiddlewareResponseBody
305+
config.allowMiddlewareResponseBody
306306
),
307307
'process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE': JSON.stringify(
308-
config.experimental.skipMiddlewareUrlNormalize
308+
config.skipMiddlewareUrlNormalize
309309
),
310310
'process.env.__NEXT_MANUAL_TRAILING_SLASH': JSON.stringify(
311-
config.experimental?.skipTrailingSlashRedirect
311+
config.skipTrailingSlashRedirect
312312
),
313313
'process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION': JSON.stringify(
314314
config.experimental.webVitalsAttribution &&
@@ -2062,8 +2062,7 @@ export default async function getBaseWebpackConfig(
20622062
dev,
20632063
sriEnabled: !dev && !!config.experimental.sri?.algorithm,
20642064
hasFontLoaders: !!config.experimental.fontLoaders,
2065-
allowMiddlewareResponseBody:
2066-
!!config.experimental.allowMiddlewareResponseBody,
2065+
allowMiddlewareResponseBody: !!config.allowMiddlewareResponseBody,
20672066
}),
20682067
isClient &&
20692068
new BuildManifestPlugin({

packages/next/lib/load-custom-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ export default async function loadCustomRoutes(
659659
)
660660
}
661661

662-
if (!config.experimental?.skipTrailingSlashRedirect) {
662+
if (!config.skipTrailingSlashRedirect) {
663663
if (config.trailingSlash) {
664664
redirects.unshift(
665665
{

packages/next/server/config-schema.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const configSchema = {
77
type: 'object',
88
additionalProperties: false,
99
properties: {
10+
allowMiddlewareResponseBody: {
11+
type: 'boolean',
12+
},
1013
amp: {
1114
additionalProperties: false,
1215
properties: {
@@ -269,9 +272,6 @@ const configSchema = {
269272
appDir: {
270273
type: 'boolean',
271274
},
272-
allowMiddlewareResponseBody: {
273-
type: 'boolean',
274-
},
275275
externalDir: {
276276
type: 'boolean',
277277
},
@@ -375,12 +375,6 @@ const configSchema = {
375375
sharedPool: {
376376
type: 'boolean',
377377
},
378-
skipMiddlewareUrlNormalize: {
379-
type: 'boolean',
380-
},
381-
skipTrailingSlashRedirect: {
382-
type: 'boolean',
383-
},
384378
sri: {
385379
properties: {
386380
algorithm: {
@@ -697,6 +691,12 @@ const configSchema = {
697691
serverRuntimeConfig: {
698692
type: 'object',
699693
},
694+
skipMiddlewareUrlNormalize: {
695+
type: 'boolean',
696+
},
697+
skipTrailingSlashRedirect: {
698+
type: 'boolean',
699+
},
700700
staticPageGenerationTimeout: {
701701
type: 'number',
702702
},

packages/next/server/config-shared.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ export interface NextJsWebpackConfig {
8080

8181
export interface ExperimentalConfig {
8282
fetchCache?: boolean
83-
allowMiddlewareResponseBody?: boolean
84-
skipMiddlewareUrlNormalize?: boolean
85-
skipTrailingSlashRedirect?: boolean
8683
optimisticClientCache?: boolean
8784
middlewarePrefetch?: 'strict' | 'flexible'
8885
legacyBrowsers?: boolean
@@ -507,6 +504,12 @@ export interface NextConfig extends Record<string, any> {
507504

508505
output?: 'standalone'
509506

507+
allowMiddlewareResponseBody?: boolean
508+
509+
skipMiddlewareUrlNormalize?: boolean
510+
511+
skipTrailingSlashRedirect?: boolean
512+
510513
/**
511514
* Enable experimental features. Note that all experimental features are subject to breaking changes in the future.
512515
*/

packages/next/server/next-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ export default class NextNodeServer extends BaseServer {
17161716

17171717
let url: string
17181718

1719-
if (this.nextConfig.experimental.skipMiddlewareUrlNormalize) {
1719+
if (this.nextConfig.skipMiddlewareUrlNormalize) {
17201720
url = getRequestMeta(params.request, '__NEXT_INIT_URL')!
17211721
} else {
17221722
// For middleware to "fetch" we must always provide an absolute URL
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2+
allowMiddlewareResponseBody: true,
23
experimental: {
34
appDir: true,
4-
allowMiddlewareResponseBody: true,
55
},
66
}

test/e2e/skip-trailing-slash-redirect/app/next.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3-
experimental: {
4-
skipTrailingSlashRedirect: true,
5-
skipMiddlewareUrlNormalize: true,
6-
allowMiddlewareResponseBody: true,
7-
},
3+
allowMiddlewareResponseBody: true,
4+
skipMiddlewareUrlNormalize: true,
5+
skipTrailingSlashRedirect: true,
86
async redirects() {
97
return [
108
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy