mirror of
https://github.com/hanzoai/quickjs-emscripten.git
synced 2026-10-30 19:37:29 +00:00
* working wrangler demo * improve worker example code quality * add helpers for cloudflare support * document cloudflare, deno, esmodule * deno smoketest file * doc cleanup * expand loader docs * test minimal example in CI * rebuild docs * document minimal size
26 lines
828 B
Bash
Executable File
26 lines
828 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# quickjs-emscripten exposes an export for the .wasm file, but Cloudflare refuses to accept it.
|
|
# Cloudflare's build system only allows importing .wasm files using a relative path.
|
|
# Github issue: https://github.com/cloudflare/workers-sdk/issues/1672
|
|
#
|
|
# Instead the easy way out is to just copy the .wasm files we need into the build directory.
|
|
# Once there, we can import them and use them to make a new quickjs variant.
|
|
#
|
|
|
|
set -eo pipefail
|
|
|
|
VARIANTS=(
|
|
DEBUG_SYNC
|
|
RELEASE_SYNC
|
|
)
|
|
|
|
for VARIANT in "${VARIANTS[@]}"; do
|
|
kebab="$(echo "$VARIANT" | tr '[:upper:]' '[:lower:]' | tr '_' '-')"
|
|
WASM_FILE="$(node -p 'require.resolve("@jitl/quickjs-wasmfile-'$kebab'/wasm")')"
|
|
cp -v "$WASM_FILE" src/$VARIANT.wasm
|
|
if [[ -f "$WASM_FILE.map" ]]; then
|
|
cp -v "$WASM_FILE.map" src/$VARIANT.wasm.map.txt
|
|
fi
|
|
done
|