mirror of
https://github.com/bewcloud/bewcloud.git
synced 2026-03-11 08:54:49 +00:00
3 lines
1.5 KiB
JavaScript
3 lines
1.5 KiB
JavaScript
|
|
/* esm.sh - @jsr/std__path@1.1.4/windows/resolve */
|
||
|
|
import{CHAR_COLON as p}from"../_common/constants.mjs";import{normalizeString as v}from"../_common/normalize_string.mjs";import{assertPath as g}from"../_common/assert_path.mjs";import{isPathSeparator as l,isWindowsDeviceRoot as A}from"./_util.mjs";function k(...w){let o="",n="",c=!1;for(let d=w.length-1;d>=-1;d--){let t,{Deno:a}=globalThis;if(d>=0)t=w[d];else if(o){if(typeof a?.env?.get!="function"||typeof a?.cwd!="function")throw new TypeError("Resolved a relative path without a current working directory (CWD)");t=a.cwd(),(t===void 0||t.slice(0,3).toLowerCase()!==`${o.toLowerCase()}\\`)&&(t=`${o}\\`)}else{if(typeof a?.cwd!="function")throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)");t=a.cwd()}g(t);let r=t.length;if(r===0)continue;let f=0,s="",h=!1,u=t.charCodeAt(0);if(r>1)if(l(u))if(h=!0,l(t.charCodeAt(1))){let e=2,i=e;for(;e<r&&!l(t.charCodeAt(e));++e);if(e<r&&e!==i){let C=t.slice(i,e);for(i=e;e<r&&l(t.charCodeAt(e));++e);if(e<r&&e!==i){for(i=e;e<r&&!l(t.charCodeAt(e));++e);e===r?(s=`\\\\${C}\\${t.slice(i)}`,f=e):e!==i&&(s=`\\\\${C}\\${t.slice(i,e)}`,f=e)}}}else f=1;else A(u)&&t.charCodeAt(1)===p&&(s=t.slice(0,2),f=2,r>2&&l(t.charCodeAt(2))&&(h=!0,f=3));else l(u)&&(f=1,h=!0);if(!(s.length>0&&o.length>0&&s.toLowerCase()!==o.toLowerCase())&&(o.length===0&&s.length>0&&(o=s),c||(n=`${t.slice(f)}\\${n}`,c=h),c&&o.length>0))break}return n=v(n,!c,"\\",l),o+(c?"\\":"")+n||"."}export{k as resolve};
|
||
|
|
//resolve.mjs.map
|