Expand description
Lazy generation cache for .wasm modules.
Two kinds of artefacts land here:
- Per-source compilations — e.g. a Rust snippet → WASM goes
into
runtimes/rust/<source-hash>.wasm. Idempotent: same source text never recompiles. - Drop-in interpreters — once Steel-WASM / QuickJS-wasi ship,
a user can place
runtimes/<lang>.wasmhere and the registry discovers it (M2 follow-up).
Path resolution:
- Linux/BSD →
$XDG_CACHE_HOME/outl/runtimes/or~/.cache/outl/runtimes/ - macOS →
~/Library/Caches/outl/runtimes/ - Windows →
%LOCALAPPDATA%\outl\runtimes\
Delegated to the dirs crate so we follow OS conventions instead
of hard-coding paths.
Functions§
- cache_
dir - Root cache directory:
<os cache>/outl/runtimes/. - cache_
path_ for_ source - Path where a compiled artefact for
(language, source)should land. The filename is<sha256-of-source>.wasm; collisions are vanishingly unlikely and the hash also doubles as a cache key for “is this source the same as last time?”. - is_
fresh - Does the file at
pathexist and is non-empty? Used by lazy-gen runtimes to decide “skip the compile, just read the bytes”.