@socketsecurity/lib 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/abort.js +60 -1
  3. package/dist/abort.js.map +2 -2
  4. package/dist/agent.js +289 -1
  5. package/dist/agent.js.map +2 -2
  6. package/dist/ansi.js +60 -1
  7. package/dist/ansi.js.map +2 -2
  8. package/dist/argv/flags.js +282 -1
  9. package/dist/argv/flags.js.map +2 -2
  10. package/dist/argv/parse.js +171 -1
  11. package/dist/argv/parse.js.map +2 -2
  12. package/dist/arrays.js +85 -1
  13. package/dist/arrays.js.map +2 -2
  14. package/dist/bin.js +419 -5
  15. package/dist/bin.js.map +2 -2
  16. package/dist/cacache.js +139 -1
  17. package/dist/cacache.js.map +2 -2
  18. package/dist/cache-with-ttl.js +223 -1
  19. package/dist/cache-with-ttl.js.map +2 -2
  20. package/dist/constants/agents.js +126 -1
  21. package/dist/constants/agents.js.map +2 -2
  22. package/dist/constants/core.js +57 -2
  23. package/dist/constants/core.js.map +2 -2
  24. package/dist/constants/encoding.js +48 -1
  25. package/dist/constants/encoding.js.map +2 -2
  26. package/dist/constants/github.js +30 -1
  27. package/dist/constants/github.js.map +2 -2
  28. package/dist/constants/licenses.js +66 -1
  29. package/dist/constants/licenses.js.map +2 -2
  30. package/dist/constants/node.js +185 -1
  31. package/dist/constants/node.js.map +2 -2
  32. package/dist/constants/packages.js +128 -1
  33. package/dist/constants/packages.js.map +2 -2
  34. package/dist/constants/paths.js +150 -1
  35. package/dist/constants/paths.js.map +2 -2
  36. package/dist/constants/platform.js +41 -1
  37. package/dist/constants/platform.js.map +2 -2
  38. package/dist/constants/process.js +52 -1
  39. package/dist/constants/process.js.map +2 -2
  40. package/dist/constants/socket.js +102 -1
  41. package/dist/constants/socket.js.map +2 -2
  42. package/dist/constants/testing.js +36 -1
  43. package/dist/constants/testing.js.map +2 -2
  44. package/dist/constants/time.js +39 -1
  45. package/dist/constants/time.js.map +2 -2
  46. package/dist/constants/typescript.js +54 -1
  47. package/dist/constants/typescript.js.map +2 -2
  48. package/dist/cover/code.js +135 -1
  49. package/dist/cover/code.js.map +2 -2
  50. package/dist/cover/formatters.js +101 -11
  51. package/dist/cover/formatters.js.map +2 -2
  52. package/dist/cover/type.js +63 -1
  53. package/dist/cover/type.js.map +2 -2
  54. package/dist/cover/types.js +15 -1
  55. package/dist/cover/types.js.map +2 -2
  56. package/dist/debug.js +337 -2
  57. package/dist/debug.js.map +2 -2
  58. package/dist/dlx-binary.js +408 -7
  59. package/dist/dlx-binary.js.map +2 -2
  60. package/dist/dlx-package.js +278 -7
  61. package/dist/dlx-package.js.map +2 -2
  62. package/dist/dlx.js +214 -7
  63. package/dist/dlx.js.map +2 -2
  64. package/dist/effects/pulse-frames.js +64 -1
  65. package/dist/effects/pulse-frames.js.map +2 -2
  66. package/dist/effects/text-shimmer.js +174 -1
  67. package/dist/effects/text-shimmer.js.map +2 -2
  68. package/dist/effects/types.js +15 -1
  69. package/dist/effects/types.js.map +2 -2
  70. package/dist/effects/ultra.js +61 -1
  71. package/dist/effects/ultra.js.map +2 -2
  72. package/dist/env/ci.js +31 -1
  73. package/dist/env/ci.js.map +2 -2
  74. package/dist/env/debug.js +30 -1
  75. package/dist/env/debug.js.map +2 -2
  76. package/dist/env/github.js +65 -1
  77. package/dist/env/github.js.map +2 -2
  78. package/dist/env/helpers.js +47 -1
  79. package/dist/env/helpers.js.map +2 -2
  80. package/dist/env/home.js +30 -1
  81. package/dist/env/home.js.map +2 -2
  82. package/dist/env/locale.js +40 -1
  83. package/dist/env/locale.js.map +2 -2
  84. package/dist/env/node-auth-token.js +30 -1
  85. package/dist/env/node-auth-token.js.map +2 -2
  86. package/dist/env/node-env.js +30 -1
  87. package/dist/env/node-env.js.map +2 -2
  88. package/dist/env/npm.js +50 -1
  89. package/dist/env/npm.js.map +2 -2
  90. package/dist/env/package-manager.js +73 -1
  91. package/dist/env/package-manager.js.map +2 -2
  92. package/dist/env/path.js +30 -1
  93. package/dist/env/path.js.map +2 -2
  94. package/dist/env/pre-commit.js +31 -1
  95. package/dist/env/pre-commit.js.map +2 -2
  96. package/dist/env/rewire.js +72 -1
  97. package/dist/env/rewire.js.map +2 -2
  98. package/dist/env/shell.js +30 -1
  99. package/dist/env/shell.js.map +2 -2
  100. package/dist/env/socket-cli-shadow.js +51 -1
  101. package/dist/env/socket-cli-shadow.js.map +2 -2
  102. package/dist/env/socket-cli.js +86 -1
  103. package/dist/env/socket-cli.js.map +2 -2
  104. package/dist/env/socket.js +101 -1
  105. package/dist/env/socket.js.map +2 -2
  106. package/dist/env/temp-dir.js +40 -1
  107. package/dist/env/temp-dir.js.map +2 -2
  108. package/dist/env/term.js +30 -1
  109. package/dist/env/term.js.map +2 -2
  110. package/dist/env/test.js +43 -1
  111. package/dist/env/test.js.map +2 -2
  112. package/dist/env/windows.js +45 -1
  113. package/dist/env/windows.js.map +2 -2
  114. package/dist/env/xdg.js +40 -1
  115. package/dist/env/xdg.js.map +2 -2
  116. package/dist/env.js +170 -1
  117. package/dist/env.js.map +2 -2
  118. package/dist/fs.js +670 -7
  119. package/dist/fs.js.map +2 -2
  120. package/dist/functions.js +68 -1
  121. package/dist/functions.js.map +2 -2
  122. package/dist/git.js +329 -2
  123. package/dist/git.js.map +2 -2
  124. package/dist/github.js +202 -1
  125. package/dist/github.js.map +2 -2
  126. package/dist/globs.js +149 -1
  127. package/dist/globs.js.map +2 -2
  128. package/dist/http-request.js +335 -3
  129. package/dist/http-request.js.map +2 -2
  130. package/dist/index.js +69 -1
  131. package/dist/index.js.map +2 -2
  132. package/dist/ipc.js +244 -1
  133. package/dist/ipc.js.map +2 -2
  134. package/dist/json.js +73 -1
  135. package/dist/json.js.map +2 -2
  136. package/dist/links/index.js +60 -1
  137. package/dist/links/index.js.map +2 -2
  138. package/dist/logger.js +1383 -6
  139. package/dist/logger.js.map +2 -2
  140. package/dist/maintained-node-versions.js +35 -1
  141. package/dist/maintained-node-versions.js.map +2 -2
  142. package/dist/memoization.js +210 -1
  143. package/dist/memoization.js.map +2 -2
  144. package/dist/objects.js +311 -1
  145. package/dist/objects.js.map +2 -2
  146. package/dist/packages/editable.js +356 -9
  147. package/dist/packages/editable.js.map +2 -2
  148. package/dist/packages/exports.js +162 -1
  149. package/dist/packages/exports.js.map +2 -2
  150. package/dist/packages/isolation.js +187 -1
  151. package/dist/packages/isolation.js.map +2 -2
  152. package/dist/packages/licenses.js +214 -1
  153. package/dist/packages/licenses.js.map +2 -2
  154. package/dist/packages/manifest.js +190 -1
  155. package/dist/packages/manifest.js.map +2 -2
  156. package/dist/packages/normalize.js +132 -1
  157. package/dist/packages/normalize.js.map +2 -2
  158. package/dist/packages/operations.js +320 -1
  159. package/dist/packages/operations.js.map +2 -2
  160. package/dist/packages/paths.js +53 -1
  161. package/dist/packages/paths.js.map +2 -2
  162. package/dist/packages/provenance.js +178 -1
  163. package/dist/packages/provenance.js.map +2 -2
  164. package/dist/packages/specs.js +83 -1
  165. package/dist/packages/specs.js.map +2 -2
  166. package/dist/packages/validation.js +51 -1
  167. package/dist/packages/validation.js.map +2 -2
  168. package/dist/packages.js +129 -1
  169. package/dist/packages.js.map +2 -2
  170. package/dist/path.js +446 -1
  171. package/dist/path.js.map +2 -2
  172. package/dist/paths/rewire.js +79 -1
  173. package/dist/paths/rewire.js.map +2 -2
  174. package/dist/paths.js +190 -1
  175. package/dist/paths.js.map +2 -2
  176. package/dist/performance.js +216 -15
  177. package/dist/performance.js.map +2 -2
  178. package/dist/process-lock.js +287 -8
  179. package/dist/process-lock.js.map +2 -2
  180. package/dist/promise-queue.js +109 -1
  181. package/dist/promise-queue.js.map +2 -2
  182. package/dist/promises.js +267 -1
  183. package/dist/promises.js.map +2 -2
  184. package/dist/prompts/index.js +45 -1
  185. package/dist/prompts/index.js.map +2 -2
  186. package/dist/prompts.js +58 -1
  187. package/dist/prompts.js.map +2 -2
  188. package/dist/regexps.js +30 -1
  189. package/dist/regexps.js.map +2 -2
  190. package/dist/sea.js +44 -1
  191. package/dist/sea.js.map +2 -2
  192. package/dist/shadow.js +58 -1
  193. package/dist/shadow.js.map +2 -2
  194. package/dist/signal-exit.js +248 -1
  195. package/dist/signal-exit.js.map +2 -2
  196. package/dist/sorts.js +94 -1
  197. package/dist/sorts.js.map +2 -2
  198. package/dist/spawn.js +200 -1
  199. package/dist/spawn.js.map +2 -2
  200. package/dist/spinner.js +961 -1
  201. package/dist/spinner.js.map +2 -2
  202. package/dist/ssri.js +71 -1
  203. package/dist/ssri.js.map +2 -2
  204. package/dist/stdio/clear.js +82 -1
  205. package/dist/stdio/clear.js.map +2 -2
  206. package/dist/stdio/divider.js +89 -3
  207. package/dist/stdio/divider.js.map +2 -2
  208. package/dist/stdio/footer.js +94 -2
  209. package/dist/stdio/footer.js.map +2 -2
  210. package/dist/stdio/header.js +100 -2
  211. package/dist/stdio/header.js.map +2 -2
  212. package/dist/stdio/mask.js +207 -5
  213. package/dist/stdio/mask.js.map +2 -2
  214. package/dist/stdio/progress.js +209 -2
  215. package/dist/stdio/progress.js.map +2 -2
  216. package/dist/stdio/prompts.js +88 -1
  217. package/dist/stdio/prompts.js.map +2 -2
  218. package/dist/stdio/stderr.js +89 -2
  219. package/dist/stdio/stderr.js.map +2 -2
  220. package/dist/stdio/stdout.js +103 -2
  221. package/dist/stdio/stdout.js.map +2 -2
  222. package/dist/streams.js +78 -1
  223. package/dist/streams.js.map +2 -2
  224. package/dist/strings.js +251 -3
  225. package/dist/strings.js.map +2 -2
  226. package/dist/suppress-warnings.js +98 -1
  227. package/dist/suppress-warnings.js.map +2 -2
  228. package/dist/tables.js +128 -3
  229. package/dist/tables.js.map +2 -2
  230. package/dist/temporary-executor.js +53 -1
  231. package/dist/temporary-executor.js.map +2 -2
  232. package/dist/themes/context.js +71 -1
  233. package/dist/themes/context.js.map +2 -2
  234. package/dist/themes/index.js +57 -1
  235. package/dist/themes/index.js.map +2 -2
  236. package/dist/themes/themes.js +195 -1
  237. package/dist/themes/themes.js.map +2 -2
  238. package/dist/themes/types.js +15 -1
  239. package/dist/themes/types.js.map +2 -2
  240. package/dist/themes/utils.js +116 -1
  241. package/dist/themes/utils.js.map +2 -2
  242. package/dist/types.js +59 -1
  243. package/dist/types.js.map +2 -2
  244. package/dist/url.js +142 -1
  245. package/dist/url.js.map +2 -2
  246. package/dist/utils/get-ipc.js +58 -1
  247. package/dist/utils/get-ipc.js.map +2 -2
  248. package/dist/validation/json-parser.js +127 -1
  249. package/dist/validation/json-parser.js.map +2 -2
  250. package/dist/validation/types.js +15 -1
  251. package/dist/validation/types.js.map +2 -2
  252. package/dist/versions.js +154 -1
  253. package/dist/versions.js.map +2 -2
  254. package/dist/words.js +50 -1
  255. package/dist/words.js.map +2 -2
  256. package/dist/zod.js +27 -1
  257. package/dist/zod.js.map +2 -2
  258. package/package.json +1 -1
package/dist/path.js CHANGED
@@ -1,3 +1,448 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var S=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of y(t))!H.call(e,r)&&r!==n&&S(e,r,{get:()=>t[r],enumerable:!(i=v(t,r))||i.enumerable});return e};var O=e=>D(S({},"__esModule",{value:!0}),e);var X={};I(X,{isAbsolute:()=>R,isNodeModules:()=>M,isPath:()=>Z,isRelative:()=>K,normalizePath:()=>U,pathLikeToString:()=>C,relativeResolve:()=>Q,splitPath:()=>j,trimLeadingDotSlash:()=>G});module.exports=O(X);var p=require("#constants/platform"),_=require("./strings");const P=92,$=58,W=47,V=97,q=122,b=65,w=90,E=/[/\\]/,z=/(?:^|[/\\])node_modules(?:[/\\]|$)/;function m(e){return e===W||e===P}function N(e){return e>=b&&e<=w||e>=V&&e<=q}let x;function T(){return x===void 0&&(x=require("node:buffer")),x}let L;function F(){return L===void 0&&(L=require("node:url")),L}function M(e){const t=C(e);return z.test(t)}function R(e){const t=C(e),{length:n}=t;if(n===0)return!1;const i=t.charCodeAt(0);return!!(i===W||i===P||p.WIN32&&n>2&&N(i)&&t.charCodeAt(1)===$&&m(t.charCodeAt(2)))}function Z(e){const t=C(e);if(typeof t!="string"||t.length===0||/^[a-z][a-z0-9+.-]+:/i.test(t))return!1;if(t==="."||t===".."||R(t))return!0;if(t.includes("/")||t.includes("\\")){if(t.startsWith("@")&&!t.startsWith("@/")){const n=t.split("/");if(n.length<=2&&!n[1]?.includes("\\"))return!1}return!0}return!1}function K(e){const t=C(e);return typeof t!="string"?!1:t.length===0?!0:!R(t)}function U(e){const t=C(e),{length:n}=t;if(n===0)return".";if(n<2)return n===1&&t.charCodeAt(0)===92?"/":t;let i=0,r=0,l="";if(n>4&&t.charCodeAt(3)===92){const s=t.charCodeAt(2);(s===63||s===46)&&t.charCodeAt(0)===92&&t.charCodeAt(1)===92&&(r=2,l="//")}if(r===0)if(n>2&&(t.charCodeAt(0)===92&&t.charCodeAt(1)===92&&t.charCodeAt(2)!==92||t.charCodeAt(0)===47&&t.charCodeAt(1)===47&&t.charCodeAt(2)!==47)){let s=-1,f=!1,c=2;for(;c<n&&(t.charCodeAt(c)===47||t.charCodeAt(c)===92);)c++;for(;c<n;){const a=t.charCodeAt(c);if(a===47||a===92){s=c;break}c++}if(s>2){for(c=s;c<n&&(t.charCodeAt(c)===47||t.charCodeAt(c)===92);)c++;c<n&&(f=!0)}if(s>2&&f)r=2,l="//";else{for(i=t.charCodeAt(r);i===47||i===92;)r+=1,i=t.charCodeAt(r);r&&(l="/")}}else{for(i=t.charCodeAt(r);i===47||i===92;)r+=1,i=t.charCodeAt(r);r&&(l="/")}let h=(0,_.search)(t,E,{fromIndex:r});if(h===-1){const s=t.slice(r);return s==="."||s.length===0?l||".":s===".."?l?l.slice(0,-1)||"/":"..":l+s}let o="",g=0,u=0;for(;h!==-1;){const s=t.slice(r,h);if(s.length>0&&s!==".")if(s==="..")if(g>0){const f=o.lastIndexOf("/");if(f===-1)o="",g=0,u>0&&!l&&(o="..",u=1);else{const c=f+1;o.slice(c)===".."?(o=`${o}/${s}`,u+=1):(o=o.slice(0,f),g-=1)}}else l||(o=o+(o.length===0?"":"/")+s,u+=1);else o=o+(o.length===0?"":"/")+s,g+=1;for(r=h+1,i=t.charCodeAt(r);i===47||i===92;)r+=1,i=t.charCodeAt(r);h=(0,_.search)(t,E,{fromIndex:r})}const d=t.slice(r);if(d.length>0&&d!==".")if(d==="..")if(g>0){const s=o.lastIndexOf("/");if(s===-1)o="",g=0,u>0&&!l&&(o="..",u=1);else{const f=s+1;o.slice(f)===".."?(o=`${o}/${d}`,u+=1):(o=o.slice(0,s),g-=1)}}else l||(o=o+(o.length===0?"":"/")+d,u+=1);else o=o+(o.length===0?"":"/")+d,g+=1;return o.length===0?l||".":l+o}function C(e){if(e==null)return"";if(typeof e=="string")return e;const{Buffer:t}=T();if(t.isBuffer(e))return e.toString("utf8");const n=F();if(e instanceof URL)try{return n.fileURLToPath(e)}catch{const i=e.pathname,r=decodeURIComponent(i);if(p.WIN32&&r.startsWith("/")){const l=r.charCodeAt(1)|32;if(!(r.length>=3&&l>=97&&l<=122&&r.charAt(2)===":"))return r}return r}return String(e)}function j(e){const t=C(e);return t===""?[]:t.split(E)}function G(e){const t=C(e);return t.startsWith("./")||t.startsWith(".\\")?t.slice(2):t}function B(...e){let t="",n=!1;for(let i=e.length-1;i>=0&&!n;i-=1){const r=e[i];typeof r!="string"||r.length===0||(t=r+(t.length===0?"":`/${t}`),n=R(r))}return n||(t=require("node:process").cwd()+(t.length===0?"":`/${t}`)),U(t)}function J(e,t){if(e===t)return"";const n=B(e),i=B(t);if(n===i)return"";if(p.WIN32){const a=n.toLowerCase(),A=i.toLowerCase();if(a===A)return""}const r=1,l=n.length,h=l-r,o=1,u=i.length-o,d=h<u?h:u;let s=-1,f=0;for(;f<d;f+=1){let a=n.charCodeAt(r+f),A=i.charCodeAt(o+f);if(p.WIN32&&(a>=b&&a<=w&&(a+=32),A>=b&&A<=w&&(A+=32)),a!==A)break;m(n.charCodeAt(r+f))&&(s=f)}if(f===d){if(u>d){const a=i.charCodeAt(o+f);if(m(a))return i.slice(o+f+1);if(f===0)return i.slice(o+f)}else if(h>d){const a=n.charCodeAt(r+f);m(a)?s=f:f===0&&(s=0)}}let c="";for(f=r+s+1;f<=l;f+=1){const a=n.charCodeAt(f);(f===l||m(a))&&(c+=c.length===0?"..":"/..")}return c+i.slice(o+s)}function Q(e,t){const n=J(e,t);return n===""?"":U(n)}0&&(module.exports={isAbsolute,isNodeModules,isPath,isRelative,normalizePath,pathLikeToString,relativeResolve,splitPath,trimLeadingDotSlash});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var path_exports = {};
20
+ __export(path_exports, {
21
+ isAbsolute: () => isAbsolute,
22
+ isNodeModules: () => isNodeModules,
23
+ isPath: () => isPath,
24
+ isRelative: () => isRelative,
25
+ normalizePath: () => normalizePath,
26
+ pathLikeToString: () => pathLikeToString,
27
+ relativeResolve: () => relativeResolve,
28
+ splitPath: () => splitPath,
29
+ trimLeadingDotSlash: () => trimLeadingDotSlash
30
+ });
31
+ module.exports = __toCommonJS(path_exports);
32
+ var import_platform = require("#constants/platform");
33
+ var import_strings = require("./strings");
34
+ const CHAR_BACKWARD_SLASH = 92;
35
+ const CHAR_COLON = 58;
36
+ const CHAR_FORWARD_SLASH = 47;
37
+ const CHAR_LOWERCASE_A = 97;
38
+ const CHAR_LOWERCASE_Z = 122;
39
+ const CHAR_UPPERCASE_A = 65;
40
+ const CHAR_UPPERCASE_Z = 90;
41
+ const slashRegExp = /[/\\]/;
42
+ const nodeModulesPathRegExp = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
43
+ // @__NO_SIDE_EFFECTS__
44
+ function isPathSeparator(code) {
45
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
46
+ }
47
+ // @__NO_SIDE_EFFECTS__
48
+ function isWindowsDeviceRoot(code) {
49
+ return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z || code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;
50
+ }
51
+ let _buffer;
52
+ // @__NO_SIDE_EFFECTS__
53
+ function getBuffer() {
54
+ if (_buffer === void 0) {
55
+ _buffer = require("node:buffer");
56
+ }
57
+ return _buffer;
58
+ }
59
+ let _url;
60
+ // @__NO_SIDE_EFFECTS__
61
+ function getUrl() {
62
+ if (_url === void 0) {
63
+ _url = require("node:url");
64
+ }
65
+ return _url;
66
+ }
67
+ // @__NO_SIDE_EFFECTS__
68
+ function isNodeModules(pathLike) {
69
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
70
+ return nodeModulesPathRegExp.test(filepath);
71
+ }
72
+ // @__NO_SIDE_EFFECTS__
73
+ function isAbsolute(pathLike) {
74
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
75
+ const { length } = filepath;
76
+ if (length === 0) {
77
+ return false;
78
+ }
79
+ const code = filepath.charCodeAt(0);
80
+ if (code === CHAR_FORWARD_SLASH) {
81
+ return true;
82
+ }
83
+ if (code === CHAR_BACKWARD_SLASH) {
84
+ return true;
85
+ }
86
+ if (import_platform.WIN32 && length > 2) {
87
+ if (/* @__PURE__ */ isWindowsDeviceRoot(code) && filepath.charCodeAt(1) === CHAR_COLON && /* @__PURE__ */ isPathSeparator(filepath.charCodeAt(2))) {
88
+ return true;
89
+ }
90
+ }
91
+ return false;
92
+ }
93
+ // @__NO_SIDE_EFFECTS__
94
+ function isPath(pathLike) {
95
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
96
+ if (typeof filepath !== "string" || filepath.length === 0) {
97
+ return false;
98
+ }
99
+ if (/^[a-z][a-z0-9+.-]+:/i.test(filepath)) {
100
+ return false;
101
+ }
102
+ if (filepath === "." || filepath === "..") {
103
+ return true;
104
+ }
105
+ if (/* @__PURE__ */ isAbsolute(filepath)) {
106
+ return true;
107
+ }
108
+ if (filepath.includes("/") || filepath.includes("\\")) {
109
+ if (filepath.startsWith("@") && !filepath.startsWith("@/")) {
110
+ const parts = filepath.split("/");
111
+ if (parts.length <= 2 && !parts[1]?.includes("\\")) {
112
+ return false;
113
+ }
114
+ }
115
+ return true;
116
+ }
117
+ return false;
118
+ }
119
+ // @__NO_SIDE_EFFECTS__
120
+ function isRelative(pathLike) {
121
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
122
+ if (typeof filepath !== "string") {
123
+ return false;
124
+ }
125
+ if (filepath.length === 0) {
126
+ return true;
127
+ }
128
+ return !/* @__PURE__ */ isAbsolute(filepath);
129
+ }
130
+ // @__NO_SIDE_EFFECTS__
131
+ function normalizePath(pathLike) {
132
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
133
+ const { length } = filepath;
134
+ if (length === 0) {
135
+ return ".";
136
+ }
137
+ if (length < 2) {
138
+ return length === 1 && filepath.charCodeAt(0) === 92 ? "/" : filepath;
139
+ }
140
+ let code = 0;
141
+ let start = 0;
142
+ let prefix = "";
143
+ if (length > 4 && filepath.charCodeAt(3) === 92) {
144
+ const code2 = filepath.charCodeAt(2);
145
+ if ((code2 === 63 || code2 === 46) && filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92) {
146
+ start = 2;
147
+ prefix = "//";
148
+ }
149
+ }
150
+ if (start === 0) {
151
+ if (length > 2 && (filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92 && filepath.charCodeAt(2) !== 92 || filepath.charCodeAt(0) === 47 && filepath.charCodeAt(1) === 47 && filepath.charCodeAt(2) !== 47)) {
152
+ let firstSegmentEnd = -1;
153
+ let hasSecondSegment = false;
154
+ let i = 2;
155
+ while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
156
+ i++;
157
+ }
158
+ while (i < length) {
159
+ const char = filepath.charCodeAt(i);
160
+ if (char === 47 || char === 92) {
161
+ firstSegmentEnd = i;
162
+ break;
163
+ }
164
+ i++;
165
+ }
166
+ if (firstSegmentEnd > 2) {
167
+ i = firstSegmentEnd;
168
+ while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
169
+ i++;
170
+ }
171
+ if (i < length) {
172
+ hasSecondSegment = true;
173
+ }
174
+ }
175
+ if (firstSegmentEnd > 2 && hasSecondSegment) {
176
+ start = 2;
177
+ prefix = "//";
178
+ } else {
179
+ code = filepath.charCodeAt(start);
180
+ while (code === 47 || code === 92) {
181
+ start += 1;
182
+ code = filepath.charCodeAt(start);
183
+ }
184
+ if (start) {
185
+ prefix = "/";
186
+ }
187
+ }
188
+ } else {
189
+ code = filepath.charCodeAt(start);
190
+ while (code === 47 || code === 92) {
191
+ start += 1;
192
+ code = filepath.charCodeAt(start);
193
+ }
194
+ if (start) {
195
+ prefix = "/";
196
+ }
197
+ }
198
+ }
199
+ let nextIndex = (0, import_strings.search)(filepath, slashRegExp, { fromIndex: start });
200
+ if (nextIndex === -1) {
201
+ const segment = filepath.slice(start);
202
+ if (segment === "." || segment.length === 0) {
203
+ return prefix || ".";
204
+ }
205
+ if (segment === "..") {
206
+ return prefix ? prefix.slice(0, -1) || "/" : "..";
207
+ }
208
+ return prefix + segment;
209
+ }
210
+ let collapsed = "";
211
+ let segmentCount = 0;
212
+ let leadingDotDots = 0;
213
+ while (nextIndex !== -1) {
214
+ const segment = filepath.slice(start, nextIndex);
215
+ if (segment.length > 0 && segment !== ".") {
216
+ if (segment === "..") {
217
+ if (segmentCount > 0) {
218
+ const lastSeparatorIndex = collapsed.lastIndexOf("/");
219
+ if (lastSeparatorIndex === -1) {
220
+ collapsed = "";
221
+ segmentCount = 0;
222
+ if (leadingDotDots > 0 && !prefix) {
223
+ collapsed = "..";
224
+ leadingDotDots = 1;
225
+ }
226
+ } else {
227
+ const lastSegmentStart = lastSeparatorIndex + 1;
228
+ const lastSegmentValue = collapsed.slice(lastSegmentStart);
229
+ if (lastSegmentValue === "..") {
230
+ collapsed = `${collapsed}/${segment}`;
231
+ leadingDotDots += 1;
232
+ } else {
233
+ collapsed = collapsed.slice(0, lastSeparatorIndex);
234
+ segmentCount -= 1;
235
+ }
236
+ }
237
+ } else if (!prefix) {
238
+ collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + segment;
239
+ leadingDotDots += 1;
240
+ }
241
+ } else {
242
+ collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + segment;
243
+ segmentCount += 1;
244
+ }
245
+ }
246
+ start = nextIndex + 1;
247
+ code = filepath.charCodeAt(start);
248
+ while (code === 47 || code === 92) {
249
+ start += 1;
250
+ code = filepath.charCodeAt(start);
251
+ }
252
+ nextIndex = (0, import_strings.search)(filepath, slashRegExp, { fromIndex: start });
253
+ }
254
+ const lastSegment = filepath.slice(start);
255
+ if (lastSegment.length > 0 && lastSegment !== ".") {
256
+ if (lastSegment === "..") {
257
+ if (segmentCount > 0) {
258
+ const lastSeparatorIndex = collapsed.lastIndexOf("/");
259
+ if (lastSeparatorIndex === -1) {
260
+ collapsed = "";
261
+ segmentCount = 0;
262
+ if (leadingDotDots > 0 && !prefix) {
263
+ collapsed = "..";
264
+ leadingDotDots = 1;
265
+ }
266
+ } else {
267
+ const lastSegmentStart = lastSeparatorIndex + 1;
268
+ const lastSegmentValue = collapsed.slice(lastSegmentStart);
269
+ if (lastSegmentValue === "..") {
270
+ collapsed = `${collapsed}/${lastSegment}`;
271
+ leadingDotDots += 1;
272
+ } else {
273
+ collapsed = collapsed.slice(0, lastSeparatorIndex);
274
+ segmentCount -= 1;
275
+ }
276
+ }
277
+ } else if (!prefix) {
278
+ collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + lastSegment;
279
+ leadingDotDots += 1;
280
+ }
281
+ } else {
282
+ collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + lastSegment;
283
+ segmentCount += 1;
284
+ }
285
+ }
286
+ if (collapsed.length === 0) {
287
+ return prefix || ".";
288
+ }
289
+ return prefix + collapsed;
290
+ }
291
+ // @__NO_SIDE_EFFECTS__
292
+ function pathLikeToString(pathLike) {
293
+ if (pathLike === null || pathLike === void 0) {
294
+ return "";
295
+ }
296
+ if (typeof pathLike === "string") {
297
+ return pathLike;
298
+ }
299
+ const { Buffer: Buffer2 } = /* @__PURE__ */ getBuffer();
300
+ if (Buffer2.isBuffer(pathLike)) {
301
+ return pathLike.toString("utf8");
302
+ }
303
+ const url = /* @__PURE__ */ getUrl();
304
+ if (pathLike instanceof URL) {
305
+ try {
306
+ return url.fileURLToPath(pathLike);
307
+ } catch {
308
+ const pathname = pathLike.pathname;
309
+ const decodedPathname = decodeURIComponent(pathname);
310
+ if (import_platform.WIN32 && decodedPathname.startsWith("/")) {
311
+ const letter = decodedPathname.charCodeAt(1) | 32;
312
+ const hasValidDriveLetter = decodedPathname.length >= 3 && letter >= 97 && // 'a' to 'z'
313
+ letter <= 122 && decodedPathname.charAt(2) === ":";
314
+ if (!hasValidDriveLetter) {
315
+ return decodedPathname;
316
+ }
317
+ }
318
+ return decodedPathname;
319
+ }
320
+ }
321
+ return String(pathLike);
322
+ }
323
+ // @__NO_SIDE_EFFECTS__
324
+ function splitPath(pathLike) {
325
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
326
+ if (filepath === "") {
327
+ return [];
328
+ }
329
+ return filepath.split(slashRegExp);
330
+ }
331
+ // @__NO_SIDE_EFFECTS__
332
+ function trimLeadingDotSlash(pathLike) {
333
+ const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
334
+ if (filepath.startsWith("./") || filepath.startsWith(".\\")) {
335
+ return filepath.slice(2);
336
+ }
337
+ return filepath;
338
+ }
339
+ // @__NO_SIDE_EFFECTS__
340
+ function resolve(...segments) {
341
+ let resolvedPath = "";
342
+ let resolvedAbsolute = false;
343
+ for (let i = segments.length - 1; i >= 0 && !resolvedAbsolute; i -= 1) {
344
+ const segment = segments[i];
345
+ if (typeof segment !== "string" || segment.length === 0) {
346
+ continue;
347
+ }
348
+ resolvedPath = segment + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
349
+ resolvedAbsolute = /* @__PURE__ */ isAbsolute(segment);
350
+ }
351
+ if (!resolvedAbsolute) {
352
+ const cwd = /* @__PURE__ */ require("node:process").cwd();
353
+ resolvedPath = cwd + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
354
+ }
355
+ return /* @__PURE__ */ normalizePath(resolvedPath);
356
+ }
357
+ // @__NO_SIDE_EFFECTS__
358
+ function relative(from, to) {
359
+ if (from === to) {
360
+ return "";
361
+ }
362
+ const actualFrom = /* @__PURE__ */ resolve(from);
363
+ const actualTo = /* @__PURE__ */ resolve(to);
364
+ if (actualFrom === actualTo) {
365
+ return "";
366
+ }
367
+ if (import_platform.WIN32) {
368
+ const fromLower = actualFrom.toLowerCase();
369
+ const toLower = actualTo.toLowerCase();
370
+ if (fromLower === toLower) {
371
+ return "";
372
+ }
373
+ }
374
+ const fromStart = 1;
375
+ const fromEnd = actualFrom.length;
376
+ const fromLen = fromEnd - fromStart;
377
+ const toStart = 1;
378
+ const toEnd = actualTo.length;
379
+ const toLen = toEnd - toStart;
380
+ const length = fromLen < toLen ? fromLen : toLen;
381
+ let lastCommonSep = -1;
382
+ let i = 0;
383
+ for (; i < length; i += 1) {
384
+ let fromCode = actualFrom.charCodeAt(fromStart + i);
385
+ let toCode = actualTo.charCodeAt(toStart + i);
386
+ if (import_platform.WIN32) {
387
+ if (fromCode >= CHAR_UPPERCASE_A && fromCode <= CHAR_UPPERCASE_Z) {
388
+ fromCode += 32;
389
+ }
390
+ if (toCode >= CHAR_UPPERCASE_A && toCode <= CHAR_UPPERCASE_Z) {
391
+ toCode += 32;
392
+ }
393
+ }
394
+ if (fromCode !== toCode) {
395
+ break;
396
+ }
397
+ if (/* @__PURE__ */ isPathSeparator(actualFrom.charCodeAt(fromStart + i))) {
398
+ lastCommonSep = i;
399
+ }
400
+ }
401
+ if (i === length) {
402
+ if (toLen > length) {
403
+ const toCode = actualTo.charCodeAt(toStart + i);
404
+ if (/* @__PURE__ */ isPathSeparator(toCode)) {
405
+ return actualTo.slice(toStart + i + 1);
406
+ }
407
+ if (i === 0) {
408
+ return actualTo.slice(toStart + i);
409
+ }
410
+ } else if (fromLen > length) {
411
+ const fromCode = actualFrom.charCodeAt(fromStart + i);
412
+ if (/* @__PURE__ */ isPathSeparator(fromCode)) {
413
+ lastCommonSep = i;
414
+ } else if (i === 0) {
415
+ lastCommonSep = 0;
416
+ }
417
+ }
418
+ }
419
+ let out = "";
420
+ for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
421
+ const code = actualFrom.charCodeAt(i);
422
+ if (i === fromEnd || /* @__PURE__ */ isPathSeparator(code)) {
423
+ out += out.length === 0 ? ".." : "/..";
424
+ }
425
+ }
426
+ return out + actualTo.slice(toStart + lastCommonSep);
427
+ }
428
+ // @__NO_SIDE_EFFECTS__
429
+ function relativeResolve(from, to) {
430
+ const rel = /* @__PURE__ */ relative(from, to);
431
+ if (rel === "") {
432
+ return "";
433
+ }
434
+ return /* @__PURE__ */ normalizePath(rel);
435
+ }
436
+ // Annotate the CommonJS export names for ESM import in node:
437
+ 0 && (module.exports = {
438
+ isAbsolute,
439
+ isNodeModules,
440
+ isPath,
441
+ isRelative,
442
+ normalizePath,
443
+ pathLikeToString,
444
+ relativeResolve,
445
+ splitPath,
446
+ trimLeadingDotSlash
447
+ });
3
448
  //# sourceMappingURL=path.js.map