@gjsify/path 0.51.1 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,
|
|
1
|
+
import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import"./constants.js";import{_format as t,assertPath as n,isPathSeparator as r,isPosixPathSeparator as i,isWindowsDeviceRoot as a,normalizeString as o}from"./util.js";var s=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 c=`\\`,l=`;`;function cwd(){return typeof globalThis.process?.cwd==`function`?globalThis.process.cwd():`/`}function resolve(...e){let t=``,i=``,s=!1;for(let o=e.length-1;o>=-1;o--){let c;if(o>=0){if(c=e[o],n(c),c.length===0)continue}else t.length===0?c=cwd():(c=globalThis.process?.env?.[`=${t}`]||cwd(),c.slice(0,2).toLowerCase()!==t.toLowerCase()&&c.charCodeAt(2)===92&&(c=`${t}\\`));let l=c.length,u=0,d=``,f=!1,p=c.charCodeAt(0);if(l===1)r(p)&&(u=1,f=!0);else if(r(p))if(f=!0,r(c.charCodeAt(1))){let e=matchUncRoot(c);e&&(d=e.device,u=e.rootEnd)}else u=1;else a(p)&&c.charCodeAt(1)===58&&(d=c.slice(0,2),u=2,l>2&&r(c.charCodeAt(2))&&(f=!0,u=3));if(d.length>0)if(t.length>0){if(d.toLowerCase()!==t.toLowerCase())continue}else t=d;if(s){if(t.length>0)break}else if(i=`${c.slice(u)}\\${i}`,s=f,f&&t.length>0)break}return i=o(i,!s,`\\`,r),s?`${t}\\${i}`:`${t}${i}`||`.`}function matchUncRoot(e){let t=e.length,n=2,i=n;for(;n<t&&!r(e.charCodeAt(n));)n++;if(n>=t||n===i)return;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++;return a===`.`||a===`?`?{device:`\\\\${a}`,rootEnd:4,shareOnly:!1}:{device:`\\\\${a}\\${e.slice(i,n)}`,rootEnd:n,shareOnly:n===t}}}function normalize(e){n(e);let t=e.length;if(t===0)return`.`;let s=e.charCodeAt(0);if(t===1)return i(s)?`\\`:e;let c=0,l,u=!1;if(r(s))if(u=!0,r(e.charCodeAt(1))){let t=matchUncRoot(e);if(t?.shareOnly)return`${t.device}\\`;if(t&&(l=t.device,c=t.rootEnd,l.length===3)){let t=e.slice(4,e.indexOf(`:`)+1);isWindowsReservedName(t,t.length-1)&&(l=`\\\\?\\${t}`,c=4+t.length)}}else c=1;else{let n=e.indexOf(`:`);n>0&&(a(s)&&n===1?(l=e.slice(0,2),c=2,t>2&&r(e.charCodeAt(2))&&(u=!0,c=3)):isWindowsReservedName(e,n)&&(l=e.slice(0,n+1),c=n+1))}let d=c<t?o(e.slice(c),!u,`\\`,r):``;if(d.length===0&&!u&&(d=`.`),d.length>0&&r(e.charCodeAt(t-1))&&(d+=`\\`),!u&&l===void 0&&e.includes(`:`)){if(d.length>=2&&a(d.charCodeAt(0))&&d.charCodeAt(1)===58)return`.\\${d}`;let n=e.indexOf(`:`);do if(n===t-1||r(e.charCodeAt(n+1)))return`.\\${d}`;while((n=e.indexOf(`:`,n+1))!==-1)}return isWindowsReservedName(e,e.indexOf(`:`))?`.\\${l??``}${d}`:l===void 0?u?`\\${d}`:d:u?`${l}\\${d}`:`${l}${d}`}const u=new Set([`CON`,`PRN`,`AUX`,`NUL`,...[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`¹`,`²`,`³`].flatMap(e=>[`COM${e}`,`LPT${e}`])]);function isWindowsReservedName(e,t){return u.has(e.slice(0,t).toUpperCase())}function isAbsolute(e){n(e);let t=e.length;if(t===0)return!1;let i=e.charCodeAt(0);return!!(r(i)||a(i)&&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 t.split(/\\+/).some(e=>{let t=e.indexOf(`:`);return t!==-1&&isWindowsReservedName(e,t)})?t.replace(/\//g,`\\`):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`||e.length===0)return e;let t=resolve(e);if(t.length<=2)return e;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(a(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`;return t}function dirname(e){n(e);let t=e.length;if(t===0)return`.`;let i=-1,o=-1,s=!0,c=0,l=e.charCodeAt(0);if(t>1)if(r(l)){if(i=c=1,r(e.charCodeAt(1))){let n=2,a=n;for(;n<t&&!r(e.charCodeAt(n));++n);if(n<t&&n!==a){for(a=n;n<t&&r(e.charCodeAt(n));++n);if(n<t&&n!==a){for(a=n;n<t&&!r(e.charCodeAt(n));++n);if(n===t)return e;n!==a&&(i=c=n+1)}}}}else a(l)&&e.charCodeAt(1)===58&&(i=c=2,t>2&&r(e.charCodeAt(2))&&(i=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(i===-1)return`.`;o=i}return e.slice(0,o)}function basename(e,t){t!==void 0&&n(t),n(e);let i=0,o=-1,s=!0;if(e.length>=2&&a(e.charCodeAt(0))&&e.charCodeAt(1)===58&&(i=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let n=t.length-1,a=-1;for(let c=e.length-1;c>=i;--c){let l=e.charCodeAt(c);if(r(l)){if(!s){i=c+1;break}}else a===-1&&(s=!1,a=c+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(o=c):(n=-1,o=a))}return i===o?o=a:o===-1&&(o=e.length),e.slice(i,o)}else{for(let t=e.length-1;t>=i;--t)if(r(e.charCodeAt(t))){if(!s){i=t+1;break}}else o===-1&&(s=!1,o=t+1);return o===-1?``:e.slice(i,o)}}function extname(e){n(e);let t=0,i=-1,o=0,s=-1,c=!0,l=0;e.length>=2&&e.charCodeAt(1)===58&&a(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?i===-1?i=n:l!==1&&(l=1):i!==-1&&(l=-1)}return i===-1||s===-1||l===0||l===1&&i===s-1&&i===o+1?``:e.slice(i,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 i=e.length,o=0,s=e.charCodeAt(0);if(i>1)if(r(s)){if(o=1,r(e.charCodeAt(1))){let t=2,n=t;for(;t<i&&!r(e.charCodeAt(t));++t);if(t<i&&t!==n){for(n=t;t<i&&r(e.charCodeAt(t));++t);if(t<i&&t!==n){for(n=t;t<i&&!r(e.charCodeAt(t));++t);t===i?o=t:t!==n&&(o=t+1)}}}}else a(s)&&e.charCodeAt(1)===58&&(o=2,i>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,l as delimiter,dirname,extname,format,isAbsolute,join,normalize,parse,relative,resolve,c as sep,toNamespacedPath,s as win32_exports};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/path",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Node.js path module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@gjsify/utils": "^0.
|
|
23
|
+
"@gjsify/utils": "^0.53.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"lib"
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"path"
|
|
46
46
|
],
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@gjsify/cli": "^0.
|
|
49
|
-
"@gjsify/unit": "^0.
|
|
48
|
+
"@gjsify/cli": "^0.53.0",
|
|
49
|
+
"@gjsify/unit": "^0.53.0",
|
|
50
50
|
"@types/node": "^25.9.2",
|
|
51
51
|
"typescript": "^6.0.3"
|
|
52
52
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"win32": "partial"
|
|
65
65
|
},
|
|
66
66
|
"osNotes": {
|
|
67
|
-
"win32": "The win32 flavour is
|
|
67
|
+
"win32": "The win32 flavour is driven directly by host-flavour.spec.ts and win32-parity.spec.ts from every host (drive letters, drive-relative paths against a stubbed cwd, UNC and device roots, toNamespacedPath, parse/format), so its SEMANTICS are exercised on Linux; a random-input differential against native Node's path.win32 found no divergence. What no runner can confirm yet is the SELECTION: `hostOs()` returning \"win32\" picks it, and no GJS-on-Windows host exists to observe that. On a POSIX host \"selected per host\" and \"posix hardcoded\" are indistinguishable at runtime, which is why `selectFlavour(os)` takes the OS as an argument — that half is asserted. Promote to \"supported\" from the first GJS run on Windows."
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"license": "MIT",
|