@stryke/env 0.20.49 → 0.20.50
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 +7 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/ci-checks.cjs +23 -1
- package/dist/ci-checks.mjs +21 -1
- package/dist/ci-checks.mjs.map +1 -1
- package/dist/convert/src/to-array.cjs +15 -1
- package/dist/convert/src/to-array.mjs +14 -1
- package/dist/convert/src/to-array.mjs.map +1 -1
- package/dist/environment-checks.cjs +156 -1
- package/dist/environment-checks.mjs +139 -1
- package/dist/environment-checks.mjs.map +1 -1
- package/dist/fs/src/exists.cjs +17 -1
- package/dist/fs/src/exists.mjs +15 -1
- package/dist/fs/src/exists.mjs.map +1 -1
- package/dist/fs/src/read-file.cjs +17 -1
- package/dist/fs/src/read-file.mjs +16 -1
- package/dist/fs/src/read-file.mjs.map +1 -1
- package/dist/get-env-paths.cjs +87 -1
- package/dist/get-env-paths.mjs +84 -1
- package/dist/get-env-paths.mjs.map +1 -1
- package/dist/index.cjs +48 -1
- package/dist/index.mjs +9 -1
- package/dist/load-env.cjs +124 -1
- package/dist/load-env.mjs +118 -1
- package/dist/load-env.mjs.map +1 -1
- package/dist/path/src/is-type.cjs +28 -1
- package/dist/path/src/is-type.mjs +28 -1
- package/dist/path/src/is-type.mjs.map +1 -1
- package/dist/path/src/join-paths.cjs +106 -1
- package/dist/path/src/join-paths.mjs +106 -1
- package/dist/path/src/join-paths.mjs.map +1 -1
- package/dist/path/src/regex.cjs +12 -1
- package/dist/path/src/regex.mjs +8 -1
- package/dist/path/src/regex.mjs.map +1 -1
- package/dist/path/src/slash.cjs +15 -1
- package/dist/path/src/slash.mjs +14 -1
- package/dist/path/src/slash.mjs.map +1 -1
- package/dist/providers.cjs +112 -1
- package/dist/providers.mjs +110 -1
- package/dist/providers.mjs.map +1 -1
- package/dist/runtime-checks.cjs +71 -1
- package/dist/runtime-checks.mjs +60 -1
- package/dist/runtime-checks.mjs.map +1 -1
- package/dist/string-format/src/acronyms.cjs +408 -1
- package/dist/string-format/src/acronyms.mjs +407 -1
- package/dist/string-format/src/acronyms.mjs.map +1 -1
- package/dist/string-format/src/articles.cjs +10 -1
- package/dist/string-format/src/articles.mjs +9 -1
- package/dist/string-format/src/articles.mjs.map +1 -1
- package/dist/string-format/src/combine.cjs +15 -1
- package/dist/string-format/src/combine.mjs +14 -1
- package/dist/string-format/src/combine.mjs.map +1 -1
- package/dist/string-format/src/conjunctions.cjs +32 -1
- package/dist/string-format/src/conjunctions.mjs +31 -1
- package/dist/string-format/src/conjunctions.mjs.map +1 -1
- package/dist/string-format/src/decamelize.cjs +14 -1
- package/dist/string-format/src/decamelize.mjs +13 -1
- package/dist/string-format/src/decamelize.mjs.map +1 -1
- package/dist/string-format/src/format-special-cases.cjs +33 -1
- package/dist/string-format/src/format-special-cases.mjs +33 -1
- package/dist/string-format/src/format-special-cases.mjs.map +1 -1
- package/dist/string-format/src/prepositions.cjs +68 -1
- package/dist/string-format/src/prepositions.mjs +67 -1
- package/dist/string-format/src/prepositions.mjs.map +1 -1
- package/dist/string-format/src/special-cases.cjs +53 -1
- package/dist/string-format/src/special-cases.mjs +52 -1
- package/dist/string-format/src/special-cases.mjs.map +1 -1
- package/dist/string-format/src/title-case.cjs +19 -1
- package/dist/string-format/src/title-case.mjs +19 -1
- package/dist/string-format/src/title-case.mjs.map +1 -1
- package/dist/string-format/src/upper-case-first.cjs +17 -1
- package/dist/string-format/src/upper-case-first.mjs +16 -1
- package/dist/string-format/src/upper-case-first.mjs.map +1 -1
- package/dist/types.cjs +13 -1
- package/dist/types.mjs +12 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - Env
|
|
4
4
|
|
|
5
|
+
## [0.20.49](https://github.com/storm-software/stryke/releases/tag/env%400.20.49) (01/16/2026)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **path** to **v0.25.0**
|
|
10
|
+
- Updated **fs** to **v0.33.32**
|
|
11
|
+
|
|
5
12
|
## [0.20.48](https://github.com/storm-software/stryke/releases/tag/env%400.20.48) (01/16/2026)
|
|
6
13
|
|
|
7
14
|
### Updated Dependencies
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/ci-checks.cjs
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/ci-checks.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if the current environment is a CI environment.
|
|
5
|
+
*
|
|
6
|
+
* @returns True if the current environment is a CI environment.
|
|
7
|
+
*/
|
|
8
|
+
const isCI = (env = process.env) => {
|
|
9
|
+
return Boolean(env.STORM_CI || env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || env.AGOLA_GIT_REF || env.AC_APPCIRCLE || env.APPVEYOR || env.CODEBUILD || env.TF_BUILD || env.bamboo_planKey || env.BITBUCKET_COMMIT || env.BITRISE_IO || env.BUDDY_WORKSPACE_ID || env.BUILDKITE || env.CIRCLECI || env.CIRRUS_CI || env.CF_BUILD_ID || env.CM_BUILD_ID || env.CI_NAME || env.DRONE || env.DSARI || env.EARTHLY_CI || env.EAS_BUILD || env.GERRIT_PROJECT || env.GITEA_ACTIONS || env.GITHUB_ACTIONS || env.GITLAB_CI || env.GOCD || env.BUILDER_OUTPUT || env.HARNESS_BUILD_ID || env.JENKINS_URL || env.BUILD_ID || env.LAYERCI || env.MAGNUM || env.NETLIFY || env.NEVERCODE || env.PROW_JOB_ID || env.RELEASE_BUILD_ID || env.RENDER || env.SAILCI || env.HUDSON || env.JENKINS_URL || env.BUILD_ID || env.SCREWDRIVER || env.SEMAPHORE || env.SOURCEHUT || env.STRIDER || env.TASK_ID || env.RUN_ID || env.TEAMCITY_VERSION || env.TRAVIS || env.VELA || env.NOW_BUILDER || env.APPCENTER_BUILD_ID || env.CI_XCODE_PROJECT || env.XCS || false);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Check if the current process is interactive
|
|
13
|
+
*
|
|
14
|
+
* @param stream - The stream to check
|
|
15
|
+
* @returns True if the current process is interactive
|
|
16
|
+
*/
|
|
17
|
+
const isInteractive = (stream = process.stdin) => {
|
|
18
|
+
return Boolean(stream?.isTTY && process.env.TERM !== "dumb");
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.isCI = isCI;
|
|
23
|
+
exports.isInteractive = isInteractive;
|
package/dist/ci-checks.mjs
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/ci-checks.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
|
+
const isCI = (env = process.env) => {
|
|
8
|
+
return Boolean(env.STORM_CI || env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || env.AGOLA_GIT_REF || env.AC_APPCIRCLE || env.APPVEYOR || env.CODEBUILD || env.TF_BUILD || env.bamboo_planKey || env.BITBUCKET_COMMIT || env.BITRISE_IO || env.BUDDY_WORKSPACE_ID || env.BUILDKITE || env.CIRCLECI || env.CIRRUS_CI || env.CF_BUILD_ID || env.CM_BUILD_ID || env.CI_NAME || env.DRONE || env.DSARI || env.EARTHLY_CI || env.EAS_BUILD || env.GERRIT_PROJECT || env.GITEA_ACTIONS || env.GITHUB_ACTIONS || env.GITLAB_CI || env.GOCD || env.BUILDER_OUTPUT || env.HARNESS_BUILD_ID || env.JENKINS_URL || env.BUILD_ID || env.LAYERCI || env.MAGNUM || env.NETLIFY || env.NEVERCODE || env.PROW_JOB_ID || env.RELEASE_BUILD_ID || env.RENDER || env.SAILCI || env.HUDSON || env.JENKINS_URL || env.BUILD_ID || env.SCREWDRIVER || env.SEMAPHORE || env.SOURCEHUT || env.STRIDER || env.TASK_ID || env.RUN_ID || env.TEAMCITY_VERSION || env.TRAVIS || env.VELA || env.NOW_BUILDER || env.APPCENTER_BUILD_ID || env.CI_XCODE_PROJECT || env.XCS || false);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Check if the current process is interactive
|
|
12
|
+
*
|
|
13
|
+
* @param stream - The stream to check
|
|
14
|
+
* @returns True if the current process is interactive
|
|
15
|
+
*/
|
|
16
|
+
const isInteractive = (stream = process.stdin) => {
|
|
17
|
+
return Boolean(stream?.isTTY && process.env.TERM !== "dumb");
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isCI, isInteractive };
|
|
2
22
|
//# sourceMappingURL=ci-checks.mjs.map
|
package/dist/ci-checks.mjs.map
CHANGED
|
@@ -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,
|
|
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 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region ../convert/src/to-array.ts
|
|
3
|
+
/**
|
|
4
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
5
|
+
*
|
|
6
|
+
* @param array - The `Arrayable<T>` to convert
|
|
7
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
8
|
+
*/
|
|
9
|
+
function toArray(array) {
|
|
10
|
+
array = array ?? [];
|
|
11
|
+
return Array.isArray(array) ? array : [array];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.toArray = toArray;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../convert/src/to-array.ts
|
|
2
|
+
/**
|
|
3
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
4
|
+
*
|
|
5
|
+
* @param array - The `Arrayable<T>` to convert
|
|
6
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
7
|
+
*/
|
|
8
|
+
function toArray(array) {
|
|
9
|
+
array = array ?? [];
|
|
10
|
+
return Array.isArray(array) ? array : [array];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toArray };
|
|
2
15
|
//# sourceMappingURL=to-array.mjs.map
|
|
@@ -1 +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,
|
|
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,QAAW,OAA0C;AACnE,SAAQ,SAAS,EAAE;AACnB,QAAO,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM"}
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_ci_checks = require('./ci-checks.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/environment-checks.ts
|
|
4
|
+
/** Value of process.platform */
|
|
5
|
+
const platform = process?.platform || "";
|
|
6
|
+
/** Detect if stdout.TTY is available */
|
|
7
|
+
const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);
|
|
8
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
9
|
+
const isDebug = Boolean(process.env.DEBUG);
|
|
10
|
+
/** Detect the `NODE_ENV` environment variable */
|
|
11
|
+
const mode = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
|
|
12
|
+
/** Detect if the application is running in a staging environment */
|
|
13
|
+
const isStaging = [
|
|
14
|
+
"stg",
|
|
15
|
+
"stage",
|
|
16
|
+
"staging"
|
|
17
|
+
].includes(mode?.toLowerCase());
|
|
18
|
+
/**
|
|
19
|
+
* Check if the current environment is production.
|
|
20
|
+
*
|
|
21
|
+
* @param mode - The mode string to check.
|
|
22
|
+
* @returns Whether the environment is production
|
|
23
|
+
*/
|
|
24
|
+
function isProductionMode(mode$1) {
|
|
25
|
+
return [
|
|
26
|
+
"prd",
|
|
27
|
+
"prod",
|
|
28
|
+
"production",
|
|
29
|
+
"preprod",
|
|
30
|
+
"preproduction",
|
|
31
|
+
"uat"
|
|
32
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
33
|
+
}
|
|
34
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
35
|
+
const isProduction = isProductionMode(mode);
|
|
36
|
+
/**
|
|
37
|
+
* Check if the current environment is test.
|
|
38
|
+
*
|
|
39
|
+
* @param mode - The mode string to check.
|
|
40
|
+
* @returns Whether the environment is test
|
|
41
|
+
*/
|
|
42
|
+
function isTestMode(mode$1) {
|
|
43
|
+
return [
|
|
44
|
+
"tst",
|
|
45
|
+
"test",
|
|
46
|
+
"testing",
|
|
47
|
+
"stg",
|
|
48
|
+
"stage",
|
|
49
|
+
"staging",
|
|
50
|
+
"qa",
|
|
51
|
+
"qualityassurance"
|
|
52
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
53
|
+
}
|
|
54
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
55
|
+
const isTest = isTestMode(mode) || isStaging || Boolean(process.env.TEST);
|
|
56
|
+
/**
|
|
57
|
+
* Check if the current environment is development.
|
|
58
|
+
*
|
|
59
|
+
* @param mode - The mode string to check.
|
|
60
|
+
* @returns Whether the environment is development
|
|
61
|
+
*/
|
|
62
|
+
function isDevelopmentMode(mode$1) {
|
|
63
|
+
return [
|
|
64
|
+
"dev",
|
|
65
|
+
"development",
|
|
66
|
+
"int",
|
|
67
|
+
"integration"
|
|
68
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
69
|
+
}
|
|
70
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
71
|
+
const isDevelopment = isDevelopmentMode(mode) || isDebug;
|
|
72
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
73
|
+
const isMinimal = Boolean(process.env.MINIMAL) || require_ci_checks.isCI() || isTest || !hasTTY;
|
|
74
|
+
/** Detect if process.platform is Windows */
|
|
75
|
+
const isWindows = /^win/i.test(platform);
|
|
76
|
+
/** Detect if process.platform is Linux */
|
|
77
|
+
const isLinux = /^linux/i.test(platform);
|
|
78
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
79
|
+
const isMacOS = /^darwin/i.test(platform);
|
|
80
|
+
/** Color Support */
|
|
81
|
+
const isColorSupported = !process.env.NO_COLOR && (Boolean(process.env.FORCE_COLOR) || (hasTTY || isWindows) && process.env.TERM !== "dumb" || require_ci_checks.isCI());
|
|
82
|
+
function parseVersion(versionString = "") {
|
|
83
|
+
if (/^\d{3,4}$/.test(versionString)) {
|
|
84
|
+
const match = /(\d{1,2})(\d{2})/.exec(versionString) ?? [];
|
|
85
|
+
return {
|
|
86
|
+
major: 0,
|
|
87
|
+
minor: Number.parseInt(match[1], 10),
|
|
88
|
+
patch: Number.parseInt(match[2], 10)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const versions = (versionString ?? "").split(".").map((n) => Number.parseInt(n, 10));
|
|
92
|
+
return {
|
|
93
|
+
major: versions[0],
|
|
94
|
+
minor: versions[1],
|
|
95
|
+
patch: versions[2]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if the current environment supports hyperlinks in the terminal.
|
|
100
|
+
*
|
|
101
|
+
* @param stream - The stream to check for TTY support (default: process.stdout)
|
|
102
|
+
* @returns Whether hyperlinks are supported
|
|
103
|
+
*/
|
|
104
|
+
function isHyperlinkSupported(stream = process.stdout) {
|
|
105
|
+
if (process.env.FORCE_HYPERLINK) return !(process.env.FORCE_HYPERLINK.length > 0 && Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0);
|
|
106
|
+
if (process.env.NETLIFY) return true;
|
|
107
|
+
else if (!isColorSupported) return false;
|
|
108
|
+
else if (stream && !stream.isTTY) return false;
|
|
109
|
+
else if ("WT_SESSION" in process.env) return true;
|
|
110
|
+
else if (process.platform === "win32") return false;
|
|
111
|
+
else if (require_ci_checks.isCI()) return false;
|
|
112
|
+
else if (process.env.TEAMCITY_VERSION) return false;
|
|
113
|
+
else if (process.env.TERM_PROGRAM) {
|
|
114
|
+
const version = parseVersion(process.env.TERM_PROGRAM_VERSION);
|
|
115
|
+
switch (process.env.TERM_PROGRAM) {
|
|
116
|
+
case "iTerm.app":
|
|
117
|
+
if (version.major === 3) return version.minor !== void 0 && version.minor >= 1;
|
|
118
|
+
return version.major !== void 0 && version.major > 3;
|
|
119
|
+
case "WezTerm": return version.major !== void 0 && version.major >= 20200620;
|
|
120
|
+
case "vscode":
|
|
121
|
+
if (process.env.CURSOR_TRACE_ID) return true;
|
|
122
|
+
return version.minor !== void 0 && version.major !== void 0 && (version.major > 1 || version.major === 1 && version.minor >= 72);
|
|
123
|
+
case "ghostty": return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (process.env.VTE_VERSION) {
|
|
127
|
+
if (process.env.VTE_VERSION === "0.50.0") return false;
|
|
128
|
+
const version = parseVersion(process.env.VTE_VERSION);
|
|
129
|
+
return version.major !== void 0 && version.major > 0 || version.minor !== void 0 && version.minor >= 50;
|
|
130
|
+
}
|
|
131
|
+
if (process.env.TERM === "alacritty") return true;
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/** Node.js versions */
|
|
135
|
+
const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
|
|
136
|
+
const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
exports.hasTTY = hasTTY;
|
|
140
|
+
exports.isColorSupported = isColorSupported;
|
|
141
|
+
exports.isDebug = isDebug;
|
|
142
|
+
exports.isDevelopment = isDevelopment;
|
|
143
|
+
exports.isDevelopmentMode = isDevelopmentMode;
|
|
144
|
+
exports.isHyperlinkSupported = isHyperlinkSupported;
|
|
145
|
+
exports.isLinux = isLinux;
|
|
146
|
+
exports.isMacOS = isMacOS;
|
|
147
|
+
exports.isMinimal = isMinimal;
|
|
148
|
+
exports.isProduction = isProduction;
|
|
149
|
+
exports.isProductionMode = isProductionMode;
|
|
150
|
+
exports.isStaging = isStaging;
|
|
151
|
+
exports.isTest = isTest;
|
|
152
|
+
exports.isTestMode = isTestMode;
|
|
153
|
+
exports.isWindows = isWindows;
|
|
154
|
+
exports.nodeMajorVersion = nodeMajorVersion;
|
|
155
|
+
exports.nodeVersion = nodeVersion;
|
|
156
|
+
exports.platform = platform;
|
|
@@ -1,2 +1,140 @@
|
|
|
1
|
-
import{isCI
|
|
1
|
+
import { isCI } from "./ci-checks.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/environment-checks.ts
|
|
4
|
+
/** Value of process.platform */
|
|
5
|
+
const platform = process?.platform || "";
|
|
6
|
+
/** Detect if stdout.TTY is available */
|
|
7
|
+
const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);
|
|
8
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
9
|
+
const isDebug = Boolean(process.env.DEBUG);
|
|
10
|
+
/** Detect the `NODE_ENV` environment variable */
|
|
11
|
+
const mode = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
|
|
12
|
+
/** Detect if the application is running in a staging environment */
|
|
13
|
+
const isStaging = [
|
|
14
|
+
"stg",
|
|
15
|
+
"stage",
|
|
16
|
+
"staging"
|
|
17
|
+
].includes(mode?.toLowerCase());
|
|
18
|
+
/**
|
|
19
|
+
* Check if the current environment is production.
|
|
20
|
+
*
|
|
21
|
+
* @param mode - The mode string to check.
|
|
22
|
+
* @returns Whether the environment is production
|
|
23
|
+
*/
|
|
24
|
+
function isProductionMode(mode$1) {
|
|
25
|
+
return [
|
|
26
|
+
"prd",
|
|
27
|
+
"prod",
|
|
28
|
+
"production",
|
|
29
|
+
"preprod",
|
|
30
|
+
"preproduction",
|
|
31
|
+
"uat"
|
|
32
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
33
|
+
}
|
|
34
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
35
|
+
const isProduction = isProductionMode(mode);
|
|
36
|
+
/**
|
|
37
|
+
* Check if the current environment is test.
|
|
38
|
+
*
|
|
39
|
+
* @param mode - The mode string to check.
|
|
40
|
+
* @returns Whether the environment is test
|
|
41
|
+
*/
|
|
42
|
+
function isTestMode(mode$1) {
|
|
43
|
+
return [
|
|
44
|
+
"tst",
|
|
45
|
+
"test",
|
|
46
|
+
"testing",
|
|
47
|
+
"stg",
|
|
48
|
+
"stage",
|
|
49
|
+
"staging",
|
|
50
|
+
"qa",
|
|
51
|
+
"qualityassurance"
|
|
52
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
53
|
+
}
|
|
54
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
55
|
+
const isTest = isTestMode(mode) || isStaging || Boolean(process.env.TEST);
|
|
56
|
+
/**
|
|
57
|
+
* Check if the current environment is development.
|
|
58
|
+
*
|
|
59
|
+
* @param mode - The mode string to check.
|
|
60
|
+
* @returns Whether the environment is development
|
|
61
|
+
*/
|
|
62
|
+
function isDevelopmentMode(mode$1) {
|
|
63
|
+
return [
|
|
64
|
+
"dev",
|
|
65
|
+
"development",
|
|
66
|
+
"int",
|
|
67
|
+
"integration"
|
|
68
|
+
].includes(mode$1?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
69
|
+
}
|
|
70
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
71
|
+
const isDevelopment = isDevelopmentMode(mode) || isDebug;
|
|
72
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
73
|
+
const isMinimal = Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;
|
|
74
|
+
/** Detect if process.platform is Windows */
|
|
75
|
+
const isWindows = /^win/i.test(platform);
|
|
76
|
+
/** Detect if process.platform is Linux */
|
|
77
|
+
const isLinux = /^linux/i.test(platform);
|
|
78
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
79
|
+
const isMacOS = /^darwin/i.test(platform);
|
|
80
|
+
/** Color Support */
|
|
81
|
+
const isColorSupported = !process.env.NO_COLOR && (Boolean(process.env.FORCE_COLOR) || (hasTTY || isWindows) && process.env.TERM !== "dumb" || isCI());
|
|
82
|
+
function parseVersion(versionString = "") {
|
|
83
|
+
if (/^\d{3,4}$/.test(versionString)) {
|
|
84
|
+
const match = /(\d{1,2})(\d{2})/.exec(versionString) ?? [];
|
|
85
|
+
return {
|
|
86
|
+
major: 0,
|
|
87
|
+
minor: Number.parseInt(match[1], 10),
|
|
88
|
+
patch: Number.parseInt(match[2], 10)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const versions = (versionString ?? "").split(".").map((n) => Number.parseInt(n, 10));
|
|
92
|
+
return {
|
|
93
|
+
major: versions[0],
|
|
94
|
+
minor: versions[1],
|
|
95
|
+
patch: versions[2]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if the current environment supports hyperlinks in the terminal.
|
|
100
|
+
*
|
|
101
|
+
* @param stream - The stream to check for TTY support (default: process.stdout)
|
|
102
|
+
* @returns Whether hyperlinks are supported
|
|
103
|
+
*/
|
|
104
|
+
function isHyperlinkSupported(stream = process.stdout) {
|
|
105
|
+
if (process.env.FORCE_HYPERLINK) return !(process.env.FORCE_HYPERLINK.length > 0 && Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0);
|
|
106
|
+
if (process.env.NETLIFY) return true;
|
|
107
|
+
else if (!isColorSupported) return false;
|
|
108
|
+
else if (stream && !stream.isTTY) return false;
|
|
109
|
+
else if ("WT_SESSION" in process.env) return true;
|
|
110
|
+
else if (process.platform === "win32") return false;
|
|
111
|
+
else if (isCI()) return false;
|
|
112
|
+
else if (process.env.TEAMCITY_VERSION) return false;
|
|
113
|
+
else if (process.env.TERM_PROGRAM) {
|
|
114
|
+
const version = parseVersion(process.env.TERM_PROGRAM_VERSION);
|
|
115
|
+
switch (process.env.TERM_PROGRAM) {
|
|
116
|
+
case "iTerm.app":
|
|
117
|
+
if (version.major === 3) return version.minor !== void 0 && version.minor >= 1;
|
|
118
|
+
return version.major !== void 0 && version.major > 3;
|
|
119
|
+
case "WezTerm": return version.major !== void 0 && version.major >= 20200620;
|
|
120
|
+
case "vscode":
|
|
121
|
+
if (process.env.CURSOR_TRACE_ID) return true;
|
|
122
|
+
return version.minor !== void 0 && version.major !== void 0 && (version.major > 1 || version.major === 1 && version.minor >= 72);
|
|
123
|
+
case "ghostty": return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (process.env.VTE_VERSION) {
|
|
127
|
+
if (process.env.VTE_VERSION === "0.50.0") return false;
|
|
128
|
+
const version = parseVersion(process.env.VTE_VERSION);
|
|
129
|
+
return version.major !== void 0 && version.major > 0 || version.minor !== void 0 && version.minor >= 50;
|
|
130
|
+
}
|
|
131
|
+
if (process.env.TERM === "alacritty") return true;
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/** Node.js versions */
|
|
135
|
+
const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
|
|
136
|
+
const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { hasTTY, isColorSupported, isDebug, isDevelopment, isDevelopmentMode, isHyperlinkSupported, isLinux, isMacOS, isMinimal, isProduction, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeMajorVersion, nodeVersion, platform };
|
|
2
140
|
//# sourceMappingURL=environment-checks.mjs.map
|
|
@@ -1 +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":"
|
|
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":"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"}
|
package/dist/fs/src/exists.cjs
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_fs_promises = require("node:fs/promises");
|
|
4
|
+
|
|
5
|
+
//#region ../fs/src/exists.ts
|
|
6
|
+
/**
|
|
7
|
+
* Check if a file exists
|
|
8
|
+
*
|
|
9
|
+
* @param filePath - The file path to check
|
|
10
|
+
* @returns An indicator specifying if the file exists
|
|
11
|
+
*/
|
|
12
|
+
function existsSync(filePath) {
|
|
13
|
+
return (0, node_fs.existsSync)(filePath);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.existsSync = existsSync;
|
package/dist/fs/src/exists.mjs
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import{existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
//#region ../fs/src/exists.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if a file exists
|
|
6
|
+
*
|
|
7
|
+
* @param filePath - The file path to check
|
|
8
|
+
* @returns An indicator specifying if the file exists
|
|
9
|
+
*/
|
|
10
|
+
function existsSync$1(filePath) {
|
|
11
|
+
return existsSync(filePath);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { existsSync$1 as existsSync };
|
|
2
16
|
//# sourceMappingURL=exists.mjs.map
|
|
@@ -1 +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":"
|
|
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":";;;;;;;;;AA2BA,SAAgBA,aAAW,UAA2B;AACpD,QAAOC,WAAa,SAAS"}
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_fs_promises = require("node:fs/promises");
|
|
4
|
+
|
|
5
|
+
//#region ../fs/src/read-file.ts
|
|
6
|
+
/**
|
|
7
|
+
* Read the given content to the given file path
|
|
8
|
+
*
|
|
9
|
+
* @param filePath - The file path to read to
|
|
10
|
+
*/
|
|
11
|
+
const readFile = async (filePath) => {
|
|
12
|
+
if (!filePath) throw new Error("No file path provided to read data");
|
|
13
|
+
return (0, node_fs_promises.readFile)(filePath, { encoding: "utf8" });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.readFile = readFile;
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
import{existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
//#region ../fs/src/read-file.ts
|
|
5
|
+
/**
|
|
6
|
+
* Read the given content to the given file path
|
|
7
|
+
*
|
|
8
|
+
* @param filePath - The file path to read to
|
|
9
|
+
*/
|
|
10
|
+
const readFile$1 = async (filePath) => {
|
|
11
|
+
if (!filePath) throw new Error("No file path provided to read data");
|
|
12
|
+
return readFile(filePath, { encoding: "utf8" });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { readFile$1 as readFile };
|
|
2
17
|
//# sourceMappingURL=read-file.mjs.map
|