Skip to content

detectRuntime

detectRuntime(): Promise<PlatformCapabilities>

Defined in: packages/runtime/src/root/detect.ts:46

Auto-detect the host platform and return the matching PlatformCapabilities.

Promise<PlatformCapabilities>

A PlatformCapabilities suitable for the current host.

Feature-detects Node.js via globalThis.process.versions.node; anything else (browser, Web Worker, Deno, Bun) falls through to the browser caps. The underlying caps modules are loaded via dynamic import() with literal specifiers so bundlers can tree-shake the unused branch.

Callers rarely invoke this directly — the runtime Unix builder calls it when .runtime(...) is not supplied.

import { detectRuntime } from '@fishnet/runtime'
const caps = await detectRuntime()
// caps is nodeCapabilities on Node.js, browserCapabilities elsewhere