From 404245f2a01ed302ca2c965290817b42a1da0e4e Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Thu, 16 Feb 2023 14:49:20 -0500 Subject: [PATCH 1/4] build(cargo): update turbopack --- packages/next-swc/Cargo.lock | 62 ++++++++++++------------ packages/next-swc/crates/core/Cargo.toml | 4 +- packages/next-swc/crates/napi/Cargo.toml | 8 +-- packages/next-swc/crates/wasm/Cargo.toml | 2 +- 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 9c202c6028496..c3f129e7992d9 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -126,7 +126,7 @@ dependencies = [ [[package]] name = "auto-hash-map" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "serde", ] @@ -2279,7 +2279,7 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "next-binding" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "mdxjs", "modularize_imports", @@ -2295,7 +2295,7 @@ dependencies = [ [[package]] name = "next-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "auto-hash-map", @@ -2325,7 +2325,7 @@ dependencies = [ [[package]] name = "next-dev" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "futures", @@ -2350,7 +2350,7 @@ dependencies = [ [[package]] name = "next-font" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "fxhash", "serde", @@ -2404,7 +2404,7 @@ dependencies = [ [[package]] name = "next-transform-dynamic" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "pathdiff", "swc_core", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "next-transform-strip-page-exports" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "fxhash", "swc_core", @@ -2423,7 +2423,7 @@ dependencies = [ [[package]] name = "node-file-trace" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "clap", @@ -5451,7 +5451,7 @@ dependencies = [ [[package]] name = "turbo-malloc" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "mimalloc", ] @@ -5459,7 +5459,7 @@ dependencies = [ [[package]] name = "turbo-tasks" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "auto-hash-map", @@ -5489,7 +5489,7 @@ dependencies = [ [[package]] name = "turbo-tasks-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "cargo-lock", @@ -5501,7 +5501,7 @@ dependencies = [ [[package]] name = "turbo-tasks-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "dotenvy", @@ -5515,7 +5515,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fetch" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "indexmap", @@ -5532,7 +5532,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "auto-hash-map", @@ -5558,7 +5558,7 @@ dependencies = [ [[package]] name = "turbo-tasks-hash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "base16", "hex", @@ -5570,7 +5570,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "convert_case 0.5.0", @@ -5584,7 +5584,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros-shared" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "proc-macro2", "quote", @@ -5594,7 +5594,7 @@ dependencies = [ [[package]] name = "turbo-tasks-memory" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "auto-hash-map", @@ -5616,7 +5616,7 @@ dependencies = [ [[package]] name = "turbopack" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "indexmap", @@ -5641,7 +5641,7 @@ dependencies = [ [[package]] name = "turbopack-cli-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "clap", @@ -5657,7 +5657,7 @@ dependencies = [ [[package]] name = "turbopack-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "async-trait", @@ -5683,11 +5683,12 @@ dependencies = [ [[package]] name = "turbopack-css" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "async-trait", "indexmap", + "indoc", "once_cell", "regex", "serde", @@ -5704,7 +5705,7 @@ dependencies = [ [[package]] name = "turbopack-dev-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "futures", @@ -5713,6 +5714,7 @@ dependencies = [ "indexmap", "mime", "mime_guess", + "once_cell", "parking_lot", "pin-project-lite", "serde", @@ -5733,7 +5735,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "async-trait", @@ -5772,7 +5774,7 @@ dependencies = [ [[package]] name = "turbopack-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "serde", @@ -5787,7 +5789,7 @@ dependencies = [ [[package]] name = "turbopack-json" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "serde", @@ -5802,7 +5804,7 @@ dependencies = [ [[package]] name = "turbopack-mdx" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "mdxjs", @@ -5817,7 +5819,7 @@ dependencies = [ [[package]] name = "turbopack-node" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "futures", @@ -5840,7 +5842,7 @@ dependencies = [ [[package]] name = "turbopack-static" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "anyhow", "serde", @@ -5856,7 +5858,7 @@ dependencies = [ [[package]] name = "turbopack-swc-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230214.2#6d5fee7f19b229e75d692ef6fbb75056c20511e8" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" dependencies = [ "swc_core", "turbo-tasks", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 32fac85a8fb53..958919618c483 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -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-230214.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2", features = [ "__swc_core", "__swc_core_next_core", "__swc_transform_styled_jsx", @@ -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-230214.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2", features = [ "__swc_core_testing_transform", "__swc_testing", ] } diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 17b49e0ed63ef..3999f3bdb80b8 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -39,10 +39,10 @@ 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" -turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230214.2" } -turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230214.2" } -turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230214.2" } -next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230214.2", features = [ +turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } +turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2", features = [ "__swc_core_binding_napi", "__turbo_next_dev_server", "__turbo_node_file_trace", diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index de587f8b4f706..fcba75079856c 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -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-230214.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2", features = [ "__swc_core_binding_wasm", "__feature_mdx_rs", ] } From 31efad3f83df9ba9460612bc21d370a155b32422 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Thu, 16 Feb 2023 22:14:41 -0500 Subject: [PATCH 2/4] Update to fix Windows issue --- packages/next-swc/Cargo.lock | 68 +++++++++++++----------- packages/next-swc/crates/core/Cargo.toml | 4 +- packages/next-swc/crates/napi/Cargo.toml | 8 +-- packages/next-swc/crates/wasm/Cargo.toml | 2 +- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index c3f129e7992d9..c3e9c6a146b95 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -126,7 +126,7 @@ dependencies = [ [[package]] name = "auto-hash-map" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "serde", ] @@ -859,6 +859,12 @@ version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0" +[[package]] +name = "dunce" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" + [[package]] name = "easy-error" version = "1.0.0" @@ -2279,7 +2285,7 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "next-binding" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "mdxjs", "modularize_imports", @@ -2295,7 +2301,7 @@ dependencies = [ [[package]] name = "next-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "auto-hash-map", @@ -2325,9 +2331,10 @@ dependencies = [ [[package]] name = "next-dev" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", + "dunce", "futures", "mime", "next-core", @@ -2350,7 +2357,7 @@ dependencies = [ [[package]] name = "next-font" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "fxhash", "serde", @@ -2404,7 +2411,7 @@ dependencies = [ [[package]] name = "next-transform-dynamic" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "pathdiff", "swc_core", @@ -2413,7 +2420,7 @@ dependencies = [ [[package]] name = "next-transform-strip-page-exports" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "fxhash", "swc_core", @@ -2423,7 +2430,7 @@ dependencies = [ [[package]] name = "node-file-trace" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "clap", @@ -5451,7 +5458,7 @@ dependencies = [ [[package]] name = "turbo-malloc" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "mimalloc", ] @@ -5459,7 +5466,7 @@ dependencies = [ [[package]] name = "turbo-tasks" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "auto-hash-map", @@ -5489,7 +5496,7 @@ dependencies = [ [[package]] name = "turbo-tasks-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "cargo-lock", @@ -5501,7 +5508,7 @@ dependencies = [ [[package]] name = "turbo-tasks-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "dotenvy", @@ -5515,7 +5522,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fetch" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "indexmap", @@ -5532,13 +5539,14 @@ dependencies = [ [[package]] name = "turbo-tasks-fs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "auto-hash-map", "bitflags", "bytes", "concurrent-queue", + "dunce", "futures", "futures-retry", "include_dir", @@ -5558,7 +5566,7 @@ dependencies = [ [[package]] name = "turbo-tasks-hash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "base16", "hex", @@ -5570,7 +5578,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "convert_case 0.5.0", @@ -5584,7 +5592,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros-shared" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "proc-macro2", "quote", @@ -5594,7 +5602,7 @@ dependencies = [ [[package]] name = "turbo-tasks-memory" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "auto-hash-map", @@ -5616,7 +5624,7 @@ dependencies = [ [[package]] name = "turbopack" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "indexmap", @@ -5641,7 +5649,7 @@ dependencies = [ [[package]] name = "turbopack-cli-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "clap", @@ -5657,7 +5665,7 @@ dependencies = [ [[package]] name = "turbopack-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "async-trait", @@ -5683,7 +5691,7 @@ dependencies = [ [[package]] name = "turbopack-css" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "async-trait", @@ -5705,7 +5713,7 @@ dependencies = [ [[package]] name = "turbopack-dev-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "futures", @@ -5735,7 +5743,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "async-trait", @@ -5774,7 +5782,7 @@ dependencies = [ [[package]] name = "turbopack-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "serde", @@ -5789,7 +5797,7 @@ dependencies = [ [[package]] name = "turbopack-json" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "serde", @@ -5804,7 +5812,7 @@ dependencies = [ [[package]] name = "turbopack-mdx" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "mdxjs", @@ -5819,7 +5827,7 @@ dependencies = [ [[package]] name = "turbopack-node" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "futures", @@ -5842,7 +5850,7 @@ dependencies = [ [[package]] name = "turbopack-static" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "anyhow", "serde", @@ -5858,7 +5866,7 @@ dependencies = [ [[package]] name = "turbopack-swc-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230216.2#a13dd24594d694d36f82dae9aa3117bbd2e74b0d" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230217.2#4fd1eef9d484ef4351cdacac30076617eb0996c7" dependencies = [ "swc_core", "turbo-tasks", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 958919618c483..efadb0846d18f 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -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-230216.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2", features = [ "__swc_core", "__swc_core_next_core", "__swc_transform_styled_jsx", @@ -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-230216.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2", features = [ "__swc_core_testing_transform", "__swc_testing", ] } diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 3999f3bdb80b8..ba740d59c1ab5 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -39,10 +39,10 @@ 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" -turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } -turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } -turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2" } -next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230216.2", features = [ +turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2" } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2" } +turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2" } +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2", features = [ "__swc_core_binding_napi", "__turbo_next_dev_server", "__turbo_node_file_trace", diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index fcba75079856c..83d363a6579d0 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -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-230216.2", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230217.2", features = [ "__swc_core_binding_wasm", "__feature_mdx_rs", ] } From 35d1acda4b5cd7e36ae24b9d34bfb841593bb3d6 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 17 Feb 2023 12:39:19 -0800 Subject: [PATCH 3/4] Add turbopack route changes --- .../next/src/server/dev/next-dev-server.ts | 27 +++--- .../next/src/server/lib/route-resolver.ts | 87 +++++++++---------- .../custom-routes/test/index.test.js | 6 +- 3 files changed, 57 insertions(+), 63 deletions(-) diff --git a/packages/next/src/server/dev/next-dev-server.ts b/packages/next/src/server/dev/next-dev-server.ts index 4575643f0ae71..9cc5206906e97 100644 --- a/packages/next/src/server/dev/next-dev-server.ts +++ b/packages/next/src/server/dev/next-dev-server.ts @@ -233,7 +233,7 @@ export default class DevServer extends Server { const ensurer: RouteEnsurer = { ensure: async (match) => { - await this.hotReloader!.ensurePage({ + await this.hotReloader?.ensurePage({ match, page: match.definition.page, clientOnly: false, @@ -708,7 +708,7 @@ export default class DevServer extends Server { !this.sortedRoutes?.every((val, idx) => val === sortedRoutes[idx]) ) { // emit the change so clients fetch the update - this.hotReloader!.send(undefined, { devPagesManifest: true }) + this.hotReloader?.send(undefined, { devPagesManifest: true }) } this.sortedRoutes = sortedRoutes @@ -1098,11 +1098,12 @@ export default class DevServer extends Server { } } - const { finished = false } = await this.hotReloader!.run( - req.originalRequest, - res.originalResponse, - parsedUrl - ) + const { finished = false } = + (await this.hotReloader?.run( + req.originalRequest, + res.originalResponse, + parsedUrl + )) || {} if (finished) { return @@ -1324,7 +1325,7 @@ export default class DevServer extends Server { } protected async ensureMiddleware() { - return this.hotReloader!.ensurePage({ + return this.hotReloader?.ensurePage({ page: this.actualMiddlewareFile!, clientOnly: false, }) @@ -1337,7 +1338,7 @@ export default class DevServer extends Server { page: string appPaths: string[] | null }) { - return this.hotReloader!.ensurePage({ page, appPaths, clientOnly: false }) + return this.hotReloader?.ensurePage({ page, appPaths, clientOnly: false }) } generateRoutes() { @@ -1542,7 +1543,7 @@ export default class DevServer extends Server { } try { if (shouldEnsure || this.renderOpts.customServer) { - await this.hotReloader!.ensurePage({ + await this.hotReloader?.ensurePage({ page: pathname, appPaths, clientOnly: false, @@ -1577,10 +1578,10 @@ export default class DevServer extends Server { } protected async getFallbackErrorComponents(): Promise { - await this.hotReloader!.buildFallbackError() + await this.hotReloader?.buildFallbackError() // Build the error page to ensure the fallback is built too. // TODO: See if this can be moved into hotReloader or removed. - await this.hotReloader!.ensurePage({ page: '/_error', clientOnly: false }) + await this.hotReloader?.ensurePage({ page: '/_error', clientOnly: false }) return await loadDefaultErrorComponents(this.distDir) } @@ -1607,7 +1608,7 @@ export default class DevServer extends Server { } async getCompilationError(page: string): Promise { - const errors = await this.hotReloader!.getCompilationErrors(page) + const errors = (await this.hotReloader?.getCompilationErrors(page)) || [] if (errors.length === 0) return // Return the very first error we found. diff --git a/packages/next/src/server/lib/route-resolver.ts b/packages/next/src/server/lib/route-resolver.ts index 3afc52ec04b51..51fc6eabde09b 100644 --- a/packages/next/src/server/lib/route-resolver.ts +++ b/packages/next/src/server/lib/route-resolver.ts @@ -1,5 +1,4 @@ import type { IncomingMessage, ServerResponse } from 'http' -import type { UnwrapPromise } from '../../lib/coalesced-function' import type { NextConfig } from '../config' import type { Route } from '../router' @@ -31,52 +30,49 @@ export async function makeResolver(dir: string, nextConfig: NextConfig) { const devServer = new DevServer({ dir, conf: nextConfig, - }) as any as { - customRoutes: UnwrapPromise> - router: InstanceType - generateRoutes: any - } + }) + await devServer.startWatcher.bind(devServer)() + // @ts-expect-error devServer.customRoutes = await loadCustomRoutes(nextConfig) - const routes = devServer.generateRoutes.bind(devServer)() - devServer.router = new Router(routes) - const routeResults = new Map() - // @ts-expect-error internal field - devServer.router.catchAllRoute = { - match: getPathMatch('/:path*'), - name: 'catchall route', - fn: async (req, _res, _params, parsedUrl) => { - // clean up internal query values - for (const key of Object.keys(parsedUrl.query || {})) { - if (key.startsWith('_next')) { - delete parsedUrl.query[key] + const routeResults = new WeakMap() + const routes = devServer.generateRoutes.bind(devServer)() + const router = new Router({ + ...routes, + catchAllRoute: { + match: getPathMatch('/:path*'), + name: 'catchall route', + fn: async (req, _res, _params, parsedUrl) => { + // clean up internal query values + for (const key of Object.keys(parsedUrl.query || {})) { + if (key.startsWith('_next')) { + delete parsedUrl.query[key] + } } - } - routeResults.set( - (req as any)._initUrl, - url.format({ - pathname: parsedUrl.pathname, - query: parsedUrl.query, - hash: parsedUrl.hash, - }) - ) - return { finished: true } - }, - } as Route + routeResults.set( + req, + url.format({ + pathname: parsedUrl.pathname, + query: parsedUrl.query, + hash: parsedUrl.hash, + }) + ) + return { finished: true } + }, + } as Route, + }) // @ts-expect-error internal field - devServer.router.compiledRoutes = devServer.router.compiledRoutes.filter( - (route: Route) => { - return ( - route.type === 'rewrite' || - route.type === 'redirect' || - route.type === 'header' || - route.name === 'catchall route' || - route.name?.includes('check') - ) - } - ) + router.compiledRoutes = router.compiledRoutes.filter((route: Route) => { + const matches = + route.type === 'rewrite' || + route.type === 'redirect' || + route.type === 'header' || + route.name === 'catchall route' || + route.name?.includes('check') + return matches + }) return async function resolveRoute( _req: IncomingMessage, @@ -86,15 +82,12 @@ export async function makeResolver(dir: string, nextConfig: NextConfig) { const res = new NodeNextResponse(_res) ;(req as any)._initUrl = req.url - await devServer.router.execute.bind(devServer.router)( - req, - res, - url.parse(req.url!, true) - ) + await router.execute.bind(router)(req, res, url.parse(req.url!, true)) if (!res.originalResponse.headersSent) { res.setHeader('x-nextjs-route-result', '1') - const resolvedUrl = routeResults.get((req as any)._initUrl) + const resolvedUrl = routeResults.get(req) + routeResults.delete(req) const routeResult: RouteResult = resolvedUrl == null diff --git a/test/integration/custom-routes/test/index.test.js b/test/integration/custom-routes/test/index.test.js index d9a5835a960cf..7999b58905755 100644 --- a/test/integration/custom-routes/test/index.test.js +++ b/test/integration/custom-routes/test/index.test.js @@ -2563,7 +2563,7 @@ describe('Custom routes', () => { await fs.writeFile(nextConfigPath, nextConfigRestoreContent) }) - describe('dev mode', () => { + describe.only('dev mode', () => { let nextConfigContent beforeAll(async () => { @@ -2577,14 +2577,14 @@ describe('Custom routes', () => { ) const tempPort = await findPort() - const tempApp = await launchApp(appDir, tempPort) + const tempApp = await launchApp(appDir, tempPort, { turbo: true }) await renderViaHTTP(tempPort, '/') await killApp(tempApp) await fs.writeFile(nextConfigPath, nextConfigContent) appPort = await findPort() - app = await launchApp(appDir, appPort) + app = await launchApp(appDir, appPort, { turbo: true }) buildId = 'development' }) afterAll(async () => { From d26e8ad39ae73e45022fcefd0ebfe9889b40ed49 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 17 Feb 2023 12:45:27 -0800 Subject: [PATCH 4/4] remove test changes --- test/integration/custom-routes/test/index.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/custom-routes/test/index.test.js b/test/integration/custom-routes/test/index.test.js index 7999b58905755..d9a5835a960cf 100644 --- a/test/integration/custom-routes/test/index.test.js +++ b/test/integration/custom-routes/test/index.test.js @@ -2563,7 +2563,7 @@ describe('Custom routes', () => { await fs.writeFile(nextConfigPath, nextConfigRestoreContent) }) - describe.only('dev mode', () => { + describe('dev mode', () => { let nextConfigContent beforeAll(async () => { @@ -2577,14 +2577,14 @@ describe('Custom routes', () => { ) const tempPort = await findPort() - const tempApp = await launchApp(appDir, tempPort, { turbo: true }) + const tempApp = await launchApp(appDir, tempPort) await renderViaHTTP(tempPort, '/') await killApp(tempApp) await fs.writeFile(nextConfigPath, nextConfigContent) appPort = await findPort() - app = await launchApp(appDir, appPort, { turbo: true }) + app = await launchApp(appDir, appPort) buildId = 'development' }) afterAll(async () => {