From 137079e5c649256f20801e1a8bb5544cc3beb399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 18 Jul 2025 13:46:43 +0800 Subject: [PATCH] =?UTF-8?q?build(color-module):=20=E6=B7=BB=E5=8A=A0wasm?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=95=B0=E6=94=AF=E6=8C=81=E5=92=8Cinternmen?= =?UTF-8?q?t=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加getrandom wasm_js后端配置以支持wasm环境下的随机数生成 添加internment依赖用于优化内存管理 --- color-module/Cargo.toml | 2 ++ color-module/build | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/color-module/Cargo.toml b/color-module/Cargo.toml index a89230f..51e2a8d 100644 --- a/color-module/Cargo.toml +++ b/color-module/Cargo.toml @@ -10,6 +10,8 @@ crate-type = ["cdylib"] [dependencies] color-name = "1.1.0" enum-iterator = "2.1.0" +getrandom = { version = "0.3.3", features = ["wasm_js"] } +internment = { version = "0.8.6", features = ["arc"] } linked-hash-map = { version = "0.5.6", features = ["serde", "serde_impl"] } linked_hash_set = { version = "0.1.5", features = ["serde"] } palette = { version = "0.7.6", features = ["serde"] } diff --git a/color-module/build b/color-module/build index adeb2cf..8cf31e1 100755 --- a/color-module/build +++ b/color-module/build @@ -1,2 +1,2 @@ #!/bin/bash -wasm-pack build --release --target web -d ../color_functions +RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --release --target web -d ../color_functions