Phase 1 Step 1 of the architecture roadmap. The old cssx.sx (cssx-resolve, cssx-process-token, cssx-template, old tw function) is superseded by the ~tw component system in tw.sx. - Delete shared/sx/templates/cssx.sx - Remove cssx.sx from all load lists (sx_server.ml, run_tests.ml, mcp_tree.ml, compile-modules.js, bundle.sh, sx-build-all.sh) - Replace (tw "tokens") inline style calls with (~tw :tokens "tokens") in layouts.sx and not-found.sx - Remove _css-hash / init-css-tracking / SX-Css header plumbing (dead code — ~tw/flush + flush-collected-styles handle CSS now) - Remove sx-css-classes param and meta tag from shell template - Update stale data-cssx references to data-sx-css in tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88 lines
2.7 KiB
Bash
Executable File
88 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Bundle the WASM SX kernel + platform + .sx files for serving.
|
|
#
|
|
# Output goes to hosts/ocaml/browser/dist/
|
|
# Serve dist/ at /wasm/ or similar path.
|
|
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
|
|
BUILD=../_build/default/browser
|
|
DIST=dist
|
|
ROOT=../../..
|
|
|
|
echo "=== Bundling SX WASM browser engine ==="
|
|
|
|
rm -rf "$DIST"
|
|
mkdir -p "$DIST/sx"
|
|
|
|
# 1. WASM kernel
|
|
cp "$BUILD/sx_browser.bc.wasm.js" "$DIST/"
|
|
cp -r "$BUILD/sx_browser.bc.wasm.assets" "$DIST/"
|
|
|
|
# Also copy js_of_ocaml version as fallback
|
|
cp "$BUILD/sx_browser.bc.js" "$DIST/"
|
|
|
|
# 2. Platform JS
|
|
cp sx-platform.js "$DIST/"
|
|
|
|
# 3. Spec modules
|
|
cp "$ROOT/spec/signals.sx" "$DIST/sx/core-signals.sx"
|
|
cp "$ROOT/spec/render.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/web-signals.sx" "$DIST/sx/signals.sx"
|
|
cp "$ROOT/web/deps.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/router.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/page-helpers.sx" "$DIST/sx/"
|
|
|
|
# 3b. Freeze scope (signal persistence) + highlight (syntax coloring)
|
|
cp "$ROOT/lib/freeze.sx" "$DIST/sx/"
|
|
cp "$ROOT/lib/highlight.sx" "$DIST/sx/"
|
|
|
|
# 4. Bytecode compiler + VM
|
|
cp "$ROOT/lib/bytecode.sx" "$DIST/sx/"
|
|
cp "$ROOT/lib/compiler.sx" "$DIST/sx/"
|
|
cp "$ROOT/lib/vm.sx" "$DIST/sx/"
|
|
|
|
# 5. Web libraries (8 FFI primitives)
|
|
cp "$ROOT/web/lib/dom.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/lib/browser.sx" "$DIST/sx/"
|
|
|
|
# 6. Web adapters
|
|
cp "$ROOT/web/adapter-html.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/adapter-sx.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/adapter-dom.sx" "$DIST/sx/"
|
|
|
|
# 7. Boot helpers (platform functions in pure SX)
|
|
cp "$ROOT/web/lib/boot-helpers.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/lib/hypersx.sx" "$DIST/sx/"
|
|
|
|
# 7b. Test harness (for inline test runners)
|
|
cp "$ROOT/spec/harness.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/harness-reactive.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/harness-web.sx" "$DIST/sx/"
|
|
|
|
# 8. Web framework
|
|
cp "$ROOT/web/engine.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/orchestration.sx" "$DIST/sx/"
|
|
cp "$ROOT/web/boot.sx" "$DIST/sx/"
|
|
|
|
# 9. Styling (tw token engine)
|
|
cp "$ROOT/shared/sx/templates/tw-layout.sx" "$DIST/sx/"
|
|
cp "$ROOT/shared/sx/templates/tw-type.sx" "$DIST/sx/"
|
|
cp "$ROOT/shared/sx/templates/tw.sx" "$DIST/sx/"
|
|
|
|
# Summary
|
|
WASM_SIZE=$(du -sh "$DIST/sx_browser.bc.wasm.assets" | cut -f1)
|
|
JS_SIZE=$(du -sh "$DIST/sx_browser.bc.js" | cut -f1)
|
|
SX_SIZE=$(du -sh "$DIST/sx" | cut -f1)
|
|
echo " WASM kernel: $WASM_SIZE (assets)"
|
|
echo " JS fallback: $JS_SIZE"
|
|
echo " SX sources: $SX_SIZE ($(ls "$DIST/sx/" | wc -l) files)"
|
|
echo " Platform JS: $(du -sh "$DIST/sx-platform.js" | cut -f1)"
|
|
echo ""
|
|
echo " dist/ ready to serve"
|
|
echo ""
|
|
echo " HTML usage:"
|
|
echo ' <script src="/wasm/sx_browser.bc.wasm.js"></script>'
|
|
echo ' <script src="/wasm/sx-platform.js"></script>'
|