Always use wee_alloc for wasm
This commit is contained in:
parent
e02410ba91
commit
61bea53b7c
5 changed files with 6 additions and 12 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -178,7 +178,6 @@ dependencies = [
|
||||||
name = "reconcile-text"
|
name = "reconcile-text"
|
||||||
version = "0.4.10"
|
version = "0.4.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.1",
|
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"insta",
|
"insta",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,11 @@ wasm-bindgen = { version = "0.2.99", optional = true }
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
console_error_panic_hook = { version = "0.1.7", optional = true }
|
||||||
|
|
||||||
wee_alloc = { version = "0.4.2", optional = true }
|
wee_alloc = { version = "0.4.2", optional = true }
|
||||||
cfg-if = "1.0.1"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
serde = [ "dep:serde" ]
|
serde = [ "dep:serde" ]
|
||||||
wasm = [ "dep:wasm-bindgen" ]
|
wasm = [ "dep:wasm-bindgen", "dep:wee_alloc" ]
|
||||||
console_error_panic_hook = [ "dep:console_error_panic_hook" ]
|
console_error_panic_hook = [ "dep:console_error_panic_hook" ]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ fi
|
||||||
echo "Bumping versions"
|
echo "Bumping versions"
|
||||||
cargo set-version --bump $1
|
cargo set-version --bump $1
|
||||||
|
|
||||||
wasm-pack build --target web --features wasm,wee_alloc
|
wasm-pack build --target web --features wasm
|
||||||
|
|
||||||
cd reconcile-js
|
cd reconcile-js
|
||||||
npm version $1
|
npm version $1
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
wasm-pack build --target web --features wasm,wee_alloc
|
wasm-pack build --target web --features wasm
|
||||||
cd reconcile-js
|
cd reconcile-js
|
||||||
npm run build
|
npm run build
|
||||||
cd ../examples/website
|
cd ../examples/website
|
||||||
|
|
|
||||||
10
src/wasm.rs
10
src/wasm.rs
|
|
@ -1,16 +1,12 @@
|
||||||
//! Expose the `reconcile` crate's functionality to WebAssembly.
|
//! Expose the `reconcile` crate's functionality to WebAssembly.
|
||||||
use core::str;
|
use core::str;
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
use crate::{BuiltinTokenizer, CursorPosition, SpanWithHistory, TextWithCursors};
|
use crate::{BuiltinTokenizer, CursorPosition, SpanWithHistory, TextWithCursors};
|
||||||
cfg_if! {
|
|
||||||
if #[cfg(feature = "wee_alloc")] {
|
#[global_allocator]
|
||||||
#[global_allocator]
|
static ALLOC: wee_alloc::WeeAlloc<'_> = wee_alloc::WeeAlloc::INIT;
|
||||||
static ALLOC: wee_alloc::WeeAlloc<'_> = wee_alloc::WeeAlloc::INIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// WASM wrapper around `crate::reconcile` for merging text.
|
/// WASM wrapper around `crate::reconcile` for merging text.
|
||||||
#[wasm_bindgen(js_name = reconcile)]
|
#[wasm_bindgen(js_name = reconcile)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue