Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/canary' into wbinnssmith/write-a…
Browse files Browse the repository at this point in the history
…ll-endpoints
  • Loading branch information
wbinnssmith committed Feb 3, 2025
2 parents 313f5b7 + 7a0eb3c commit 96b5aae
Show file tree
Hide file tree
Showing 39 changed files with 443 additions and 381 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
rustup show &&
rustup target add x86_64-unknown-linux-musl &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
export RUSTFLAGS="--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Csymbol-mangling-version=v0 -Ctarget-feature=-crt-static" &&
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Csymbol-mangling-version=v0 -Ctarget-feature=-crt-static' &&
cd packages/next-swc && npm run build-native-release -- --target x86_64-unknown-linux-musl &&
strip native/next-swc.*.node
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
rustup show &&
rustup target add aarch64-unknown-linux-musl &&
export RUSTFLAGS="--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Zunstable-options -Csymbol-mangling-version=v0 -Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker" &&
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Zunstable-options -Csymbol-mangling-version=v0 -Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker' &&
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-musl &&
llvm-strip -x native/next-swc.*.node
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ jobs:
path: |
test/test-junit-report
test/turbopack-test-junit-report
test/rspack-test-junit-report
if-no-files-found: ignore

# upload playwright snapshots from failed tests
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

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

38 changes: 16 additions & 22 deletions crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{path::PathBuf, sync::Arc, thread, time::Duration};
use std::{io::Write, path::PathBuf, sync::Arc, thread, time::Duration};

use anyhow::{anyhow, bail, Context, Result};
use napi::{
Expand Down Expand Up @@ -387,27 +387,21 @@ pub async fn project_new(
memory_limit,
dependency_tracking,
)?;
if !persistent_caching {
use std::io::Write;
let stats_path = std::env::var_os("NEXT_TURBOPACK_TASK_STATISTICS");
if let Some(stats_path) = stats_path {
let Some(backend) = turbo_tasks.memory_backend() else {
return Err(anyhow!("task statistics require a memory backend").into());
};
let task_stats = backend.task_statistics().enable().clone();
exit.on_exit(async move {
tokio::task::spawn_blocking(move || {
let mut file = std::fs::File::create(&stats_path)
.with_context(|| format!("failed to create or open {stats_path:?}"))?;
serde_json::to_writer(&file, &task_stats)
.context("failed to serialize or write task statistics")?;
file.flush().context("failed to flush file")
})
.await
.unwrap()
.unwrap();
});
}
let stats_path = std::env::var_os("NEXT_TURBOPACK_TASK_STATISTICS");
if let Some(stats_path) = stats_path {
let task_stats = turbo_tasks.task_statistics().enable().clone();
exit.on_exit(async move {
tokio::task::spawn_blocking(move || {
let mut file = std::fs::File::create(&stats_path)
.with_context(|| format!("failed to create or open {stats_path:?}"))?;
serde_json::to_writer(&file, &task_stats)
.context("failed to serialize or write task statistics")?;
file.flush().context("failed to flush file")
})
.await
.unwrap()
.unwrap();
});
}
let options: ProjectOptions = options.into();
let container = turbo_tasks
Expand Down
16 changes: 8 additions & 8 deletions crates/napi/src/next_api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use napi::{
};
use serde::Serialize;
use turbo_tasks::{
get_effects, trace::TraceRawVcs, Effects, OperationVc, ReadRef, TaskId, TryJoinIterExt,
TurboTasks, UpdateInfo, Vc, VcValueType,
get_effects, task_statistics::TaskStatisticsApi, trace::TraceRawVcs, Effects, OperationVc,
ReadRef, TaskId, TryJoinIterExt, TurboTasks, TurboTasksApi, UpdateInfo, Vc, VcValueType,
};
use turbo_tasks_backend::{
default_backing_storage, noop_backing_storage, DefaultBackingStorage, NoopBackingStorage,
Expand Down Expand Up @@ -111,17 +111,17 @@ impl NextTurboTasks {
}
}

pub fn memory_backend(&self) -> Option<&turbo_tasks_memory::MemoryBackend> {
pub async fn stop_and_wait(&self) {
match self {
NextTurboTasks::Memory(_) => None,
NextTurboTasks::PersistentCaching(_) => None,
NextTurboTasks::Memory(turbo_tasks) => turbo_tasks.stop_and_wait().await,
NextTurboTasks::PersistentCaching(turbo_tasks) => turbo_tasks.stop_and_wait().await,
}
}

pub async fn stop_and_wait(&self) {
pub fn task_statistics(&self) -> &TaskStatisticsApi {
match self {
NextTurboTasks::Memory(turbo_tasks) => turbo_tasks.stop_and_wait().await,
NextTurboTasks::PersistentCaching(turbo_tasks) => turbo_tasks.stop_and_wait().await,
NextTurboTasks::Memory(turbo_tasks) => turbo_tasks.task_statistics(),
NextTurboTasks::PersistentCaching(turbo_tasks) => turbo_tasks.task_statistics(),
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions crates/next-core/src/transform_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ pub async fn get_jsx_transform_options(
) -> Result<Vc<JsxTransformOptions>> {
let tsconfig = get_typescript_options(project_path).await?;

let enable_react_refresh = if let Some(resolve_options_context) = resolve_options_context {
assert_can_resolve_react_refresh(project_path, resolve_options_context)
.await?
.is_found()
let is_react_development = mode.await?.is_react_development();
let enable_react_refresh = if is_react_development {
if let Some(resolve_options_context) = resolve_options_context {
assert_can_resolve_react_refresh(project_path, resolve_options_context)
.await?
.is_found()
} else {
false
}
} else {
false
};
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.2.0-canary.36"
"version": "15.2.0-canary.37"
}
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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"@next/eslint-plugin-next": "15.2.0-canary.37",
"@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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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.2.0-canary.36",
"version": "15.2.0-canary.37",
"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-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "15.2.0-canary.36",
"version": "15.2.0-canary.37",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs 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.2.0-canary.36",
"version": "15.2.0-canary.37",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -100,7 +100,7 @@
]
},
"dependencies": {
"@next/env": "15.2.0-canary.36",
"@next/env": "15.2.0-canary.37",
"@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.2.0-canary.36",
"@next/polyfill-module": "15.2.0-canary.36",
"@next/polyfill-nomodule": "15.2.0-canary.36",
"@next/react-refresh-utils": "15.2.0-canary.36",
"@next/swc": "15.2.0-canary.36",
"@next/font": "15.2.0-canary.37",
"@next/polyfill-module": "15.2.0-canary.37",
"@next/polyfill-nomodule": "15.2.0-canary.37",
"@next/react-refresh-utils": "15.2.0-canary.37",
"@next/swc": "15.2.0-canary.37",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@storybook/addon-a11y": "8.5.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ export function useErrorHook({
? rootLayoutMissingTags.length
: !!buildError
? 1
: errors.length,
: readyErrors.length,
}
}
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "15.2.0-canary.36",
"version": "15.2.0-canary.37",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/third-parties/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/third-parties",
"version": "15.2.0-canary.36",
"version": "15.2.0-canary.37",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
Expand All @@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "15.2.0-canary.36",
"next": "15.2.0-canary.37",
"outdent": "0.8.0",
"prettier": "2.5.1",
"typescript": "5.7.2"
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

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

13 changes: 0 additions & 13 deletions test/e2e/app-dir/hello-world/app/global-error.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions turbopack/crates/turbo-tasks-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ turbo-tasks-testing = { workspace = true }

[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
regex = { workspace = true }
serde_json = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
Expand Down
Loading

0 comments on commit 96b5aae

Please sign in to comment.