lower maximum memory

This commit is contained in:
Toshit Chawda 2024-07-25 10:48:42 -07:00
parent 87b39f45dc
commit 4c9f689c3b
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
4 changed files with 13 additions and 11 deletions

2
Cargo.lock generated
View file

@ -516,7 +516,7 @@ dependencies = [
[[package]]
name = "epoxy-client"
version = "2.0.8"
version = "2.0.9"
dependencies = [
"async-compression",
"async-trait",

View file

@ -1,6 +1,6 @@
[package]
name = "epoxy-client"
version = "2.0.8"
version = "2.0.9"
edition = "2021"
[lib]
@ -34,18 +34,15 @@ web-sys = { version = "0.3.69", features = ["BinaryType", "Headers", "MessageEve
wisp-mux = { path = "../wisp", features = ["wasm"] }
[dependencies.ring]
# update whenever rustls updates
version = "0.17.8"
version = "*"
features = ["wasm32_unknown_unknown_js"]
[dependencies.rustls-pki-types]
# update whenever rustls updates
version = "1.4.1"
version = "*"
features = ["web"]
[dependencies.parking_lot_core]
# update based on Cargo.lock
version = "0.9.10"
version = "*"
features = ["nightly"]
[features]

View file

@ -12,12 +12,17 @@ wasm-bindgen --weak-refs --target no-modules --no-modules-global epoxy --out-dir
echo "[epx] wasm-bindgen finished"
mv out/epoxy_client_bg.wasm out/epoxy_client_unoptimized.wasm
time wasm-opt -Oz --vacuum --dce --enable-threads --enable-bulk-memory --enable-simd out/epoxy_client_unoptimized.wasm -o out/epoxy_client_bg.wasm
time wasm-opt -Oz --vacuum --dce --enable-threads --enable-bulk-memory out/epoxy_client_unoptimized.wasm -o out/epoxy_client_bg.wasm
echo "[epx] wasm-opt finished"
AUTOGENERATED_SOURCE=$(<"out/epoxy_client.js")
# patch for websocket sharedarraybuffer error
AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2)/getObject(arg0).send(new Uint8Array(getArrayU8FromWasm0(arg1, arg2)).buffer}
# patch for safari OOM errors on safari iOS 16/older devices
# also lowers maximum memory from default of 1GB to 512M on non-iOS and to 256M on iOS
AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//maximum:16384,shared:true/maximum:/iPad|iPhone|iPod/.test(navigator.userAgent)?4096:8192,shared:true}
# patch to set proper wasm path
AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//'_bg.wasm'/'.wasm'}
echo "$AUTOGENERATED_SOURCE" > pkg/epoxy.js
cp pkg/epoxy.js pkg/epoxy-module.js

View file

@ -1,7 +1,7 @@
{
"name": "@mercuryworkshop/epoxy-tls",
"version": "2.0.8-1",
"description": "A wasm library for using raw encrypted tls/ssl/https/websocket streams on the browser",
"version": "2.0.9-1",
"description": "A wasm library for using raw encrypted tls/ssl/tcp/udp/https/websocket streams on the browser",
"scripts": {
"build": "./build.sh"
},