/** * Registry for storage runtimes that only exist on some platforms. * * `createFeltDB` is synchronous, so it cannot `await import()` a runtime on * demand. Instead, a platform entry point registers the runtimes it can * provide, and `createFeltDB` looks them up. * * This exists for one reason: the file runtime imports Node's `fs` and `path`. * A static import of it anywhere in the public entry's module graph makes the * whole package unloadable in a browser, because a browser cannot resolve a * bare `fs` specifier. Keeping that import out of the shared graph is what * lets a browser application import `@feltdb/core` at all. */ import type { JsDb } from './feltdb.js'; /** Builds a runtime from the option that selected it. */ export type RuntimeFactory = (target: string) => JsDb; /** * Make a runtime available to `createFeltDB`. * * Called by a platform entry point for the runtimes that platform supports. */ export declare function registerRuntime(name: string, factory: RuntimeFactory): void; export declare function resolveRuntime(name: string): RuntimeFactory | undefined; /** * Build a runtime, or explain precisely why this platform cannot. * * The message names the alternative rather than reporting a missing module, * because "cannot resolve fs" is not an actionable error for someone who just * wants a database in a browser. */ export declare function requireRuntime(name: string, target: string, guidance: string): JsDb; //# sourceMappingURL=runtime-registry.d.ts.map