这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ napi-derive = { version = "3.0.0-alpha" }
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["std", "fmt"] } # Omit the `regex` feature

[target.'cfg(all(not(target_os = "linux"), not(target_os = "freebsd"), not(target_arch = "arm"), not(target_family = "wasm")))'.dependencies]
mimalloc-safe = { version = "0.1.50", features = ["skip_collect_on_exit"] }
mimalloc-safe = { version = "0.1.50", optional = true, features = ["skip_collect_on_exit"] }

[target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies]
mimalloc-safe = { version = "0.1.50", features = ["skip_collect_on_exit", "local_dynamic_tls"] }
mimalloc-safe = { version = "0.1.50", optional = true, features = ["skip_collect_on_exit", "local_dynamic_tls"] }

[build-dependencies]
napi-build = "2.1.6"

[features]
default = []
allocator = ["dep:mimalloc-safe"]
7 changes: 6 additions & 1 deletion napi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#[cfg(all(not(target_arch = "arm"), not(target_os = "freebsd"), not(target_family = "wasm")))]
#[cfg(all(
feature = "allocator",
not(target_arch = "arm"),
not(target_os = "freebsd"),
not(target_family = "wasm")
))]
#[global_allocator]
static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
],
"scripts": {
"test": "vitest run -r ./napi",
"build": "napi build --platform --release --manifest-path napi/Cargo.toml",
"build:debug": "napi build --platform --manifest-path napi/Cargo.toml",
"postbuild": "node napi/patch.mjs"
"build": "pnpm run build:debug --features allocator --release",
"postbuild:debug": "node napi/patch.mjs"
},
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.78",
Expand Down
Loading