UNPKG

3.96 kBTypeScriptView Raw
1type EnvObject = Record<string, string | undefined>;
2declare const env: EnvObject;
3declare const nodeENV: string;
4
5/** Value of process.platform */
6declare const platform: NodeJS.Platform;
7/** Detect if `CI` environment variable is set or a provider CI detected */
8declare const isCI: boolean;
9/** Detect if stdout.TTY is available */
10declare const hasTTY: boolean;
11/** Detect if global `window` object is available */
12declare const hasWindow: boolean;
13/** Detect if `DEBUG` environment variable is set */
14declare const isDebug: boolean;
15/** Detect if `NODE_ENV` environment variable is `test` */
16declare const isTest: boolean;
17/** Detect if `NODE_ENV` environment variable is `production` */
18declare const isProduction: boolean;
19/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
20declare const isDevelopment: boolean;
21/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
22declare const isMinimal: boolean;
23/** Detect if process.platform is Windows */
24declare const isWindows: boolean;
25/** Detect if process.platform is Linux */
26declare const isLinux: boolean;
27/** Detect if process.platform is macOS (darwin kernel) */
28declare const isMacOS: boolean;
29/** Color Support */
30declare const isColorSupported: boolean;
31/** Node.js versions */
32declare const nodeVersion: string | null;
33declare const nodeMajorVersion: number | null;
34
35interface Process extends Partial<Omit<typeof globalThis.process, "versions">> {
36 env: EnvObject;
37 versions: Record<string, string>;
38}
39declare const process: Process;
40
41type ProviderName = "" | "appveyor" | "aws_amplify" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "codebuild" | "codefresh" | "drone" | "drone" | "dsari" | "github_actions" | "gitlab" | "gocd" | "layerci" | "hudson" | "jenkins" | "magnum" | "netlify" | "nevercode" | "render" | "sail" | "semaphore" | "screwdriver" | "shippable" | "solano" | "strider" | "teamcity" | "travis" | "vercel" | "appcenter" | "codesandbox" | "stackblitz" | "stormkit" | "cleavr" | "zeabur" | "codesphere" | "railway" | "deno-deploy" | "firebase_app_hosting";
42type ProviderInfo = {
43 name: ProviderName;
44 ci?: boolean;
45 [meta: string]: any;
46};
47/** Current provider info */
48declare const providerInfo: ProviderInfo;
49declare const provider: ProviderName;
50
51type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | "";
52type RuntimeInfo = {
53 name: RuntimeName;
54};
55/**
56 * Indicates if running in Node.js or a Node.js compatible runtime.
57 *
58 * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.
59 *
60 * Use `runtime === "node"` if you need strict check for Node.js runtime.
61 */
62declare const isNode: boolean;
63/**
64 * Indicates if running in Bun runtime.
65 */
66declare const isBun: boolean;
67/**
68 * Indicates if running in Deno runtime.
69 */
70declare const isDeno: boolean;
71/**
72 * Indicates if running in Fastly runtime.
73 */
74declare const isFastly: boolean;
75/**
76 * Indicates if running in Netlify runtime.
77 */
78declare const isNetlify: boolean;
79/**
80 *
81 * Indicates if running in EdgeLight (Vercel Edge) runtime.
82 */
83declare const isEdgeLight: boolean;
84/**
85 * Indicates if running in Cloudflare Workers runtime.
86 */
87declare const isWorkerd: boolean;
88declare const runtimeInfo: RuntimeInfo | undefined;
89declare const runtime: RuntimeName;
90
91export { type EnvObject, type Process, type ProviderInfo, type ProviderName, type RuntimeInfo, type RuntimeName, env, hasTTY, hasWindow, isBun, isCI, isColorSupported, isDebug, isDeno, isDevelopment, isEdgeLight, isFastly, isLinux, isMacOS, isMinimal, isNetlify, isNode, isProduction, isTest, isWindows, isWorkerd, nodeENV, nodeMajorVersion, nodeVersion, platform, process, provider, providerInfo, runtime, runtimeInfo };