Skip to content

Commit

Permalink
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Dec 10, 2024
2 parents 5050ff0 + 416c137 commit 2cf36e2
Show file tree
Hide file tree
Showing 267 changed files with 4,427 additions and 5,116 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ jobs:
elif [ '${{ github.event_name }}' == 'workflow_dispatch' ]
then
echo "value=force-preview" >> $GITHUB_OUTPUT
elif [[ $(node scripts/run-for-change.js --not --type docs --exec echo 'false') != 'false' ]];
then
echo "value=skipped" >> $GITHUB_OUTPUT
else
echo "value=automated-preview" >> $GITHUB_OUTPUT
fi
- name: Print deploy target
run: echo "Deploy target is '${{ steps.deploy-target.outputs.value }}'"

build:
if: ${{ needs.deploy-target.outputs.value != 'skipped' }}
needs:
- deploy-target
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
Expand Down Expand Up @@ -96,6 +102,7 @@ jobs:

# Build binaries for publishing
build-native:
if: ${{ needs.deploy-target.outputs.value != 'skipped' }}
needs:
- deploy-target
defaults:
Expand Down Expand Up @@ -380,6 +387,9 @@ jobs:
path: .turbo/runs

build-wasm:
if: ${{ needs.deploy-target.outputs.value != 'skipped' }}
needs:
- deploy-target
strategy:
matrix:
target: [web, nodejs]
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/issue_stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ jobs:
name: 'Close stale issues with no reproduction'
with:
repo-token: ${{ secrets.STALE_TOKEN }}
any-of-labels: 'please add a complete reproduction,please simplify reproduction'
close-issue-message: 'This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.'
any-of-labels: 'please add a complete reproduction'
close-issue-message: 'This issue has been automatically closed due to 2 days of inactivity and the avsence of a complete reproduction. If you believe this was done in error, please leave a comment. If you are experiencing a similar issue, consider opening a new issue with a complete reproduction. Thank you.'
days-before-issue-close: 1
days-before-issue-stale: 30
days-before-issue-stale: 2
days-before-pr-close: -1
days-before-pr-stale: -1
exempt-issue-labels: 'blocked,must,should,keep'
operations-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close
- uses: actions/stale@v9
id: stale-simple-repro
name: 'Close issues with no simple repro'
with:
repo-token: ${{ secrets.STALE_TOKEN }}
any-of-labels: 'please simplify reproduction'
close-issue-message: 'This issue has been automatically closed due to 14 days of inactivity and the absence of a simple reproduction for investigation. If you believe this was done in error, please leave a comment. If you are experiencing a similar issue, consider opening a new issue with a simple reproduction. Thank you.'
days-before-issue-close: 1
days-before-issue-stale: 14
days-before-pr-close: -1
days-before-pr-stale: -1
exempt-issue-labels: 'blocked,must,should,keep'
Expand All @@ -29,9 +42,9 @@ jobs:
with:
repo-token: ${{ secrets.STALE_TOKEN }}
any-of-labels: 'please verify canary'
close-issue-message: "This issue has been automatically closed because it wasn't verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you."
close-issue-message: 'This issue has been automatically closed due to 14 days of inactivity and the absence of testing against next@canary. If you believe this was done in error, please leave a comment. If you are experiencing a similar issue, consider opening a new issue with a reproduction. Thank you.'
days-before-issue-close: 1
days-before-issue-stale: 30
days-before-issue-stale: 14
days-before-pr-close: -1
days-before-pr-stale: -1
exempt-issue-labels: 'blocked,must,should,keep'
Expand Down
14 changes: 9 additions & 5 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/next-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ workspace = true

[dependencies]
anyhow = { workspace = true, features = ["backtrace"] }
auto-hash-map = { workspace = true }
futures = { workspace = true }
indexmap = { workspace = true }
next-core = { workspace = true }
petgraph = { workspace = true, features = ["serde-1"]}
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
91 changes: 35 additions & 56 deletions crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ use serde::{Deserialize, Serialize};
use tracing::Instrument;
use turbo_rcstr::RcStr;
use turbo_tasks::{
fxindexmap, fxindexset, trace::TraceRawVcs, Completion, FxIndexMap, FxIndexSet, ResolvedVc,
TryJoinIterExt, Value, ValueToString, Vc,
fxindexmap, fxindexset, trace::TraceRawVcs, Completion, FxIndexSet, ResolvedVc, TryJoinIterExt,
Value, ValueToString, Vc,
};
use turbo_tasks_env::{CustomProcessEnv, ProcessEnv};
use turbo_tasks_fs::{File, FileContent, FileSystemPath};
Expand Down Expand Up @@ -69,12 +69,10 @@ use turbopack_core::{
use turbopack_ecmascript::resolve::cjs_resolve;

use crate::{
dynamic_imports::{
collect_chunk_group, collect_evaluated_chunk_group, collect_next_dynamic_imports,
VisitedDynamicImportModules,
},
dynamic_imports::{collect_chunk_group, collect_evaluated_chunk_group},
font::create_font_manifest,
loadable_manifest::create_react_loadable_manifest,
module_graph::get_reduced_graphs_for_endpoint,
nft_json::NftJsonAsset,
paths::{
all_paths_in_root, all_server_paths, get_asset_paths_from_root, get_js_paths_from_root,
Expand Down Expand Up @@ -912,7 +910,7 @@ impl AppEndpoint {
None
};

let (client_dynamic_imports, client_references, client_references_chunks) =
let (next_dynamic_imports, client_references, client_references_chunks) =
if process_client_components {
let client_shared_chunk_group = get_app_client_shared_chunk_group(
AssetIdent::from_path(this.app_project.project().project_path())
Expand All @@ -933,6 +931,15 @@ impl AppEndpoint {
}
let client_shared_availability_info = client_shared_chunk_group.availability_info;

let reduced_graphs = get_reduced_graphs_for_endpoint(
this.app_project.project(),
*rsc_entry,
Vc::upcast(this.app_project.client_module_context()),
);
let next_dynamic_imports = reduced_graphs
.get_next_dynamic_imports_for_endpoint(*rsc_entry)
.await?;

let client_references = {
let ServerEntries {
server_component_entries,
Expand Down Expand Up @@ -961,32 +968,6 @@ impl AppEndpoint {
};
let client_references_cell = client_references.clone().cell();

let client_dynamic_imports = {
let mut client_dynamic_imports = FxIndexMap::default();
let mut visited_modules = VisitedDynamicImportModules::empty();

for refs in client_references
.client_references_by_server_component
.values()
{
let result = collect_next_dynamic_imports(
refs.iter().map(|v| **v).collect(),
Vc::upcast(this.app_project.client_module_context()),
visited_modules,
)
.await?;
client_dynamic_imports.extend(
result
.client_dynamic_imports
.iter()
.map(|(k, v)| (*k, v.clone())),
);
visited_modules = *result.visited_modules;
}

client_dynamic_imports
};

let client_references_chunks = get_app_client_references_chunks(
client_references_cell,
client_chunking_context,
Expand Down Expand Up @@ -1130,7 +1111,7 @@ impl AppEndpoint {
}

(
Some(client_dynamic_imports),
Some(next_dynamic_imports),
Some(client_references_cell),
Some(client_references_chunks),
)
Expand All @@ -1139,8 +1120,21 @@ impl AppEndpoint {
};

let server_action_manifest_loader = if process_client_components {
let reduced_graphs = get_reduced_graphs_for_endpoint(
this.app_project.project(),
*rsc_entry,
Vc::upcast(this.app_project.client_module_context()),
);
let actions = reduced_graphs.get_server_actions_for_endpoint(
*rsc_entry,
match runtime {
NextRuntime::Edge => Vc::upcast(this.app_project.edge_rsc_module_context()),
NextRuntime::NodeJs => Vc::upcast(this.app_project.rsc_module_context()),
},
);

let server_action_manifest = create_server_actions_manifest(
*ResolvedVc::upcast(app_entry.rsc_entry),
actions,
this.app_project.project().project_path(),
node_root,
app_entry.original_name.clone(),
Expand Down Expand Up @@ -1310,19 +1304,11 @@ impl AppEndpoint {
.await?;
server_assets.insert(app_paths_manifest_output);

// create react-loadable-manifest for next/dynamic
let mut dynamic_import_modules = collect_next_dynamic_imports(
vec![*ResolvedVc::upcast(app_entry.rsc_entry)],
Vc::upcast(this.app_project.client_module_context()),
VisitedDynamicImportModules::empty(),
)
.await?
.client_dynamic_imports
.clone();
dynamic_import_modules.extend(client_dynamic_imports.into_iter().flatten());
let dynamic_import_entries = collect_evaluated_chunk_group(
Vc::upcast(client_chunking_context),
dynamic_import_modules,
next_dynamic_imports
.as_deref()
.unwrap_or(&Default::default()),
)
.await?;
let loadable_manifest_output = create_react_loadable_manifest(
Expand Down Expand Up @@ -1369,18 +1355,11 @@ impl AppEndpoint {

// create react-loadable-manifest for next/dynamic
let availability_info = Value::new(AvailabilityInfo::Root);
let mut dynamic_import_modules = collect_next_dynamic_imports(
vec![*ResolvedVc::upcast(app_entry.rsc_entry)],
Vc::upcast(this.app_project.client_module_context()),
VisitedDynamicImportModules::empty(),
)
.await?
.client_dynamic_imports
.clone();
dynamic_import_modules.extend(client_dynamic_imports.into_iter().flatten());
let dynamic_import_entries = collect_chunk_group(
Vc::upcast(client_chunking_context),
dynamic_import_modules,
next_dynamic_imports
.as_deref()
.unwrap_or(&Default::default()),
availability_info,
)
.await?;
Expand Down
Loading

0 comments on commit 2cf36e2

Please sign in to comment.