From 84d631a9c370d304e2e82bebdb79d618a9895f29 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 1 Mar 2025 02:22:27 +0100 Subject: [PATCH] Move typst wasm plugin into separate workspace --- .gitignore | 3 +- Cargo.lock | 30 -- Cargo.toml | 5 - .../src/documents/plugin.wasm | 2 +- showbits-typst-plugin/Cargo.lock | 339 ++++++++++++++++++ showbits-typst-plugin/Cargo.toml | 44 ++- showbits-typst-plugin/meta/build | 5 +- 7 files changed, 381 insertions(+), 47 deletions(-) create mode 100644 showbits-typst-plugin/Cargo.lock diff --git a/.gitignore b/.gitignore index ea8c4bf..356aeba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/target +/target/ +/showbits-typst-plugin/target/ diff --git a/Cargo.lock b/Cargo.lock index 7a59a91..aaf9200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2533,16 +2533,6 @@ dependencies = [ "typst-render", ] -[[package]] -name = "showbits-typst-plugin" -version = "0.0.0" -dependencies = [ - "image", - "mark", - "palette", - "wasm-minimal-protocol", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3526,16 +3516,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "venial" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61584a325b16f97b5b25fcc852eb9550843a251057a5e3e5992d2376f3df4bb2" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "version-compare" version = "0.2.0" @@ -3631,16 +3611,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "wasm-minimal-protocol" -version = "0.1.0" -source = "git+https://github.com/astrale-sharp/wasm-minimal-protocol.git?rev=90336ebf2d99844fd8f8e99ea7096af96526cbf4#90336ebf2d99844fd8f8e99ea7096af96526cbf4" -dependencies = [ - "proc-macro2", - "quote", - "venial", -] - [[package]] name = "wasmi" version = "0.40.0" diff --git a/Cargo.toml b/Cargo.toml index 790495a..32053b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ members = [ "showbits-common", "showbits-thermal-printer", "showbits-typst", - "showbits-typst-plugin", ] [workspace.package] @@ -43,10 +42,6 @@ features = ["std", "taffy_tree", "flexbox", "grid", "block_layout"] git = "https://github.com/Garmelon/mark.git" rev = "2a862a69d69abc64ddd7eefd1e1ff3d05ce3b6e4" -[workspace.dependencies.wasm-minimal-protocol] -git = "https://github.com/astrale-sharp/wasm-minimal-protocol.git" -rev = "90336ebf2d99844fd8f8e99ea7096af96526cbf4" - [workspace.lints] rust.unsafe_code = { level = "forbid", priority = 1 } # Lint groups diff --git a/showbits-thermal-printer/src/documents/plugin.wasm b/showbits-thermal-printer/src/documents/plugin.wasm index 178ce8a..df71aee 120000 --- a/showbits-thermal-printer/src/documents/plugin.wasm +++ b/showbits-thermal-printer/src/documents/plugin.wasm @@ -1 +1 @@ -../../../target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm \ No newline at end of file +../../../showbits-typst-plugin/target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm \ No newline at end of file diff --git a/showbits-typst-plugin/Cargo.lock b/showbits-typst-plugin/Cargo.lock new file mode 100644 index 0000000..6986795 --- /dev/null +++ b/showbits-typst-plugin/Cargo.lock @@ -0,0 +1,339 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytemuck" +version = "1.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "fast-srgb8" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "flate2" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "image" +version = "0.25.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" +dependencies = [ + "bytemuck", + "byteorder-lite", + "num-traits", + "png", +] + +[[package]] +name = "mark" +version = "0.0.0" +source = "git+https://github.com/Garmelon/mark.git?rev=2a862a69d69abc64ddd7eefd1e1ff3d05ce3b6e4#2a862a69d69abc64ddd7eefd1e1ff3d05ce3b6e4" +dependencies = [ + "image", + "palette", + "rand 0.9.0", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "palette" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbf71184cc5ecc2e4e1baccdb21026c20e5fc3dcf63028a086131b3ab00b6e6" +dependencies = [ + "approx", + "fast-srgb8", + "palette_derive", + "phf", +] + +[[package]] +name = "palette_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5030daf005bface118c096f510ffb781fc28f9ab6a32ab224d8631be6851d30" +dependencies = [ + "by_address", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "proc-macro2" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_core 0.9.2", + "zerocopy", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a509b1a2ffbe92afab0e55c8fd99dea1c280e8171bd2d88682bb20bc41cbc2c" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "showbits-typst-plugin" +version = "0.0.0" +dependencies = [ + "image", + "mark", + "palette", + "wasm-minimal-protocol", +] + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "syn" +version = "2.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" + +[[package]] +name = "venial" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61584a325b16f97b5b25fcc852eb9550843a251057a5e3e5992d2376f3df4bb2" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "wasm-minimal-protocol" +version = "0.1.0" +source = "git+https://github.com/astrale-sharp/wasm-minimal-protocol.git?rev=90336ebf2d99844fd8f8e99ea7096af96526cbf4#90336ebf2d99844fd8f8e99ea7096af96526cbf4" +dependencies = [ + "proc-macro2", + "quote", + "venial", +] + +[[package]] +name = "zerocopy" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf01143b2dd5d134f11f545cf9f1431b13b749695cb33bcce051e7568f99478" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712c8386f4f4299382c9abee219bee7084f78fb939d88b6840fcc1320d5f6da2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/showbits-typst-plugin/Cargo.toml b/showbits-typst-plugin/Cargo.toml index 797e871..8735386 100644 --- a/showbits-typst-plugin/Cargo.toml +++ b/showbits-typst-plugin/Cargo.toml @@ -1,16 +1,26 @@ [package] name = "showbits-typst-plugin" -version = { workspace = true } -edition = { workspace = true } +version = "0.0.0" +edition = "2024" [lib] crate-type = ["cdylib"] [dependencies] -image = { workspace = true, features = ["png"] } -mark = { workspace = true } -palette = { workspace = true } -wasm-minimal-protocol = { workspace = true } +palette = "0.7.6" + +[dependencies.image] +version = "0.25.5" +default-features = false +features = ["png"] + +[dependencies.mark] +git = "https://github.com/Garmelon/mark.git" +rev = "2a862a69d69abc64ddd7eefd1e1ff3d05ce3b6e4" + +[dependencies.wasm-minimal-protocol] +git = "https://github.com/astrale-sharp/wasm-minimal-protocol.git" +rev = "90336ebf2d99844fd8f8e99ea7096af96526cbf4" [profile.release] lto = true # Enable link-time optimization @@ -20,4 +30,24 @@ codegen-units = 1 # Reduce number of codegen units to increase optimizations panic = 'abort' # Abort on panic [lints] -workspace = true +rust.unsafe_code = { level = "forbid", priority = 1 } +# Lint groups +rust.deprecated_safe = "warn" +rust.future_incompatible = "warn" +rust.keyword_idents = "warn" +rust.rust_2018_idioms = "warn" +rust.unused = "warn" +# Individual lints +rust.non_local_definitions = "warn" +rust.redundant_imports = "warn" +rust.redundant_lifetimes = "warn" +rust.single_use_lifetimes = "warn" +rust.unit_bindings = "warn" +rust.unused_crate_dependencies = "warn" +rust.unused_import_braces = "warn" +rust.unused_lifetimes = "warn" +rust.unused_qualifications = "warn" +# Clippy +clippy.use_self = "warn" + +[workspace] # Prevent package from being included in outer workspace diff --git a/showbits-typst-plugin/meta/build b/showbits-typst-plugin/meta/build index 330a86d..ce10625 100755 --- a/showbits-typst-plugin/meta/build +++ b/showbits-typst-plugin/meta/build @@ -1,5 +1,4 @@ #!/usr/bin/env fish -cargo build --release \ - --package showbits-typst-plugin \ - --target wasm32-unknown-unknown +pushd showbits-typst-plugin +cargo build --release --target wasm32-unknown-unknown