39 lines
1,023 B
TypeScript
39 lines
1,023 B
TypeScript
/**
|
|
* @module unified
|
|
* @description Unified entry point for Brainy. Re-exports the public surface
|
|
* from `index.js` and surfaces a tiny runtime-environment object the rest of
|
|
* the library can read.
|
|
*
|
|
* 8.0 supports Node-like runtimes only (Node.js, Bun, Deno); the browser
|
|
* detection helpers and Worker Thread plumbing are gone.
|
|
*/
|
|
|
|
import './setup.js'
|
|
|
|
import { isNode } from './utils/environment.js'
|
|
|
|
export const environment = {
|
|
get isNode() {
|
|
return isNode()
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
/**
|
|
* Runtime-environment marker published by the unified entry point so
|
|
* embedders and diagnostics can detect the active Brainy environment.
|
|
* Ambient `var` is required — `let`/`const` in `declare global` do not
|
|
* attach to `globalThis`.
|
|
*/
|
|
var __ENV__: typeof environment | undefined
|
|
}
|
|
|
|
if (typeof globalThis !== 'undefined') {
|
|
globalThis.__ENV__ = environment
|
|
}
|
|
|
|
console.log(
|
|
`Brainy running on ${environment.isNode ? 'Node-like runtime' : 'unknown runtime'}`
|
|
)
|
|
|
|
export * from './index.js'
|