octane
v0.4.3
Published
A fast, modern UI framework and the successor to Inferno
Keywords
Readme
What is octane?
Octane is a fast, JavaScript UI framework, and the successor to
Inferno. It gives you the React API you
already know, a compiler that keeps the runtime small and fast, no rules of
hooks, and no hand-maintained dependency arrays in the common case. Omit a hook's
dependency list and the compiler derives it from the closure; explicit arrays
retain React semantics, while null means every render. Built-in hook calls
retain this inference inside compiler-processed custom hooks, including those in
plain .ts/.js modules. Inferring a dependency argument at a call to a custom
wrapper is narrower: the wrapper must be locally declared in a fully compiled
.tsrx/.tsx module and transparently forward its callback and final dependency
parameter to a supported hook. This package ships both the runtime and compiler,
with the compiler exposed at octane/compiler.
Signals are stable. Import createScope and
query from octane/signals, or useSignal$ from octane/signals/client, for
scoped state, derived values, async resources, and native component reads.
The standard compiler handles signals automatically; no extra option is needed.
Custom Node build pipelines can opt into project-aware string-child inference
through octane/compiler/typescript. See the
type-aware text compilation guide.
Vite builds can fold proven immutable CSS-module class strings into templates. See the CSS-module constants guide for the provider contract and stylesheet-loading guarantees.
Custom native integrations can opt into the experimental Valdi writer compiler. It requires an application-provided adapter; Octane does not bundle a Valdi runtime or native build integration.
Direct Node or Bun server scripts can preload octane/compiler/register to
compile imported Octane components without going through Vite. See the
SSR guide.
Applications that stream or update their own server-rendered DOM can import
attachBehaviorRoot from octane/behavior. Behavior-only roots attach native
interactions and disposable behavior without creating a component root or
taking ownership of the existing markup. See the
external ownership guide.
For fixed native presentation, the experimental compiler-backed adoptBindings
API updates declared properties on existing SSR nodes without importing the
renderer. See compiled DOM bindings
for explicit template eligibility, typed activation and lifetime ownership.
For the full story, see the main README.
React interoperability
octane/react exports both hosting directions: ReactCompat runs real React
components inside Octane, and OctaneCompat runs compiled Octane components
inside React 19. ReactCompat needs matching React and React DOM versions,
19.2 or newer in the React 19 series.
// App.tsrx — compiled by Octane.
import { ReactCompat } from 'octane/react';
import { Counter } from './Counter.react';
export function App() @{
<ReactCompat><Counter start={3} /></ReactCompat>
}Counter.react.tsx stays an ordinary React module, using hooks from react and
React's JSX transform with /** @jsxImportSource react */. Native .tsrx
components stay with Octane. In a mixed build, use requireDirective: true with
both compilers and mark Octane-owned .tsx and hook helper modules with
/** @jsxImportSource octane */. Do not alias React to Octane.
React retains its own state, events, refs, and component types, including class,
memo, lazy, and forwardRef components. Use
bridgeReactContext(OctaneContext, ReactContext) and ReactCompat's contexts
prop to map native context into React. Within OctaneCompat, Octane's use or
useContext can read a real React context directly.
Both server implementations are exported from octane/react/server. Octane's
server compiler selects that entry automatically; React-owned server entries
that bypass it must select it explicitly. Each renderer commits its own work:
Octane transitions and flushSync() do not synchronously commit a
React root. The React interoperability guide
and full ReactCompat reference
cover setup, pending updates, SSR buffering, hydration, and nesting limits.
Browser compatibility
See the browser support guide for recommended targets, required browser APIs, and optional fallbacks.
Configure your application's build target for the browser engines you support.
The Rsbuild integration's modules target includes Chromium 87 and Samsung
Internet 14; Samsung Internet can also be selected directly with targets such as
samsung24. Samsung Internet versions do not match their Chromium engine
versions, and Android System WebView is updated independently from the browser.
Build targets transpile JavaScript syntax; they do not polyfill application Web
APIs. Features such as native inert may require a polyfill on older supported
browsers. Validate text entry with the keyboards, languages, and browser or
WebView versions your application supports.
Octane is beta software. It is ready to build with, but its APIs may still change before 1.0.
License
MIT
