refactor(es): Prepare wasm32-wasi-preview1-threads target support (#8724)

This commit is contained in:
LongYinan 2024-03-11 12:27:29 +08:00 committed by GitHub
parent e25380451e
commit e3acd1476c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 921 additions and 940 deletions

View File

@ -63,5 +63,5 @@ swc_core = { version = "0.90.18", features = [
"ecma_visit", "ecma_visit",
"base_node", "base_node",
"base_concurrent", "base_concurrent",
] } ]}
swc_malloc = "0.5.10" swc_malloc = "0.5.10"

View File

@ -138,7 +138,7 @@ pub struct Options {
#[serde(skip_deserializing, default)] #[serde(skip_deserializing, default)]
pub unresolved_mark: Option<Mark>, pub unresolved_mark: Option<Mark>,
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[serde(default = "default_cwd")] #[serde(default = "default_cwd")]
pub cwd: PathBuf, pub cwd: PathBuf,
@ -160,7 +160,7 @@ pub struct Options {
#[serde(default = "default_swcrc")] #[serde(default = "default_swcrc")]
pub swcrc: bool, pub swcrc: bool,
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[serde(default)] #[serde(default)]
pub swcrc_roots: Option<PathBuf>, pub swcrc_roots: Option<PathBuf>,
@ -821,7 +821,7 @@ pub struct CallerOptions {
pub name: String, pub name: String,
} }
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
fn default_cwd() -> PathBuf { fn default_cwd() -> PathBuf {
::std::env::current_dir().unwrap() ::std::env::current_dir().unwrap()
} }

View File

@ -244,7 +244,7 @@ impl Scope {
#[cfg(feature = "concurrent-renamer")] #[cfg(feature = "concurrent-renamer")]
if parallel { if parallel {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
let iter = self.children.par_iter_mut(); let iter = self.children.par_iter_mut();
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
let iter = self.children.iter_mut(); let iter = self.children.iter_mut();

View File

@ -117,7 +117,7 @@ where
} }
pub fn with_config(resolver: R, config: Config) -> Self { 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 { if let Some(base_dir) = &config.base_dir {
assert!( assert!(
base_dir.is_absolute(), base_dir.is_absolute(),

View File

@ -93,7 +93,7 @@
"@babel/preset-react": "^7.13.13", "@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0", "@babel/preset-typescript": "^7.13.0",
"@babel/types": "^7.14.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/core": "=1.2.220",
"@swc/helpers": "^0.5.0", "@swc/helpers": "^0.5.0",
"@swc/plugin-jest": "^1.5.117", "@swc/plugin-jest": "^1.5.117",
@ -167,7 +167,7 @@
"postinstall.js", "postinstall.js",
"bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts" "bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts"
], ],
"packageManager": "yarn@4.0.2", "packageManager": "yarn@4.1.1",
"dependencies": { "dependencies": {
"@swc/counter": "^0.1.2", "@swc/counter": "^0.1.2",
"@swc/types": "^0.1.5" "@swc/types": "^0.1.5"

1845
yarn.lock

File diff suppressed because it is too large Load Diff