createBrowserCapabilities
createBrowserCapabilities(
baseUrl?):PlatformCapabilities
Defined in: packages/runtime/src/platform/browser-caps.ts:67
Build PlatformCapabilities for the browser host.
Parameters
Section titled “Parameters”baseUrl?
Section titled “baseUrl?”string
Base URL for resolving relative loadAsset paths.
Defaults to globalThis.location.href when available,
otherwise empty (which means only absolute URLs work).
Returns
Section titled “Returns”A PlatformCapabilities bound to the current browser window / worker globals.
Remarks
Section titled “Remarks”Wires capabilities to the browser’s built-ins — fetch for both
loadAsset (binary body via arrayBuffer()) and fetch, Blob +
URL.createObjectURL for ESM evaluation (dynamic import(blobUrl)),
and WebAssembly.compile for WASM. The module avoids requiring the DOM
lib in tsconfig by casting through a structural BrowserGlobals
shape, which keeps this file importable from a Node test runner without
complaining about missing window.
importEsm rewrites import.meta.url to "" — in a blob-URL context
the real value is the blob URL itself, which is meaningless to
Emscripten glue. In the browser ENVIRONMENT_IS_NODE is false so
createRequire never runs, so an empty string is safe.
Consumed by browserRuntime; prefer that factory for boot flows.
Example
Section titled “Example”import { createBrowserCapabilities, createRuntime } from '@fishnet/runtime'
const runtime = createRuntime(createBrowserCapabilities())