Skip to content

Commit

Permalink
refactor(es): Prepare wasm32-wasi-preview1-threads target support (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Mar 11, 2024
1 parent e253804 commit e3acd14
Show file tree
Hide file tree
Showing 6 changed files with 921 additions and 940 deletions.
2 changes: 1 addition & 1 deletion bindings/binding_core_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ swc_core = { version = "0.90.18", features = [
"ecma_visit",
"base_node",
"base_concurrent",
] }
]}
swc_malloc = "0.5.10"
6 changes: 3 additions & 3 deletions crates/swc/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub struct Options {
#[serde(skip_deserializing, default)]
pub unresolved_mark: Option<Mark>,

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[serde(default = "default_cwd")]
pub cwd: PathBuf,

Expand All @@ -160,7 +160,7 @@ pub struct Options {
#[serde(default = "default_swcrc")]
pub swcrc: bool,

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[serde(default)]
pub swcrc_roots: Option<PathBuf>,

Expand Down Expand Up @@ -821,7 +821,7 @@ pub struct CallerOptions {
pub name: String,
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
fn default_cwd() -> PathBuf {
::std::env::current_dir().unwrap()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl Scope {

#[cfg(feature = "concurrent-renamer")]
if parallel {
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
let iter = self.children.par_iter_mut();
#[cfg(target_arch = "wasm32")]
let iter = self.children.iter_mut();
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_ecma_transforms_module/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
}

pub fn with_config(resolver: R, config: Config) -> Self {
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
if let Some(base_dir) = &config.base_dir {
assert!(
base_dir.is_absolute(),
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/types": "^7.14.0",
"@napi-rs/cli": "^3.0.0-alpha.22",
"@napi-rs/cli": "^3.0.0-alpha.43",
"@swc/core": "=1.2.220",
"@swc/helpers": "^0.5.0",
"@swc/plugin-jest": "^1.5.117",
Expand Down Expand Up @@ -167,7 +167,7 @@
"postinstall.js",
"bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts"
],
"packageManager": "yarn@4.0.2",
"packageManager": "yarn@4.1.1",
"dependencies": {
"@swc/counter": "^0.1.2",
"@swc/types": "^0.1.5"
Expand Down

0 comments on commit e3acd14

Please sign in to comment.