UNPKG

cross-log

Version:

A universal logging package that works in both browser and Node.js environments with environment variable configuration

46 lines 1.41 kB
/** * Environment abstraction layer for cross-platform compatibility * Handles differences between Node.js, Browser, and Edge Runtime environments */ import { Environment } from './types'; /** * Runtime type detection */ export declare const RuntimeType: { readonly BROWSER: "browser"; readonly NODE: "node"; readonly EDGE: "edge"; readonly DENO: "deno"; readonly BUN: "bun"; readonly UNKNOWN: "unknown"; }; export type RuntimeTypeValue = typeof RuntimeType[keyof typeof RuntimeType]; /** * Detect the current runtime type */ export declare function detectRuntimeType(): RuntimeTypeValue; /** * Environment variable abstraction * Works across different runtime environments */ export declare function getEnvironmentVariable(key: string, defaultValue?: string): string | undefined; /** * Detect if running in production mode * Works across different environments */ export declare function isProductionEnvironment(): boolean; /** * Enhanced environment detection that works across all runtimes */ export declare function detectEnvironment(): Environment; /** * Performance timing abstraction * Works across different environments */ export declare function getHighResolutionTime(): number; /** * Check if a global object exists * Useful for feature detection */ export declare function hasGlobal(name: string): boolean; //# sourceMappingURL=environment.d.ts.map