Skip to content

createNodeCapabilities

createNodeCapabilities(): PlatformCapabilities

Defined in: packages/runtime/src/platform/node-caps.ts:48

Build PlatformCapabilities for the Node.js host.

PlatformCapabilities

A PlatformCapabilities bound to the current Node process.

Wires capabilities to Node built-ins — node:fs/promises.readFile for assets, import(dataUri) for ESM evaluation, globalThis.fetch (undici, Node 18+) for HTTP, and WebAssembly.compile for WASM. All node:* imports are dynamic so this module stays isomorphic-importable (the browser bundler just never hits the branches that use them when createBrowserCapabilities is the one in play).

importEsm rewrites import.meta.url to process.cwd()+"/" before evaluation — in a data-URI context the real value is the data URI itself, which breaks Emscripten glue that calls createRequire(import.meta.url).

Consumed by nodeRuntime; prefer that factory for boot flows.

import { createNodeCapabilities, createRuntime } from '@fishnet/runtime'
const runtime = createRuntime(createNodeCapabilities())