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