-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ES chunk evaluate logic into a Runtime trait (#4141)
### Description This refactors the EcmaScript chunk evaluate segment logic into a separate `EcmascriptChunkRuntime` trait. `ChunkingContext` implementors can now optionally implement the `EcmascriptChunkContext` trait (which already existed before as a struct). This trait has two additional methods: * `EcmascriptChunkContext::ecmascript_runtime()` -> Creates a ES runtime that only registers chunks' contents * `EcmascriptChunkContext::evaluated_ecmascript_runtime()` -> Creates an ES runtime that registers chunks' contents and evaluates its entries This is important because we are going to start having more than one runtime evaluation logic with `next build` (and `ncc` and any future bundler-specific work). In the future, this could even be used to have non-Ecmascript runtimes. Also fixes WEB-688 PR for the Next.js side: vercel/next.js#47116 ### TODO - [x] ~~I need to ensure that `waitForChunksToLoad` works as expected on first load and does not re-create requests to JS and CSS chunks that are already being loaded.~~ - [x] ~~Looks like there's a hashing problem (module ident perhaps?) that creates additional snapshots.~~ ### Testing Instructions Snapshots + Integrations tests
- Loading branch information
Showing
245 changed files
with
17,169 additions
and
12,281 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "turbopack-dev" | ||
version = "0.1.0" | ||
description = "TBD" | ||
license = "MPL-2.0" | ||
edition = "2021" | ||
autobenches = false | ||
|
||
[lib] | ||
bench = false | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
indexmap = { workspace = true } | ||
indoc = { workspace = true } | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
serde_qs = { workspace = true } | ||
|
||
turbo-tasks = { workspace = true } | ||
turbo-tasks-fs = { workspace = true } | ||
turbo-tasks-hash = { workspace = true } | ||
turbopack-core = { workspace = true } | ||
turbopack-ecmascript = { workspace = true } | ||
|
||
[build-dependencies] | ||
turbo-tasks-build = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use turbo_tasks_build::generate_register; | ||
|
||
fn main() { | ||
generate_register(); | ||
} |
4 changes: 2 additions & 2 deletions
4
crates/turbopack-ecmascript/js/package.json → crates/turbopack-dev/js/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.