Skip to content

Commit 639db50

Browse files
committed
feat: re-use old flag, remove old typedRoutes code
1 parent 98f6695 commit 639db50

File tree

46 files changed

+20
-953
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+20
-953
lines changed

crates/next-core/src/next_config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ pub struct ExperimentalConfig {
781781
swc_trace_profiling: Option<bool>,
782782
/// @internal Used by the Next.js internals only.
783783
trust_host_header: Option<bool>,
784-
/// Generate Route types and enable type checking for Link and Router.push,
785-
/// etc. This option requires `appDir` to be enabled first.
784+
/// Generate Route types and enable type checking for Link and Router.push, etc.
786785
/// @see [api reference](https://nextjs.org/docs/app/api-reference/next-config-js/typedRoutes)
787786
typed_routes: Option<bool>,
788787
url_imports: Option<serde_json::Value>,

docs/01-app/03-api-reference/05-config/01-next-config-js/typedRoutes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Enable experimental support for statically typed links.
44
version: experimental
55
---
66

7-
Experimental support for [statically typed links](/docs/app/api-reference/config/typescript#statically-typed-links). This feature requires using the App Router as well as TypeScript in your project.
7+
Experimental support for [statically typed links](/docs/app/api-reference/config/typescript#statically-typed-links). This feature requires using TypeScript in your project.
88

99
```js filename="next.config.js"
1010
/** @type {import('next').NextConfig} */

docs/01-app/03-api-reference/08-turbopack.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Some features are not yet implemented or not planned:
112112
- **`experimental.esmExternals`**
113113
Not planned. Turbopack does not support the legacy `esmExternals` configuration in Next.js.
114114
- **Some Next.js Experimental Flags**
115-
- `experimental.typedRoutes`
116115
- `experimental.nextScriptWorkers`
117116
- `experimental.sri.algorithm`
118117
- `experimental.fallbackNodePolyfills`

packages/next/src/build/define-env.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ export function getDefineEnv({
277277
config.experimental.webVitalsAttribution ?? false,
278278
'process.env.__NEXT_LINK_NO_TOUCH_START':
279279
config.experimental.linkNoTouchStart ?? false,
280-
'process.env.__NEXT_NEW_TYPED_ROUTES':
281-
config.experimental.newTypedRoutes ?? false,
280+
'process.env.__NEXT_TYPED_ROUTES': config.experimental.typedRoutes ?? false,
282281
'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,
283282
'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':
284283
!!config.experimental.authInterrupts,

packages/next/src/build/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,8 @@ export default async function build(
13831383
app: appPaths.length > 0 ? appPaths : undefined,
13841384
}
13851385

1386-
// Generate route types if experimental.newTypedRoutes is enabled
1387-
if (config.experimental.newTypedRoutes) {
1386+
// Generate route types if experimental.typedRoutes is enabled
1387+
if (config.experimental.typedRoutes) {
13881388
await nextBuildSpan
13891389
.traceChild('generate-route-types')
13901390
.traceAsyncFn(async () => {

packages/next/src/build/webpack-config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ export default async function getBaseWebpackConfig(
387387

388388
const hasAppDir = !!appDir
389389
const disableOptimizedLoading = true
390-
const enableTypedRoutes = !!config.experimental.typedRoutes && hasAppDir
391390
const bundledReactChannel = needsExperimentalReact(config)
392391
? '-experimental'
393392
: ''
@@ -2122,7 +2121,6 @@ export default async function getBaseWebpackConfig(
21222121
dev,
21232122
isEdgeServer,
21242123
pageExtensions: config.pageExtensions,
2125-
typedRoutes: enableTypedRoutes,
21262124
cacheLifeConfig: config.experimental.cacheLife,
21272125
originalRewrites,
21282126
originalRedirects,

packages/next/src/build/webpack/plugins/next-types-plugin/index.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('next-types-plugin', () => {
1111
dev: false,
1212
isEdgeServer: false,
1313
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
14-
typedRoutes: false,
1514
cacheLifeConfig: undefined,
1615
originalRewrites: undefined,
1716
originalRedirects: undefined,
@@ -40,7 +39,6 @@ describe('next-types-plugin', () => {
4039
dev: false,
4140
isEdgeServer: false,
4241
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
43-
typedRoutes: false,
4442
cacheLifeConfig: undefined,
4543
originalRewrites: undefined,
4644
originalRedirects: undefined,
@@ -61,7 +59,6 @@ describe('next-types-plugin', () => {
6159
dev: false,
6260
isEdgeServer: false,
6361
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
64-
typedRoutes: false,
6562
cacheLifeConfig: undefined,
6663
originalRewrites: undefined,
6764
originalRedirects: undefined,

0 commit comments

Comments
 (0)