Skip to content

Commit 9dc685e

Browse files
chore: remove turbopack-binding and other unused crates (#68456)
### What? Removes the `turbopack-binding` crate which is unnecessary now that we have everything in one repo. This should improve compile times a bit. Closes PACK-3162
1 parent ba82e5e commit 9dc685e

File tree

188 files changed

+1255
-2493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+1255
-2493
lines changed

Cargo.lock

Lines changed: 73 additions & 204 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ next-custom-transforms = { path = "crates/next-custom-transforms" }
4040
# Turbopack
4141
auto-hash-map = { path = "turbopack/crates/turbo-tasks-auto-hash-map" }
4242
node-file-trace = { path = "turbopack/crates/node-file-trace", default-features = false }
43-
signposter = { path = "turbopack/crates/turbo-tasks-signposter" }
44-
signposter-sys = { path = "turbopack/crates/turbo-tasks-signposter-sys" }
45-
tracing-signpost = { path = "turbopack/crates/turbo-tasks-tracing-signpost" }
4643
swc-ast-explorer = { path = "turbopack/crates/turbopack-swc-ast-explorer" }
4744
turbo-prehash = { path = "turbopack/crates/turbo-prehash" }
4845
turbo-tasks-malloc = { path = "turbopack/crates/turbo-tasks-malloc", default-features = false }
@@ -60,7 +57,6 @@ turbo-tasks-memory = { path = "turbopack/crates/turbo-tasks-memory" }
6057
turbo-tasks-testing = { path = "turbopack/crates/turbo-tasks-testing" }
6158
turbopack = { path = "turbopack/crates/turbopack" }
6259
turbopack-bench = { path = "turbopack/crates/turbopack-bench" }
63-
turbopack-binding = { path = "turbopack/crates/turbopack-binding" }
6460
turbopack-nodejs = { path = "turbopack/crates/turbopack-nodejs" }
6561
turbopack-cli = { path = "turbopack/crates/turbopack-cli" }
6662
turbopack-cli-utils = { path = "turbopack/crates/turbopack-cli-utils" }

crates/napi/Cargo.toml

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ crate-type = ["cdylib", "rlib"]
1414
# time (i.e wasmer/default vs wasmer/js-default) while cargo merges all the
1515
# features at once.
1616
plugin = [
17-
"turbopack-binding/__swc_core_binding_napi_plugin",
18-
"turbopack-binding/__swc_core_binding_napi_plugin_filesystem_cache",
19-
"turbopack-binding/__swc_core_binding_napi_plugin_shared_runtime",
20-
"next-custom-transforms/plugin",
21-
"next-core/plugin",
17+
"swc_core/plugin_transform_host_native",
18+
"swc_core/plugin_transform_host_native_filesystem_cache",
19+
"swc_core/plugin_transform_host_native_shared_runtime",
20+
"next-custom-transforms/plugin",
21+
"next-core/plugin",
22+
"turbopack-ecmascript-plugins",
23+
"turbopack-ecmascript-plugins/swc_ecma_transform_plugin",
2224
]
2325

2426
image-webp = ["next-core/image-webp"]
@@ -53,14 +55,14 @@ dhat = { workspace = true, optional = true }
5355
indexmap = { workspace = true }
5456
owo-colors = { workspace = true }
5557
napi = { version = "2", default-features = false, features = [
56-
"napi3",
57-
"serde-json",
58-
"tokio_rt",
59-
"error_anyhow",
60-
# Lightningcss uses this features
61-
"napi4",
62-
"napi5",
63-
"compat-mode"
58+
"napi3",
59+
"serde-json",
60+
"tokio_rt",
61+
"error_anyhow",
62+
# Lightningcss uses this features
63+
"napi4",
64+
"napi5",
65+
"compat-mode"
6466
] }
6567
napi-derive = "2"
6668
next-custom-transforms = { workspace = true }
@@ -73,40 +75,64 @@ tracing-subscriber = { workspace = true }
7375
tracing-chrome = "0.5.0"
7476
url = { workspace = true }
7577
urlencoding = { workspace = true }
76-
once_cell ={workspace= true}
78+
once_cell = { workspace = true }
79+
80+
swc_core = { workspace = true, features = [
81+
"base_concurrent",
82+
"base_node",
83+
"bundler",
84+
"bundler_concurrent",
85+
"common_concurrent",
86+
"ecma_ast",
87+
"ecma_ast_serde",
88+
"ecma_codegen",
89+
"ecma_loader_lru",
90+
"ecma_loader_node",
91+
"ecma_minifier",
92+
"ecma_parser",
93+
"ecma_parser_typescript",
94+
"ecma_transforms",
95+
"ecma_transforms_optimization",
96+
"ecma_transforms_react",
97+
"ecma_transforms_typescript",
98+
"ecma_utils",
99+
"ecma_visit",
100+
] }
77101

78102
# Dependencies for the native, non-wasm32 build.
79103
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
80104
lightningcss-napi = { workspace = true }
81105
tokio = { workspace = true, features = ["full"] }
82106
turbo-tasks = { workspace = true }
107+
turbo-tasks-memory = { workspace = true }
108+
turbo-tasks-fs = { workspace = true }
83109
next-api = { workspace = true }
84110
next-build = { workspace = true }
85111
next-core = { workspace = true }
86-
turbopack-binding = { workspace = true, features = [
87-
"__swc_core_binding_napi",
88-
"__swc_core_serde",
89-
"__feature_node_file_trace",
90-
"__feature_mdx_rs",
91-
"__turbo",
92-
"__turbo_tasks",
93-
"__turbo_tasks_malloc",
94-
"__turbo_tasks_malloc_custom_allocator",
95-
"__turbo_tasks_memory",
96-
"__turbopack",
97-
"__turbopack_ecmascript_hmr_protocol",
112+
113+
node-file-trace = { workspace = true, features = ["node-api"] }
114+
mdxjs = { workspace = true, features = ["serializable"] }
115+
116+
turbo-tasks-malloc = { workspace = true, default-features = false, features = [
117+
"custom_allocator"
98118
] }
99119

120+
turbopack = { workspace = true }
121+
turbopack-core = { workspace = true }
122+
turbopack-ecmascript-hmr-protocol = { workspace = true }
123+
turbopack-trace-utils = { workspace = true }
124+
turbopack-trace-server = { workspace = true }
125+
turbopack-ecmascript-plugins = { workspace = true, optional = true }
126+
127+
100128
# Dependencies for the wasm32 build.
101129
[target.'cfg(target_arch = "wasm32")'.dependencies]
102130
getrandom = { version = "0.2.9", default-features = false, features = ["js"] }
103131
iana-time-zone = { version = "*", features = ["fallback"] }
104-
turbopack-binding = { workspace = true, features = [
105-
"__swc_core_binding_napi",
106-
"__swc_core_serde",
107-
"__feature_mdx_rs",
108-
"__turbo_tasks_malloc",
109-
] }
132+
133+
mdxjs = { workspace = true }
134+
135+
turbo-tasks-malloc = { workspace = true, default-features = false }
110136

111137
# wasi-only dependencies.
112138
[target.wasm32-wasip1-threads.dependencies]
@@ -122,4 +148,4 @@ shadow-rs = { workspace = true }
122148

123149
# build-dependencies for the native, non-wasm32 build
124150
[target.'cfg(not(target_arch = "wasm32"))'.build-dependencies]
125-
turbopack-binding = { workspace = true, features = ["__turbo_tasks_build"] }
151+
turbo-tasks-build = { workspace = true }

crates/napi/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ fn main() {
2626
println!("cargo:rustc-link-arg=-Wl,--warn-unresolved-symbols");
2727

2828
#[cfg(not(target_arch = "wasm32"))]
29-
turbopack_binding::turbo::tasks_build::generate_register();
29+
turbo_tasks_build::generate_register();
3030
}

crates/napi/src/app_structure.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@ use next_core::app_structure::{
1212
LoaderTree, MetadataItem, MetadataWithAltItem,
1313
};
1414
use serde::{Deserialize, Serialize};
15-
use turbo_tasks::{RcStr, ReadRef, Vc};
16-
use turbopack_binding::{
17-
turbo::{
18-
tasks::{
19-
debug::ValueDebugFormat, trace::TraceRawVcs, TryJoinIterExt, TurboTasks, ValueToString,
20-
},
21-
tasks_fs::{DiskFileSystem, FileSystem, FileSystemPath},
22-
tasks_memory::MemoryBackend,
23-
},
24-
turbopack::core::PROJECT_FILESYSTEM_NAME,
15+
use turbo_tasks::{
16+
debug::ValueDebugFormat, trace::TraceRawVcs, RcStr, ReadRef, TryJoinIterExt, TurboTasks,
17+
ValueToString, Vc,
2518
};
19+
use turbo_tasks_fs::{DiskFileSystem, FileSystem, FileSystemPath};
20+
use turbo_tasks_memory::MemoryBackend;
21+
use turbopack_core::PROJECT_FILESYSTEM_NAME;
2622

2723
use crate::register;
2824

crates/napi/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use backtrace::Backtrace;
4545
use fxhash::FxHashSet;
4646
use napi::bindgen_prelude::*;
4747
use owo_colors::OwoColorize;
48-
use turbopack_binding::swc::core::{
48+
use swc_core::{
4949
base::{Compiler, TransformOutput},
5050
common::{FilePathMapping, SourceMap},
5151
};
@@ -73,8 +73,7 @@ shadow_rs::shadow!(build);
7373

7474
#[cfg(not(any(feature = "__internal_dhat-heap", feature = "__internal_dhat-ad-hoc")))]
7575
#[global_allocator]
76-
static ALLOC: turbopack_binding::turbo::malloc::TurboMalloc =
77-
turbopack_binding::turbo::malloc::TurboMalloc;
76+
static ALLOC: turbo_tasks_malloc::TurboMalloc = turbo_tasks_malloc::TurboMalloc;
7877

7978
static LOG_THROTTLE: Mutex<Option<Instant>> = Mutex::new(None);
8079
static LOG_FILE_PATH: &str = ".next/turbopack.log";

crates/napi/src/mdx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use mdxjs::{compile, Options};
12
use napi::bindgen_prelude::*;
2-
use turbopack_binding::features::mdxjs::{compile, Options};
33

44
pub struct MdxCompileTask {
55
pub input: String,

crates/napi/src/minify.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::sync::Arc;
3030
use fxhash::FxHashMap;
3131
use napi::bindgen_prelude::*;
3232
use serde::Deserialize;
33-
use turbopack_binding::swc::core::{
33+
use swc_core::{
3434
base::{config::JsMinifyOptions, try_with_handler, BoolOrDataConfig, TransformOutput},
3535
common::{errors::ColorConfig, sync::Lrc, FileName, SourceFile, SourceMap, GLOBALS},
3636
ecma::minifier::option::{
@@ -42,9 +42,9 @@ use turbopack_binding::swc::core::{
4242
use crate::{get_compiler, util::MapErr};
4343

4444
pub struct MinifyTask {
45-
c: Arc<turbopack_binding::swc::core::base::Compiler>,
45+
c: Arc<swc_core::base::Compiler>,
4646
code: MinifyTarget,
47-
opts: turbopack_binding::swc::core::base::config::JsMinifyOptions,
47+
opts: swc_core::base::config::JsMinifyOptions,
4848
}
4949

5050
#[derive(Deserialize)]
@@ -84,7 +84,7 @@ impl Task for MinifyTask {
8484
fn compute(&mut self) -> napi::Result<Self::Output> {
8585
try_with_handler(
8686
self.c.cm.clone(),
87-
turbopack_binding::swc::core::base::HandlerOpts {
87+
swc_core::base::HandlerOpts {
8888
color: ColorConfig::Never,
8989
skip_filename: true,
9090
},
@@ -147,7 +147,7 @@ pub fn minify_sync(input: Buffer, opts: Buffer) -> napi::Result<TransformOutput>
147147

148148
try_with_handler(
149149
c.cm.clone(),
150-
turbopack_binding::swc::core::base::HandlerOpts {
150+
swc_core::base::HandlerOpts {
151151
color: ColorConfig::Never,
152152
skip_filename: true,
153153
},

crates/napi/src/next_api/endpoint.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use next_api::{
88
};
99
use tracing::Instrument;
1010
use turbo_tasks::{Completion, ReadRef, Vc};
11-
use turbopack_binding::turbopack::core::{
12-
diagnostics::PlainDiagnostic, error::PrettyPrintError, issue::PlainIssue,
13-
};
11+
use turbopack_core::{diagnostics::PlainDiagnostic, error::PrettyPrintError, issue::PlainIssue};
1412

1513
use super::utils::{
1614
get_diagnostics, get_issues, subscribe, NapiDiagnostic, NapiIssue, RootTask, TurbopackResult,

crates/napi/src/next_api/project.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,21 @@ use tokio::{io::AsyncWriteExt, time::Instant};
2323
use tracing::Instrument;
2424
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Registry};
2525
use turbo_tasks::{Completion, RcStr, ReadRef, TransientInstance, TurboTasks, UpdateInfo, Vc};
26-
use turbopack_binding::{
27-
turbo::{
28-
tasks_fs::{DiskFileSystem, FileContent, FileSystem, FileSystemPath},
29-
tasks_memory::MemoryBackend,
30-
},
31-
turbopack::{
32-
core::{
33-
diagnostics::PlainDiagnostic,
34-
error::PrettyPrintError,
35-
issue::PlainIssue,
36-
source_map::Token,
37-
version::{PartialUpdate, TotalUpdate, Update, VersionState},
38-
SOURCE_MAP_PREFIX,
39-
},
40-
ecmascript_hmr_protocol::{ClientUpdateInstruction, ResourceIdentifier},
41-
trace_utils::{
42-
exit::{ExitHandler, ExitReceiver},
43-
raw_trace::RawTraceLayer,
44-
trace_writer::TraceWriter,
45-
},
46-
},
26+
use turbo_tasks_fs::{DiskFileSystem, FileContent, FileSystem, FileSystemPath};
27+
use turbo_tasks_memory::MemoryBackend;
28+
use turbopack_core::{
29+
diagnostics::PlainDiagnostic,
30+
error::PrettyPrintError,
31+
issue::PlainIssue,
32+
source_map::Token,
33+
version::{PartialUpdate, TotalUpdate, Update, VersionState},
34+
SOURCE_MAP_PREFIX,
35+
};
36+
use turbopack_ecmascript_hmr_protocol::{ClientUpdateInstruction, ResourceIdentifier};
37+
use turbopack_trace_utils::{
38+
exit::{ExitHandler, ExitReceiver},
39+
raw_trace::RawTraceLayer,
40+
trace_writer::TraceWriter,
4741
};
4842
use url::Url;
4943

@@ -307,9 +301,7 @@ pub async fn project_new(
307301
let trace_server = std::env::var("NEXT_TURBOPACK_TRACE_SERVER").ok();
308302
if trace_server.is_some() {
309303
thread::spawn(move || {
310-
turbopack_binding::turbopack::trace_server::start_turbopack_trace_server(
311-
trace_file,
312-
);
304+
turbopack_trace_server::start_turbopack_trace_server(trace_file);
313305
});
314306
println!("Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/");
315307
}

0 commit comments

Comments
 (0)