brainy/src/unified.ts
David Snelling 5edea683c6 **feat: improve TensorFlow.js compatibility and remove unnecessary patches**
- Removed outdated Node.js v24 compatibility patches for `TextEncoder` and `TextDecoder` in `cli-wrapper.js` and other modules since TensorFlow.js now supports Node.js v24+ natively.
- Introduced a utility module `src/utils/tensorflowUtils.ts` for TensorFlow.js compatibility, defining global `PlatformNode` and related utilities.
- Enhanced `fileSystemStorage.ts` with improved Node.js module loading mechanisms for better compatibility across environments.
- Simplified dependency requirements by reducing the minimum Node.js version to `>=23.0.0`.
- Updated `package.json`, `cli-package/package.json`, and `README.md` versions to `0.9.25`.
- Harmonized `cli-package` and main package dependencies to ensure version alignment.
- Improved global compatibility with TensorFlow.js in mixed Node.js environments.

This update modernizes TensorFlow.js integration, reduces maintenance efforts, and aligns compatibility with current Node.js and TensorFlow.js capabilities.
2025-07-02 16:16:19 -07:00

36 lines
933 B
TypeScript

/**
* Unified entry point for Brainy
* This file exports everything from index.ts
* Environment detection is handled here and made available to all components
*/
// Export environment information
export const environment = {
isBrowser: typeof window !== 'undefined',
isNode:
typeof process !== 'undefined' && process.versions && process.versions.node,
isServerless:
typeof window === 'undefined' &&
(typeof process === 'undefined' ||
!process.versions ||
!process.versions.node)
}
// Make environment information available globally
if (typeof globalThis !== 'undefined') {
;(globalThis as any).__ENV__ = environment
}
// Log the detected environment
console.log(
`Brainy running in ${
environment.isBrowser
? 'browser'
: environment.isNode
? 'Node.js'
: 'serverless/unknown'
} environment`
)
// Re-export everything from index.ts
export * from './index.js'