index.d.ts 3.9 KB

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