Step 17b: bytecode-compiled text-layout, WASM library import fix

- text-layout.sx added to WASM bytecode pipeline (9K compiled)
- Fix multi-list map calls (map-indexed + nth instead of map fn list1 list2)
- pretext-layout-lines and pretext-position-line moved to library exports
- Browser load-sxbc: handle VmSuspended for import, copy library exports
  to global_env after module load (define-library export fix)
- compile-modules.js: text-layout in SOURCE_MAP, FILES, and entry deps
- Island uses library functions (break-lines, pretext-layout-lines)
  instead of inlining — runs on bytecode VM when exports resolve

Known issue: define-library exports don't propagate to browser global env
yet. The load-sxbc import suspension handler resumes correctly but
bind_import_set doesn't fire. Needs deeper investigation into how the
WASM kernel's define-library registers exports vs how other libraries
(adapter-html, tw) make their exports available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 16:37:04 +00:00
parent 676ec6dd2b
commit 699dd5ad69
17 changed files with 2270 additions and 1662 deletions

View File

@@ -618,6 +618,29 @@
"tw-process-token"
]
},
"sx text-layout": {
"file": "text-layout.sxbc",
"deps": [],
"exports": [
"measure-text",
"line-badness",
"compute-demerits",
"sum-widths",
"find-breaks",
"break-lines",
"break-lines-greedy",
"position-line",
"position-lines",
"pretext-position-line",
"pretext-layout-lines",
"layout-paragraph",
"make-hyphenation-trie",
"find-hyphenation-points",
"hyphenate-word",
"typeset",
"typeset-plain"
]
},
"web boot-helpers": {
"file": "boot-helpers.sxbc",
"deps": [
@@ -1039,7 +1062,8 @@
"web router",
"web page-helpers",
"web orchestration",
"sx render"
"sx render",
"sx text-layout"
],
"lazy_deps": [
"sx bytecode",