Skip to content

Commit

Permalink
Rename ChunkLoading::None to ChunkLoading::Edge (#8376)
Browse files Browse the repository at this point in the history
### Description

Changing the name in order to reflect reality after talking to @sokra.

<!--
  ✍️ Write a short summary of your work.
  If necessary, include relevant screenshots.
-->

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
timneutkens authored Jun 7, 2024
1 parent c2fb13e commit 52d3aa9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/turbopack-core/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ async fn graph_node_to_referenced_nodes(
ChunkingType::Async => {
let chunk_loading =
chunking_context.environment().chunk_loading().await?;
if matches!(*chunk_loading, ChunkLoading::None) {
if matches!(*chunk_loading, ChunkLoading::Edge) {
let chunk_item = chunkable_module
.as_chunk_item(chunking_context)
.resolve()
Expand Down
8 changes: 3 additions & 5 deletions crates/turbopack-core/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ impl Rendering {
}

#[turbo_tasks::value]
#[derive(Default)]
pub enum ChunkLoading {
#[default]
None,
Edge,
/// CommonJS in Node.js
NodeJs,
/// <script> and <link> tags in the browser
Expand Down Expand Up @@ -221,9 +219,9 @@ impl Environment {
ExecutionEnvironment::NodeJsBuildTime(_) | ExecutionEnvironment::NodeJsLambda(_) => {
ChunkLoading::NodeJs.cell()
}
ExecutionEnvironment::EdgeWorker(_) => ChunkLoading::None.cell(),
ExecutionEnvironment::EdgeWorker(_) => ChunkLoading::Edge.cell(),
ExecutionEnvironment::Browser(_) => ChunkLoading::Dom.cell(),
_ => ChunkLoading::None.cell(),
ExecutionEnvironment::Custom(_) => todo!(),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-ecmascript-runtime/src/dev_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn get_browser_runtime_code(
let runtime_backend_code = embed_static_code(
asset_context,
match chunk_loading {
ChunkLoading::None => "dev/runtime/none/runtime-backend-none.ts".into(),
ChunkLoading::Edge => "dev/runtime/none/runtime-backend-none.ts".into(),
ChunkLoading::NodeJs => "dev/runtime/nodejs/runtime-backend-nodejs.ts".into(),
ChunkLoading::Dom => "dev/runtime/dom/runtime-backend-dom.ts".into(),
},
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-ecmascript/src/references/esm/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl CodeGenerateable for EsmAsyncAssetReference {
),
if matches!(
*chunking_context.environment().chunk_loading().await?,
ChunkLoading::None
ChunkLoading::Edge
) {
Value::new(ResolveType::ChunkItem)
} else {
Expand Down

0 comments on commit 52d3aa9

Please sign in to comment.