std-env 3.1.0 → 3.1.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.
Files changed (2) hide show
  1. package/dist/index.cjs +103 -0
  2. package/package.json +1 -1
package/dist/index.cjs ADDED
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const providers = [
6
+ ["APPVEYOR"],
7
+ ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
8
+ ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
9
+ ["APPCIRCLE", "AC_APPCIRCLE"],
10
+ ["BAMBOO", "bamboo_planKey"],
11
+ ["BITBUCKET", "BITBUCKET_COMMIT"],
12
+ ["BITRISE", "BITRISE_IO"],
13
+ ["BUDDY", "BUDDY_WORKSPACE_ID"],
14
+ ["BUILDKITE"],
15
+ ["CIRCLE", "CIRCLECI"],
16
+ ["CIRRUS", "CIRRUS_CI"],
17
+ ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
18
+ ["CODEFRESH", "CF_BUILD_ID"],
19
+ ["DRONE"],
20
+ ["DRONE", "DRONE_BUILD_EVENT"],
21
+ ["DSARI"],
22
+ ["GITHUB_ACTIONS"],
23
+ ["GITLAB", "GITLAB_CI"],
24
+ ["GITLAB", "CI_MERGE_REQUEST_ID"],
25
+ ["GOCD", "GO_PIPELINE_LABEL"],
26
+ ["LAYERCI"],
27
+ ["HUDSON", "HUDSON_URL"],
28
+ ["JENKINS", "JENKINS_URL"],
29
+ ["MAGNUM"],
30
+ ["NETLIFY"],
31
+ ["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
32
+ ["NEVERCODE"],
33
+ ["RENDER"],
34
+ ["SAIL", "SAILCI"],
35
+ ["SEMAPHORE"],
36
+ ["SCREWDRIVER"],
37
+ ["SHIPPABLE"],
38
+ ["SOLANO", "TDDIUM"],
39
+ ["STRIDER"],
40
+ ["TEAMCITY", "TEAMCITY_VERSION"],
41
+ ["TRAVIS"],
42
+ ["VERCEL", "NOW_BUILDER"],
43
+ ["APPCENTER", "APPCENTER_BUILD_ID"],
44
+ ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
45
+ ["STACKBLITZ"],
46
+ ["STORMKIT"]
47
+ ];
48
+ function detectProvider(env) {
49
+ for (const provider of providers) {
50
+ const envName = provider[1] || provider[0];
51
+ if (env[envName]) {
52
+ return {
53
+ name: provider[0].toLowerCase(),
54
+ ...provider[2]
55
+ };
56
+ }
57
+ }
58
+ if (env.SHELL && env.SHELL === "/bin/jsh") {
59
+ return {
60
+ name: "stackblitz",
61
+ ci: false
62
+ };
63
+ }
64
+ return {
65
+ name: "",
66
+ ci: false
67
+ };
68
+ }
69
+
70
+ const processShim = typeof process !== "undefined" ? process : {};
71
+ const envShim = processShim.env || {};
72
+ const providerInfo = detectProvider(envShim);
73
+ const nodeENV = envShim.NODE_ENV || "";
74
+ const platform = processShim.platform;
75
+ const provider = providerInfo.name;
76
+ const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
77
+ const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
78
+ const hasWindow = typeof window !== "undefined";
79
+ const isDebug = toBoolean(envShim.DEBUG);
80
+ const isTest = toBoolean(envShim.TEST);
81
+ const isProduction = nodeENV === "production";
82
+ const isDevelopment = nodeENV === "dev" || nodeENV === "development";
83
+ const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
84
+ const isWindows = /^win/i.test(platform);
85
+ const isLinux = /^linux/i.test(platform);
86
+ const isMacOS = /^darwin/i.test(platform);
87
+ function toBoolean(val) {
88
+ return val ? val !== "false" : false;
89
+ }
90
+
91
+ exports.hasTTY = hasTTY;
92
+ exports.hasWindow = hasWindow;
93
+ exports.isCI = isCI;
94
+ exports.isDebug = isDebug;
95
+ exports.isDevelopment = isDevelopment;
96
+ exports.isLinux = isLinux;
97
+ exports.isMacOS = isMacOS;
98
+ exports.isMinimal = isMinimal;
99
+ exports.isProduction = isProduction;
100
+ exports.isTest = isTest;
101
+ exports.isWindows = isWindows;
102
+ exports.platform = platform;
103
+ exports.provider = provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "std-env",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Detect current Javascript environment",
5
5
  "repository": "unjs/std-env",
6
6
  "license": "MIT",