Frameworks
SolidJS (solid) is the built-in default framework in PocketJS. It compiles
TSX through babel-preset-solid universal mode onto renderer-solid.ts over
the native tree and Rust core.
Other JavaScript frameworks target the same native tree through
@pocketjs/framework/adapter. Maintained external adapters for Vue Vapor,
Octane, Svelte 5, React 19, Effect UI, Angular, and
Vanilla live in
pocket-nexus/ax333/adapters/
and are benchmarked on identical apps and 333 MHz hardware at
ax333.pocketjs.dev.
This repository also keeps internal vue-vapor compiler support for
MicroTS Vue SFC AOT compilation and acceptance suites.
| Layer | Build id / entry | JSX / template transform | Native tree bridge |
|---|---|---|---|
| Built-in default (SolidJS) | solid |
babel-preset-solid universal mode |
renderer-solid.ts |
| External frameworks | @pocketjs/framework/adapter |
Framework's own compiler / bundler | createPocketAdapter() over ui.* |
Solid TSX and Vue SFC views can also compile to Rust. A native application uses a compiled TypeScript model or a handwritten Rust model. The TypeScript support reference compares those modes with ordinary guest applications.
Solid builds to dist/<app>.js and dist/<app>.pak:
bun tools/build.ts hero-main # dist/hero-main.jsThere is no environment-variable switch for framework selection. Product
builds state app.framework: "solid" in pocket.host.config.ts; low-level
compiler work can pass --framework for one invocation.
Contract selection
// pocket.host.config.ts
import { defineHostConfig } from "@pocketjs/framework/host-config";
export default defineHostConfig({
hosts: ["psp", "./hosts/my-board/pocket.host.json"],
app: {
entry: "main.tsx",
framework: "solid",
viewport: { logical: [480, 272], presentation: "integer-fit" },
},
});pocket check and pocket compile read the framework from app.framework
("solid" by default).
The compiler passes that selection through the resolved build plan. Animation
keyframes and shorthand definitions belong beside it in app.theme.
The caller selects one of the hosts the config lists:
pocket compile --target psp
pocket compile --target ./hosts/my-board/pocket.host.json
POCKET_TARGET=psp pocket compile--target accepts a built-in host id or the path of a pocket.host.json
file whose id the config lists. POCKET_TARGET provides the default for that
option. Without a target, the config must list one host. The compiler reads
the nearest pocket.host.config.ts above the current directory, or the file
--config names.
The host contract supplies display geometry, cadences and capabilities; the
app section supplies app.tickHz.
pocket build consumes the host config's build recipe to build
the native program. The recipe uses cargo(), cmake(), make() or
compilerOnly() from @pocketjs/framework/host-config; an application config
without build builds with the stock program of a built-in host.
External framework adapters
To bring Vue Vapor, Octane, Svelte 5, React 19, Effect UI, Angular, or a custom
framework to PocketJS, bind the framework's host-renderer hooks onto
@pocketjs/framework/adapter. The adapter SDK exposes the native tree node ops,
style lookup, focus and input routing, and virtual frame clock without requiring
changes inside PocketJS.
Reference adapters and starter workspaces live in
pocket-nexus/ax333/adapters/.
Framework app imports
Ordinary apps import state and control-flow primitives from solid-js.
PocketJS runtime, host components and lifecycle APIs come from
@pocketjs/framework/*. Compiled models have a separate
reactive import contract.
A Solid app:
import { mount, frameworkName } from "@pocketjs/framework/solid";
import { View, Text, type NodeMirror } from "@pocketjs/framework/solid/components";
import { onMount } from "@pocketjs/framework/solid/lifecycle";
import { createSignal, Show } from "solid-js";
export default function App() {
const [count, setCount] = createSignal(0);
let marker: NodeMirror | undefined;
onMount(() => {
console.log(frameworkName(), marker?.id);
});
return (
<View class="p-4 flex-col gap-2">
<Text class="text-base text-slate-950">Framework: {frameworkName()}</Text>
<View nodeRef={(node) => (marker = node ?? undefined)} focusable onPress={() => setCount(count() + 1)}>
<Text class="text-sm text-blue-600">Count: {count()}</Text>
</View>
<Show when={count() > 2}>
<Text class="text-sm text-emerald-600">Solid, native tree.</Text>
</Show>
</View>
);
}
mount(() => <App />);The generic public subpaths resolve to SolidJS by default:
| Import | Target |
|---|---|
@pocketjs/framework / @pocketjs/framework/solid |
framework/src/index.ts |
@pocketjs/framework/components / @pocketjs/framework/solid/components |
framework/src/components.ts |
@pocketjs/framework/lifecycle / @pocketjs/framework/solid/lifecycle |
Solid lifecycle hooks |
@pocketjs/framework/adapter |
External framework adapter SDK |
Reactivity on PocketJS
PocketJS wraps no reactive system: SolidJS (or an external framework adapter) brings its own, and the runtime adds four rules on top — when a handler's write commits, which imports the Solid lint rejects, the scheduler globals QuickJS lacks, and why continuous motion does not come from per-frame state. Reactivity states all four.
What stays shared
SolidJS and every external adapter built on @pocketjs/framework/adapter share
the same Tailwind-subset compiler, generated style table, font atlas baker,
.pak asset container, host detection, button/focus input, overlay layer,
animation API, and the native rendering and capture paths provided by the
selected program. Host contracts declare software capabilities;
pocket.host.config.ts declares the program build. Switching frameworks changes
the JS component/reactivity layer and the renderer adapter.