Commit fbfbb400 authored by Tim Neutkens's avatar Tim Neutkens

Update

parent 79e01a39
...@@ -44,6 +44,7 @@ The root `conductor.json` defines: ...@@ -44,6 +44,7 @@ The root `conductor.json` defines:
### Creating a New Workspace ### Creating a New Workspace
In the Conductor app: In the Conductor app:
1. Add this repository 1. Add this repository
2. Create a new workspace with a descriptive name 2. Create a new workspace with a descriptive name
3. The setup script will automatically install dependencies and build 3. The setup script will automatically install dependencies and build
...@@ -70,6 +71,7 @@ cd ../next.js-worktrees/my-feature ...@@ -70,6 +71,7 @@ cd ../next.js-worktrees/my-feature
## Managing Worktrees ## Managing Worktrees
View all worktrees: View all worktrees:
```bash ```bash
git worktree list git worktree list
``` ```
...@@ -77,16 +79,19 @@ git worktree list ...@@ -77,16 +79,19 @@ git worktree list
## Best Practices ## Best Practices
### Disk Space Management ### Disk Space Management
- Each worktree uses ~500MB-1GB after build - Each worktree uses ~500MB-1GB after build
- Run `pnpm sweep` periodically to clean Rust build artifacts - Run `pnpm sweep` periodically to clean Rust build artifacts
- Remove unused worktrees with `git worktree remove <path>` - Remove unused worktrees with `git worktree remove <path>`
### Development Workflow ### Development Workflow
1. **Never run `pnpm build` while `pnpm dev` is active** (causes build corruption) 1. **Never run `pnpm build` while `pnpm dev` is active** (causes build corruption)
2. Use `pnpm test-dev-turbo` for fastest test iteration 2. Use `pnpm test-dev-turbo` for fastest test iteration
3. Use `NEXT_SKIP_ISOLATE=1` for faster test runs during development 3. Use `NEXT_SKIP_ISOLATE=1` for faster test runs during development
### Parallel Agent Recommendations ### Parallel Agent Recommendations
- Limit to 3-4 concurrent agents to avoid: - Limit to 3-4 concurrent agents to avoid:
- GitHub API rate limits - GitHub API rate limits
- Disk space exhaustion - Disk space exhaustion
...@@ -95,7 +100,9 @@ git worktree list ...@@ -95,7 +100,9 @@ git worktree list
## Troubleshooting ## Troubleshooting
### Build Corruption ### Build Corruption
If builds become corrupted: If builds become corrupted:
```bash ```bash
# Kill any running dev processes # Kill any running dev processes
pkill -f "pnpm dev" pkill -f "pnpm dev"
...@@ -107,6 +114,7 @@ pnpm build ...@@ -107,6 +114,7 @@ pnpm build
``` ```
### Worktree Issues ### Worktree Issues
```bash ```bash
# List worktrees with status # List worktrees with status
git worktree list git worktree list
......
...@@ -4,7 +4,6 @@ A Next.js application for visualizing bundle sizes and analyzing dependencies us ...@@ -4,7 +4,6 @@ A Next.js application for visualizing bundle sizes and analyzing dependencies us
This package is not published to npm. Instead it's built and vendored into the main `next` package during its build process. This package is not published to npm. Instead it's built and vendored into the main `next` package during its build process.
## Features ## Features
- 📊 **Interactive Treemap**: Visualize bundle sizes with an interactive treemap interface - 📊 **Interactive Treemap**: Visualize bundle sizes with an interactive treemap interface
...@@ -16,5 +15,6 @@ This package is not published to npm. Instead it's built and vendored into the m ...@@ -16,5 +15,6 @@ This package is not published to npm. Instead it's built and vendored into the m
## Updating ## Updating
When landing non-trivial changes, consider updating the demo site: When landing non-trivial changes, consider updating the demo site:
* Site: https://turbopack-bundle-analyzer-demo.vercel.sh/
* Repo: https://github.com/vercel/turbopack-bundle-analyzer-demo - Site: https://turbopack-bundle-analyzer-demo.vercel.sh/
\ No newline at end of file - Repo: https://github.com/vercel/turbopack-bundle-analyzer-demo
...@@ -30,7 +30,8 @@ const badgeVariants = cva( ...@@ -30,7 +30,8 @@ const badgeVariants = cva(
) )
export interface BadgeProps export interface BadgeProps
extends React.HTMLAttributes<HTMLSpanElement>, extends
React.HTMLAttributes<HTMLSpanElement>,
VariantProps<typeof badgeVariants> {} VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) { function Badge({ className, variant, ...props }: BadgeProps) {
......
...@@ -37,7 +37,8 @@ const buttonVariants = cva( ...@@ -37,7 +37,8 @@ const buttonVariants = cva(
) )
export interface ButtonProps export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, extends
React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> { VariantProps<typeof buttonVariants> {
asChild?: boolean asChild?: boolean
} }
......
...@@ -2,8 +2,7 @@ import * as React from 'react' ...@@ -2,8 +2,7 @@ import * as React from 'react'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
export interface InputProps export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>( const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => { ({ className, type, ...props }, ref) => {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// inserted by rust code // inserted by rust code
declare const PAGE_PATH: string declare const PAGE_PATH: string
// Adapted from https://github.com/vercel/next.js/blob/b7f9f1f98fc8ab602e84825105b5727272b72e7d/packages/next/src/build/webpack/loaders/next-client-pages-loader.ts // Adapted from https://github.com/vercel/next.js/blob/b7f9f1f98fc8ab602e84825105b5727272b72e7d/packages/next/src/build/webpack/loaders/next-client-pages-loader.ts
;(window.__NEXT_P = window.__NEXT_P || []).push([ ;(window.__NEXT_P = window.__NEXT_P || []).push([
PAGE_PATH, PAGE_PATH,
() => { () => {
......
...@@ -18,7 +18,6 @@ This plugin transforms Next.js source code by: ...@@ -18,7 +18,6 @@ This plugin transforms Next.js source code by:
## Build Process Details ## Build Process Details
- **Two-Pass Build:** - **Two-Pass Build:**
1. **First Pass:** 1. **First Pass:**
- Extracts new errors and temporarily stores them in `packages/next/.errors/*.json`. - Extracts new errors and temporarily stores them in `packages/next/.errors/*.json`.
- In CI, a build with new errors will fail. - In CI, a build with new errors will fail.
...@@ -31,7 +30,6 @@ This plugin transforms Next.js source code by: ...@@ -31,7 +30,6 @@ This plugin transforms Next.js source code by:
## Modifying the Plugin ## Modifying the Plugin
- **WASM Rebuild Required:** - **WASM Rebuild Required:**
- After modifying the plugin, rebuild the WASM file via `pnpm build-error-code-plugin` and commit it to the repository. - After modifying the plugin, rebuild the WASM file via `pnpm build-error-code-plugin` and commit it to the repository.
- **Reason:** Pre-built artifacts simplify the build process (`pnpm build` runs without requiring `cargo`). - **Reason:** Pre-built artifacts simplify the build process (`pnpm build` runs without requiring `cargo`).
......
...@@ -31,9 +31,8 @@ async function webpackFinal(config) { ...@@ -31,9 +31,8 @@ async function webpackFinal(config) {
// we need to resolve next-babel-loader since it's not available // we need to resolve next-babel-loader since it's not available
// relative with storybook's config // relative with storybook's config
if (rule.use && rule.use.loader === 'next-babel-loader') { if (rule.use && rule.use.loader === 'next-babel-loader') {
rule.use.loader = require.resolve( rule.use.loader =
'next/dist/build/webpack/loaders/next-babel-loader' require.resolve('next/dist/build/webpack/loaders/next-babel-loader')
)
} }
return rule return rule
}), }),
......
...@@ -68,6 +68,7 @@ Each route can have: ...@@ -68,6 +68,7 @@ Each route can have:
### Redirects ### Redirects
When a route has: When a route has:
- A redirect status code (300-399) - A redirect status code (300-399)
- Headers containing `Location` or `Refresh` - Headers containing `Location` or `Refresh`
......
...@@ -42,6 +42,7 @@ Contributions to Next.js are welcome and highly appreciated. However, before you ...@@ -42,6 +42,7 @@ Contributions to Next.js are welcome and highly appreciated. However, before you
We have a list of **[good first issues](https://github.com/vercel/next.js/labels/good%20first%20issue)** that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process. We have a list of **[good first issues](https://github.com/vercel/next.js/labels/good%20first%20issue)** that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.
--- ---
## Security ## Security
If you believe you have found a security vulnerability in Next.js, we encourage you to **_responsibly disclose this and NOT open a public issue_**. If you believe you have found a security vulnerability in Next.js, we encourage you to **_responsibly disclose this and NOT open a public issue_**.
......
...@@ -120,9 +120,8 @@ module.exports = ({ dev, ...rest }) => { ...@@ -120,9 +120,8 @@ module.exports = ({ dev, ...rest }) => {
// We've experienced `singletonStyleTag` that the later updated styles not being applied. // We've experienced `singletonStyleTag` that the later updated styles not being applied.
// Keep using `styleTag` to ensure when new styles injected the style can also be updated. // Keep using `styleTag` to ensure when new styles injected the style can also be updated.
injectType: 'styleTag', injectType: 'styleTag',
insert: require.resolve( insert:
'./src/build/webpack/loaders/devtool/devtool-style-inject.js' require.resolve('./src/build/webpack/loaders/devtool/devtool-style-inject.js'),
),
}, },
}, },
{ loader: 'css-loader', options: { sourceMap: false } }, { loader: 'css-loader', options: { sourceMap: false } },
......
...@@ -510,27 +510,20 @@ export function createVendoredReactAliases( ...@@ -510,27 +510,20 @@ export function createVendoredReactAliases(
export function getOptimizedModuleAliases(): CompilerAliases { export function getOptimizedModuleAliases(): CompilerAliases {
return { return {
unfetch: require.resolve('next/dist/build/polyfills/fetch/index.js'), unfetch: require.resolve('next/dist/build/polyfills/fetch/index.js'),
'isomorphic-unfetch': require.resolve( 'isomorphic-unfetch':
'next/dist/build/polyfills/fetch/index.js' require.resolve('next/dist/build/polyfills/fetch/index.js'),
), 'whatwg-fetch':
'whatwg-fetch': require.resolve( require.resolve('next/dist/build/polyfills/fetch/whatwg-fetch.js'),
'next/dist/build/polyfills/fetch/whatwg-fetch.js' 'object-assign':
), require.resolve('next/dist/build/polyfills/object-assign.js'),
'object-assign': require.resolve( 'object.assign/auto':
'next/dist/build/polyfills/object-assign.js' require.resolve('next/dist/build/polyfills/object.assign/auto.js'),
), 'object.assign/implementation':
'object.assign/auto': require.resolve( require.resolve('next/dist/build/polyfills/object.assign/implementation.js'),
'next/dist/build/polyfills/object.assign/auto.js' 'object.assign/polyfill':
), require.resolve('next/dist/build/polyfills/object.assign/polyfill.js'),
'object.assign/implementation': require.resolve( 'object.assign/shim':
'next/dist/build/polyfills/object.assign/implementation.js' require.resolve('next/dist/build/polyfills/object.assign/shim.js'),
),
'object.assign/polyfill': require.resolve(
'next/dist/build/polyfills/object.assign/polyfill.js'
),
'object.assign/shim': require.resolve(
'next/dist/build/polyfills/object.assign/shim.js'
),
url: require.resolve('next/dist/compiled/native-url'), url: require.resolve('next/dist/compiled/native-url'),
} }
} }
......
...@@ -533,14 +533,12 @@ export async function createPagesMapping({ ...@@ -533,14 +533,12 @@ export async function createPagesMapping({
// If there's any app pages existed, add a default /_not-found route as 404. // If there's any app pages existed, add a default /_not-found route as 404.
// If there's any custom /_not-found page, it will override the default one. // If there's any custom /_not-found page, it will override the default one.
...(hasAppPages && { ...(hasAppPages && {
[UNDERSCORE_NOT_FOUND_ROUTE_ENTRY]: require.resolve( [UNDERSCORE_NOT_FOUND_ROUTE_ENTRY]:
'next/dist/client/components/builtin/global-not-found' require.resolve('next/dist/client/components/builtin/global-not-found'),
),
}), }),
...(hasAppGlobalError && { ...(hasAppGlobalError && {
[UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY]: require.resolve( [UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY]:
'next/dist/client/components/builtin/app-error' require.resolve('next/dist/client/components/builtin/app-error'),
),
}), }),
...pages, ...pages,
} }
......
...@@ -3221,8 +3221,11 @@ export default async function build( ...@@ -3221,8 +3221,11 @@ export default async function build(
for (const route of staticPrerenderedRoutes) { for (const route of staticPrerenderedRoutes) {
if (isDynamicRoute(page) && route.pathname === page) continue if (isDynamicRoute(page) && route.pathname === page) continue
const { metadata = {}, hasEmptyStaticShell, hasPostponed } = const {
exportResult.byPath.get(route.pathname) ?? {} metadata = {},
hasEmptyStaticShell,
hasPostponed,
} = exportResult.byPath.get(route.pathname) ?? {}
const cacheControl = getCacheControl( const cacheControl = getCacheControl(
route.pathname, route.pathname,
......
...@@ -18,9 +18,8 @@ const nextDistPath = new RegExp( ...@@ -18,9 +18,8 @@ const nextDistPath = new RegExp(
const nodeModulesPath = /[\\/]node_modules[\\/]/ const nodeModulesPath = /[\\/]node_modules[\\/]/
const regeneratorRuntimePath = require.resolve( const regeneratorRuntimePath =
'next/dist/compiled/regenerator-runtime' require.resolve('next/dist/compiled/regenerator-runtime')
)
function isTypeScriptFile(filename: string) { function isTypeScriptFile(filename: string) {
return filename.endsWith('.ts') || filename.endsWith('.tsx') return filename.endsWith('.ts') || filename.endsWith('.tsx')
......
...@@ -369,8 +369,10 @@ export type WrittenEndpoint = ...@@ -369,8 +369,10 @@ export type WrittenEndpoint =
config: EndpointConfig config: EndpointConfig
} }
export interface ProjectOptions export interface ProjectOptions extends Omit<
extends Omit<NapiProjectOptions, 'nextConfig' | 'env'> { NapiProjectOptions,
'nextConfig' | 'env'
> {
/** /**
* The next.config.js contents. * The next.config.js contents.
*/ */
...@@ -382,8 +384,10 @@ export interface ProjectOptions ...@@ -382,8 +384,10 @@ export interface ProjectOptions
env: Record<string, string> env: Record<string, string>
} }
export interface PartialProjectOptions export interface PartialProjectOptions extends Omit<
extends Omit<NapiPartialProjectOptions, 'nextConfig' | 'env'> { NapiPartialProjectOptions,
'nextConfig' | 'env'
> {
rootPath: NapiProjectOptions['rootPath'] rootPath: NapiProjectOptions['rootPath']
projectPath: NapiProjectOptions['projectPath'] projectPath: NapiProjectOptions['projectPath']
/** /**
......
...@@ -4,9 +4,13 @@ import type { IncomingMessage, ServerResponse } from 'node:http' ...@@ -4,9 +4,13 @@ import type { IncomingMessage, ServerResponse } from 'node:http'
import { import {
AppPageRouteModule, AppPageRouteModule,
type AppPageRouteHandlerContext, type AppPageRouteHandlerContext,
} from '../../server/route-modules/app-page/module.compiled' with { 'turbopack-transition': 'next-ssr' } } from '../../server/route-modules/app-page/module.compiled' with {
'turbopack-transition': 'next-ssr',
}
import { RouteKind } from '../../server/route-kind' with { 'turbopack-transition': 'next-server-utility' } import { RouteKind } from '../../server/route-kind' with {
'turbopack-transition': 'next-server-utility',
}
import { getRevalidateReason } from '../../server/instrumentation/utils' import { getRevalidateReason } from '../../server/instrumentation/utils'
import { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer' import { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'
...@@ -70,7 +74,9 @@ declare const tree: LoaderTree ...@@ -70,7 +74,9 @@ declare const tree: LoaderTree
// module. // module.
// INJECT:tree // INJECT:tree
import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' } import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with {
'turbopack-transition': 'next-server-utility',
}
export { GlobalError } export { GlobalError }
...@@ -86,13 +92,17 @@ export const __next_app__ = { ...@@ -86,13 +92,17 @@ export const __next_app__ = {
loadChunk: __next_app_load_chunk__, loadChunk: __next_app_load_chunk__,
} }
import * as entryBase from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' } import * as entryBase from '../../server/app-render/entry-base' with {
'turbopack-transition': 'next-server-utility',
}
import { RedirectStatusCode } from '../../client/components/redirect-status-code' import { RedirectStatusCode } from '../../client/components/redirect-status-code'
import { InvariantError } from '../../shared/lib/invariant-error' import { InvariantError } from '../../shared/lib/invariant-error'
import { scheduleOnNextTick } from '../../lib/scheduler' import { scheduleOnNextTick } from '../../lib/scheduler'
import { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes' import { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes'
export * from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' } export * from '../../server/app-render/entry-base' with {
'turbopack-transition': 'next-server-utility',
}
// Create and export the route module that will be consumed. // Create and export the route module that will be consumed.
export const routeModule = new AppPageRouteModule({ export const routeModule = new AppPageRouteModule({
......
...@@ -545,9 +545,8 @@ export default async function getBaseWebpackConfig( ...@@ -545,9 +545,8 @@ export default async function getBaseWebpackConfig(
emitDecoratorMetadata: Boolean( emitDecoratorMetadata: Boolean(
jsConfig?.compilerOptions?.emitDecoratorMetadata jsConfig?.compilerOptions?.emitDecoratorMetadata
), ),
regeneratorRuntimePath: require.resolve( regeneratorRuntimePath:
'next/dist/compiled/regenerator-runtime' require.resolve('next/dist/compiled/regenerator-runtime'),
),
...extraOptions, ...extraOptions,
}, },
...@@ -936,9 +935,9 @@ export default async function getBaseWebpackConfig( ...@@ -936,9 +935,9 @@ export default async function getBaseWebpackConfig(
const telemetryPlugin = const telemetryPlugin =
!dev && !dev &&
isClient && isClient &&
new (( new (
require('./webpack/plugins/telemetry-plugin/telemetry-plugin') as typeof import('./webpack/plugins/telemetry-plugin/telemetry-plugin') require('./webpack/plugins/telemetry-plugin/telemetry-plugin') as typeof import('./webpack/plugins/telemetry-plugin/telemetry-plugin')
).TelemetryPlugin)( ).TelemetryPlugin(
new Map( new Map(
[ [
['swcLoader', useSWCLoader], ['swcLoader', useSWCLoader],
...@@ -1838,69 +1837,44 @@ export default async function getBaseWebpackConfig( ...@@ -1838,69 +1837,44 @@ export default async function getBaseWebpackConfig(
setImmediate: false, setImmediate: false,
} }
: { : {
assert: require.resolve( assert:
'next/dist/compiled/assert' require.resolve('next/dist/compiled/assert'),
), buffer:
buffer: require.resolve( require.resolve('next/dist/compiled/buffer'),
'next/dist/compiled/buffer' constants:
), require.resolve('next/dist/compiled/constants-browserify'),
constants: require.resolve( crypto:
'next/dist/compiled/constants-browserify' require.resolve('next/dist/compiled/crypto-browserify'),
), domain:
crypto: require.resolve( require.resolve('next/dist/compiled/domain-browser'),
'next/dist/compiled/crypto-browserify' http: require.resolve('next/dist/compiled/stream-http'),
), https:
domain: require.resolve( require.resolve('next/dist/compiled/https-browserify'),
'next/dist/compiled/domain-browser' os: require.resolve('next/dist/compiled/os-browserify'),
), path: require.resolve('next/dist/compiled/path-browserify'),
http: require.resolve( punycode:
'next/dist/compiled/stream-http' require.resolve('next/dist/compiled/punycode'),
),
https: require.resolve(
'next/dist/compiled/https-browserify'
),
os: require.resolve(
'next/dist/compiled/os-browserify'
),
path: require.resolve(
'next/dist/compiled/path-browserify'
),
punycode: require.resolve(
'next/dist/compiled/punycode'
),
process: require.resolve('./polyfills/process'), process: require.resolve('./polyfills/process'),
// Handled in separate alias // Handled in separate alias
querystring: require.resolve( querystring:
'next/dist/compiled/querystring-es3' require.resolve('next/dist/compiled/querystring-es3'),
), stream:
stream: require.resolve( require.resolve('next/dist/compiled/stream-browserify'),
'next/dist/compiled/stream-browserify' string_decoder:
), require.resolve('next/dist/compiled/string_decoder'),
string_decoder: require.resolve(
'next/dist/compiled/string_decoder'
),
sys: require.resolve('next/dist/compiled/util'), sys: require.resolve('next/dist/compiled/util'),
timers: require.resolve( timers:
'next/dist/compiled/timers-browserify' require.resolve('next/dist/compiled/timers-browserify'),
), tty: require.resolve('next/dist/compiled/tty-browserify'),
tty: require.resolve(
'next/dist/compiled/tty-browserify'
),
// Handled in separate alias // Handled in separate alias
// url: require.resolve('url'), // url: require.resolve('url'),
util: require.resolve('next/dist/compiled/util'), util: require.resolve('next/dist/compiled/util'),
vm: require.resolve( vm: require.resolve('next/dist/compiled/vm-browserify'),
'next/dist/compiled/vm-browserify' zlib: require.resolve('next/dist/compiled/browserify-zlib'),
), events:
zlib: require.resolve( require.resolve('next/dist/compiled/events'),
'next/dist/compiled/browserify-zlib' setImmediate:
), require.resolve('next/dist/compiled/setimmediate'),
events: require.resolve(
'next/dist/compiled/events'
),
setImmediate: require.resolve(
'next/dist/compiled/setimmediate'
),
}, },
}, },
}, },
...@@ -2041,12 +2015,11 @@ export default async function getBaseWebpackConfig( ...@@ -2041,12 +2015,11 @@ export default async function getBaseWebpackConfig(
}), }),
isNodeServer && isNodeServer &&
!dev && !dev &&
new ( new ((
(
require('./webpack/plugins/next-trace-entrypoints-plugin') as typeof import('./webpack/plugins/next-trace-entrypoints-plugin') require('./webpack/plugins/next-trace-entrypoints-plugin') as typeof import('./webpack/plugins/next-trace-entrypoints-plugin')
) )
.TraceEntryPointsPlugin as typeof import('./webpack/plugins/next-trace-entrypoints-plugin').TraceEntryPointsPlugin .TraceEntryPointsPlugin as typeof import('./webpack/plugins/next-trace-entrypoints-plugin').TraceEntryPointsPlugin)(
)({ {
rootDir: dir, rootDir: dir,
appDir: appDir, appDir: appDir,
pagesDir: pagesDir, pagesDir: pagesDir,
...@@ -2055,7 +2028,8 @@ export default async function getBaseWebpackConfig( ...@@ -2055,7 +2028,8 @@ export default async function getBaseWebpackConfig(
appDirEnabled: hasAppDir, appDirEnabled: hasAppDir,
traceIgnores: [], traceIgnores: [],
compilerType, compilerType,
}), }
),
// Moment.js is an extremely popular library that bundles large locale files // Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical // by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales. // solution that requires the user to opt into importing specific locales.
...@@ -2184,13 +2158,13 @@ export default async function getBaseWebpackConfig( ...@@ -2184,13 +2158,13 @@ export default async function getBaseWebpackConfig(
telemetryPlugin, telemetryPlugin,
!dev && !dev &&
isNodeServer && isNodeServer &&
new (( new (
require('./webpack/plugins/telemetry-plugin/telemetry-plugin') as typeof import('./webpack/plugins/telemetry-plugin/telemetry-plugin') require('./webpack/plugins/telemetry-plugin/telemetry-plugin') as typeof import('./webpack/plugins/telemetry-plugin/telemetry-plugin')
).TelemetryPlugin)(new Map()), ).TelemetryPlugin(new Map()),
shouldEnableSlowModuleDetection && shouldEnableSlowModuleDetection &&
new (( new (
require('./webpack/plugins/slow-module-detection-plugin') as typeof import('./webpack/plugins/slow-module-detection-plugin') require('./webpack/plugins/slow-module-detection-plugin') as typeof import('./webpack/plugins/slow-module-detection-plugin')
).default)({ ).default({
compilerType, compilerType,
...config.experimental.slowModuleDetection!, ...config.experimental.slowModuleDetection!,
}), }),
......
...@@ -196,12 +196,10 @@ export const css = curry(async function css( ...@@ -196,12 +196,10 @@ export const css = curry(async function css(
const fns: ConfigurationFn[] = [] const fns: ConfigurationFn[] = []
const googleLoader = require.resolve( const googleLoader =
'next/dist/compiled/@next/font/google/loader' require.resolve('next/dist/compiled/@next/font/google/loader')
) const localLoader =
const localLoader = require.resolve( require.resolve('next/dist/compiled/@next/font/local/loader')
'next/dist/compiled/@next/font/local/loader'
)
const nextFontLoaders: Array<[string | RegExp, string, any?]> = [ const nextFontLoaders: Array<[string | RegExp, string, any?]> = [
[require.resolve('next/font/google/target.css'), googleLoader], [require.resolve('next/font/google/target.css'), googleLoader],
[require.resolve('next/font/local/target.css'), localLoader], [require.resolve('next/font/local/target.css'), localLoader],
...@@ -262,9 +260,8 @@ export const css = curry(async function css( ...@@ -262,9 +260,8 @@ export const css = curry(async function css(
issuerLayer: APP_LAYER_RULE, issuerLayer: APP_LAYER_RULE,
use: [ use: [
{ {
loader: require.resolve( loader:
'../../../loaders/next-flight-css-loader' require.resolve('../../../loaders/next-flight-css-loader'),
),
options: { options: {
cssModules: true, cssModules: true,
}, },
...@@ -302,9 +299,8 @@ export const css = curry(async function css( ...@@ -302,9 +299,8 @@ export const css = curry(async function css(
issuerLayer: APP_LAYER_RULE, issuerLayer: APP_LAYER_RULE,
use: [ use: [
{ {
loader: require.resolve( loader:
'../../../loaders/next-flight-css-loader' require.resolve('../../../loaders/next-flight-css-loader'),
),
options: { options: {
cssModules: true, cssModules: true,
}, },
...@@ -356,9 +352,8 @@ export const css = curry(async function css( ...@@ -356,9 +352,8 @@ export const css = curry(async function css(
test: [regexCssGlobal, regexSassGlobal], test: [regexCssGlobal, regexSassGlobal],
issuerLayer: APP_LAYER_RULE, issuerLayer: APP_LAYER_RULE,
use: { use: {
loader: require.resolve( loader:
'../../../loaders/next-flight-css-loader' require.resolve('../../../loaders/next-flight-css-loader'),
),
options: { options: {
cssModules: false, cssModules: false,
}, },
...@@ -414,9 +409,8 @@ export const css = curry(async function css( ...@@ -414,9 +409,8 @@ export const css = curry(async function css(
issuerLayer: APP_LAYER_RULE, issuerLayer: APP_LAYER_RULE,
use: [ use: [
{ {
loader: require.resolve( loader:
'../../../loaders/next-flight-css-loader' require.resolve('../../../loaders/next-flight-css-loader'),
),
options: { options: {
cssModules: false, cssModules: false,
}, },
...@@ -433,9 +427,8 @@ export const css = curry(async function css( ...@@ -433,9 +427,8 @@ export const css = curry(async function css(
issuerLayer: APP_LAYER_RULE, issuerLayer: APP_LAYER_RULE,
use: [ use: [
{ {
loader: require.resolve( loader:
'../../../loaders/next-flight-css-loader' require.resolve('../../../loaders/next-flight-css-loader'),
),
options: { options: {
cssModules: false, cssModules: false,
}, },
......
...@@ -34,9 +34,8 @@ const EdgeAppRouteLoader: webpack.LoaderDefinitionFunction<EdgeAppRouteLoaderQue ...@@ -34,9 +34,8 @@ const EdgeAppRouteLoader: webpack.LoaderDefinitionFunction<EdgeAppRouteLoaderQue
const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}') const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}')
if (!cacheHandlers.default) { if (!cacheHandlers.default) {
cacheHandlers.default = require.resolve( cacheHandlers.default =
'../../../../server/lib/cache-handlers/default.external' require.resolve('../../../../server/lib/cache-handlers/default.external')
)
} }
// Ensure we only run this loader for as a module. // Ensure we only run this loader for as a module.
......
...@@ -83,9 +83,8 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> = ...@@ -83,9 +83,8 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> =
const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}') const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}')
if (!cacheHandlers.default) { if (!cacheHandlers.default) {
cacheHandlers.default = require.resolve( cacheHandlers.default =
'../../../../server/lib/cache-handlers/default.external' require.resolve('../../../../server/lib/cache-handlers/default.external')
)
} }
const middlewareConfig: ProxyConfig = JSON.parse( const middlewareConfig: ProxyConfig = JSON.parse(
......
...@@ -34,8 +34,7 @@ interface SourceMap extends RawSourceMap { ...@@ -34,8 +34,7 @@ interface SourceMap extends RawSourceMap {
version: number version: number
} }
export interface EvalSourceMapDevToolPluginOptions export interface EvalSourceMapDevToolPluginOptions extends SourceMapDevToolPluginOptions {
extends SourceMapDevToolPluginOptions {
// Fork // Fork
shouldIgnorePath?: (modulePath: string) => boolean shouldIgnorePath?: (modulePath: string) => boolean
} }
......
...@@ -31,8 +31,7 @@ interface HTTPAccessFallbackBoundaryProps { ...@@ -31,8 +31,7 @@ interface HTTPAccessFallbackBoundaryProps {
missingSlots?: Set<string> missingSlots?: Set<string>
} }
interface HTTPAccessFallbackErrorBoundaryProps interface HTTPAccessFallbackErrorBoundaryProps extends HTTPAccessFallbackBoundaryProps {
extends HTTPAccessFallbackBoundaryProps {
pathname: string | null pathname: string | null
missingSlots?: Set<string> missingSlots?: Set<string>
} }
......
...@@ -46,9 +46,8 @@ export function getFlightDataPartsFromPath( ...@@ -46,9 +46,8 @@ export function getFlightDataPartsFromPath(
// Pick the last 4 items from the `FlightDataPath` to get the [tree, seedData, viewport, isHeadPartial]. // Pick the last 4 items from the `FlightDataPath` to get the [tree, seedData, viewport, isHeadPartial].
const flightDataPathLength = 4 const flightDataPathLength = 4
// tree, seedData, and head are *always* the last three items in the `FlightDataPath`. // tree, seedData, and head are *always* the last three items in the `FlightDataPath`.
const [tree, seedData, head, isHeadPartial] = flightDataPath.slice( const [tree, seedData, head, isHeadPartial] =
-flightDataPathLength flightDataPath.slice(-flightDataPathLength)
)
// The `FlightSegmentPath` is everything except the last three items. For a root render, it won't be present. // The `FlightSegmentPath` is everything except the last three items. For a root render, it won't be present.
const segmentPath = flightDataPath.slice(0, -flightDataPathLength) const segmentPath = flightDataPath.slice(0, -flightDataPathLength)
......
...@@ -107,8 +107,7 @@ export function StatusIndicator({ status, onClick }: StatusIndicatorProps) { ...@@ -107,8 +107,7 @@ export function StatusIndicator({ status, onClick }: StatusIndicatorProps) {
} }
[data-status-text-enter] { [data-status-text-enter] {
animation: slotMachineEnter 150ms cubic-bezier(0, 0, 0.2, 1) animation: slotMachineEnter 150ms cubic-bezier(0, 0, 0.2, 1) forwards;
forwards;
} }
} }
......
...@@ -13,9 +13,9 @@ export const FontStyles = () => { ...@@ -13,9 +13,9 @@ export const FontStyles = () => {
font-display: swap; font-display: swap;
src: url(/__nextjs_font/geist-latin-ext.woff2) format('woff2'); src: url(/__nextjs_font/geist-latin-ext.woff2) format('woff2');
unicode-range: unicode-range:
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
} }
/* latin-ext */ /* latin-ext */
@font-face { @font-face {
...@@ -25,9 +25,9 @@ export const FontStyles = () => { ...@@ -25,9 +25,9 @@ export const FontStyles = () => {
font-display: swap; font-display: swap;
src: url(/__nextjs_font/geist-mono-latin-ext.woff2) format('woff2'); src: url(/__nextjs_font/geist-mono-latin-ext.woff2) format('woff2');
unicode-range: unicode-range:
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
} }
/* latin */ /* latin */
@font-face { @font-face {
...@@ -38,8 +38,8 @@ export const FontStyles = () => { ...@@ -38,8 +38,8 @@ export const FontStyles = () => {
src: url(/__nextjs_font/geist-latin.woff2) format('woff2'); src: url(/__nextjs_font/geist-latin.woff2) format('woff2');
unicode-range: unicode-range:
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
U+2212, U+2215, U+FEFF, U+FFFD; U+2215, U+FEFF, U+FFFD;
} }
/* latin */ /* latin */
@font-face { @font-face {
...@@ -50,8 +50,8 @@ export const FontStyles = () => { ...@@ -50,8 +50,8 @@ export const FontStyles = () => {
src: url(/__nextjs_font/geist-mono-latin.woff2) format('woff2'); src: url(/__nextjs_font/geist-mono-latin.woff2) format('woff2');
unicode-range: unicode-range:
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
U+2212, U+2215, U+FEFF, U+FFFD; U+2215, U+FEFF, U+FFFD;
} }
` `
document.head.appendChild(style) document.head.appendChild(style)
......
...@@ -56,7 +56,9 @@ describe('css template literal tag', () => { ...@@ -56,7 +56,9 @@ describe('css template literal tag', () => {
}) })
it('should handle empty strings', () => { it('should handle empty strings', () => {
const result = css`` const result = css`
`
expect(result).toBe('') expect(result).toBe('')
}) })
......
...@@ -52,8 +52,9 @@ export function ignoreListAnonymousStackFramesIfSandwiched( ...@@ -52,8 +52,9 @@ export function ignoreListAnonymousStackFramesIfSandwiched(
: '' : ''
}, },
(response) => { (response) => {
;(response as PromiseFulfilledResult<OriginalStackFrameResponse>) ;(
.value.originalStackFrame!.ignored = true response as PromiseFulfilledResult<OriginalStackFrameResponse>
).value.originalStackFrame!.ignored = true
} }
) )
} }
......
import type { AsyncLocalStorage } from 'async_hooks' import type { AsyncLocalStorage } from 'async_hooks'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { actionAsyncStorageInstance } from './action-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { actionAsyncStorageInstance } from './action-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
export interface ActionStore { export interface ActionStore {
readonly isAction?: boolean readonly isAction?: boolean
readonly isAppRoute?: boolean readonly isAppRoute?: boolean
......
import type { AsyncLocalStorage } from 'async_hooks' import type { AsyncLocalStorage } from 'async_hooks'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { afterTaskAsyncStorageInstance as afterTaskAsyncStorage } from './after-task-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { afterTaskAsyncStorageInstance as afterTaskAsyncStorage } from './after-task-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
import type { WorkUnitStore } from './work-unit-async-storage.external' import type { WorkUnitStore } from './work-unit-async-storage.external'
export interface AfterTaskStore { export interface AfterTaskStore {
......
...@@ -4,9 +4,9 @@ const sharedAsyncLocalStorageNotAvailableError = new Error( ...@@ -4,9 +4,9 @@ const sharedAsyncLocalStorageNotAvailableError = new Error(
'Invariant: AsyncLocalStorage accessed in runtime where it is not available' 'Invariant: AsyncLocalStorage accessed in runtime where it is not available'
) )
class FakeAsyncLocalStorage<Store extends {}> class FakeAsyncLocalStorage<
implements AsyncLocalStorage<Store> Store extends {},
{ > implements AsyncLocalStorage<Store> {
disable(): void { disable(): void {
throw sharedAsyncLocalStorageNotAvailableError throw sharedAsyncLocalStorageNotAvailableError
} }
......
import type { AsyncLocalStorage } from 'async_hooks' import type { AsyncLocalStorage } from 'async_hooks'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { consoleAsyncStorageInstance } from './console-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { consoleAsyncStorageInstance } from './console-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
export interface ConsoleStore { export interface ConsoleStore {
/** /**
......
import type { AsyncLocalStorage } from 'async_hooks' import type { AsyncLocalStorage } from 'async_hooks'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { dynamicAccessAsyncStorageInstance } from './dynamic-access-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { dynamicAccessAsyncStorageInstance } from './dynamic-access-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
export interface DynamicAccessAsyncStore { export interface DynamicAccessAsyncStore {
readonly abortController: AbortController readonly abortController: AbortController
......
...@@ -6,6 +6,8 @@ import { ...@@ -6,6 +6,8 @@ import {
trackPendingChunkLoad, trackPendingChunkLoad,
trackPendingImport, trackPendingImport,
trackPendingModules, trackPendingModules,
} from './track-module-loading.instance' with { 'turbopack-transition': 'next-shared' } } from './track-module-loading.instance' with {
'turbopack-transition': 'next-shared',
}
export { trackPendingChunkLoad, trackPendingImport, trackPendingModules } export { trackPendingChunkLoad, trackPendingImport, trackPendingModules }
...@@ -7,7 +7,9 @@ import type { AfterContext } from '../after/after-context' ...@@ -7,7 +7,9 @@ import type { AfterContext } from '../after/after-context'
import type { CacheLife } from '../use-cache/cache-life' import type { CacheLife } from '../use-cache/cache-life'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { workAsyncStorageInstance } from './work-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { workAsyncStorageInstance } from './work-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
import type { LazyResult } from '../lib/lazy-result' import type { LazyResult } from '../lib/lazy-result'
import type { DigestedError } from './create-error-handler' import type { DigestedError } from './create-error-handler'
import type { ActionRevalidationKind } from '../../shared/lib/action-revalidation-kind' import type { ActionRevalidationKind } from '../../shared/lib/action-revalidation-kind'
......
...@@ -8,7 +8,9 @@ import type { DynamicTrackingState } from './dynamic-rendering' ...@@ -8,7 +8,9 @@ import type { DynamicTrackingState } from './dynamic-rendering'
import type { OpaqueFallbackRouteParams } from '../request/fallback-params' import type { OpaqueFallbackRouteParams } from '../request/fallback-params'
// Share the instance module in the next-shared layer // Share the instance module in the next-shared layer
import { workUnitAsyncStorageInstance } from './work-unit-async-storage-instance' with { 'turbopack-transition': 'next-shared' } import { workUnitAsyncStorageInstance } from './work-unit-async-storage-instance' with {
'turbopack-transition': 'next-shared',
}
import type { ServerComponentsHmrCache } from '../response-cache' import type { ServerComponentsHmrCache } from '../response-cache'
import type { import type {
RenderResumeDataCache, RenderResumeDataCache,
...@@ -108,19 +110,16 @@ export type StaticPrerenderStoreModern = Exclude< ...@@ -108,19 +110,16 @@ export type StaticPrerenderStoreModern = Exclude<
> >
export interface PrerenderStoreModernClient export interface PrerenderStoreModernClient
extends PrerenderStoreModernCommon, extends PrerenderStoreModernCommon, StaticPrerenderStoreCommon {
StaticPrerenderStoreCommon {
readonly type: 'prerender-client' readonly type: 'prerender-client'
} }
export interface PrerenderStoreModernServer export interface PrerenderStoreModernServer
extends PrerenderStoreModernCommon, extends PrerenderStoreModernCommon, StaticPrerenderStoreCommon {
StaticPrerenderStoreCommon {
readonly type: 'prerender' readonly type: 'prerender'
} }
export interface PrerenderStoreModernRuntime export interface PrerenderStoreModernRuntime extends PrerenderStoreModernCommon {
extends PrerenderStoreModernCommon {
readonly type: 'prerender-runtime' readonly type: 'prerender-runtime'
/** /**
...@@ -149,8 +148,7 @@ export interface RevalidateStore { ...@@ -149,8 +148,7 @@ export interface RevalidateStore {
} }
interface PrerenderStoreModernCommon interface PrerenderStoreModernCommon
extends CommonWorkUnitStore, extends CommonWorkUnitStore, RevalidateStore {
RevalidateStore {
/** /**
* The render signal is aborted after React's `prerender` function is aborted * The render signal is aborted after React's `prerender` function is aborted
* (using a separate signal), which happens in two cases: * (using a separate signal), which happens in two cases:
...@@ -226,8 +224,7 @@ interface StaticPrerenderStoreCommon { ...@@ -226,8 +224,7 @@ interface StaticPrerenderStoreCommon {
} }
export interface PrerenderStorePPR export interface PrerenderStorePPR
extends CommonWorkUnitStore, extends CommonWorkUnitStore, RevalidateStore {
RevalidateStore {
readonly type: 'prerender-ppr' readonly type: 'prerender-ppr'
readonly rootParams: Params readonly rootParams: Params
readonly dynamicTracking: null | DynamicTrackingState readonly dynamicTracking: null | DynamicTrackingState
...@@ -245,8 +242,7 @@ export interface PrerenderStorePPR ...@@ -245,8 +242,7 @@ export interface PrerenderStorePPR
} }
export interface PrerenderStoreLegacy export interface PrerenderStoreLegacy
extends CommonWorkUnitStore, extends CommonWorkUnitStore, RevalidateStore {
RevalidateStore {
readonly type: 'prerender-legacy' readonly type: 'prerender-legacy'
readonly rootParams: Params readonly rootParams: Params
} }
...@@ -262,8 +258,10 @@ export type StaticPrerenderStore = Exclude< ...@@ -262,8 +258,10 @@ export type StaticPrerenderStore = Exclude<
PrerenderStoreModernRuntime PrerenderStoreModernRuntime
> >
export interface CommonCacheStore export interface CommonCacheStore extends Omit<
extends Omit<CommonWorkUnitStore, 'implicitTags'> { CommonWorkUnitStore,
'implicitTags'
> {
/** /**
* A cache work unit store might not always have an outer work unit store, * A cache work unit store might not always have an outer work unit store,
* from which implicit tags could be inherited. * from which implicit tags could be inherited.
......
...@@ -264,9 +264,8 @@ type BaseRenderOpts = RenderOpts & { ...@@ -264,9 +264,8 @@ type BaseRenderOpts = RenderOpts & {
*/ */
export interface BaseRequestHandler< export interface BaseRequestHandler<
ServerRequest extends BaseNextRequest | IncomingMessage = BaseNextRequest, ServerRequest extends BaseNextRequest | IncomingMessage = BaseNextRequest,
ServerResponse extends ServerResponse extends BaseNextResponse | HTTPServerResponse =
| BaseNextResponse BaseNextResponse,
| HTTPServerResponse = BaseNextResponse,
> { > {
( (
req: ServerRequest, req: ServerRequest,
......
...@@ -480,9 +480,8 @@ export async function findPagePathData( ...@@ -480,9 +480,8 @@ export async function findPagePathData(
// If they're not presented, then fallback to global-not-found // If they're not presented, then fallback to global-not-found
return { return {
filename: require.resolve( filename:
'next/dist/client/components/builtin/global-not-found' require.resolve('next/dist/client/components/builtin/global-not-found'),
),
bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`, bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`,
page: UNDERSCORE_NOT_FOUND_ROUTE_ENTRY, page: UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,
} }
......
...@@ -496,9 +496,7 @@ async function startWatcher( ...@@ -496,9 +496,7 @@ async function startWatcher(
const isAppPath = Boolean( const isAppPath = Boolean(
appDir && appDir &&
normalizePathSep(fileName).startsWith( normalizePathSep(fileName).startsWith(normalizePathSep(appDir) + '/')
normalizePathSep(appDir) + '/'
)
) )
const isPagePath = Boolean( const isPagePath = Boolean(
pagesDir && pagesDir &&
......
import type { RouteDefinition } from './route-definition' import type { RouteDefinition } from './route-definition'
import { RouteKind } from '../route-kind' import { RouteKind } from '../route-kind'
export interface AppPageRouteDefinition export interface AppPageRouteDefinition extends RouteDefinition<RouteKind.APP_PAGE> {
extends RouteDefinition<RouteKind.APP_PAGE> {
readonly appPaths: ReadonlyArray<string> readonly appPaths: ReadonlyArray<string>
} }
......
import type { RouteKind } from '../route-kind' import type { RouteKind } from '../route-kind'
import type { RouteDefinition } from './route-definition' import type { RouteDefinition } from './route-definition'
export interface AppRouteRouteDefinition export interface AppRouteRouteDefinition extends RouteDefinition<RouteKind.APP_ROUTE> {}
extends RouteDefinition<RouteKind.APP_ROUTE> {}
import type { RouteDefinition } from './route-definition' import type { RouteDefinition } from './route-definition'
import type { RouteKind } from '../route-kind' import type { RouteKind } from '../route-kind'
export interface LocaleRouteDefinition<K extends RouteKind = RouteKind> export interface LocaleRouteDefinition<
extends RouteDefinition<K> { K extends RouteKind = RouteKind,
> extends RouteDefinition<K> {
/** /**
* When defined it means that this route is locale aware. When undefined, * When defined it means that this route is locale aware. When undefined,
* it means no special handling has to occur to process locales. * it means no special handling has to occur to process locales.
......
import type { RouteKind } from '../route-kind' import type { RouteKind } from '../route-kind'
import type { LocaleRouteDefinition } from './locale-route-definition' import type { LocaleRouteDefinition } from './locale-route-definition'
export interface PagesAPIRouteDefinition export interface PagesAPIRouteDefinition extends LocaleRouteDefinition<RouteKind.PAGES_API> {}
extends LocaleRouteDefinition<RouteKind.PAGES_API> {}
import type { LocaleRouteDefinition } from './locale-route-definition' import type { LocaleRouteDefinition } from './locale-route-definition'
import type { RouteKind } from '../route-kind' import type { RouteKind } from '../route-kind'
export interface PagesRouteDefinition export interface PagesRouteDefinition extends LocaleRouteDefinition<RouteKind.PAGES> {}
extends LocaleRouteDefinition<RouteKind.PAGES> {}
...@@ -12,8 +12,7 @@ interface LoaderComparable<D> { ...@@ -12,8 +12,7 @@ interface LoaderComparable<D> {
export abstract class CachedRouteMatcherProvider< export abstract class CachedRouteMatcherProvider<
M extends RouteMatcher = RouteMatcher, M extends RouteMatcher = RouteMatcher,
D = any, D = any,
> implements RouteMatcherProvider<M> > implements RouteMatcherProvider<M> {
{
private data?: D private data?: D
private cached: ReadonlyArray<M> = [] private cached: ReadonlyArray<M> = []
......
import type { RouteMatch } from './route-match' import type { RouteMatch } from './route-match'
import type { AppRouteRouteDefinition } from '../route-definitions/app-route-route-definition' import type { AppRouteRouteDefinition } from '../route-definitions/app-route-route-definition'
export interface AppRouteRouteMatch export interface AppRouteRouteMatch extends RouteMatch<AppRouteRouteDefinition> {}
extends RouteMatch<AppRouteRouteDefinition> {}
import type { LocaleRouteDefinition } from '../route-definitions/locale-route-definition' import type { LocaleRouteDefinition } from '../route-definitions/locale-route-definition'
import type { RouteMatch } from './route-match' import type { RouteMatch } from './route-match'
export interface LocaleRouteMatch<R extends LocaleRouteDefinition> export interface LocaleRouteMatch<
extends RouteMatch<R> { R extends LocaleRouteDefinition,
> extends RouteMatch<R> {
readonly detectedLocale?: string readonly detectedLocale?: string
} }
...@@ -3,8 +3,7 @@ import type { PagesAPIRouteDefinition } from '../route-definitions/pages-api-rou ...@@ -3,8 +3,7 @@ import type { PagesAPIRouteDefinition } from '../route-definitions/pages-api-rou
import { RouteKind } from '../route-kind' import { RouteKind } from '../route-kind'
export interface PagesAPIRouteMatch export interface PagesAPIRouteMatch extends RouteMatch<PagesAPIRouteDefinition> {}
extends RouteMatch<PagesAPIRouteDefinition> {}
/** /**
* Checks if the given match is a Pages API route match. * Checks if the given match is a Pages API route match.
......
import type { PagesRouteDefinition } from '../route-definitions/pages-route-definition' import type { PagesRouteDefinition } from '../route-definitions/pages-route-definition'
import type { LocaleRouteMatch } from './locale-route-match' import type { LocaleRouteMatch } from './locale-route-match'
export interface PagesRouteMatch export interface PagesRouteMatch extends LocaleRouteMatch<PagesRouteDefinition> {}
extends LocaleRouteMatch<PagesRouteDefinition> {}
...@@ -172,8 +172,10 @@ export type AppRouteUserlandModule = AppRouteHandlers & ...@@ -172,8 +172,10 @@ export type AppRouteUserlandModule = AppRouteHandlers &
* AppRouteRouteModuleOptions is the options that are passed to the app route * AppRouteRouteModuleOptions is the options that are passed to the app route
* module from the bundled code. * module from the bundled code.
*/ */
export interface AppRouteRouteModuleOptions export interface AppRouteRouteModuleOptions extends RouteModuleOptions<
extends RouteModuleOptions<AppRouteRouteDefinition, AppRouteUserlandModule> { AppRouteRouteDefinition,
AppRouteUserlandModule
> {
readonly resolvedPagePath: string readonly resolvedPagePath: string
readonly nextConfigOutput: NextConfig['output'] readonly nextConfigOutput: NextConfig['output']
} }
......
...@@ -81,8 +81,10 @@ type PagesComponents = { ...@@ -81,8 +81,10 @@ type PagesComponents = {
readonly Document: DocumentType readonly Document: DocumentType
} }
export interface PagesRouteModuleOptions export interface PagesRouteModuleOptions extends RouteModuleOptions<
extends RouteModuleOptions<PagesRouteDefinition, PagesUserlandModule> { PagesRouteDefinition,
PagesUserlandModule
> {
readonly components: PagesComponents readonly components: PagesComponents
} }
......
...@@ -160,9 +160,8 @@ export abstract class RouteModule< ...@@ -160,9 +160,8 @@ export abstract class RouteModule<
getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir
) )
const { instrumentationOnRequestError } = await import( const { instrumentationOnRequestError } =
'../lib/router-utils/instrumentation-globals.external.js' await import('../lib/router-utils/instrumentation-globals.external.js')
)
return instrumentationOnRequestError( return instrumentationOnRequestError(
absoluteProjectDir, absoluteProjectDir,
...@@ -614,9 +613,8 @@ export abstract class RouteModule< ...@@ -614,9 +613,8 @@ export abstract class RouteModule<
if (absoluteDistDir) { if (absoluteDistDir) {
this.distDir = relative(absoluteProjectDir, absoluteDistDir) this.distDir = relative(absoluteProjectDir, absoluteDistDir)
} }
const { ensureInstrumentationRegistered } = await import( const { ensureInstrumentationRegistered } =
'../lib/router-utils/instrumentation-globals.external.js' await import('../lib/router-utils/instrumentation-globals.external.js')
)
// ensure instrumentation is registered and pass // ensure instrumentation is registered and pass
// onRequestError below // onRequestError below
ensureInstrumentationRegistered(absoluteProjectDir, this.distDir) ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)
......
...@@ -89,8 +89,16 @@ export type NextPage<Props = {}, InitialProps = Props> = NextComponentType< ...@@ -89,8 +89,16 @@ export type NextPage<Props = {}, InitialProps = Props> = NextComponentType<
> >
export type FileSizeSuffix = `${ export type FileSizeSuffix = `${
'k' | 'K' | 'm' | 'M' | 'g' | 'G' | 't' | 'T' | 'p' | 'P' | 'k'
}${'b' | 'B'}` | 'K'
| 'm'
| 'M'
| 'g'
| 'G'
| 't'
| 'T'
| 'p'
| 'P'}${'b' | 'B'}`
export type SizeLimit = number | `${number}${FileSizeSuffix}` export type SizeLimit = number | `${number}${FileSizeSuffix}`
......
...@@ -1506,8 +1506,7 @@ export async function copy_vendor_react(task_) { ...@@ -1506,8 +1506,7 @@ export async function copy_vendor_react(task_) {
const schedulerDir = dirname( const schedulerDir = dirname(
relative(__dirname, require.resolve(`scheduler-${channel}/package.json`)) relative(__dirname, require.resolve(`scheduler-${channel}/package.json`))
) )
yield ( yield task
task
.source(join(schedulerDir, '*.{json,js}')) .source(join(schedulerDir, '*.{json,js}'))
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1516,7 +1515,6 @@ export async function copy_vendor_react(task_) { ...@@ -1516,7 +1515,6 @@ export async function copy_vendor_react(task_) {
} }
}) })
.target(`src/compiled/scheduler${packageSuffix}`) .target(`src/compiled/scheduler${packageSuffix}`)
)
yield task yield task
.source(join(schedulerDir, 'cjs/**/*.{js,map}')) .source(join(schedulerDir, 'cjs/**/*.{js,map}'))
.target(`src/compiled/scheduler${packageSuffix}/cjs`) .target(`src/compiled/scheduler${packageSuffix}/cjs`)
...@@ -1531,8 +1529,7 @@ export async function copy_vendor_react(task_) { ...@@ -1531,8 +1529,7 @@ export async function copy_vendor_react(task_) {
relative(__dirname, require.resolve(`react-dom-${channel}/package.json`)) relative(__dirname, require.resolve(`react-dom-${channel}/package.json`))
) )
yield ( yield task
task
.source(join(reactDir, '*.{json,js}')) .source(join(reactDir, '*.{json,js}'))
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1541,12 +1538,10 @@ export async function copy_vendor_react(task_) { ...@@ -1541,12 +1538,10 @@ export async function copy_vendor_react(task_) {
} }
}) })
.target(`src/compiled/react${packageSuffix}`) .target(`src/compiled/react${packageSuffix}`)
)
yield task yield task
.source(join(reactDir, 'LICENSE')) .source(join(reactDir, 'LICENSE'))
.target(`src/compiled/react${packageSuffix}`) .target(`src/compiled/react${packageSuffix}`)
yield ( yield task
task
.source(join(reactDir, 'cjs/**/*.{js,map}')) .source(join(reactDir, 'cjs/**/*.{js,map}'))
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1555,10 +1550,8 @@ export async function copy_vendor_react(task_) { ...@@ -1555,10 +1550,8 @@ export async function copy_vendor_react(task_) {
file.data = aliasVendoredReactPackages(source) file.data = aliasVendoredReactPackages(source)
}) })
.target(`src/compiled/react${packageSuffix}/cjs`) .target(`src/compiled/react${packageSuffix}/cjs`)
)
yield ( yield task
task
.source(join(reactDomDir, '*.{json,js}')) .source(join(reactDomDir, '*.{json,js}'))
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1567,12 +1560,10 @@ export async function copy_vendor_react(task_) { ...@@ -1567,12 +1560,10 @@ export async function copy_vendor_react(task_) {
} }
}) })
.target(`src/compiled/react-dom${packageSuffix}`) .target(`src/compiled/react-dom${packageSuffix}`)
)
yield task yield task
.source(join(reactDomDir, 'LICENSE')) .source(join(reactDomDir, 'LICENSE'))
.target(`src/compiled/react-dom${packageSuffix}`) .target(`src/compiled/react-dom${packageSuffix}`)
yield ( yield task
task
.source(join(reactDomDir, 'cjs/**/*.{js,map}')) .source(join(reactDomDir, 'cjs/**/*.{js,map}'))
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1586,7 +1577,6 @@ export async function copy_vendor_react(task_) { ...@@ -1586,7 +1577,6 @@ export async function copy_vendor_react(task_) {
// as it mighe be aliased to the server rendering stub. // as it mighe be aliased to the server rendering stub.
}) })
.target(`src/compiled/react-dom${packageSuffix}/cjs`) .target(`src/compiled/react-dom${packageSuffix}/cjs`)
)
function replaceIdentifiersInAst( function replaceIdentifiersInAst(
/** @type {recast.types.namedTypes.File} */ ast, /** @type {recast.types.namedTypes.File} */ ast,
...@@ -1670,13 +1660,9 @@ export async function copy_vendor_react(task_) { ...@@ -1670,13 +1660,9 @@ export async function copy_vendor_react(task_) {
yield task yield task
.source(join(reactServerDomWebpackDir, 'LICENSE')) .source(join(reactServerDomWebpackDir, 'LICENSE'))
.target(`src/compiled/react-server-dom-webpack${packageSuffix}`) .target(`src/compiled/react-server-dom-webpack${packageSuffix}`)
yield ( yield task
task
.source( .source(
join( join(reactServerDomWebpackDir, '{package.json,*.js,cjs/**/*.{js,map}}')
reactServerDomWebpackDir,
'{package.json,*.js,cjs/**/*.{js,map}}'
)
) )
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
.run({ every: true }, function* (file) { .run({ every: true }, function* (file) {
...@@ -1687,9 +1673,7 @@ export async function copy_vendor_react(task_) { ...@@ -1687,9 +1673,7 @@ export async function copy_vendor_react(task_) {
// indirection // indirection
if ( if (
(file.base.startsWith('react-server-dom-webpack-client') && (file.base.startsWith('react-server-dom-webpack-client') &&
!file.base.startsWith( !file.base.startsWith('react-server-dom-webpack-client.browser')) ||
'react-server-dom-webpack-client.browser'
)) ||
(file.base.startsWith('react-server-dom-webpack-server') && (file.base.startsWith('react-server-dom-webpack-server') &&
!file.base.startsWith('react-server-dom-webpack-server.browser')) !file.base.startsWith('react-server-dom-webpack-server.browser'))
) { ) {
...@@ -1712,7 +1696,6 @@ export async function copy_vendor_react(task_) { ...@@ -1712,7 +1696,6 @@ export async function copy_vendor_react(task_) {
} }
}) })
.target(`src/compiled/react-server-dom-webpack${packageSuffix}`) .target(`src/compiled/react-server-dom-webpack${packageSuffix}`)
)
// react-server-dom-turbopack // react-server-dom-turbopack
// Currently, this `next` and `experimental` channels are always in sync so // Currently, this `next` and `experimental` channels are always in sync so
...@@ -1728,8 +1711,7 @@ export async function copy_vendor_react(task_) { ...@@ -1728,8 +1711,7 @@ export async function copy_vendor_react(task_) {
yield task yield task
.source(join(reactServerDomTurbopackDir, 'LICENSE')) .source(join(reactServerDomTurbopackDir, 'LICENSE'))
.target(`src/compiled/react-server-dom-turbopack${packageSuffix}`) .target(`src/compiled/react-server-dom-turbopack${packageSuffix}`)
yield ( yield task
task
.source( .source(
join( join(
reactServerDomTurbopackDir, reactServerDomTurbopackDir,
...@@ -1773,7 +1755,6 @@ export async function copy_vendor_react(task_) { ...@@ -1773,7 +1755,6 @@ export async function copy_vendor_react(task_) {
} }
}) })
.target(`src/compiled/react-server-dom-turbopack${packageSuffix}`) .target(`src/compiled/react-server-dom-turbopack${packageSuffix}`)
)
} }
// As taskr transpiles async functions into generators, to reuse the same logic // As taskr transpiles async functions into generators, to reuse the same logic
......
...@@ -10,7 +10,9 @@ describe('hmr-iframe', () => { ...@@ -10,7 +10,9 @@ describe('hmr-iframe', () => {
let browser = await next.browser('/page1') let browser = await next.browser('/page1')
expect( expect(
await (await (await browser.elementByCss('iframe')).contentFrame()) await (
await (await browser.elementByCss('iframe')).contentFrame()
)
.locator('p') .locator('p')
.innerText() .innerText()
).toEqual('content') ).toEqual('content')
...@@ -23,7 +25,9 @@ describe('hmr-iframe', () => { ...@@ -23,7 +25,9 @@ describe('hmr-iframe', () => {
await waitForNoRedbox(browser) await waitForNoRedbox(browser)
expect( expect(
await (await (await browser.elementByCss('iframe')).contentFrame()) await (
await (await browser.elementByCss('iframe')).contentFrame()
)
.locator('p') .locator('p')
.innerText() .innerText()
).toEqual('content-new') ).toEqual('content-new')
......
...@@ -10,7 +10,6 @@ export const contentType = 'image/png' ...@@ -10,7 +10,6 @@ export const contentType = 'image/png'
export default async function Image() { export default async function Image() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
fontSize: 24, fontSize: 24,
...@@ -25,8 +24,7 @@ export default async function Image() { ...@@ -25,8 +24,7 @@ export default async function Image() {
}} }}
> >
OpenGraph Test Image OpenGraph Test Image
</div> </div>,
),
{ {
...size, ...size,
} }
......
...@@ -2,7 +2,6 @@ import { ImageResponse } from 'next/og' ...@@ -2,7 +2,6 @@ import { ImageResponse } from 'next/og'
export default function OpenGraphImage() { export default function OpenGraphImage() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: 1200, width: 1200,
...@@ -19,5 +18,4 @@ export default function OpenGraphImage() { ...@@ -19,5 +18,4 @@ export default function OpenGraphImage() {
OG OG
</div> </div>
) )
)
} }
...@@ -4,7 +4,6 @@ export default async function icon({ params, id }) { ...@@ -4,7 +4,6 @@ export default async function icon({ params, id }) {
const { size } = await params const { size } = await params
const iconId = await id const iconId = await id
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -20,5 +19,4 @@ export default async function icon({ params, id }) { ...@@ -20,5 +19,4 @@ export default async function icon({ params, id }) {
Apple {size} {iconId} Apple {size} {iconId}
</div> </div>
) )
)
} }
...@@ -17,7 +17,6 @@ export async function generateImageMetadata({ params }) { ...@@ -17,7 +17,6 @@ export async function generateImageMetadata({ params }) {
export default function icon({ params, id }) { export default function icon({ params, id }) {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -33,5 +32,4 @@ export default function icon({ params, id }) { ...@@ -33,5 +32,4 @@ export default function icon({ params, id }) {
Apple {params.size} {id} Apple {params.size} {id}
</div> </div>
) )
)
} }
...@@ -19,7 +19,6 @@ export default async function icon({ params, id }) { ...@@ -19,7 +19,6 @@ export default async function icon({ params, id }) {
const { size } = await params const { size } = await params
const iconId = await id const iconId = await id
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -35,5 +34,4 @@ export default async function icon({ params, id }) { ...@@ -35,5 +34,4 @@ export default async function icon({ params, id }) {
Icon {size} {iconId} Icon {size} {iconId}
</div> </div>
) )
)
} }
...@@ -7,7 +7,6 @@ export default async function og({ params }) { ...@@ -7,7 +7,6 @@ export default async function og({ params }) {
const big = size === 'big' const big = size === 'big'
const background = big ? 'orange' : '#000' const background = big ? 'orange' : '#000'
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -25,8 +24,7 @@ export default async function og({ params }) { ...@@ -25,8 +24,7 @@ export default async function og({ params }) {
background, background,
}} }}
/> />
</div> </div>,
),
{ {
width: big === true ? 1200 : 600, width: big === true ? 1200 : 600,
height: big === true ? 630 : 315, height: big === true ? 630 : 315,
......
...@@ -2,7 +2,6 @@ import { ImageResponse } from 'next/og' ...@@ -2,7 +2,6 @@ import { ImageResponse } from 'next/og'
export default function og() { export default function og() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -18,5 +17,4 @@ export default function og() { ...@@ -18,5 +17,4 @@ export default function og() {
group route og group route og
</div> </div>
) )
)
} }
...@@ -5,7 +5,6 @@ export const size = { width: 1200, height: 675 } ...@@ -5,7 +5,6 @@ export const size = { width: 1200, height: 675 }
export default function twitter() { export default function twitter() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -18,8 +17,7 @@ export default function twitter() { ...@@ -18,8 +17,7 @@ export default function twitter() {
}} }}
> >
group route twitter group route twitter
</div> </div>,
),
size size
) )
} }
......
...@@ -4,7 +4,6 @@ export const contentType = 'image/png' ...@@ -4,7 +4,6 @@ export const contentType = 'image/png'
export default function appleIcon() { export default function appleIcon() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -20,5 +19,4 @@ export default function appleIcon() { ...@@ -20,5 +19,4 @@ export default function appleIcon() {
Apple Icon Apple Icon
</div> </div>
) )
)
} }
...@@ -3,7 +3,6 @@ import { ImageResponse } from 'next/og' ...@@ -3,7 +3,6 @@ import { ImageResponse } from 'next/og'
export default function favicon() { export default function favicon() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -19,5 +18,4 @@ export default function favicon() { ...@@ -19,5 +18,4 @@ export default function favicon() {
Favicon Favicon
</div> </div>
) )
)
} }
...@@ -19,7 +19,6 @@ export default async function icon({ params, id }) { ...@@ -19,7 +19,6 @@ export default async function icon({ params, id }) {
const { size } = await params const { size } = await params
const iconId = await id const iconId = await id
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -35,5 +34,4 @@ export default async function icon({ params, id }) { ...@@ -35,5 +34,4 @@ export default async function icon({ params, id }) {
Icon {size} {iconId} Icon {size} {iconId}
</div> </div>
) )
)
} }
...@@ -5,7 +5,6 @@ export const size = { width: 512, height: 512 } ...@@ -5,7 +5,6 @@ export const size = { width: 512, height: 512 }
export default function icon() { export default function icon() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -21,5 +20,4 @@ export default function icon() { ...@@ -21,5 +20,4 @@ export default function icon() {
Icon Icon
</div> </div>
) )
)
} }
...@@ -19,7 +19,6 @@ export async function generateImageMetadata() { ...@@ -19,7 +19,6 @@ export async function generateImageMetadata() {
export default function og() { export default function og() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -34,5 +33,4 @@ export default function og() { ...@@ -34,5 +33,4 @@ export default function og() {
Open Graph Open Graph
</div> </div>
) )
)
} }
...@@ -5,7 +5,6 @@ export const alt = 'Open Graph' ...@@ -5,7 +5,6 @@ export const alt = 'Open Graph'
/* without generateImageMetadata */ /* without generateImageMetadata */
export default function og() { export default function og() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -20,5 +19,4 @@ export default function og() { ...@@ -20,5 +19,4 @@ export default function og() {
Open Graph Open Graph
</div> </div>
) )
)
} }
...@@ -12,7 +12,6 @@ export const size = { width: 1600, height: 900 } ...@@ -12,7 +12,6 @@ export const size = { width: 1600, height: 900 }
export default function twitter() { export default function twitter() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -25,8 +24,7 @@ export default function twitter() { ...@@ -25,8 +24,7 @@ export default function twitter() {
}} }}
> >
Twitter Image Twitter Image
</div> </div>,
),
size size
) )
} }
...@@ -13,7 +13,6 @@ export const size = { width: 1600, height: 900 } ...@@ -13,7 +13,6 @@ export const size = { width: 1600, height: 900 }
export default function twitter() { export default function twitter() {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -26,8 +25,7 @@ export default function twitter() { ...@@ -26,8 +25,7 @@ export default function twitter() {
}} }}
> >
Twitter Image Twitter Image
</div> </div>,
),
size size
) )
} }
......
...@@ -7,7 +7,6 @@ export default async function og() { ...@@ -7,7 +7,6 @@ export default async function og() {
new URL('../../assets/typewr__.ttf', import.meta.url) new URL('../../assets/typewr__.ttf', import.meta.url)
).then((res) => res.arrayBuffer()) ).then((res) => res.arrayBuffer())
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -21,8 +20,7 @@ export default async function og() { ...@@ -21,8 +20,7 @@ export default async function og() {
}} }}
> >
Typewriter og Typewriter og
</div> </div>,
),
{ {
fonts: [ fonts: [
{ {
......
...@@ -9,7 +9,6 @@ export default async function og() { ...@@ -9,7 +9,6 @@ export default async function og() {
path.join(process.cwd(), 'assets/typewr__.ttf') path.join(process.cwd(), 'assets/typewr__.ttf')
) )
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -23,8 +22,7 @@ export default async function og() { ...@@ -23,8 +22,7 @@ export default async function og() {
}} }}
> >
Typewriter og Typewriter og
</div> </div>,
),
{ {
fonts: [ fonts: [
{ {
......
...@@ -5,6 +5,7 @@ This fixture contains scenarios that **SHOULD throw `MissingDefaultParallelRoute ...@@ -5,6 +5,7 @@ This fixture contains scenarios that **SHOULD throw `MissingDefaultParallelRoute
## Why These Should Error ## Why These Should Error
All scenarios in this fixture have: All scenarios in this fixture have:
1. ✅ Parallel routes (slots starting with `@`) 1. ✅ Parallel routes (slots starting with `@`)
2. ❌ **NO** `default.tsx` files for those parallel routes 2. ❌ **NO** `default.tsx` files for those parallel routes
3. ✅ **Child routes** that make these **non-leaf segments** 3. ✅ **Child routes** that make these **non-leaf segments**
...@@ -32,6 +33,7 @@ app/with-children/ ...@@ -32,6 +33,7 @@ app/with-children/
``` ```
**Expected Error:** **Expected Error:**
``` ```
MissingDefaultParallelRouteError: MissingDefaultParallelRouteError:
Missing required default.js file for parallel route at /with-children/@header Missing required default.js file for parallel route at /with-children/@header
...@@ -39,6 +41,7 @@ MissingDefaultParallelRouteError: ...@@ -39,6 +41,7 @@ MissingDefaultParallelRouteError:
``` ```
**Why it errors:** **Why it errors:**
- When navigating from `/with-children` to `/with-children/child`, the routing system needs to know what to render for the `@header` and `@sidebar` slots - When navigating from `/with-children` to `/with-children/child`, the routing system needs to know what to render for the `@header` and `@sidebar` slots
- Since `/with-children/child` doesn't define these parallel routes, Next.js looks for `default.tsx` files - Since `/with-children/child` doesn't define these parallel routes, Next.js looks for `default.tsx` files
- No `default.tsx` files exist → ERROR! - No `default.tsx` files exist → ERROR!
...@@ -66,6 +69,7 @@ app/with-groups-and-children/(dashboard)/(overview)/ ...@@ -66,6 +69,7 @@ app/with-groups-and-children/(dashboard)/(overview)/
**Route Groups:** `(dashboard)` and `(overview)` don't affect the URL **Route Groups:** `(dashboard)` and `(overview)` don't affect the URL
**Expected Error:** **Expected Error:**
``` ```
MissingDefaultParallelRouteError: MissingDefaultParallelRouteError:
Missing required default.js file for parallel route at /with-groups-and-children/(dashboard)/(overview)/@analytics Missing required default.js file for parallel route at /with-groups-and-children/(dashboard)/(overview)/@analytics
...@@ -73,6 +77,7 @@ MissingDefaultParallelRouteError: ...@@ -73,6 +77,7 @@ MissingDefaultParallelRouteError:
``` ```
**Why it errors:** **Why it errors:**
- Even with route groups, the segment has a child route (`/nested`) - Even with route groups, the segment has a child route (`/nested`)
- The `hasChildRoutesForSegment()` helper correctly: - The `hasChildRoutesForSegment()` helper correctly:
1. Filters out route groups `(dashboard)` and `(overview)` 1. Filters out route groups `(dashboard)` and `(overview)`
...@@ -87,6 +92,7 @@ MissingDefaultParallelRouteError: ...@@ -87,6 +92,7 @@ MissingDefaultParallelRouteError:
To make these scenarios build successfully, add `default.tsx` files: To make these scenarios build successfully, add `default.tsx` files:
### For Scenario 1: ### For Scenario 1:
```tsx ```tsx
// app/with-children/@header/default.tsx // app/with-children/@header/default.tsx
export default function HeaderDefault() { export default function HeaderDefault() {
...@@ -100,6 +106,7 @@ export default function SidebarDefault() { ...@@ -100,6 +106,7 @@ export default function SidebarDefault() {
``` ```
### For Scenario 2: ### For Scenario 2:
```tsx ```tsx
// app/with-groups-and-children/(dashboard)/(overview)/@analytics/default.tsx // app/with-groups-and-children/(dashboard)/(overview)/@analytics/default.tsx
export default function AnalyticsDefault() { export default function AnalyticsDefault() {
...@@ -117,9 +124,11 @@ export default function MetricsDefault() { ...@@ -117,9 +124,11 @@ export default function MetricsDefault() {
## Contrast with `no-build-error` Fixture ## Contrast with `no-build-error` Fixture
The `no-build-error` fixture has similar parallel routes but: The `no-build-error` fixture has similar parallel routes but:
- ❌ **NO child routes** (leaf segments) - ❌ **NO child routes** (leaf segments)
- ✅ `default.tsx` files are **NOT required** - ✅ `default.tsx` files are **NOT required**
This fixture (build-error) has: This fixture (build-error) has:
- ✅ **Child routes exist** (non-leaf segments) - ✅ **Child routes exist** (non-leaf segments)
- ❌ `default.tsx` files **ARE required** but missing → **ERROR!** - ❌ `default.tsx` files **ARE required** but missing → **ERROR!**
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
*/ */
const nextConfig = { const nextConfig = {
cacheHandlers: { cacheHandlers: {
custom: require.resolve( custom:
'next/dist/server/lib/cache-handlers/default.external' require.resolve('next/dist/server/lib/cache-handlers/default.external'),
),
}, },
experimental: { experimental: {
useCache: true, useCache: true,
......
...@@ -38,8 +38,8 @@ describe.skip('Browserslist', () => { ...@@ -38,8 +38,8 @@ describe.skip('Browserslist', () => {
} }
return false return false
}) })
) // Filter out false values
) )
) // Filter out false values
.filter((item) => item) .filter((item) => item)
).toBeEmpty() ).toBeEmpty()
}) })
......
...@@ -16,7 +16,9 @@ export default function ProTip() { ...@@ -16,7 +16,9 @@ export default function ProTip() {
<Typography sx={{ mt: 6, mb: 3 }} color="text.secondary"> <Typography sx={{ mt: 6, mb: 3 }} color="text.secondary">
<LightBulbIcon sx={{ mr: 1, verticalAlign: 'middle' }} /> <LightBulbIcon sx={{ mr: 1, verticalAlign: 'middle' }} />
Pro tip: See more{' '} Pro tip: See more{' '}
<Link href="https://mui.com/getting-started/templates/">templates</Link>{' '} <Link href="https://mui.com/getting-started/templates/">
templates
</Link>{' '}
on the MUI documentation. on the MUI documentation.
</Typography> </Typography>
) )
......
...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils' ...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils' import { renderViaHTTP } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
const mockedGoogleFontResponses = require.resolve( const mockedGoogleFontResponses =
'./google-font-mocked-responses.js' require.resolve('./google-font-mocked-responses.js')
)
describe('next/font/google basepath', () => { describe('next/font/google basepath', () => {
let next: NextInstance let next: NextInstance
......
...@@ -3,9 +3,8 @@ import { NextInstance } from 'e2e-utils' ...@@ -3,9 +3,8 @@ import { NextInstance } from 'e2e-utils'
import { join } from 'path' import { join } from 'path'
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
const mockedGoogleFontResponses = require.resolve( const mockedGoogleFontResponses =
'./google-font-mocked-responses.js' require.resolve('./google-font-mocked-responses.js')
)
describe('next/font/google fetch error', () => { describe('next/font/google fetch error', () => {
const isDev = (global as any).isNextDev const isDev = (global as any).isNextDev
......
...@@ -5,9 +5,8 @@ import { renderViaHTTP } from 'next-test-utils' ...@@ -5,9 +5,8 @@ import { renderViaHTTP } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
const mockedGoogleFontResponses = require.resolve( const mockedGoogleFontResponses =
'./google-font-mocked-responses.js' require.resolve('./google-font-mocked-responses.js')
)
function getClassNameRegex(className: string): RegExp { function getClassNameRegex(className: string): RegExp {
return new RegExp(`${className}`) return new RegExp(`${className}`)
......
...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils' ...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils' import { renderViaHTTP } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
const mockedGoogleFontResponses = require.resolve( const mockedGoogleFontResponses =
'./google-font-mocked-responses.js' require.resolve('./google-font-mocked-responses.js')
)
const isDev = (global as any).isNextDev const isDev = (global as any).isNextDev
......
...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils' ...@@ -4,9 +4,8 @@ import { NextInstance } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils' import { renderViaHTTP } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
const mockedGoogleFontResponses = require.resolve( const mockedGoogleFontResponses =
'./google-font-mocked-responses.js' require.resolve('./google-font-mocked-responses.js')
)
describe('next/font/google without-preloaded-fonts without _app', () => { describe('next/font/google without-preloaded-fonts without _app', () => {
let next: NextInstance let next: NextInstance
......
...@@ -3,7 +3,6 @@ import { ImageResponse } from 'next/og' ...@@ -3,7 +3,6 @@ import { ImageResponse } from 'next/og'
export default function () { export default function () {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -18,5 +17,4 @@ export default function () { ...@@ -18,5 +17,4 @@ export default function () {
Hello! Hello!
</div> </div>
) )
)
} }
...@@ -7,7 +7,6 @@ export const config = { ...@@ -7,7 +7,6 @@ export const config = {
export default function () { export default function () {
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -22,5 +21,4 @@ export default function () { ...@@ -22,5 +21,4 @@ export default function () {
Hello! Hello!
</div> </div>
) )
)
} }
...@@ -8,7 +8,6 @@ export async function GET() { ...@@ -8,7 +8,6 @@ export async function GET() {
path.join(process.cwd(), 'assets/typewr__.ttf') path.join(process.cwd(), 'assets/typewr__.ttf')
) )
return new ImageResponse( return new ImageResponse(
(
<div <div
style={{ style={{
width: '100%', width: '100%',
...@@ -22,8 +21,7 @@ export async function GET() { ...@@ -22,8 +21,7 @@ export async function GET() {
}} }}
> >
Typewriter og Typewriter og
</div> </div>,
),
{ {
fonts: [ fonts: [
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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