Set up typst wasm plugin
This commit is contained in:
parent
49d6a2c022
commit
179d0653bb
10 changed files with 76 additions and 1 deletions
21
showbits-typst-plugin/Cargo.toml
Normal file
21
showbits-typst-plugin/Cargo.toml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[package]
|
||||
name = "showbits-typst-plugin"
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies.wasm-minimal-protocol]
|
||||
git = "https://github.com/astrale-sharp/wasm-minimal-protocol.git"
|
||||
rev = "90336ebf2d99844fd8f8e99ea7096af96526cbf4"
|
||||
|
||||
[profile.release]
|
||||
lto = true # Enable link-time optimization
|
||||
strip = true # Strip symbols from binary*
|
||||
opt-level = 'z' # Optimize for size
|
||||
codegen-units = 1 # Reduce number of codegen units to increase optimizations
|
||||
panic = 'abort' # Abort on panic
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
5
showbits-typst-plugin/meta/build
Executable file
5
showbits-typst-plugin/meta/build
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
cargo build --release \
|
||||
--package showbits-typst-plugin \
|
||||
--target wasm32-unknown-unknown
|
||||
3
showbits-typst-plugin/meta/setup
Executable file
3
showbits-typst-plugin/meta/setup
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
rustup target add wasm32-unknown-unknown
|
||||
8
showbits-typst-plugin/src/lib.rs
Normal file
8
showbits-typst-plugin/src/lib.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
use wasm_minimal_protocol::*;
|
||||
|
||||
initiate_protocol!();
|
||||
|
||||
#[wasm_func]
|
||||
pub fn debug_print(arg: &[u8]) -> Vec<u8> {
|
||||
format!("{arg:?}").into_bytes()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue