@stryke/env 0.20.100 → 0.20.102

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 (68) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +0 -14
  3. package/dist/ci-checks.cjs +0 -11
  4. package/dist/ci-checks.mjs +1 -7
  5. package/dist/ci-checks.mjs.map +1 -1
  6. package/dist/environment-checks.cjs +0 -28
  7. package/dist/environment-checks.mjs +1 -23
  8. package/dist/environment-checks.mjs.map +1 -1
  9. package/dist/get-env-paths.cjs +1 -8
  10. package/dist/get-env-paths.mjs +1 -3
  11. package/dist/get-env-paths.mjs.map +1 -1
  12. package/dist/index.cjs +0 -53
  13. package/dist/index.mjs +1 -49
  14. package/dist/load-env.cjs +1 -14
  15. package/dist/load-env.mjs +1 -9
  16. package/dist/load-env.mjs.map +1 -1
  17. package/dist/providers.cjs +1 -12
  18. package/dist/providers.mjs +1 -7
  19. package/dist/providers.mjs.map +1 -1
  20. package/dist/runtime-checks.cjs +1 -21
  21. package/dist/runtime-checks.mjs +1 -16
  22. package/dist/runtime-checks.mjs.map +1 -1
  23. package/dist/types.cjs +1 -9
  24. package/dist/types.mjs +1 -4
  25. package/dist/types.mjs.map +1 -1
  26. package/package.json +6 -38
  27. package/dist/_virtual/_rolldown/runtime.mjs +0 -18
  28. package/dist/ci-checks.test.cjs +0 -13
  29. package/dist/ci-checks.test.d.cts +0 -1
  30. package/dist/ci-checks.test.d.mts +0 -1
  31. package/dist/ci-checks.test.mjs +0 -14
  32. package/dist/ci-checks.test.mjs.map +0 -1
  33. package/dist/environment-checks.test.cjs +0 -13
  34. package/dist/environment-checks.test.d.cts +0 -1
  35. package/dist/environment-checks.test.d.mts +0 -1
  36. package/dist/environment-checks.test.mjs +0 -14
  37. package/dist/environment-checks.test.mjs.map +0 -1
  38. package/dist/get-env-paths.test.cjs +0 -13
  39. package/dist/get-env-paths.test.d.cts +0 -1
  40. package/dist/get-env-paths.test.d.mts +0 -1
  41. package/dist/get-env-paths.test.mjs +0 -14
  42. package/dist/get-env-paths.test.mjs.map +0 -1
  43. package/dist/index.mjs.map +0 -1
  44. package/dist/index.test.cjs +0 -13
  45. package/dist/index.test.d.cts +0 -1
  46. package/dist/index.test.d.mts +0 -1
  47. package/dist/index.test.mjs +0 -14
  48. package/dist/index.test.mjs.map +0 -1
  49. package/dist/load-env.test.cjs +0 -13
  50. package/dist/load-env.test.d.cts +0 -1
  51. package/dist/load-env.test.d.mts +0 -1
  52. package/dist/load-env.test.mjs +0 -14
  53. package/dist/load-env.test.mjs.map +0 -1
  54. package/dist/providers.test.cjs +0 -13
  55. package/dist/providers.test.d.cts +0 -1
  56. package/dist/providers.test.d.mts +0 -1
  57. package/dist/providers.test.mjs +0 -14
  58. package/dist/providers.test.mjs.map +0 -1
  59. package/dist/runtime-checks.test.cjs +0 -13
  60. package/dist/runtime-checks.test.d.cts +0 -1
  61. package/dist/runtime-checks.test.d.mts +0 -1
  62. package/dist/runtime-checks.test.mjs +0 -14
  63. package/dist/runtime-checks.test.mjs.map +0 -1
  64. package/dist/types.test.cjs +0 -13
  65. package/dist/types.test.d.cts +0 -1
  66. package/dist/types.test.d.mts +0 -1
  67. package/dist/types.test.mjs +0 -14
  68. package/dist/types.test.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  # Changelog for Stryke - Env
4
4
 
5
+ ## [0.20.101](https://github.com/storm-software/stryke/releases/tag/env%400.20.101) (06/01/2026)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **monorepo:** Resolve issue causing `.test.ts` files to be included in package ([6fe5e79d](https://github.com/storm-software/stryke/commit/6fe5e79d))
10
+
11
+ ### Updated Dependencies
12
+
13
+ - Updated **convert** to **v0.7.14**
14
+ - Updated **fs** to **v0.33.84**
15
+ - Updated **path** to **v0.29.10**
16
+ - Updated **string-format** to **v0.17.25**
17
+
18
+ ## [0.20.100](https://github.com/storm-software/stryke/releases/tag/env%400.20.100) (06/01/2026)
19
+
20
+ ### Updated Dependencies
21
+
22
+ - Updated **fs** to **v0.33.83**
23
+
5
24
  ## [0.20.99](https://github.com/storm-software/stryke/releases/tag/env%400.20.99) (06/01/2026)
6
25
 
7
26
  ### Miscellaneous
@@ -5,19 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (!no_symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
8
  var __copyProps = (to, from, except, desc) => {
22
9
  if (from && typeof from === "object" || typeof from === "function") {
23
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -39,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
26
 
40
27
  //#endregion
41
28
 
42
- exports.__exportAll = __exportAll;
43
29
  exports.__toESM = __toESM;
@@ -1,11 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
 
4
3
  //#region src/ci-checks.ts
5
- var ci_checks_exports = /* @__PURE__ */ require_runtime.__exportAll({
6
- isCI: () => isCI,
7
- isInteractive: () => isInteractive
8
- });
9
4
  /**
10
5
  * Returns true if the current environment is a CI environment.
11
6
  *
@@ -25,11 +20,5 @@ const isInteractive = (stream = process.stdin) => {
25
20
  };
26
21
 
27
22
  //#endregion
28
- Object.defineProperty(exports, 'ci_checks_exports', {
29
- enumerable: true,
30
- get: function () {
31
- return ci_checks_exports;
32
- }
33
- });
34
23
  exports.isCI = isCI;
35
24
  exports.isInteractive = isInteractive;
@@ -1,10 +1,4 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
-
3
1
  //#region src/ci-checks.ts
4
- var ci_checks_exports = /* @__PURE__ */ __exportAll({
5
- isCI: () => isCI,
6
- isInteractive: () => isInteractive
7
- });
8
2
  /**
9
3
  * Returns true if the current environment is a CI environment.
10
4
  *
@@ -24,5 +18,5 @@ const isInteractive = (stream = process.stdin) => {
24
18
  };
25
19
 
26
20
  //#endregion
27
- export { ci_checks_exports, isCI, isInteractive };
21
+ export { isCI, isInteractive };
28
22
  //# sourceMappingURL=ci-checks.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ci-checks.mjs","names":[],"sources":["../src/ci-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/**\n * Returns true if the current environment is a CI environment.\n *\n * @returns True if the current environment is a CI environment.\n */\nexport const isCI = (\n env: Record<string, string | undefined> = process.env\n): boolean => {\n // From https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61\n // Evaluating at runtime makes it possible to change the values in our tests\n // This list is probably not exhaustive though `process.env.CI` should be enough\n // but since we were using this utility in the past, we want to keep the same behavior\n return Boolean(\n env.STORM_CI || // Custom CI\n env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari\n env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI\n env.BUILD_NUMBER || // Jenkins, TeamCity\n env.RUN_ID || // TaskCluster, dsari\n // From `env` from v4.0.0 https://github.com/watson/ci-info/blob/3e1488e98680f1f776785fe8708a157b7f00e568/vendors.json\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n // See https://github.com/prisma/prisma/issues/22380 for why we commented it out\n // Users deploying on Vercel might have this env var set in the local dev env\n // env.VERCEL ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS ||\n false\n );\n};\n\n// Same logic as https://github.com/sindresorhus/is-interactive/blob/dc8037ae1a61d828cfb42761c345404055b1e036/index.js\n// But defaults to check `stdin` for our prompts\n// It checks that the stream is TTY, not a dumb terminal\n\n/**\n * Check if the current process is interactive\n *\n * @param stream - The stream to check\n * @returns True if the current process is interactive\n */\nexport const isInteractive = (stream = process.stdin): boolean => {\n return Boolean(stream?.isTTY && process.env.TERM !== \"dumb\");\n};\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAa,QACX,MAA0C,QAAQ,QACtC;AAKZ,QAAO,QACL,IAAI,YACJ,IAAI,MACJ,IAAI,0BACJ,IAAI,gBACJ,IAAI,UAEJ,IAAI,iBACJ,IAAI,gBACJ,IAAI,YACJ,IAAI,aACJ,IAAI,YACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,cACJ,IAAI,sBACJ,IAAI,aACJ,IAAI,YACJ,IAAI,aACJ,IAAI,eACJ,IAAI,eACJ,IAAI,WACJ,IAAI,SACJ,IAAI,SACJ,IAAI,cACJ,IAAI,aACJ,IAAI,kBACJ,IAAI,iBACJ,IAAI,kBACJ,IAAI,aACJ,IAAI,QACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,eACJ,IAAI,YACJ,IAAI,WACJ,IAAI,UACJ,IAAI,WACJ,IAAI,aACJ,IAAI,eACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,UACJ,IAAI,UACJ,IAAI,eACJ,IAAI,YACJ,IAAI,eACJ,IAAI,aACJ,IAAI,aACJ,IAAI,WACJ,IAAI,WACJ,IAAI,UACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,QACJ,IAAI,eAIJ,IAAI,sBACJ,IAAI,oBACJ,IAAI,OACJ,MACD;;;;;;;;AAaH,MAAa,iBAAiB,SAAS,QAAQ,UAAmB;AAChE,QAAO,QAAQ,QAAQ,SAAS,QAAQ,IAAI,SAAS,OAAO"}
1
+ {"version":3,"file":"ci-checks.mjs","names":[],"sources":["../src/ci-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/**\n * Returns true if the current environment is a CI environment.\n *\n * @returns True if the current environment is a CI environment.\n */\nexport const isCI = (\n env: Record<string, string | undefined> = process.env\n): boolean => {\n // From https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61\n // Evaluating at runtime makes it possible to change the values in our tests\n // This list is probably not exhaustive though `process.env.CI` should be enough\n // but since we were using this utility in the past, we want to keep the same behavior\n return Boolean(\n env.STORM_CI || // Custom CI\n env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari\n env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI\n env.BUILD_NUMBER || // Jenkins, TeamCity\n env.RUN_ID || // TaskCluster, dsari\n // From `env` from v4.0.0 https://github.com/watson/ci-info/blob/3e1488e98680f1f776785fe8708a157b7f00e568/vendors.json\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n // See https://github.com/prisma/prisma/issues/22380 for why we commented it out\n // Users deploying on Vercel might have this env var set in the local dev env\n // env.VERCEL ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS ||\n false\n );\n};\n\n// Same logic as https://github.com/sindresorhus/is-interactive/blob/dc8037ae1a61d828cfb42761c345404055b1e036/index.js\n// But defaults to check `stdin` for our prompts\n// It checks that the stream is TTY, not a dumb terminal\n\n/**\n * Check if the current process is interactive\n *\n * @param stream - The stream to check\n * @returns True if the current process is interactive\n */\nexport const isInteractive = (stream = process.stdin): boolean => {\n return Boolean(stream?.isTTY && process.env.TERM !== \"dumb\");\n};\n"],"mappings":";;;;;;AAuBA,MAAa,QACX,MAA0C,QAAQ,QACtC;AAKZ,QAAO,QACL,IAAI,YACJ,IAAI,MACJ,IAAI,0BACJ,IAAI,gBACJ,IAAI,UAEJ,IAAI,iBACJ,IAAI,gBACJ,IAAI,YACJ,IAAI,aACJ,IAAI,YACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,cACJ,IAAI,sBACJ,IAAI,aACJ,IAAI,YACJ,IAAI,aACJ,IAAI,eACJ,IAAI,eACJ,IAAI,WACJ,IAAI,SACJ,IAAI,SACJ,IAAI,cACJ,IAAI,aACJ,IAAI,kBACJ,IAAI,iBACJ,IAAI,kBACJ,IAAI,aACJ,IAAI,QACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,eACJ,IAAI,YACJ,IAAI,WACJ,IAAI,UACJ,IAAI,WACJ,IAAI,aACJ,IAAI,eACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,UACJ,IAAI,UACJ,IAAI,eACJ,IAAI,YACJ,IAAI,eACJ,IAAI,aACJ,IAAI,aACJ,IAAI,WACJ,IAAI,WACJ,IAAI,UACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,QACJ,IAAI,eAIJ,IAAI,sBACJ,IAAI,oBACJ,IAAI,OACJ,MACD;;;;;;;;AAaH,MAAa,iBAAiB,SAAS,QAAQ,UAAmB;AAChE,QAAO,QAAQ,QAAQ,SAAS,QAAQ,IAAI,SAAS,OAAO"}
@@ -1,29 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_ci_checks = require('./ci-checks.cjs');
4
3
 
5
4
  //#region src/environment-checks.ts
6
- var environment_checks_exports = /* @__PURE__ */ require_runtime.__exportAll({
7
- hasTTY: () => hasTTY,
8
- isColorSupported: () => isColorSupported,
9
- isDebug: () => isDebug,
10
- isDevelopment: () => isDevelopment,
11
- isDevelopmentMode: () => isDevelopmentMode,
12
- isHyperlinkSupported: () => isHyperlinkSupported,
13
- isLinux: () => isLinux,
14
- isMacOS: () => isMacOS,
15
- isMinimal: () => isMinimal,
16
- isProduction: () => isProduction,
17
- isProductionMode: () => isProductionMode,
18
- isStaging: () => isStaging,
19
- isTest: () => isTest,
20
- isTestMode: () => isTestMode,
21
- isWindows: () => isWindows,
22
- nodeMajorVersion: () => nodeMajorVersion,
23
- nodeVersion: () => nodeVersion,
24
- platform: () => platform,
25
- toMode: () => toMode
26
- });
27
5
  /** Value of process.platform */
28
6
  const platform = process?.platform || "";
29
7
  /** Detect if stdout.TTY is available */
@@ -171,12 +149,6 @@ const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
171
149
  const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
172
150
 
173
151
  //#endregion
174
- Object.defineProperty(exports, 'environment_checks_exports', {
175
- enumerable: true,
176
- get: function () {
177
- return environment_checks_exports;
178
- }
179
- });
180
152
  exports.hasTTY = hasTTY;
181
153
  exports.isColorSupported = isColorSupported;
182
154
  exports.isDebug = isDebug;
@@ -1,28 +1,6 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
1
  import { isCI } from "./ci-checks.mjs";
3
2
 
4
3
  //#region src/environment-checks.ts
5
- var environment_checks_exports = /* @__PURE__ */ __exportAll({
6
- hasTTY: () => hasTTY,
7
- isColorSupported: () => isColorSupported,
8
- isDebug: () => isDebug,
9
- isDevelopment: () => isDevelopment,
10
- isDevelopmentMode: () => isDevelopmentMode,
11
- isHyperlinkSupported: () => isHyperlinkSupported,
12
- isLinux: () => isLinux,
13
- isMacOS: () => isMacOS,
14
- isMinimal: () => isMinimal,
15
- isProduction: () => isProduction,
16
- isProductionMode: () => isProductionMode,
17
- isStaging: () => isStaging,
18
- isTest: () => isTest,
19
- isTestMode: () => isTestMode,
20
- isWindows: () => isWindows,
21
- nodeMajorVersion: () => nodeMajorVersion,
22
- nodeVersion: () => nodeVersion,
23
- platform: () => platform,
24
- toMode: () => toMode
25
- });
26
4
  /** Value of process.platform */
27
5
  const platform = process?.platform || "";
28
6
  /** Detect if stdout.TTY is available */
@@ -170,5 +148,5 @@ const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
170
148
  const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
171
149
 
172
150
  //#endregion
173
- export { environment_checks_exports, hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform, toMode };
151
+ export { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform, toMode };
174
152
  //# sourceMappingURL=environment-checks.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment-checks.mjs","names":[],"sources":["../src/environment-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\nimport { isCI } from \"./ci-checks\";\n\n/** Value of process.platform */\nexport const platform = process?.platform || \"\";\n\n/** Detect if stdout.TTY is available */\nexport const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);\n\n/** Detect if `DEBUG` environment variable is set */\nexport const isDebug = Boolean(process.env.DEBUG);\n\n/** Detect the `NODE_ENV` environment variable */\nconst mode =\n process.env.STORM_MODE ||\n process.env.NEXT_PUBLIC_VERCEL_ENV ||\n process.env.NODE_ENV ||\n \"production\";\n\n/** Detect if the application is running in a staging environment */\nexport const isStaging = [\"stg\", \"stage\", \"staging\"].includes(\n mode?.toLowerCase()\n);\n\n/**\n * Check if the current environment is production.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is production\n */\nexport function isProductionMode(mode: string) {\n return [\n \"prd\",\n \"prod\",\n \"production\",\n\n \"preprod\",\n\n \"preproduction\",\n \"uat\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `production` */\nexport const isProduction = isProductionMode(mode);\n\n/**\n * Check if the current environment is test.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is test\n */\nexport function isTestMode(mode: string) {\n return [\n \"tst\",\n \"test\",\n \"testing\",\n \"stg\",\n \"stage\",\n \"staging\",\n \"qa\",\n\n \"qualityassurance\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `test` */\nexport const isTest =\n isTestMode(mode) || isStaging || Boolean(process.env.TEST);\n\n/**\n * Check if the current environment is development.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is development\n */\nexport function isDevelopmentMode(mode: string) {\n return [\"dev\", \"development\", \"int\", \"integration\"].includes(\n mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\")\n );\n}\n\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nexport const isDevelopment = isDevelopmentMode(mode) || isDebug;\n\n/**\n * Convert a mode string to a standardized mode value of \"production\", \"development\", or \"test\".\n *\n * @param mode - The mode string to convert.\n * @returns The standardized mode value.\n */\nexport function toMode(mode: string): \"production\" | \"development\" | \"test\" {\n if (isProductionMode(mode)) {\n return \"production\";\n } else if (isTestMode(mode)) {\n return \"test\";\n } else if (isDevelopmentMode(mode)) {\n return \"development\";\n }\n\n return \"production\";\n}\n\n/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */\nexport const isMinimal =\n Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;\n\n/** Detect if process.platform is Windows */\nexport const isWindows = /^win/i.test(platform);\n\n/** Detect if process.platform is Linux */\nexport const isLinux = /^linux/i.test(platform);\n\n/** Detect if process.platform is macOS (darwin kernel) */\nexport const isMacOS = /^darwin/i.test(platform);\n\n/** Color Support */\nexport const isColorSupported =\n !process.env.NO_COLOR &&\n (Boolean(process.env.FORCE_COLOR) ||\n ((hasTTY || isWindows) && process.env.TERM !== \"dumb\") ||\n isCI());\n\nfunction parseVersion(versionString = \"\") {\n if (/^\\d{3,4}$/.test(versionString)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(versionString) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versions = (versionString ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versions[0],\n minor: versions[1],\n patch: versions[2]\n };\n}\n\n/**\n * Check if the current environment supports hyperlinks in the terminal.\n *\n * @param stream - The stream to check for TTY support (default: process.stdout)\n * @returns Whether hyperlinks are supported\n */\nexport function isHyperlinkSupported(\n stream: NodeJS.WriteStream = process.stdout\n): boolean {\n if (process.env.FORCE_HYPERLINK) {\n return !(\n process.env.FORCE_HYPERLINK.length > 0 &&\n Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0\n );\n }\n\n // Netlify does not run a TTY, it does not need `supportsColor` check\n if (process.env.NETLIFY) {\n return true;\n } else if (!isColorSupported) {\n return false;\n } else if (stream && !stream.isTTY) {\n return false;\n } else if (\"WT_SESSION\" in process.env) {\n return true;\n } else if (process.platform === \"win32\") {\n return false;\n } else if (isCI()) {\n return false;\n } else if (process.env.TEAMCITY_VERSION) {\n return false;\n } else if (process.env.TERM_PROGRAM) {\n const version = parseVersion(process.env.TERM_PROGRAM_VERSION);\n\n switch (process.env.TERM_PROGRAM) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n case \"vscode\": {\n // Cursor forked VS Code and supports hyperlinks in 0.x.x\n if (process.env.CURSOR_TRACE_ID) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (process.env.VTE_VERSION) {\n // 0.50.0 was supposed to support hyperlinks, but throws a segfault\n if (process.env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(process.env.VTE_VERSION);\n\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (process.env.TERM === \"alacritty\") {\n return true;\n }\n\n return false;\n}\n\n/** Node.js versions */\nexport const nodeVersion =\n (process?.versions?.node || \"\").replace(/^v/, \"\") || null;\n\nexport const nodeMajorVersion = Number(nodeVersion?.split(\".\")[0]) || null;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,WAAW,SAAS,YAAY;;AAG7C,MAAa,SAAS,QAAQ,SAAS,UAAU,SAAS,OAAO,MAAM;;AAGvE,MAAa,UAAU,QAAQ,QAAQ,IAAI,MAAM;;AAGjD,MAAM,OACJ,QAAQ,IAAI,cACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,YACZ;;AAGF,MAAa,YAAY;CAAC;CAAO;CAAS;CAAU,CAAC,SACnD,MAAM,aAAa,CACpB;;;;;;;AAQD,SAAgB,iBAAiB,MAAc;AAC7C,QAAO;EACL;EACA;EACA;EAEA;EAEA;EACA;EACD,CAAC,SAAS,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAAC;;;AAI1D,MAAa,eAAe,iBAAiB,KAAK;;;;;;;AAQlD,SAAgB,WAAW,MAAc;AACvC,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACD,CAAC,SAAS,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAAC;;;AAI1D,MAAa,SACX,WAAW,KAAK,IAAI,aAAa,QAAQ,QAAQ,IAAI,KAAK;;;;;;;AAQ5D,SAAgB,kBAAkB,MAAc;AAC9C,QAAO;EAAC;EAAO;EAAe;EAAO;EAAc,CAAC,SAClD,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAC7C;;;AAIH,MAAa,gBAAgB,kBAAkB,KAAK,IAAI;;;;;;;AAQxD,SAAgB,OAAO,MAAqD;AAC1E,KAAI,iBAAiB,KAAK,CACxB,QAAO;UACE,WAAW,KAAK,CACzB,QAAO;UACE,kBAAkB,KAAK,CAChC,QAAO;AAGT,QAAO;;;AAIT,MAAa,YACX,QAAQ,QAAQ,IAAI,QAAQ,IAAI,MAAM,IAAI,UAAU,C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U,UAAa,QAAQ,QAAQ;GAExD,KAAK,UACH,QAAO,QAAQ,UAAU,UAAa,QAAQ,SAAS;GAEzD,KAAK;AAEH,QAAI,QAAQ,IAAI,gBACd,QAAO;AAGT,WACE,QAAQ,UAAU,UAClB,QAAQ,UAAU,WACjB,QAAQ,QAAQ,KAAM,QAAQ,UAAU,KAAK,QAAQ,SAAS;GAGnE,KAAK,UACH,QAAO;;;AAKb,KAAI,QAAQ,IAAI,aAAa;AAE3B,MAAI,QAAQ,IAAI,gBAAgB,SAC9B,QAAO;EAGT,MAAM,UAAU,aAAa,QAAQ,IAAI,YAAY;AAErD,SACG,QAAQ,UAAU,UAAa,QAAQ,QAAQ,KAC/C,QAAQ,UAAU,UAAa,QAAQ,SAAS;;AAIrD,KAAI,QAAQ,IAAI,SAAS,YACvB,QAAO;AAGT,QAAO;;;AAIT,MAAa,eACV,SAAS,UAAU,QAAQ,IAAI,QAAQ,MAAM,GAAG,IAAI;AAEvD,MAAa,mBAAmB,OAAO,aAAa,MAAM,IAAI,CAAC,GAAG,IAAI"}
1
+ {"version":3,"file":"environment-checks.mjs","names":[],"sources":["../src/environment-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\nimport { isCI } from \"./ci-checks\";\n\n/** Value of process.platform */\nexport const platform = process?.platform || \"\";\n\n/** Detect if stdout.TTY is available */\nexport const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);\n\n/** Detect if `DEBUG` environment variable is set */\nexport const isDebug = Boolean(process.env.DEBUG);\n\n/** Detect the `NODE_ENV` environment variable */\nconst mode =\n process.env.STORM_MODE ||\n process.env.NEXT_PUBLIC_VERCEL_ENV ||\n process.env.NODE_ENV ||\n \"production\";\n\n/** Detect if the application is running in a staging environment */\nexport const isStaging = [\"stg\", \"stage\", \"staging\"].includes(\n mode?.toLowerCase()\n);\n\n/**\n * Check if the current environment is production.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is production\n */\nexport function isProductionMode(mode: string) {\n return [\n \"prd\",\n \"prod\",\n \"production\",\n\n \"preprod\",\n\n \"preproduction\",\n \"uat\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `production` */\nexport const isProduction = isProductionMode(mode);\n\n/**\n * Check if the current environment is test.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is test\n */\nexport function isTestMode(mode: string) {\n return [\n \"tst\",\n \"test\",\n \"testing\",\n \"stg\",\n \"stage\",\n \"staging\",\n \"qa\",\n\n \"qualityassurance\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `test` */\nexport const isTest =\n isTestMode(mode) || isStaging || Boolean(process.env.TEST);\n\n/**\n * Check if the current environment is development.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is development\n */\nexport function isDevelopmentMode(mode: string) {\n return [\"dev\", \"development\", \"int\", \"integration\"].includes(\n mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\")\n );\n}\n\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nexport const isDevelopment = isDevelopmentMode(mode) || isDebug;\n\n/**\n * Convert a mode string to a standardized mode value of \"production\", \"development\", or \"test\".\n *\n * @param mode - The mode string to convert.\n * @returns The standardized mode value.\n */\nexport function toMode(mode: string): \"production\" | \"development\" | \"test\" {\n if (isProductionMode(mode)) {\n return \"production\";\n } else if (isTestMode(mode)) {\n return \"test\";\n } else if (isDevelopmentMode(mode)) {\n return \"development\";\n }\n\n return \"production\";\n}\n\n/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */\nexport const isMinimal =\n Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;\n\n/** Detect if process.platform is Windows */\nexport const isWindows = /^win/i.test(platform);\n\n/** Detect if process.platform is Linux */\nexport const isLinux = /^linux/i.test(platform);\n\n/** Detect if process.platform is macOS (darwin kernel) */\nexport const isMacOS = /^darwin/i.test(platform);\n\n/** Color Support */\nexport const isColorSupported =\n !process.env.NO_COLOR &&\n (Boolean(process.env.FORCE_COLOR) ||\n ((hasTTY || isWindows) && process.env.TERM !== \"dumb\") ||\n isCI());\n\nfunction parseVersion(versionString = \"\") {\n if (/^\\d{3,4}$/.test(versionString)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(versionString) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versions = (versionString ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versions[0],\n minor: versions[1],\n patch: versions[2]\n };\n}\n\n/**\n * Check if the current environment supports hyperlinks in the terminal.\n *\n * @param stream - The stream to check for TTY support (default: process.stdout)\n * @returns Whether hyperlinks are supported\n */\nexport function isHyperlinkSupported(\n stream: NodeJS.WriteStream = process.stdout\n): boolean {\n if (process.env.FORCE_HYPERLINK) {\n return !(\n process.env.FORCE_HYPERLINK.length > 0 &&\n Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0\n );\n }\n\n // Netlify does not run a TTY, it does not need `supportsColor` check\n if (process.env.NETLIFY) {\n return true;\n } else if (!isColorSupported) {\n return false;\n } else if (stream && !stream.isTTY) {\n return false;\n } else if (\"WT_SESSION\" in process.env) {\n return true;\n } else if (process.platform === \"win32\") {\n return false;\n } else if (isCI()) {\n return false;\n } else if (process.env.TEAMCITY_VERSION) {\n return false;\n } else if (process.env.TERM_PROGRAM) {\n const version = parseVersion(process.env.TERM_PROGRAM_VERSION);\n\n switch (process.env.TERM_PROGRAM) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n case \"vscode\": {\n // Cursor forked VS Code and supports hyperlinks in 0.x.x\n if (process.env.CURSOR_TRACE_ID) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (process.env.VTE_VERSION) {\n // 0.50.0 was supposed to support hyperlinks, but throws a segfault\n if (process.env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(process.env.VTE_VERSION);\n\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (process.env.TERM === \"alacritty\") {\n return true;\n }\n\n return false;\n}\n\n/** Node.js versions */\nexport const nodeVersion =\n (process?.versions?.node || \"\").replace(/^v/, \"\") || null;\n\nexport const nodeMajorVersion = Number(nodeVersion?.split(\".\")[0]) || null;\n"],"mappings":";;;;AAqBA,MAAa,WAAW,SAAS,YAAY;;AAG7C,MAAa,SAAS,QAAQ,SAAS,UAAU,SAAS,OAAO,MAAM;;AAGvE,MAAa,UAAU,QAAQ,QAAQ,IAAI,MAAM;;AAGjD,MAAM,OACJ,QAAQ,IAAI,cACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,YACZ;;AAGF,MAAa,YAAY;CAAC;CAAO;CAAS;CAAU,CAAC,SACnD,MAAM,aAAa,CACpB;;;;;;;AAQD,SAAgB,iBAAiB,MAAc;AAC7C,QAAO;EACL;EACA;EACA;EAEA;EAEA;EACA;EACD,CAAC,SAAS,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAAC;;;AAI1D,MAAa,eAAe,iBAAiB,KAAK;;;;;;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Aa,MAAM,IAAI,CAAC,GAAG,IAAI"}
@@ -8,7 +8,6 @@ let node_path = require("node:path");
8
8
  node_path = require_runtime.__toESM(node_path, 1);
9
9
 
10
10
  //#region src/get-env-paths.ts
11
- var get_env_paths_exports = /* @__PURE__ */ require_runtime.__exportAll({ getEnvPaths: () => getEnvPaths });
12
11
  const homedir = node_os.default.homedir();
13
12
  const tmpdir = node_os.default.tmpdir();
14
13
  const macos = (orgId) => {
@@ -86,10 +85,4 @@ function getEnvPaths(options = {}) {
86
85
  }
87
86
 
88
87
  //#endregion
89
- exports.getEnvPaths = getEnvPaths;
90
- Object.defineProperty(exports, 'get_env_paths_exports', {
91
- enumerable: true,
92
- get: function () {
93
- return get_env_paths_exports;
94
- }
95
- });
88
+ exports.getEnvPaths = getEnvPaths;
@@ -1,11 +1,9 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
1
  import { joinPaths } from "@stryke/path/join-paths";
3
2
  import { titleCase } from "@stryke/string-format/title-case";
4
3
  import os from "node:os";
5
4
  import path from "node:path";
6
5
 
7
6
  //#region src/get-env-paths.ts
8
- var get_env_paths_exports = /* @__PURE__ */ __exportAll({ getEnvPaths: () => getEnvPaths });
9
7
  const homedir = os.homedir();
10
8
  const tmpdir = os.tmpdir();
11
9
  const macos = (orgId) => {
@@ -83,5 +81,5 @@ function getEnvPaths(options = {}) {
83
81
  }
84
82
 
85
83
  //#endregion
86
- export { getEnvPaths, get_env_paths_exports };
84
+ export { getEnvPaths };
87
85
  //# sourceMappingURL=get-env-paths.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-env-paths.mjs","names":[],"sources":["../src/get-env-paths.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\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n// Forked from https://www.npmjs.com/package/env-paths\n\nconst homedir = os.homedir();\nconst tmpdir = os.tmpdir();\n\n/**\n * Options for the `getEnvPaths` function.\n */\nexport interface GetEnvPathsOptions {\n /**\n * The name of the organization\n *\n * @defaultValue \"storm-software\"\n */\n orgId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * For example: `~/ ... /storm-software/Log/<appId>`\n */\n appId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`\n *\n * @remarks\n * If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`\n */\n nestedDir?: string;\n\n /**\n * The suffix to append to the project name.\n *\n * @remarks\n * If `suffix` is `true`, the project name will be suffixed with `\"nodejs\"`.\n *\n * @defaultValue false\n */\n suffix?: string | boolean | null;\n\n /**\n * The root directory of the workspace that is used for determining the `cache` and `tmp` paths if they were not already set by other means.\n */\n workspaceRoot?: string;\n}\n\nexport interface EnvPaths {\n data: string;\n config: string;\n cache: string;\n log: string;\n temp: string;\n}\n\nconst macos = (orgId: string): EnvPaths => {\n const library = joinPaths(homedir, \"Library\");\n\n return {\n data: joinPaths(library, \"Application Support\", orgId),\n config: joinPaths(library, \"Preferences\", orgId),\n cache: joinPaths(library, \"Caches\", orgId),\n log: joinPaths(library, \"Logs\", orgId),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\nconst windows = (orgId: string): EnvPaths => {\n const appData =\n process.env.APPDATA || joinPaths(homedir, \"AppData\", \"Roaming\");\n const localAppData =\n process.env.LOCALAPPDATA || joinPaths(homedir, \"AppData\", \"Local\");\n\n const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\\s+/g, \"\");\n\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n data: joinPaths(localAppData, windowsFormattedOrgId, \"Data\"),\n config: joinPaths(appData, windowsFormattedOrgId, \"Config\"),\n cache: joinPaths(localAppData, \"Cache\", orgId),\n log: joinPaths(localAppData, windowsFormattedOrgId, \"Log\"),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\n// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\nconst linux = (orgId: string): EnvPaths => {\n const username = path.basename(homedir);\n\n return {\n data: joinPaths(\n process.env.XDG_DATA_HOME || joinPaths(homedir, \".local\", \"share\"),\n orgId\n ),\n config: joinPaths(\n process.env.XDG_CONFIG_HOME || joinPaths(homedir, \".config\"),\n orgId\n ),\n cache: joinPaths(\n process.env.XDG_CACHE_HOME || joinPaths(homedir, \".cache\"),\n orgId\n ),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: joinPaths(\n process.env.XDG_STATE_HOME || joinPaths(homedir, \".local\", \"state\"),\n orgId\n ),\n // https://devenv.sh/files-and-variables/#devenv_root\n temp:\n process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR\n ? joinPaths(\n (process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR)!,\n orgId\n )\n : joinPaths(tmpdir, username, orgId)\n };\n};\n\n/**\n * Get paths for storing things like data, config, logs, and cache in the current runtime environment.\n *\n * @remarks\n * On macOS, directories are generally created in `~/Library/Application Support/<name>`.\n * On Windows, directories are generally created in `%AppData%/<name>`.\n * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).\n *\n * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.\n *\n * @param options - Parameters used to determine the specific paths for the current project/runtime environment\n * @returns An object containing the various paths for the runtime environment\n */\nexport function getEnvPaths(options: GetEnvPathsOptions = {}): EnvPaths {\n let orgId = options.orgId || \"storm-software\";\n if (!orgId) {\n throw new Error(\n \"You need to provide an orgId to the `getEnvPaths` function\"\n );\n }\n\n if (options.suffix) {\n // Add suffix to prevent possible conflict with native apps\n orgId += `-${typeof options.suffix === \"string\" ? options.suffix : \"nodejs\"}`;\n }\n\n let result = {} as EnvPaths;\n\n if (process.platform === \"darwin\") {\n result = macos(orgId);\n } else if (process.platform === \"win32\") {\n result = windows(orgId);\n } else {\n result = linux(orgId);\n }\n\n if (process.env.STORM_DATA_DIR) {\n result.data = process.env.STORM_DATA_DIR;\n } else if (process.env.STORM_CONFIG_DIR) {\n result.config = process.env.STORM_CONFIG_DIR;\n } else if (process.env.STORM_CACHE_DIR) {\n result.cache = process.env.STORM_CACHE_DIR;\n } else if (process.env.STORM_LOG_DIR) {\n result.log = process.env.STORM_LOG_DIR;\n } else if (process.env.STORM_TEMP_DIR) {\n result.temp = process.env.STORM_TEMP_DIR;\n }\n\n if (options.workspaceRoot) {\n result.cache ??= joinPaths(\n options.workspaceRoot,\n \"node_modules\",\n \".cache\",\n orgId\n );\n result.temp ??= joinPaths(options.workspaceRoot, \"tmp\", orgId);\n result.log ??= joinPaths(result.temp, \"logs\");\n result.config ??= joinPaths(options.workspaceRoot, \".config\", orgId);\n }\n\n return Object.keys(result).reduce((ret, key) => {\n if (result[key as keyof EnvPaths]) {\n const filePath = result[key as keyof EnvPaths];\n\n ret[key as keyof EnvPaths] =\n options.appId &&\n options.appId !== options.orgId &&\n options.appId !== options.nestedDir\n ? joinPaths(filePath, options.appId)\n : filePath;\n\n if (\n options.nestedDir &&\n options.nestedDir !== options.orgId &&\n options.nestedDir !== options.appId\n ) {\n ret[key as keyof EnvPaths] = joinPaths(\n ret[key as keyof EnvPaths],\n options.nestedDir\n );\n }\n }\n\n return ret;\n }, {} as EnvPaths);\n}\n"],"mappings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AAIL,SAAO;IACN,EAAE,CAAa"}
1
+ {"version":3,"file":"get-env-paths.mjs","names":[],"sources":["../src/get-env-paths.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\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n// Forked from https://www.npmjs.com/package/env-paths\n\nconst homedir = os.homedir();\nconst tmpdir = os.tmpdir();\n\n/**\n * Options for the `getEnvPaths` function.\n */\nexport interface GetEnvPathsOptions {\n /**\n * The name of the organization\n *\n * @defaultValue \"storm-software\"\n */\n orgId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * For example: `~/ ... /storm-software/Log/<appId>`\n */\n appId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`\n *\n * @remarks\n * If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`\n */\n nestedDir?: string;\n\n /**\n * The suffix to append to the project name.\n *\n * @remarks\n * If `suffix` is `true`, the project name will be suffixed with `\"nodejs\"`.\n *\n * @defaultValue false\n */\n suffix?: string | boolean | null;\n\n /**\n * The root directory of the workspace that is used for determining the `cache` and `tmp` paths if they were not already set by other means.\n */\n workspaceRoot?: string;\n}\n\nexport interface EnvPaths {\n data: string;\n config: string;\n cache: string;\n log: string;\n temp: string;\n}\n\nconst macos = (orgId: string): EnvPaths => {\n const library = joinPaths(homedir, \"Library\");\n\n return {\n data: joinPaths(library, \"Application Support\", orgId),\n config: joinPaths(library, \"Preferences\", orgId),\n cache: joinPaths(library, \"Caches\", orgId),\n log: joinPaths(library, \"Logs\", orgId),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\nconst windows = (orgId: string): EnvPaths => {\n const appData =\n process.env.APPDATA || joinPaths(homedir, \"AppData\", \"Roaming\");\n const localAppData =\n process.env.LOCALAPPDATA || joinPaths(homedir, \"AppData\", \"Local\");\n\n const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\\s+/g, \"\");\n\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n data: joinPaths(localAppData, windowsFormattedOrgId, \"Data\"),\n config: joinPaths(appData, windowsFormattedOrgId, \"Config\"),\n cache: joinPaths(localAppData, \"Cache\", orgId),\n log: joinPaths(localAppData, windowsFormattedOrgId, \"Log\"),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\n// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\nconst linux = (orgId: string): EnvPaths => {\n const username = path.basename(homedir);\n\n return {\n data: joinPaths(\n process.env.XDG_DATA_HOME || joinPaths(homedir, \".local\", \"share\"),\n orgId\n ),\n config: joinPaths(\n process.env.XDG_CONFIG_HOME || joinPaths(homedir, \".config\"),\n orgId\n ),\n cache: joinPaths(\n process.env.XDG_CACHE_HOME || joinPaths(homedir, \".cache\"),\n orgId\n ),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: joinPaths(\n process.env.XDG_STATE_HOME || joinPaths(homedir, \".local\", \"state\"),\n orgId\n ),\n // https://devenv.sh/files-and-variables/#devenv_root\n temp:\n process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR\n ? joinPaths(\n (process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR)!,\n orgId\n )\n : joinPaths(tmpdir, username, orgId)\n };\n};\n\n/**\n * Get paths for storing things like data, config, logs, and cache in the current runtime environment.\n *\n * @remarks\n * On macOS, directories are generally created in `~/Library/Application Support/<name>`.\n * On Windows, directories are generally created in `%AppData%/<name>`.\n * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).\n *\n * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.\n *\n * @param options - Parameters used to determine the specific paths for the current project/runtime environment\n * @returns An object containing the various paths for the runtime environment\n */\nexport function getEnvPaths(options: GetEnvPathsOptions = {}): EnvPaths {\n let orgId = options.orgId || \"storm-software\";\n if (!orgId) {\n throw new Error(\n \"You need to provide an orgId to the `getEnvPaths` function\"\n );\n }\n\n if (options.suffix) {\n // Add suffix to prevent possible conflict with native apps\n orgId += `-${typeof options.suffix === \"string\" ? options.suffix : \"nodejs\"}`;\n }\n\n let result = {} as EnvPaths;\n\n if (process.platform === \"darwin\") {\n result = macos(orgId);\n } else if (process.platform === \"win32\") {\n result = windows(orgId);\n } else {\n result = linux(orgId);\n }\n\n if (process.env.STORM_DATA_DIR) {\n result.data = process.env.STORM_DATA_DIR;\n } else if (process.env.STORM_CONFIG_DIR) {\n result.config = process.env.STORM_CONFIG_DIR;\n } else if (process.env.STORM_CACHE_DIR) {\n result.cache = process.env.STORM_CACHE_DIR;\n } else if (process.env.STORM_LOG_DIR) {\n result.log = process.env.STORM_LOG_DIR;\n } else if (process.env.STORM_TEMP_DIR) {\n result.temp = process.env.STORM_TEMP_DIR;\n }\n\n if (options.workspaceRoot) {\n result.cache ??= joinPaths(\n options.workspaceRoot,\n \"node_modules\",\n \".cache\",\n orgId\n );\n result.temp ??= joinPaths(options.workspaceRoot, \"tmp\", orgId);\n result.log ??= joinPaths(result.temp, \"logs\");\n result.config ??= joinPaths(options.workspaceRoot, \".config\", orgId);\n }\n\n return Object.keys(result).reduce((ret, key) => {\n if (result[key as keyof EnvPaths]) {\n const filePath = result[key as keyof EnvPaths];\n\n ret[key as keyof EnvPaths] =\n options.appId &&\n options.appId !== options.orgId &&\n options.appId !== options.nestedDir\n ? joinPaths(filePath, options.appId)\n : filePath;\n\n if (\n options.nestedDir &&\n options.nestedDir !== options.orgId &&\n options.nestedDir !== options.appId\n ) {\n ret[key as keyof EnvPaths] = joinPaths(\n ret[key as keyof EnvPaths],\n options.nestedDir\n );\n }\n }\n\n return ret;\n }, {} as EnvPaths);\n}\n"],"mappings":";;;;;;AAyBA,MAAM,UAAU,GAAG,SAAS;AAC5B,MAAM,SAAS,GAAG,QAAQ;AAsD1B,MAAM,SAAS,UAA4B;CACzC,MAAM,UAAU,UAAU,SAAS,UAAU;AAE7C,QAAO;EACL,MAAM,UAAU,SAAS,uBAAuB,MAAM;EACtD,QAAQ,UAAU,SAAS,eAAe,MAAM;EAChD,OAAO,UAAU,SAAS,UAAU,MAAM;EAC1C,KAAK,UAAU,SAAS,QAAQ,MAAM;EACtC,MAAM,UAAU,QAAQ,MAAM;EAC/B;;AAGH,MAAM,WAAW,UAA4B;CAC3C,MAAM,UACJ,QAAQ,IAAI,WAAW,UAAU,SAAS,WAAW,UAAU;CACjE,MAAM,eACJ,QAAQ,IAAI,gBAAgB,UAAU,SAAS,WAAW,QAAQ;CAEpE,MAAM,wBAAwB,UAAU,MAAM,CAAC,MAAM,CAAC,QAAQ,QAAQ,GAAG;AAEzE,QAAO;EAEL,MAAM,UAAU,cAAc,uBAAuB,OAAO;EAC5D,QAAQ,UAAU,SAAS,uBAAuB,SAAS;EAC3D,OAAO,UAAU,cAAc,SAAS,MAAM;EAC9C,KAAK,UAAU,cAAc,uBAAuB,MAAM;EAC1D,MAAM,UAAU,QAAQ,MAAM;EAC/B;;AAIH,MAAM,SAAS,UAA4B;CACzC,MAAM,WAAW,KAAK,SAAS,QAAQ;AAEvC,QAAO;EACL,MAAM,UACJ,QAAQ,IAAI,iBAAiB,UAAU,SAAS,UAAU,QAAQ,EAClE,MACD;EACD,QAAQ,UACN,QA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C9C,MAAI,OAAO,MAAwB;GACjC,MAAM,WAAW,OAAO;AAExB,OAAI,OACF,QAAQ,SACR,QAAQ,UAAU,QAAQ,SAC1B,QAAQ,UAAU,QAAQ,YACtB,UAAU,UAAU,QAAQ,MAAM,GAClC;AAEN,OACE,QAAQ,aACR,QAAQ,cAAc,QAAQ,SAC9B,QAAQ,cAAc,QAAQ,MAE9B,KAAI,OAAyB,UAC3B,IAAI,MACJ,QAAQ,UACT;;AAIL,SAAO;IACN,EAAE,CAAa"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_ci_checks = require('./ci-checks.cjs');
4
3
  const require_environment_checks = require('./environment-checks.cjs');
5
4
  const require_get_env_paths = require('./get-env-paths.cjs');
@@ -8,52 +7,6 @@ const require_load_env = require('./load-env.cjs');
8
7
  const require_providers = require('./providers.cjs');
9
8
  const require_runtime_checks = require('./runtime-checks.cjs');
10
9
 
11
- //#region src/index.ts
12
- var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
13
- ENV_PREFIXES: () => require_types.ENV_PREFIXES,
14
- getEnvFilesForMode: () => require_load_env.getEnvFilesForMode,
15
- getEnvPaths: () => require_get_env_paths.getEnvPaths,
16
- hasTTY: () => require_environment_checks.hasTTY,
17
- isBun: () => require_runtime_checks.isBun,
18
- isCI: () => require_ci_checks.isCI,
19
- isColorSupported: () => require_environment_checks.isColorSupported,
20
- isDebug: () => require_environment_checks.isDebug,
21
- isDeno: () => require_runtime_checks.isDeno,
22
- isDevelopment: () => require_environment_checks.isDevelopment,
23
- isDevelopmentMode: () => require_environment_checks.isDevelopmentMode,
24
- isEdgeLight: () => require_runtime_checks.isEdgeLight,
25
- isFastly: () => require_runtime_checks.isFastly,
26
- isHyperlinkSupported: () => require_environment_checks.isHyperlinkSupported,
27
- isInteractive: () => require_ci_checks.isInteractive,
28
- isLinux: () => require_environment_checks.isLinux,
29
- isMacOS: () => require_environment_checks.isMacOS,
30
- isMinimal: () => require_environment_checks.isMinimal,
31
- isNetlify: () => require_runtime_checks.isNetlify,
32
- isNode: () => require_runtime_checks.isNode,
33
- isProduction: () => require_environment_checks.isProduction,
34
- isProductionMode: () => require_environment_checks.isProductionMode,
35
- isRuntimeClient: () => require_runtime_checks.isRuntimeClient,
36
- isRuntimeServer: () => require_runtime_checks.isRuntimeServer,
37
- isStaging: () => require_environment_checks.isStaging,
38
- isTest: () => require_environment_checks.isTest,
39
- isTestMode: () => require_environment_checks.isTestMode,
40
- isWindows: () => require_environment_checks.isWindows,
41
- isWorkerd: () => require_runtime_checks.isWorkerd,
42
- loadClientEnv: () => require_load_env.loadClientEnv,
43
- loadEnv: () => require_load_env.loadEnv,
44
- loadEnvFile: () => require_load_env.loadEnvFile,
45
- loadServerEnv: () => require_load_env.loadServerEnv,
46
- nodeMajorVersion: () => require_environment_checks.nodeMajorVersion,
47
- nodeVersion: () => require_environment_checks.nodeVersion,
48
- platform: () => require_environment_checks.platform,
49
- provider: () => require_providers.provider,
50
- providerInfo: () => require_providers.providerInfo,
51
- runtime: () => require_runtime_checks.runtime,
52
- runtimeInfo: () => require_runtime_checks.runtimeInfo,
53
- toMode: () => require_environment_checks.toMode
54
- });
55
-
56
- //#endregion
57
10
  exports.ENV_PREFIXES = require_types.ENV_PREFIXES;
58
11
  exports.getEnvFilesForMode = require_load_env.getEnvFilesForMode;
59
12
  exports.getEnvPaths = require_get_env_paths.getEnvPaths;
@@ -94,10 +47,4 @@ exports.provider = require_providers.provider;
94
47
  exports.providerInfo = require_providers.providerInfo;
95
48
  exports.runtime = require_runtime_checks.runtime;
96
49
  exports.runtimeInfo = require_runtime_checks.runtimeInfo;
97
- Object.defineProperty(exports, 'src_exports', {
98
- enumerable: true,
99
- get: function () {
100
- return src_exports;
101
- }
102
- });
103
50
  exports.toMode = require_environment_checks.toMode;
package/dist/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
1
  import { isCI, isInteractive } from "./ci-checks.mjs";
3
2
  import { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform, toMode } from "./environment-checks.mjs";
4
3
  import { getEnvPaths } from "./get-env-paths.mjs";
@@ -7,51 +6,4 @@ import { getEnvFilesForMode, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv
7
6
  import { provider, providerInfo } from "./providers.mjs";
8
7
  import { isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isRuntimeClient, isRuntimeServer, isWorkerd, runtime, runtimeInfo } from "./runtime-checks.mjs";
9
8
 
10
- //#region src/index.ts
11
- var src_exports = /* @__PURE__ */ __exportAll({
12
- ENV_PREFIXES: () => ENV_PREFIXES,
13
- getEnvFilesForMode: () => getEnvFilesForMode,
14
- getEnvPaths: () => getEnvPaths,
15
- hasTTY: () => hasTTY,
16
- isBun: () => isBun,
17
- isCI: () => isCI,
18
- isColorSupported: () => isColorSupported,
19
- isDebug: () => isDebug,
20
- isDeno: () => isDeno,
21
- isDevelopment: () => isDevelopment,
22
- isDevelopmentMode: () => isDevelopmentMode,
23
- isEdgeLight: () => isEdgeLight,
24
- isFastly: () => isFastly,
25
- isHyperlinkSupported: () => isHyperlinkSupported,
26
- isInteractive: () => isInteractive,
27
- isLinux: () => isLinux,
28
- isMacOS: () => isMacOS,
29
- isMinimal: () => isMinimal,
30
- isNetlify: () => isNetlify,
31
- isNode: () => isNode,
32
- isProduction: () => isProduction,
33
- isProductionMode: () => isProductionMode,
34
- isRuntimeClient: () => isRuntimeClient,
35
- isRuntimeServer: () => isRuntimeServer,
36
- isStaging: () => isStaging,
37
- isTest: () => isTest,
38
- isTestMode: () => isTestMode,
39
- isWindows: () => isWindows,
40
- isWorkerd: () => isWorkerd,
41
- loadClientEnv: () => loadClientEnv,
42
- loadEnv: () => loadEnv,
43
- loadEnvFile: () => loadEnvFile,
44
- loadServerEnv: () => loadServerEnv,
45
- nodeMajorVersion: () => nodeMajorVersion,
46
- nodeVersion: () => nodeVersion,
47
- platform: () => platform,
48
- provider: () => provider,
49
- providerInfo: () => providerInfo,
50
- runtime: () => runtime,
51
- runtimeInfo: () => runtimeInfo,
52
- toMode: () => toMode
53
- });
54
-
55
- //#endregion
56
- export { ENV_PREFIXES, getEnvFilesForMode, getEnvPaths, hasTTY, isBun, isCI, isColorSupported, isDebug, isDeno, isDevelopment, isDevelopmentMode, isEdgeLight, isFastly, isHyperlinkSupported, isInteractive, isLinux, isMacOS, isMinimal, isNetlify, isNode, isProduction, isProductionMode, isRuntimeClient, isRuntimeServer, isStaging, isTest, isTestMode, isWindows, isWorkerd, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv, nodeMajorVersion, nodeVersion, platform, provider, providerInfo, runtime, runtimeInfo, src_exports, toMode };
57
- //# sourceMappingURL=index.mjs.map
9
+ export { ENV_PREFIXES, getEnvFilesForMode, getEnvPaths, hasTTY, isBun, isCI, isColorSupported, isDebug, isDeno, isDevelopment, isDevelopmentMode, isEdgeLight, isFastly, isHyperlinkSupported, isInteractive, isLinux, isMacOS, isMinimal, isNetlify, isNode, isProduction, isProductionMode, isRuntimeClient, isRuntimeServer, isStaging, isTest, isTestMode, isWindows, isWorkerd, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv, nodeMajorVersion, nodeVersion, platform, provider, providerInfo, runtime, runtimeInfo, toMode };
package/dist/load-env.cjs CHANGED
@@ -10,13 +10,6 @@ let defu = require("defu");
10
10
  defu = require_runtime.__toESM(defu, 1);
11
11
 
12
12
  //#region src/load-env.ts
13
- var load_env_exports = /* @__PURE__ */ require_runtime.__exportAll({
14
- getEnvFilesForMode: () => getEnvFilesForMode,
15
- loadClientEnv: () => loadClientEnv,
16
- loadEnv: () => loadEnv,
17
- loadEnvFile: () => loadEnvFile,
18
- loadServerEnv: () => loadServerEnv
19
- });
20
13
  function getEnvFilesForMode(envDir, mode = "production") {
21
14
  return [
22
15
  ".env",
@@ -129,10 +122,4 @@ exports.getEnvFilesForMode = getEnvFilesForMode;
129
122
  exports.loadClientEnv = loadClientEnv;
130
123
  exports.loadEnv = loadEnv;
131
124
  exports.loadEnvFile = loadEnvFile;
132
- exports.loadServerEnv = loadServerEnv;
133
- Object.defineProperty(exports, 'load_env_exports', {
134
- enumerable: true,
135
- get: function () {
136
- return load_env_exports;
137
- }
138
- });
125
+ exports.loadServerEnv = loadServerEnv;
package/dist/load-env.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
1
  import { ENV_PREFIXES } from "./types.mjs";
3
2
  import { joinPaths } from "@stryke/path/join-paths";
4
3
  import { parse } from "@dotenvx/dotenvx";
@@ -8,13 +7,6 @@ import { readFile } from "@stryke/fs/read-file";
8
7
  import defu from "defu";
9
8
 
10
9
  //#region src/load-env.ts
11
- var load_env_exports = /* @__PURE__ */ __exportAll({
12
- getEnvFilesForMode: () => getEnvFilesForMode,
13
- loadClientEnv: () => loadClientEnv,
14
- loadEnv: () => loadEnv,
15
- loadEnvFile: () => loadEnvFile,
16
- loadServerEnv: () => loadServerEnv
17
- });
18
10
  function getEnvFilesForMode(envDir, mode = "production") {
19
11
  return [
20
12
  ".env",
@@ -123,5 +115,5 @@ async function loadServerEnv(envDir, mode) {
123
115
  }
124
116
 
125
117
  //#endregion
126
- export { getEnvFilesForMode, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv, load_env_exports };
118
+ export { getEnvFilesForMode, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv };
127
119
  //# sourceMappingURL=load-env.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-env.mjs","names":[],"sources":["../src/load-env.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\nimport type { DotenvPopulateInput } from \"@dotenvx/dotenvx\";\nimport { parse } from \"@dotenvx/dotenvx\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { DotenvParseOutput } from \"./types\";\nimport { ENV_PREFIXES } from \"./types\";\n\nexport function getEnvFilesForMode(\n envDir: string,\n mode = \"production\"\n): string[] {\n return [\n /** default file */ \".env\",\n /** local file */ \".env.local\",\n /** mode file */ `.env.${mode}`,\n /** mode local file */ `.env.${mode}.local`,\n /** local mode file */ `.env.local.${mode}`\n ].map(file => joinPaths(envDir, file));\n}\n\n/**\n * Load environment variables from a .env file.\n *\n * @param envFile - The path to the .env file.\n * @returns The environment variables.\n */\nexport async function loadEnvFile(\n envFile: string,\n envDir: string | string[] = []\n): Promise<DotenvParseOutput> {\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n return (\n await Promise.all(\n (envDir.length > 0\n ? envDirs.map(envDir => joinPaths(envDir, envFile))\n : [envFile]\n ).map(async envFilePath => {\n if (!existsSync(envFilePath)) {\n return undefined;\n }\n\n return readFile(envFilePath);\n })\n )\n ).reduce((ret, envFileContent) => {\n if (!envFileContent) {\n return ret;\n }\n\n const result = parse(envFileContent, {\n processEnv: { ...process.env } as DotenvPopulateInput,\n privateKey:\n process.env.DOTENV_PRIVATE_KEY || process.env.STORM_PRIVATE_KEY\n });\n\n return defu(result, ret);\n }, {});\n}\n\n/**\n * Load environment variables from .env files.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadEnv(\n envDir: string | string[],\n mode?: string,\n prefix?: string | string[]\n): Promise<DotenvParseOutput> {\n if (mode === \"local\") {\n throw new Error(\n '\"local\" cannot be used as a mode name because it conflicts with ' +\n \"the .local postfix for .env files.\"\n );\n }\n\n const prefixes = toArray(prefix).reduce((ret, pre) => {\n if (!pre) {\n return ret;\n }\n\n if (!ret.includes(pre.endsWith(\"_\") ? pre : `${pre}_`)) {\n ret.push(pre.endsWith(\"_\") ? pre : `${pre}_`);\n }\n if (!ret.includes(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`)) {\n ret.push(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`);\n }\n return ret;\n }, [] as string[]);\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n const env: DotenvParseOutput = {};\n const envFiles = envDirs.reduce((ret, envFilePath) => {\n ret.push(\n ...getEnvFilesForMode(envFilePath, mode).filter(\n envFile => !ret.includes(envFile)\n )\n );\n\n return ret;\n }, [] as string[]);\n\n let envParsed = (\n await Promise.all(\n envFiles.map(async filePath => {\n return loadEnvFile(filePath);\n })\n )\n ).reduce((ret, result) => {\n return defu(result, ret);\n }, {});\n\n // test NODE_ENV override before expand as otherwise process.env.NODE_ENV would override this\n if (envParsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {\n process.env.VITE_USER_NODE_ENV = JSON.stringify(envParsed.NODE_ENV);\n }\n // support BROWSER and BROWSER_ARGS env variables\n if (envParsed.BROWSER && process.env.BROWSER === undefined) {\n process.env.BROWSER = JSON.stringify(envParsed.BROWSER);\n }\n if (envParsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {\n process.env.BROWSER_ARGS = JSON.stringify(envParsed.BROWSER_ARGS);\n }\n\n // let environment variables use each other. make a copy of `process.env` so that we do not mutate the global `process.env`.\n envParsed = defu({ ...process.env }, envParsed);\n if (prefixes.length === 0) {\n return envParsed;\n }\n\n // only keys that start with prefix are exposed to client\n for (const [key, value] of Object.entries(envParsed)) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = String(value);\n }\n }\n\n // check if there are actual env variables starting with VITE_*\n // these are typically provided inline and should be prioritized\n for (const key in process.env) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = process.env[key];\n }\n }\n\n return env;\n}\n\n/**\n * Load environment variables from .env files for a client-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadClientEnv(\n envDir: string | string[],\n mode?: string,\n prefix: string | string[] = ENV_PREFIXES\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode, prefix);\n}\n\n/**\n * Load environment variables from .env files for a server-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @returns The environment variables.\n */\nexport async function loadServerEnv(\n envDir: string | string[],\n mode: string\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBACd,QACA,OAAO,cACG;AACV,QAAO;EACe;EACF;EACD,QAAQ;EACF,QAAQ,KAAK;EACb,cAAc;EACtC,CAAC,KAAI,SAAQ,UAAU,QAAQ,KAAK,CAAC;;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mB,aAAa,KAAK,CAAC,QACvC,YAAW,CAAC,IAAI,SAAS,QAAQ,CAClC,CACF;AAED,SAAO;IACN,EAAE,CAAa;CAElB,IAAI,aACF,MAAM,QAAQ,IACZ,SAAS,IAAI,OAAM,aAAY;AAC7B,SAAO,YAAY,SAAS;GAC5B,CACH,EACD,QAAQ,KAAK,WAAW;AACxB,SAAO,KAAK,QAAQ,IAAI;IACvB,EAAE,CAAC;AAGN,KAAI,UAAU,YAAY,QAAQ,IAAI,uBAAuB,OAC3D,SAAQ,IAAI,qBAAqB,KAAK,UAAU,UAAU,SAAS;AAGrE,KAAI,UAAU,WAAW,QAAQ,IAAI,YAAY,OAC/C,SAAQ,IAAI,UAAU,KAAK,UAAU,UAAU,QAAQ;AAEzD,KAAI,UAAU,gBAAgB,QAAQ,IAAI,iBAAiB,OACzD,SAAQ,IAAI,eAAe,KAAK,UAAU,UAAU,aAAa;AAInE,aAAY,KAAK,EAAE,GAAG,QAAQ,KAAK,EAAE,UAAU;AAC/C,KAAI,SAAS,WAAW,EACtB,QAAO;AAIT,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,CAClD,KAAI,SAAS,MAAK,WAAU,IAAI,WAAW,OAAO,CAAC,CACjD,KAAI,OAAO,OAAO,MAAM;AAM5B,MAAK,MAAM,OAAO,QAAQ,IACxB,KAAI,SAAS,MAAK,WAAU,IAAI,WAAW,OAAO,CAAC,CACjD,KAAI,OAAO,QAAQ,IAAI;AAI3B,QAAO;;;;;;;;;;;;;;;;;AAkBT,eAAsB,cACpB,QACA,MACA,SAA4B,cACA;AAC5B,QAAO,QAAQ,QAAQ,MAAM,OAAO;;;;;;;;;;;;;;;;AAiBtC,eAAsB,cACpB,QACA,MAC4B;AAC5B,QAAO,QAAQ,QAAQ,KAAK"}
1
+ {"version":3,"file":"load-env.mjs","names":[],"sources":["../src/load-env.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\nimport type { DotenvPopulateInput } from \"@dotenvx/dotenvx\";\nimport { parse } from \"@dotenvx/dotenvx\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { DotenvParseOutput } from \"./types\";\nimport { ENV_PREFIXES } from \"./types\";\n\nexport function getEnvFilesForMode(\n envDir: string,\n mode = \"production\"\n): string[] {\n return [\n /** default file */ \".env\",\n /** local file */ \".env.local\",\n /** mode file */ `.env.${mode}`,\n /** mode local file */ `.env.${mode}.local`,\n /** local mode file */ `.env.local.${mode}`\n ].map(file => joinPaths(envDir, file));\n}\n\n/**\n * Load environment variables from a .env file.\n *\n * @param envFile - The path to the .env file.\n * @returns The environment variables.\n */\nexport async function loadEnvFile(\n envFile: string,\n envDir: string | string[] = []\n): Promise<DotenvParseOutput> {\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n return (\n await Promise.all(\n (envDir.length > 0\n ? envDirs.map(envDir => joinPaths(envDir, envFile))\n : [envFile]\n ).map(async envFilePath => {\n if (!existsSync(envFilePath)) {\n return undefined;\n }\n\n return readFile(envFilePath);\n })\n )\n ).reduce((ret, envFileContent) => {\n if (!envFileContent) {\n return ret;\n }\n\n const result = parse(envFileContent, {\n processEnv: { ...process.env } as DotenvPopulateInput,\n privateKey:\n process.env.DOTENV_PRIVATE_KEY || process.env.STORM_PRIVATE_KEY\n });\n\n return defu(result, ret);\n }, {});\n}\n\n/**\n * Load environment variables from .env files.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadEnv(\n envDir: string | string[],\n mode?: string,\n prefix?: string | string[]\n): Promise<DotenvParseOutput> {\n if (mode === \"local\") {\n throw new Error(\n '\"local\" cannot be used as a mode name because it conflicts with ' +\n \"the .local postfix for .env files.\"\n );\n }\n\n const prefixes = toArray(prefix).reduce((ret, pre) => {\n if (!pre) {\n return ret;\n }\n\n if (!ret.includes(pre.endsWith(\"_\") ? pre : `${pre}_`)) {\n ret.push(pre.endsWith(\"_\") ? pre : `${pre}_`);\n }\n if (!ret.includes(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`)) {\n ret.push(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`);\n }\n return ret;\n }, [] as string[]);\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n const env: DotenvParseOutput = {};\n const envFiles = envDirs.reduce((ret, envFilePath) => {\n ret.push(\n ...getEnvFilesForMode(envFilePath, mode).filter(\n envFile => !ret.includes(envFile)\n )\n );\n\n return ret;\n }, [] as string[]);\n\n let envParsed = (\n await Promise.all(\n envFiles.map(async filePath => {\n return loadEnvFile(filePath);\n })\n )\n ).reduce((ret, result) => {\n return defu(result, ret);\n }, {});\n\n // test NODE_ENV override before expand as otherwise process.env.NODE_ENV would override this\n if (envParsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {\n process.env.VITE_USER_NODE_ENV = JSON.stringify(envParsed.NODE_ENV);\n }\n // support BROWSER and BROWSER_ARGS env variables\n if (envParsed.BROWSER && process.env.BROWSER === undefined) {\n process.env.BROWSER = JSON.stringify(envParsed.BROWSER);\n }\n if (envParsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {\n process.env.BROWSER_ARGS = JSON.stringify(envParsed.BROWSER_ARGS);\n }\n\n // let environment variables use each other. make a copy of `process.env` so that we do not mutate the global `process.env`.\n envParsed = defu({ ...process.env }, envParsed);\n if (prefixes.length === 0) {\n return envParsed;\n }\n\n // only keys that start with prefix are exposed to client\n for (const [key, value] of Object.entries(envParsed)) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = String(value);\n }\n }\n\n // check if there are actual env variables starting with VITE_*\n // these are typically provided inline and should be prioritized\n for (const key in process.env) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = process.env[key];\n }\n }\n\n return env;\n}\n\n/**\n * Load environment variables from .env files for a client-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadClientEnv(\n envDir: string | string[],\n mode?: string,\n prefix: string | string[] = ENV_PREFIXES\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode, prefix);\n}\n\n/**\n * Load environment variables from .env files for a server-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @returns The environment variables.\n */\nexport async function loadServerEnv(\n envDir: string | string[],\n mode: string\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode);\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,mBACd,QACA,OAAO,cACG;AACV,QAAO;EACe;EACF;EACD,QAAQ;EACF,QAAQ,KAAK;EACb,cAAc;EACtC,CAAC,KAAI,SAAQ,UAAU,QAAQ,KAAK,CAAC;;;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#region src/providers.ts
5
- var providers_exports = /* @__PURE__ */ require_runtime.__exportAll({
6
- provider: () => provider,
7
- providerInfo: () => providerInfo
8
- });
9
4
  const providers = [
10
5
  ["APPVEYOR"],
11
6
  [
@@ -115,10 +110,4 @@ const provider = providerInfo.name;
115
110
 
116
111
  //#endregion
117
112
  exports.provider = provider;
118
- exports.providerInfo = providerInfo;
119
- Object.defineProperty(exports, 'providers_exports', {
120
- enumerable: true,
121
- get: function () {
122
- return providers_exports;
123
- }
124
- });
113
+ exports.providerInfo = providerInfo;
@@ -1,10 +1,4 @@
1
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
-
3
1
  //#region src/providers.ts
4
- var providers_exports = /* @__PURE__ */ __exportAll({
5
- provider: () => provider,
6
- providerInfo: () => providerInfo
7
- });
8
2
  const providers = [
9
3
  ["APPVEYOR"],
10
4
  [
@@ -113,5 +107,5 @@ const providerInfo = detectProvider();
113
107
  const provider = providerInfo.name;
114
108
 
115
109
  //#endregion
116
- export { provider, providerInfo, providers_exports };
110
+ export { provider, providerInfo };
117
111
  //# sourceMappingURL=providers.mjs.map