Skip to content

createAdapter

Generated reference page for the createAdapter function export.

Signatures

ts
function createAdapter(globals?: GlobalForDetect): RuntimeAdapter;
ParameterTypeDescription
globalsGlobalForDetect | undefinedOverride globalThis for testing. Production callers
should omit this parameter.

Members

Members

createAdapter

Create a runtime adapter for the current environment.

Detection order follows detectRuntime: Bun → Deno → Node → unknown. Unknown runtimes fall back to the Node adapter because most JS runtimes expose a Node-compatible process global.

ts
(globals?: GlobalForDetect): RuntimeAdapter;

Examples

ts
import { cli } from '@kjanat/dreamcli';

// Auto-detects Node/Bun/Deno and creates the right adapter
cli('mycli').run(); // uses createAdapter() internally

See Also

Released under the MIT License.