Unverified Commit 0e1c85ce authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove additional appDir checks (#54788)

Followup to #54785 removing additional places where `.appDir` was used. 


<!-- 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 1aab5ee9
...@@ -61,7 +61,7 @@ pub async fn get_app_entries( ...@@ -61,7 +61,7 @@ pub async fn get_app_entries(
server_compile_time_info: Vc<CompileTimeInfo>, server_compile_time_info: Vc<CompileTimeInfo>,
next_config: Vc<NextConfig>, next_config: Vc<NextConfig>,
) -> Result<Vc<AppEntries>> { ) -> Result<Vc<AppEntries>> {
let app_dir = find_app_dir_if_enabled(project_root, next_config); let app_dir = find_app_dir_if_enabled(project_root);
let Some(&app_dir) = app_dir.await?.as_ref() else { let Some(&app_dir) = app_dir.await?.as_ref() else {
return Ok(AppEntries::cell(AppEntries { return Ok(AppEntries::cell(AppEntries {
......
...@@ -243,13 +243,7 @@ pub async fn find_app_dir(project_path: Vc<FileSystemPath>) -> Result<Vc<OptionA ...@@ -243,13 +243,7 @@ pub async fn find_app_dir(project_path: Vc<FileSystemPath>) -> Result<Vc<OptionA
/// Finds and returns the [DirectoryTree] of the app directory if enabled and /// Finds and returns the [DirectoryTree] of the app directory if enabled and
/// existing. /// existing.
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn find_app_dir_if_enabled( pub async fn find_app_dir_if_enabled(project_path: Vc<FileSystemPath>) -> Result<Vc<OptionAppDir>> {
project_path: Vc<FileSystemPath>,
next_config: Vc<NextConfig>,
) -> Result<Vc<OptionAppDir>> {
if !*next_config.app_dir().await? {
return Ok(Vc::cell(None));
}
Ok(find_app_dir(project_path)) Ok(find_app_dir(project_path))
} }
......
...@@ -403,7 +403,6 @@ pub enum LoaderItem { ...@@ -403,7 +403,6 @@ pub enum LoaderItem {
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, TraceRawVcs)] #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, TraceRawVcs)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ExperimentalConfig { pub struct ExperimentalConfig {
pub app_dir: Option<bool>,
pub server_components_external_packages: Option<Vec<String>>, pub server_components_external_packages: Option<Vec<String>>,
pub turbo: Option<ExperimentalTurboConfig>, pub turbo: Option<ExperimentalTurboConfig>,
pub allowed_revalidate_header_keys: Option<Vec<String>>, pub allowed_revalidate_header_keys: Option<Vec<String>>,
...@@ -527,18 +526,6 @@ impl NextConfig { ...@@ -527,18 +526,6 @@ impl NextConfig {
)) ))
} }
#[turbo_tasks::function]
pub async fn app_dir(self: Vc<Self>) -> Result<Vc<bool>> {
Ok(Vc::cell(
self.await?
.experimental
.app_dir
.as_ref()
.cloned()
.unwrap_or_default(),
))
}
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn env(self: Vc<Self>) -> Result<Vc<EnvMap>> { pub async fn env(self: Vc<Self>) -> Result<Vc<EnvMap>> {
// The value expected for env is Record<String, String>, but config itself // The value expected for env is Record<String, String>, but config itself
......
...@@ -388,7 +388,7 @@ async fn source( ...@@ -388,7 +388,7 @@ async fn source(
next_config, next_config,
server_addr, server_addr,
); );
let app_dir = find_app_dir_if_enabled(project_path, next_config); let app_dir = find_app_dir_if_enabled(project_path);
let app_source = create_app_source( let app_source = create_app_source(
app_dir, app_dir,
project_path, project_path,
......
...@@ -1987,7 +1987,7 @@ startServer({ ...@@ -1987,7 +1987,7 @@ startServer({
port: currentPort, port: currentPort,
allowRetry: false, allowRetry: false,
keepAliveTimeout, keepAliveTimeout,
useWorkers: !!nextConfig.experimental?.appDir, useWorkers: true,
}).catch((err) => { }).catch((err) => {
console.error(err); console.error(err);
process.exit(1); process.exit(1);
......
...@@ -11,7 +11,7 @@ import { CliCommand } from '../lib/commands' ...@@ -11,7 +11,7 @@ import { CliCommand } from '../lib/commands'
import { getProjectDir } from '../lib/get-project-dir' import { getProjectDir } from '../lib/get-project-dir'
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants' import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'
import path from 'path' import path from 'path'
import { defaultConfig, NextConfigComplete } from '../server/config-shared' import { NextConfigComplete } from '../server/config-shared'
import { traceGlobals } from '../trace/shared' import { traceGlobals } from '../trace/shared'
import { Telemetry } from '../telemetry/storage' import { Telemetry } from '../telemetry/storage'
import loadConfig from '../server/config' import loadConfig from '../server/config'
...@@ -352,12 +352,7 @@ const nextDev: CliCommand = async (argv) => { ...@@ -352,12 +352,7 @@ const nextDev: CliCommand = async (argv) => {
}) })
const distDir = path.join(dir, rawNextConfig.distDir || '.next') const distDir = path.join(dir, rawNextConfig.distDir || '.next')
const { pagesDir, appDir } = findPagesDir( const { pagesDir, appDir } = findPagesDir(dir, true)
dir,
typeof rawNextConfig?.experimental?.appDir === 'undefined'
? !!defaultConfig.experimental?.appDir
: !!rawNextConfig.experimental?.appDir
)
const telemetry = new Telemetry({ const telemetry = new Telemetry({
distDir, distDir,
}) })
......
...@@ -298,9 +298,6 @@ const configSchema = { ...@@ -298,9 +298,6 @@ const configSchema = {
}, },
] as any, ] as any,
}, },
appDir: {
type: 'boolean',
},
serverActions: { serverActions: {
type: 'boolean', type: 'boolean',
}, },
......
...@@ -183,11 +183,6 @@ export interface ExperimentalConfig { ...@@ -183,11 +183,6 @@ export interface ExperimentalConfig {
nextScriptWorkers?: boolean nextScriptWorkers?: boolean
scrollRestoration?: boolean scrollRestoration?: boolean
externalDir?: boolean externalDir?: boolean
/**
* The App Router (app directory) enables support for layouts, Server Components, streaming, and colocated data fetching.
* @see https://nextjs.org/docs/app/api-reference/next-config-js/appDir
*/
appDir?: boolean
amp?: { amp?: {
optimizer?: any optimizer?: any
validator?: string validator?: string
...@@ -702,7 +697,7 @@ export const defaultConfig: NextConfig = { ...@@ -702,7 +697,7 @@ export const defaultConfig: NextConfig = {
deploymentId: undefined, deploymentId: undefined,
useDeploymentIdServerActions: false, useDeploymentIdServerActions: false,
appDocumentPreloading: undefined, appDocumentPreloading: undefined,
clientRouterFilter: false, clientRouterFilter: true,
clientRouterFilterRedirects: false, clientRouterFilterRedirects: false,
fetchCacheKeyPrefix: '', fetchCacheKeyPrefix: '',
middlewarePrefetch: 'flexible', middlewarePrefetch: 'flexible',
...@@ -727,7 +722,6 @@ export const defaultConfig: NextConfig = { ...@@ -727,7 +722,6 @@ export const defaultConfig: NextConfig = {
gzipSize: true, gzipSize: true,
craCompat: false, craCompat: false,
esmExternals: true, esmExternals: true,
appDir: true,
// default to 50MB limit // default to 50MB limit
isrMemoryCacheSize: 50 * 1024 * 1024, isrMemoryCacheSize: 50 * 1024 * 1024,
incrementalCacheHandlerPath: undefined, incrementalCacheHandlerPath: undefined,
......
...@@ -425,13 +425,6 @@ function assignDefaults( ...@@ -425,13 +425,6 @@ function assignDefaults(
silent silent
) )
if (
typeof userConfig.experimental?.clientRouterFilter === 'undefined' &&
result.experimental?.appDir
) {
result.experimental.clientRouterFilter = true
}
if ( if (
result.experimental?.outputFileTracingRoot && result.experimental?.outputFileTracingRoot &&
!isAbsolute(result.experimental.outputFileTracingRoot) !isAbsolute(result.experimental.outputFileTracingRoot)
......
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