eglue js by way of rust wasm bindgen (alpha)
-
cargo update -
rustup update -
Rust extension (ignore analyzer warning 7/11/2022)
-
open a new Visual Studio (VS) code
This can (potentially) deploy to cloudflare service workers, PHP to (C++ to Rust)Build to build/worker/shim.mjs format="module"
PATH="$PATH:$HOME/.cargo/bin" because source is not recognized, better actions(github) have it new terminal effect
github/workflows/main.yml:
...
- name: Publish
uses: cloudflare/wrangler-action@1.3.0
with:
email: "nmcarducci@gmail.com"
apiKey: ${{ secrets.CF_API_KEY }}
# apiToken: ${{ secrets.CF_API_TOKEN }}
preCommands: curl https://sh.rustup.rs -sSf | sh -s -- -y && PATH="$PATH:$HOME/.cargo/bin" && cargo install --git https://github.com/cloudflare/workers-rs --branch zeb/esbuild
postCommands: PATH="$PATH:$HOME/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.78/bin"
environment: "production"
env:
USER: root
wrangler.toml
[build.upload]
format = "modules" # "service-workers"
dir = "build/worker" # dist for libraries...
main = "./shim.mjs"
[build]
command = "worker-build --release"
testing...
curl https://sh.rustup.rs -sSf | sh -s -- -y && PATH="$PATH:$HOME/.cargo/bin" && cargo install --git https://github.com/cloudflare/workers-rs && cargo install --git https://github.com/cloudflare/workers-rs --branch zeb/esbuild && PATH="$PATH:$HOME/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.81/bin" && curl -L 'https://github.com/WebAssembly/binaryen/releases/download/version_90/binaryen-version_90-x86-linux.tar.gz' | tar -xz && worker-build --release
? catches unwind, durable object will send a log before throwing an exception on internal service error..
console_log throws complacency but you always for now want "{}" first self arg-param,
activate wasm-bindgen
[dependencies.web-sys]
features = ["Response", "Request", "Url", "Window", "Document", "Body ]