Skip to content

[pull] canary from vercel:canary #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub async fn get_swc_ecma_transform_rule_impl(
plugin_configs: &[(RcStr, serde_json::Value)],
enable_mdx_rs: bool,
) -> Result<Option<ModuleRule>> {
use anyhow::{bail, Context};
use turbo_tasks::{TryJoinIterExt, Value};
use anyhow::bail;
use turbo_tasks::{TryFlatJoinIterExt, Value};
use turbo_tasks_fs::FileContent;
use turbopack::{resolve_options, resolve_options_context::ResolveOptionsContext};
use turbopack_core::{
Expand Down Expand Up @@ -78,30 +78,34 @@ pub async fn get_swc_ecma_transform_rule_impl(
)
.as_raw_module_result(),
Value::new(ReferenceType::CommonJs(CommonJsReferenceSubType::Undefined)),
// TODO proper error location
*project_path,
request,
resolve_options,
false,
// TODO proper error location
None,
)
.await?;
let plugin_module = plugin_wasm_module_resolve_result
.first_module()
.await?
.context("Expected to find module")?;

let content = &*plugin_module.content().file_content().await?;
let Some(plugin_module) = &*plugin_wasm_module_resolve_result.first_module().await?
else {
// Ignore unresolveable plugin modules, handle_resolve_error has already emitted an
// issue.
return Ok(None);
};

let content = &*plugin_module.content().file_content().await?;
let FileContent::Content(file) = content else {
bail!("Expected file content for plugin module");
};

Ok((
Ok(Some((
SwcPluginModule::new(name, file.content().to_bytes()?.to_vec()).resolved_cell(),
config.clone(),
))
)))
})
.try_join()
.try_flat_join()
.await?;

Ok(Some(get_ecma_transform_rule(
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "15.3.1-canary.2"
"version": "15.3.1-canary.4"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/api-reference/config/eslint",
"dependencies": {
"@next/eslint-plugin-next": "15.3.1-canary.2",
"@next/eslint-plugin-next": "15.3.1-canary.4",
"@rushstack/eslint-patch": "^1.10.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-rspack",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"private": true,
"files": [
"native/"
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "15.3.1-canary.2",
"version": "15.3.1-canary.4",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -100,7 +100,7 @@
]
},
"dependencies": {
"@next/env": "15.3.1-canary.2",
"@next/env": "15.3.1-canary.4",
"@swc/counter": "0.1.3",
"@swc/helpers": "0.5.15",
"busboy": "1.6.0",
Expand Down Expand Up @@ -164,11 +164,11 @@
"@jest/types": "29.5.0",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/font": "15.3.1-canary.2",
"@next/polyfill-module": "15.3.1-canary.2",
"@next/polyfill-nomodule": "15.3.1-canary.2",
"@next/react-refresh-utils": "15.3.1-canary.2",
"@next/swc": "15.3.1-canary.2",
"@next/font": "15.3.1-canary.4",
"@next/polyfill-module": "15.3.1-canary.4",
"@next/polyfill-nomodule": "15.3.1-canary.4",
"@next/react-refresh-utils": "15.3.1-canary.4",
"@next/swc": "15.3.1-canary.4",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@storybook/addon-a11y": "8.6.0",
Expand Down
10 changes: 10 additions & 0 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3301,6 +3301,16 @@ export default async function build(
orig,
path.join(distDir, 'server', updatedRelativeDest)
)

// since the app router not found is prioritized over pages router,
// we have to ensure the app router entries are available for all locales
if (i18n) {
for (const locale of i18n.locales) {
const curPath = `/${locale}/404`
pagesManifest[curPath] = updatedRelativeDest
}
}

pagesManifest['/404'] = updatedRelativeDest
}
})
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
prerenderEarlyExit: z.boolean().optional(),
proxyTimeout: z.number().gte(0).optional(),
routerBFCache: z.boolean().optional(),
removeUncaughtErrorAndRejectionListeners: z.boolean().optional(),
scrollRestoration: z.boolean().optional(),
sri: z
.object({
Expand Down
11 changes: 11 additions & 0 deletions packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,16 @@ export interface ExperimentalConfig {
*/
routerBFCache?: boolean

/**
* Uninstalls all "unhandledRejection" and "uncaughtException" listeners from
* the global process so that we can override the behavior, which in some
* runtimes is to exit the process.
*
* This is experimental until we've considered the impact in various
* deployment environments.
*/
removeUncaughtErrorAndRejectionListeners?: boolean

serverActions?: {
/**
* Allows adjusting body parser size limit for server actions.
Expand Down Expand Up @@ -1302,6 +1312,7 @@ export const defaultConfig: NextConfig = {
useEarlyImport: false,
viewTransition: false,
routerBFCache: false,
removeUncaughtErrorAndRejectionListeners: false,
staleTimes: {
dynamic: 0,
static: 300,
Expand Down
17 changes: 0 additions & 17 deletions packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { CONFIG_FILES } from '../../shared/lib/constants'
import { getStartServerInfo, logStartInfo } from './app-info-log'
import { validateTurboNextConfig } from '../../lib/turbopack-warning'
import { type Span, trace, flushAllTraces } from '../../trace'
import { isPostpone } from './router-utils/is-postpone'
import { isIPv6 } from './is-ipv6'
import { AsyncCallbackSet } from './async-callback-set'
import type { NextServer } from '../next'
Expand Down Expand Up @@ -331,29 +330,13 @@ export async function startServer(
process.exit(0)
})()
}
const exception = (err: Error) => {
if (isPostpone(err)) {
// React postpones that are unhandled might end up logged here but they're
// not really errors. They're just part of rendering.
return
}

// This is the render worker, we keep the process alive
console.error(err)
}
// Make sure commands gracefully respect termination signals (e.g. from Docker)
// Allow the graceful termination to be manually configurable
if (!process.env.NEXT_MANUAL_SIG_HANDLE) {
process.on('SIGINT', cleanup)
process.on('SIGTERM', cleanup)
}
process.on('rejectionHandled', () => {
// It is ok to await a Promise late in Next.js as it allows for better
// prefetching patterns to avoid waterfalls. We ignore loggining these.
// We should've already errored in anyway unhandledRejection.
})
process.on('uncaughtException', exception)
process.on('unhandledRejection', exception)

const initResult = await getRequestHandlers({
dir,
Expand Down
Loading
Loading