#!/bin/bash # Javy Wasmer Test Script # Tests the Javy static WASM module using Wasmer runtime set -e echo "๐Ÿงช Testing Javy implementation with Wasmer" echo "==========================================" # Test data TEST_INPUT='{"users":[{"name":"Alice","age":30},{"name":"Bob","age":25}]}' WASM_FILE="transform.wasm" echo "๐Ÿ“‹ Test Input: $TEST_INPUT" echo "๐Ÿ“ WASM File: $WASM_FILE" # Check if WASM file exists if [ ! -f "$WASM_FILE" ]; then echo "โŒ WASM file not found: $WASM_FILE" echo " Run: javy build -o transform.wasm transform.js" exit 1 fi echo "๐Ÿ“Š File Size: $(du -h "$WASM_FILE" | cut -f1) ($(du -h "$WASM_FILE" | cut -f1 | numfmt --from=iec --to=si)B)" echo "๐Ÿ“ฆ Gzipped: $(gzip -c "$WASM_FILE" | wc -c | numfmt --to=iec)B" # Source Wasmer environment if available if [ -f "/home/trist/.wasmer/wasmer.sh" ]; then source /home/trist/.wasmer/wasmer.sh fi # Check if Wasmer is installed if ! command -v wasmer >/dev/null 2>&1; then echo "โŒ Wasmer not installed" echo " Install with: curl https://get.wasmer.io -sSfL | sh" echo " Then run: source ~/.bashrc or source /home/trist/.wasmer/wasmer.sh" exit 1 fi echo "๐Ÿš€ Wasmer version: $(wasmer --version)" echo "" # Test with Wasmer echo "๐Ÿ”ง Testing Javy static build with Wasmer..." echo " Command: echo '$TEST_INPUT' | wasmer run $WASM_FILE" echo "" if echo "$TEST_INPUT" | wasmer run "$WASM_FILE"; then echo "" echo "โœ… Javy Static + Wasmer: SUCCESS!" echo "" echo "๐ŸŽฏ Integration Notes:" echo " โ€ข Javy static build works perfectly with Wasmer" echo " โ€ข Self-contained JavaScript engine (519KB gzipped)" echo " โ€ข No dynamic linking required" echo " โ€ข Excellent for Wasmer SDK integration" echo " โ€ข Larger than dynamic build but simpler deployment" else echo "" echo "โŒ Javy Static + Wasmer: FAILED" echo "" echo "๐Ÿ” Troubleshooting:" echo " โ€ข Ensure WASM file is built with: javy build -o transform.wasm transform.js" echo " โ€ข Check Wasmer installation: wasmer --version" echo " โ€ข Try with verbose output: wasmer run $WASM_FILE --verbose" fi