@stryke/env 0.20.36 → 0.20.38
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 +18 -0
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/ci-checks.cjs +1 -1
- package/dist/ci-checks.d.cts +19 -2
- package/dist/ci-checks.d.cts.map +1 -0
- package/dist/ci-checks.d.mts +19 -2
- package/dist/ci-checks.d.mts.map +1 -0
- package/dist/ci-checks.mjs +2 -1
- package/dist/ci-checks.mjs.map +1 -0
- package/dist/convert/src/to-array.cjs +1 -0
- package/dist/convert/src/to-array.mjs +2 -0
- package/dist/convert/src/to-array.mjs.map +1 -0
- package/dist/environment-checks.cjs +1 -1
- package/dist/environment-checks.d.cts +59 -2
- package/dist/environment-checks.d.cts.map +1 -0
- package/dist/environment-checks.d.mts +59 -2
- package/dist/environment-checks.d.mts.map +1 -0
- package/dist/environment-checks.mjs +2 -1
- package/dist/environment-checks.mjs.map +1 -0
- package/dist/fs/src/exists.cjs +1 -0
- package/dist/fs/src/exists.mjs +2 -0
- package/dist/fs/src/exists.mjs.map +1 -0
- package/dist/fs/src/read-file.cjs +1 -0
- package/dist/fs/src/read-file.mjs +2 -0
- package/dist/fs/src/read-file.mjs.map +1 -0
- package/dist/get-env-paths.cjs +1 -1
- package/dist/get-env-paths.d.cts +64 -2
- package/dist/get-env-paths.d.cts.map +1 -0
- package/dist/get-env-paths.d.mts +64 -2
- package/dist/get-env-paths.d.mts.map +1 -0
- package/dist/get-env-paths.mjs +2 -1
- package/dist/get-env-paths.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +1 -1
- package/dist/load-env.cjs +1 -1
- package/dist/load-env.d.cts +61 -2
- package/dist/load-env.d.cts.map +1 -0
- package/dist/load-env.d.mts +61 -2
- package/dist/load-env.d.mts.map +1 -0
- package/dist/load-env.mjs +2 -1
- package/dist/load-env.mjs.map +1 -0
- package/dist/path/src/is-type.cjs +1 -0
- package/dist/path/src/is-type.mjs +2 -0
- package/dist/path/src/is-type.mjs.map +1 -0
- package/dist/path/src/join-paths.cjs +1 -0
- package/dist/path/src/join-paths.mjs +2 -0
- package/dist/path/src/join-paths.mjs.map +1 -0
- package/dist/path/src/regex.cjs +1 -0
- package/dist/path/src/regex.mjs +2 -0
- package/dist/path/src/regex.mjs.map +1 -0
- package/dist/path/src/slash.cjs +1 -0
- package/dist/path/src/slash.mjs +2 -0
- package/dist/path/src/slash.mjs.map +1 -0
- package/dist/providers.cjs +1 -1
- package/dist/providers.d.cts +13 -2
- package/dist/providers.d.cts.map +1 -0
- package/dist/providers.d.mts +13 -2
- package/dist/providers.d.mts.map +1 -0
- package/dist/providers.mjs +2 -1
- package/dist/providers.mjs.map +1 -0
- package/dist/runtime-checks.cjs +1 -1
- package/dist/runtime-checks.d.cts +51 -2
- package/dist/runtime-checks.d.cts.map +1 -0
- package/dist/runtime-checks.d.mts +51 -2
- package/dist/runtime-checks.d.mts.map +1 -0
- package/dist/runtime-checks.mjs +2 -1
- package/dist/runtime-checks.mjs.map +1 -0
- package/dist/string-format/src/acronyms.cjs +1 -0
- package/dist/string-format/src/acronyms.mjs +2 -0
- package/dist/string-format/src/acronyms.mjs.map +1 -0
- package/dist/string-format/src/articles.cjs +1 -0
- package/dist/string-format/src/articles.mjs +2 -0
- package/dist/string-format/src/articles.mjs.map +1 -0
- package/dist/string-format/src/combine.cjs +1 -0
- package/dist/string-format/src/combine.mjs +2 -0
- package/dist/string-format/src/combine.mjs.map +1 -0
- package/dist/string-format/src/conjunctions.cjs +1 -0
- package/dist/string-format/src/conjunctions.mjs +2 -0
- package/dist/string-format/src/conjunctions.mjs.map +1 -0
- package/dist/string-format/src/decamelize.cjs +1 -0
- package/dist/string-format/src/decamelize.mjs +2 -0
- package/dist/string-format/src/decamelize.mjs.map +1 -0
- package/dist/string-format/src/format-special-cases.cjs +1 -0
- package/dist/string-format/src/format-special-cases.mjs +2 -0
- package/dist/string-format/src/format-special-cases.mjs.map +1 -0
- package/dist/string-format/src/prepositions.cjs +1 -0
- package/dist/string-format/src/prepositions.mjs +2 -0
- package/dist/string-format/src/prepositions.mjs.map +1 -0
- package/dist/string-format/src/special-cases.cjs +1 -0
- package/dist/string-format/src/special-cases.mjs +2 -0
- package/dist/string-format/src/special-cases.mjs.map +1 -0
- package/dist/string-format/src/title-case.cjs +1 -0
- package/dist/string-format/src/title-case.mjs +2 -0
- package/dist/string-format/src/title-case.mjs.map +1 -0
- package/dist/string-format/src/upper-case-first.cjs +1 -0
- package/dist/string-format/src/upper-case-first.mjs +2 -0
- package/dist/string-format/src/upper-case-first.mjs.map +1 -0
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +8 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +8 -2
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -1
- package/dist/types.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/ci-checks-5v7fZL3R.mjs +0 -2
- package/dist/ci-checks-5v7fZL3R.mjs.map +0 -1
- package/dist/ci-checks-BFAxtIMg.d.mts +0 -19
- package/dist/ci-checks-BFAxtIMg.d.mts.map +0 -1
- package/dist/ci-checks-ByUPPNOk.d.cts +0 -19
- package/dist/ci-checks-ByUPPNOk.d.cts.map +0 -1
- package/dist/ci-checks-DRWFr2UM.cjs +0 -1
- package/dist/environment-checks-BvXEMk0w.d.mts +0 -59
- package/dist/environment-checks-BvXEMk0w.d.mts.map +0 -1
- package/dist/environment-checks-CNP6SBWs.mjs +0 -2
- package/dist/environment-checks-CNP6SBWs.mjs.map +0 -1
- package/dist/environment-checks-TkDPh8QD.d.cts +0 -59
- package/dist/environment-checks-TkDPh8QD.d.cts.map +0 -1
- package/dist/environment-checks-ghgIrof1.cjs +0 -1
- package/dist/get-env-paths-CRQWNX3i.cjs +0 -1
- package/dist/get-env-paths-DReLbhw5.d.cts +0 -64
- package/dist/get-env-paths-DReLbhw5.d.cts.map +0 -1
- package/dist/get-env-paths-DUHBXxwb.mjs +0 -2
- package/dist/get-env-paths-DUHBXxwb.mjs.map +0 -1
- package/dist/get-env-paths-KTCEsWqe.d.mts +0 -64
- package/dist/get-env-paths-KTCEsWqe.d.mts.map +0 -1
- package/dist/join-paths-BMFGURJb.cjs +0 -1
- package/dist/join-paths-DoUrclq3.mjs +0 -2
- package/dist/join-paths-DoUrclq3.mjs.map +0 -1
- package/dist/load-env-B_Q4iLSZ.d.mts +0 -61
- package/dist/load-env-B_Q4iLSZ.d.mts.map +0 -1
- package/dist/load-env-COR_EMlB.cjs +0 -1
- package/dist/load-env-DPtGxfd9.d.cts +0 -61
- package/dist/load-env-DPtGxfd9.d.cts.map +0 -1
- package/dist/load-env-DUjj4KN6.mjs +0 -2
- package/dist/load-env-DUjj4KN6.mjs.map +0 -1
- package/dist/providers-B2d_hJW2.d.mts +0 -13
- package/dist/providers-B2d_hJW2.d.mts.map +0 -1
- package/dist/providers-B9xVKxf9.cjs +0 -1
- package/dist/providers-BUdbSP8f.mjs +0 -2
- package/dist/providers-BUdbSP8f.mjs.map +0 -1
- package/dist/providers-YKl7K1Ek.d.cts +0 -13
- package/dist/providers-YKl7K1Ek.d.cts.map +0 -1
- package/dist/runtime-checks-Bka6c_Kr.d.mts +0 -51
- package/dist/runtime-checks-Bka6c_Kr.d.mts.map +0 -1
- package/dist/runtime-checks-DGhXcN9g.mjs +0 -2
- package/dist/runtime-checks-DGhXcN9g.mjs.map +0 -1
- package/dist/runtime-checks-Dc2IKXYE.d.cts +0 -51
- package/dist/runtime-checks-Dc2IKXYE.d.cts.map +0 -1
- package/dist/runtime-checks-NIf4Bpj9.cjs +0 -1
- package/dist/types-2O6mBvGZ.cjs +0 -1
- package/dist/types-D7S9q0_s.d.mts +0 -8
- package/dist/types-D7S9q0_s.d.mts.map +0 -1
- package/dist/types-DJpwQAko.d.cts +0 -8
- package/dist/types-DJpwQAko.d.cts.map +0 -1
- package/dist/types-ULysAnV9.mjs +0 -2
- package/dist/types-ULysAnV9.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - Env
|
|
4
4
|
|
|
5
|
+
## [0.20.37](https://github.com/storm-software/stryke/releases/tag/env%400.20.37) (12/08/2025)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **string-format** to **v0.12.24**
|
|
10
|
+
- Updated **convert** to **v0.6.24**
|
|
11
|
+
- Updated **path** to **v0.22.11**
|
|
12
|
+
- Updated **fs** to **v0.33.20**
|
|
13
|
+
|
|
14
|
+
## [0.20.36](https://github.com/storm-software/stryke/releases/tag/env%400.20.36) (12/08/2025)
|
|
15
|
+
|
|
16
|
+
### Updated Dependencies
|
|
17
|
+
|
|
18
|
+
- Updated **string-format** to **v0.12.23**
|
|
19
|
+
- Updated **convert** to **v0.6.23**
|
|
20
|
+
- Updated **path** to **v0.22.10**
|
|
21
|
+
- Updated **fs** to **v0.33.19**
|
|
22
|
+
|
|
5
23
|
## [0.20.35](https://github.com/storm-software/stryke/releases/tag/env%400.20.35) (12/08/2025)
|
|
6
24
|
|
|
7
25
|
### Updated Dependencies
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/ci-checks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=
|
|
1
|
+
const e=(e=process.env)=>!!(e.STORM_CI||e.CI||e.CONTINUOUS_INTEGRATION||e.BUILD_NUMBER||e.RUN_ID||e.AGOLA_GIT_REF||e.AC_APPCIRCLE||e.APPVEYOR||e.CODEBUILD||e.TF_BUILD||e.bamboo_planKey||e.BITBUCKET_COMMIT||e.BITRISE_IO||e.BUDDY_WORKSPACE_ID||e.BUILDKITE||e.CIRCLECI||e.CIRRUS_CI||e.CF_BUILD_ID||e.CM_BUILD_ID||e.CI_NAME||e.DRONE||e.DSARI||e.EARTHLY_CI||e.EAS_BUILD||e.GERRIT_PROJECT||e.GITEA_ACTIONS||e.GITHUB_ACTIONS||e.GITLAB_CI||e.GOCD||e.BUILDER_OUTPUT||e.HARNESS_BUILD_ID||e.JENKINS_URL||e.BUILD_ID||e.LAYERCI||e.MAGNUM||e.NETLIFY||e.NEVERCODE||e.PROW_JOB_ID||e.RELEASE_BUILD_ID||e.RENDER||e.SAILCI||e.HUDSON||e.JENKINS_URL||e.BUILD_ID||e.SCREWDRIVER||e.SEMAPHORE||e.SOURCEHUT||e.STRIDER||e.TASK_ID||e.RUN_ID||e.TEAMCITY_VERSION||e.TRAVIS||e.VELA||e.NOW_BUILDER||e.APPCENTER_BUILD_ID||e.CI_XCODE_PROJECT||e.XCS),t=(e=process.stdin)=>!!(e?.isTTY&&process.env.TERM!==`dumb`);exports.isCI=e,exports.isInteractive=t;
|
package/dist/ci-checks.d.cts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/ci-checks.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the current environment is a CI environment.
|
|
4
|
+
*
|
|
5
|
+
* @returns True if the current environment is a CI environment.
|
|
6
|
+
*/
|
|
7
|
+
declare const isCI: (env?: Record<string, string | undefined>) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the current process is interactive
|
|
10
|
+
*
|
|
11
|
+
* @param stream - The stream to check
|
|
12
|
+
* @returns True if the current process is interactive
|
|
13
|
+
*/
|
|
14
|
+
declare const isInteractive: (stream?: NodeJS.ReadStream & {
|
|
15
|
+
fd: 0;
|
|
16
|
+
}) => boolean;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isCI, isInteractive };
|
|
19
|
+
//# sourceMappingURL=ci-checks.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-checks.d.cts","names":[],"sources":["../src/ci-checks.ts"],"sourcesContent":[],"mappings":";;AAuBA;AAmFA;;;cAnFa,aACN;;;;;;;cAkFM,yBAAiB,MAAA,CAAA"}
|
package/dist/ci-checks.d.mts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/ci-checks.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the current environment is a CI environment.
|
|
4
|
+
*
|
|
5
|
+
* @returns True if the current environment is a CI environment.
|
|
6
|
+
*/
|
|
7
|
+
declare const isCI: (env?: Record<string, string | undefined>) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the current process is interactive
|
|
10
|
+
*
|
|
11
|
+
* @param stream - The stream to check
|
|
12
|
+
* @returns True if the current process is interactive
|
|
13
|
+
*/
|
|
14
|
+
declare const isInteractive: (stream?: NodeJS.ReadStream & {
|
|
15
|
+
fd: 0;
|
|
16
|
+
}) => boolean;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isCI, isInteractive };
|
|
19
|
+
//# sourceMappingURL=ci-checks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-checks.d.mts","names":[],"sources":["../src/ci-checks.ts"],"sourcesContent":[],"mappings":";;AAuBA;AAmFA;;;cAnFa,aACN;;;;;;;cAkFM,yBAAiB,MAAA,CAAA"}
|
package/dist/ci-checks.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=(e=process.env)=>!!(e.STORM_CI||e.CI||e.CONTINUOUS_INTEGRATION||e.BUILD_NUMBER||e.RUN_ID||e.AGOLA_GIT_REF||e.AC_APPCIRCLE||e.APPVEYOR||e.CODEBUILD||e.TF_BUILD||e.bamboo_planKey||e.BITBUCKET_COMMIT||e.BITRISE_IO||e.BUDDY_WORKSPACE_ID||e.BUILDKITE||e.CIRCLECI||e.CIRRUS_CI||e.CF_BUILD_ID||e.CM_BUILD_ID||e.CI_NAME||e.DRONE||e.DSARI||e.EARTHLY_CI||e.EAS_BUILD||e.GERRIT_PROJECT||e.GITEA_ACTIONS||e.GITHUB_ACTIONS||e.GITLAB_CI||e.GOCD||e.BUILDER_OUTPUT||e.HARNESS_BUILD_ID||e.JENKINS_URL||e.BUILD_ID||e.LAYERCI||e.MAGNUM||e.NETLIFY||e.NEVERCODE||e.PROW_JOB_ID||e.RELEASE_BUILD_ID||e.RENDER||e.SAILCI||e.HUDSON||e.JENKINS_URL||e.BUILD_ID||e.SCREWDRIVER||e.SEMAPHORE||e.SOURCEHUT||e.STRIDER||e.TASK_ID||e.RUN_ID||e.TEAMCITY_VERSION||e.TRAVIS||e.VELA||e.NOW_BUILDER||e.APPCENTER_BUILD_ID||e.CI_XCODE_PROJECT||e.XCS),t=(e=process.stdin)=>!!(e?.isTTY&&process.env.TERM!==`dumb`);export{e as isCI,t as isInteractive};
|
|
2
|
+
//# sourceMappingURL=ci-checks.mjs.map
|
|
@@ -0,0 +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,GACX,EAA0C,QAAQ,MAM3C,GACL,EAAI,UACJ,EAAI,IACJ,EAAI,wBACJ,EAAI,cACJ,EAAI,QAEJ,EAAI,eACJ,EAAI,cACJ,EAAI,UACJ,EAAI,WACJ,EAAI,UACJ,EAAI,gBACJ,EAAI,kBACJ,EAAI,YACJ,EAAI,oBACJ,EAAI,WACJ,EAAI,UACJ,EAAI,WACJ,EAAI,aACJ,EAAI,aACJ,EAAI,SACJ,EAAI,OACJ,EAAI,OACJ,EAAI,YACJ,EAAI,WACJ,EAAI,gBACJ,EAAI,eACJ,EAAI,gBACJ,EAAI,WACJ,EAAI,MACJ,EAAI,gBACJ,EAAI,kBACJ,EAAI,aACJ,EAAI,UACJ,EAAI,SACJ,EAAI,QACJ,EAAI,SACJ,EAAI,WACJ,EAAI,aACJ,EAAI,kBACJ,EAAI,QACJ,EAAI,QACJ,EAAI,QACJ,EAAI,aACJ,EAAI,UACJ,EAAI,aACJ,EAAI,WACJ,EAAI,WACJ,EAAI,SACJ,EAAI,SACJ,EAAI,QACJ,EAAI,kBACJ,EAAI,QACJ,EAAI,MACJ,EAAI,aAIJ,EAAI,oBACJ,EAAI,kBACJ,EAAI,KAeK,GAAiB,EAAS,QAAQ,QACtC,GAAQ,GAAQ,OAAS,QAAQ,IAAI,OAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e??=[],Array.isArray(e)?e:[e]}exports.toArray=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-array.mjs","names":[],"sources":["../../../../convert/src/to-array.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 { Arrayable } from \"@stryke/types/array\";\nimport type { Nullable } from \"@stryke/types/utilities\";\n\n/**\n * Convert `Arrayable<T>` to `Array<T>`\n *\n * @param array - The `Arrayable<T>` to convert\n * @returns An `Array<T>` containing the elements of the input\n */\nexport function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\n"],"mappings":"AA2BA,SAAgB,EAAW,EAA0C,CAEnE,MADA,KAAiB,EAAE,CACZ,MAAM,QAAQ,EAAM,CAAG,EAAQ,CAAC,EAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./ci-checks.cjs`),t=process?.platform||``,n=!!(process?.stdout&&process?.stdout.isTTY),r=!!process.env.DEBUG,i=process.env.STORM_MODE||process.env.NEXT_PUBLIC_VERCEL_ENV||process.env.NODE_ENV||`production`,a=[`stg`,`stage`,`staging`].includes(i?.toLowerCase());function o(e){return[`prd`,`prod`,`production`,`preprod`,`preproduction`,`uat`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const s=o(i);function c(e){return[`tst`,`test`,`testing`,`stg`,`stage`,`staging`,`qa`,`qualityassurance`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const l=c(i)||a||!!process.env.TEST;function u(e){return[`dev`,`development`,`int`,`integration`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const d=u(i)||r,f=!!process.env.MINIMAL||e.isCI()||l||!n,p=/^win/i.test(t),m=/^linux/i.test(t),h=/^darwin/i.test(t),g=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(n||p)&&process.env.TERM!==`dumb`||e.isCI());function _(e=``){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e)??[];return{major:0,minor:Number.parseInt(t[1],10),patch:Number.parseInt(t[2],10)}}let t=(e??``).split(`.`).map(e=>Number.parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function v(t=process.stdout){if(process.env.FORCE_HYPERLINK)return!(process.env.FORCE_HYPERLINK.length>0&&Number.parseInt(process.env.FORCE_HYPERLINK,10)===0);if(process.env.NETLIFY)return!0;if(g){if(t&&!t.isTTY)return!1;if(`WT_SESSION`in process.env)return!0;if(process.platform===`win32`||e.isCI()||process.env.TEAMCITY_VERSION)return!1;if(process.env.TERM_PROGRAM){let e=_(process.env.TERM_PROGRAM_VERSION);switch(process.env.TERM_PROGRAM){case`iTerm.app`:return e.major===3?e.minor!==void 0&&e.minor>=1:e.major!==void 0&&e.major>3;case`WezTerm`:return e.major!==void 0&&e.major>=20200620;case`vscode`:return process.env.CURSOR_TRACE_ID?!0:e.minor!==void 0&&e.major!==void 0&&(e.major>1||e.major===1&&e.minor>=72);case`ghostty`:return!0}}}else return!1;if(process.env.VTE_VERSION){if(process.env.VTE_VERSION===`0.50.0`)return!1;let e=_(process.env.VTE_VERSION);return e.major!==void 0&&e.major>0||e.minor!==void 0&&e.minor>=50}return process.env.TERM===`alacritty`}const y=(process?.versions?.node||``).replace(/^v/,``)||null,b=Number(y?.split(`.`)[0])||null;exports.hasTTY=n,exports.isColorSupported=g,exports.isDebug=r,exports.isDevelopment=d,exports.isDevelopmentMode=u,exports.isHyperlinkSupported=v,exports.isLinux=m,exports.isMacOS=h,exports.isMinimal=f,exports.isProduction=s,exports.isProductionMode=o,exports.isStaging=a,exports.isTest=l,exports.isTestMode=c,exports.isWindows=p,exports.nodeMajorVersion=b,exports.nodeVersion=y,exports.platform=t;
|
|
@@ -1,2 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/environment-checks.d.ts
|
|
2
|
+
/** Value of process.platform */
|
|
3
|
+
declare const platform: NodeJS.Platform;
|
|
4
|
+
/** Detect if stdout.TTY is available */
|
|
5
|
+
declare const hasTTY: boolean;
|
|
6
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
7
|
+
declare const isDebug: boolean;
|
|
8
|
+
/** Detect if the application is running in a staging environment */
|
|
9
|
+
declare const isStaging: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check if the current environment is production.
|
|
12
|
+
*
|
|
13
|
+
* @param mode - The mode string to check.
|
|
14
|
+
* @returns Whether the environment is production
|
|
15
|
+
*/
|
|
16
|
+
declare function isProductionMode(mode: string): boolean;
|
|
17
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
18
|
+
declare const isProduction: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if the current environment is test.
|
|
21
|
+
*
|
|
22
|
+
* @param mode - The mode string to check.
|
|
23
|
+
* @returns Whether the environment is test
|
|
24
|
+
*/
|
|
25
|
+
declare function isTestMode(mode: string): boolean;
|
|
26
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
27
|
+
declare const isTest: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if the current environment is development.
|
|
30
|
+
*
|
|
31
|
+
* @param mode - The mode string to check.
|
|
32
|
+
* @returns Whether the environment is development
|
|
33
|
+
*/
|
|
34
|
+
declare function isDevelopmentMode(mode: string): boolean;
|
|
35
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
36
|
+
declare const isDevelopment: boolean;
|
|
37
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
38
|
+
declare const isMinimal: boolean;
|
|
39
|
+
/** Detect if process.platform is Windows */
|
|
40
|
+
declare const isWindows: boolean;
|
|
41
|
+
/** Detect if process.platform is Linux */
|
|
42
|
+
declare const isLinux: boolean;
|
|
43
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
44
|
+
declare const isMacOS: boolean;
|
|
45
|
+
/** Color Support */
|
|
46
|
+
declare const isColorSupported: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the current environment supports hyperlinks in the terminal.
|
|
49
|
+
*
|
|
50
|
+
* @param stream - The stream to check for TTY support (default: process.stdout)
|
|
51
|
+
* @returns Whether hyperlinks are supported
|
|
52
|
+
*/
|
|
53
|
+
declare function isHyperlinkSupported(stream?: NodeJS.WriteStream): boolean;
|
|
54
|
+
/** Node.js versions */
|
|
55
|
+
declare const nodeVersion: string | null;
|
|
56
|
+
declare const nodeMajorVersion: number | null;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform };
|
|
59
|
+
//# sourceMappingURL=environment-checks.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-checks.d.cts","names":[],"sources":["../src/environment-checks.ts"],"sourcesContent":[],"mappings":";;AAqBa,cAAA,QAAQ,EAAA,MAAA,CAAA,QAA0B;AAG/C;AAGa,cAHA,MAGoC,EAAA,OAAA;AAUjD;AAUgB,cApBH,OAoBmB,EAAA,OAAA;AAchC;AAQgB,cAhCH,SAgCa,EAAA,OAAA;AAe1B;AASA;AAOA;AAGA;AAIA;AAGA;AAGa,iBAlEG,gBAAA,CAkEgC,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;AAGhD;AAkCgB,cAzFH,YAyFuB,EAAA,OAC1B;AA8EV;AAGA;;;;;iBAnKgB,UAAA;;cAeH;;;;;;;iBASG,iBAAA;;cAOH;;cAGA;;cAIA;;cAGA;;cAGA;;cAGA;;;;;;;iBAkCG,oBAAA,UACN,MAAA,CAAO;;cA8EJ;cAGA"}
|
|
@@ -1,2 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/environment-checks.d.ts
|
|
2
|
+
/** Value of process.platform */
|
|
3
|
+
declare const platform: NodeJS.Platform;
|
|
4
|
+
/** Detect if stdout.TTY is available */
|
|
5
|
+
declare const hasTTY: boolean;
|
|
6
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
7
|
+
declare const isDebug: boolean;
|
|
8
|
+
/** Detect if the application is running in a staging environment */
|
|
9
|
+
declare const isStaging: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check if the current environment is production.
|
|
12
|
+
*
|
|
13
|
+
* @param mode - The mode string to check.
|
|
14
|
+
* @returns Whether the environment is production
|
|
15
|
+
*/
|
|
16
|
+
declare function isProductionMode(mode: string): boolean;
|
|
17
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
18
|
+
declare const isProduction: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if the current environment is test.
|
|
21
|
+
*
|
|
22
|
+
* @param mode - The mode string to check.
|
|
23
|
+
* @returns Whether the environment is test
|
|
24
|
+
*/
|
|
25
|
+
declare function isTestMode(mode: string): boolean;
|
|
26
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
27
|
+
declare const isTest: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if the current environment is development.
|
|
30
|
+
*
|
|
31
|
+
* @param mode - The mode string to check.
|
|
32
|
+
* @returns Whether the environment is development
|
|
33
|
+
*/
|
|
34
|
+
declare function isDevelopmentMode(mode: string): boolean;
|
|
35
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
36
|
+
declare const isDevelopment: boolean;
|
|
37
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
38
|
+
declare const isMinimal: boolean;
|
|
39
|
+
/** Detect if process.platform is Windows */
|
|
40
|
+
declare const isWindows: boolean;
|
|
41
|
+
/** Detect if process.platform is Linux */
|
|
42
|
+
declare const isLinux: boolean;
|
|
43
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
44
|
+
declare const isMacOS: boolean;
|
|
45
|
+
/** Color Support */
|
|
46
|
+
declare const isColorSupported: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the current environment supports hyperlinks in the terminal.
|
|
49
|
+
*
|
|
50
|
+
* @param stream - The stream to check for TTY support (default: process.stdout)
|
|
51
|
+
* @returns Whether hyperlinks are supported
|
|
52
|
+
*/
|
|
53
|
+
declare function isHyperlinkSupported(stream?: NodeJS.WriteStream): boolean;
|
|
54
|
+
/** Node.js versions */
|
|
55
|
+
declare const nodeVersion: string | null;
|
|
56
|
+
declare const nodeMajorVersion: number | null;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform };
|
|
59
|
+
//# sourceMappingURL=environment-checks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-checks.d.mts","names":[],"sources":["../src/environment-checks.ts"],"sourcesContent":[],"mappings":";;AAqBa,cAAA,QAAQ,EAAA,MAAA,CAAA,QAA0B;AAG/C;AAGa,cAHA,MAGoC,EAAA,OAAA;AAUjD;AAUgB,cApBH,OAoBmB,EAAA,OAAA;AAchC;AAQgB,cAhCH,SAgCa,EAAA,OAAA;AAe1B;AASA;AAOA;AAGA;AAIA;AAGA;AAGa,iBAlEG,gBAAA,CAkEgC,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;AAGhD;AAkCgB,cAzFH,YAyFuB,EAAA,OAC1B;AA8EV;AAGA;;;;;iBAnKgB,UAAA;;cAeH;;;;;;;iBASG,iBAAA;;cAOH;;cAGA;;cAIA;;cAGA;;cAGA;;cAGA;;;;;;;iBAkCG,oBAAA,UACN,MAAA,CAAO;;cA8EJ;cAGA"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isCI as e}from"./ci-checks.mjs";const t=process?.platform||``,n=!!(process?.stdout&&process?.stdout.isTTY),r=!!process.env.DEBUG,i=process.env.STORM_MODE||process.env.NEXT_PUBLIC_VERCEL_ENV||process.env.NODE_ENV||`production`,a=[`stg`,`stage`,`staging`].includes(i?.toLowerCase());function o(e){return[`prd`,`prod`,`production`,`preprod`,`preproduction`,`uat`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const s=o(i);function c(e){return[`tst`,`test`,`testing`,`stg`,`stage`,`staging`,`qa`,`qualityassurance`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const l=c(i)||a||!!process.env.TEST;function u(e){return[`dev`,`development`,`int`,`integration`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const d=u(i)||r,f=!!process.env.MINIMAL||e()||l||!n,p=/^win/i.test(t),m=/^linux/i.test(t),h=/^darwin/i.test(t),g=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(n||p)&&process.env.TERM!==`dumb`||e());function _(e=``){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e)??[];return{major:0,minor:Number.parseInt(t[1],10),patch:Number.parseInt(t[2],10)}}let t=(e??``).split(`.`).map(e=>Number.parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function v(t=process.stdout){if(process.env.FORCE_HYPERLINK)return!(process.env.FORCE_HYPERLINK.length>0&&Number.parseInt(process.env.FORCE_HYPERLINK,10)===0);if(process.env.NETLIFY)return!0;if(g){if(t&&!t.isTTY)return!1;if(`WT_SESSION`in process.env)return!0;if(process.platform===`win32`||e()||process.env.TEAMCITY_VERSION)return!1;if(process.env.TERM_PROGRAM){let e=_(process.env.TERM_PROGRAM_VERSION);switch(process.env.TERM_PROGRAM){case`iTerm.app`:return e.major===3?e.minor!==void 0&&e.minor>=1:e.major!==void 0&&e.major>3;case`WezTerm`:return e.major!==void 0&&e.major>=20200620;case`vscode`:return process.env.CURSOR_TRACE_ID?!0:e.minor!==void 0&&e.major!==void 0&&(e.major>1||e.major===1&&e.minor>=72);case`ghostty`:return!0}}}else return!1;if(process.env.VTE_VERSION){if(process.env.VTE_VERSION===`0.50.0`)return!1;let e=_(process.env.VTE_VERSION);return e.major!==void 0&&e.major>0||e.minor!==void 0&&e.minor>=50}return process.env.TERM===`alacritty`}const y=(process?.versions?.node||``).replace(/^v/,``)||null,b=Number(y?.split(`.`)[0])||null;export{n as hasTTY,g as isColorSupported,r as isDebug,d as isDevelopment,u as isDevelopmentMode,v as isHyperlinkSupported,m as isLinux,h as isMacOS,f as isMinimal,s as isProduction,o as isProductionMode,a as isStaging,l as isTest,c as isTestMode,p as isWindows,b as nodeMajorVersion,y as nodeVersion,t as platform};
|
|
2
|
+
//# sourceMappingURL=environment-checks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-checks.mjs","names":["mode"],"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 // eslint-disable-next-line @cspell/spellchecker\n \"preprod\",\n // eslint-disable-next-line @cspell/spellchecker\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 // eslint-disable-next-line @cspell/spellchecker\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/** 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":"uCAqBA,MAAa,EAAW,SAAS,UAAY,GAGhC,EAAS,GAAQ,SAAS,QAAU,SAAS,OAAO,OAGpD,EAAU,EAAQ,QAAQ,IAAI,MAGrC,EACJ,QAAQ,IAAI,YACZ,QAAQ,IAAI,wBACZ,QAAQ,IAAI,UACZ,aAGW,EAAY,CAAC,MAAO,QAAS,UAAU,CAAC,SACnD,GAAM,aAAa,CACpB,CAQD,SAAgB,EAAiB,EAAc,CAC7C,MAAO,CACL,MACA,OACA,aAEA,UAEA,gBACA,MACD,CAAC,SAASA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAAC,CAI1D,MAAa,EAAe,EAAiB,EAAK,CAQlD,SAAgB,EAAW,EAAc,CACvC,MAAO,CACL,MACA,OACA,UACA,MACA,QACA,UACA,KAEA,mBACD,CAAC,SAASA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAAC,CAI1D,MAAa,EACX,EAAW,EAAK,EAAI,GAAa,EAAQ,QAAQ,IAAI,KAQvD,SAAgB,EAAkB,EAAc,CAC9C,MAAO,CAAC,MAAO,cAAe,MAAO,cAAc,CAAC,SAClDA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAC7C,CAIH,MAAa,EAAgB,EAAkB,EAAK,EAAI,EAG3C,EACX,EAAQ,QAAQ,IAAI,SAAY,GAAM,EAAI,GAAU,CAAC,EAG1C,EAAY,QAAQ,KAAK,EAAS,CAGlC,EAAU,UAAU,KAAK,EAAS,CAGlC,EAAU,WAAW,KAAK,EAAS,CAGnC,EACX,CAAC,QAAQ,IAAI,WACZ,EAAQ,QAAQ,IAAI,cACjB,GAAU,IAAc,QAAQ,IAAI,OAAS,QAC/C,GAAM,EAEV,SAAS,EAAa,EAAgB,GAAI,CACxC,GAAI,YAAY,KAAK,EAAc,CAAE,CACnC,IAAM,EAAQ,mBAAmB,KAAK,EAAc,EAAI,EAAE,CAE1D,MAAO,CACL,MAAO,EACP,MAAO,OAAO,SAAS,EAAM,GAAK,GAAG,CACrC,MAAO,OAAO,SAAS,EAAM,GAAK,GAAG,CACtC,CAGH,IAAM,GAAY,GAAiB,IAChC,MAAM,IAAI,CACV,IAAI,GAAK,OAAO,SAAS,EAAG,GAAG,CAAC,CAEnC,MAAO,CACL,MAAO,EAAS,GAChB,MAAO,EAAS,GAChB,MAAO,EAAS,GACjB,CASH,SAAgB,EACd,EAA6B,QAAQ,OAC5B,CACT,GAAI,QAAQ,IAAI,gBACd,MAAO,EACL,QAAQ,IAAI,gBAAgB,OAAS,GACrC,OAAO,SAAS,QAAQ,IAAI,gBAAiB,GAAG,GAAK,GAKzD,GAAI,QAAQ,IAAI,QACd,MAAO,MACG,MAED,GAAU,CAAC,EAAO,MAC3B,MAAO,MACE,eAAgB,QAAQ,IACjC,MAAO,MACE,QAAQ,WAAa,SAErB,GAAM,EAEN,QAAQ,IAAI,iBACrB,MAAO,MACE,QAAQ,IAAI,aAAc,CACnC,IAAM,EAAU,EAAa,QAAQ,IAAI,qBAAqB,CAE9D,OAAQ,QAAQ,IAAI,aAApB,CACE,IAAK,YAKH,OAJI,EAAQ,QAAU,EACb,EAAQ,QAAU,IAAA,IAAa,EAAQ,OAAS,EAGlD,EAAQ,QAAU,IAAA,IAAa,EAAQ,MAAQ,EAExD,IAAK,UACH,OAAO,EAAQ,QAAU,IAAA,IAAa,EAAQ,OAAS,SAEzD,IAAK,SAMH,OAJI,QAAQ,IAAI,gBACP,GAIP,EAAQ,QAAU,IAAA,IAClB,EAAQ,QAAU,IAAA,KACjB,EAAQ,MAAQ,GAAM,EAAQ,QAAU,GAAK,EAAQ,OAAS,IAGnE,IAAK,UACH,MAAO,UAtCX,MAAO,GA2CT,GAAI,QAAQ,IAAI,YAAa,CAE3B,GAAI,QAAQ,IAAI,cAAgB,SAC9B,MAAO,GAGT,IAAM,EAAU,EAAa,QAAQ,IAAI,YAAY,CAErD,OACG,EAAQ,QAAU,IAAA,IAAa,EAAQ,MAAQ,GAC/C,EAAQ,QAAU,IAAA,IAAa,EAAQ,OAAS,GAQrD,OAJI,QAAQ,IAAI,OAAS,YAQ3B,MAAa,GACV,SAAS,UAAU,MAAQ,IAAI,QAAQ,KAAM,GAAG,EAAI,KAE1C,EAAmB,OAAO,GAAa,MAAM,IAAI,CAAC,GAAG,EAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`node:fs`),n=require(`node:fs/promises`);function r(e){return(0,t.existsSync)(e)}exports.existsSync=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exists.mjs","names":["existsSync","existsSyncFs"],"sources":["../../../../fs/src/exists.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 { existsSync as existsSyncFs } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport function existsSync(filePath: string): boolean {\n return existsSyncFs(filePath);\n}\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport async function exists(filePath: string): Promise<boolean> {\n return access(filePath, constants.F_OK)\n .then(() => true)\n .catch(() => false);\n}\n"],"mappings":"qCA2BA,SAAgBA,EAAW,EAA2B,CACpD,OAAOC,EAAa,EAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`node:fs`),n=require(`node:fs/promises`);const r=async e=>{if(!e)throw Error(`No file path provided to read data`);return(0,n.readFile)(e,{encoding:`utf8`})};exports.readFile=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.mjs","names":["readFile","readFileFs"],"sources":["../../../../fs/src/read-file.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 { existsSync, readFileSync as readFileSyncFs } from \"node:fs\";\nimport { readFile as readFileFs } from \"node:fs/promises\";\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to write to\n */\nexport const readFileSync = (filePath: string): string => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileSyncFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to read to\n */\nexport const readFile = async (filePath: string): Promise<string> => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport function readFileIfExistingSync(path: string) {\n return existsSync(path) ? readFileSync(path) : \"\";\n}\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport async function readFileIfExisting(path: string) {\n return existsSync(path) ? readFile(path) : \"\";\n}\n"],"mappings":"iFAuCA,MAAaA,EAAW,KAAO,IAAsC,CACnE,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,OAAOC,EAAW,EAAU,CAAE,SAAU,OAAQ,CAAC"}
|
package/dist/get-env-paths.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./path/src/join-paths.cjs`),n=require(`./string-format/src/title-case.cjs`);let r=require(`node:os`);r=e.__toESM(r);let i=require(`node:path`);i=e.__toESM(i);const a=r.default.homedir(),o=r.default.tmpdir(),s=e=>{let n=t.joinPaths(a,`Library`);return{data:t.joinPaths(n,`Application Support`,e),config:t.joinPaths(n,`Preferences`,e),cache:t.joinPaths(n,`Caches`,e),log:t.joinPaths(n,`Logs`,e),temp:t.joinPaths(o,e)}},c=e=>{let r=process.env.APPDATA||t.joinPaths(a,`AppData`,`Roaming`),i=process.env.LOCALAPPDATA||t.joinPaths(a,`AppData`,`Local`),s=n.titleCase(e).trim().replace(/\s+/g,``);return{data:t.joinPaths(i,s,`Data`),config:t.joinPaths(r,s,`Config`),cache:t.joinPaths(i,`Cache`,e),log:t.joinPaths(i,s,`Log`),temp:t.joinPaths(o,e)}},l=e=>{let n=i.default.basename(a);return{data:t.joinPaths(process.env.XDG_DATA_HOME||t.joinPaths(a,`.local`,`share`),e),config:t.joinPaths(process.env.XDG_CONFIG_HOME||t.joinPaths(a,`.config`),e),cache:t.joinPaths(process.env.XDG_CACHE_HOME||t.joinPaths(a,`.cache`),e),log:t.joinPaths(process.env.XDG_STATE_HOME||t.joinPaths(a,`.local`,`state`),e),temp:process.env.DEVENV_RUNTIME||process.env.XDG_RUNTIME_DIR?t.joinPaths(process.env.DEVENV_RUNTIME||process.env.XDG_RUNTIME_DIR,e):t.joinPaths(o,n,e)}};function u(e={}){let n=e.orgId||`storm-software`;if(!n)throw Error("You need to provide an orgId to the `getEnvPaths` function");e.suffix&&(n+=`-${typeof e.suffix==`string`?e.suffix:`nodejs`}`);let r={};return r=process.platform===`darwin`?s(n):process.platform===`win32`?c(n):l(n),process.env.STORM_DATA_DIR?r.data=process.env.STORM_DATA_DIR:process.env.STORM_CONFIG_DIR?r.config=process.env.STORM_CONFIG_DIR:process.env.STORM_CACHE_DIR?r.cache=process.env.STORM_CACHE_DIR:process.env.STORM_LOG_DIR?r.log=process.env.STORM_LOG_DIR:process.env.STORM_TEMP_DIR&&(r.temp=process.env.STORM_TEMP_DIR),e.workspaceRoot&&(r.cache??=t.joinPaths(e.workspaceRoot,`node_modules`,`.cache`,n),r.temp??=t.joinPaths(e.workspaceRoot,`tmp`,n),r.log??=t.joinPaths(r.temp,`logs`),r.config??=t.joinPaths(e.workspaceRoot,`.config`,n)),Object.keys(r).reduce((n,i)=>{if(r[i]){let a=r[i];n[i]=e.appId&&e.appId!==e.orgId&&e.appId!==e.nestedDir?t.joinPaths(a,e.appId):a,e.nestedDir&&e.nestedDir!==e.orgId&&e.nestedDir!==e.appId&&(n[i]=t.joinPaths(n[i],e.nestedDir))}return n},{})}exports.getEnvPaths=u;
|
package/dist/get-env-paths.d.cts
CHANGED
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/get-env-paths.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Options for the `getEnvPaths` function.
|
|
4
|
+
*/
|
|
5
|
+
interface GetEnvPathsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the organization
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue "storm-software"
|
|
10
|
+
*/
|
|
11
|
+
orgId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
14
|
+
*
|
|
15
|
+
* For example: `~/ ... /storm-software/Log/<appId>`
|
|
16
|
+
*/
|
|
17
|
+
appId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
20
|
+
*
|
|
21
|
+
* When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`
|
|
25
|
+
*/
|
|
26
|
+
nestedDir?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The suffix to append to the project name.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* If `suffix` is `true`, the project name will be suffixed with `"nodejs"`.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
suffix?: string | boolean | null;
|
|
36
|
+
/**
|
|
37
|
+
* 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.
|
|
38
|
+
*/
|
|
39
|
+
workspaceRoot?: string;
|
|
40
|
+
}
|
|
41
|
+
interface EnvPaths {
|
|
42
|
+
data: string;
|
|
43
|
+
config: string;
|
|
44
|
+
cache: string;
|
|
45
|
+
log: string;
|
|
46
|
+
temp: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get paths for storing things like data, config, logs, and cache in the current runtime environment.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* On macOS, directories are generally created in `~/Library/Application Support/<name>`.
|
|
53
|
+
* On Windows, directories are generally created in `%AppData%/<name>`.
|
|
54
|
+
* 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/).
|
|
55
|
+
*
|
|
56
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Parameters used to determine the specific paths for the current project/runtime environment
|
|
59
|
+
* @returns An object containing the various paths for the runtime environment
|
|
60
|
+
*/
|
|
61
|
+
declare function getEnvPaths(options?: GetEnvPathsOptions): EnvPaths;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { EnvPaths, GetEnvPathsOptions, getEnvPaths };
|
|
64
|
+
//# sourceMappingURL=get-env-paths.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-env-paths.d.cts","names":[],"sources":["../src/get-env-paths.ts"],"sourcesContent":[],"mappings":";;AA+BA;AAyCA;AAoFgB,UA7HC,kBAAA,CA6HoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UApFpB,QAAA;;;;;;;;;;;;;;;;;;;;iBAoFD,WAAA,WAAqB,qBAA0B"}
|
package/dist/get-env-paths.d.mts
CHANGED
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/get-env-paths.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Options for the `getEnvPaths` function.
|
|
4
|
+
*/
|
|
5
|
+
interface GetEnvPathsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the organization
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue "storm-software"
|
|
10
|
+
*/
|
|
11
|
+
orgId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
14
|
+
*
|
|
15
|
+
* For example: `~/ ... /storm-software/Log/<appId>`
|
|
16
|
+
*/
|
|
17
|
+
appId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
20
|
+
*
|
|
21
|
+
* When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`
|
|
25
|
+
*/
|
|
26
|
+
nestedDir?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The suffix to append to the project name.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* If `suffix` is `true`, the project name will be suffixed with `"nodejs"`.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
suffix?: string | boolean | null;
|
|
36
|
+
/**
|
|
37
|
+
* 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.
|
|
38
|
+
*/
|
|
39
|
+
workspaceRoot?: string;
|
|
40
|
+
}
|
|
41
|
+
interface EnvPaths {
|
|
42
|
+
data: string;
|
|
43
|
+
config: string;
|
|
44
|
+
cache: string;
|
|
45
|
+
log: string;
|
|
46
|
+
temp: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get paths for storing things like data, config, logs, and cache in the current runtime environment.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* On macOS, directories are generally created in `~/Library/Application Support/<name>`.
|
|
53
|
+
* On Windows, directories are generally created in `%AppData%/<name>`.
|
|
54
|
+
* 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/).
|
|
55
|
+
*
|
|
56
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Parameters used to determine the specific paths for the current project/runtime environment
|
|
59
|
+
* @returns An object containing the various paths for the runtime environment
|
|
60
|
+
*/
|
|
61
|
+
declare function getEnvPaths(options?: GetEnvPathsOptions): EnvPaths;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { EnvPaths, GetEnvPathsOptions, getEnvPaths };
|
|
64
|
+
//# sourceMappingURL=get-env-paths.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-env-paths.d.mts","names":[],"sources":["../src/get-env-paths.ts"],"sourcesContent":[],"mappings":";;AA+BA;AAyCA;AAoFgB,UA7HC,kBAAA,CA6HoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UApFpB,QAAA;;;;;;;;;;;;;;;;;;;;iBAoFD,WAAA,WAAqB,qBAA0B"}
|
package/dist/get-env-paths.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{joinPaths as e}from"./path/src/join-paths.mjs";import{titleCase as t}from"./string-format/src/title-case.mjs";import n from"node:os";import r from"node:path";const i=n.homedir(),a=n.tmpdir(),o=t=>{let n=e(i,`Library`);return{data:e(n,`Application Support`,t),config:e(n,`Preferences`,t),cache:e(n,`Caches`,t),log:e(n,`Logs`,t),temp:e(a,t)}},s=n=>{let r=process.env.APPDATA||e(i,`AppData`,`Roaming`),o=process.env.LOCALAPPDATA||e(i,`AppData`,`Local`),s=t(n).trim().replace(/\s+/g,``);return{data:e(o,s,`Data`),config:e(r,s,`Config`),cache:e(o,`Cache`,n),log:e(o,s,`Log`),temp:e(a,n)}},c=t=>{let n=r.basename(i);return{data:e(process.env.XDG_DATA_HOME||e(i,`.local`,`share`),t),config:e(process.env.XDG_CONFIG_HOME||e(i,`.config`),t),cache:e(process.env.XDG_CACHE_HOME||e(i,`.cache`),t),log:e(process.env.XDG_STATE_HOME||e(i,`.local`,`state`),t),temp:process.env.DEVENV_RUNTIME||process.env.XDG_RUNTIME_DIR?e(process.env.DEVENV_RUNTIME||process.env.XDG_RUNTIME_DIR,t):e(a,n,t)}};function l(t={}){let n=t.orgId||`storm-software`;if(!n)throw Error("You need to provide an orgId to the `getEnvPaths` function");t.suffix&&(n+=`-${typeof t.suffix==`string`?t.suffix:`nodejs`}`);let r={};return r=process.platform===`darwin`?o(n):process.platform===`win32`?s(n):c(n),process.env.STORM_DATA_DIR?r.data=process.env.STORM_DATA_DIR:process.env.STORM_CONFIG_DIR?r.config=process.env.STORM_CONFIG_DIR:process.env.STORM_CACHE_DIR?r.cache=process.env.STORM_CACHE_DIR:process.env.STORM_LOG_DIR?r.log=process.env.STORM_LOG_DIR:process.env.STORM_TEMP_DIR&&(r.temp=process.env.STORM_TEMP_DIR),t.workspaceRoot&&(r.cache??=e(t.workspaceRoot,`node_modules`,`.cache`,n),r.temp??=e(t.workspaceRoot,`tmp`,n),r.log??=e(r.temp,`logs`),r.config??=e(t.workspaceRoot,`.config`,n)),Object.keys(r).reduce((n,i)=>{if(r[i]){let a=r[i];n[i]=t.appId&&t.appId!==t.orgId&&t.appId!==t.nestedDir?e(a,t.appId):a,t.nestedDir&&t.nestedDir!==t.orgId&&t.nestedDir!==t.appId&&(n[i]=e(n[i],t.nestedDir))}return n},{})}export{l as getEnvPaths};
|
|
2
|
+
//# sourceMappingURL=get-env-paths.mjs.map
|
|
@@ -0,0 +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":"qKAyBA,MAAM,EAAU,EAAG,SAAS,CACtB,EAAS,EAAG,QAAQ,CAsDpB,EAAS,GAA4B,CACzC,IAAM,EAAU,EAAU,EAAS,UAAU,CAE7C,MAAO,CACL,KAAM,EAAU,EAAS,sBAAuB,EAAM,CACtD,OAAQ,EAAU,EAAS,cAAe,EAAM,CAChD,MAAO,EAAU,EAAS,SAAU,EAAM,CAC1C,IAAK,EAAU,EAAS,OAAQ,EAAM,CACtC,KAAM,EAAU,EAAQ,EAAM,CAC/B,EAGG,EAAW,GAA4B,CAC3C,IAAM,EACJ,QAAQ,IAAI,SAAW,EAAU,EAAS,UAAW,UAAU,CAC3D,EACJ,QAAQ,IAAI,cAAgB,EAAU,EAAS,UAAW,QAAQ,CAE9D,EAAwB,EAAU,EAAM,CAAC,MAAM,CAAC,QAAQ,OAAQ,GAAG,CAEzE,MAAO,CAEL,KAAM,EAAU,EAAc,EAAuB,OAAO,CAC5D,OAAQ,EAAU,EAAS,EAAuB,SAAS,CAC3D,MAAO,EAAU,EAAc,QAAS,EAAM,CAC9C,IAAK,EAAU,EAAc,EAAuB,MAAM,CAC1D,KAAM,EAAU,EAAQ,EAAM,CAC/B,EAIG,EAAS,GAA4B,CACzC,IAAM,EAAW,EAAK,SAAS,EAAQ,CAEvC,MAAO,CACL,KAAM,EACJ,QAAQ,IAAI,eAAiB,EAAU,EAAS,SAAU,QAAQ,CAClE,EACD,CACD,OAAQ,EACN,QAAQ,IAAI,iBAAmB,EAAU,EAAS,UAAU,CAC5D,EACD,CACD,MAAO,EACL,QAAQ,IAAI,gBAAkB,EAAU,EAAS,SAAS,CAC1D,EACD,CAED,IAAK,EACH,QAAQ,IAAI,gBAAkB,EAAU,EAAS,SAAU,QAAQ,CACnE,EACD,CAED,KACE,QAAQ,IAAI,gBAAkB,QAAQ,IAAI,gBACtC,EACG,QAAQ,IAAI,gBAAkB,QAAQ,IAAI,gBAC3C,EACD,CACD,EAAU,EAAQ,EAAU,EAAM,CACzC,EAgBH,SAAgB,EAAY,EAA8B,EAAE,CAAY,CACtE,IAAI,EAAQ,EAAQ,OAAS,iBAC7B,GAAI,CAAC,EACH,MAAU,MACR,6DACD,CAGC,EAAQ,SAEV,GAAS,IAAI,OAAO,EAAQ,QAAW,SAAW,EAAQ,OAAS,YAGrE,IAAI,EAAS,EAAE,CAkCf,MAhCA,CAKE,EALE,QAAQ,WAAa,SACd,EAAM,EAAM,CACZ,QAAQ,WAAa,QACrB,EAAQ,EAAM,CAEd,EAAM,EAAM,CAGnB,QAAQ,IAAI,eACd,EAAO,KAAO,QAAQ,IAAI,eACjB,QAAQ,IAAI,iBACrB,EAAO,OAAS,QAAQ,IAAI,iBACnB,QAAQ,IAAI,gBACrB,EAAO,MAAQ,QAAQ,IAAI,gBAClB,QAAQ,IAAI,cACrB,EAAO,IAAM,QAAQ,IAAI,cAChB,QAAQ,IAAI,iBACrB,EAAO,KAAO,QAAQ,IAAI,gBAGxB,EAAQ,gBACV,EAAO,QAAU,EACf,EAAQ,cACR,eACA,SACA,EACD,CACD,EAAO,OAAS,EAAU,EAAQ,cAAe,MAAO,EAAM,CAC9D,EAAO,MAAQ,EAAU,EAAO,KAAM,OAAO,CAC7C,EAAO,SAAW,EAAU,EAAQ,cAAe,UAAW,EAAM,EAG/D,OAAO,KAAK,EAAO,CAAC,QAAQ,EAAK,IAAQ,CAC9C,GAAI,EAAO,GAAwB,CACjC,IAAM,EAAW,EAAO,GAExB,EAAI,GACF,EAAQ,OACR,EAAQ,QAAU,EAAQ,OAC1B,EAAQ,QAAU,EAAQ,UACtB,EAAU,EAAU,EAAQ,MAAM,CAClC,EAGJ,EAAQ,WACR,EAAQ,YAAc,EAAQ,OAC9B,EAAQ,YAAc,EAAQ,QAE9B,EAAI,GAAyB,EAC3B,EAAI,GACJ,EAAQ,UACT,EAIL,OAAO,GACN,EAAE,CAAa"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./ci-checks
|
|
1
|
+
const e=require(`./ci-checks.cjs`),t=require(`./environment-checks.cjs`),n=require(`./get-env-paths.cjs`),r=require(`./types.cjs`),i=require(`./load-env.cjs`),a=require(`./providers.cjs`),o=require(`./runtime-checks.cjs`);exports.ENV_PREFIXES=r.ENV_PREFIXES,exports.getEnvFilesForMode=i.getEnvFilesForMode,exports.getEnvPaths=n.getEnvPaths,exports.hasTTY=t.hasTTY,exports.isBun=o.isBun,exports.isCI=e.isCI,exports.isColorSupported=t.isColorSupported,exports.isDebug=t.isDebug,exports.isDeno=o.isDeno,exports.isDevelopment=t.isDevelopment,exports.isDevelopmentMode=t.isDevelopmentMode,exports.isEdgeLight=o.isEdgeLight,exports.isFastly=o.isFastly,exports.isHyperlinkSupported=t.isHyperlinkSupported,exports.isInteractive=e.isInteractive,exports.isLinux=t.isLinux,exports.isMacOS=t.isMacOS,exports.isMinimal=t.isMinimal,exports.isNetlify=o.isNetlify,exports.isNode=o.isNode,exports.isProduction=t.isProduction,exports.isProductionMode=t.isProductionMode,exports.isRuntimeClient=o.isRuntimeClient,exports.isRuntimeServer=o.isRuntimeServer,exports.isStaging=t.isStaging,exports.isTest=t.isTest,exports.isTestMode=t.isTestMode,exports.isWindows=t.isWindows,exports.isWorkerd=o.isWorkerd,exports.loadClientEnv=i.loadClientEnv,exports.loadEnv=i.loadEnv,exports.loadEnvFile=i.loadEnvFile,exports.loadServerEnv=i.loadServerEnv,exports.nodeMajorVersion=t.nodeMajorVersion,exports.nodeVersion=t.nodeVersion,exports.platform=t.platform,exports.provider=a.provider,exports.providerInfo=a.providerInfo,exports.runtime=o.runtime,exports.runtimeInfo=o.runtimeInfo;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { isCI, isInteractive } from "./ci-checks.cjs";
|
|
2
|
+
import { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform } from "./environment-checks.cjs";
|
|
3
|
+
import { EnvPaths, GetEnvPathsOptions, getEnvPaths } from "./get-env-paths.cjs";
|
|
4
|
+
import { DotenvParseOutput, ENV_PREFIXES } from "./types.cjs";
|
|
5
|
+
import { getEnvFilesForMode, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv } from "./load-env.cjs";
|
|
6
|
+
import { ProviderInfo, ProviderName, provider, providerInfo } from "./providers.cjs";
|
|
7
|
+
import { RuntimeInfo, RuntimeName, isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isRuntimeClient, isRuntimeServer, isWorkerd, runtime, runtimeInfo } from "./runtime-checks.cjs";
|
|
8
8
|
export { DotenvParseOutput, ENV_PREFIXES, EnvPaths, GetEnvPathsOptions, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName, 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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { isCI, isInteractive } from "./ci-checks.mjs";
|
|
2
|
+
import { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform } from "./environment-checks.mjs";
|
|
3
|
+
import { EnvPaths, GetEnvPathsOptions, getEnvPaths } from "./get-env-paths.mjs";
|
|
4
|
+
import { DotenvParseOutput, ENV_PREFIXES } from "./types.mjs";
|
|
5
|
+
import { getEnvFilesForMode, loadClientEnv, loadEnv, loadEnvFile, loadServerEnv } from "./load-env.mjs";
|
|
6
|
+
import { ProviderInfo, ProviderName, provider, providerInfo } from "./providers.mjs";
|
|
7
|
+
import { RuntimeInfo, RuntimeName, isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isRuntimeClient, isRuntimeServer, isWorkerd, runtime, runtimeInfo } from "./runtime-checks.mjs";
|
|
8
8
|
export { DotenvParseOutput, ENV_PREFIXES, EnvPaths, GetEnvPathsOptions, ProviderInfo, ProviderName, RuntimeInfo, RuntimeName, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isCI as e,isInteractive as t}from"./ci-checks.mjs";import{hasTTY as n,isColorSupported as r,isDebug as i,isDevelopment as a,isDevelopmentMode as o,isHyperlinkSupported as s,isLinux as c,isMacOS as l,isMinimal as u,isProduction as d,isProductionMode as f,isStaging as p,isTest as m,isTestMode as h,isWindows as g,nodeMajorVersion as _,nodeVersion as v,platform as y}from"./environment-checks.mjs";import{getEnvPaths as b}from"./get-env-paths.mjs";import{ENV_PREFIXES as x}from"./types.mjs";import{getEnvFilesForMode as S,loadClientEnv as C,loadEnv as w,loadEnvFile as T,loadServerEnv as E}from"./load-env.mjs";import{provider as D,providerInfo as O}from"./providers.mjs";import{isBun as k,isDeno as A,isEdgeLight as j,isFastly as M,isNetlify as N,isNode as P,isRuntimeClient as F,isRuntimeServer as I,isWorkerd as L,runtime as R,runtimeInfo as z}from"./runtime-checks.mjs";export{x as ENV_PREFIXES,S as getEnvFilesForMode,b as getEnvPaths,n as hasTTY,k as isBun,e as isCI,r as isColorSupported,i as isDebug,A as isDeno,a as isDevelopment,o as isDevelopmentMode,j as isEdgeLight,M as isFastly,s as isHyperlinkSupported,t as isInteractive,c as isLinux,l as isMacOS,u as isMinimal,N as isNetlify,P as isNode,d as isProduction,f as isProductionMode,F as isRuntimeClient,I as isRuntimeServer,p as isStaging,m as isTest,h as isTestMode,g as isWindows,L as isWorkerd,C as loadClientEnv,w as loadEnv,T as loadEnvFile,E as loadServerEnv,_ as nodeMajorVersion,v as nodeVersion,y as platform,D as provider,O as providerInfo,R as runtime,z as runtimeInfo};
|
package/dist/load-env.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./path/src/join-paths.cjs`),n=require(`./convert/src/to-array.cjs`),r=require(`./fs/src/exists.cjs`),i=require(`./fs/src/read-file.cjs`),a=require(`./types.cjs`);let o=require(`@dotenvx/dotenvx`),s=require(`defu`);s=e.__toESM(s);function c(e,n=`production`){return[`.env`,`.env.local`,`.env.${n}`,`.env.${n}.local`,`.env.local.${n}`].map(n=>t.joinPaths(e,n))}async function l(e,n=[]){let a=Array.isArray(n)?n:[n];return(await Promise.all((n.length>0?a.map(n=>t.joinPaths(n,e)):[e]).map(async e=>{if(r.existsSync(e))return i.readFile(e)}))).reduce((e,t)=>t?(0,s.default)((0,o.parse)(t,{processEnv:{...process.env},privateKey:process.env.DOTENV_PRIVATE_KEY||process.env.STORM_PRIVATE_KEY}),e):e,{})}async function u(e,t,r){if(t===`local`)throw Error(`"local" cannot be used as a mode name because it conflicts with the .local postfix for .env files.`);let i=n.toArray(r).reduce((e,t)=>t?(e.includes(t.endsWith(`_`)?t:`${t}_`)||e.push(t.endsWith(`_`)?t:`${t}_`),e.includes(`${t.endsWith(`_`)?t:`${t}_`}PUBLIC_`)||e.push(`${t.endsWith(`_`)?t:`${t}_`}PUBLIC_`),e):e,[]),a=Array.isArray(e)?e:[e],o={},u=a.reduce((e,n)=>(e.push(...c(n,t).filter(t=>!e.includes(t))),e),[]),d=(await Promise.all(u.map(async e=>l(e)))).reduce((e,t)=>(0,s.default)(t,e),{});if(d.NODE_ENV&&process.env.VITE_USER_NODE_ENV===void 0&&(process.env.VITE_USER_NODE_ENV=JSON.stringify(d.NODE_ENV)),d.BROWSER&&process.env.BROWSER===void 0&&(process.env.BROWSER=JSON.stringify(d.BROWSER)),d.BROWSER_ARGS&&process.env.BROWSER_ARGS===void 0&&(process.env.BROWSER_ARGS=JSON.stringify(d.BROWSER_ARGS)),d=(0,s.default)({...process.env},d),i.length===0)return d;for(let[e,t]of Object.entries(d))i.some(t=>e.startsWith(t))&&(o[e]=String(t));for(let e in process.env)i.some(t=>e.startsWith(t))&&(o[e]=process.env[e]);return o}async function d(e,t,n=a.ENV_PREFIXES){return u(e,t,n)}async function f(e,t){return u(e,t)}exports.getEnvFilesForMode=c,exports.loadClientEnv=d,exports.loadEnv=u,exports.loadEnvFile=l,exports.loadServerEnv=f;
|