Wire hyperscript activation into browser boot pipeline

- orchestration.sx: add hs-boot-subtree! call to process-elements
- integration.sx: remove load-library! calls (browser loads via manifest)
- sx_vm.ml: add __resolve-symbol hook to OP_GLOBAL_GET for lazy loading
- compile-modules.js: add HS modules as lazy_deps in manifest

HS compilation works in browser (tokenize→parse→compile verified).
Activation pipeline partially working — hs-activate! needs debugging
(dom-get-data/dom-set-data interaction with WASM host-get on functions).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 19:59:04 +00:00
parent 7492ceac4e
commit 7f273dc7c2
11 changed files with 115 additions and 91 deletions

View File

@@ -399,6 +399,12 @@ if (entryFile) {
]);
const eagerDeps = entryFile.deps.filter(d => !LAZY_ENTRY_DEPS.has(d));
const lazyDeps = entryFile.deps.filter(d => LAZY_ENTRY_DEPS.has(d));
// Hyperscript modules aren't define-library, so not auto-detected as deps.
// Load them lazily after boot — eager loading breaks the boot sequence.
const HS_LAZY = ['hs-tokenizer', 'hs-parser', 'hs-compiler', 'hs-runtime', 'hs-integration'];
for (const m of HS_LAZY) {
if (manifest[m] && !lazyDeps.includes(m)) lazyDeps.push(m);
}
manifest['_entry'] = {
file: entryFile.file,
deps: eagerDeps,

View File

@@ -514,7 +514,14 @@ and run vm =
| None ->
try Hashtbl.find vm.globals name with Not_found ->
try Sx_primitives.get_primitive name
with _ -> raise (Eval_error ("VM undefined: " ^ name))
with _ ->
(* Try resolve hook — loads the library that exports this symbol *)
(try
let resolve_fn = Hashtbl.find vm.globals "__resolve-symbol" in
ignore (Sx_runtime.sx_call resolve_fn [String name]);
try Hashtbl.find vm.globals name
with Not_found -> raise (Eval_error ("VM undefined: " ^ name))
with Not_found -> raise (Eval_error ("VM undefined: " ^ name)))
in
push vm v
| 21 (* OP_GLOBAL_SET *) ->