Skip to content

0.12.16

Latest

Choose a tag to compare

@k7d k7d released this 24 Nov 08:40
· 86 commits to main since this release

Added

  • :self-host true compiles the ClojureScript compiler into the build (cljf.selfhost, with cljs.core's macros compiled as ClojureScript). cljf.selfhost/eval-str compiles and evaluates forms in the page, without the watcher's JVM, reading the build's analysis caches as forms need them; in a watched build, cljs_selfhost_eval does it from the console. #x literals work too (cljf.jsx's macros, now .cljc, compiled as ClojureScript), and forms can require npm modules the page provides (cljf.selfhost/provide-module!).

  • cljf.webmcp/register! registers the self-hosted compiler's tools (cljs_eval, cljs_doc, cljs_apropos, cljs_ns_info, cljs_macroexpand, cljs_namespaces) with WebMCP, for agents in the browser, and a page's own tools; cljf.selfhost has the lookups (doc, apropos, ns-info, macroexpand-str, namespaces).

  • The generated :test-runner's run-tests takes an optional function of the cljs.test block it runs, letting runners add steps between tests.

  • The Vite plugin's dev server pages show its status in their bottom left corner, like shadow-cljs' HUD: the modules a page is loading, a compile in progress, a hot reload's modules applied, and the dev server or its compiler gone. hud: false turns it off.

Fixed

  • cljf.esm.karma/start yields the event loop between tests once a second. cljs.test only yields when an async test waits, so a long run of synchronous tests kept the browser from answering Karma's socket ping, and Karma dropped it (Disconnected reconnect failed before timeout ... (ping timeout)).
  • A page could load a second instance of namespaces it already ran, i.e. when a hot reloaded namespace gained a require, whose top level ran again without the first instance's values: defmultis came back empty and record types were redefined until the page was reloaded. Vite gave the importers of a hot updated namespace the update's timestamp, which later imports of them used, though the page keeps running their instances. The Vite plugin now hot updates compiled namespaces in pages itself, stamping only the updated namespace.
  • The dependents the watch recompiled after a namespace's API changed often weren't hot reloaded: their output keeps its unchanged source's modification time, so Vite's file watcher didn't report the rewrite, and pages kept running code compiled against the old API (i.e. a direct call of an arity that no longer exists). The Vite plugin now hot updates the namespaces a compile wrote from its compiled event, together in one update. Those a compile wrote before failing (its error event reports them) are held back until a compile succeeds.

Full Changelog: v0.12.15...v0.12.16