Spec URL evaluation in router.sx, bootstrap to Python/JS

Add url-to-expr, auto-quote-unknowns, prepare-url-expr to router.sx —
the canonical URL-to-expression pipeline. Dots→spaces, parse, then
auto-quote unknown symbols as strings (slugs). The same spec serves
both server (Python) and client (JS) route handling.

- router.sx: three new pure functions for URL evaluation
- bootstrap_py.py: auto-include router module with html adapter
- platform_js.py: export urlToExpr/autoQuoteUnknowns/prepareUrlExpr
- sx_router.py: replace hand-written auto_quote_slugs with bootstrapped
  prepare_url_expr — delete ~50 lines of hardcoded function name sets
- Rebootstrap sx_ref.py (4331 lines) and sx-browser.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 23:05:01 +00:00
parent 355f57a60b
commit 5f06e2e2cc
6 changed files with 546 additions and 150 deletions

View File

@@ -1254,7 +1254,8 @@ def compile_ref_to_py(
if sm not in SPEC_MODULES:
raise ValueError(f"Unknown spec module: {sm!r}. Valid: {', '.join(SPEC_MODULES)}")
spec_mod_set.add(sm)
# html adapter needs deps (component analysis) and signals (island rendering)
# html adapter needs deps (component analysis), signals (island rendering),
# router (URL-to-expression evaluation), and page-helpers
if "html" in adapter_set:
if "deps" in SPEC_MODULES:
spec_mod_set.add("deps")
@@ -1262,6 +1263,8 @@ def compile_ref_to_py(
spec_mod_set.add("signals")
if "page-helpers" in SPEC_MODULES:
spec_mod_set.add("page-helpers")
if "router" in SPEC_MODULES:
spec_mod_set.add("router")
has_deps = "deps" in spec_mod_set
# Core files always included, then selected adapters, then spec modules