@stryke/env 0.2.0 → 0.3.0
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/dist/runtime-checks.cjs
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.runtimeInfo = exports.runtime = exports.isWorkerd = exports.isNode = exports.isNetlify = exports.isFastly = exports.isEdgeLight = exports.isDeno = exports.isBun = void 0;
|
|
6
|
+
exports.runtimeInfo = exports.runtime = exports.isWorkerd = exports.isRuntimeServer = exports.isRuntimeClient = exports.isNode = exports.isNetlify = exports.isFastly = exports.isEdgeLight = exports.isDeno = exports.isBun = void 0;
|
|
7
7
|
const isNode = exports.isNode = globalThis.process?.release?.name === "node",
|
|
8
8
|
isBun = exports.isBun = !!globalThis.Bun || !!globalThis.process?.versions?.bun,
|
|
9
9
|
isDeno = exports.isDeno = !!globalThis.Deno,
|
|
10
10
|
isFastly = exports.isFastly = !!globalThis.fastly,
|
|
11
11
|
isNetlify = exports.isNetlify = !!globalThis.Netlify,
|
|
12
12
|
isEdgeLight = exports.isEdgeLight = !!globalThis.EdgeRuntime,
|
|
13
|
-
isWorkerd = exports.isWorkerd = globalThis.navigator?.userAgent === "Cloudflare-Workers"
|
|
14
|
-
|
|
13
|
+
isWorkerd = exports.isWorkerd = globalThis.navigator?.userAgent === "Cloudflare-Workers",
|
|
14
|
+
isRuntimeServer = exports.isRuntimeServer = isNode || isBun || isDeno || isFastly || isNetlify || isEdgeLight || isWorkerd,
|
|
15
|
+
isRuntimeClient = exports.isRuntimeClient = !isRuntimeServer;
|
|
16
|
+
const o = [[isNetlify, "netlify"], [isEdgeLight, "edge-light"], [isWorkerd, "workerd"], [isFastly, "fastly"], [isDeno, "deno"], [isBun, "bun"], [isNode, "node"]];
|
|
15
17
|
function t() {
|
|
16
|
-
const e =
|
|
18
|
+
const e = o.find(n => n[0]);
|
|
17
19
|
if (e) return {
|
|
18
20
|
name: e[1]
|
|
19
21
|
};
|
package/dist/runtime-checks.d.ts
CHANGED
|
@@ -35,5 +35,13 @@ export declare const isEdgeLight: boolean;
|
|
|
35
35
|
* Indicates if running in Cloudflare Workers runtime.
|
|
36
36
|
*/
|
|
37
37
|
export declare const isWorkerd: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates if the code is running on the server-side
|
|
40
|
+
*/
|
|
41
|
+
export declare const isRuntimeServer: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates if the code is running in the browser (and not on the server).
|
|
44
|
+
*/
|
|
45
|
+
export declare const isRuntimeClient: boolean;
|
|
38
46
|
export declare const runtimeInfo: RuntimeInfo | undefined;
|
|
39
47
|
export declare const runtime: RuntimeName;
|
package/dist/runtime-checks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const isNode=globalThis.process?.release?.name==="node",isBun=!!globalThis.Bun||!!globalThis.process?.versions?.bun,isDeno=!!globalThis.Deno,isFastly=!!globalThis.fastly,isNetlify=!!globalThis.Netlify,isEdgeLight=!!globalThis.EdgeRuntime,isWorkerd=globalThis.navigator?.userAgent==="Cloudflare-Workers";const
|
|
1
|
+
export const isNode=globalThis.process?.release?.name==="node",isBun=!!globalThis.Bun||!!globalThis.process?.versions?.bun,isDeno=!!globalThis.Deno,isFastly=!!globalThis.fastly,isNetlify=!!globalThis.Netlify,isEdgeLight=!!globalThis.EdgeRuntime,isWorkerd=globalThis.navigator?.userAgent==="Cloudflare-Workers",isRuntimeServer=isNode||isBun||isDeno||isFastly||isNetlify||isEdgeLight||isWorkerd,isRuntimeClient=!isRuntimeServer;const o=[[isNetlify,"netlify"],[isEdgeLight,"edge-light"],[isWorkerd,"workerd"],[isFastly,"fastly"],[isDeno,"deno"],[isBun,"bun"],[isNode,"node"]];function t(){const e=o.find(n=>n[0]);if(e)return{name:e[1]}}export const runtimeInfo=t(),runtime=runtimeInfo?.name||"";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing utility functions to handle environment specific processes",
|
|
6
6
|
"repository": {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@dotenvx/dotenvx": "1.35.0",
|
|
14
14
|
"defu": "^6.1.4",
|
|
15
|
-
"@stryke/fs": ">=0.1.
|
|
16
|
-
"@stryke/json": ">=0.1.
|
|
17
|
-
"@stryke/path": ">=0.1.
|
|
18
|
-
"@stryke/string-format": ">=0.1.
|
|
19
|
-
"@stryke/types": ">=0.1.
|
|
15
|
+
"@stryke/fs": ">=0.1.5",
|
|
16
|
+
"@stryke/json": ">=0.1.2",
|
|
17
|
+
"@stryke/path": ">=0.1.2",
|
|
18
|
+
"@stryke/string-format": ">=0.1.5",
|
|
19
|
+
"@stryke/types": ">=0.1.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": { "@types/node": "^22.13.1" },
|
|
22
22
|
"publishConfig": { "access": "public" },
|