Skip to content

Commit

Permalink
Merge branch 'canary' into sam/docs/sassOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Sep 26, 2024
2 parents a3ee2de + c13f502 commit 544eb70
Show file tree
Hide file tree
Showing 690 changed files with 15,445 additions and 10,425 deletions.
2 changes: 1 addition & 1 deletion .github/actions/next-repo-actions/src/popular-prs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function run() {

const blocks = BlockCollection([
Section({
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)._`,
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)._`,
}),
Divider(),
Section({
Expand Down
44 changes: 32 additions & 12 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ jobs:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
# Empty value uses default
react: ['', '18.3.1']
uses: ./.github/workflows/build_reusable.yml
with:
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}
stepName: 'test-turbopack-dev-${{ matrix.group }}'
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}
stepName: 'test-turbopack-dev-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

test-turbopack-integration:
Expand All @@ -217,11 +219,13 @@ jobs:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
# Empty value uses default
react: ['']
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.18.2
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
stepName: 'test-turbopack-integration-${{ matrix.group }}'
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
stepName: 'test-turbopack-integration-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

test-turbopack-production:
Expand All @@ -233,11 +237,17 @@ jobs:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
# Empty value uses default
# TODO: Run with React 18.
# Integration tests use the installed React version in next/package.json.include:
# We can't easily switch like we do for e2e tests.
# Skipping this dimensions until we can figure out a way to test multiple React versions.
react: ['', '18.3.1']
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.18.2
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
stepName: 'test-turbopack-production-${{ matrix.group }}'
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
stepName: 'test-turbopack-production-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

test-turbopack-production-integration:
Expand Down Expand Up @@ -362,10 +372,12 @@ jobs:
fail-fast: false
matrix:
group: [1/4, 2/4, 3/4, 4/4]
# Empty value uses default
react: ['', '18.3.1']
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
stepName: 'test-dev-${{ matrix.group }}'
afterBuild: NEXT_TEST_MODE=dev NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

test-prod:
Expand All @@ -377,10 +389,12 @@ jobs:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
# Empty value uses default
react: ['', '18.3.1']
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
stepName: 'test-prod-${{ matrix.group }}'
afterBuild: NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
stepName: 'test-prod-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

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

test-firefox-safari:
Expand Down
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,29 @@
"codemod",
"codemods",
"Destructuring",
"buildtime",
"callsites",
"codemod",
"datastream",
"deduped",
"draftmode",
"Entrypoints",
"jscodeshift",
"napi",
"navigations",
"nextjs",
"opentelemetry",
"Preinit",
"prerendered",
"prerendering",
"proxied",
"renderable",
"revalidates",
"subresource",
"thenables",
"Threadsafe",
"Turbopack",
"unproxied",
"zipkin"
],
"grammarly.selectors": [
Expand Down
67 changes: 53 additions & 14 deletions crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use next_core::{
next_app::{
app_client_references_chunks::get_app_server_reference_modules,
get_app_client_references_chunks, get_app_client_shared_chunk_group, get_app_page_entry,
get_app_route_entry, metadata::route::get_app_metadata_route_entry, AppEntry, AppPage,
get_app_route_entry, include_modules_module::IncludeModulesModule,
metadata::route::get_app_metadata_route_entry, AppEntry, AppPage,
},
next_client::{
get_client_module_options_context, get_client_resolve_options_context,
Expand All @@ -36,7 +37,9 @@ use next_core::{
};
use serde::{Deserialize, Serialize};
use tracing::Instrument;
use turbo_tasks::{trace::TraceRawVcs, Completion, RcStr, TryJoinIterExt, Value, Vc};
use turbo_tasks::{
trace::TraceRawVcs, Completion, RcStr, TryJoinIterExt, Value, ValueToString, Vc,
};
use turbo_tasks_env::{CustomProcessEnv, ProcessEnv};
use turbo_tasks_fs::{File, FileContent, FileSystemPath};
use turbopack::{
Expand Down Expand Up @@ -686,6 +689,11 @@ fn client_shared_chunks() -> Vc<RcStr> {
Vc::cell("client_shared_chunks".into())
}

#[turbo_tasks::function]
fn server_utils_module() -> Vc<RcStr> {
Vc::cell("server-utils".into())
}

#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs)]
enum AppPageEndpointType {
Html,
Expand Down Expand Up @@ -1256,31 +1264,62 @@ impl AppEndpoint {
let mut current_chunks = OutputAssets::empty();
let mut current_availability_info = AvailabilityInfo::Root;
if let Some(client_references) = client_references {
for server_component in client_references
.await?
.server_component_entries
.iter()
.copied()
{
let server_path = server_component.server_path();
let is_layout =
server_path.file_stem().await?.as_deref() == Some("layout");
let client_references = client_references.await?;
let span = tracing::trace_span!("server utils",);
async {
let utils_module = IncludeModulesModule::new(
AssetIdent::from_path(this.app_project.project().project_path())
.with_modifier(server_utils_module()),
client_references.server_utils.clone(),
);

let chunk_group = chunking_context
.chunk_group(
server_component.ident(),
Vc::upcast(server_component),
utils_module.ident(),
Vc::upcast(utils_module),
Value::new(current_availability_info),
)
.await?;

if is_layout {
current_chunks = current_chunks
.concatenate(chunk_group.assets)
.resolve()
.await?;
current_availability_info = chunk_group.availability_info;

anyhow::Ok(())
}
.instrument(span)
.await?;
for server_component in client_references
.server_component_entries
.iter()
.copied()
.take(client_references.server_component_entries.len() - 1)
{
let span = tracing::trace_span!(
"layout segment",
name = server_component.ident().to_string().await?.as_str()
);
async {
let chunk_group = chunking_context
.chunk_group(
server_component.ident(),
Vc::upcast(server_component),
Value::new(current_availability_info),
)
.await?;

current_chunks = current_chunks
.concatenate(chunk_group.assets)
.resolve()
.await?;
current_availability_info = chunk_group.availability_info;

anyhow::Ok(())
}
.instrument(span)
.await?;
}
}
chunking_context
Expand Down
8 changes: 3 additions & 5 deletions crates/next-api/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,11 @@ impl MiddlewareEndpoint {
}

#[turbo_tasks::function]
async fn userland_module(self: Vc<Self>) -> Result<Vc<Box<dyn Module>>> {
let this = self.await?;

Ok(this
async fn userland_module(&self) -> Result<Vc<Box<dyn Module>>> {
Ok(self
.asset_context
.process(
this.source,
self.source,
Value::new(ReferenceType::Entry(EntryReferenceSubType::Middleware)),
)
.module())
Expand Down
25 changes: 11 additions & 14 deletions crates/next-api/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,8 @@ impl PageEndpoint {
}

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

#[turbo_tasks::function]
Expand Down Expand Up @@ -946,11 +945,10 @@ impl PageEndpoint {

#[turbo_tasks::function]
async fn pages_manifest(
self: Vc<Self>,
&self,
entry_chunk: Vc<Box<dyn OutputAsset>>,
) -> Result<Vc<Box<dyn OutputAsset>>> {
let this = self.await?;
let node_root = this.pages_project.project().node_root();
let node_root = self.pages_project.project().node_root();
let chunk_path = entry_chunk.ident().path().await?;

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

let pages_manifest = PagesManifest {
pages: [(this.pathname.await?.clone_value(), asset_path.into())]
pages: [(self.pathname.await?.clone_value(), asset_path.into())]
.into_iter()
.collect(),
};
let manifest_path_prefix = get_asset_prefix_from_pathname(&this.pathname.await?);
let manifest_path_prefix = get_asset_prefix_from_pathname(&self.pathname.await?);
Ok(Vc::upcast(VirtualOutputAsset::new(
node_root
.join(format!("server/pages{manifest_path_prefix}/pages-manifest.json",).into()),
Expand All @@ -991,16 +989,15 @@ impl PageEndpoint {

#[turbo_tasks::function]
async fn build_manifest(
self: Vc<Self>,
&self,
client_chunks: Vc<OutputAssets>,
) -> Result<Vc<Box<dyn OutputAsset>>> {
let this = self.await?;
let node_root = this.pages_project.project().node_root();
let client_relative_path = this.pages_project.project().client_relative_path();
let node_root = self.pages_project.project().node_root();
let client_relative_path = self.pages_project.project().client_relative_path();
let client_relative_path_ref = client_relative_path.await?;
let build_manifest = BuildManifest {
pages: [(
this.pathname.await?.clone_value(),
self.pathname.await?.clone_value(),
client_chunks
.await?
.iter()
Expand All @@ -1022,7 +1019,7 @@ impl PageEndpoint {
.collect(),
..Default::default()
};
let manifest_path_prefix = get_asset_prefix_from_pathname(&this.pathname.await?);
let manifest_path_prefix = get_asset_prefix_from_pathname(&self.pathname.await?);
Ok(Vc::upcast(VirtualOutputAsset::new(
node_root
.join(format!("server/pages{manifest_path_prefix}/build-manifest.json",).into()),
Expand Down
Loading

0 comments on commit 544eb70

Please sign in to comment.