Scripts
Yeet scripts run inside a V8 isolate with a curated set of globals. The runtime is intentionally minimal — it is not Node.js, not Deno, and not a browser.
Running a script
yeet run script.js # run once, exit when done
yeet run -w script.js # watch mode — re-runs automatically when the file changes
Press Ctrl+C to cancel a running script at any time.
Module system
Scripts are evaluated as ES modules. import / export syntax works. require() / CommonJS is not supported.
import myQuery from './my-query.graphql';
Special import rules
| File extension | What you get |
|---|---|
.gql, .graphql | A function (vars?) => { query, subscribe, unsubscribe } — see GraphQL modules |
.bpf.o | A default-exported BpfObject pointing at that ELF — see eBPF |
| Everything else | Normal ES module |
Built-in modules
| Import | Contents |
|---|---|
yeet:tui | Declarative terminal UI — Box, Text, Layer, CellBuffer, Disposal, mount, signal, computed, from, effect, face helpers — see TUI |
yeet:tui/jsx-runtime | JSX runtime (jsx, jsxs, Fragment) |
yeet:tui:layout | Layout engine (Node, Size, layout) |
yeet:tui:face | Styled-string and color primitives |
yeet:tui:text | Text measurement utilities |
yeet:signal | TC39-style signals (Signal.State, Signal.Computed, Signal.subtle) |
JSX
Scripts can use JSX syntax in .jsx and .tsx files. The runtime transpiles it automatically — no pragma or build step required.
import { Box, Text, mount } from 'yeet:tui';
mount(size => (
<Box border="round" padding={1}>
<Text>hello</Text>
</Box>
));
JSX element types must be component functions. String tag names (<div>, etc.) are not supported.
Execution model
- Scripts run as ES modules inside a single-threaded V8 isolate.
- Async/await and promises work — the event loop runs timers and resolves pending promises between turns.
- The isolate terminates when the top-level module finishes and no pending timers or unresolved promises remain, or when
yeet.exit()is called. - Uncaught exceptions and unhandled promise rejections are reported to the daemon and terminate the isolate.