Fix: load HS modules as bytecode, not source — restores IO suspension chain
Reverts the source-loading workaround. Bytecode modules go through the VM which handles IO suspension (perform/wait/fetch) correctly. The endModuleLoad sync copies VM globals to CEK env, so eval-expr-cek in hs-handler can find hs-on/hs-toggle-class!/etc. All three HS examples fully working on live site: Toggle Color — toggle classes on click Bounce — add class, wait 1s (IO suspend+resume), remove class Count Clicks — increment counter, update innerHTML Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -506,19 +506,9 @@
|
|||||||
// will see it as already loaded and skip rather than infinite-looping.
|
// will see it as already loaded and skip rather than infinite-looping.
|
||||||
_loadedLibs[name] = true;
|
_loadedLibs[name] = true;
|
||||||
|
|
||||||
// Load this module.
|
// Load this module (bytecode first, fallback to source)
|
||||||
// Non-library modules (no space in name, e.g. "hs-runtime") use source
|
var ok = loadBytecodeFile("sx/" + info.file);
|
||||||
// loading so their defines go into the CEK global env — needed when
|
if (!ok) {
|
||||||
// eval-expr-cek evaluates compiled hyperscript at runtime.
|
|
||||||
var isLibrary = name.indexOf(' ') >= 0 || name === '_entry';
|
|
||||||
var ok;
|
|
||||||
if (isLibrary) {
|
|
||||||
ok = loadBytecodeFile("sx/" + info.file);
|
|
||||||
if (!ok) {
|
|
||||||
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
|
||||||
ok = loadSxFile("sx/" + sxFile);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
||||||
ok = loadSxFile("sx/" + sxFile);
|
ok = loadSxFile("sx/" + sxFile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -506,19 +506,9 @@
|
|||||||
// will see it as already loaded and skip rather than infinite-looping.
|
// will see it as already loaded and skip rather than infinite-looping.
|
||||||
_loadedLibs[name] = true;
|
_loadedLibs[name] = true;
|
||||||
|
|
||||||
// Load this module.
|
// Load this module (bytecode first, fallback to source)
|
||||||
// Non-library modules (no space in name, e.g. "hs-runtime") use source
|
var ok = loadBytecodeFile("sx/" + info.file);
|
||||||
// loading so their defines go into the CEK global env — needed when
|
if (!ok) {
|
||||||
// eval-expr-cek evaluates compiled hyperscript at runtime.
|
|
||||||
var isLibrary = name.indexOf(' ') >= 0 || name === '_entry';
|
|
||||||
var ok;
|
|
||||||
if (isLibrary) {
|
|
||||||
ok = loadBytecodeFile("sx/" + info.file);
|
|
||||||
if (!ok) {
|
|
||||||
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
|
||||||
ok = loadSxFile("sx/" + sxFile);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
var sxFile = info.file.replace(/\.sxbc$/, '.sx');
|
||||||
ok = loadSxFile("sx/" + sxFile);
|
ok = loadSxFile("sx/" + sxFile);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user