- 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>
26 lines
961 B
JavaScript
26 lines
961 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"));
|
|
|
|
// Test signal basics
|
|
const tests = [
|
|
'(signal 42)',
|
|
'(let ((s (signal 42))) (deref s))',
|
|
'(let ((s (signal 42))) (reset! s 100) (deref s))',
|
|
'(let ((s (signal 10))) (swap! s (fn (v) (* v 2))) (deref s))',
|
|
'(let ((s (signal 0))) (computed (fn () (+ (deref s) 1))))',
|
|
'(let ((idx (signal 0))) (let ((c (computed (fn () (+ (deref idx) 10))))) (deref c)))',
|
|
];
|
|
|
|
for (const t of tests) {
|
|
const r = K.eval(t);
|
|
const s = JSON.stringify(r);
|
|
console.log(`${t.substring(0,60)}`);
|
|
console.log(` => ${s && s.length > 100 ? s.substring(0,100) + '...' : s}`);
|
|
console.log();
|
|
}
|