@stryke/env 0.20.86 → 0.20.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  3. package/dist/ci-checks.cjs +1 -0
  4. package/dist/ci-checks.d.cts.map +1 -1
  5. package/dist/ci-checks.d.mts.map +1 -1
  6. package/dist/environment-checks.cjs +11 -10
  7. package/dist/environment-checks.d.cts.map +1 -1
  8. package/dist/environment-checks.d.mts.map +1 -1
  9. package/dist/environment-checks.mjs +10 -10
  10. package/dist/environment-checks.mjs.map +1 -1
  11. package/dist/get-env-paths.cjs +31 -30
  12. package/dist/get-env-paths.d.cts.map +1 -1
  13. package/dist/get-env-paths.d.mts.map +1 -1
  14. package/dist/get-env-paths.mjs +2 -2
  15. package/dist/index.cjs +1 -0
  16. package/dist/load-env.cjs +16 -15
  17. package/dist/load-env.d.cts.map +1 -1
  18. package/dist/load-env.d.mts.map +1 -1
  19. package/dist/load-env.mjs +7 -7
  20. package/dist/load-env.mjs.map +1 -1
  21. package/dist/providers.cjs +5 -4
  22. package/dist/providers.d.cts.map +1 -1
  23. package/dist/providers.d.mts.map +1 -1
  24. package/dist/providers.mjs +4 -4
  25. package/dist/providers.mjs.map +1 -1
  26. package/dist/runtime-checks.cjs +1 -0
  27. package/dist/runtime-checks.d.cts.map +1 -1
  28. package/dist/runtime-checks.d.mts.map +1 -1
  29. package/dist/runtime-checks.mjs.map +1 -1
  30. package/dist/types.cjs +1 -0
  31. package/dist/types.d.cts.map +1 -1
  32. package/dist/types.d.mts.map +1 -1
  33. package/package.json +21 -21
  34. package/dist/convert/src/to-array.cjs +0 -15
  35. package/dist/convert/src/to-array.mjs +0 -15
  36. package/dist/convert/src/to-array.mjs.map +0 -1
  37. package/dist/fs/src/exists.cjs +0 -17
  38. package/dist/fs/src/exists.mjs +0 -16
  39. package/dist/fs/src/exists.mjs.map +0 -1
  40. package/dist/fs/src/read-file.cjs +0 -17
  41. package/dist/fs/src/read-file.mjs +0 -17
  42. package/dist/fs/src/read-file.mjs.map +0 -1
  43. package/dist/path/src/is-type.cjs +0 -28
  44. package/dist/path/src/is-type.mjs +0 -29
  45. package/dist/path/src/is-type.mjs.map +0 -1
  46. package/dist/path/src/join-paths.cjs +0 -122
  47. package/dist/path/src/join-paths.mjs +0 -123
  48. package/dist/path/src/join-paths.mjs.map +0 -1
  49. package/dist/path/src/regex.cjs +0 -12
  50. package/dist/path/src/regex.mjs +0 -9
  51. package/dist/path/src/regex.mjs.map +0 -1
  52. package/dist/path/src/slash.cjs +0 -15
  53. package/dist/path/src/slash.mjs +0 -15
  54. package/dist/path/src/slash.mjs.map +0 -1
  55. package/dist/string-format/src/acronyms.cjs +0 -415
  56. package/dist/string-format/src/acronyms.mjs +0 -415
  57. package/dist/string-format/src/acronyms.mjs.map +0 -1
  58. package/dist/string-format/src/articles.cjs +0 -10
  59. package/dist/string-format/src/articles.mjs +0 -10
  60. package/dist/string-format/src/articles.mjs.map +0 -1
  61. package/dist/string-format/src/combine.cjs +0 -15
  62. package/dist/string-format/src/combine.mjs +0 -15
  63. package/dist/string-format/src/combine.mjs.map +0 -1
  64. package/dist/string-format/src/conjunctions.cjs +0 -32
  65. package/dist/string-format/src/conjunctions.mjs +0 -32
  66. package/dist/string-format/src/conjunctions.mjs.map +0 -1
  67. package/dist/string-format/src/decamelize.cjs +0 -14
  68. package/dist/string-format/src/decamelize.mjs +0 -14
  69. package/dist/string-format/src/decamelize.mjs.map +0 -1
  70. package/dist/string-format/src/format-special-cases.cjs +0 -33
  71. package/dist/string-format/src/format-special-cases.mjs +0 -34
  72. package/dist/string-format/src/format-special-cases.mjs.map +0 -1
  73. package/dist/string-format/src/prepositions.cjs +0 -68
  74. package/dist/string-format/src/prepositions.mjs +0 -68
  75. package/dist/string-format/src/prepositions.mjs.map +0 -1
  76. package/dist/string-format/src/special-cases.cjs +0 -53
  77. package/dist/string-format/src/special-cases.mjs +0 -53
  78. package/dist/string-format/src/special-cases.mjs.map +0 -1
  79. package/dist/string-format/src/title-case.cjs +0 -20
  80. package/dist/string-format/src/title-case.mjs +0 -21
  81. package/dist/string-format/src/title-case.mjs.map +0 -1
  82. package/dist/string-format/src/upper-case-first.cjs +0 -17
  83. package/dist/string-format/src/upper-case-first.mjs +0 -17
  84. package/dist/string-format/src/upper-case-first.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"providers.mjs","names":["providers: InternalProvider[]","provider","provider: ProviderName"],"sources":["../src/providers.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// Reference: https://github.com/watson/ci-info/blob/v3.2.0/vendors.json\n\nexport type ProviderName =\n | \"\"\n | \"appveyor\"\n | \"aws_amplify\"\n | \"azure_pipelines\"\n | \"azure_static\"\n | \"appcircle\"\n | \"bamboo\"\n | \"bitbucket\"\n | \"bitrise\"\n | \"buddy\"\n | \"buildkite\"\n | \"circle\"\n | \"cirrus\"\n | \"cloudflare_pages\"\n | \"codebuild\"\n | \"codefresh\"\n | \"drone\"\n | \"drone\"\n | \"dsari\"\n | \"github_actions\"\n | \"gitlab\"\n | \"gocd\"\n | \"layerci\"\n | \"hudson\"\n | \"jenkins\"\n | \"magnum\"\n | \"netlify\"\n | \"nevercode\"\n | \"render\"\n | \"sail\"\n | \"semaphore\"\n | \"screwdriver\"\n | \"shippable\"\n | \"solano\"\n | \"strider\"\n | \"teamcity\"\n | \"travis\"\n | \"vercel\"\n | \"appcenter\"\n | \"codesandbox\"\n | \"stackblitz\"\n | \"stormkit\"\n | \"cleavr\"\n | \"zeabur\"\n | \"codesphere\"\n | \"railway\"\n | \"deno-deploy\"\n | \"firebase_app_hosting\";\n\ntype InternalProvider = [\n providerName: Uppercase<ProviderName>,\n envName?: string,\n meta?: Record<string, any>\n];\n\nconst providers: InternalProvider[] = [\n [\"APPVEYOR\"],\n [\"AWS_AMPLIFY\", \"AWS_APP_ID\", { ci: true }],\n [\"AZURE_PIPELINES\", \"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI\"],\n [\"AZURE_STATIC\", \"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN\"],\n [\"APPCIRCLE\", \"AC_APPCIRCLE\"],\n [\"BAMBOO\", \"bamboo_planKey\"],\n [\"BITBUCKET\", \"BITBUCKET_COMMIT\"],\n [\"BITRISE\", \"BITRISE_IO\"],\n [\"BUDDY\", \"BUDDY_WORKSPACE_ID\"],\n [\"BUILDKITE\"],\n [\"CIRCLE\", \"CIRCLECI\"],\n [\"CIRRUS\", \"CIRRUS_CI\"],\n [\"CLOUDFLARE_PAGES\", \"CF_PAGES\", { ci: true }],\n [\"CODEBUILD\", \"CODEBUILD_BUILD_ARN\"],\n [\"CODEFRESH\", \"CF_BUILD_ID\"],\n [\"DRONE\"],\n [\"DRONE\", \"DRONE_BUILD_EVENT\"],\n [\"DSARI\"],\n [\"GITHUB_ACTIONS\"],\n [\"GITLAB\", \"GITLAB_CI\"],\n [\"GITLAB\", \"CI_MERGE_REQUEST_ID\"],\n [\"GOCD\", \"GO_PIPELINE_LABEL\"],\n [\"LAYERCI\"],\n [\"HUDSON\", \"HUDSON_URL\"],\n [\"JENKINS\", \"JENKINS_URL\"],\n [\"MAGNUM\"],\n [\"NETLIFY\"],\n [\"NETLIFY\", \"NETLIFY_LOCAL\", { ci: false }],\n [\"NEVERCODE\"],\n [\"RENDER\"],\n [\"SAIL\", \"SAILCI\"],\n [\"SEMAPHORE\"],\n [\"SCREWDRIVER\"],\n [\"SHIPPABLE\"],\n [\"SOLANO\", \"TDDIUM\"],\n [\"STRIDER\"],\n [\"TEAMCITY\", \"TEAMCITY_VERSION\"],\n [\"TRAVIS\"],\n [\"VERCEL\", \"NOW_BUILDER\"],\n [\"VERCEL\", \"VERCEL\", { ci: false }],\n [\"VERCEL\", \"VERCEL_ENV\", { ci: false }],\n [\"APPCENTER\", \"APPCENTER_BUILD_ID\"],\n [\"CODESANDBOX\", \"CODESANDBOX_SSE\", { ci: false }],\n [\"STACKBLITZ\"],\n [\"STORMKIT\"],\n [\"CLEAVR\"],\n [\"ZEABUR\"],\n [\"CODESPHERE\", \"CODESPHERE_APP_ID\", { ci: true }],\n [\"RAILWAY\", \"RAILWAY_PROJECT_ID\"],\n [\"RAILWAY\", \"RAILWAY_SERVICE_ID\"],\n [\"DENO-DEPLOY\", \"DENO_DEPLOYMENT_ID\"],\n [\"FIREBASE_APP_HOSTING\", \"FIREBASE_APP_HOSTING\", { ci: true }]\n];\n\nexport interface ProviderInfo {\n name: ProviderName;\n ci?: boolean;\n [meta: string]: any;\n}\n\nfunction detectProvider(): ProviderInfo {\n // Based on env\n if (process?.env) {\n for (const provider of providers) {\n const envName = provider[1] || provider[0];\n if (process?.env[envName]) {\n return {\n name: provider[0].toLowerCase(),\n ...(provider[2] as any)\n };\n }\n }\n }\n\n // Stackblitz / Webcontainer\n if (process?.env?.SHELL === \"/bin/jsh\" && process?.versions?.webcontainer) {\n return {\n name: \"stackblitz\",\n ci: false\n };\n }\n\n return {\n name: \"\",\n ci: false\n };\n}\n\n/** Current provider info */\nexport const providerInfo = detectProvider();\nexport const provider: ProviderName = providerInfo.name;\n"],"mappings":";AA4EA,MAAMA,YAAgC;CACpC,CAAC,WAAW;CACZ;EAAC;EAAe;EAAc,EAAE,IAAI,MAAM;EAAC;CAC3C,CAAC,mBAAmB,qCAAqC;CACzD,CAAC,gBAAgB,wCAAwC;CACzD,CAAC,aAAa,eAAe;CAC7B,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SAAS,iBAA+B;AAEtC,KAAI,SAAS,IACX,MAAK,MAAMC,cAAY,WAAW;EAChC,MAAM,UAAUA,WAAS,MAAMA,WAAS;AACxC,MAAI,SAAS,IAAI,SACf,QAAO;GACL,MAAMA,WAAS,GAAG,aAAa;GAC/B,GAAIA,WAAS;GACd;;AAMP,KAAI,SAAS,KAAK,UAAU,cAAc,SAAS,UAAU,aAC3D,QAAO;EACL,MAAM;EACN,IAAI;EACL;AAGH,QAAO;EACL,MAAM;EACN,IAAI;EACL;;;AAIH,MAAa,eAAe,gBAAgB;AAC5C,MAAaC,WAAyB,aAAa"}
1
+ {"version":3,"file":"providers.mjs","names":[],"sources":["../src/providers.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// Reference: https://github.com/watson/ci-info/blob/v3.2.0/vendors.json\n\nexport type ProviderName =\n | \"\"\n | \"appveyor\"\n | \"aws_amplify\"\n | \"azure_pipelines\"\n | \"azure_static\"\n | \"appcircle\"\n | \"bamboo\"\n | \"bitbucket\"\n | \"bitrise\"\n | \"buddy\"\n | \"buildkite\"\n | \"circle\"\n | \"cirrus\"\n | \"cloudflare_pages\"\n | \"codebuild\"\n | \"codefresh\"\n | \"drone\"\n | \"drone\"\n | \"dsari\"\n | \"github_actions\"\n | \"gitlab\"\n | \"gocd\"\n | \"layerci\"\n | \"hudson\"\n | \"jenkins\"\n | \"magnum\"\n | \"netlify\"\n | \"nevercode\"\n | \"render\"\n | \"sail\"\n | \"semaphore\"\n | \"screwdriver\"\n | \"shippable\"\n | \"solano\"\n | \"strider\"\n | \"teamcity\"\n | \"travis\"\n | \"vercel\"\n | \"appcenter\"\n | \"codesandbox\"\n | \"stackblitz\"\n | \"stormkit\"\n | \"cleavr\"\n | \"zeabur\"\n | \"codesphere\"\n | \"railway\"\n | \"deno-deploy\"\n | \"firebase_app_hosting\";\n\ntype InternalProvider = [\n providerName: Uppercase<ProviderName>,\n envName?: string,\n meta?: Record<string, any>\n];\n\nconst providers: InternalProvider[] = [\n [\"APPVEYOR\"],\n [\"AWS_AMPLIFY\", \"AWS_APP_ID\", { ci: true }],\n [\"AZURE_PIPELINES\", \"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI\"],\n [\"AZURE_STATIC\", \"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN\"],\n [\"APPCIRCLE\", \"AC_APPCIRCLE\"],\n [\"BAMBOO\", \"bamboo_planKey\"],\n [\"BITBUCKET\", \"BITBUCKET_COMMIT\"],\n [\"BITRISE\", \"BITRISE_IO\"],\n [\"BUDDY\", \"BUDDY_WORKSPACE_ID\"],\n [\"BUILDKITE\"],\n [\"CIRCLE\", \"CIRCLECI\"],\n [\"CIRRUS\", \"CIRRUS_CI\"],\n [\"CLOUDFLARE_PAGES\", \"CF_PAGES\", { ci: true }],\n [\"CODEBUILD\", \"CODEBUILD_BUILD_ARN\"],\n [\"CODEFRESH\", \"CF_BUILD_ID\"],\n [\"DRONE\"],\n [\"DRONE\", \"DRONE_BUILD_EVENT\"],\n [\"DSARI\"],\n [\"GITHUB_ACTIONS\"],\n [\"GITLAB\", \"GITLAB_CI\"],\n [\"GITLAB\", \"CI_MERGE_REQUEST_ID\"],\n [\"GOCD\", \"GO_PIPELINE_LABEL\"],\n [\"LAYERCI\"],\n [\"HUDSON\", \"HUDSON_URL\"],\n [\"JENKINS\", \"JENKINS_URL\"],\n [\"MAGNUM\"],\n [\"NETLIFY\"],\n [\"NETLIFY\", \"NETLIFY_LOCAL\", { ci: false }],\n [\"NEVERCODE\"],\n [\"RENDER\"],\n [\"SAIL\", \"SAILCI\"],\n [\"SEMAPHORE\"],\n [\"SCREWDRIVER\"],\n [\"SHIPPABLE\"],\n [\"SOLANO\", \"TDDIUM\"],\n [\"STRIDER\"],\n [\"TEAMCITY\", \"TEAMCITY_VERSION\"],\n [\"TRAVIS\"],\n [\"VERCEL\", \"NOW_BUILDER\"],\n [\"VERCEL\", \"VERCEL\", { ci: false }],\n [\"VERCEL\", \"VERCEL_ENV\", { ci: false }],\n [\"APPCENTER\", \"APPCENTER_BUILD_ID\"],\n [\"CODESANDBOX\", \"CODESANDBOX_SSE\", { ci: false }],\n [\"STACKBLITZ\"],\n [\"STORMKIT\"],\n [\"CLEAVR\"],\n [\"ZEABUR\"],\n [\"CODESPHERE\", \"CODESPHERE_APP_ID\", { ci: true }],\n [\"RAILWAY\", \"RAILWAY_PROJECT_ID\"],\n [\"RAILWAY\", \"RAILWAY_SERVICE_ID\"],\n [\"DENO-DEPLOY\", \"DENO_DEPLOYMENT_ID\"],\n [\"FIREBASE_APP_HOSTING\", \"FIREBASE_APP_HOSTING\", { ci: true }]\n];\n\nexport interface ProviderInfo {\n name: ProviderName;\n ci?: boolean;\n [meta: string]: any;\n}\n\nfunction detectProvider(): ProviderInfo {\n // Based on env\n if (process?.env) {\n for (const provider of providers) {\n const envName = provider[1] || provider[0];\n if (process?.env[envName]) {\n return {\n name: provider[0].toLowerCase(),\n ...(provider[2] as any)\n };\n }\n }\n }\n\n // Stackblitz / Webcontainer\n if (process?.env?.SHELL === \"/bin/jsh\" && process?.versions?.webcontainer) {\n return {\n name: \"stackblitz\",\n ci: false\n };\n }\n\n return {\n name: \"\",\n ci: false\n };\n}\n\n/** Current provider info */\nexport const providerInfo = detectProvider();\nexport const provider: ProviderName = providerInfo.name;\n"],"mappings":";AA4EA,MAAM,YAAgC;CACpC,CAAC,WAAW;CACZ;EAAC;EAAe;EAAc,EAAE,IAAI,MAAM;EAAC;CAC3C,CAAC,mBAAmB,qCAAqC;CACzD,CAAC,gBAA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AAwB,EAAE,IAAI,MAAM;EAAC;CAC/D;AAQD,SAAS,iBAA+B;AAEtC,KAAI,SAAS,IACX,MAAK,MAAM,YAAY,WAAW;EAChC,MAAM,UAAU,SAAS,MAAM,SAAS;AACxC,MAAI,SAAS,IAAI,SACf,QAAO;GACL,MAAM,SAAS,GAAG,aAAa;GAC/B,GAAI,SAAS;GACd;;AAMP,KAAI,SAAS,KAAK,UAAU,cAAc,SAAS,UAAU,aAC3D,QAAO;EACL,MAAM;EACN,IAAI;EACL;AAGH,QAAO;EACL,MAAM;EACN,IAAI;EACL;;;AAIH,MAAa,eAAe,gBAAgB;AAC5C,MAAa,WAAyB,aAAa"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/runtime-checks.ts
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-checks.d.cts","names":[],"sources":["../src/runtime-checks.ts"],"sourcesContent":[],"mappings":";KAmBY,WAAA;AAAA,UAUK,WAAA,CAVM;EAUN,IAAA,EACT,WADoB;AAW5B;AAKA;AAKA;AAKA;AAKA;AAMA;AAMA;AAKA;AAYa,cAjDA,MAiDkC,EAAA,OAAA;AAwB/C;AAEA;;cAtEa;;;;cAKA;;;;cAKA;;;;cAKA;;;;;cAMA;;;;cAMA;;;;cAKA;;;;cAYA;cAwBA,aAAW;cAEX,SAAS"}
1
+ {"version":3,"file":"runtime-checks.d.cts","names":[],"sources":["../src/runtime-checks.ts"],"mappings":";KAmBY,WAAA;AAAA,UAUK,WAAA;EACf,IAAA,EAAM,WAAA;AAAA;;;AADR;;;;;cAWa,MAAA;;;;cAKA,KAAA;AAAb;;;AAAA,cAKa,MAAA;;AAAb;;cAKa,QAAA;;;AAAb;cAKa,SAAA;;;;AAAb;cAMa,WAAA;;;;cAMA,SAAA;;;;cAKA,eAAA;AALb;;;AAAA,cAiBa,eAAA;AAAA,cAwBA,WAAA,EAAW,WAAA;AAAA,cAEX,OAAA,EAAS,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-checks.d.mts","names":[],"sources":["../src/runtime-checks.ts"],"sourcesContent":[],"mappings":";KAmBY,WAAA;AAAA,UAUK,WAAA,CAVM;EAUN,IAAA,EACT,WADoB;AAW5B;AAKA;AAKA;AAKA;AAKA;AAMA;AAMA;AAKA;AAYa,cAjDA,MAiDkC,EAAA,OAAA;AAwB/C;AAEA;;cAtEa;;;;cAKA;;;;cAKA;;;;cAKA;;;;;cAMA;;;;cAMA;;;;cAKA;;;;cAYA;cAwBA,aAAW;cAEX,SAAS"}
1
+ {"version":3,"file":"runtime-checks.d.mts","names":[],"sources":["../src/runtime-checks.ts"],"mappings":";KAmBY,WAAA;AAAA,UAUK,WAAA;EACf,IAAA,EAAM,WAAA;AAAA;;;AADR;;;;;cAWa,MAAA;;;;cAKA,KAAA;AAAb;;;AAAA,cAKa,MAAA;;AAAb;;cAKa,QAAA;;;AAAb;cAKa,SAAA;;;;AAAb;cAMa,WAAA;;;;cAMA,SAAA;;;;cAKA,eAAA;AALb;;;AAAA,cAiBa,eAAA;AAAA,cAwBA,WAAA,EAAW,WAAA;AAAA,cAEX,OAAA,EAAS,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-checks.mjs","names":["runtimeChecks: [boolean, RuntimeName][]","runtime: RuntimeName"],"sources":["../src/runtime-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// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName =\n | \"workerd\"\n | \"deno\"\n | \"netlify\"\n | \"node\"\n | \"bun\"\n | \"edge-light\"\n | \"fastly\"\n | \"\";\n\nexport interface RuntimeInfo {\n name: RuntimeName;\n}\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.\n *\n * Use `runtime === \"node\"` if you need strict check for Node.js runtime.\n */\nexport const isNode = process?.release?.name === \"node\";\n\n/**\n * Indicates if running in Bun runtime.\n */\nexport const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);\n\n/**\n * Indicates if running in Deno runtime.\n */\nexport const isDeno = Boolean(Deno);\n\n/**\n * Indicates if running in Fastly runtime.\n */\nexport const isFastly = Boolean(fastly);\n\n/**\n * Indicates if running in Netlify runtime.\n */\nexport const isNetlify = Boolean(Netlify);\n\n/**\n *\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nexport const isEdgeLight = Boolean(EdgeRuntime);\n// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n */\nexport const isWorkerd = navigator?.userAgent === \"Cloudflare-Workers\";\n\n/**\n * Indicates if the code is running on the server-side\n */\nexport const isRuntimeServer =\n isNode ||\n isBun ||\n isDeno ||\n isFastly ||\n isNetlify ||\n isEdgeLight ||\n isWorkerd;\n\n/**\n * Indicates if the code is running in the browser (and not on the server).\n */\nexport const isRuntimeClient = !isRuntimeServer;\n\nconst runtimeChecks: [boolean, RuntimeName][] = [\n [isNetlify, \"netlify\"],\n [isEdgeLight, \"edge-light\"],\n [isWorkerd, \"workerd\"],\n [isFastly, \"fastly\"],\n [isDeno, \"deno\"],\n [isBun, \"bun\"],\n [isNode, \"node\"]\n];\n\nfunction detectRuntime(): RuntimeInfo | undefined {\n const detectedRuntime = runtimeChecks.find(check => check[0]);\n\n if (detectedRuntime) {\n const name = detectedRuntime[1];\n\n return { name };\n }\n\n return undefined;\n}\n\nexport const runtimeInfo = detectRuntime();\n\nexport const runtime: RuntimeName = runtimeInfo?.name || \"\";\n"],"mappings":";;;;;;;;AAwCA,MAAa,SAAS,SAAS,SAAS,SAAS;;;;AAKjD,MAAa,QAAQ,QAAQ,IAAI,IAAI,QAAQ,SAAS,UAAU,IAAI;;;;AAKpE,MAAa,SAAS,QAAQ,KAAK;;;;AAKnC,MAAa,WAAW,QAAQ,OAAO;;;;AAKvC,MAAa,YAAY,QAAQ,QAAQ;;;;;AAMzC,MAAa,cAAc,QAAQ,YAAY;;;;AAM/C,MAAa,YAAY,WAAW,cAAc;;;;AAKlD,MAAa,kBACX,UACA,SACA,UACA,YACA,aACA,eACA;;;;AAKF,MAAa,kBAAkB,CAAC;AAEhC,MAAMA,gBAA0C;CAC9C,CAAC,WAAW,UAAU;CACtB,CAAC,aAAa,aAAa;CAC3B,CAAC,WAAW,UAAU;CACtB,CAAC,UAAU,SAAS;CACpB,CAAC,QAAQ,OAAO;CAChB,CAAC,OAAO,MAAM;CACd,CAAC,QAAQ,OAAO;CACjB;AAED,SAAS,gBAAyC;CAChD,MAAM,kBAAkB,cAAc,MAAK,UAAS,MAAM,GAAG;AAE7D,KAAI,gBAGF,QAAO,EAAE,MAFI,gBAAgB,IAEd;;AAMnB,MAAa,cAAc,eAAe;AAE1C,MAAaC,UAAuB,aAAa,QAAQ"}
1
+ {"version":3,"file":"runtime-checks.mjs","names":[],"sources":["../src/runtime-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// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName =\n | \"workerd\"\n | \"deno\"\n | \"netlify\"\n | \"node\"\n | \"bun\"\n | \"edge-light\"\n | \"fastly\"\n | \"\";\n\nexport interface RuntimeInfo {\n name: RuntimeName;\n}\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.\n *\n * Use `runtime === \"node\"` if you need strict check for Node.js runtime.\n */\nexport const isNode = process?.release?.name === \"node\";\n\n/**\n * Indicates if running in Bun runtime.\n */\nexport const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);\n\n/**\n * Indicates if running in Deno runtime.\n */\nexport const isDeno = Boolean(Deno);\n\n/**\n * Indicates if running in Fastly runtime.\n */\nexport const isFastly = Boolean(fastly);\n\n/**\n * Indicates if running in Netlify runtime.\n */\nexport const isNetlify = Boolean(Netlify);\n\n/**\n *\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nexport const isEdgeLight = Boolean(EdgeRuntime);\n// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n */\nexport const isWorkerd = navigator?.userAgent === \"Cloudflare-Workers\";\n\n/**\n * Indicates if the code is running on the server-side\n */\nexport const isRuntimeServer =\n isNode ||\n isBun ||\n isDeno ||\n isFastly ||\n isNetlify ||\n isEdgeLight ||\n isWorkerd;\n\n/**\n * Indicates if the code is running in the browser (and not on the server).\n */\nexport const isRuntimeClient = !isRuntimeServer;\n\nconst runtimeChecks: [boolean, RuntimeName][] = [\n [isNetlify, \"netlify\"],\n [isEdgeLight, \"edge-light\"],\n [isWorkerd, \"workerd\"],\n [isFastly, \"fastly\"],\n [isDeno, \"deno\"],\n [isBun, \"bun\"],\n [isNode, \"node\"]\n];\n\nfunction detectRuntime(): RuntimeInfo | undefined {\n const detectedRuntime = runtimeChecks.find(check => check[0]);\n\n if (detectedRuntime) {\n const name = detectedRuntime[1];\n\n return { name };\n }\n\n return undefined;\n}\n\nexport const runtimeInfo = detectRuntime();\n\nexport const runtime: RuntimeName = runtimeInfo?.name || \"\";\n"],"mappings":";;;;;;;;AAwCA,MAAa,SAAS,SAAS,SAAS,SAAS;;;;AAKjD,MAAa,QAAQ,QAAQ,IAAI,IAAI,QAAQ,SAAS,UAAU,IAAI;;;;AAKpE,MAAa,SAAS,QAAQ,KAAK;;;;AAKnC,MAAa,WAAW,QAAQ,OAAO;;;;AAKvC,MAAa,YAAY,QAAQ,QAAQ;;;;;AAMzC,MAAa,cAAc,QAAQ,YAAY;;;;AAM/C,MAAa,YAAY,WAAW,cAAc;;;;AAKlD,MAAa,kBACX,UACA,SACA,UACA,YACA,aACA,eACA;;;;AAKF,MAAa,kBAAkB,CAAC;AAEhC,MAAM,gBAA0C;CAC9C,CAAC,WAAW,UAAU;CACtB,CAAC,aAAa,aAAa;CAC3B,CAAC,WAAW,UAAU;CACtB,CAAC,UAAU,SAAS;CACpB,CAAC,QAAQ,OAAO;CAChB,CAAC,OAAO,MAAM;CACd,CAAC,QAAQ,OAAO;CACjB;AAED,SAAS,gBAAyC;CAChD,MAAM,kBAAkB,cAAc,MAAK,UAAS,MAAM,GAAG;AAE7D,KAAI,gBAGF,QAAO,EAAE,MAFI,gBAAgB,IAEd;;AAMnB,MAAa,cAAc,eAAe;AAE1C,MAAa,UAAuB,aAAa,QAAQ"}
package/dist/types.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/types.ts
3
4
  const ENV_PREFIXES = [
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";cAkBa;AAAA,UASI,iBAAA,CAFhB;EAEgB,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAiB,GAAA,SAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";cAkBa,YAAA;AAAA,UASI,iBAAA;EAAA,CACd,IAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";cAkBa;AAAA,UASI,iBAAA,CAFhB;EAEgB,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAiB,GAAA,SAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";cAkBa,YAAA;AAAA,UASI,iBAAA;EAAA,CACd,IAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/env",
3
- "version": "0.20.86",
3
+ "version": "0.20.88",
4
4
  "private": false,
5
5
  "description": "A package containing utility functions to handle environment specific processes",
6
6
  "repository": {
@@ -10,32 +10,32 @@
10
10
  },
11
11
  "type": "module",
12
12
  "exports": {
13
- ".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
13
+ ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
14
14
  "./ci-checks": {
15
- "require": "./dist/ci-checks.cjs",
16
- "import": "./dist/ci-checks.mjs"
15
+ "import": "./dist/ci-checks.mjs",
16
+ "require": "./dist/ci-checks.cjs"
17
17
  },
18
18
  "./environment-checks": {
19
- "require": "./dist/environment-checks.cjs",
20
- "import": "./dist/environment-checks.mjs"
19
+ "import": "./dist/environment-checks.mjs",
20
+ "require": "./dist/environment-checks.cjs"
21
21
  },
22
22
  "./get-env-paths": {
23
- "require": "./dist/get-env-paths.cjs",
24
- "import": "./dist/get-env-paths.mjs"
23
+ "import": "./dist/get-env-paths.mjs",
24
+ "require": "./dist/get-env-paths.cjs"
25
25
  },
26
26
  "./load-env": {
27
- "require": "./dist/load-env.cjs",
28
- "import": "./dist/load-env.mjs"
27
+ "import": "./dist/load-env.mjs",
28
+ "require": "./dist/load-env.cjs"
29
29
  },
30
30
  "./providers": {
31
- "require": "./dist/providers.cjs",
32
- "import": "./dist/providers.mjs"
31
+ "import": "./dist/providers.mjs",
32
+ "require": "./dist/providers.cjs"
33
33
  },
34
34
  "./runtime-checks": {
35
- "require": "./dist/runtime-checks.cjs",
36
- "import": "./dist/runtime-checks.mjs"
35
+ "import": "./dist/runtime-checks.mjs",
36
+ "require": "./dist/runtime-checks.cjs"
37
37
  },
38
- "./types": { "require": "./dist/types.cjs", "import": "./dist/types.mjs" },
38
+ "./types": { "import": "./dist/types.mjs", "require": "./dist/types.cjs" },
39
39
  "./*": "./*"
40
40
  },
41
41
  "main": "./dist/index.cjs",
@@ -43,13 +43,13 @@
43
43
  "types": "./dist/index.d.cts",
44
44
  "dependencies": {
45
45
  "@dotenvx/dotenvx": "1.35.0",
46
- "@stryke/convert": "^0.7.2",
47
- "@stryke/fs": "^0.33.69",
48
- "@stryke/path": "^0.28.1",
49
- "@stryke/string-format": "^0.17.12",
46
+ "@stryke/convert": "^0.7.4",
47
+ "@stryke/fs": "^0.33.71",
48
+ "@stryke/path": "^0.28.3",
49
+ "@stryke/string-format": "^0.17.14",
50
50
  "defu": "^6.1.7"
51
51
  },
52
- "devDependencies": { "@types/node": "^24.12.2", "tsdown": "^0.17.2" },
52
+ "devDependencies": { "@types/node": "^24.12.2", "tsdown": "^0.21.10" },
53
53
  "publishConfig": { "access": "public" },
54
- "gitHead": "d934face11e0511f16942786bd609d4cec659ec6"
54
+ "gitHead": "b6886b6200909e934012026a76709bfeb90176dd"
55
55
  }
@@ -1,15 +0,0 @@
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,15 +0,0 @@
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 };
15
- //# sourceMappingURL=to-array.mjs.map
@@ -1 +0,0 @@
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,17 +0,0 @@
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;
@@ -1,16 +0,0 @@
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 };
16
- //# sourceMappingURL=exists.mjs.map
@@ -1 +0,0 @@
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,17 +0,0 @@
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,17 +0,0 @@
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 };
17
- //# sourceMappingURL=read-file.mjs.map
@@ -1 +0,0 @@
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":";;;;;;;;;AAuCA,MAAaA,aAAW,OAAO,aAAsC;AACnE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAGvD,QAAOC,SAAW,UAAU,EAAE,UAAU,QAAQ,CAAC"}
@@ -1,28 +0,0 @@
1
- const require_regex = require('./regex.cjs');
2
- const require_slash = require('./slash.cjs');
3
-
4
- //#region ../path/src/is-type.ts
5
- /**
6
- * Check if the path is an absolute path.
7
- *
8
- * @param path - The path to check
9
- * @returns An indicator specifying if the path is an absolute path
10
- */
11
- function isAbsolutePath(path) {
12
- return require_regex.ABSOLUTE_PATH_REGEX.test(require_slash.slash(path));
13
- }
14
- /**
15
- * Check if the path is an absolute path.
16
- *
17
- * @remarks
18
- * This is an alias for {@link isAbsolutePath}.
19
- *
20
- * @param path - The path to check
21
- * @returns An indicator specifying if the path is an absolute path
22
- */
23
- function isAbsolute(path) {
24
- return isAbsolutePath(path);
25
- }
26
-
27
- //#endregion
28
- exports.isAbsolute = isAbsolute;
@@ -1,29 +0,0 @@
1
- import { ABSOLUTE_PATH_REGEX } from "./regex.mjs";
2
- import { slash } from "./slash.mjs";
3
-
4
- //#region ../path/src/is-type.ts
5
- /**
6
- * Check if the path is an absolute path.
7
- *
8
- * @param path - The path to check
9
- * @returns An indicator specifying if the path is an absolute path
10
- */
11
- function isAbsolutePath(path) {
12
- return ABSOLUTE_PATH_REGEX.test(slash(path));
13
- }
14
- /**
15
- * Check if the path is an absolute path.
16
- *
17
- * @remarks
18
- * This is an alias for {@link isAbsolutePath}.
19
- *
20
- * @param path - The path to check
21
- * @returns An indicator specifying if the path is an absolute path
22
- */
23
- function isAbsolute(path) {
24
- return isAbsolutePath(path);
25
- }
26
-
27
- //#endregion
28
- export { isAbsolute };
29
- //# sourceMappingURL=is-type.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-type.mjs","names":[],"sources":["../../../../path/src/is-type.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 { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex\";\nimport { slash } from \"./slash\";\n\n/**\n * Check if the path is an absolute path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolutePath(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is an absolute path.\n *\n * @remarks\n * This is an alias for {@link isAbsolutePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolute(path: string): boolean {\n return isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelativePath(path: string): boolean {\n return !isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @remarks\n * This is an alias for {@link isRelativePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelative(path: string): boolean {\n return isRelativePath(path);\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n *\n * @example\n * ```ts\n * isNpmScopedPackage(\"@stryke/path\"); // returns true\n * isNpmScopedPackage(\"lodash\"); // returns false\n * isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackagePath(path: string): boolean {\n return NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n *\n * @example\n * ```ts\n * isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n * isNpmScopedPackagePath(\"lodash\"); // returns false\n * isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackage(path: string): boolean {\n return isNpmScopedPackagePath(path);\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,eAAe,MAAuB;AACpD,QAAO,oBAAoB,KAAK,MAAM,KAAK,CAAC;;;;;;;;;;;AAY9C,SAAgB,WAAW,MAAuB;AAChD,QAAO,eAAe,KAAK"}
@@ -1,122 +0,0 @@
1
- const require_regex = require('./regex.cjs');
2
- const require_slash = require('./slash.cjs');
3
- const require_is_type = require('./is-type.cjs');
4
-
5
- //#region ../path/src/join-paths.ts
6
- function normalizeWindowsPath(input = "") {
7
- if (!input) return input;
8
- return input.replace(/\\/g, "/").replace(require_regex.DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
9
- }
10
- function correctPaths(path) {
11
- if (!path || path.length === 0) return ".";
12
- path = normalizeWindowsPath(path);
13
- const isUNCPath = path.match(require_regex.UNC_REGEX);
14
- const isPathAbsolute = require_is_type.isAbsolute(path);
15
- const trailingSeparator = path[path.length - 1] === "/";
16
- path = normalizeString(path, !isPathAbsolute);
17
- if (path.length === 0) {
18
- if (isPathAbsolute) return "/";
19
- return trailingSeparator ? "./" : ".";
20
- }
21
- if (trailingSeparator) path += "/";
22
- if (require_regex.DRIVE_LETTER_REGEX.test(path)) path += "/";
23
- if (isUNCPath) {
24
- if (!isPathAbsolute) return `//./${path}`;
25
- return `//${path}`;
26
- }
27
- return isPathAbsolute && !require_is_type.isAbsolute(path) ? `/${path}` : path;
28
- }
29
- /**
30
- * Joins all given path segments together using the platform-specific separator as a delimiter.
31
- *
32
- * @remarks
33
- * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.
34
- *
35
- * @example
36
- * ```ts
37
- * import { joinPaths } from 'stryke/path';
38
- *
39
- * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');
40
- * console.log(fullPath); // Output: 'folder1/folder3/file.txt'
41
- *
42
- * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');
43
- * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'
44
- *
45
- * const windowsPath = joinPaths('C:\\', 'Users', 'Public', '..', 'Documents', 'file.txt');
46
- * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'
47
- *
48
- * const uncPath = joinPaths('\\\\Server\\Share', 'Folder', 'File.txt');
49
- * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'
50
- * ```
51
- *
52
- * @param segments - The path segments to join.
53
- * @returns The joined and normalized path string.
54
- */
55
- function joinPaths(...segments) {
56
- let result = "";
57
- for (const segment of segments) if (segment && require_slash.slash(segment).replaceAll(/\//g, "") !== ".") {
58
- if (result) if (require_slash.slash(segment).replaceAll(/\//g, "") === "..") result = require_slash.slash(result).replace(/\/+$/, "").replace(/\/*[^/]+$/, "");
59
- else result = `${require_slash.slash(result).replace(/\/+$/, "")}/${require_slash.slash(segment).replace(/^\/+/, "")}`;
60
- else if (require_slash.slash(segment).replaceAll(/\//g, "") !== "..") result = segment;
61
- }
62
- return correctPaths(result);
63
- }
64
- /**
65
- * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
66
- *
67
- * @param path - The path to normalize.
68
- * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
69
- * @returns the normalized path string.
70
- */
71
- function normalizeString(path, allowAboveRoot) {
72
- let res = "";
73
- let lastSegmentLength = 0;
74
- let lastSlash = -1;
75
- let dots = 0;
76
- let char = null;
77
- for (let index = 0; index <= path.length; ++index) {
78
- if (index < path.length) char = path[index];
79
- else if (char === "/") break;
80
- else char = "/";
81
- if (char === "/") {
82
- if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
83
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
84
- if (res.length > 2) {
85
- const lastSlashIndex = res.lastIndexOf("/");
86
- if (lastSlashIndex === -1) {
87
- res = "";
88
- lastSegmentLength = 0;
89
- } else {
90
- res = res.slice(0, lastSlashIndex);
91
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
92
- }
93
- lastSlash = index;
94
- dots = 0;
95
- continue;
96
- } else if (res.length > 0) {
97
- res = "";
98
- lastSegmentLength = 0;
99
- lastSlash = index;
100
- dots = 0;
101
- continue;
102
- }
103
- }
104
- if (allowAboveRoot) {
105
- res += res.length > 0 ? "/.." : "..";
106
- lastSegmentLength = 2;
107
- }
108
- } else {
109
- if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
110
- else res = path.slice(lastSlash + 1, index);
111
- lastSegmentLength = index - lastSlash - 1;
112
- }
113
- lastSlash = index;
114
- dots = 0;
115
- } else if (char === "." && dots !== -1) ++dots;
116
- else dots = -1;
117
- }
118
- return res;
119
- }
120
-
121
- //#endregion
122
- exports.joinPaths = joinPaths;
@@ -1,123 +0,0 @@
1
- import { DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX } from "./regex.mjs";
2
- import { slash } from "./slash.mjs";
3
- import { isAbsolute } from "./is-type.mjs";
4
-
5
- //#region ../path/src/join-paths.ts
6
- function normalizeWindowsPath(input = "") {
7
- if (!input) return input;
8
- return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
9
- }
10
- function correctPaths(path) {
11
- if (!path || path.length === 0) return ".";
12
- path = normalizeWindowsPath(path);
13
- const isUNCPath = path.match(UNC_REGEX);
14
- const isPathAbsolute = isAbsolute(path);
15
- const trailingSeparator = path[path.length - 1] === "/";
16
- path = normalizeString(path, !isPathAbsolute);
17
- if (path.length === 0) {
18
- if (isPathAbsolute) return "/";
19
- return trailingSeparator ? "./" : ".";
20
- }
21
- if (trailingSeparator) path += "/";
22
- if (DRIVE_LETTER_REGEX.test(path)) path += "/";
23
- if (isUNCPath) {
24
- if (!isPathAbsolute) return `//./${path}`;
25
- return `//${path}`;
26
- }
27
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
28
- }
29
- /**
30
- * Joins all given path segments together using the platform-specific separator as a delimiter.
31
- *
32
- * @remarks
33
- * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.
34
- *
35
- * @example
36
- * ```ts
37
- * import { joinPaths } from 'stryke/path';
38
- *
39
- * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');
40
- * console.log(fullPath); // Output: 'folder1/folder3/file.txt'
41
- *
42
- * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');
43
- * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'
44
- *
45
- * const windowsPath = joinPaths('C:\\', 'Users', 'Public', '..', 'Documents', 'file.txt');
46
- * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'
47
- *
48
- * const uncPath = joinPaths('\\\\Server\\Share', 'Folder', 'File.txt');
49
- * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'
50
- * ```
51
- *
52
- * @param segments - The path segments to join.
53
- * @returns The joined and normalized path string.
54
- */
55
- function joinPaths(...segments) {
56
- let result = "";
57
- for (const segment of segments) if (segment && slash(segment).replaceAll(/\//g, "") !== ".") {
58
- if (result) if (slash(segment).replaceAll(/\//g, "") === "..") result = slash(result).replace(/\/+$/, "").replace(/\/*[^/]+$/, "");
59
- else result = `${slash(result).replace(/\/+$/, "")}/${slash(segment).replace(/^\/+/, "")}`;
60
- else if (slash(segment).replaceAll(/\//g, "") !== "..") result = segment;
61
- }
62
- return correctPaths(result);
63
- }
64
- /**
65
- * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
66
- *
67
- * @param path - The path to normalize.
68
- * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
69
- * @returns the normalized path string.
70
- */
71
- function normalizeString(path, allowAboveRoot) {
72
- let res = "";
73
- let lastSegmentLength = 0;
74
- let lastSlash = -1;
75
- let dots = 0;
76
- let char = null;
77
- for (let index = 0; index <= path.length; ++index) {
78
- if (index < path.length) char = path[index];
79
- else if (char === "/") break;
80
- else char = "/";
81
- if (char === "/") {
82
- if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
83
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
84
- if (res.length > 2) {
85
- const lastSlashIndex = res.lastIndexOf("/");
86
- if (lastSlashIndex === -1) {
87
- res = "";
88
- lastSegmentLength = 0;
89
- } else {
90
- res = res.slice(0, lastSlashIndex);
91
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
92
- }
93
- lastSlash = index;
94
- dots = 0;
95
- continue;
96
- } else if (res.length > 0) {
97
- res = "";
98
- lastSegmentLength = 0;
99
- lastSlash = index;
100
- dots = 0;
101
- continue;
102
- }
103
- }
104
- if (allowAboveRoot) {
105
- res += res.length > 0 ? "/.." : "..";
106
- lastSegmentLength = 2;
107
- }
108
- } else {
109
- if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
110
- else res = path.slice(lastSlash + 1, index);
111
- lastSegmentLength = index - lastSlash - 1;
112
- }
113
- lastSlash = index;
114
- dots = 0;
115
- } else if (char === "." && dots !== -1) ++dots;
116
- else dots = -1;
117
- }
118
- return res;
119
- }
120
-
121
- //#endregion
122
- export { joinPaths };
123
- //# sourceMappingURL=join-paths.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"join-paths.mjs","names":["char: string | null"],"sources":["../../../../path/src/join-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 { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\nimport { slash } from \"./slash\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n *\n * @remarks\n * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @example\n * ```ts\n * import { joinPaths } from 'stryke/path';\n *\n * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');\n * console.log(fullPath); // Output: 'folder1/folder3/file.txt'\n *\n * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');\n * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'\n *\n * const windowsPath = joinPaths('C:\\\\', 'Users', 'Public', '..', 'Documents', 'file.txt');\n * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'\n *\n * const uncPath = joinPaths('\\\\\\\\Server\\\\Share', 'Folder', 'File.txt');\n * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'\n * ```\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let result = \"\";\n for (const segment of segments) {\n if (segment && slash(segment).replaceAll(/\\//g, \"\") !== \".\") {\n if (result) {\n if (slash(segment).replaceAll(/\\//g, \"\") === \"..\") {\n result = slash(result)\n .replace(/\\/+$/, \"\")\n .replace(/\\/*[^/]+$/, \"\");\n } else {\n result = `${slash(result).replace(/\\/+$/, \"\")}/${slash(\n segment\n ).replace(/^\\/+/, \"\")}`;\n }\n } else if (slash(segment).replaceAll(/\\//g, \"\") !== \"..\") {\n result = segment;\n }\n }\n }\n\n return correctPaths(result);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;;AA2BA,SAAS,qBAAqB,QAAQ,IAAI;AACxC,KAAI,CAAC,MACH,QAAO;AAET,QAAO,MACJ,QAAQ,OAAO,IAAI,CACnB,QAAQ,2BAA0B,MAAK,EAAE,aAAa,CAAC;;AAG5D,SAAS,aAAa,MAAe;AACnC,KAAI,CAAC,QAAQ,KAAK,WAAW,EAC3B,QAAO;AAIT,QAAO,qBAAqB,KAAK;CAEjC,MAAM,YAAY,KAAK,MAAM,UAAU;CACvC,MAAM,iBAAiB,WAAW,K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