Skip to content

Commit

Permalink
Merge 3568120 into bbaaccb
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 6, 2023
2 parents bbaaccb + 3568120 commit bbc638b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
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.

18 changes: 4 additions & 14 deletions crates/next-core/src/app_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::{anyhow, Result};
use indexmap::indexmap;
use turbo_tasks::{TryJoinIterExt, Value, ValueToString};
use turbo_tasks_env::{CustomProcessEnvVc, EnvMapVc, ProcessEnvVc};
use turbo_tasks_fs::{rebase, rope::RopeBuilder, File, FileContent, FileSystemPathVc};
use turbo_tasks_fs::{rope::RopeBuilder, File, FileContent, FileSystemPathVc};
use turbopack::{
ecmascript::EcmascriptInputTransform,
transition::{TransitionVc, TransitionsByNameVc},
Expand Down Expand Up @@ -394,9 +394,7 @@ async fn create_app_source_for_directory(
intermediate_output_path_root: FileSystemPathVc,
) -> Result<ContentSourceVc> {
let AppStructure {
item,
ref children,
directory,
item, ref children, ..
} = *app_structure.await?;
let mut sources = Vec::new();

Expand Down Expand Up @@ -428,11 +426,7 @@ async fn create_app_source_for_directory(
page_path: page,
target,
project_path,
intermediate_output_path: rebase(
directory,
project_path,
intermediate_output_path_root,
),
intermediate_output_path: intermediate_output_path_root,
}
.cell()
.into(),
Expand Down Expand Up @@ -461,11 +455,7 @@ async fn create_app_source_for_directory(
server_root,
entry_path: route,
project_path,
intermediate_output_path: rebase(
directory,
project_path,
intermediate_output_path_root,
),
intermediate_output_path: intermediate_output_path_root,
output_root: intermediate_output_path_root,
}
.cell()
Expand Down
6 changes: 3 additions & 3 deletions crates/next-core/src/page_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use turbo_tasks::{
Value,
};
use turbo_tasks_env::{CustomProcessEnvVc, EnvMapVc, ProcessEnvVc};
use turbo_tasks_fs::{rebase, FileContent, FileSystemPathVc};
use turbo_tasks_fs::{FileContent, FileSystemPathVc};
use turbopack::{transition::TransitionsByNameVc, ModuleAssetContextVc};
use turbopack_core::{
asset::AssetVc,
Expand Down Expand Up @@ -575,7 +575,7 @@ async fn create_page_source_for_directory(
server_root,
url,
false,
rebase(page, project_path, output_root),
output_root,
output_root,
));
}
Expand All @@ -598,7 +598,7 @@ async fn create_page_source_for_directory(
server_root,
url,
true,
rebase(api, project_path, output_root),
output_root,
output_root,
));
}
Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tokio = { workspace = true, features = ["full"] }
turbo-tasks = { workspace = true }
turbo-tasks-env = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbopack-core = { workspace = true }
turbopack-dev-server = { workspace = true }
turbopack-ecmascript = { workspace = true }
Expand Down
9 changes: 7 additions & 2 deletions crates/turbopack-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use serde_json::Value as JsonValue;
use turbo_tasks::{CompletionVc, CompletionsVc, TryJoinIterExt, ValueToString};
use turbo_tasks_env::{ProcessEnv, ProcessEnvVc};
use turbo_tasks_fs::{to_sys_path, File, FileContent, FileSystemPathVc};
use turbo_tasks_hash::{encode_hex, hash_xxh3_hash64};
use turbopack_core::{
asset::{Asset, AssetVc, AssetsSetVc},
chunk::{ChunkGroupVc, ChunkVc, ChunkingContextVc},
Expand Down Expand Up @@ -215,7 +216,7 @@ pub async fn get_renderer_pool(

emit(intermediate_asset, output_root).await?;

let entrypoint = intermediate_output_path.join("index.js");
let entrypoint = intermediate_asset.ident().path();

let Some(cwd) = to_sys_path(cwd).await? else {
bail!("can only render from a disk filesystem, but `cwd = {}`", cwd.fs().to_string().await?);
Expand Down Expand Up @@ -245,8 +246,12 @@ pub async fn get_intermediate_asset(
intermediate_output_path: FileSystemPathVc,
) -> Result<AssetVc> {
let chunk_group = ChunkGroupVc::from_chunk(entry_chunk);
let mut hash = encode_hex(hash_xxh3_hash64(
entry_chunk.ident().path().to_string().await?.as_str(),
));
hash.push_str(".js");
Ok(NodeJsBootstrapAsset {
path: intermediate_output_path.join("index.js"),
path: intermediate_output_path.join(&hash),
chunk_group,
}
.cell()
Expand Down

0 comments on commit bbc638b

Please sign in to comment.