JavaScript adapter

Crate: parallax-adapter-js
Worker: adapters/js/worker.js

Host discovery

Order:

  1. node
  2. nodejs
  3. %ProgramFiles%\nodejs\node.exe

Execution model

  • Subprocess: node worker.js
  • Guest code runs in vm.Script / vm.createContext
  • Capture works for top-level let / const / var by appending a final expression that reads names from script scope
  • console.log / error / warn are redirected into captured stdout/stderr buffers

Supported value subset (encode)

JavaScriptPIR
null / undefinednull
booleanbool
safe integer numberint
other numberfloat
bigintbigint
stringstring
Buffer / Uint8Arraybytes
Arraylist
Setset
plain object / Mapmap
functionfunction
otherunsupported

Restore

  • PIR int within the safe integer range → number
  • Larger ints / bigint → JS BigInt
  • map with string keys → plain object
  • list / tuple / setArray (set semantics not reified as Set today)

Limitations

  • No DOM / browser engine — Node.js only in 0.1
  • No async migration
  • Module import / ESM loader hooks are not provided inside the vm context