Files
rose-ash/shared/static/wasm/sx/browser.sxbc
giles e0070041d6 Add .sxbc s-expression bytecode format
Bytecode modules are now serialized as s-expressions (.sxbc) in addition
to JSON (.sxbc.json). The .sxbc format is the canonical representation —
content-addressable, parseable by the SX parser, and suitable for CID
referencing. Annotation layers (source maps, variable names, tests, docs)
can reference the bytecode CID without polluting the bytecode itself.

Format: (sxbc version hash (code :arity N :bytecode (...) :constants (...)))

The browser loader tries .sxbc first (via load-sxbc kernel primitive),
falls back to .sxbc.json. Caddy needs .sxbc MIME type to serve the new
format (currently 404s, JSON fallback works).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 14:16:22 +00:00

318 lines
9.8 KiB
Plaintext

(sxbc 1 "b149b21c8bdcb90e"
(code
:bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 51 5 0 128 4 0 5 51 7 0 128 6 0 5 51 9 0 128 8 0 5 51 11 0 128 10 0 5 51 13 0 128 12 0 5 51 15 0 128 14 0 5 51 17 0 128 16 0 5 51 19 0 128 18 0 5 51 21 0 128 20 0 5 51 23 0 128 22 0 5 51 25 0 128 24 0 5 51 27 0 128 26 0 5 51 29 0 128 28 0 5 51 31 0 128 30 0 5 51 33 0 128 32 0 5 51 35 0 128 34 0 5 51 37 0 128 36 0 5 51 39 0 128 38 0 5 51 41 0 128 40 0 5 51 43 0 128 42 0 5 51 45 0 128 44 0 5 51 47 0 128 46 0 5 51 49 0 128 48 0 5 51 51 0 128 50 0 5 51 53 0 128 52 0 5 51 55 0 128 54 0 5 51 57 0 128 56 0 5 51 59 0 128 58 0 5 51 57 0 128 60 0 5 51 62 0 128 61 0 5 51 64 0 128 63 0 5 51 66 0 128 65 0 5 51 68 0 128 67 0 50)
:constants (
"browser-location-href"
(code
:bytecode (20 0 0 20 0 0 20 1 0 48 0 1 2 0 48 2 1 3 0 49 2 50)
:constants (
"host-get"
"dom-window"
"location"
"href"))
"browser-location-pathname"
(code
:bytecode (20 0 0 20 0 0 20 1 0 48 0 1 2 0 48 2 1 3 0 49 2 50)
:constants (
"host-get"
"dom-window"
"location"
"pathname"))
"browser-location-origin"
(code
:bytecode (20 0 0 20 0 0 20 1 0 48 0 1 2 0 48 2 1 3 0 49 2 50)
:constants (
"host-get"
"dom-window"
"location"
"origin"))
"browser-same-origin?"
(code :arity 1
:bytecode (16 0 20 1 0 48 0 52 0 0 2 50)
:constants (
"starts-with?"
"browser-location-origin"))
"url-pathname"
(code :arity 1
:bytecode (20 0 0 20 1 0 1 2 0 16 0 20 3 0 48 0 48 3 1 4 0 49 2 50)
:constants (
"host-get"
"host-new"
"URL"
"browser-location-origin"
"pathname"))
"browser-push-state"
(code :arity 3
:bytecode (16 1 52 0 0 1 33 30 0 20 1 0 20 2 0 20 3 0 48 0 1 4 0 48 2 1 5 0 2 1 6 0 16 0 49 5 32 27 0 20 1 0 20 2 0 20 3 0 48 0 1 4 0 48 2 1 5 0 16 0 16 1 16 2 49 5 50)
:constants (
"nil?"
"host-call"
"host-get"
"dom-window"
"history"
"pushState"
""))
"browser-replace-state"
(code :arity 3
:bytecode (16 1 52 0 0 1 33 30 0 20 1 0 20 2 0 20 3 0 48 0 1 4 0 48 2 1 5 0 2 1 6 0 16 0 49 5 32 27 0 20 1 0 20 2 0 20 3 0 48 0 1 4 0 48 2 1 5 0 16 0 16 1 16 2 49 5 50)
:constants (
"nil?"
"host-call"
"host-get"
"dom-window"
"history"
"replaceState"
""))
"browser-reload"
(code
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 48 2 1 4 0 49 2 50)
:constants (
"host-call"
"host-get"
"dom-window"
"location"
"reload"))
"browser-navigate"
(code :arity 1
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 48 2 1 4 0 16 0 49 3 50)
:constants (
"host-set!"
"host-get"
"dom-window"
"location"
"href"))
"local-storage-get"
(code :arity 1
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 48 2 1 4 0 16 0 49 3 50)
:constants (
"host-call"
"host-get"
"dom-window"
"localStorage"
"getItem"))
"local-storage-set"
(code :arity 2
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 48 2 1 4 0 16 0 16 1 49 4 50)
:constants (
"host-call"
"host-get"
"dom-window"
"localStorage"
"setItem"))
"local-storage-remove"
(code :arity 1
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 48 2 1 4 0 16 0 49 3 50)
:constants (
"host-call"
"host-get"
"dom-window"
"localStorage"
"removeItem"))
"set-timeout"
(code :arity 2
:bytecode (20 0 0 20 1 0 48 0 1 2 0 20 3 0 16 0 48 1 16 1 49 4 50)
:constants (
"host-call"
"dom-window"
"setTimeout"
"host-callback"))
"set-interval"
(code :arity 2
:bytecode (20 0 0 20 1 0 48 0 1 2 0 20 3 0 16 0 48 1 16 1 49 4 50)
:constants (
"host-call"
"dom-window"
"setInterval"
"host-callback"))
"clear-timeout"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-call"
"dom-window"
"clearTimeout"))
"clear-interval"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-call"
"dom-window"
"clearInterval"))
"request-animation-frame"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 20 3 0 16 0 48 1 49 3 50)
:constants (
"host-call"
"dom-window"
"requestAnimationFrame"
"host-callback"))
"fetch-request"
(code :arity 2
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 16 1 49 4 50)
:constants (
"host-call"
"dom-window"
"fetch"))
"new-abort-controller"
(code
:bytecode (20 0 0 1 1 0 49 1 50)
:constants (
"host-new"
"AbortController"))
"controller-signal"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"signal"))
"controller-abort"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-call"
"abort"))
"promise-then"
(code :arity 3
:bytecode (20 0 0 16 1 48 1 17 3 16 2 33 10 0 20 0 0 16 2 48 1 32 1 0 2 17 4 16 4 33 25 0 20 1 0 20 1 0 16 0 1 2 0 16 3 48 3 1 3 0 16 4 49 3 32 12 0 20 1 0 16 0 1 2 0 16 3 49 3 50)
:constants (
"host-callback"
"host-call"
"then"
"catch"))
"promise-resolve"
(code :arity 1
:bytecode (20 0 0 20 1 0 1 2 0 48 1 1 3 0 16 0 49 3 50)
:constants (
"host-call"
"host-global"
"Promise"
"resolve"))
"promise-delayed"
(code :arity 2
:bytecode (20 0 0 1 1 0 20 2 0 51 3 0 1 1 1 0 48 1 49 2 50)
:constants (
"host-new"
"Promise"
"host-callback"
(code :arity 1 :upvalue-count 2
:bytecode (20 0 0 51 1 0 1 0 0 0 18 1 49 2 50)
:constants (
"set-timeout"
(code :upvalue-count 2
:bytecode (20 0 0 18 0 1 1 0 2 18 1 49 4 50)
:constants (
"host-call"
"call"))))))
"browser-confirm"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-call"
"dom-window"
"confirm"))
"browser-prompt"
(code :arity 2
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 16 1 49 4 50)
:constants (
"host-call"
"dom-window"
"prompt"))
"browser-media-matches?"
(code :arity 1
:bytecode (20 0 0 20 1 0 20 2 0 48 0 1 3 0 16 0 48 3 1 4 0 49 2 50)
:constants (
"host-get"
"host-call"
"dom-window"
"matchMedia"
"matches"))
"json-parse"
(code :arity 1
:bytecode (20 0 0 20 1 0 1 2 0 48 1 1 3 0 16 0 49 3 50)
:constants (
"host-call"
"host-global"
"JSON"
"parse"))
"log-info"
(code :arity 1
:bytecode (20 0 0 20 1 0 1 2 0 48 1 1 3 0 1 5 0 16 0 52 4 0 2 49 3 50)
:constants (
"host-call"
"host-global"
"console"
"log"
"str"
"[sx] "))
"log-warn"
(code :arity 1
:bytecode (20 0 0 20 1 0 1 2 0 48 1 1 3 0 1 5 0 16 0 52 4 0 2 49 3 50)
:constants (
"host-call"
"host-global"
"console"
"warn"
"str"
"[sx] "))
"console-log"
"now-ms"
(code
:bytecode (20 0 0 20 1 0 1 2 0 48 1 1 3 0 49 2 50)
:constants (
"host-call"
"host-global"
"Date"
"now"))
"schedule-idle"
(code :arity 1
:bytecode (20 0 0 51 1 0 1 0 48 1 17 1 20 2 0 20 3 0 48 0 1 4 0 48 2 33 18 0 20 5 0 20 3 0 48 0 1 4 0 16 1 49 3 32 10 0 20 6 0 16 1 1 7 0 49 2 50)
:constants (
"host-callback"
(code :arity 1 :upvalue-count 1
:bytecode (18 0 49 0 50)
:constants ())
"host-get"
"dom-window"
"requestIdleCallback"
"host-call"
"set-timeout"
0))
"set-cookie"
(code :arity 3
:bytecode (16 2 6 34 4 0 5 1 0 0 17 3 20 1 0 20 2 0 1 3 0 20 1 0 20 5 0 1 3 0 48 1 1 6 0 48 2 16 3 1 8 0 52 7 0 2 52 4 0 2 48 2 1 9 0 48 2 17 4 20 10 0 20 11 0 48 0 1 12 0 16 0 1 14 0 20 1 0 2 1 15 0 16 1 48 3 1 16 0 16 4 1 17 0 52 13 0 6 49 3 50)
:constants (
365
"host-call"
"host-new"
"Date"
"+"
"host-global"
"now"
"*"
86400000
"toUTCString"
"host-set!"
"dom-document"
"cookie"
"str"
"="
"encodeURIComponent"
";expires="
";path=/;SameSite=Lax"))
"get-cookie"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 48 2 17 1 20 3 0 16 1 1 4 0 20 5 0 1 6 0 1 8 0 16 0 1 9 0 52 7 0 3 48 2 48 3 17 2 16 2 33 22 0 20 3 0 2 1 10 0 20 0 0 16 2 1 11 0 48 2 49 3 32 1 0 2 50)
:constants (
"host-get"
"dom-document"
"cookie"
"host-call"
"match"
"host-new"
"RegExp"
"str"
"(?:^|;\\s*)"
"=([^;]*)"
"decodeURIComponent"
1)))))