Skip to content

Commit 793b67e

Browse files
committed
feat: re-use old flag, remove old typedRoutes code
1 parent 297069e commit 793b67e

File tree

45 files changed

+20
-951
lines changed

Some content is hidden

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

45 files changed

+20
-951
lines changed

crates/next-core/src/next_config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,7 @@ pub struct ExperimentalConfig {
785785
swc_trace_profiling: Option<bool>,
786786
/// @internal Used by the Next.js internals only.
787787
trust_host_header: Option<bool>,
788-
/// Generate Route types and enable type checking for Link and Router.push,
789-
/// etc. This option requires `appDir` to be enabled first.
788+
/// Generate Route types and enable type checking for Link and Router.push, etc.
790789
/// @see [api reference](https://nextjs.org/docs/app/api-reference/next-config-js/typedRoutes)
791790
typed_routes: Option<bool>,
792791
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
@@ -273,8 +273,7 @@ export function getDefineEnv({
273273
config.experimental.webVitalsAttribution ?? false,
274274
'process.env.__NEXT_LINK_NO_TOUCH_START':
275275
config.experimental.linkNoTouchStart ?? false,
276-
'process.env.__NEXT_NEW_TYPED_ROUTES':
277-
config.experimental.newTypedRoutes ?? false,
276+
'process.env.__NEXT_TYPED_ROUTES': config.experimental.typedRoutes ?? false,
278277
'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,
279278
'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':
280279
!!config.experimental.authInterrupts,

packages/next/src/build/index.ts

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

1427-
// Generate route types if experimental.newTypedRoutes is enabled
1428-
if (config.experimental.newTypedRoutes) {
1427+
// Generate route types if experimental.typedRoutes is enabled
1428+
if (config.experimental.typedRoutes) {
14291429
await nextBuildSpan
14301430
.traceChild('generate-route-types')
14311431
.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
: ''
@@ -2128,7 +2127,6 @@ export default async function getBaseWebpackConfig(
21282127
dev,
21292128
isEdgeServer,
21302129
pageExtensions: config.pageExtensions,
2131-
typedRoutes: enableTypedRoutes,
21322130
cacheLifeConfig: config.experimental.cacheLife,
21332131
originalRewrites,
21342132
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)