Skip to content

Commit 544eb70

Browse files
authored
Merge branch 'canary' into sam/docs/sassOptions
2 parents a3ee2de + c13f502 commit 544eb70

File tree

690 files changed

+15445
-10425
lines changed

Some content is hidden

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

690 files changed

+15445
-10425
lines changed

.github/actions/next-repo-actions/src/popular-prs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function run() {
3939

4040
const blocks = BlockCollection([
4141
Section({
42-
text: `*A list of the top ${count} PRs sorted by the most reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-prs.mjs|action> will run every Monday at 10AM UTC (6AM EST)._`,
42+
text: `*A list of the top ${count} PRs sorted by the most reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-actions/src/popular-prs.ts|action> will run every Monday at 10AM UTC (6AM EST)._`,
4343
}),
4444
Divider(),
4545
Section({

.github/workflows/build_and_test.yml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ jobs:
202202
fail-fast: false
203203
matrix:
204204
group: [1/5, 2/5, 3/5, 4/5, 5/5]
205+
# Empty value uses default
206+
react: ['', '18.3.1']
205207
uses: ./.github/workflows/build_reusable.yml
206208
with:
207-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY}
208-
stepName: 'test-turbopack-dev-${{ matrix.group }}'
209+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY}
210+
stepName: 'test-turbopack-dev-react-${{ matrix.react }}-${{ matrix.group }}'
209211
secrets: inherit
210212

211213
test-turbopack-integration:
@@ -217,11 +219,13 @@ jobs:
217219
fail-fast: false
218220
matrix:
219221
group: [1/5, 2/5, 3/5, 4/5, 5/5]
222+
# Empty value uses default
223+
react: ['']
220224
uses: ./.github/workflows/build_reusable.yml
221225
with:
222226
nodeVersion: 18.18.2
223-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
224-
stepName: 'test-turbopack-integration-${{ matrix.group }}'
227+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
228+
stepName: 'test-turbopack-integration-react-${{ matrix.react }}-${{ matrix.group }}'
225229
secrets: inherit
226230

227231
test-turbopack-production:
@@ -233,11 +237,17 @@ jobs:
233237
fail-fast: false
234238
matrix:
235239
group: [1/5, 2/5, 3/5, 4/5, 5/5]
240+
# Empty value uses default
241+
# TODO: Run with React 18.
242+
# Integration tests use the installed React version in next/package.json.include:
243+
# We can't easily switch like we do for e2e tests.
244+
# Skipping this dimensions until we can figure out a way to test multiple React versions.
245+
react: ['', '18.3.1']
236246
uses: ./.github/workflows/build_reusable.yml
237247
with:
238248
nodeVersion: 18.18.2
239-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
240-
stepName: 'test-turbopack-production-${{ matrix.group }}'
249+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
250+
stepName: 'test-turbopack-production-react-${{ matrix.react }}-${{ matrix.group }}'
241251
secrets: inherit
242252

243253
test-turbopack-production-integration:
@@ -362,10 +372,12 @@ jobs:
362372
fail-fast: false
363373
matrix:
364374
group: [1/4, 2/4, 3/4, 4/4]
375+
# Empty value uses default
376+
react: ['', '18.3.1']
365377
uses: ./.github/workflows/build_reusable.yml
366378
with:
367-
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
368-
stepName: 'test-dev-${{ matrix.group }}'
379+
afterBuild: NEXT_TEST_MODE=dev NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
380+
stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}'
369381
secrets: inherit
370382

371383
test-prod:
@@ -377,10 +389,12 @@ jobs:
377389
fail-fast: false
378390
matrix:
379391
group: [1/5, 2/5, 3/5, 4/5, 5/5]
392+
# Empty value uses default
393+
react: ['', '18.3.1']
380394
uses: ./.github/workflows/build_reusable.yml
381395
with:
382-
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
383-
stepName: 'test-prod-${{ matrix.group }}'
396+
afterBuild: NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
397+
stepName: 'test-prod-react-${{ matrix.react }}-${{ matrix.group }}'
384398
secrets: inherit
385399

386400
test-integration:
@@ -404,11 +418,17 @@ jobs:
404418
- 10/12
405419
- 11/12
406420
- 12/12
421+
# Empty value uses default
422+
# TODO: Run with React 18.
423+
# Integration tests use the installed React version in next/package.json.include:
424+
# We can't easily switch like we do for e2e tests.
425+
# Skipping this dimensions until we can figure out a way to test multiple React versions.
426+
react: ['']
407427
uses: ./.github/workflows/build_reusable.yml
408428
with:
409429
nodeVersion: 18.18.2
410-
afterBuild: node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
411-
stepName: 'test-integration-${{ matrix.group }}'
430+
afterBuild: NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
431+
stepName: 'test-integration-${{ matrix.group }}-react-${{ matrix.react }}'
412432
secrets: inherit
413433

414434
test-firefox-safari:

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,29 @@
6060
"codemod",
6161
"codemods",
6262
"Destructuring",
63+
"buildtime",
64+
"callsites",
65+
"codemod",
66+
"datastream",
67+
"deduped",
68+
"draftmode",
6369
"Entrypoints",
6470
"jscodeshift",
6571
"napi",
72+
"navigations",
6673
"nextjs",
6774
"opentelemetry",
75+
"Preinit",
6876
"prerendered",
77+
"prerendering",
78+
"proxied",
79+
"renderable",
80+
"revalidates",
81+
"subresource",
82+
"thenables",
6983
"Threadsafe",
7084
"Turbopack",
85+
"unproxied",
7186
"zipkin"
7287
],
7388
"grammarly.selectors": [

crates/next-api/src/app.rs

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use next_core::{
1111
next_app::{
1212
app_client_references_chunks::get_app_server_reference_modules,
1313
get_app_client_references_chunks, get_app_client_shared_chunk_group, get_app_page_entry,
14-
get_app_route_entry, metadata::route::get_app_metadata_route_entry, AppEntry, AppPage,
14+
get_app_route_entry, include_modules_module::IncludeModulesModule,
15+
metadata::route::get_app_metadata_route_entry, AppEntry, AppPage,
1516
},
1617
next_client::{
1718
get_client_module_options_context, get_client_resolve_options_context,
@@ -36,7 +37,9 @@ use next_core::{
3637
};
3738
use serde::{Deserialize, Serialize};
3839
use tracing::Instrument;
39-
use turbo_tasks::{trace::TraceRawVcs, Completion, RcStr, TryJoinIterExt, Value, Vc};
40+
use turbo_tasks::{
41+
trace::TraceRawVcs, Completion, RcStr, TryJoinIterExt, Value, ValueToString, Vc,
42+
};
4043
use turbo_tasks_env::{CustomProcessEnv, ProcessEnv};
4144
use turbo_tasks_fs::{File, FileContent, FileSystemPath};
4245
use turbopack::{
@@ -686,6 +689,11 @@ fn client_shared_chunks() -> Vc<RcStr> {
686689
Vc::cell("client_shared_chunks".into())
687690
}
688691

692+
#[turbo_tasks::function]
693+
fn server_utils_module() -> Vc<RcStr> {
694+
Vc::cell("server-utils".into())
695+
}
696+
689697
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs)]
690698
enum AppPageEndpointType {
691699
Html,
@@ -1256,31 +1264,62 @@ impl AppEndpoint {
12561264
let mut current_chunks = OutputAssets::empty();
12571265
let mut current_availability_info = AvailabilityInfo::Root;
12581266
if let Some(client_references) = client_references {
1259-
for server_component in client_references
1260-
.await?
1261-
.server_component_entries
1262-
.iter()
1263-
.copied()
1264-
{
1265-
let server_path = server_component.server_path();
1266-
let is_layout =
1267-
server_path.file_stem().await?.as_deref() == Some("layout");
1267+
let client_references = client_references.await?;
1268+
let span = tracing::trace_span!("server utils",);
1269+
async {
1270+
let utils_module = IncludeModulesModule::new(
1271+
AssetIdent::from_path(this.app_project.project().project_path())
1272+
.with_modifier(server_utils_module()),
1273+
client_references.server_utils.clone(),
1274+
);
12681275

12691276
let chunk_group = chunking_context
12701277
.chunk_group(
1271-
server_component.ident(),
1272-
Vc::upcast(server_component),
1278+
utils_module.ident(),
1279+
Vc::upcast(utils_module),
12731280
Value::new(current_availability_info),
12741281
)
12751282
.await?;
12761283

1277-
if is_layout {
1284+
current_chunks = current_chunks
1285+
.concatenate(chunk_group.assets)
1286+
.resolve()
1287+
.await?;
1288+
current_availability_info = chunk_group.availability_info;
1289+
1290+
anyhow::Ok(())
1291+
}
1292+
.instrument(span)
1293+
.await?;
1294+
for server_component in client_references
1295+
.server_component_entries
1296+
.iter()
1297+
.copied()
1298+
.take(client_references.server_component_entries.len() - 1)
1299+
{
1300+
let span = tracing::trace_span!(
1301+
"layout segment",
1302+
name = server_component.ident().to_string().await?.as_str()
1303+
);
1304+
async {
1305+
let chunk_group = chunking_context
1306+
.chunk_group(
1307+
server_component.ident(),
1308+
Vc::upcast(server_component),
1309+
Value::new(current_availability_info),
1310+
)
1311+
.await?;
1312+
12781313
current_chunks = current_chunks
12791314
.concatenate(chunk_group.assets)
12801315
.resolve()
12811316
.await?;
12821317
current_availability_info = chunk_group.availability_info;
1318+
1319+
anyhow::Ok(())
12831320
}
1321+
.instrument(span)
1322+
.await?;
12841323
}
12851324
}
12861325
chunking_context

crates/next-api/src/middleware.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,11 @@ impl MiddlewareEndpoint {
255255
}
256256

257257
#[turbo_tasks::function]
258-
async fn userland_module(self: Vc<Self>) -> Result<Vc<Box<dyn Module>>> {
259-
let this = self.await?;
260-
261-
Ok(this
258+
async fn userland_module(&self) -> Result<Vc<Box<dyn Module>>> {
259+
Ok(self
262260
.asset_context
263261
.process(
264-
this.source,
262+
self.source,
265263
Value::new(ReferenceType::Entry(EntryReferenceSubType::Middleware)),
266264
)
267265
.module())

crates/next-api/src/pages.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,8 @@ impl PageEndpoint {
640640
}
641641

642642
#[turbo_tasks::function]
643-
async fn source(self: Vc<Self>) -> Result<Vc<Box<dyn Source>>> {
644-
let this = self.await?;
645-
Ok(Vc::upcast(FileSource::new(this.page.project_path())))
643+
async fn source(&self) -> Result<Vc<Box<dyn Source>>> {
644+
Ok(Vc::upcast(FileSource::new(self.page.project_path())))
646645
}
647646

648647
#[turbo_tasks::function]
@@ -946,11 +945,10 @@ impl PageEndpoint {
946945

947946
#[turbo_tasks::function]
948947
async fn pages_manifest(
949-
self: Vc<Self>,
948+
&self,
950949
entry_chunk: Vc<Box<dyn OutputAsset>>,
951950
) -> Result<Vc<Box<dyn OutputAsset>>> {
952-
let this = self.await?;
953-
let node_root = this.pages_project.project().node_root();
951+
let node_root = self.pages_project.project().node_root();
954952
let chunk_path = entry_chunk.ident().path().await?;
955953

956954
let asset_path = node_root
@@ -960,11 +958,11 @@ impl PageEndpoint {
960958
.context("ssr chunk entry path must be inside the node root")?;
961959

962960
let pages_manifest = PagesManifest {
963-
pages: [(this.pathname.await?.clone_value(), asset_path.into())]
961+
pages: [(self.pathname.await?.clone_value(), asset_path.into())]
964962
.into_iter()
965963
.collect(),
966964
};
967-
let manifest_path_prefix = get_asset_prefix_from_pathname(&this.pathname.await?);
965+
let manifest_path_prefix = get_asset_prefix_from_pathname(&self.pathname.await?);
968966
Ok(Vc::upcast(VirtualOutputAsset::new(
969967
node_root
970968
.join(format!("server/pages{manifest_path_prefix}/pages-manifest.json",).into()),
@@ -991,16 +989,15 @@ impl PageEndpoint {
991989

992990
#[turbo_tasks::function]
993991
async fn build_manifest(
994-
self: Vc<Self>,
992+
&self,
995993
client_chunks: Vc<OutputAssets>,
996994
) -> Result<Vc<Box<dyn OutputAsset>>> {
997-
let this = self.await?;
998-
let node_root = this.pages_project.project().node_root();
999-
let client_relative_path = this.pages_project.project().client_relative_path();
995+
let node_root = self.pages_project.project().node_root();
996+
let client_relative_path = self.pages_project.project().client_relative_path();
1000997
let client_relative_path_ref = client_relative_path.await?;
1001998
let build_manifest = BuildManifest {
1002999
pages: [(
1003-
this.pathname.await?.clone_value(),
1000+
self.pathname.await?.clone_value(),
10041001
client_chunks
10051002
.await?
10061003
.iter()
@@ -1022,7 +1019,7 @@ impl PageEndpoint {
10221019
.collect(),
10231020
..Default::default()
10241021
};
1025-
let manifest_path_prefix = get_asset_prefix_from_pathname(&this.pathname.await?);
1022+
let manifest_path_prefix = get_asset_prefix_from_pathname(&self.pathname.await?);
10261023
Ok(Vc::upcast(VirtualOutputAsset::new(
10271024
node_root
10281025
.join(format!("server/pages{manifest_path_prefix}/build-manifest.json",).into()),

0 commit comments

Comments
 (0)