std-env 3.3.1 → 3.3.3

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/index.cjs CHANGED
@@ -70,14 +70,14 @@ function detectProvider(env) {
70
70
  const processShim = typeof process !== "undefined" ? process : {};
71
71
  const envShim = processShim.env || {};
72
72
  const providerInfo = detectProvider(envShim);
73
- const nodeENV = envShim.NODE_ENV || "";
73
+ const nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
74
74
  const platform = processShim.platform;
75
75
  const provider = providerInfo.name;
76
76
  const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
77
77
  const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
78
78
  const hasWindow = typeof window !== "undefined";
79
79
  const isDebug = toBoolean(envShim.DEBUG);
80
- const isTest = toBoolean(envShim.TEST);
80
+ const isTest = nodeENV === "test" || toBoolean(envShim.TEST);
81
81
  const isProduction = nodeENV === "production";
82
82
  const isDevelopment = nodeENV === "dev" || nodeENV === "development";
83
83
  const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare type ProviderName = "" | "appveyor" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "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";
2
- declare type ProviderInfo = {
1
+ type ProviderName = "" | "appveyor" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "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";
2
+ type ProviderInfo = {
3
3
  name: ProviderName;
4
4
  [meta: string]: any;
5
5
  };
package/dist/index.mjs CHANGED
@@ -68,14 +68,14 @@ function detectProvider(env) {
68
68
  const processShim = typeof process !== "undefined" ? process : {};
69
69
  const envShim = processShim.env || {};
70
70
  const providerInfo = detectProvider(envShim);
71
- const nodeENV = envShim.NODE_ENV || "";
71
+ const nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
72
72
  const platform = processShim.platform;
73
73
  const provider = providerInfo.name;
74
74
  const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
75
75
  const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
76
76
  const hasWindow = typeof window !== "undefined";
77
77
  const isDebug = toBoolean(envShim.DEBUG);
78
- const isTest = toBoolean(envShim.TEST);
78
+ const isTest = nodeENV === "test" || toBoolean(envShim.TEST);
79
79
  const isProduction = nodeENV === "production";
80
80
  const isDevelopment = nodeENV === "dev" || nodeENV === "development";
81
81
  const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "std-env",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
4
4
  "description": "Detect current Javascript environment",
5
5
  "repository": "unjs/std-env",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
8
8
  "exports": {
9
+ "types": "./dist/index.d.ts",
9
10
  "import": "./dist/index.mjs",
10
11
  "require": "./dist/index.cjs"
11
12
  },
@@ -14,23 +15,26 @@
14
15
  "files": [
15
16
  "dist"
16
17
  ],
17
- "devDependencies": {
18
- "@types/node": "^18.11.9",
19
- "c8": "^7.12.0",
20
- "eslint": "^8.27.0",
21
- "eslint-config-unjs": "^0.0.2",
22
- "jiti": "^1.16.0",
23
- "standard-version": "^9.5.0",
24
- "typescript": "^4.8.4",
25
- "unbuild": "^0.9.4",
26
- "vitest": "^0.25.2"
27
- },
28
- "packageManager": "pnpm@7.13.4",
29
18
  "scripts": {
30
19
  "build": "unbuild",
31
20
  "dev": "vitest",
32
- "lint": "eslint --ext .ts .",
33
- "release": "pnpm test && standard-version && git push --follow-tags && pnpm publish",
34
- "test": "pnpm lint && vitest run"
35
- }
21
+ "lint": "eslint --ext .ts . && prettier -c src test",
22
+ "lint:fix": "eslint --fix --ext .ts . && prettier -w src test",
23
+ "prepack": "unbuild",
24
+ "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
25
+ "test": "pnpm lint && vitest run --coverage"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^18.16.3",
29
+ "@vitest/coverage-c8": "^0.31.0",
30
+ "changelogen": "^0.5.3",
31
+ "eslint": "^8.39.0",
32
+ "eslint-config-unjs": "^0.1.0",
33
+ "jiti": "^1.18.2",
34
+ "prettier": "^2.8.8",
35
+ "typescript": "^5.0.4",
36
+ "unbuild": "^1.2.1",
37
+ "vitest": "^0.31.0"
38
+ },
39
+ "packageManager": "pnpm@8.4.0"
36
40
  }