@stryke/env 0.20.49 → 0.20.51
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/CHANGELOG.md +16 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/ci-checks.cjs +23 -1
- package/dist/ci-checks.mjs +21 -1
- package/dist/ci-checks.mjs.map +1 -1
- package/dist/convert/src/to-array.cjs +15 -1
- package/dist/convert/src/to-array.mjs +14 -1
- package/dist/convert/src/to-array.mjs.map +1 -1
- package/dist/environment-checks.cjs +156 -1
- package/dist/environment-checks.mjs +139 -1
- package/dist/environment-checks.mjs.map +1 -1
- package/dist/fs/src/exists.cjs +17 -1
- package/dist/fs/src/exists.mjs +15 -1
- package/dist/fs/src/exists.mjs.map +1 -1
- package/dist/fs/src/read-file.cjs +17 -1
- package/dist/fs/src/read-file.mjs +16 -1
- package/dist/fs/src/read-file.mjs.map +1 -1
- package/dist/get-env-paths.cjs +87 -1
- package/dist/get-env-paths.mjs +84 -1
- package/dist/get-env-paths.mjs.map +1 -1
- package/dist/index.cjs +48 -1
- package/dist/index.mjs +9 -1
- package/dist/load-env.cjs +124 -1
- package/dist/load-env.mjs +118 -1
- package/dist/load-env.mjs.map +1 -1
- package/dist/path/src/is-type.cjs +28 -1
- package/dist/path/src/is-type.mjs +28 -1
- package/dist/path/src/is-type.mjs.map +1 -1
- package/dist/path/src/join-paths.cjs +106 -1
- package/dist/path/src/join-paths.mjs +106 -1
- package/dist/path/src/join-paths.mjs.map +1 -1
- package/dist/path/src/regex.cjs +12 -1
- package/dist/path/src/regex.mjs +8 -1
- package/dist/path/src/regex.mjs.map +1 -1
- package/dist/path/src/slash.cjs +15 -1
- package/dist/path/src/slash.mjs +14 -1
- package/dist/path/src/slash.mjs.map +1 -1
- package/dist/providers.cjs +112 -1
- package/dist/providers.mjs +110 -1
- package/dist/providers.mjs.map +1 -1
- package/dist/runtime-checks.cjs +71 -1
- package/dist/runtime-checks.mjs +60 -1
- package/dist/runtime-checks.mjs.map +1 -1
- package/dist/string-format/src/acronyms.cjs +408 -1
- package/dist/string-format/src/acronyms.mjs +407 -1
- package/dist/string-format/src/acronyms.mjs.map +1 -1
- package/dist/string-format/src/articles.cjs +10 -1
- package/dist/string-format/src/articles.mjs +9 -1
- package/dist/string-format/src/articles.mjs.map +1 -1
- package/dist/string-format/src/combine.cjs +15 -1
- package/dist/string-format/src/combine.mjs +14 -1
- package/dist/string-format/src/combine.mjs.map +1 -1
- package/dist/string-format/src/conjunctions.cjs +32 -1
- package/dist/string-format/src/conjunctions.mjs +31 -1
- package/dist/string-format/src/conjunctions.mjs.map +1 -1
- package/dist/string-format/src/decamelize.cjs +14 -1
- package/dist/string-format/src/decamelize.mjs +13 -1
- package/dist/string-format/src/decamelize.mjs.map +1 -1
- package/dist/string-format/src/format-special-cases.cjs +33 -1
- package/dist/string-format/src/format-special-cases.mjs +33 -1
- package/dist/string-format/src/format-special-cases.mjs.map +1 -1
- package/dist/string-format/src/prepositions.cjs +68 -1
- package/dist/string-format/src/prepositions.mjs +67 -1
- package/dist/string-format/src/prepositions.mjs.map +1 -1
- package/dist/string-format/src/special-cases.cjs +53 -1
- package/dist/string-format/src/special-cases.mjs +52 -1
- package/dist/string-format/src/special-cases.mjs.map +1 -1
- package/dist/string-format/src/title-case.cjs +19 -1
- package/dist/string-format/src/title-case.mjs +19 -1
- package/dist/string-format/src/title-case.mjs.map +1 -1
- package/dist/string-format/src/upper-case-first.cjs +17 -1
- package/dist/string-format/src/upper-case-first.mjs +16 -1
- package/dist/string-format/src/upper-case-first.mjs.map +1 -1
- package/dist/types.cjs +13 -1
- package/dist/types.mjs +12 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -6
package/dist/providers.mjs
CHANGED
|
@@ -1,2 +1,111 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/providers.ts
|
|
2
|
+
const providers = [
|
|
3
|
+
["APPVEYOR"],
|
|
4
|
+
[
|
|
5
|
+
"AWS_AMPLIFY",
|
|
6
|
+
"AWS_APP_ID",
|
|
7
|
+
{ ci: true }
|
|
8
|
+
],
|
|
9
|
+
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
10
|
+
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
11
|
+
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
12
|
+
["BAMBOO", "bamboo_planKey"],
|
|
13
|
+
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
14
|
+
["BITRISE", "BITRISE_IO"],
|
|
15
|
+
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
16
|
+
["BUILDKITE"],
|
|
17
|
+
["CIRCLE", "CIRCLECI"],
|
|
18
|
+
["CIRRUS", "CIRRUS_CI"],
|
|
19
|
+
[
|
|
20
|
+
"CLOUDFLARE_PAGES",
|
|
21
|
+
"CF_PAGES",
|
|
22
|
+
{ ci: true }
|
|
23
|
+
],
|
|
24
|
+
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
25
|
+
["CODEFRESH", "CF_BUILD_ID"],
|
|
26
|
+
["DRONE"],
|
|
27
|
+
["DRONE", "DRONE_BUILD_EVENT"],
|
|
28
|
+
["DSARI"],
|
|
29
|
+
["GITHUB_ACTIONS"],
|
|
30
|
+
["GITLAB", "GITLAB_CI"],
|
|
31
|
+
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
32
|
+
["GOCD", "GO_PIPELINE_LABEL"],
|
|
33
|
+
["LAYERCI"],
|
|
34
|
+
["HUDSON", "HUDSON_URL"],
|
|
35
|
+
["JENKINS", "JENKINS_URL"],
|
|
36
|
+
["MAGNUM"],
|
|
37
|
+
["NETLIFY"],
|
|
38
|
+
[
|
|
39
|
+
"NETLIFY",
|
|
40
|
+
"NETLIFY_LOCAL",
|
|
41
|
+
{ ci: false }
|
|
42
|
+
],
|
|
43
|
+
["NEVERCODE"],
|
|
44
|
+
["RENDER"],
|
|
45
|
+
["SAIL", "SAILCI"],
|
|
46
|
+
["SEMAPHORE"],
|
|
47
|
+
["SCREWDRIVER"],
|
|
48
|
+
["SHIPPABLE"],
|
|
49
|
+
["SOLANO", "TDDIUM"],
|
|
50
|
+
["STRIDER"],
|
|
51
|
+
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
52
|
+
["TRAVIS"],
|
|
53
|
+
["VERCEL", "NOW_BUILDER"],
|
|
54
|
+
[
|
|
55
|
+
"VERCEL",
|
|
56
|
+
"VERCEL",
|
|
57
|
+
{ ci: false }
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"VERCEL",
|
|
61
|
+
"VERCEL_ENV",
|
|
62
|
+
{ ci: false }
|
|
63
|
+
],
|
|
64
|
+
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
65
|
+
[
|
|
66
|
+
"CODESANDBOX",
|
|
67
|
+
"CODESANDBOX_SSE",
|
|
68
|
+
{ ci: false }
|
|
69
|
+
],
|
|
70
|
+
["STACKBLITZ"],
|
|
71
|
+
["STORMKIT"],
|
|
72
|
+
["CLEAVR"],
|
|
73
|
+
["ZEABUR"],
|
|
74
|
+
[
|
|
75
|
+
"CODESPHERE",
|
|
76
|
+
"CODESPHERE_APP_ID",
|
|
77
|
+
{ ci: true }
|
|
78
|
+
],
|
|
79
|
+
["RAILWAY", "RAILWAY_PROJECT_ID"],
|
|
80
|
+
["RAILWAY", "RAILWAY_SERVICE_ID"],
|
|
81
|
+
["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
|
|
82
|
+
[
|
|
83
|
+
"FIREBASE_APP_HOSTING",
|
|
84
|
+
"FIREBASE_APP_HOSTING",
|
|
85
|
+
{ ci: true }
|
|
86
|
+
]
|
|
87
|
+
];
|
|
88
|
+
function detectProvider() {
|
|
89
|
+
if (process?.env) for (const provider$1 of providers) {
|
|
90
|
+
const envName = provider$1[1] || provider$1[0];
|
|
91
|
+
if (process?.env[envName]) return {
|
|
92
|
+
name: provider$1[0].toLowerCase(),
|
|
93
|
+
...provider$1[2]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (process?.env?.SHELL === "/bin/jsh" && process?.versions?.webcontainer) return {
|
|
97
|
+
name: "stackblitz",
|
|
98
|
+
ci: false
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
name: "",
|
|
102
|
+
ci: false
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Current provider info */
|
|
106
|
+
const providerInfo = detectProvider();
|
|
107
|
+
const provider = providerInfo.name;
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { provider, providerInfo };
|
|
2
111
|
//# sourceMappingURL=providers.mjs.map
|
package/dist/providers.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.mjs","names":["providers: InternalProvider[]","provider","provider: ProviderName"],"sources":["../src/providers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// Reference: https://github.com/watson/ci-info/blob/v3.2.0/vendors.json\n\nexport type ProviderName =\n | \"\"\n | \"appveyor\"\n | \"aws_amplify\"\n | \"azure_pipelines\"\n | \"azure_static\"\n | \"appcircle\"\n | \"bamboo\"\n | \"bitbucket\"\n | \"bitrise\"\n | \"buddy\"\n | \"buildkite\"\n | \"circle\"\n | \"cirrus\"\n | \"cloudflare_pages\"\n | \"codebuild\"\n | \"codefresh\"\n | \"drone\"\n | \"drone\"\n | \"dsari\"\n | \"github_actions\"\n | \"gitlab\"\n | \"gocd\"\n | \"layerci\"\n | \"hudson\"\n | \"jenkins\"\n | \"magnum\"\n | \"netlify\"\n | \"nevercode\"\n | \"render\"\n | \"sail\"\n | \"semaphore\"\n | \"screwdriver\"\n | \"shippable\"\n | \"solano\"\n | \"strider\"\n | \"teamcity\"\n | \"travis\"\n | \"vercel\"\n | \"appcenter\"\n | \"codesandbox\"\n | \"stackblitz\"\n | \"stormkit\"\n | \"cleavr\"\n | \"zeabur\"\n | \"codesphere\"\n | \"railway\"\n | \"deno-deploy\"\n | \"firebase_app_hosting\";\n\ntype InternalProvider = [\n providerName: Uppercase<ProviderName>,\n envName?: string,\n meta?: Record<string, any>\n];\n\nconst providers: InternalProvider[] = [\n [\"APPVEYOR\"],\n [\"AWS_AMPLIFY\", \"AWS_APP_ID\", { ci: true }],\n [\"AZURE_PIPELINES\", \"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI\"],\n [\"AZURE_STATIC\", \"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN\"],\n [\"APPCIRCLE\", \"AC_APPCIRCLE\"],\n [\"BAMBOO\", \"bamboo_planKey\"],\n [\"BITBUCKET\", \"BITBUCKET_COMMIT\"],\n [\"BITRISE\", \"BITRISE_IO\"],\n [\"BUDDY\", \"BUDDY_WORKSPACE_ID\"],\n [\"BUILDKITE\"],\n [\"CIRCLE\", \"CIRCLECI\"],\n [\"CIRRUS\", \"CIRRUS_CI\"],\n [\"CLOUDFLARE_PAGES\", \"CF_PAGES\", { ci: true }],\n [\"CODEBUILD\", \"CODEBUILD_BUILD_ARN\"],\n [\"CODEFRESH\", \"CF_BUILD_ID\"],\n [\"DRONE\"],\n [\"DRONE\", \"DRONE_BUILD_EVENT\"],\n [\"DSARI\"],\n [\"GITHUB_ACTIONS\"],\n [\"GITLAB\", \"GITLAB_CI\"],\n [\"GITLAB\", \"CI_MERGE_REQUEST_ID\"],\n [\"GOCD\", \"GO_PIPELINE_LABEL\"],\n [\"LAYERCI\"],\n [\"HUDSON\", \"HUDSON_URL\"],\n [\"JENKINS\", \"JENKINS_URL\"],\n [\"MAGNUM\"],\n [\"NETLIFY\"],\n [\"NETLIFY\", \"NETLIFY_LOCAL\", { ci: false }],\n [\"NEVERCODE\"],\n [\"RENDER\"],\n [\"SAIL\", \"SAILCI\"],\n [\"SEMAPHORE\"],\n [\"SCREWDRIVER\"],\n [\"SHIPPABLE\"],\n [\"SOLANO\", \"TDDIUM\"],\n [\"STRIDER\"],\n [\"TEAMCITY\", \"TEAMCITY_VERSION\"],\n [\"TRAVIS\"],\n [\"VERCEL\", \"NOW_BUILDER\"],\n [\"VERCEL\", \"VERCEL\", { ci: false }],\n [\"VERCEL\", \"VERCEL_ENV\", { ci: false }],\n [\"APPCENTER\", \"APPCENTER_BUILD_ID\"],\n [\"CODESANDBOX\", \"CODESANDBOX_SSE\", { ci: false }],\n [\"STACKBLITZ\"],\n [\"STORMKIT\"],\n [\"CLEAVR\"],\n [\"ZEABUR\"],\n [\"CODESPHERE\", \"CODESPHERE_APP_ID\", { ci: true }],\n [\"RAILWAY\", \"RAILWAY_PROJECT_ID\"],\n [\"RAILWAY\", \"RAILWAY_SERVICE_ID\"],\n [\"DENO-DEPLOY\", \"DENO_DEPLOYMENT_ID\"],\n [\"FIREBASE_APP_HOSTING\", \"FIREBASE_APP_HOSTING\", { ci: true }]\n];\n\nexport interface ProviderInfo {\n name: ProviderName;\n ci?: boolean;\n [meta: string]: any;\n}\n\nfunction detectProvider(): ProviderInfo {\n // Based on env\n if (process?.env) {\n for (const provider of providers) {\n const envName = provider[1] || provider[0];\n if (process?.env[envName]) {\n return {\n name: provider[0].toLowerCase(),\n ...(provider[2] as any)\n };\n }\n }\n }\n\n // Stackblitz / Webcontainer\n if (process?.env?.SHELL === \"/bin/jsh\" && process?.versions?.webcontainer) {\n return {\n name: \"stackblitz\",\n ci: false\n };\n }\n\n return {\n name: \"\",\n ci: false\n };\n}\n\n/** Current provider info */\nexport const providerInfo = detectProvider();\nexport const provider: ProviderName = providerInfo.name;\n"],"mappings":"AA4EA,MAAMA,
|
|
1
|
+
{"version":3,"file":"providers.mjs","names":["providers: InternalProvider[]","provider","provider: ProviderName"],"sources":["../src/providers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// Reference: https://github.com/watson/ci-info/blob/v3.2.0/vendors.json\n\nexport type ProviderName =\n | \"\"\n | \"appveyor\"\n | \"aws_amplify\"\n | \"azure_pipelines\"\n | \"azure_static\"\n | \"appcircle\"\n | \"bamboo\"\n | \"bitbucket\"\n | \"bitrise\"\n | \"buddy\"\n | \"buildkite\"\n | \"circle\"\n | \"cirrus\"\n | \"cloudflare_pages\"\n | \"codebuild\"\n | \"codefresh\"\n | \"drone\"\n | \"drone\"\n | \"dsari\"\n | \"github_actions\"\n | \"gitlab\"\n | \"gocd\"\n | \"layerci\"\n | \"hudson\"\n | \"jenkins\"\n | \"magnum\"\n | \"netlify\"\n | \"nevercode\"\n | \"render\"\n | \"sail\"\n | \"semaphore\"\n | \"screwdriver\"\n | \"shippable\"\n | \"solano\"\n | \"strider\"\n | \"teamcity\"\n | \"travis\"\n | \"vercel\"\n | \"appcenter\"\n | \"codesandbox\"\n | \"stackblitz\"\n | \"stormkit\"\n | \"cleavr\"\n | \"zeabur\"\n | \"codesphere\"\n | \"railway\"\n | \"deno-deploy\"\n | \"firebase_app_hosting\";\n\ntype InternalProvider = [\n providerName: Uppercase<ProviderName>,\n envName?: string,\n meta?: Record<string, any>\n];\n\nconst providers: InternalProvider[] = [\n [\"APPVEYOR\"],\n [\"AWS_AMPLIFY\", \"AWS_APP_ID\", { ci: true }],\n [\"AZURE_PIPELINES\", \"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI\"],\n [\"AZURE_STATIC\", \"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN\"],\n [\"APPCIRCLE\", \"AC_APPCIRCLE\"],\n [\"BAMBOO\", \"bamboo_planKey\"],\n [\"BITBUCKET\", \"BITBUCKET_COMMIT\"],\n [\"BITRISE\", \"BITRISE_IO\"],\n [\"BUDDY\", \"BUDDY_WORKSPACE_ID\"],\n [\"BUILDKITE\"],\n [\"CIRCLE\", \"CIRCLECI\"],\n [\"CIRRUS\", \"CIRRUS_CI\"],\n [\"CLOUDFLARE_PAGES\", \"CF_PAGES\", { ci: true }],\n [\"CODEBUILD\", \"CODEBUILD_BUILD_ARN\"],\n [\"CODEFRESH\", \"CF_BUILD_ID\"],\n [\"DRONE\"],\n [\"DRONE\", \"DRONE_BUILD_EVENT\"],\n [\"DSARI\"],\n [\"GITHUB_ACTIONS\"],\n [\"GITLAB\", \"GITLAB_CI\"],\n [\"GITLAB\", \"CI_MERGE_REQUEST_ID\"],\n [\"GOCD\", \"GO_PIPELINE_LABEL\"],\n [\"LAYERCI\"],\n [\"HUDSON\", \"HUDSON_URL\"],\n [\"JENKINS\", \"JENKINS_URL\"],\n [\"MAGNUM\"],\n [\"NETLIFY\"],\n [\"NETLIFY\", \"NETLIFY_LOCAL\", { ci: false }],\n [\"NEVERCODE\"],\n [\"RENDER\"],\n [\"SAIL\", \"SAILCI\"],\n [\"SEMAPHORE\"],\n [\"SCREWDRIVER\"],\n [\"SHIPPABLE\"],\n [\"SOLANO\", \"TDDIUM\"],\n [\"STRIDER\"],\n [\"TEAMCITY\", \"TEAMCITY_VERSION\"],\n [\"TRAVIS\"],\n [\"VERCEL\", \"NOW_BUILDER\"],\n [\"VERCEL\", \"VERCEL\", { ci: false }],\n [\"VERCEL\", \"VERCEL_ENV\", { ci: false }],\n [\"APPCENTER\", \"APPCENTER_BUILD_ID\"],\n [\"CODESANDBOX\", \"CODESANDBOX_SSE\", { ci: false }],\n [\"STACKBLITZ\"],\n [\"STORMKIT\"],\n [\"CLEAVR\"],\n [\"ZEABUR\"],\n [\"CODESPHERE\", \"CODESPHERE_APP_ID\", { ci: true }],\n [\"RAILWAY\", \"RAILWAY_PROJECT_ID\"],\n [\"RAILWAY\", \"RAILWAY_SERVICE_ID\"],\n [\"DENO-DEPLOY\", \"DENO_DEPLOYMENT_ID\"],\n [\"FIREBASE_APP_HOSTING\", \"FIREBASE_APP_HOSTING\", { ci: true }]\n];\n\nexport interface ProviderInfo {\n name: ProviderName;\n ci?: boolean;\n [meta: string]: any;\n}\n\nfunction detectProvider(): ProviderInfo {\n // Based on env\n if (process?.env) {\n for (const provider of providers) {\n const envName = provider[1] || provider[0];\n if (process?.env[envName]) {\n return {\n name: provider[0].toLowerCase(),\n ...(provider[2] as any)\n };\n }\n }\n }\n\n // Stackblitz / Webcontainer\n if (process?.env?.SHELL === \"/bin/jsh\" && process?.versions?.webcontainer) {\n return {\n name: \"stackblitz\",\n ci: false\n };\n }\n\n return {\n name: \"\",\n ci: false\n };\n}\n\n/** Current provider info */\nexport const providerInfo = detectProvider();\nexport const provider: ProviderName = providerInfo.name;\n"],"mappings":";AA4EA,MAAMA,YAAgC;CACpC,CAAC,WAAW;CACZ;EAAC;EAAe;EAAc,EAAE,IAAI,MAAM;EAAC;CAC3C,CAAC,mBAAmB,qCAAqC;CACzD,CAAC,gBAAgB,wCAAwC;CACzD,CAAC,aAAa,eAAe;CAC7B,CAAC,UAAU,iBAAiB;CAC5B,CAAC,aAAa,mBAAmB;CACjC,CAAC,WAAW,aAAa;CACzB,CAAC,SAAS,qBAAqB;CAC/B,CAAC,YAAY;CACb,CAAC,UAAU,WAAW;CACtB,CAAC,UAAU,YAAY;CACvB;EAAC;EAAoB;EAAY,EAAE,IAAI,MAAM;EAAC;CAC9C,CAAC,aAAa,sBAAsB;CACpC,CAAC,aAAa,cAAc;CAC5B,CAAC,QAAQ;CACT,CAAC,SAAS,oBAAoB;CAC9B,CAAC,QAAQ;CACT,CAAC,iBAAiB;CAClB,CAAC,UAAU,YAAY;CACvB,CAAC,UAAU,sBAAsB;CACjC,CAAC,QAAQ,oBAAoB;CAC7B,CAAC,UAAU;CACX,CAAC,UAAU,aAAa;CACxB,CAAC,WAAW,cAAc;CAC1B,CAAC,SAAS;CACV,CAAC,UAAU;CACX;EAAC;EAAW;EAAiB,EAAE,IAAI,OAAO;EAAC;CAC3C,CAAC,YAAY;CACb,CAAC,SAAS;CACV,CAAC,QAAQ,SAAS;CAClB,CAAC,YAAY;CACb,CAAC,cAAc;CACf,CAAC,YAAY;CACb,CAAC,UAAU,SAAS;CACpB,CAAC,UAAU;CACX,CAAC,YAAY,mBAAmB;CAChC,CAAC,SAAS;CACV,CAAC,UAAU,cAAc;CACzB;EAAC;EAAU;EAAU,EAAE,IAAI,OAAO;EAAC;CACnC;EAAC;EAAU;EAAc,EAAE,IAAI,OAAO;EAAC;CACvC,CAAC,aAAa,qBAAqB;CACnC;EAAC;EAAe;EAAmB,EAAE,IAAI,OAAO;EAAC;CACjD,CAAC,aAAa;CACd,CAAC,WAAW;CACZ,CAAC,SAAS;CACV,CAAC,SAAS;CACV;EAAC;EAAc;EAAqB,EAAE,IAAI,MAAM;EAAC;CACjD,CAAC,WAAW,qBAAqB;CACjC,CAAC,WAAW,qBAAqB;CACjC,CAAC,eAAe,qBAAqB;CACrC;EAAC;EAAwB;EAAwB,EAAE,IAAI,MAAM;EAAC;CAC/D;AAQD,SAAS,iBAA+B;AAEtC,KAAI,SAAS,IACX,MAAK,MAAMC,cAAY,WAAW;EAChC,MAAM,UAAUA,WAAS,MAAMA,WAAS;AACxC,MAAI,SAAS,IAAI,SACf,QAAO;GACL,MAAMA,WAAS,GAAG,aAAa;GAC/B,GAAIA,WAAS;GACd;;AAMP,KAAI,SAAS,KAAK,UAAU,cAAc,SAAS,UAAU,aAC3D,QAAO;EACL,MAAM;EACN,IAAI;EACL;AAGH,QAAO;EACL,MAAM;EACN,IAAI;EACL;;;AAIH,MAAa,eAAe,gBAAgB;AAC5C,MAAaC,WAAyB,aAAa"}
|
package/dist/runtime-checks.cjs
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/runtime-checks.ts
|
|
3
|
+
/**
|
|
4
|
+
* Indicates if running in Node.js or a Node.js compatible runtime.
|
|
5
|
+
*
|
|
6
|
+
* **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.
|
|
7
|
+
*
|
|
8
|
+
* Use `runtime === "node"` if you need strict check for Node.js runtime.
|
|
9
|
+
*/
|
|
10
|
+
const isNode = process?.release?.name === "node";
|
|
11
|
+
/**
|
|
12
|
+
* Indicates if running in Bun runtime.
|
|
13
|
+
*/
|
|
14
|
+
const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);
|
|
15
|
+
/**
|
|
16
|
+
* Indicates if running in Deno runtime.
|
|
17
|
+
*/
|
|
18
|
+
const isDeno = Boolean(Deno);
|
|
19
|
+
/**
|
|
20
|
+
* Indicates if running in Fastly runtime.
|
|
21
|
+
*/
|
|
22
|
+
const isFastly = Boolean(fastly);
|
|
23
|
+
/**
|
|
24
|
+
* Indicates if running in Netlify runtime.
|
|
25
|
+
*/
|
|
26
|
+
const isNetlify = Boolean(Netlify);
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
30
|
+
*/
|
|
31
|
+
const isEdgeLight = Boolean(EdgeRuntime);
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if running in Cloudflare Workers runtime.
|
|
34
|
+
*/
|
|
35
|
+
const isWorkerd = navigator?.userAgent === "Cloudflare-Workers";
|
|
36
|
+
/**
|
|
37
|
+
* Indicates if the code is running on the server-side
|
|
38
|
+
*/
|
|
39
|
+
const isRuntimeServer = isNode || isBun || isDeno || isFastly || isNetlify || isEdgeLight || isWorkerd;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates if the code is running in the browser (and not on the server).
|
|
42
|
+
*/
|
|
43
|
+
const isRuntimeClient = !isRuntimeServer;
|
|
44
|
+
const runtimeChecks = [
|
|
45
|
+
[isNetlify, "netlify"],
|
|
46
|
+
[isEdgeLight, "edge-light"],
|
|
47
|
+
[isWorkerd, "workerd"],
|
|
48
|
+
[isFastly, "fastly"],
|
|
49
|
+
[isDeno, "deno"],
|
|
50
|
+
[isBun, "bun"],
|
|
51
|
+
[isNode, "node"]
|
|
52
|
+
];
|
|
53
|
+
function detectRuntime() {
|
|
54
|
+
const detectedRuntime = runtimeChecks.find((check) => check[0]);
|
|
55
|
+
if (detectedRuntime) return { name: detectedRuntime[1] };
|
|
56
|
+
}
|
|
57
|
+
const runtimeInfo = detectRuntime();
|
|
58
|
+
const runtime = runtimeInfo?.name || "";
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.isBun = isBun;
|
|
62
|
+
exports.isDeno = isDeno;
|
|
63
|
+
exports.isEdgeLight = isEdgeLight;
|
|
64
|
+
exports.isFastly = isFastly;
|
|
65
|
+
exports.isNetlify = isNetlify;
|
|
66
|
+
exports.isNode = isNode;
|
|
67
|
+
exports.isRuntimeClient = isRuntimeClient;
|
|
68
|
+
exports.isRuntimeServer = isRuntimeServer;
|
|
69
|
+
exports.isWorkerd = isWorkerd;
|
|
70
|
+
exports.runtime = runtime;
|
|
71
|
+
exports.runtimeInfo = runtimeInfo;
|
package/dist/runtime-checks.mjs
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/runtime-checks.ts
|
|
2
|
+
/**
|
|
3
|
+
* Indicates if running in Node.js or a Node.js compatible runtime.
|
|
4
|
+
*
|
|
5
|
+
* **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.
|
|
6
|
+
*
|
|
7
|
+
* Use `runtime === "node"` if you need strict check for Node.js runtime.
|
|
8
|
+
*/
|
|
9
|
+
const isNode = process?.release?.name === "node";
|
|
10
|
+
/**
|
|
11
|
+
* Indicates if running in Bun runtime.
|
|
12
|
+
*/
|
|
13
|
+
const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);
|
|
14
|
+
/**
|
|
15
|
+
* Indicates if running in Deno runtime.
|
|
16
|
+
*/
|
|
17
|
+
const isDeno = Boolean(Deno);
|
|
18
|
+
/**
|
|
19
|
+
* Indicates if running in Fastly runtime.
|
|
20
|
+
*/
|
|
21
|
+
const isFastly = Boolean(fastly);
|
|
22
|
+
/**
|
|
23
|
+
* Indicates if running in Netlify runtime.
|
|
24
|
+
*/
|
|
25
|
+
const isNetlify = Boolean(Netlify);
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
29
|
+
*/
|
|
30
|
+
const isEdgeLight = Boolean(EdgeRuntime);
|
|
31
|
+
/**
|
|
32
|
+
* Indicates if running in Cloudflare Workers runtime.
|
|
33
|
+
*/
|
|
34
|
+
const isWorkerd = navigator?.userAgent === "Cloudflare-Workers";
|
|
35
|
+
/**
|
|
36
|
+
* Indicates if the code is running on the server-side
|
|
37
|
+
*/
|
|
38
|
+
const isRuntimeServer = isNode || isBun || isDeno || isFastly || isNetlify || isEdgeLight || isWorkerd;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates if the code is running in the browser (and not on the server).
|
|
41
|
+
*/
|
|
42
|
+
const isRuntimeClient = !isRuntimeServer;
|
|
43
|
+
const runtimeChecks = [
|
|
44
|
+
[isNetlify, "netlify"],
|
|
45
|
+
[isEdgeLight, "edge-light"],
|
|
46
|
+
[isWorkerd, "workerd"],
|
|
47
|
+
[isFastly, "fastly"],
|
|
48
|
+
[isDeno, "deno"],
|
|
49
|
+
[isBun, "bun"],
|
|
50
|
+
[isNode, "node"]
|
|
51
|
+
];
|
|
52
|
+
function detectRuntime() {
|
|
53
|
+
const detectedRuntime = runtimeChecks.find((check) => check[0]);
|
|
54
|
+
if (detectedRuntime) return { name: detectedRuntime[1] };
|
|
55
|
+
}
|
|
56
|
+
const runtimeInfo = detectRuntime();
|
|
57
|
+
const runtime = runtimeInfo?.name || "";
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isRuntimeClient, isRuntimeServer, isWorkerd, runtime, runtimeInfo };
|
|
2
61
|
//# sourceMappingURL=runtime-checks.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-checks.mjs","names":["runtimeChecks: [boolean, RuntimeName][]","runtime: RuntimeName"],"sources":["../src/runtime-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName =\n | \"workerd\"\n | \"deno\"\n | \"netlify\"\n | \"node\"\n | \"bun\"\n | \"edge-light\"\n | \"fastly\"\n | \"\";\n\nexport interface RuntimeInfo {\n name: RuntimeName;\n}\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **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.\n *\n * Use `runtime === \"node\"` if you need strict check for Node.js runtime.\n */\nexport const isNode = process?.release?.name === \"node\";\n\n/**\n * Indicates if running in Bun runtime.\n */\nexport const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);\n\n/**\n * Indicates if running in Deno runtime.\n */\nexport const isDeno = Boolean(Deno);\n\n/**\n * Indicates if running in Fastly runtime.\n */\nexport const isFastly = Boolean(fastly);\n\n/**\n * Indicates if running in Netlify runtime.\n */\nexport const isNetlify = Boolean(Netlify);\n\n/**\n *\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nexport const isEdgeLight = Boolean(EdgeRuntime);\n// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n */\nexport const isWorkerd = navigator?.userAgent === \"Cloudflare-Workers\";\n\n/**\n * Indicates if the code is running on the server-side\n */\nexport const isRuntimeServer =\n isNode ||\n isBun ||\n isDeno ||\n isFastly ||\n isNetlify ||\n isEdgeLight ||\n isWorkerd;\n\n/**\n * Indicates if the code is running in the browser (and not on the server).\n */\nexport const isRuntimeClient = !isRuntimeServer;\n\nconst runtimeChecks: [boolean, RuntimeName][] = [\n [isNetlify, \"netlify\"],\n [isEdgeLight, \"edge-light\"],\n [isWorkerd, \"workerd\"],\n [isFastly, \"fastly\"],\n [isDeno, \"deno\"],\n [isBun, \"bun\"],\n [isNode, \"node\"]\n];\n\nfunction detectRuntime(): RuntimeInfo | undefined {\n const detectedRuntime = runtimeChecks.find(check => check[0]);\n\n if (detectedRuntime) {\n const name = detectedRuntime[1];\n\n return { name };\n }\n\n return undefined;\n}\n\nexport const runtimeInfo = detectRuntime();\n\nexport const runtime: RuntimeName = runtimeInfo?.name || \"\";\n"],"mappings":"AAwCA,MAAa,
|
|
1
|
+
{"version":3,"file":"runtime-checks.mjs","names":["runtimeChecks: [boolean, RuntimeName][]","runtime: RuntimeName"],"sources":["../src/runtime-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName =\n | \"workerd\"\n | \"deno\"\n | \"netlify\"\n | \"node\"\n | \"bun\"\n | \"edge-light\"\n | \"fastly\"\n | \"\";\n\nexport interface RuntimeInfo {\n name: RuntimeName;\n}\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **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.\n *\n * Use `runtime === \"node\"` if you need strict check for Node.js runtime.\n */\nexport const isNode = process?.release?.name === \"node\";\n\n/**\n * Indicates if running in Bun runtime.\n */\nexport const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);\n\n/**\n * Indicates if running in Deno runtime.\n */\nexport const isDeno = Boolean(Deno);\n\n/**\n * Indicates if running in Fastly runtime.\n */\nexport const isFastly = Boolean(fastly);\n\n/**\n * Indicates if running in Netlify runtime.\n */\nexport const isNetlify = Boolean(Netlify);\n\n/**\n *\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nexport const isEdgeLight = Boolean(EdgeRuntime);\n// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n */\nexport const isWorkerd = navigator?.userAgent === \"Cloudflare-Workers\";\n\n/**\n * Indicates if the code is running on the server-side\n */\nexport const isRuntimeServer =\n isNode ||\n isBun ||\n isDeno ||\n isFastly ||\n isNetlify ||\n isEdgeLight ||\n isWorkerd;\n\n/**\n * Indicates if the code is running in the browser (and not on the server).\n */\nexport const isRuntimeClient = !isRuntimeServer;\n\nconst runtimeChecks: [boolean, RuntimeName][] = [\n [isNetlify, \"netlify\"],\n [isEdgeLight, \"edge-light\"],\n [isWorkerd, \"workerd\"],\n [isFastly, \"fastly\"],\n [isDeno, \"deno\"],\n [isBun, \"bun\"],\n [isNode, \"node\"]\n];\n\nfunction detectRuntime(): RuntimeInfo | undefined {\n const detectedRuntime = runtimeChecks.find(check => check[0]);\n\n if (detectedRuntime) {\n const name = detectedRuntime[1];\n\n return { name };\n }\n\n return undefined;\n}\n\nexport const runtimeInfo = detectRuntime();\n\nexport const runtime: RuntimeName = runtimeInfo?.name || \"\";\n"],"mappings":";;;;;;;;AAwCA,MAAa,SAAS,SAAS,SAAS,SAAS;;;;AAKjD,MAAa,QAAQ,QAAQ,IAAI,IAAI,QAAQ,SAAS,UAAU,IAAI;;;;AAKpE,MAAa,SAAS,QAAQ,KAAK;;;;AAKnC,MAAa,WAAW,QAAQ,OAAO;;;;AAKvC,MAAa,YAAY,QAAQ,QAAQ;;;;;AAMzC,MAAa,cAAc,QAAQ,YAAY;;;;AAM/C,MAAa,YAAY,WAAW,cAAc;;;;AAKlD,MAAa,kBACX,UACA,SACA,UACA,YACA,aACA,eACA;;;;AAKF,MAAa,kBAAkB,CAAC;AAEhC,MAAMA,gBAA0C;CAC9C,CAAC,WAAW,UAAU;CACtB,CAAC,aAAa,aAAa;CAC3B,CAAC,WAAW,UAAU;CACtB,CAAC,UAAU,SAAS;CACpB,CAAC,QAAQ,OAAO;CAChB,CAAC,OAAO,MAAM;CACd,CAAC,QAAQ,OAAO;CACjB;AAED,SAAS,gBAAyC;CAChD,MAAM,kBAAkB,cAAc,MAAK,UAAS,MAAM,GAAG;AAE7D,KAAI,gBAGF,QAAO,EAAE,MAFI,gBAAgB,IAEd;;AAMnB,MAAa,cAAc,eAAe;AAE1C,MAAaC,UAAuB,aAAa,QAAQ"}
|