@rindle/wasm 0.1.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.sh +10 -5
- package/package.json +5 -3
package/build.sh
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Build the rindle wasm engine into this package as a portable ESM artifact
|
|
3
|
-
# works in browsers/bundlers (await init()) and Node (await init(bytes)) — see
|
|
2
|
+
# Build the rindle wasm engine into this package as a portable ESM artifact by default
|
|
3
|
+
# (--target web): works in browsers/bundlers (await init()) and Node (await init(bytes)) — see
|
|
4
|
+
# src/index.ts.
|
|
4
5
|
#
|
|
5
6
|
# ./build.sh [profile] # wasm-release (default) | release | dev
|
|
6
7
|
#
|
|
7
8
|
# Produces packages/wasm/pkg/{rindle.js, rindle_bg.wasm, rindle.d.ts}.
|
|
9
|
+
# Advanced wrappers may override:
|
|
10
|
+
# RINDLE_WASM_OUT output directory
|
|
11
|
+
# RINDLE_WASM_BINDGEN_TARGET wasm-bindgen target (default: web)
|
|
8
12
|
set -euo pipefail
|
|
9
13
|
|
|
10
14
|
PROFILE="${1:-wasm-release}"
|
|
11
15
|
TARGET=wasm32-unknown-unknown
|
|
12
16
|
FEATURES=wasm
|
|
13
17
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
14
|
-
OUT="$ROOT/packages/wasm/pkg"
|
|
18
|
+
OUT="${RINDLE_WASM_OUT:-$ROOT/packages/wasm/pkg}"
|
|
19
|
+
BINDGEN_TARGET="${RINDLE_WASM_BINDGEN_TARGET:-web}"
|
|
15
20
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
16
21
|
|
|
17
22
|
cd "$ROOT"
|
|
@@ -29,7 +34,7 @@ case "$PROFILE" in
|
|
|
29
34
|
*) cargo rustc -p rindle --profile "$PROFILE" --target "$TARGET" --no-default-features --features "$FEATURES" --crate-type cdylib; WASM="$ROOT/target/$TARGET/$PROFILE/rindle.wasm" ;;
|
|
30
35
|
esac
|
|
31
36
|
|
|
32
|
-
wasm-bindgen --target
|
|
37
|
+
wasm-bindgen --target "$BINDGEN_TARGET" --out-dir "$OUT" --out-name rindle "$WASM"
|
|
33
38
|
|
|
34
39
|
if command -v wasm-opt >/dev/null 2>&1 && [ "$PROFILE" != "dev" ]; then
|
|
35
40
|
# Guard the binaryen version. Since Rust 1.82, wasm32 enables the `reference-types` feature by
|
|
@@ -50,4 +55,4 @@ if command -v wasm-opt >/dev/null 2>&1 && [ "$PROFILE" != "dev" ]; then
|
|
|
50
55
|
echo "wasm-opt -Oz applied"
|
|
51
56
|
fi
|
|
52
57
|
|
|
53
|
-
echo "built $OUT (target
|
|
58
|
+
echo "built $OUT (target=$BINDGEN_TARGET, profile=$PROFILE, $(wc -c < "$OUT/rindle_bg.wasm") bytes)"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindle/wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"@rindle/source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"default": "./dist/index.js"
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./pkg/*": "./pkg/*"
|
|
21
23
|
},
|
|
22
24
|
"files": [
|
|
23
25
|
"dist",
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
"README.md"
|
|
28
30
|
],
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@rindle/client": "0.
|
|
32
|
+
"@rindle/client": "0.2.0"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"@types/node": "^22.10.0",
|