std-env 3.9.0 → 4.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -82
- package/dist/index.d.mts +117 -45
- package/dist/index.mjs +1 -1
- package/package.json +28 -32
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -92
- package/dist/index.d.ts +0 -92
package/README.md
CHANGED
|
@@ -1,117 +1,89 @@
|
|
|
1
1
|
# std-env
|
|
2
2
|
|
|
3
|
-
[](http://npmjs.com/package/std-env)
|
|
4
|
+
[](http://npmjs.com/package/std-env)
|
|
5
|
+
[](https://bundlephobia.com/result?p=std-env)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Runtime-agnostic JS utils for detecting environments, runtimes, CI providers, and AI coding agents.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Runtime Detection
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
# Using npm
|
|
13
|
-
npm i std-env
|
|
11
|
+
Detects the current JavaScript runtime based on global variables, following the [WinterCG Runtime Keys proposal](https://runtime-keys.proposal.wintercg.org/).
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
```ts
|
|
14
|
+
import { runtime, runtimeInfo } from "std-env";
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
console.log(runtime); // "" | "node" | "deno" | "bun" | "workerd" ...
|
|
17
|
+
console.log(runtimeInfo); // { name: "node" }
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
Individual named exports: `isNode`, `isBun`, `isDeno`, `isNetlify`, `isEdgeLight`, `isWorkerd`, `isFastly`
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { env, isDevelopment, isProduction } from "std-env";
|
|
27
|
-
|
|
28
|
-
// CommonJS
|
|
29
|
-
const { env, isDevelopment, isProduction } = require("std-env");
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Flags
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> `isNode` is also `true` in Bun/Deno with Node.js compatibility mode. Use `runtime === "node"` for strict checks.
|
|
33
24
|
|
|
34
|
-
|
|
35
|
-
- `hasWindow`
|
|
36
|
-
- `isDebug`
|
|
37
|
-
- `isDevelopment`
|
|
38
|
-
- `isLinux`
|
|
39
|
-
- `isMacOS`
|
|
40
|
-
- `isMinimal`
|
|
41
|
-
- `isProduction`
|
|
42
|
-
- `isTest`
|
|
43
|
-
- `isWindows`
|
|
44
|
-
- `platform`
|
|
45
|
-
- `isColorSupported`
|
|
46
|
-
- `nodeVersion`
|
|
47
|
-
- `nodeMajorVersion`
|
|
48
|
-
|
|
49
|
-
You can read more about how each flag works from [./src/flags.ts](./src/flags.ts).
|
|
25
|
+
See [./src/runtimes.ts](./src/runtimes.ts) for the full list.
|
|
50
26
|
|
|
51
27
|
## Provider Detection
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
You can use `isCI` and `platform` exports to detect it:
|
|
29
|
+
Detects the current CI/CD provider based on environment variables.
|
|
56
30
|
|
|
57
31
|
```ts
|
|
58
32
|
import { isCI, provider, providerInfo } from "std-env";
|
|
59
33
|
|
|
60
|
-
console.log({
|
|
61
|
-
|
|
62
|
-
provider, // "github_actions"
|
|
63
|
-
providerInfo, // { name: "github_actions", isCI: true }
|
|
64
|
-
});
|
|
34
|
+
console.log({ isCI, provider, providerInfo });
|
|
35
|
+
// { isCI: true, provider: "github_actions", providerInfo: { name: "github_actions", isCI: true } }
|
|
65
36
|
```
|
|
66
37
|
|
|
67
|
-
|
|
38
|
+
Use `detectProvider()` to re-run detection. See [./src/providers.ts](./src/providers.ts) for the full list.
|
|
68
39
|
|
|
69
|
-
##
|
|
40
|
+
## Agent Detection
|
|
70
41
|
|
|
71
|
-
|
|
42
|
+
Detects if the environment is running inside an AI coding agent.
|
|
72
43
|
|
|
73
44
|
```ts
|
|
74
|
-
import {
|
|
45
|
+
import { isAgent, agent, agentInfo } from "std-env";
|
|
75
46
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// { name: "node" }
|
|
80
|
-
console.log(runtimeInfo);
|
|
47
|
+
console.log({ isAgent, agent, agentInfo });
|
|
48
|
+
// { isAgent: true, agent: "claude", agentInfo: { name: "claude" } }
|
|
81
49
|
```
|
|
82
50
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
> [!NOTE]
|
|
86
|
-
> 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.
|
|
87
|
-
>
|
|
88
|
-
> Use `runtime === "node"` if you need strict check for Node.js runtime.
|
|
89
|
-
|
|
90
|
-
- `isNode`
|
|
91
|
-
- `isBun`
|
|
92
|
-
- `isDeno`
|
|
93
|
-
- `isNetlify`
|
|
94
|
-
- `isEdgeLight`
|
|
95
|
-
- `isWorkerd`
|
|
96
|
-
- `isFastly`
|
|
51
|
+
Set the `AI_AGENT` env var to explicitly specify the agent name. Use `detectAgent()` to re-run detection.
|
|
97
52
|
|
|
98
|
-
|
|
53
|
+
Supported agents: `cursor`, `claude`, `devin`, `replit`, `gemini`, `codex`, `auggie`, `opencode`, `kiro`, `goose`, `pi`
|
|
99
54
|
|
|
100
|
-
##
|
|
101
|
-
|
|
102
|
-
`std-env` provides a lightweight proxy to access environment variables in a platform agnostic way.
|
|
55
|
+
## Flags
|
|
103
56
|
|
|
104
|
-
```
|
|
105
|
-
import { env } from "std-env";
|
|
57
|
+
```js
|
|
58
|
+
import { env, isDevelopment, isProduction } from "std-env";
|
|
106
59
|
```
|
|
107
60
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
61
|
+
| Export | Description |
|
|
62
|
+
| ------------------ | ----------------------------------------- |
|
|
63
|
+
| `hasTTY` | stdout TTY is available |
|
|
64
|
+
| `hasWindow` | Global `window` is available |
|
|
65
|
+
| `isCI` | Running in CI |
|
|
66
|
+
| `isColorSupported` | Terminal color output supported |
|
|
67
|
+
| `isDebug` | `DEBUG` env var is set |
|
|
68
|
+
| `isDevelopment` | `NODE_ENV` is `dev` or `development` |
|
|
69
|
+
| `isLinux` | Linux platform |
|
|
70
|
+
| `isMacOS` | macOS (darwin) platform |
|
|
71
|
+
| `isMinimal` | Minimal environment (CI, test, or no TTY) |
|
|
72
|
+
| `isProduction` | `NODE_ENV` is `production` |
|
|
73
|
+
| `isTest` | `NODE_ENV` is `test` |
|
|
74
|
+
| `isWindows` | Windows platform |
|
|
75
|
+
| `platform` | Value of `process.platform` |
|
|
76
|
+
| `nodeVersion` | Node.js version string (e.g. `"22.0.0"`) |
|
|
77
|
+
| `nodeMajorVersion` | Node.js major version number (e.g. `22`) |
|
|
78
|
+
|
|
79
|
+
See [./src/flags.ts](./src/flags.ts) for details.
|
|
80
|
+
|
|
81
|
+
## Environment
|
|
82
|
+
|
|
83
|
+
| Export | Description |
|
|
84
|
+
| --------- | --------------------------------------------------- |
|
|
85
|
+
| `env` | Universal `process.env` (works across all runtimes) |
|
|
86
|
+
| `nodeENV` | Current `NODE_ENV` value (undefined if unset) |
|
|
115
87
|
|
|
116
88
|
## License
|
|
117
89
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/agents.d.ts
|
|
2
|
+
type AgentName = (string & {}) | "cursor" | "claude" | "devin" | "replit" | "gemini" | "codex" | "auggie" | "opencode" | "kiro" | "goose" | "pi";
|
|
3
|
+
/**
|
|
4
|
+
* Provides information about an AI coding agent.
|
|
5
|
+
*/
|
|
6
|
+
type AgentInfo = {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the AI coding agent. See {@link AgentName} for possible values.
|
|
9
|
+
*/
|
|
10
|
+
name?: AgentName;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Detects the current AI coding agent from environment variables.
|
|
14
|
+
*
|
|
15
|
+
* Supported agents: `cursor`, `claude`, `devin`, `replit`, `gemini`, `codex`, `auggie`, `opencode`, `kiro`, `goose`, `pi`
|
|
16
|
+
*
|
|
17
|
+
* You can also set the `AI_AGENT` environment variable to explicitly specify the agent name.
|
|
18
|
+
*/
|
|
19
|
+
declare function detectAgent(): AgentInfo;
|
|
20
|
+
/**
|
|
21
|
+
* The detected agent information for the current execution context.
|
|
22
|
+
* This value is evaluated once at module initialisation.
|
|
23
|
+
*/
|
|
24
|
+
declare const agentInfo: AgentInfo;
|
|
25
|
+
/**
|
|
26
|
+
* Name of the detected agent.
|
|
27
|
+
*/
|
|
28
|
+
declare const agent: AgentName | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean flag indicating whether the current environment is running inside an AI coding agent.
|
|
31
|
+
*/
|
|
32
|
+
declare const isAgent: boolean;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/env.d.ts
|
|
35
|
+
declare const env: Record<string, string | undefined>;
|
|
36
|
+
declare const process: Partial<typeof globalThis.process>;
|
|
37
|
+
/**
|
|
38
|
+
* Current value of the `NODE_ENV` environment variable (or static value if replaced during build).
|
|
39
|
+
*
|
|
40
|
+
* If `NODE_ENV` is not set, this will be undefined.
|
|
41
|
+
*/
|
|
42
|
+
declare const nodeENV: string | undefined;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/flags.d.ts
|
|
5
45
|
/** Value of process.platform */
|
|
6
|
-
declare const platform:
|
|
46
|
+
declare const platform: string;
|
|
7
47
|
/** Detect if `CI` environment variable is set or a provider CI detected */
|
|
8
48
|
declare const isCI: boolean;
|
|
9
49
|
/** Detect if stdout.TTY is available */
|
|
@@ -12,11 +52,11 @@ declare const hasTTY: boolean;
|
|
|
12
52
|
declare const hasWindow: boolean;
|
|
13
53
|
/** Detect if `DEBUG` environment variable is set */
|
|
14
54
|
declare const isDebug: boolean;
|
|
15
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
55
|
+
/** Detect if `NODE_ENV` environment variable is `test` or `TEST` environment variable is set */
|
|
16
56
|
declare const isTest: boolean;
|
|
17
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
57
|
+
/** Detect if `NODE_ENV` or `MODE` environment variable is `production` */
|
|
18
58
|
declare const isProduction: boolean;
|
|
19
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
59
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development`, or if `MODE` environment variable is `development` */
|
|
20
60
|
declare const isDevelopment: boolean;
|
|
21
61
|
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
22
62
|
declare const isMinimal: boolean;
|
|
@@ -31,62 +71,94 @@ declare const isColorSupported: boolean;
|
|
|
31
71
|
/** Node.js versions */
|
|
32
72
|
declare const nodeVersion: string | null;
|
|
33
73
|
declare const nodeMajorVersion: number | null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/providers.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* Represents the name of a CI/CD or Deployment provider.
|
|
78
|
+
*/
|
|
79
|
+
type ProviderName = (string & {}) | "appveyor" | "aws_amplify" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "cloudflare_workers" | "google_cloudrun" | "google_cloudrun_job" | "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";
|
|
80
|
+
/**
|
|
81
|
+
* Provides information about a CI/CD or Deployment provider, including its name and possibly other metadata.
|
|
82
|
+
*/
|
|
42
83
|
type ProviderInfo = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The name of the CI/CD or Deployment provider. See {@link ProviderName} for possible values.
|
|
86
|
+
*/
|
|
87
|
+
name: ProviderName;
|
|
88
|
+
/**
|
|
89
|
+
* If is set to `true`, the environment is recognised as a CI/CD provider.
|
|
90
|
+
*/
|
|
91
|
+
ci?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Arbitrary metadata associated with the provider.
|
|
94
|
+
*/
|
|
95
|
+
[meta: string]: any;
|
|
46
96
|
};
|
|
47
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Detects the current CI/CD or Deployment provider from environment variables.
|
|
99
|
+
*/
|
|
100
|
+
declare function detectProvider(): ProviderInfo;
|
|
101
|
+
/**
|
|
102
|
+
* The detected provider information for the current execution context.
|
|
103
|
+
* This value is evaluated once at module initialisation.
|
|
104
|
+
*/
|
|
48
105
|
declare const providerInfo: ProviderInfo;
|
|
106
|
+
/**
|
|
107
|
+
* Name of the detected provider, defaults to an empty string if no provider is detected.
|
|
108
|
+
*/
|
|
49
109
|
declare const provider: ProviderName;
|
|
50
|
-
|
|
51
|
-
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/runtimes.d.ts
|
|
112
|
+
type RuntimeName = (string & {}) | "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly";
|
|
52
113
|
type RuntimeInfo = {
|
|
53
|
-
|
|
114
|
+
/**
|
|
115
|
+
* The name of the detected runtime.
|
|
116
|
+
*/
|
|
117
|
+
name: RuntimeName;
|
|
54
118
|
};
|
|
55
119
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
120
|
+
* Indicates if running in Node.js or a Node.js compatible runtime.
|
|
121
|
+
*
|
|
122
|
+
* **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.
|
|
123
|
+
*
|
|
124
|
+
* Use `runtime === "node"` if you need strict check for Node.js runtime.
|
|
125
|
+
*/
|
|
62
126
|
declare const isNode: boolean;
|
|
63
127
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
128
|
+
* Indicates if running in Bun runtime.
|
|
129
|
+
*/
|
|
66
130
|
declare const isBun: boolean;
|
|
67
131
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
* Indicates if running in Deno runtime.
|
|
133
|
+
*/
|
|
70
134
|
declare const isDeno: boolean;
|
|
71
135
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
136
|
+
* Indicates if running in Fastly runtime.
|
|
137
|
+
*/
|
|
74
138
|
declare const isFastly: boolean;
|
|
75
139
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
140
|
+
* Indicates if running in Netlify runtime.
|
|
141
|
+
*/
|
|
78
142
|
declare const isNetlify: boolean;
|
|
79
143
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
144
|
+
*
|
|
145
|
+
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
146
|
+
*/
|
|
83
147
|
declare const isEdgeLight: boolean;
|
|
84
148
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
149
|
+
* Indicates if running in Cloudflare Workers runtime.
|
|
150
|
+
*
|
|
151
|
+
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
152
|
+
*/
|
|
87
153
|
declare const isWorkerd: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Contains information about the detected runtime, if any.
|
|
156
|
+
*/
|
|
88
157
|
declare const runtimeInfo: RuntimeInfo | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* A convenience constant that returns the name of the detected runtime,
|
|
160
|
+
* defaults to an empty string if no runtime is detected.
|
|
161
|
+
*/
|
|
89
162
|
declare const runtime: RuntimeName;
|
|
90
|
-
|
|
91
|
-
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 };
|
|
92
|
-
export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName };
|
|
163
|
+
//#endregion
|
|
164
|
+
export { type AgentInfo, type AgentName, type ProviderInfo, type ProviderName, type RuntimeInfo, type RuntimeName, agent, agentInfo, detectAgent, detectProvider, env, hasTTY, hasWindow, isAgent, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e=globalThis.process?.env||Object.create(null),t=globalThis.process||{env:e},n=t!==void 0&&t.env&&t.env.NODE_ENV||void 0,r=[[`claude`,[`CLAUDECODE`,`CLAUDE_CODE`]],[`replit`,[`REPL_ID`]],[`gemini`,[`GEMINI_CLI`]],[`codex`,[`CODEX_SANDBOX`,`CODEX_THREAD_ID`]],[`opencode`,[`OPENCODE`]],[`pi`,[i(`PATH`,/\.pi[\\/]agent/)]],[`auggie`,[`AUGMENT_AGENT`]],[`goose`,[`GOOSE_PROVIDER`]],[`devin`,[i(`EDITOR`,/devin/)]],[`cursor`,[`CURSOR_AGENT`]],[`kiro`,[i(`TERM_PROGRAM`,/kiro/)]]];function i(t,n){return()=>{let r=e[t];return r?n.test(r):!1}}function a(){let t=e.AI_AGENT;if(t)return{name:t.toLowerCase()};for(let[t,n]of r)for(let r of n)if(typeof r==`string`?e[r]:r())return{name:t};return{}}const o=a(),s=o.name,c=!!o.name,l=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CLOUDFLARE_WORKERS`,`WORKERS_CI`,{ci:!0}],[`GOOGLE_CLOUDRUN`,`K_SERVICE`],[`GOOGLE_CLOUDRUN_JOB`,`CLOUD_RUN_JOB`],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`JENKINS`,`JENKINS_URL`],[`HUDSON`,`HUDSON_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOY`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}]];function u(){for(let t of l)if(e[t[1]||t[0]])return{name:t[0].toLowerCase(),...t[2]};return e.SHELL===`/bin/jsh`&&t.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}const d=u(),f=d.name,p=t.platform||``,m=!!e.CI||d.ci!==!1,h=!!t.stdout?.isTTY,g=typeof window<`u`,_=!!e.DEBUG,v=n===`test`||!!e.TEST,y=n===`production`||e.MODE===`production`,b=n===`dev`||n===`development`||e.MODE===`development`,x=!!e.MINIMAL||m||v||!h,S=/^win/i.test(p),C=/^linux/i.test(p),w=/^darwin/i.test(p),T=!e.NO_COLOR&&(!!e.FORCE_COLOR||(h||S)&&e.TERM!==`dumb`||m),E=(t.versions?.node||``).replace(/^v/,``)||null,D=Number(E?.split(`.`)[0])||null,O=!!t?.versions?.node,k=`Bun`in globalThis,A=`Deno`in globalThis,j=`fastly`in globalThis,M=`Netlify`in globalThis,N=`EdgeRuntime`in globalThis,P=globalThis.navigator?.userAgent===`Cloudflare-Workers`,F=[[M,`netlify`],[N,`edge-light`],[P,`workerd`],[j,`fastly`],[A,`deno`],[k,`bun`],[O,`node`]];function I(){let e=F.find(e=>e[0]);if(e)return{name:e[1]}}const L=I(),R=L?.name||``;export{s as agent,o as agentInfo,a as detectAgent,u as detectProvider,e as env,h as hasTTY,g as hasWindow,c as isAgent,k as isBun,m as isCI,T as isColorSupported,_ as isDebug,A as isDeno,b as isDevelopment,N as isEdgeLight,j as isFastly,C as isLinux,w as isMacOS,x as isMinimal,M as isNetlify,O as isNode,y as isProduction,v as isTest,S as isWindows,P as isWorkerd,n as nodeENV,D as nodeMajorVersion,E as nodeVersion,p as platform,t as process,f as provider,d as providerInfo,R as runtime,L as runtimeInfo};
|
package/package.json
CHANGED
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "std-env",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.1",
|
|
4
4
|
"description": "Runtime agnostic JS utils",
|
|
5
|
-
"repository": "unjs/std-env",
|
|
6
5
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"exports": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
-
},
|
|
13
|
-
"main": "./dist/index.cjs",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"repository": "unjs/std-env",
|
|
15
7
|
"files": [
|
|
16
8
|
"dist"
|
|
17
9
|
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"main": "./dist/index.mjs",
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./dist/index.mjs"
|
|
16
|
+
},
|
|
18
17
|
"scripts": {
|
|
19
|
-
"build": "
|
|
18
|
+
"build": "obuild",
|
|
20
19
|
"dev": "vitest",
|
|
21
|
-
"lint": "
|
|
22
|
-
"lint:fix": "
|
|
23
|
-
"prepack": "
|
|
24
|
-
"
|
|
25
|
-
"play:deno": "pnpm build && deno run -A playground/deno.ts",
|
|
26
|
-
"play:node": "pnpm build && node playground/node.mjs",
|
|
27
|
-
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
|
20
|
+
"lint": "oxlint . && oxfmt",
|
|
21
|
+
"lint:fix": "oxlint --fix . && oxfmt",
|
|
22
|
+
"prepack": "obuild",
|
|
23
|
+
"release": "pnpm test && pnpm build && changelogen --release --prerelease --publish && git push --follow-tags",
|
|
28
24
|
"test": "pnpm lint && pnpm typecheck && vitest run --coverage",
|
|
29
|
-
"typecheck": "
|
|
25
|
+
"typecheck": "tsgo --noEmit"
|
|
30
26
|
},
|
|
31
27
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"vitest": "^
|
|
28
|
+
"@types/node": "^25.2.3",
|
|
29
|
+
"@typescript/native-preview": "^7.0.0-dev.20260217.1",
|
|
30
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
31
|
+
"changelogen": "^0.6.2",
|
|
32
|
+
"esbuild": "^0.27.3",
|
|
33
|
+
"mitata": "^1.0.34",
|
|
34
|
+
"obuild": "^0.4.28",
|
|
35
|
+
"oxfmt": "^0.33.0",
|
|
36
|
+
"oxlint": "^1.48.0",
|
|
37
|
+
"rollup": "^4.57.1",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vitest": "^4.0.18"
|
|
44
40
|
},
|
|
45
|
-
"packageManager": "pnpm@10.
|
|
41
|
+
"packageManager": "pnpm@10.30.0"
|
|
46
42
|
}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;var p=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var C=(i,e,E)=>e in i?B(i,e,{enumerable:!0,configurable:!0,writable:!0,value:E}):i[e]=E,A=(i,e)=>{for(var E in e||(e={}))b.call(e,E)&&C(i,E,e[E]);if(p)for(var E of p(e))g.call(e,E)&&C(i,E,e[E]);return i};var O,_,D,a,L,c,S,N,u,P;const r$2=Object.create(null),s=i=>{var e,E;return((e=globalThis.process)==null?void 0:e.env)||void 0||((E=globalThis.Deno)==null?void 0:E.env.toObject())||globalThis.__env__||(i?r$2:globalThis)},env=new Proxy(r$2,{get(i,e){var E;return(E=s()[e])!=null?E:r$2[e]},has(i,e){const E=s();return e in E||e in r$2},set(i,e,E){const n=s(!0);return n[e]=E,!0},deleteProperty(i,e){if(!e)return!1;const E=s(!0);return delete E[e],!0},ownKeys(){const i=s(!0);return Object.keys(i)}}),nodeENV=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",r$1=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CLOUDFLARE_WORKERS","WORKERS_CI",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["CODESANDBOX","CODESANDBOX_HOST",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function I(){var i,e,E,n,T,R;if((i=globalThis.process)!=null&&i.env)for(const l of r$1){const d=l[1]||l[0];if((e=globalThis.process)!=null&&e.env[d])return A({name:l[0].toLowerCase()},l[2])}return((n=(E=globalThis.process)==null?void 0:E.env)==null?void 0:n.SHELL)==="/bin/jsh"&&((R=(T=globalThis.process)==null?void 0:T.versions)!=null&&R.webcontainer)?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const providerInfo=I(),provider=providerInfo.name;function toBoolean(i){return i?i!=="false":!1}const platform=((O=globalThis.process)==null?void 0:O.platform)||"",isCI=toBoolean(env.CI)||providerInfo.ci!==!1,hasTTY=toBoolean(((_=globalThis.process)==null?void 0:_.stdout)&&((D=globalThis.process)==null?void 0:D.stdout.isTTY)),hasWindow=typeof window<"u",isDebug=toBoolean(env.DEBUG),isTest=nodeENV==="test"||toBoolean(env.TEST),isProduction=nodeENV==="production",isDevelopment=nodeENV==="dev"||nodeENV==="development",isMinimal=toBoolean(env.MINIMAL)||isCI||isTest||!hasTTY,isWindows=/^win/i.test(platform),isLinux=/^linux/i.test(platform),isMacOS=/^darwin/i.test(platform),isColorSupported=!toBoolean(env.NO_COLOR)&&(toBoolean(env.FORCE_COLOR)||(hasTTY||isWindows)&&env.TERM!=="dumb"||isCI),nodeVersion=(((L=(a=globalThis.process)==null?void 0:a.versions)==null?void 0:L.node)||"").replace(/^v/,"")||null,nodeMajorVersion=Number(nodeVersion==null?void 0:nodeVersion.split(".")[0])||null,o$1=globalThis.process||Object.create(null),r={versions:{}},process$1=new Proxy(o$1,{get(i,e){if(e==="env")return env;if(e in i)return i[e];if(e in r)return r[e]}}),isNode=((S=(c=globalThis.process)==null?void 0:c.release)==null?void 0:S.name)==="node",isBun=!!globalThis.Bun||!!((u=(N=globalThis.process)==null?void 0:N.versions)!=null&&u.bun),isDeno=!!globalThis.Deno,isFastly=!!globalThis.fastly,isNetlify=!!globalThis.Netlify,isEdgeLight=!!globalThis.EdgeRuntime,isWorkerd=((P=globalThis.navigator)==null?void 0:P.userAgent)==="Cloudflare-Workers",t=[[isNetlify,"netlify"],[isEdgeLight,"edge-light"],[isWorkerd,"workerd"],[isFastly,"fastly"],[isDeno,"deno"],[isBun,"bun"],[isNode,"node"]];function o(){const i=t.find(e=>e[0]);if(i)return{name:i[1]}}const runtimeInfo=o(),runtime=(runtimeInfo==null?void 0:runtimeInfo.name)||"";exports.env=env,exports.hasTTY=hasTTY,exports.hasWindow=hasWindow,exports.isBun=isBun,exports.isCI=isCI,exports.isColorSupported=isColorSupported,exports.isDebug=isDebug,exports.isDeno=isDeno,exports.isDevelopment=isDevelopment,exports.isEdgeLight=isEdgeLight,exports.isFastly=isFastly,exports.isLinux=isLinux,exports.isMacOS=isMacOS,exports.isMinimal=isMinimal,exports.isNetlify=isNetlify,exports.isNode=isNode,exports.isProduction=isProduction,exports.isTest=isTest,exports.isWindows=isWindows,exports.isWorkerd=isWorkerd,exports.nodeENV=nodeENV,exports.nodeMajorVersion=nodeMajorVersion,exports.nodeVersion=nodeVersion,exports.platform=platform,exports.process=process$1,exports.provider=provider,exports.providerInfo=providerInfo,exports.runtime=runtime,exports.runtimeInfo=runtimeInfo;
|
package/dist/index.d.cts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
type EnvObject = Record<string, string | undefined>;
|
|
2
|
-
declare const env: EnvObject;
|
|
3
|
-
declare const nodeENV: string;
|
|
4
|
-
|
|
5
|
-
/** Value of process.platform */
|
|
6
|
-
declare const platform: NodeJS.Platform;
|
|
7
|
-
/** Detect if `CI` environment variable is set or a provider CI detected */
|
|
8
|
-
declare const isCI: boolean;
|
|
9
|
-
/** Detect if stdout.TTY is available */
|
|
10
|
-
declare const hasTTY: boolean;
|
|
11
|
-
/** Detect if global `window` object is available */
|
|
12
|
-
declare const hasWindow: boolean;
|
|
13
|
-
/** Detect if `DEBUG` environment variable is set */
|
|
14
|
-
declare const isDebug: boolean;
|
|
15
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
16
|
-
declare const isTest: boolean;
|
|
17
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
18
|
-
declare const isProduction: boolean;
|
|
19
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
20
|
-
declare const isDevelopment: boolean;
|
|
21
|
-
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
22
|
-
declare const isMinimal: boolean;
|
|
23
|
-
/** Detect if process.platform is Windows */
|
|
24
|
-
declare const isWindows: boolean;
|
|
25
|
-
/** Detect if process.platform is Linux */
|
|
26
|
-
declare const isLinux: boolean;
|
|
27
|
-
/** Detect if process.platform is macOS (darwin kernel) */
|
|
28
|
-
declare const isMacOS: boolean;
|
|
29
|
-
/** Color Support */
|
|
30
|
-
declare const isColorSupported: boolean;
|
|
31
|
-
/** Node.js versions */
|
|
32
|
-
declare const nodeVersion: string | null;
|
|
33
|
-
declare const nodeMajorVersion: number | null;
|
|
34
|
-
|
|
35
|
-
interface Process extends Partial<Omit<typeof globalThis.process, "versions">> {
|
|
36
|
-
env: EnvObject;
|
|
37
|
-
versions: Record<string, string>;
|
|
38
|
-
}
|
|
39
|
-
declare const process: Process;
|
|
40
|
-
|
|
41
|
-
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";
|
|
42
|
-
type ProviderInfo = {
|
|
43
|
-
name: ProviderName;
|
|
44
|
-
ci?: boolean;
|
|
45
|
-
[meta: string]: any;
|
|
46
|
-
};
|
|
47
|
-
/** Current provider info */
|
|
48
|
-
declare const providerInfo: ProviderInfo;
|
|
49
|
-
declare const provider: ProviderName;
|
|
50
|
-
|
|
51
|
-
type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | "";
|
|
52
|
-
type 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
|
-
*/
|
|
62
|
-
declare const isNode: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Indicates if running in Bun runtime.
|
|
65
|
-
*/
|
|
66
|
-
declare const isBun: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Indicates if running in Deno runtime.
|
|
69
|
-
*/
|
|
70
|
-
declare const isDeno: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Indicates if running in Fastly runtime.
|
|
73
|
-
*/
|
|
74
|
-
declare const isFastly: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Indicates if running in Netlify runtime.
|
|
77
|
-
*/
|
|
78
|
-
declare const isNetlify: boolean;
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
82
|
-
*/
|
|
83
|
-
declare const isEdgeLight: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Indicates if running in Cloudflare Workers runtime.
|
|
86
|
-
*/
|
|
87
|
-
declare const isWorkerd: boolean;
|
|
88
|
-
declare const runtimeInfo: RuntimeInfo | undefined;
|
|
89
|
-
declare const runtime: RuntimeName;
|
|
90
|
-
|
|
91
|
-
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 };
|
|
92
|
-
export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName };
|
package/dist/index.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
type EnvObject = Record<string, string | undefined>;
|
|
2
|
-
declare const env: EnvObject;
|
|
3
|
-
declare const nodeENV: string;
|
|
4
|
-
|
|
5
|
-
/** Value of process.platform */
|
|
6
|
-
declare const platform: NodeJS.Platform;
|
|
7
|
-
/** Detect if `CI` environment variable is set or a provider CI detected */
|
|
8
|
-
declare const isCI: boolean;
|
|
9
|
-
/** Detect if stdout.TTY is available */
|
|
10
|
-
declare const hasTTY: boolean;
|
|
11
|
-
/** Detect if global `window` object is available */
|
|
12
|
-
declare const hasWindow: boolean;
|
|
13
|
-
/** Detect if `DEBUG` environment variable is set */
|
|
14
|
-
declare const isDebug: boolean;
|
|
15
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
16
|
-
declare const isTest: boolean;
|
|
17
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
18
|
-
declare const isProduction: boolean;
|
|
19
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
20
|
-
declare const isDevelopment: boolean;
|
|
21
|
-
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
22
|
-
declare const isMinimal: boolean;
|
|
23
|
-
/** Detect if process.platform is Windows */
|
|
24
|
-
declare const isWindows: boolean;
|
|
25
|
-
/** Detect if process.platform is Linux */
|
|
26
|
-
declare const isLinux: boolean;
|
|
27
|
-
/** Detect if process.platform is macOS (darwin kernel) */
|
|
28
|
-
declare const isMacOS: boolean;
|
|
29
|
-
/** Color Support */
|
|
30
|
-
declare const isColorSupported: boolean;
|
|
31
|
-
/** Node.js versions */
|
|
32
|
-
declare const nodeVersion: string | null;
|
|
33
|
-
declare const nodeMajorVersion: number | null;
|
|
34
|
-
|
|
35
|
-
interface Process extends Partial<Omit<typeof globalThis.process, "versions">> {
|
|
36
|
-
env: EnvObject;
|
|
37
|
-
versions: Record<string, string>;
|
|
38
|
-
}
|
|
39
|
-
declare const process: Process;
|
|
40
|
-
|
|
41
|
-
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";
|
|
42
|
-
type ProviderInfo = {
|
|
43
|
-
name: ProviderName;
|
|
44
|
-
ci?: boolean;
|
|
45
|
-
[meta: string]: any;
|
|
46
|
-
};
|
|
47
|
-
/** Current provider info */
|
|
48
|
-
declare const providerInfo: ProviderInfo;
|
|
49
|
-
declare const provider: ProviderName;
|
|
50
|
-
|
|
51
|
-
type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | "";
|
|
52
|
-
type 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
|
-
*/
|
|
62
|
-
declare const isNode: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Indicates if running in Bun runtime.
|
|
65
|
-
*/
|
|
66
|
-
declare const isBun: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Indicates if running in Deno runtime.
|
|
69
|
-
*/
|
|
70
|
-
declare const isDeno: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Indicates if running in Fastly runtime.
|
|
73
|
-
*/
|
|
74
|
-
declare const isFastly: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Indicates if running in Netlify runtime.
|
|
77
|
-
*/
|
|
78
|
-
declare const isNetlify: boolean;
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
82
|
-
*/
|
|
83
|
-
declare const isEdgeLight: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Indicates if running in Cloudflare Workers runtime.
|
|
86
|
-
*/
|
|
87
|
-
declare const isWorkerd: boolean;
|
|
88
|
-
declare const runtimeInfo: RuntimeInfo | undefined;
|
|
89
|
-
declare const runtime: RuntimeName;
|
|
90
|
-
|
|
91
|
-
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 };
|
|
92
|
-
export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName };
|