Files
rose-ash/hosts/ocaml/browser/test_page_render.js
giles fac97883f9 Spec explorer data endpoint, spec file finder, browser render test (failing)
- Add spec-explorer-data-by-slug helper with _SPEC_SLUG_MAP
- _find_spec_file searches spec/, web/, shared/sx/ref/ directories
- defpage specs-explore-page uses :data for server-side data fetch
- test_evaluator_renders_in_browser: failing test for client-side rendering
  (client re-evaluates defpage content, find-spec unavailable — pre-existing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 17:36:21 +00:00

19 lines
786 B
JavaScript

const path = require("path");
const fs = require("fs");
require(path.join(__dirname, "../_build/default/browser/sx_browser.bc.js"));
require(path.join(__dirname, "sx-platform.js"));
const K = globalThis.SxKernel;
for (const n of ["signals","deps","page-helpers","router","adapter-html"])
K.loadSource(fs.readFileSync(path.join(__dirname,`../../../web/${n}.sx`),"utf8"));
K.loadSource(fs.readFileSync("/tmp/comp_defs.txt","utf8"));
const pageSx = fs.readFileSync("/tmp/page_sx.txt","utf8");
const parsed = K.parse(pageSx);
const html = K.renderToHtml(parsed[0]);
if (typeof html === "string" && !html.startsWith("Error:")) {
console.log("SUCCESS! Rendered", html.length, "chars of HTML");
console.log("Preview:", html.substring(0, 200));
} else {
console.log("Error:", html);
}