Unverified Commit cafb886e authored by Shu Ding's avatar Shu Ding Committed by GitHub

Move options to stable (#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)
parent 2b3a38ee
......@@ -797,8 +797,7 @@ export default async function build(
header: RSC,
varyHeader: RSC_VARY_HEADER,
},
skipMiddlewareUrlNormalize:
config.experimental.skipMiddlewareUrlNormalize,
skipMiddlewareUrlNormalize: config.skipMiddlewareUrlNormalize,
}
})
......
......@@ -302,13 +302,13 @@ export function getDefineEnv({
'process.env.__NEXT_I18N_DOMAINS': JSON.stringify(config.i18n?.domains),
'process.env.__NEXT_ANALYTICS_ID': JSON.stringify(config.analyticsId),
'process.env.__NEXT_ALLOW_MIDDLEWARE_RESPONSE_BODY': JSON.stringify(
config.experimental.allowMiddlewareResponseBody
config.allowMiddlewareResponseBody
),
'process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE': JSON.stringify(
config.experimental.skipMiddlewareUrlNormalize
config.skipMiddlewareUrlNormalize
),
'process.env.__NEXT_MANUAL_TRAILING_SLASH': JSON.stringify(
config.experimental?.skipTrailingSlashRedirect
config.skipTrailingSlashRedirect
),
'process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION': JSON.stringify(
config.experimental.webVitalsAttribution &&
......@@ -2062,8 +2062,7 @@ export default async function getBaseWebpackConfig(
dev,
sriEnabled: !dev && !!config.experimental.sri?.algorithm,
hasFontLoaders: !!config.experimental.fontLoaders,
allowMiddlewareResponseBody:
!!config.experimental.allowMiddlewareResponseBody,
allowMiddlewareResponseBody: !!config.allowMiddlewareResponseBody,
}),
isClient &&
new BuildManifestPlugin({
......
......@@ -659,7 +659,7 @@ export default async function loadCustomRoutes(
)
}
if (!config.experimental?.skipTrailingSlashRedirect) {
if (!config.skipTrailingSlashRedirect) {
if (config.trailingSlash) {
redirects.unshift(
{
......
......@@ -7,6 +7,9 @@ const configSchema = {
type: 'object',
additionalProperties: false,
properties: {
allowMiddlewareResponseBody: {
type: 'boolean',
},
amp: {
additionalProperties: false,
properties: {
......@@ -269,9 +272,6 @@ const configSchema = {
appDir: {
type: 'boolean',
},
allowMiddlewareResponseBody: {
type: 'boolean',
},
externalDir: {
type: 'boolean',
},
......@@ -375,12 +375,6 @@ const configSchema = {
sharedPool: {
type: 'boolean',
},
skipMiddlewareUrlNormalize: {
type: 'boolean',
},
skipTrailingSlashRedirect: {
type: 'boolean',
},
sri: {
properties: {
algorithm: {
......@@ -697,6 +691,12 @@ const configSchema = {
serverRuntimeConfig: {
type: 'object',
},
skipMiddlewareUrlNormalize: {
type: 'boolean',
},
skipTrailingSlashRedirect: {
type: 'boolean',
},
staticPageGenerationTimeout: {
type: 'number',
},
......
......@@ -80,9 +80,6 @@ export interface NextJsWebpackConfig {
export interface ExperimentalConfig {
fetchCache?: boolean
allowMiddlewareResponseBody?: boolean
skipMiddlewareUrlNormalize?: boolean
skipTrailingSlashRedirect?: boolean
optimisticClientCache?: boolean
middlewarePrefetch?: 'strict' | 'flexible'
legacyBrowsers?: boolean
......@@ -507,6 +504,12 @@ export interface NextConfig extends Record<string, any> {
output?: 'standalone'
allowMiddlewareResponseBody?: boolean
skipMiddlewareUrlNormalize?: boolean
skipTrailingSlashRedirect?: boolean
/**
* Enable experimental features. Note that all experimental features are subject to breaking changes in the future.
*/
......
......@@ -1716,7 +1716,7 @@ export default class NextNodeServer extends BaseServer {
let url: string
if (this.nextConfig.experimental.skipMiddlewareUrlNormalize) {
if (this.nextConfig.skipMiddlewareUrlNormalize) {
url = getRequestMeta(params.request, '__NEXT_INIT_URL')!
} else {
// For middleware to "fetch" we must always provide an absolute URL
......
module.exports = {
allowMiddlewareResponseBody: true,
experimental: {
appDir: true,
allowMiddlewareResponseBody: true,
},
}
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
skipTrailingSlashRedirect: true,
skipMiddlewareUrlNormalize: true,
allowMiddlewareResponseBody: true,
},
allowMiddlewareResponseBody: true,
skipMiddlewareUrlNormalize: true,
skipTrailingSlashRedirect: true,
async redirects() {
return [
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment