@gjsify/path 0.3.19 → 0.3.21

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.
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t as __exportAll};
1
+ var e=Object.defineProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{__exportAll};
package/lib/esm/posix.js CHANGED
@@ -1 +1 @@
1
- import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import"./constants.js";import{_format as t,assertPath as n,isPosixPathSeparator as r,normalizeString as i}from"./util.js";var a=e({basename:()=>g,delimiter:()=>`:`,dirname:()=>h,extname:()=>_,format:()=>v,isAbsolute:()=>d,join:()=>f,normalize:()=>u,parse:()=>y,relative:()=>p,resolve:()=>l,sep:()=>`/`,toNamespacedPath:()=>m});const o=`/`,s=`:`;function c(){if(typeof globalThis.process?.cwd==`function`)return globalThis.process.cwd();try{let e=globalThis.imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function l(...e){let t=``,a=!1;for(let r=e.length-1;r>=-1&&!a;r--){let i;if(r>=0){if(i=e[r],n(i),i.length===0)continue}else i=c();t=`${i}/${t}`,a=i.charCodeAt(0)===47}return t=i(t,!a,`/`,r),a?t.length>0?`/${t}`:`/`:t.length>0?t:`.`}function u(e){if(n(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,a=e.charCodeAt(e.length-1)===47,o=i(e,!t,`/`,r);return o.length===0&&!t&&(o=`.`),o.length>0&&a&&(o+=`/`),t?`/${o}`:o}function d(e){return n(e),e.length>0&&e.charCodeAt(0)===47}function f(...e){if(e.length===0)return`.`;let t;for(let r=0;r<e.length;++r){let i=e[r];n(i),i.length>0&&(t===void 0?t=i:t+=`/${i}`)}return t===void 0?`.`:u(t)}function p(e,t){if(n(e),n(t),e===t||(e=l(e),t=l(t),e===t))return``;let r=e.length,i=r-1,a=1,o=t.length-a,s=i<o?i:o,c=-1,u=0;for(;u<=s;++u){if(u===s){if(o>s){if(t.charCodeAt(a+u)===47)return t.slice(a+u+1);if(u===0)return t.slice(a+u)}else i>s&&(e.charCodeAt(1+u)===47?c=u:u===0&&(c=0));break}let n=e.charCodeAt(1+u);if(n!==t.charCodeAt(a+u))break;n===47&&(c=u)}let d=``;for(u=1+c+1;u<=r;++u)(u===r||e.charCodeAt(u)===47)&&(d.length===0?d+=`..`:d+=`/..`);return d.length>0?d+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))}function m(e){return e}function h(e){if(n(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,r=-1,i=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===47){if(!i){r=t;break}}else i=!1;return r===-1?t?`/`:`.`:t&&r===1?`//`:e.slice(0,r)}function g(e,t){t!==void 0&&n(t),n(e);let r=0,i=-1,a=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let n=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}}else o===-1&&(a=!1,o=s+1),n>=0&&(c===t.charCodeAt(n)?--n===-1&&(i=s):(n=-1,i=o))}return r===i?i=o:i===-1&&(i=e.length),e.slice(r,i)}else{for(let t=e.length-1;t>=0;--t)if(e.charCodeAt(t)===47){if(!a){r=t+1;break}}else i===-1&&(a=!1,i=t+1);return i===-1?``:e.slice(r,i)}}function _(e){n(e);let t=-1,r=0,i=-1,a=!0,o=0;for(let n=e.length-1;n>=0;--n){let s=e.charCodeAt(n);if(s===47){if(!a){r=n+1;break}continue}i===-1&&(a=!1,i=n+1),s===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)}function v(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return t(`/`,e)}function y(e){n(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let r=e.charCodeAt(0)===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){let t=e.charCodeAt(l);if(t===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),t===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t}export{g as basename,s as delimiter,h as dirname,_ as extname,v as format,d as isAbsolute,f as join,u as normalize,y as parse,a as posix_exports,p as relative,l as resolve,o as sep,m as toNamespacedPath};
1
+ import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import"./constants.js";import{_format as t,assertPath as n,isPosixPathSeparator as r,normalizeString as i}from"./util.js";var a=e({basename:()=>basename,delimiter:()=>`:`,dirname:()=>dirname,extname:()=>extname,format:()=>format,isAbsolute:()=>isAbsolute,join:()=>join,normalize:()=>normalize,parse:()=>parse,relative:()=>relative,resolve:()=>resolve,sep:()=>`/`,toNamespacedPath:()=>toNamespacedPath});const o=`/`,s=`:`;function posixCwd(){if(typeof globalThis.process?.cwd==`function`)return globalThis.process.cwd();try{let e=globalThis.imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function resolve(...e){let t=``,a=!1;for(let r=e.length-1;r>=-1&&!a;r--){let i;if(r>=0){if(i=e[r],n(i),i.length===0)continue}else i=posixCwd();t=`${i}/${t}`,a=i.charCodeAt(0)===47}return t=i(t,!a,`/`,r),a?t.length>0?`/${t}`:`/`:t.length>0?t:`.`}function normalize(e){if(n(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,a=e.charCodeAt(e.length-1)===47,o=i(e,!t,`/`,r);return o.length===0&&!t&&(o=`.`),o.length>0&&a&&(o+=`/`),t?`/${o}`:o}function isAbsolute(e){return n(e),e.length>0&&e.charCodeAt(0)===47}function join(...e){if(e.length===0)return`.`;let t;for(let r=0;r<e.length;++r){let i=e[r];n(i),i.length>0&&(t===void 0?t=i:t+=`/${i}`)}return t===void 0?`.`:normalize(t)}function relative(e,t){if(n(e),n(t),e===t||(e=resolve(e),t=resolve(t),e===t))return``;let r=e.length,i=r-1,a=1,o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(1+l)===47?c=l:l===0&&(c=0));break}let n=e.charCodeAt(1+l);if(n!==t.charCodeAt(a+l))break;n===47&&(c=l)}let u=``;for(l=1+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))}function toNamespacedPath(e){return e}function dirname(e){if(n(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,r=-1,i=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===47){if(!i){r=t;break}}else i=!1;return r===-1?t?`/`:`.`:t&&r===1?`//`:e.slice(0,r)}function basename(e,t){t!==void 0&&n(t),n(e);let r=0,i=-1,a=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let n=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}}else o===-1&&(a=!1,o=s+1),n>=0&&(c===t.charCodeAt(n)?--n===-1&&(i=s):(n=-1,i=o))}return r===i?i=o:i===-1&&(i=e.length),e.slice(r,i)}else{for(let t=e.length-1;t>=0;--t)if(e.charCodeAt(t)===47){if(!a){r=t+1;break}}else i===-1&&(a=!1,i=t+1);return i===-1?``:e.slice(r,i)}}function extname(e){n(e);let t=-1,r=0,i=-1,a=!0,o=0;for(let n=e.length-1;n>=0;--n){let s=e.charCodeAt(n);if(s===47){if(!a){r=n+1;break}continue}i===-1&&(a=!1,i=n+1),s===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)}function format(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return t(`/`,e)}function parse(e){n(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let r=e.charCodeAt(0)===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){let t=e.charCodeAt(l);if(t===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),t===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t}export{basename,s as delimiter,dirname,extname,format,isAbsolute,join,normalize,parse,a as posix_exports,relative,resolve,o as sep,toNamespacedPath};
package/lib/esm/util.js CHANGED
@@ -1 +1 @@
1
- import"./constants.js";function e(e){if(typeof e!=`string`)throw TypeError(`The "path" argument must be of type string. Received type `+typeof e)}function t(e){return e===47}function n(e){return e===47||e===92}function r(e){return e>=65&&e<=90||e>=97&&e<=122}function i(e,t,n,r){let i=``,a=0,o=-1,s=0,c;for(let l=0;l<=e.length;++l){if(l<e.length)c=e.charCodeAt(l);else if(r(c))break;else c=47;if(r(c)){if(!(o===l-1||s===1))if(o!==l-1&&s===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let e=i.lastIndexOf(n);e===-1?(i=``,a=0):(i=i.slice(0,e),a=i.length-1-i.lastIndexOf(n)),o=l,s=0;continue}else if(i.length===2||i.length===1){i=``,a=0,o=l,s=0;continue}}t&&(i.length>0?i+=`${n}..`:i=`..`,a=2)}else i.length>0?i+=n+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else c===46&&s!==-1?++s:s=-1}return i}function a(e,t){if(typeof t!=`object`||!t)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof t);let n=t.dir||t.root,r=t.base||(t.name||``)+o(t.ext);return n?n===t.root?n+r:n+e+r:r}function o(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}export{a as _format,e as assertPath,n as isPathSeparator,t as isPosixPathSeparator,r as isWindowsDeviceRoot,i as normalizeString};
1
+ import"./constants.js";function assertPath(e){if(typeof e!=`string`)throw TypeError(`The "path" argument must be of type string. Received type `+typeof e)}function isPosixPathSeparator(e){return e===47}function isPathSeparator(e){return e===47||e===92}function isWindowsDeviceRoot(e){return e>=65&&e<=90||e>=97&&e<=122}function normalizeString(e,t,n,r){let i=``,a=0,o=-1,s=0,c;for(let l=0;l<=e.length;++l){if(l<e.length)c=e.charCodeAt(l);else if(r(c))break;else c=47;if(r(c)){if(!(o===l-1||s===1))if(o!==l-1&&s===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let e=i.lastIndexOf(n);e===-1?(i=``,a=0):(i=i.slice(0,e),a=i.length-1-i.lastIndexOf(n)),o=l,s=0;continue}else if(i.length===2||i.length===1){i=``,a=0,o=l,s=0;continue}}t&&(i.length>0?i+=`${n}..`:i=`..`,a=2)}else i.length>0?i+=n+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else c===46&&s!==-1?++s:s=-1}return i}function _format(e,t){if(typeof t!=`object`||!t)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof t);let n=t.dir||t.root,r=t.base||(t.name||``)+formatExt(t.ext);return n?n===t.root?n+r:n+e+r:r}function formatExt(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}export{_format,assertPath,isPathSeparator,isPosixPathSeparator,isWindowsDeviceRoot,normalizeString};
package/lib/esm/win32.js CHANGED
@@ -1 +1 @@
1
- import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import"./constants.js";import{_format as t,assertPath as n,isPathSeparator as r,isWindowsDeviceRoot as i,normalizeString as a}from"./util.js";var o=e({basename:()=>g,delimiter:()=>`;`,dirname:()=>h,extname:()=>_,format:()=>v,isAbsolute:()=>d,join:()=>f,normalize:()=>u,parse:()=>y,relative:()=>p,resolve:()=>l,sep:()=>`\\`,toNamespacedPath:()=>m});const s=`\\`,c=`;`;function l(...e){let t=``,o=``,s=!1;for(let a=e.length-1;a>=-1;a--){let c;if(a>=0){if(c=e[a],n(c),c.length===0)continue}else c=(t.length,typeof globalThis.process?.cwd==`function`?globalThis.process.cwd():`/`);let l=c.length,u=0,d=``,f=!1,p=c.charCodeAt(0);if(l>1)if(r(p))if(f=!0,r(c.charCodeAt(1))){let e=2,t=e;for(;e<l&&!r(c.charCodeAt(e));++e);if(e<l&&e!==t){let n=c.slice(t,e);for(t=e;e<l&&r(c.charCodeAt(e));++e);if(e<l&&e!==t){for(t=e;e<l&&!r(c.charCodeAt(e));++e);e===l?(d=`\\\\${n}\\${c.slice(t)}`,u=e):e!==t&&(d=`\\\\${n}\\${c.slice(t,e)}`,u=e)}}}else u=1;else i(p)&&c.charCodeAt(1)===58&&(d=c.slice(0,2),u=2,l>2&&r(c.charCodeAt(2))&&(f=!0,u=3));else r(p)&&(u=1,f=!0);if(!(d.length>0&&t.length>0&&d.toLowerCase()!==t.toLowerCase())&&(t.length===0&&d.length>0&&(t=d),s||=(o=`${c.slice(u)}\\${o}`,f),t.length>0&&s))break}return o=a(o,!s,`\\`,r),t+(s?`\\`:``)+o||`.`}function u(e){n(e);let t=e.length;if(t===0)return`.`;let o=0,s,c=!1,l=e.charCodeAt(0);if(t>1)if(r(l))if(c=!0,r(e.charCodeAt(1))){let n=2,i=n;for(;n<t&&!r(e.charCodeAt(n));++n);if(n<t&&n!==i){let a=e.slice(i,n);for(i=n;n<t&&r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&!r(e.charCodeAt(n));++n);if(n===t)return`\\\\${a}\\${e.slice(i)}\\`;n!==i&&(s=`\\\\${a}\\${e.slice(i,n)}`,o=n)}}}else o=1;else i(l)&&e.charCodeAt(1)===58&&(s=e.slice(0,2),o=2,t>2&&r(e.charCodeAt(2))&&(c=!0,o=3));else if(r(l))return`\\`;let u;return u=o<t?a(e.slice(o),!c,`\\`,r):``,u.length===0&&!c&&(u=`.`),u.length>0&&r(e.charCodeAt(t-1))&&(u+=`\\`),s===void 0?c?u.length>0?`\\${u}`:`\\`:u.length>0?u:``:c?u.length>0?`${s}\\${u}`:`${s}\\`:u.length>0?s+u:s}function d(e){n(e);let t=e.length;if(t===0)return!1;let a=e.charCodeAt(0);return!!(r(a)||i(a)&&t>2&&e.charCodeAt(1)===58&&r(e.charCodeAt(2)))}function f(...e){if(e.length===0)return`.`;let t,i;for(let r=0;r<e.length;++r){let a=e[r];n(a),a.length>0&&(t===void 0?t=i=a:t+=`\\${a}`)}if(t===void 0)return`.`;let a=!0,o=0;if(r(i.charCodeAt(0))){++o;let e=i.length;e>1&&r(i.charCodeAt(1))&&(++o,e>2&&(r(i.charCodeAt(2))?++o:a=!1))}if(a){for(;o<t.length&&r(t.charCodeAt(o));++o);o>=2&&(t=`\\${t.slice(o)}`)}return u(t)}function p(e,t){if(n(e),n(t),e===t)return``;let r=l(e),i=l(t);if(r===i||(e=r.toLowerCase(),t=i.toLowerCase(),e===t))return``;let a=0;for(;a<e.length&&e.charCodeAt(a)===92;++a);let o=e.length;for(;o-1>a&&e.charCodeAt(o-1)===92;--o);let s=o-a,c=0;for(;c<t.length&&t.charCodeAt(c)===92;++c);let u=t.length;for(;u-1>c&&t.charCodeAt(u-1)===92;--u);let d=u-c,f=s<d?s:d,p=-1,m=0;for(;m<=f;++m){if(m===f){if(d>f){if(t.charCodeAt(c+m)===92)return i.slice(c+m+1);if(m===2)return i.slice(c+m)}s>f&&(e.charCodeAt(a+m)===92?p=m:m===2&&(p=3));break}let n=e.charCodeAt(a+m);if(n!==t.charCodeAt(c+m))break;n===92&&(p=m)}if(m!==f&&p===-1)return i;let h=``;for(p===-1&&(p=0),m=a+p+1;m<=o;++m)(m===o||e.charCodeAt(m)===92)&&(h.length===0?h+=`..`:h+=`\\..`);return h.length>0?h+i.slice(c+p,u):(c+=p,i.charCodeAt(c)===92&&++c,i.slice(c,u))}function m(e){if(typeof e!=`string`)return e;if(e.length===0)return``;let t=l(e);if(t.length>=3){if(t.charCodeAt(0)===92){if(t.charCodeAt(1)===92){let e=t.charCodeAt(2);if(e!==63&&e!==46)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(i(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`}return e}function h(e){n(e);let t=e.length;if(t===0)return`.`;let a=-1,o=-1,s=!0,c=0,l=e.charCodeAt(0);if(t>1)if(r(l)){if(a=c=1,r(e.charCodeAt(1))){let n=2,i=n;for(;n<t&&!r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&!r(e.charCodeAt(n));++n);if(n===t)return e;n!==i&&(a=c=n+1)}}}}else i(l)&&e.charCodeAt(1)===58&&(a=c=2,t>2&&r(e.charCodeAt(2))&&(a=c=3));else if(r(l))return e;for(let n=t-1;n>=c;--n)if(r(e.charCodeAt(n))){if(!s){o=n;break}}else s=!1;if(o===-1){if(a===-1)return`.`;o=a}return e.slice(0,o)}function g(e,t){t!==void 0&&n(t),n(e);let a=0,o=-1,s=!0;if(e.length>=2&&i(e.charCodeAt(0))&&e.charCodeAt(1)===58&&(a=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let n=t.length-1,i=-1;for(let c=e.length-1;c>=a;--c){let l=e.charCodeAt(c);if(r(l)){if(!s){a=c+1;break}}else i===-1&&(s=!1,i=c+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(o=c):(n=-1,o=i))}return a===o?o=i:o===-1&&(o=e.length),e.slice(a,o)}else{for(let t=e.length-1;t>=a;--t)if(r(e.charCodeAt(t))){if(!s){a=t+1;break}}else o===-1&&(s=!1,o=t+1);return o===-1?``:e.slice(a,o)}}function _(e){n(e);let t=0,a=-1,o=0,s=-1,c=!0,l=0;e.length>=2&&e.charCodeAt(1)===58&&i(e.charCodeAt(0))&&(t=o=2);for(let n=e.length-1;n>=t;--n){let t=e.charCodeAt(n);if(r(t)){if(!c){o=n+1;break}continue}s===-1&&(c=!1,s=n+1),t===46?a===-1?a=n:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||s===-1||l===0||l===1&&a===s-1&&a===o+1?``:e.slice(a,s)}function v(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return t(`\\`,e)}function y(e){n(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let a=e.length,o=0,s=e.charCodeAt(0);if(a>1)if(r(s)){if(o=1,r(e.charCodeAt(1))){let t=2,n=t;for(;t<a&&!r(e.charCodeAt(t));++t);if(t<a&&t!==n){for(n=t;t<a&&r(e.charCodeAt(t));++t);if(t<a&&t!==n){for(n=t;t<a&&!r(e.charCodeAt(t));++t);t===a?o=t:t!==n&&(o=t+1)}}}}else i(s)&&e.charCodeAt(1)===58&&(o=2,a>2&&r(e.charCodeAt(2))&&(o=3));else if(r(s))return t.root=t.dir=e,t;o>0&&(t.root=e.slice(0,o));let c=-1,l=o,u=-1,d=!0,f=e.length-1,p=0;for(;f>=o;--f){if(s=e.charCodeAt(f),r(s)){if(!d){l=f+1;break}continue}u===-1&&(d=!1,u=f+1),s===46?c===-1?c=f:p!==1&&(p=1):c!==-1&&(p=-1)}return c===-1||u===-1||p===0||p===1&&c===u-1&&c===l+1?u!==-1&&(t.base=t.name=e.slice(l,u)):(t.name=e.slice(l,c),t.base=e.slice(l,u),t.ext=e.slice(c,u)),l>0&&l!==o?t.dir=e.slice(0,l-1):t.dir=t.root,t}export{g as basename,c as delimiter,h as dirname,_ as extname,v as format,d as isAbsolute,f as join,u as normalize,y as parse,p as relative,l as resolve,s as sep,m as toNamespacedPath,o as win32_exports};
1
+ import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import"./constants.js";import{_format as t,assertPath as n,isPathSeparator as r,isWindowsDeviceRoot as i,normalizeString as a}from"./util.js";var o=e({basename:()=>basename,delimiter:()=>`;`,dirname:()=>dirname,extname:()=>extname,format:()=>format,isAbsolute:()=>isAbsolute,join:()=>join,normalize:()=>normalize,parse:()=>parse,relative:()=>relative,resolve:()=>resolve,sep:()=>`\\`,toNamespacedPath:()=>toNamespacedPath});const s=`\\`,c=`;`;function resolve(...e){let t=``,o=``,s=!1;for(let a=e.length-1;a>=-1;a--){let c;if(a>=0){if(c=e[a],n(c),c.length===0)continue}else c=(t.length,typeof globalThis.process?.cwd==`function`?globalThis.process.cwd():`/`);let l=c.length,u=0,d=``,f=!1,p=c.charCodeAt(0);if(l>1)if(r(p))if(f=!0,r(c.charCodeAt(1))){let e=2,t=e;for(;e<l&&!r(c.charCodeAt(e));++e);if(e<l&&e!==t){let n=c.slice(t,e);for(t=e;e<l&&r(c.charCodeAt(e));++e);if(e<l&&e!==t){for(t=e;e<l&&!r(c.charCodeAt(e));++e);e===l?(d=`\\\\${n}\\${c.slice(t)}`,u=e):e!==t&&(d=`\\\\${n}\\${c.slice(t,e)}`,u=e)}}}else u=1;else i(p)&&c.charCodeAt(1)===58&&(d=c.slice(0,2),u=2,l>2&&r(c.charCodeAt(2))&&(f=!0,u=3));else r(p)&&(u=1,f=!0);if(!(d.length>0&&t.length>0&&d.toLowerCase()!==t.toLowerCase())&&(t.length===0&&d.length>0&&(t=d),s||=(o=`${c.slice(u)}\\${o}`,f),t.length>0&&s))break}return o=a(o,!s,`\\`,r),t+(s?`\\`:``)+o||`.`}function normalize(e){n(e);let t=e.length;if(t===0)return`.`;let o=0,s,c=!1,l=e.charCodeAt(0);if(t>1)if(r(l))if(c=!0,r(e.charCodeAt(1))){let n=2,i=n;for(;n<t&&!r(e.charCodeAt(n));++n);if(n<t&&n!==i){let a=e.slice(i,n);for(i=n;n<t&&r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&!r(e.charCodeAt(n));++n);if(n===t)return`\\\\${a}\\${e.slice(i)}\\`;n!==i&&(s=`\\\\${a}\\${e.slice(i,n)}`,o=n)}}}else o=1;else i(l)&&e.charCodeAt(1)===58&&(s=e.slice(0,2),o=2,t>2&&r(e.charCodeAt(2))&&(c=!0,o=3));else if(r(l))return`\\`;let u;return u=o<t?a(e.slice(o),!c,`\\`,r):``,u.length===0&&!c&&(u=`.`),u.length>0&&r(e.charCodeAt(t-1))&&(u+=`\\`),s===void 0?c?u.length>0?`\\${u}`:`\\`:u.length>0?u:``:c?u.length>0?`${s}\\${u}`:`${s}\\`:u.length>0?s+u:s}function isAbsolute(e){n(e);let t=e.length;if(t===0)return!1;let a=e.charCodeAt(0);return!!(r(a)||i(a)&&t>2&&e.charCodeAt(1)===58&&r(e.charCodeAt(2)))}function join(...e){if(e.length===0)return`.`;let t,i;for(let r=0;r<e.length;++r){let a=e[r];n(a),a.length>0&&(t===void 0?t=i=a:t+=`\\${a}`)}if(t===void 0)return`.`;let a=!0,o=0;if(r(i.charCodeAt(0))){++o;let e=i.length;e>1&&r(i.charCodeAt(1))&&(++o,e>2&&(r(i.charCodeAt(2))?++o:a=!1))}if(a){for(;o<t.length&&r(t.charCodeAt(o));++o);o>=2&&(t=`\\${t.slice(o)}`)}return normalize(t)}function relative(e,t){if(n(e),n(t),e===t)return``;let r=resolve(e),i=resolve(t);if(r===i||(e=r.toLowerCase(),t=i.toLowerCase(),e===t))return``;let a=0;for(;a<e.length&&e.charCodeAt(a)===92;++a);let o=e.length;for(;o-1>a&&e.charCodeAt(o-1)===92;--o);let s=o-a,c=0;for(;c<t.length&&t.charCodeAt(c)===92;++c);let l=t.length;for(;l-1>c&&t.charCodeAt(l-1)===92;--l);let u=l-c,d=s<u?s:u,f=-1,p=0;for(;p<=d;++p){if(p===d){if(u>d){if(t.charCodeAt(c+p)===92)return i.slice(c+p+1);if(p===2)return i.slice(c+p)}s>d&&(e.charCodeAt(a+p)===92?f=p:p===2&&(f=3));break}let n=e.charCodeAt(a+p);if(n!==t.charCodeAt(c+p))break;n===92&&(f=p)}if(p!==d&&f===-1)return i;let m=``;for(f===-1&&(f=0),p=a+f+1;p<=o;++p)(p===o||e.charCodeAt(p)===92)&&(m.length===0?m+=`..`:m+=`\\..`);return m.length>0?m+i.slice(c+f,l):(c+=f,i.charCodeAt(c)===92&&++c,i.slice(c,l))}function toNamespacedPath(e){if(typeof e!=`string`)return e;if(e.length===0)return``;let t=resolve(e);if(t.length>=3){if(t.charCodeAt(0)===92){if(t.charCodeAt(1)===92){let e=t.charCodeAt(2);if(e!==63&&e!==46)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(i(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`}return e}function dirname(e){n(e);let t=e.length;if(t===0)return`.`;let a=-1,o=-1,s=!0,c=0,l=e.charCodeAt(0);if(t>1)if(r(l)){if(a=c=1,r(e.charCodeAt(1))){let n=2,i=n;for(;n<t&&!r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&r(e.charCodeAt(n));++n);if(n<t&&n!==i){for(i=n;n<t&&!r(e.charCodeAt(n));++n);if(n===t)return e;n!==i&&(a=c=n+1)}}}}else i(l)&&e.charCodeAt(1)===58&&(a=c=2,t>2&&r(e.charCodeAt(2))&&(a=c=3));else if(r(l))return e;for(let n=t-1;n>=c;--n)if(r(e.charCodeAt(n))){if(!s){o=n;break}}else s=!1;if(o===-1){if(a===-1)return`.`;o=a}return e.slice(0,o)}function basename(e,t){t!==void 0&&n(t),n(e);let a=0,o=-1,s=!0;if(e.length>=2&&i(e.charCodeAt(0))&&e.charCodeAt(1)===58&&(a=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let n=t.length-1,i=-1;for(let c=e.length-1;c>=a;--c){let l=e.charCodeAt(c);if(r(l)){if(!s){a=c+1;break}}else i===-1&&(s=!1,i=c+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(o=c):(n=-1,o=i))}return a===o?o=i:o===-1&&(o=e.length),e.slice(a,o)}else{for(let t=e.length-1;t>=a;--t)if(r(e.charCodeAt(t))){if(!s){a=t+1;break}}else o===-1&&(s=!1,o=t+1);return o===-1?``:e.slice(a,o)}}function extname(e){n(e);let t=0,a=-1,o=0,s=-1,c=!0,l=0;e.length>=2&&e.charCodeAt(1)===58&&i(e.charCodeAt(0))&&(t=o=2);for(let n=e.length-1;n>=t;--n){let t=e.charCodeAt(n);if(r(t)){if(!c){o=n+1;break}continue}s===-1&&(c=!1,s=n+1),t===46?a===-1?a=n:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||s===-1||l===0||l===1&&a===s-1&&a===o+1?``:e.slice(a,s)}function format(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return t(`\\`,e)}function parse(e){n(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let a=e.length,o=0,s=e.charCodeAt(0);if(a>1)if(r(s)){if(o=1,r(e.charCodeAt(1))){let t=2,n=t;for(;t<a&&!r(e.charCodeAt(t));++t);if(t<a&&t!==n){for(n=t;t<a&&r(e.charCodeAt(t));++t);if(t<a&&t!==n){for(n=t;t<a&&!r(e.charCodeAt(t));++t);t===a?o=t:t!==n&&(o=t+1)}}}}else i(s)&&e.charCodeAt(1)===58&&(o=2,a>2&&r(e.charCodeAt(2))&&(o=3));else if(r(s))return t.root=t.dir=e,t;o>0&&(t.root=e.slice(0,o));let c=-1,l=o,u=-1,d=!0,f=e.length-1,p=0;for(;f>=o;--f){if(s=e.charCodeAt(f),r(s)){if(!d){l=f+1;break}continue}u===-1&&(d=!1,u=f+1),s===46?c===-1?c=f:p!==1&&(p=1):c!==-1&&(p=-1)}return c===-1||u===-1||p===0||p===1&&c===u-1&&c===l+1?u!==-1&&(t.base=t.name=e.slice(l,u)):(t.name=e.slice(l,c),t.base=e.slice(l,u),t.ext=e.slice(c,u)),l>0&&l!==o?t.dir=e.slice(0,l-1):t.dir=t.root,t}export{basename,c as delimiter,dirname,extname,format,isAbsolute,join,normalize,parse,relative,resolve,s as sep,toNamespacedPath,o as win32_exports};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/path",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Node.js path module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -38,8 +38,8 @@
38
38
  "path"
39
39
  ],
40
40
  "devDependencies": {
41
- "@gjsify/cli": "^0.3.19",
42
- "@gjsify/unit": "^0.3.19",
41
+ "@gjsify/cli": "^0.3.21",
42
+ "@gjsify/unit": "^0.3.21",
43
43
  "@types/node": "^25.6.2",
44
44
  "typescript": "^6.0.3"
45
45
  }