Website for CuffScript: a landing page, a browser IDE (editor, multi-file projects, stdin, an AST/token viewer), and a full language guide — built with Vite + TypeScript + CodeMirror 6.
This repository is the website only. The compiled engine itself
(cuffscript.mjs / cuffscript.wasm) is published separately as the
cuffscript-wasm npm package
from the main cuffscript repository and consumed here as an ordinary
dependency.
Three entry points, each its own folder so they build to clean URLs:
/—index.html/src/home.ts— landing page./ide/—ide/index.html/src/ide.ts— the IDE./guide/—guide/index.html/src/guide.ts— the language guide.
src/ui/header.ts renders the shared header (logo, nav, theme toggle) on all
three so there's one place to change it.
src/engine/—engine.ts(main-thread wrapper),worker.ts(the code that actually loads the wasm module and calls it), andstdinChannel.ts(the SharedArrayBuffer/Atomics protocol behind real-timeinput()). This is the "glue" layer between the wasm package and the UI.src/editor/— CodeMirror language definition, theme, and the static code highlighter used on the guide and landing pages.src/ide/— editor/tab/console state management.src/examples/— curated example projects, loaded from real.cufffiles via Vite's?rawimports.src/styles/—base.css(variables, shared header/buttons, the landing and guide pages) andide.css(the IDE workspace only) —ide.tsimports both,home.ts/guide.tsimport justbase.css.
npm install
npm run devcuffscript-wasm is published to npm, so a normal install picks it up. To
test against a local engine build instead (e.g. while iterating on the engine
itself), point the dependency at a local path in this repo's package.json:
"cuffscript-wasm": "file:../cuffscript/npm"(after running make wasm in the cuffscript repo so npm/dist/ is
populated), or use npm link.
The IDE answers input() inline in the console as the program runs, instead
of asking for stdin up front. This needs the page to be cross-origin
isolated
(for SharedArrayBuffer + Atomics.wait, see src/engine/stdinChannel.ts) —
vite.config.ts sets the required headers for dev/preview, and
public/_headers does the same for Cloudflare Pages in production. If a
deploy target doesn't honor public/_headers, add the equivalent
Cross-Origin-Opener-Policy: same-origin /
Cross-Origin-Embedder-Policy: require-corp headers there yourself. Without
them, the IDE falls back to the old "type stdin ahead of time" panel
automatically — no code changes needed either way.
npm run buildOutputs a static site in dist/ (index.html, ide/index.html,
guide/index.html) that can be hosted anywhere that serves static files with
correct MIME types for .wasm. Most static hosts (Netlify, Vercel, Cloudflare
Pages, GitHub Pages) resolve /ide and /guide to their folder's
index.html automatically; if yours doesn't, add a rewrite for
/ide -> /ide/ and /guide -> /guide/.
Apache-2.0 — see LICENSE.