Skip to content

Commit

Permalink
Update turbopack to 230209.02 (#45776)Co-authored-by: kodiakhq[bot] <…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn and kodiakhq[bot] committed Feb 10, 2023
1 parent 1c5983f commit 946ccb0
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 312 deletions.
688 changes: 389 additions & 299 deletions packages/next-swc/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ serde = "1"
serde_json = "1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] }

next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02", features = [
"__swc_core",
"__swc_core_next_core",
"__swc_transform_styled_jsx",
Expand All @@ -29,7 +29,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-2
] }

[dev-dependencies]
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02", features = [
"__swc_core_testing_transform",
"__swc_testing",
] }
Expand Down
4 changes: 3 additions & 1 deletion packages/next-swc/crates/core/tests/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ fn test(input: &Path, minify: bool) {
output_path: Some(output.clone()),

config: next_binding::swc::core::base::config::Config {
is_module: next_binding::swc::core::base::config::IsModule::Bool(true),
is_module: Some(next_binding::swc::core::base::config::IsModule::Bool(
true,
)),

jsc: next_binding::swc::core::base::config::JscConfig {
minify: if minify {
Expand Down
4 changes: 3 additions & 1 deletion packages/next-swc/crates/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ tracing = { version = "0.1.37", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9"
tracing-chrome = "0.5.0"
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02" }
turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02" }
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02", features = [
"__swc_core_binding_napi",
"__turbo_next_dev_server",
"__turbo_node_file_trace",
Expand Down
23 changes: 21 additions & 2 deletions packages/next-swc/crates/napi/src/turbotrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@ use std::sync::Arc;

use napi::bindgen_prelude::*;
use next_binding::turbo::node_file_trace::{start, Args};
use turbo_tasks::TurboTasks;
use turbo_tasks_memory::MemoryBackend;

#[napi]
pub async fn run_turbo_tracing(options: Buffer) -> napi::Result<Vec<String>> {
pub fn create_turbo_tasks(memory_limit: Option<u32>) -> External<Arc<TurboTasks<MemoryBackend>>> {
let turbo_tasks = TurboTasks::new(MemoryBackend::new(
memory_limit.map(|m| m as usize).unwrap_or(usize::MAX),
));
External::new_with_size_hint(
turbo_tasks,
memory_limit
.map(|m| (m as usize) * 1024 * 1024)
.unwrap_or(usize::MAX),
)
}

#[napi]
pub async fn run_turbo_tracing(
options: Buffer,
turbo_tasks: Option<External<Arc<TurboTasks<MemoryBackend>>>>,
) -> napi::Result<Vec<String>> {
let args: Args = serde_json::from_slice(options.as_ref())?;
let files = start(Arc::new(args)).await?;
let turbo_tasks = turbo_tasks.map(|t| t.clone());
let files = start(Arc::new(args), turbo_tasks.as_ref()).await?;
Ok(files)
}
2 changes: 1 addition & 1 deletion packages/next-swc/crates/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8"
getrandom = { version = "0.2.5", optional = true, default-features = false }
js-sys = "0.3.59"
serde-wasm-bindgen = "0.4.3"
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230209.02", features = [
"__swc_core_binding_wasm",
"__feature_mdx_rs",
] }
Expand Down
9 changes: 7 additions & 2 deletions packages/next/src/build/swc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,13 @@ function loadNative(isCustomTurbopack = false) {
require(__INTERNAL_CUSTOM_TURBOPACK_BINDINGS).startDev(devOptions)
}
},
startTrace: (options = {}) =>
bindings.runTurboTracing(toBuffer({ exact: true, ...options })),
startTrace: (options = {}, turboTasks: unknown) =>
bindings.runTurboTracing(
toBuffer({ exact: true, ...options }),
turboTasks
),
createTurboTasks: (memoryLimit?: number): unknown =>
bindings.createTurboTasks(memoryLimit),
},
mdx: {
compile: (src: string, options: any) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ Error:
\`----
Caused by:
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error
Syntax Error
Import trace for requested module:
./index.js"
Expand All @@ -177,8 +176,7 @@ Error:
\`----
Caused by:
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error
Syntax Error
Import trace for requested module:
./index.js"
Expand Down

0 comments on commit 946ccb0

Please sign in to comment.