detectRuntime(globals?: GlobalScope): RuntimePlatform
Detects the current runtime platform.
Detection order (first match wins):
- Deno —
Denoglobal exists - Bun —
Bunglobal exists (checked before Cloudflare to avoid false positives since Bun might also havecaches) - Cloudflare Workers —
cachesexists andnavigator.userAgentcontains 'cloudflare', case-insensitively (a real Worker reports'Cloudflare-Workers') - Default — Node.js
process is deliberately NOT consulted: nodejs_compat defines it on
Cloudflare Workers, so a process-based check would misreport every
Worker scaffolded with that flag — which is every Worker this CLI emits.
optional
globals: GlobalScope = globalThis
Injectable global scope (defaults to globalThis)