Removes the 5993-line bootstrapped Python evaluator (sx_ref.py) and all
code that depended on it exclusively. Both bootstrappers (JS + OCaml)
now use a new synchronous OCaml bridge (ocaml_sync.py) to run the
transpiler. JS build produces identical output; OCaml bootstrap produces
byte-identical sx_ref.ml.
Key changes:
- New shared/sx/ocaml_sync.py: sync subprocess bridge to sx_server.exe
- hosts/javascript/bootstrap.py: serialize defines → temp file → OCaml eval
- hosts/ocaml/bootstrap.py: same pattern for OCaml transpiler
- shared/sx/{html,async_eval,resolver,jinja_bridge,handlers,pages,deps,helpers}:
stub or remove sx_ref imports; runtime uses OCaml bridge (SX_USE_OCAML=1)
- sx/sxc/pages: parse defpage/defhandler from AST instead of Python eval
- hosts/ocaml/lib/sx_primitives.ml: append handles non-list 2nd arg per spec
- Deleted: sx_ref.py, async_eval_ref.py, 6 Python test runners, misc ref/ files
Test results: JS 1078/1078, OCaml 1114/1114.
sx_docs SSR has pre-existing rendering issues to investigate separately.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""SX docs defpage setup — registers layouts, page helpers, and loads .sx pages."""
|
|
from __future__ import annotations
|
|
|
|
|
|
def setup_sx_pages() -> None:
|
|
"""Register sx-specific layouts, page helpers, and load page definitions."""
|
|
from .layouts import _register_sx_layouts
|
|
from .helpers import _register_sx_helpers
|
|
_register_sx_layouts()
|
|
_register_sx_helpers()
|
|
_load_sx_page_files()
|
|
|
|
|
|
def _load_sx_page_files() -> None:
|
|
"""Load defpage definitions from sx/sxc/pages/*.sx."""
|
|
import os
|
|
from shared.sx.pages import load_page_dir, get_page_helpers
|
|
from shared.sx.jinja_bridge import load_sx_dir, watch_sx_dir, load_service_components
|
|
_sxc_dir = os.path.dirname(os.path.dirname(__file__)) # sx/sxc/
|
|
service_root = os.path.dirname(_sxc_dir) # sx/
|
|
load_service_components(service_root, service_name="sx")
|
|
load_sx_dir(_sxc_dir)
|
|
watch_sx_dir(_sxc_dir)
|
|
# Page helpers are accessed via the OCaml IO bridge (helper "name" args...)
|
|
# — no Python-side PRIMITIVES registration needed.
|
|
|
|
load_page_dir(os.path.dirname(__file__), "sx")
|