Unverified Commit 3fbbfeb6 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove experimental.appDir as it's stable (#54785)

Removes the experimental option as it has been shipped.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent f567aaf1
......@@ -405,7 +405,7 @@ export default async function build(
setGlobal('telemetry', telemetry)
const publicDir = path.join(dir, 'public')
const isAppDirEnabled = !!config.experimental.appDir
const isAppDirEnabled = true
const { pagesDir, appDir } = findPagesDir(dir, isAppDirEnabled)
NextBuildContext.pagesDir = pagesDir
NextBuildContext.appDir = appDir
......
......@@ -73,7 +73,7 @@ export default function nextJest(options: { dir?: string } = {}) {
isEsmProject = packageConfig.type === 'module'
nextConfig = await getConfig(resolvedDir)
const isAppDirEnabled = !!nextConfig.experimental.appDir
const isAppDirEnabled = true
const findPagesDirResult = findPagesDir(resolvedDir, isAppDirEnabled)
hasServerComponents = !!findPagesDirResult.appDir
pagesDir = findPagesDirResult.pagesDir
......
......@@ -293,12 +293,8 @@ export function getDefineEnv({
config.reactStrictMode === null ? false : config.reactStrictMode
),
'process.env.__NEXT_STRICT_MODE_APP': JSON.stringify(
// When next.config.js does not have reactStrictMode enabling appDir will enable it.
config.reactStrictMode === null
? config.experimental.appDir
? true
: false
: config.reactStrictMode
// When next.config.js does not have reactStrictMode it's enabled by default.
config.reactStrictMode === null ? true : config.reactStrictMode
),
'process.env.__NEXT_OPTIMIZE_FONTS': JSON.stringify(
!dev && config.optimizeFonts
......@@ -791,7 +787,7 @@ export default async function getBaseWebpackConfig(
rewrites.afterFiles.length > 0 ||
rewrites.fallback.length > 0
const hasAppDir = !!config.experimental.appDir && !!appDir
const hasAppDir = !!appDir
const hasServerComponents = hasAppDir
const disableOptimizedLoading = true
const enableTypedRoutes = !!config.experimental.typedRoutes && hasAppDir
......@@ -2710,7 +2706,6 @@ export default async function getBaseWebpackConfig(
}
const configVars = JSON.stringify({
appDir: config.experimental.appDir,
crossOrigin: config.crossOrigin,
pageExtensions: pageExtensions,
trailingSlash: config.trailingSlash,
......
......@@ -5,10 +5,7 @@ import { join } from 'path'
import chalk from 'next/dist/compiled/chalk'
import { CliCommand } from '../lib/commands'
import {
ESLINT_DEFAULT_DIRS,
ESLINT_DEFAULT_DIRS_WITH_APP,
} from '../lib/constants'
import { ESLINT_DEFAULT_DIRS_WITH_APP } from '../lib/constants'
import { runLintCheck } from '../lib/eslint/runLintCheck'
import { printAndExit } from '../server/lib/utils'
import { Telemetry } from '../telemetry/storage'
......@@ -169,9 +166,7 @@ const nextLint: CliCommand = async (argv) => {
const filesToLint = [...(dirs ?? []), ...files]
// Remove that when the `appDir` will be stable.
const directoriesToLint = !!nextConfig.experimental.appDir
? ESLINT_DEFAULT_DIRS_WITH_APP
: ESLINT_DEFAULT_DIRS
const directoriesToLint = ESLINT_DEFAULT_DIRS_WITH_APP
const pathsToLint = (
filesToLint.length ? filesToLint : directoriesToLint
......@@ -190,11 +185,8 @@ const nextLint: CliCommand = async (argv) => {
const distDir = join(baseDir, nextConfig.distDir)
const defaultCacheLocation = join(distDir, 'cache', 'eslint/')
const hasAppDir = !!nextConfig.experimental.appDir
const { pagesDir, appDir } = findPagesDir(
baseDir,
!!nextConfig.experimental.appDir
)
const hasAppDir = true
const { pagesDir, appDir } = findPagesDir(baseDir, hasAppDir)
await verifyTypeScriptSetup({
dir: baseDir,
......
......@@ -721,7 +721,7 @@ export default async function exportApp(
httpAgentOptions: nextConfig.httpAgentOptions,
debugOutput: options.debugOutput,
isrMemoryCacheSize: nextConfig.experimental.isrMemoryCacheSize,
fetchCache: nextConfig.experimental.appDir,
fetchCache: true,
fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,
incrementalCacheHandlerPath:
nextConfig.experimental.incrementalCacheHandlerPath,
......
......@@ -20,7 +20,6 @@ const supportedTurbopackNextConfigOptions = [
'swcMinify',
'transpilePackages',
'sassOptions.includePaths',
'experimental.appDir',
'experimental.serverComponentsExternalPackages',
'experimental.turbo',
'experimental.mdxRs',
......
......@@ -426,8 +426,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
this.buildId = this.getBuildId()
this.minimalMode = minimalMode || !!process.env.NEXT_PRIVATE_MINIMAL_MODE
this.hasAppDir =
!!this.nextConfig.experimental.appDir && this.getHasAppDir(dev)
this.hasAppDir = this.getHasAppDir(dev)
const serverComponents = this.hasAppDir
this.nextFontManifest = this.getNextFontManifest()
......@@ -1925,7 +1924,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
const renderOpts: RenderOpts = {
...components,
...opts,
...(isAppPath && this.nextConfig.experimental.appDir
...(isAppPath
? {
incrementalCache,
isRevalidate: isSSG,
......
......@@ -180,19 +180,13 @@ export default class DevServer extends Server {
})
}
const { pagesDir, appDir } = findPagesDir(
this.dir,
!!this.nextConfig.experimental.appDir
)
const { pagesDir, appDir } = findPagesDir(this.dir, true)
this.pagesDir = pagesDir
this.appDir = appDir
}
protected getRouteMatchers(): RouteMatcherManager {
const { pagesDir, appDir } = findPagesDir(
this.dir,
!!this.nextConfig.experimental.appDir
)
const { pagesDir, appDir } = findPagesDir(this.dir, true)
const ensurer: RouteEnsurer = {
ensure: async (match) => {
......
......@@ -66,10 +66,7 @@ export async function makeResolver(
minimalMode: false,
config: nextConfig,
})
const { appDir, pagesDir } = findPagesDir(
dir,
!!nextConfig.experimental.appDir
)
const { appDir, pagesDir } = findPagesDir(dir, true)
// we format the hostname so that it can be fetched
const fetchHostname = formatHostname(hostname)
......
......@@ -104,10 +104,7 @@ export async function initialize(opts: {
const telemetry = new Telemetry({
distDir: path.join(opts.dir, config.distDir),
})
const { pagesDir, appDir } = findPagesDir(
opts.dir,
!!config.experimental.appDir
)
const { pagesDir, appDir } = findPagesDir(opts.dir, true)
const { setupDev } =
(await require('./router-utils/setup-dev')) as typeof import('./router-utils/setup-dev')
......
......@@ -300,7 +300,7 @@ export default class NextNodeServer extends BaseServer {
this.nextConfig.experimental.allowedRevalidateHeaderKeys,
minimalMode: this.minimalMode,
serverDistDir: this.serverDistDir,
fetchCache: this.nextConfig.experimental.appDir,
fetchCache: true,
fetchCacheKeyPrefix: this.nextConfig.experimental.fetchCacheKeyPrefix,
maxMemoryCacheSize: this.nextConfig.experimental.isrMemoryCacheSize,
flushToDisk:
......
......@@ -68,7 +68,7 @@ export default class NextWebServer extends BaseServer<WebServerOptions> {
allowedRevalidateHeaderKeys:
this.nextConfig.experimental.allowedRevalidateHeaderKeys,
minimalMode: this.minimalMode,
fetchCache: this.nextConfig.experimental.appDir,
fetchCache: true,
fetchCacheKeyPrefix: this.nextConfig.experimental.fetchCacheKeyPrefix,
maxMemoryCacheSize: this.nextConfig.experimental.isrMemoryCacheSize,
flushToDisk: false,
......
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