mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-14 19:16:02 -04:00
!debug
This commit is contained in:
@@ -21,21 +21,30 @@ RUSTFLAGS='-C opt-level=z' WASM_BINDGEN_WEAKREF=1 wasm-pack build --release --ta
|
||||
# Convert the Wasm into a JS file that exports the base64'ed Wasm.
|
||||
echo "module.exports = '$(base64 pkg/matrix_sdk_crypto_js_bg.wasm)';" > pkg/matrix_sdk_crypto_js_bg.wasm.js
|
||||
|
||||
echo 'HEAD:';
|
||||
head -c 30 pkg/matrix_sdk_crypto_js_bg.wasm.js
|
||||
|
||||
echo -e '\n\nTAIL:';
|
||||
tail -c 20 pkg/matrix_sdk_crypto_js_bg.wasm.js
|
||||
|
||||
# Copy in the unbase64 module
|
||||
cp scripts/unbase64.js pkg/
|
||||
|
||||
if test "$(uname)" = "Darwin"; then
|
||||
SEDI="-i ''"
|
||||
else
|
||||
SEDI="-i"
|
||||
fi
|
||||
|
||||
# In the JavaScript:
|
||||
# 1. Replace the lines that load the Wasm,
|
||||
# 2. Remove the imports of `TextDecoder` and `TextEncoder`. We rely on the global defaults.
|
||||
loadwasm='const bytes = require("./unbase64.js")(require("./matrix_sdk_crypto_js_bg.wasm.js"));'
|
||||
sed "${SEDI}" \
|
||||
-e "/^const path = /d" \
|
||||
-e "s@^const bytes =.*@${loadwasm}@" \
|
||||
-e '/Text..coder.*= require(.util.)/d' \
|
||||
pkg/matrix_sdk_crypto_js.js
|
||||
|
||||
if test "$(uname)" = "Darwin"; then
|
||||
sed -i '' \
|
||||
-e "/^const path = /d" \
|
||||
-e "s@^const bytes =.*@${loadwasm}@" \
|
||||
-e '/Text..coder.*= require(.util.)/d' \
|
||||
pkg/matrix_sdk_crypto_js.js
|
||||
else
|
||||
sed -i \
|
||||
-e "/^const path = /d" \
|
||||
-e "s@^const bytes =.*@${loadwasm}@" \
|
||||
-e '/Text..coder.*= require(.util.)/d' \
|
||||
pkg/matrix_sdk_crypto_js.js
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user