diff options
Diffstat (limited to 'vanilla/node_modules/std-env')
| -rw-r--r-- | vanilla/node_modules/std-env/LICENCE | 22 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/README.md | 118 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/dist/index.cjs | 1 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/dist/index.d.cts | 92 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/dist/index.d.mts | 92 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/dist/index.d.ts | 92 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/dist/index.mjs | 1 | ||||
| -rw-r--r-- | vanilla/node_modules/std-env/package.json | 46 |
8 files changed, 464 insertions, 0 deletions
diff --git a/vanilla/node_modules/std-env/LICENCE b/vanilla/node_modules/std-env/LICENCE new file mode 100644 index 0000000..db8fffe --- /dev/null +++ b/vanilla/node_modules/std-env/LICENCE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) Pooya Parsa <pooya@pi0.io> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vanilla/node_modules/std-env/README.md b/vanilla/node_modules/std-env/README.md new file mode 100644 index 0000000..7ed80fe --- /dev/null +++ b/vanilla/node_modules/std-env/README.md @@ -0,0 +1,118 @@ +# std-env + +[](http://npmjs.com/package/std-env) +[](http://npmjs.com/package/std-env) +[](https://bundlephobia.com/result?p=std-env) + +> Runtime agnostic JS utils + +## Installation + +```sh +# Using npm +npm i std-env + +# Using pnpm +pnpm i std-env + +# Using yarn +yarn add std-env +``` + +## Usage + +```js +// ESM +import { env, isDevelopment, isProduction } from "std-env"; + +// CommonJS +const { env, isDevelopment, isProduction } = require("std-env"); +``` + +## Flags + +- `hasTTY` +- `hasWindow` +- `isDebug` +- `isDevelopment` +- `isLinux` +- `isMacOS` +- `isMinimal` +- `isProduction` +- `isTest` +- `isWindows` +- `platform` +- `isColorSupported` +- `nodeVersion` +- `nodeMajorVersion` + +You can read more about how each flag works from [./src/flags.ts](./src/flags.ts). + +## Provider Detection + +`std-env` can automatically detect the current runtime provider based on environment variables. + +You can use `isCI` and `platform` exports to detect it: + +```ts +import { isCI, provider, providerInfo } from "std-env"; + +console.log({ + isCI, // true + provider, // "github_actions" + providerInfo, // { name: "github_actions", isCI: true } +}); +``` + +List of well known providers can be found from [./src/providers.ts](./src/providers.ts). + +## Runtime Detection + +`std-env` can automatically detect the current JavaScript runtime based on global variables, following the [WinterCG Runtime Keys proposal](https://runtime-keys.proposal.wintercg.org/): + +```ts +import { runtime, runtimeInfo } from "std-env"; + +// "" | "node" | "deno" | "bun" | "workerd" ... +console.log(runtime); + +// { name: "node" } +console.log(runtimeInfo); +``` + +You can also use individual named exports for each runtime detection: + +> [!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. +> +> Use `runtime === "node"` if you need strict check for Node.js runtime. + +- `isNode` +- `isBun` +- `isDeno` +- `isNetlify` +- `isEdgeLight` +- `isWorkerd` +- `isFastly` + +List of well known providers can be found from [./src/runtimes.ts](./src/runtimes.ts). + +## Platform-Agnostic `env` + +`std-env` provides a lightweight proxy to access environment variables in a platform agnostic way. + +```ts +import { env } from "std-env"; +``` + +## Platform-Agnostic `process` + +`std-env` provides a lightweight proxy to access [`process`](https://nodejs.org/api/process.html) object in a platform agnostic way. + +```ts +import { process } from "std-env"; +``` + +## License + +MIT diff --git a/vanilla/node_modules/std-env/dist/index.cjs b/vanilla/node_modules/std-env/dist/index.cjs new file mode 100644 index 0000000..98504ed --- /dev/null +++ b/vanilla/node_modules/std-env/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var b=Object.defineProperty;var C=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var A=(i,e,E)=>e in i?b(i,e,{enumerable:!0,configurable:!0,writable:!0,value:E}):i[e]=E,O=(i,e)=>{for(var E in e||(e={}))g.call(e,E)&&A(i,E,e[E]);if(C)for(var E of C(e))x.call(e,E)&&A(i,E,e[E]);return i};var _,D,a,L,c,S,N,u,P,d;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 l=s(!0);return l[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,l,R,p;if((i=globalThis.process)!=null&&i.env)for(const T of r$1){const B=T[1]||T[0];if((e=globalThis.process)!=null&&e.env[B])return O({name:T[0].toLowerCase()},T[2])}return((l=(E=globalThis.process)==null?void 0:E.env)==null?void 0:l.SHELL)==="/bin/jsh"&&((p=(R=globalThis.process)==null?void 0:R.versions)!=null&&p.webcontainer)?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const providerInfo=I(),provider=providerInfo.name;function toBoolean(i){return i?i!=="false":!1}const platform=((_=globalThis.process)==null?void 0:_.platform)||"",isCI=toBoolean(env.CI)||providerInfo.ci!==!1,hasTTY=toBoolean(((D=globalThis.process)==null?void 0:D.stdout)&&((a=globalThis.process)==null?void 0:a.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=(((c=(L=globalThis.process)==null?void 0:L.versions)==null?void 0:c.node)||"").replace(/^v/,"")||null,nodeMajorVersion=Number(nodeVersion==null?void 0:nodeVersion.split(".")[0])||null,o=globalThis.process||Object.create(null),r={versions:{}},process$1=new Proxy(o,{get(i,e){if(e==="env")return env;if(e in i)return i[e];if(e in r)return r[e]}}),isNode=((N=(S=globalThis.process)==null?void 0:S.release)==null?void 0:N.name)==="node",isBun=!!globalThis.Bun||!!((P=(u=globalThis.process)==null?void 0:u.versions)!=null&&P.bun),isDeno=!!globalThis.Deno,isFastly=!!globalThis.fastly,isNetlify=!!globalThis.Netlify,isEdgeLight=!!globalThis.EdgeRuntime,isWorkerd=((d=globalThis.navigator)==null?void 0:d.userAgent)==="Cloudflare-Workers",n=[[isNetlify,"netlify"],[isEdgeLight,"edge-light"],[isWorkerd,"workerd"],[isFastly,"fastly"],[isDeno,"deno"],[isBun,"bun"],[isNode,"node"]];function t(){const i=n.find(e=>e[0]);if(i)return{name:i[1]}}const runtimeInfo=t(),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; diff --git a/vanilla/node_modules/std-env/dist/index.d.cts b/vanilla/node_modules/std-env/dist/index.d.cts new file mode 100644 index 0000000..451e186 --- /dev/null +++ b/vanilla/node_modules/std-env/dist/index.d.cts @@ -0,0 +1,92 @@ +type EnvObject = Record<string, string | undefined>; +declare const env: EnvObject; +declare const nodeENV: string; + +/** Value of process.platform */ +declare const platform: string; +/** Detect if `CI` environment variable is set or a provider CI detected */ +declare const isCI: boolean; +/** Detect if stdout.TTY is available */ +declare const hasTTY: boolean; +/** Detect if global `window` object is available */ +declare const hasWindow: boolean; +/** Detect if `DEBUG` environment variable is set */ +declare const isDebug: boolean; +/** Detect if `NODE_ENV` environment variable is `test` */ +declare const isTest: boolean; +/** Detect if `NODE_ENV` environment variable is `production` */ +declare const isProduction: boolean; +/** Detect if `NODE_ENV` environment variable is `dev` or `development` */ +declare const isDevelopment: boolean; +/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */ +declare const isMinimal: boolean; +/** Detect if process.platform is Windows */ +declare const isWindows: boolean; +/** Detect if process.platform is Linux */ +declare const isLinux: boolean; +/** Detect if process.platform is macOS (darwin kernel) */ +declare const isMacOS: boolean; +/** Color Support */ +declare const isColorSupported: boolean; +/** Node.js versions */ +declare const nodeVersion: string | null; +declare const nodeMajorVersion: number | null; + +interface Process extends Partial<Omit<typeof globalThis.process, "versions">> { + env: EnvObject; + versions: Record<string, string>; +} +declare const process: Process; + +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"; +type ProviderInfo = { + name: ProviderName; + ci?: boolean; + [meta: string]: any; +}; +/** Current provider info */ +declare const providerInfo: ProviderInfo; +declare const provider: ProviderName; + +type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | ""; +type RuntimeInfo = { + name: RuntimeName; +}; +/** + * Indicates if running in Node.js or a Node.js compatible runtime. + * + * **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. + * + * Use `runtime === "node"` if you need strict check for Node.js runtime. + */ +declare const isNode: boolean; +/** + * Indicates if running in Bun runtime. + */ +declare const isBun: boolean; +/** + * Indicates if running in Deno runtime. + */ +declare const isDeno: boolean; +/** + * Indicates if running in Fastly runtime. + */ +declare const isFastly: boolean; +/** + * Indicates if running in Netlify runtime. + */ +declare const isNetlify: boolean; +/** + * + * Indicates if running in EdgeLight (Vercel Edge) runtime. + */ +declare const isEdgeLight: boolean; +/** + * Indicates if running in Cloudflare Workers runtime. + */ +declare const isWorkerd: boolean; +declare const runtimeInfo: RuntimeInfo | undefined; +declare const runtime: RuntimeName; + +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 }; +export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName }; diff --git a/vanilla/node_modules/std-env/dist/index.d.mts b/vanilla/node_modules/std-env/dist/index.d.mts new file mode 100644 index 0000000..451e186 --- /dev/null +++ b/vanilla/node_modules/std-env/dist/index.d.mts @@ -0,0 +1,92 @@ +type EnvObject = Record<string, string | undefined>; +declare const env: EnvObject; +declare const nodeENV: string; + +/** Value of process.platform */ +declare const platform: string; +/** Detect if `CI` environment variable is set or a provider CI detected */ +declare const isCI: boolean; +/** Detect if stdout.TTY is available */ +declare const hasTTY: boolean; +/** Detect if global `window` object is available */ +declare const hasWindow: boolean; +/** Detect if `DEBUG` environment variable is set */ +declare const isDebug: boolean; +/** Detect if `NODE_ENV` environment variable is `test` */ +declare const isTest: boolean; +/** Detect if `NODE_ENV` environment variable is `production` */ +declare const isProduction: boolean; +/** Detect if `NODE_ENV` environment variable is `dev` or `development` */ +declare const isDevelopment: boolean; +/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */ +declare const isMinimal: boolean; +/** Detect if process.platform is Windows */ +declare const isWindows: boolean; +/** Detect if process.platform is Linux */ +declare const isLinux: boolean; +/** Detect if process.platform is macOS (darwin kernel) */ +declare const isMacOS: boolean; +/** Color Support */ +declare const isColorSupported: boolean; +/** Node.js versions */ +declare const nodeVersion: string | null; +declare const nodeMajorVersion: number | null; + +interface Process extends Partial<Omit<typeof globalThis.process, "versions">> { + env: EnvObject; + versions: Record<string, string>; +} +declare const process: Process; + +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"; +type ProviderInfo = { + name: ProviderName; + ci?: boolean; + [meta: string]: any; +}; +/** Current provider info */ +declare const providerInfo: ProviderInfo; +declare const provider: ProviderName; + +type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | ""; +type RuntimeInfo = { + name: RuntimeName; +}; +/** + * Indicates if running in Node.js or a Node.js compatible runtime. + * + * **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. + * + * Use `runtime === "node"` if you need strict check for Node.js runtime. + */ +declare const isNode: boolean; +/** + * Indicates if running in Bun runtime. + */ +declare const isBun: boolean; +/** + * Indicates if running in Deno runtime. + */ +declare const isDeno: boolean; +/** + * Indicates if running in Fastly runtime. + */ +declare const isFastly: boolean; +/** + * Indicates if running in Netlify runtime. + */ +declare const isNetlify: boolean; +/** + * + * Indicates if running in EdgeLight (Vercel Edge) runtime. + */ +declare const isEdgeLight: boolean; +/** + * Indicates if running in Cloudflare Workers runtime. + */ +declare const isWorkerd: boolean; +declare const runtimeInfo: RuntimeInfo | undefined; +declare const runtime: RuntimeName; + +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 }; +export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName }; diff --git a/vanilla/node_modules/std-env/dist/index.d.ts b/vanilla/node_modules/std-env/dist/index.d.ts new file mode 100644 index 0000000..451e186 --- /dev/null +++ b/vanilla/node_modules/std-env/dist/index.d.ts @@ -0,0 +1,92 @@ +type EnvObject = Record<string, string | undefined>; +declare const env: EnvObject; +declare const nodeENV: string; + +/** Value of process.platform */ +declare const platform: string; +/** Detect if `CI` environment variable is set or a provider CI detected */ +declare const isCI: boolean; +/** Detect if stdout.TTY is available */ +declare const hasTTY: boolean; +/** Detect if global `window` object is available */ +declare const hasWindow: boolean; +/** Detect if `DEBUG` environment variable is set */ +declare const isDebug: boolean; +/** Detect if `NODE_ENV` environment variable is `test` */ +declare const isTest: boolean; +/** Detect if `NODE_ENV` environment variable is `production` */ +declare const isProduction: boolean; +/** Detect if `NODE_ENV` environment variable is `dev` or `development` */ +declare const isDevelopment: boolean; +/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */ +declare const isMinimal: boolean; +/** Detect if process.platform is Windows */ +declare const isWindows: boolean; +/** Detect if process.platform is Linux */ +declare const isLinux: boolean; +/** Detect if process.platform is macOS (darwin kernel) */ +declare const isMacOS: boolean; +/** Color Support */ +declare const isColorSupported: boolean; +/** Node.js versions */ +declare const nodeVersion: string | null; +declare const nodeMajorVersion: number | null; + +interface Process extends Partial<Omit<typeof globalThis.process, "versions">> { + env: EnvObject; + versions: Record<string, string>; +} +declare const process: Process; + +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"; +type ProviderInfo = { + name: ProviderName; + ci?: boolean; + [meta: string]: any; +}; +/** Current provider info */ +declare const providerInfo: ProviderInfo; +declare const provider: ProviderName; + +type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | ""; +type RuntimeInfo = { + name: RuntimeName; +}; +/** + * Indicates if running in Node.js or a Node.js compatible runtime. + * + * **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. + * + * Use `runtime === "node"` if you need strict check for Node.js runtime. + */ +declare const isNode: boolean; +/** + * Indicates if running in Bun runtime. + */ +declare const isBun: boolean; +/** + * Indicates if running in Deno runtime. + */ +declare const isDeno: boolean; +/** + * Indicates if running in Fastly runtime. + */ +declare const isFastly: boolean; +/** + * Indicates if running in Netlify runtime. + */ +declare const isNetlify: boolean; +/** + * + * Indicates if running in EdgeLight (Vercel Edge) runtime. + */ +declare const isEdgeLight: boolean; +/** + * Indicates if running in Cloudflare Workers runtime. + */ +declare const isWorkerd: boolean; +declare const runtimeInfo: RuntimeInfo | undefined; +declare const runtime: RuntimeName; + +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 }; +export type { EnvObject, Process, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName }; diff --git a/vanilla/node_modules/std-env/dist/index.mjs b/vanilla/node_modules/std-env/dist/index.mjs new file mode 100644 index 0000000..36e2cf3 --- /dev/null +++ b/vanilla/node_modules/std-env/dist/index.mjs @@ -0,0 +1 @@ +const r=Object.create(null),i=e=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?r:globalThis),o=new Proxy(r,{get(e,s){return i()[s]??r[s]},has(e,s){const E=i();return s in E||s in r},set(e,s,E){const B=i(!0);return B[s]=E,!0},deleteProperty(e,s){if(!s)return!1;const E=i(!0);return delete E[s],!0},ownKeys(){const e=i(!0);return Object.keys(e)}}),t=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",f=[["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 b(){if(globalThis.process?.env)for(const e of f){const s=e[1]||e[0];if(globalThis.process?.env[s])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const l=b(),p=l.name;function n(e){return e?e!=="false":!1}const I=globalThis.process?.platform||"",T=n(o.CI)||l.ci!==!1,R=n(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),U=typeof window<"u",d=n(o.DEBUG),a=t==="test"||n(o.TEST),g=t==="production",h=t==="dev"||t==="development",v=n(o.MINIMAL)||T||a||!R,A=/^win/i.test(I),M=/^linux/i.test(I),m=/^darwin/i.test(I),Y=!n(o.NO_COLOR)&&(n(o.FORCE_COLOR)||(R||A)&&o.TERM!=="dumb"||T),C=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null,V=Number(C?.split(".")[0])||null,W=globalThis.process||Object.create(null),_={versions:{}},y=new Proxy(W,{get(e,s){if(s==="env")return o;if(s in e)return e[s];if(s in _)return _[s]}}),O=globalThis.process?.release?.name==="node",c=!!globalThis.Bun||!!globalThis.process?.versions?.bun,D=!!globalThis.Deno,L=!!globalThis.fastly,S=!!globalThis.Netlify,u=!!globalThis.EdgeRuntime,N=globalThis.navigator?.userAgent==="Cloudflare-Workers",F=[[S,"netlify"],[u,"edge-light"],[N,"workerd"],[L,"fastly"],[D,"deno"],[c,"bun"],[O,"node"]];function G(){const e=F.find(s=>s[0]);if(e)return{name:e[1]}}const P=G(),K=P?.name||"";export{o as env,R as hasTTY,U as hasWindow,c as isBun,T as isCI,Y as isColorSupported,d as isDebug,D as isDeno,h as isDevelopment,u as isEdgeLight,L as isFastly,M as isLinux,m as isMacOS,v as isMinimal,S as isNetlify,O as isNode,g as isProduction,a as isTest,A as isWindows,N as isWorkerd,t as nodeENV,V as nodeMajorVersion,C as nodeVersion,I as platform,y as process,p as provider,l as providerInfo,K as runtime,P as runtimeInfo}; diff --git a/vanilla/node_modules/std-env/package.json b/vanilla/node_modules/std-env/package.json new file mode 100644 index 0000000..0abe132 --- /dev/null +++ b/vanilla/node_modules/std-env/package.json @@ -0,0 +1,46 @@ +{ + "name": "std-env", + "version": "3.10.0", + "description": "Runtime agnostic JS utils", + "repository": "unjs/std-env", + "license": "MIT", + "sideEffects": false, + "type": "module", + "exports": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + }, + "main": "./dist/index.cjs", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "unbuild", + "dev": "vitest", + "lint": "eslint . && prettier -c src test", + "lint:fix": "eslint --fix . && prettier -w src test", + "prepack": "unbuild", + "play:bun": "bun playground/bun.ts", + "play:deno": "pnpm build && deno run -A playground/deno.ts", + "play:node": "pnpm build && node playground/node.mjs", + "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags", + "test": "pnpm lint && pnpm typecheck && vitest run --coverage", + "typecheck": "tsc --noEmit" + }, + "devDependencies": { + "@types/node": "^24.7.2", + "@vitest/coverage-v8": "^3.2.4", + "changelogen": "^0.6.2", + "esbuild": "^0.25.10", + "eslint": "^9.37.0", + "eslint-config-unjs": "^0.5.0", + "prettier": "^3.6.2", + "rollup": "^4.52.4", + "typescript": "^5.9.3", + "unbuild": "^3.6.1", + "vitest": "^3.2.4" + }, + "packageManager": "pnpm@10.18.2" +} |
