@sqlitecloud/drivers
Version:
SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients
32 lines (31 loc) • 1.43 kB
TypeScript
/**
* safe-imports.ts - Safe imports for optional React Native dependencies
*
* This module provides safe imports for dependencies that are optional peer dependencies.
* When these dependencies are not installed (e.g., using the package in a web/Next.js context),
* the imports will still work. However, in React Native contexts where these dependencies are
* required but not installed, clear error messages will be thrown.
*/
/**
* Detects if we're running in React Native environment
*/
export declare function isReactNative(): boolean;
/**
* Safely imports the URL class from whatwg-url or react-native-url-polyfill
* In React Native: Uses react-native-url-polyfill (via react-native field mapping)
* In Web/Node: Uses whatwg-url
*/
export declare function getSafeURL(): typeof import('whatwg-url').URL;
/**
* Safely imports the Buffer class from buffer or @craftzdog/react-native-buffer
* In React Native: Uses @craftzdog/react-native-buffer (via react-native field mapping)
* In Web/Node: Uses buffer package
*/
export declare function getSafeBuffer(): typeof import('buffer').Buffer;
/**
* Safely imports the tls module or react-native-tcp-socket
* In React Native: Uses react-native-tcp-socket (via react-native field mapping)
* In Node: Uses native tls module
* In Browser: Will return null (browser field sets tls to false)
*/
export declare function getSafeTLS(): typeof import('tls') | null;