Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1,886 changes: 1,268 additions & 618 deletions deps/swc/Cargo.lock

Large diffs are not rendered by default.

476 changes: 329 additions & 147 deletions deps/swc/Cargo.toml

Large diffs are not rendered by default.

7,084 changes: 0 additions & 7,084 deletions deps/swc/bindings/Cargo.lock

This file was deleted.

214 changes: 0 additions & 214 deletions deps/swc/bindings/Cargo.toml

This file was deleted.

8 changes: 3 additions & 5 deletions deps/swc/bindings/binding_core_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exclude = ["artifacts.json", "index.node"]
license = "Apache-2.0"
name = "binding_core_node"
publish = false
version = "0.1.0"
version = "0.2.0"

[lib]
bench = false
Expand Down Expand Up @@ -38,18 +38,16 @@ anyhow = { workspace = true }
backtrace = { workspace = true }
napi = { workspace = true, features = ["napi3", "serde-json"] }
napi-derive = { workspace = true, features = ["type-def"] }
node_macro_deps = { path = "../node_macro_deps" }
par-core = { workspace = true, features = ["chili"] }
path-clean = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["unbounded_depth"] }
tracing = { workspace = true, features = ["release_max_level_info"] }
tracing-chrome = { workspace = true }
tracing-futures = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

swc_core = { workspace = true, features = [
swc_core = { path = "../../crates/swc_core", features = [
"allocator_node",
"ecma_ast",
"ecma_minifier",
Expand All @@ -64,4 +62,4 @@ swc_core = { workspace = true, features = [
"base_node",
"base_concurrent",
] }
swc_malloc = { workspace = true }
swc_malloc = { path = "../../crates/swc_malloc" }
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_core_node/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl Task for BundleTask {
if let Some(s) = err.downcast_ref::<String>() {
return Err(napi::Error::new(
Status::GenericFailure,
format!("panic detected: {}", s),
format!("panic detected: {s}"),
));
}

Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_core_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn init() {
if cfg!(debug_assertions) || env::var("SWC_DEBUG").unwrap_or_default() == "1" {
set_hook(Box::new(|panic_info| {
let backtrace = Backtrace::new();
println!("Panic: {:?}\nBacktrace: {:?}", panic_info, backtrace);
println!("Panic: {panic_info:?}\nBacktrace: {backtrace:?}");
}));
}
}
Expand Down
4 changes: 2 additions & 2 deletions deps/swc/bindings/binding_core_node/src/minify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn minify(
let code = String::from_utf8_lossy(code.as_ref()).to_string();
let options = String::from_utf8_lossy(opts.as_ref()).to_string();
let extras = JsMinifyExtras::default()
.with_mangle_name_cache(extras.mangle_name_cache.as_deref().map(|s| (*s).clone()));
.with_mangle_name_cache(extras.mangle_name_cache.map(|s| (*s).clone()));

let c = get_fresh_compiler();

Expand Down Expand Up @@ -134,7 +134,7 @@ pub fn minify_sync(
};
let opts = get_deserialized(opts)?;
let extras = JsMinifyExtras::default()
.with_mangle_name_cache(extras.mangle_name_cache.as_deref().map(|s| (*s).clone()));
.with_mangle_name_cache(extras.mangle_name_cache.map(|s| (*s).clone()));

let c = get_fresh_compiler();

Expand Down
2 changes: 2 additions & 0 deletions deps/swc/bindings/binding_core_node/src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl Task for PrintTask {
codegen_config: swc_core::ecma::codegen::Config::default()
.with_target(options.config.jsc.target.unwrap_or(EsVersion::Es2020))
.with_minify(options.config.minify.into_bool()),
source_file_name: Some(&options.filename),
..Default::default()
},
)
Expand Down Expand Up @@ -108,6 +109,7 @@ pub fn print_sync(program: String, options: Buffer) -> napi::Result<TransformOut
codegen_config: swc_core::ecma::codegen::Config::default()
.with_target(codegen_target)
.with_minify(options.config.minify.into_bool()),
source_file_name: Some(&options.filename),
..Default::default()
},
)
Expand Down
4 changes: 2 additions & 2 deletions deps/swc/bindings/binding_core_node/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ where
};

if let Some(s) = p.downcast_ref::<String>() {
Err(anyhow!("failed to handle: {}", s))
Err(anyhow!("failed to handle: {s}"))
} else if let Some(s) = p.downcast_ref::<&str>() {
Err(anyhow!("failed to handle: {}", s))
Err(anyhow!("failed to handle: {s}"))
} else {
Err(anyhow!("failed to handle with unknown panic message"))
}
Expand Down
20 changes: 13 additions & 7 deletions deps/swc/bindings/binding_core_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ license = { workspace = true }
name = "binding_core_wasm"
publish = false
repository = { workspace = true }
version = "1.14.0"
version = "1.15.10"

[lib]
bench = false
crate-type = ["cdylib"]

[features]
default = ["swc_v1"]
swc_v1 = []
swc_v2 = []
__plugin = []
default = ["swc_v1"]
swc_v1 = []
swc_v2 = []
# This feature exists to allow cargo operations
# [TODO]: this is disabled due to signature mismatch between host_native and host_js,
# which causes build errors like
Expand All @@ -35,16 +36,21 @@ anyhow = { workspace = true }
getrandom = { workspace = true, features = ["wasm_js"] }
serde = { workspace = true, features = ["derive"] }
serde-wasm-bindgen = { workspace = true }
swc_core = { workspace = true, features = [
swc_core = { path = "../../crates/swc_core", features = [
"ecma_ast_serde",
"ecma_codegen",
"binding_macro_wasm",
"ecma_transforms",
"ecma_visit",
"ecma_helpers_inline",
"ecma_lints",
] }
tracing = { workspace = true, features = ["max_level_off"] }
wasm-bindgen = { workspace = true, features = ["enable-interning"] }

[package.metadata.wasm-pack.profile.release]
wasm-opt = false
[package.metadata.wasm-pack.profile.release]
wasm-opt = false

[package.metadata.cargo-shear]
# ignored, as they are only used to enable features
ignored = ["getrandom", "anyhow", "serde-wasm-bindgen"]
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_core_wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"devDependencies": {
"jest": "^29.7.0"
"@rstest/core": "0.7.8"
}
}
4 changes: 4 additions & 0 deletions deps/swc/bindings/binding_core_wasm/rstest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
include: ["__tests__/**/*.{js,jsx,ts,tsx}"],
globals: true,
};
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_core_wasm/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -eu

wasm-pack build --out-name wasm --release --scope=swc --target nodejs
npx jest $@
npx rstest $@
Loading
Loading