@gjsify/util 0.3.21 → 0.4.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.
- package/lib/esm/_virtual/_rolldown/runtime.js +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/types/index.js +1 -1
- package/lib/types/index.d.ts +14 -0
- package/package.json +43 -40
- package/src/errors.ts +0 -101
- package/src/extended.spec.ts +0 -540
- package/src/index.spec.ts +0 -440
- package/src/index.ts +0 -747
- package/src/test.ts +0 -7
- package/src/types/index.ts +0 -357
- package/src/types.ts +0 -4
- package/tsconfig.json +0 -29
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0}),__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,__name};
|
package/lib/esm/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={[-1]:`EPERM`,[-2]:`ENOENT`,[-3]:`ESRCH`,[-4]:`EINTR`,[-5]:`EIO`,[-6]:`ENXIO`,[-7]:`E2BIG`,[-8]:`ENOEXEC`,[-9]:`EBADF`,[-10]:`ECHILD`,[-11]:`EAGAIN`,[-12]:`ENOMEM`,[-13]:`EACCES`,[-14]:`EFAULT`,[-15]:`ENOTBLK`,[-16]:`EBUSY`,[-17]:`EEXIST`,[-18]:`EXDEV`,[-19]:`ENODEV`,[-20]:`ENOTDIR`,[-21]:`EISDIR`,[-22]:`EINVAL`,[-23]:`ENFILE`,[-24]:`EMFILE`,[-25]:`ENOTTY`,[-26]:`ETXTBSY`,[-27]:`EFBIG`,[-28]:`ENOSPC`,[-29]:`ESPIPE`,[-30]:`EROFS`,[-31]:`EMLINK`,[-32]:`EPIPE`,[-33]:`EDOM`,[-34]:`ERANGE`,[-35]:`EDEADLK`,[-36]:`ENAMETOOLONG`,[-37]:`ENOLCK`,[-38]:`ENOSYS`,[-39]:`ENOTEMPTY`,[-40]:`ELOOP`,[-42]:`ENOMSG`,[-43]:`EIDRM`,[-44]:`ECHRNG`,[-45]:`EL2NSYNC`,[-46]:`EL3HLT`,[-47]:`EL3RST`,[-48]:`ELNRNG`,[-49]:`EUNATCH`,[-50]:`ENOCSI`,[-51]:`EL2HLT`,[-52]:`EBADE`,[-53]:`EBADR`,[-54]:`EXFULL`,[-55]:`ENOANO`,[-56]:`EBADRQC`,[-57]:`EBADSLT`,[-59]:`EBFONT`,[-60]:`ENOSTR`,[-61]:`ENODATA`,[-62]:`ETIME`,[-63]:`ENOSR`,[-64]:`ENONET`,[-65]:`ENOPKG`,[-66]:`EREMOTE`,[-67]:`ENOLINK`,[-68]:`EADV`,[-69]:`ESRMNT`,[-70]:`ECOMM`,[-71]:`EPROTO`,[-72]:`EMULTIHOP`,[-73]:`EDOTDOT`,[-74]:`EBADMSG`,[-75]:`EOVERFLOW`,[-76]:`ENOTUNIQ`,[-77]:`EBADFD`,[-78]:`EREMCHG`,[-79]:`ELIBACC`,[-80]:`ELIBBAD`,[-81]:`ELIBSCN`,[-82]:`ELIBMAX`,[-83]:`ELIBEXEC`,[-84]:`EILSEQ`,[-85]:`ERESTART`,[-86]:`ESTRPIPE`,[-87]:`EUSERS`,[-88]:`ENOTSOCK`,[-89]:`EDESTADDRREQ`,[-90]:`EMSGSIZE`,[-91]:`EPROTOTYPE`,[-92]:`ENOPROTOOPT`,[-93]:`EPROTONOSUPPORT`,[-94]:`ESOCKTNOSUPPORT`,[-95]:`ENOTSUP`,[-96]:`EPFNOSUPPORT`,[-97]:`EAFNOSUPPORT`,[-98]:`EADDRINUSE`,[-99]:`EADDRNOTAVAIL`,[-100]:`ENETDOWN`,[-101]:`ENETUNREACH`,[-102]:`ENETRESET`,[-103]:`ECONNABORTED`,[-104]:`ECONNRESET`,[-105]:`ENOBUFS`,[-106]:`EISCONN`,[-107]:`ENOTCONN`,[-108]:`ESHUTDOWN`,[-109]:`ETOOMANYREFS`,[-110]:`ETIMEDOUT`,[-111]:`ECONNREFUSED`,[-112]:`EHOSTDOWN`,[-113]:`EHOSTUNREACH`,[-114]:`EALREADY`,[-115]:`EINPROGRESS`,[-116]:`ESTALE`,[-117]:`EUCLEAN`,[-118]:`ENOTNAM`,[-119]:`ENAVAIL`,[-120]:`EISNAM`,[-121]:`EREMOTEIO`,[-122]:`EDQUOT`,[-123]:`ENOMEDIUM`,[-124]:`EMEDIUMTYPE`,[-125]:`ECANCELED`,[-126]:`ENOKEY`,[-127]:`EKEYEXPIRED`,[-128]:`EKEYREVOKED`,[-129]:`EKEYREJECTED`},t={[-1]:`EPERM`,[-2]:`ENOENT`,[-3]:`ESRCH`,[-4]:`EINTR`,[-5]:`EIO`,[-6]:`ENXIO`,[-7]:`E2BIG`,[-8]:`ENOEXEC`,[-9]:`EBADF`,[-10]:`ECHILD`,[-11]:`EDEADLK`,[-12]:`ENOMEM`,[-13]:`EACCES`,[-14]:`EFAULT`,[-15]:`ENOTBLK`,[-16]:`EBUSY`,[-17]:`EEXIST`,[-18]:`EXDEV`,[-19]:`ENODEV`,[-20]:`ENOTDIR`,[-21]:`EISDIR`,[-22]:`EINVAL`,[-23]:`ENFILE`,[-24]:`EMFILE`,[-25]:`ENOTTY`,[-26]:`ETXTBSY`,[-27]:`EFBIG`,[-28]:`ENOSPC`,[-29]:`ESPIPE`,[-30]:`EROFS`,[-31]:`EMLINK`,[-32]:`EPIPE`,[-33]:`EDOM`,[-34]:`ERANGE`,[-35]:`EAGAIN`,[-36]:`EINPROGRESS`,[-37]:`EALREADY`,[-38]:`ENOTSOCK`,[-39]:`EDESTADDRREQ`,[-40]:`EMSGSIZE`,[-41]:`EPROTOTYPE`,[-42]:`ENOPROTOOPT`,[-43]:`EPROTONOSUPPORT`,[-44]:`ESOCKTNOSUPPORT`,[-45]:`ENOTSUP`,[-46]:`EPFNOSUPPORT`,[-47]:`EAFNOSUPPORT`,[-48]:`EADDRINUSE`,[-49]:`EADDRNOTAVAIL`,[-50]:`ENETDOWN`,[-51]:`ENETUNREACH`,[-52]:`ENETRESET`,[-53]:`ECONNABORTED`,[-54]:`ECONNRESET`,[-55]:`ENOBUFS`,[-56]:`EISCONN`,[-57]:`ENOTCONN`,[-58]:`ESHUTDOWN`,[-59]:`ETOOMANYREFS`,[-60]:`ETIMEDOUT`,[-61]:`ECONNREFUSED`,[-62]:`ELOOP`,[-63]:`ENAMETOOLONG`,[-64]:`EHOSTDOWN`,[-65]:`EHOSTUNREACH`,[-66]:`ENOTEMPTY`,[-67]:`EPROCLIM`,[-68]:`EUSERS`,[-69]:`EDQUOT`,[-70]:`ESTALE`,[-71]:`EREMOTE`,[-72]:`EBADRPC`,[-73]:`ERPCMISMATCH`,[-74]:`EPROGUNAVAIL`,[-75]:`EPROGMISMATCH`,[-76]:`EPROCUNAVAIL`,[-77]:`ENOLCK`,[-78]:`ENOSYS`,[-79]:`EFTYPE`,[-80]:`EAUTH`,[-81]:`ENEEDAUTH`,[-82]:`EPWROFF`,[-83]:`EDEVERR`,[-84]:`EOVERFLOW`,[-85]:`EBADEXEC`,[-86]:`EBADARCH`,[-87]:`ESHLIBVERS`,[-88]:`EBADMACHO`,[-89]:`ECANCELED`,[-90]:`EIDRM`,[-91]:`ENOMSG`,[-92]:`EILSEQ`,[-93]:`ENOATTR`,[-94]:`EBADMSG`,[-95]:`EMULTIHOP`,[-96]:`ENODATA`,[-97]:`ENOLINK`,[-98]:`ENOSR`,[-99]:`ENOSTR`,[-100]:`EPROTO`,[-101]:`ETIME`,[-102]:`EOPNOTSUPP`};function getPlatform(){return typeof globalThis.process?.platform==`string`?globalThis.process.platform:`linux`}function getSystemErrorName(n){if(typeof n!=`number`)throw TypeError(`The "err" argument must be of type number. Received type `+typeof n);if(n>=0)throw RangeError(`The value of "err" is out of range. It must be a negative integer. Received ${n}`);return(getPlatform()===`darwin`?t:e)[n]||`Unknown system error ${n}`}function getSystemErrorMap(){let n=getPlatform()===`darwin`?t:e,r=new Map;for(let[e,t]of Object.entries(n))r.set(Number(e),[t,``]);return r}export{getSystemErrorMap,getSystemErrorName};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e={[-1]:`EPERM`,[-2]:`ENOENT`,[-3]:`ESRCH`,[-4]:`EINTR`,[-5]:`EIO`,[-6]:`ENXIO`,[-7]:`E2BIG`,[-8]:`ENOEXEC`,[-9]:`EBADF`,[-10]:`ECHILD`,[-11]:`EAGAIN`,[-12]:`ENOMEM`,[-13]:`EACCES`,[-14]:`EFAULT`,[-15]:`ENOTBLK`,[-16]:`EBUSY`,[-17]:`EEXIST`,[-18]:`EXDEV`,[-19]:`ENODEV`,[-20]:`ENOTDIR`,[-21]:`EISDIR`,[-22]:`EINVAL`,[-23]:`ENFILE`,[-24]:`EMFILE`,[-25]:`ENOTTY`,[-26]:`ETXTBSY`,[-27]:`EFBIG`,[-28]:`ENOSPC`,[-29]:`ESPIPE`,[-30]:`EROFS`,[-31]:`EMLINK`,[-32]:`EPIPE`,[-33]:`EDOM`,[-34]:`ERANGE`,[-35]:`EDEADLK`,[-36]:`ENAMETOOLONG`,[-37]:`ENOLCK`,[-38]:`ENOSYS`,[-39]:`ENOTEMPTY`,[-40]:`ELOOP`,[-42]:`ENOMSG`,[-43]:`EIDRM`,[-44]:`ECHRNG`,[-45]:`EL2NSYNC`,[-46]:`EL3HLT`,[-47]:`EL3RST`,[-48]:`ELNRNG`,[-49]:`EUNATCH`,[-50]:`ENOCSI`,[-51]:`EL2HLT`,[-52]:`EBADE`,[-53]:`EBADR`,[-54]:`EXFULL`,[-55]:`ENOANO`,[-56]:`EBADRQC`,[-57]:`EBADSLT`,[-59]:`EBFONT`,[-60]:`ENOSTR`,[-61]:`ENODATA`,[-62]:`ETIME`,[-63]:`ENOSR`,[-64]:`ENONET`,[-65]:`ENOPKG`,[-66]:`EREMOTE`,[-67]:`ENOLINK`,[-68]:`EADV`,[-69]:`ESRMNT`,[-70]:`ECOMM`,[-71]:`EPROTO`,[-72]:`EMULTIHOP`,[-73]:`EDOTDOT`,[-74]:`EBADMSG`,[-75]:`EOVERFLOW`,[-76]:`ENOTUNIQ`,[-77]:`EBADFD`,[-78]:`EREMCHG`,[-79]:`ELIBACC`,[-80]:`ELIBBAD`,[-81]:`ELIBSCN`,[-82]:`ELIBMAX`,[-83]:`ELIBEXEC`,[-84]:`EILSEQ`,[-85]:`ERESTART`,[-86]:`ESTRPIPE`,[-87]:`EUSERS`,[-88]:`ENOTSOCK`,[-89]:`EDESTADDRREQ`,[-90]:`EMSGSIZE`,[-91]:`EPROTOTYPE`,[-92]:`ENOPROTOOPT`,[-93]:`EPROTONOSUPPORT`,[-94]:`ESOCKTNOSUPPORT`,[-95]:`ENOTSUP`,[-96]:`EPFNOSUPPORT`,[-97]:`EAFNOSUPPORT`,[-98]:`EADDRINUSE`,[-99]:`EADDRNOTAVAIL`,[-100]:`ENETDOWN`,[-101]:`ENETUNREACH`,[-102]:`ENETRESET`,[-103]:`ECONNABORTED`,[-104]:`ECONNRESET`,[-105]:`ENOBUFS`,[-106]:`EISCONN`,[-107]:`ENOTCONN`,[-108]:`ESHUTDOWN`,[-109]:`ETOOMANYREFS`,[-110]:`ETIMEDOUT`,[-111]:`ECONNREFUSED`,[-112]:`EHOSTDOWN`,[-113]:`EHOSTUNREACH`,[-114]:`EALREADY`,[-115]:`EINPROGRESS`,[-116]:`ESTALE`,[-117]:`EUCLEAN`,[-118]:`ENOTNAM`,[-119]:`ENAVAIL`,[-120]:`EISNAM`,[-121]:`EREMOTEIO`,[-122]:`EDQUOT`,[-123]:`ENOMEDIUM`,[-124]:`EMEDIUMTYPE`,[-125]:`ECANCELED`,[-126]:`ENOKEY`,[-127]:`EKEYEXPIRED`,[-128]:`EKEYREVOKED`,[-129]:`EKEYREJECTED`},t={[-1]:`EPERM`,[-2]:`ENOENT`,[-3]:`ESRCH`,[-4]:`EINTR`,[-5]:`EIO`,[-6]:`ENXIO`,[-7]:`E2BIG`,[-8]:`ENOEXEC`,[-9]:`EBADF`,[-10]:`ECHILD`,[-11]:`EDEADLK`,[-12]:`ENOMEM`,[-13]:`EACCES`,[-14]:`EFAULT`,[-15]:`ENOTBLK`,[-16]:`EBUSY`,[-17]:`EEXIST`,[-18]:`EXDEV`,[-19]:`ENODEV`,[-20]:`ENOTDIR`,[-21]:`EISDIR`,[-22]:`EINVAL`,[-23]:`ENFILE`,[-24]:`EMFILE`,[-25]:`ENOTTY`,[-26]:`ETXTBSY`,[-27]:`EFBIG`,[-28]:`ENOSPC`,[-29]:`ESPIPE`,[-30]:`EROFS`,[-31]:`EMLINK`,[-32]:`EPIPE`,[-33]:`EDOM`,[-34]:`ERANGE`,[-35]:`EAGAIN`,[-36]:`EINPROGRESS`,[-37]:`EALREADY`,[-38]:`ENOTSOCK`,[-39]:`EDESTADDRREQ`,[-40]:`EMSGSIZE`,[-41]:`EPROTOTYPE`,[-42]:`ENOPROTOOPT`,[-43]:`EPROTONOSUPPORT`,[-44]:`ESOCKTNOSUPPORT`,[-45]:`ENOTSUP`,[-46]:`EPFNOSUPPORT`,[-47]:`EAFNOSUPPORT`,[-48]:`EADDRINUSE`,[-49]:`EADDRNOTAVAIL`,[-50]:`ENETDOWN`,[-51]:`ENETUNREACH`,[-52]:`ENETRESET`,[-53]:`ECONNABORTED`,[-54]:`ECONNRESET`,[-55]:`ENOBUFS`,[-56]:`EISCONN`,[-57]:`ENOTCONN`,[-58]:`ESHUTDOWN`,[-59]:`ETOOMANYREFS`,[-60]:`ETIMEDOUT`,[-61]:`ECONNREFUSED`,[-62]:`ELOOP`,[-63]:`ENAMETOOLONG`,[-64]:`EHOSTDOWN`,[-65]:`EHOSTUNREACH`,[-66]:`ENOTEMPTY`,[-67]:`EPROCLIM`,[-68]:`EUSERS`,[-69]:`EDQUOT`,[-70]:`ESTALE`,[-71]:`EREMOTE`,[-72]:`EBADRPC`,[-73]:`ERPCMISMATCH`,[-74]:`EPROGUNAVAIL`,[-75]:`EPROGMISMATCH`,[-76]:`EPROCUNAVAIL`,[-77]:`ENOLCK`,[-78]:`ENOSYS`,[-79]:`EFTYPE`,[-80]:`EAUTH`,[-81]:`ENEEDAUTH`,[-82]:`EPWROFF`,[-83]:`EDEVERR`,[-84]:`EOVERFLOW`,[-85]:`EBADEXEC`,[-86]:`EBADARCH`,[-87]:`ESHLIBVERS`,[-88]:`EBADMACHO`,[-89]:`ECANCELED`,[-90]:`EIDRM`,[-91]:`ENOMSG`,[-92]:`EILSEQ`,[-93]:`ENOATTR`,[-94]:`EBADMSG`,[-95]:`EMULTIHOP`,[-96]:`ENODATA`,[-97]:`ENOLINK`,[-98]:`ENOSR`,[-99]:`ENOSTR`,[-100]:`EPROTO`,[-101]:`ETIME`,[-102]:`EOPNOTSUPP`};function getPlatform(){return typeof globalThis.process?.platform==`string`?globalThis.process.platform:`linux`}function getSystemErrorName(n){if(typeof n!=`number`)throw TypeError(`The "err" argument must be of type number. Received type `+typeof n);if(n>=0)throw RangeError(`The value of "err" is out of range. It must be a negative integer. Received ${n}`);return(getPlatform()===`darwin`?t:e)[n]||`Unknown system error ${n}`}function getSystemErrorMap(){let n=getPlatform()===`darwin`?t:e,r=new Map;for(let[e,t]of Object.entries(n))r.set(Number(e),[t,``]);return r}export{getSystemErrorMap,getSystemErrorName};
|
package/lib/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getSystemErrorMap as e,getSystemErrorName as t}from"./errors.js";import{types_exports as n}from"./types.js";const r=Symbol.for(`nodejs.util.inspect.custom`);function inspectValue(e,t,n){if(e===null)return t.colors?`\x1B[1mnull\x1B[22m`:`null`;if(e===void 0)return t.colors?`\x1B[90mundefined\x1B[39m`:`undefined`;let i=t.depth??2;if(typeof e==`string`){let n=e.replace(/\\/g,`\\\\`);if(e.includes(`'`)&&!e.includes(`"`)){let e=n.replace(/"/g,`\\"`);return t.colors?`\x1b[32m"${e}"\x1b[39m`:`"${e}"`}let r=n.replace(/'/g,`\\'`);return t.colors?`\x1b[32m'${r}'\x1b[39m`:`'${r}'`}if(typeof e==`number`)return t.colors?`\x1b[33m${e}\x1b[39m`:String(e);if(typeof e==`bigint`)return t.colors?`\x1b[33m${e}n\x1b[39m`:`${e}n`;if(typeof e==`boolean`)return t.colors?`\x1b[33m${e}\x1b[39m`:String(e);if(typeof e==`symbol`)return t.colors?`\x1b[32m${e.toString()}\x1b[39m`:e.toString();if(typeof e==`function`){let n=e.name?`: ${e.name}`:``;return t.colors?`\x1b[36m[Function${n}]\x1b[39m`:`[Function${n}]`}if(typeof e==`object`&&e&&r in e){let i=e[r];if(typeof i==`function`){let r=i.call(e,n,t);return typeof r==`string`?r:inspectValue(r,t,n)}}if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return t.colors?`\x1b[31m${e.toString()}\x1b[39m`:e.toString();if(e instanceof Error)return e.stack||e.toString();if(n>i)return Array.isArray(e)?`[Array]`:`[Object]`;if(Array.isArray(e))return inspectArray(e,t,n);if(e instanceof Map){let r=[...e.entries()].map(([e,r])=>`${inspectValue(e,t,n+1)} => ${inspectValue(r,t,n+1)}`);return`Map(${e.size}) { ${r.join(`, `)} }`}if(e instanceof Set){let r=[...e].map(e=>inspectValue(e,t,n+1));return`Set(${e.size}) { ${r.join(`, `)} }`}if(ArrayBuffer.isView(e)&&!(e instanceof DataView)){let t=e.constructor?.name||`TypedArray`,n=Array.from(e);return`${t}(${n.length}) [ ${n.join(`, `)} ]`}return inspectObject(e,t,n)}function inspectArray(e,t,n){let r=t.maxArrayLength??100,i=Math.min(e.length,r),a=[];for(let r=0;r<i;r++)a.push(inspectValue(e[r],t,n+1));e.length>r&&a.push(`... ${e.length-r} more items`),t.showHidden&&a.push(`[length]: ${e.length}`);let o=t.breakLength??72,s=t.compact??3;if(typeof s==`number`&&s>0&&e.length>s){let stripAnsi=e=>e.replace(/\x1b\[[0-9;]*m/g,``),e=Math.max(...a.map(e=>stripAnsi(e).length)),t=Math.max(e-2,1),n=a.length,r=Math.min(Math.round(Math.sqrt(2.5*t*n)/t),Math.floor((o-2)/t),Math.floor((2.5+n-1)/2),15);if(r>1){let e=[];for(let t=0;t<n;t+=r)e.push(` `+a.slice(t,Math.min(t+r,n)).join(`, `));return`[\n${e.join(`,
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{getSystemErrorMap as e,getSystemErrorName as t}from"./errors.js";import{types_exports as n}from"./types.js";const r=Symbol.for(`nodejs.util.inspect.custom`);function inspectValue(e,t,n){if(e===null)return t.colors?`\x1B[1mnull\x1B[22m`:`null`;if(e===void 0)return t.colors?`\x1B[90mundefined\x1B[39m`:`undefined`;let i=t.depth??2;if(typeof e==`string`){let n=e.replace(/\\/g,`\\\\`);if(e.includes(`'`)&&!e.includes(`"`)){let e=n.replace(/"/g,`\\"`);return t.colors?`\x1b[32m"${e}"\x1b[39m`:`"${e}"`}let r=n.replace(/'/g,`\\'`);return t.colors?`\x1b[32m'${r}'\x1b[39m`:`'${r}'`}if(typeof e==`number`)return t.colors?`\x1b[33m${e}\x1b[39m`:String(e);if(typeof e==`bigint`)return t.colors?`\x1b[33m${e}n\x1b[39m`:`${e}n`;if(typeof e==`boolean`)return t.colors?`\x1b[33m${e}\x1b[39m`:String(e);if(typeof e==`symbol`)return t.colors?`\x1b[32m${e.toString()}\x1b[39m`:e.toString();if(typeof e==`function`){let n=e.name?`: ${e.name}`:``;return t.colors?`\x1b[36m[Function${n}]\x1b[39m`:`[Function${n}]`}if(typeof e==`object`&&e&&r in e){let i=e[r];if(typeof i==`function`){let r=i.call(e,n,t);return typeof r==`string`?r:inspectValue(r,t,n)}}if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return t.colors?`\x1b[31m${e.toString()}\x1b[39m`:e.toString();if(e instanceof Error)return e.stack||e.toString();if(n>i)return Array.isArray(e)?`[Array]`:`[Object]`;if(Array.isArray(e))return inspectArray(e,t,n);if(e instanceof Map){let r=[...e.entries()].map(([e,r])=>`${inspectValue(e,t,n+1)} => ${inspectValue(r,t,n+1)}`);return`Map(${e.size}) { ${r.join(`, `)} }`}if(e instanceof Set){let r=[...e].map(e=>inspectValue(e,t,n+1));return`Set(${e.size}) { ${r.join(`, `)} }`}if(ArrayBuffer.isView(e)&&!(e instanceof DataView)){let t=e.constructor?.name||`TypedArray`,n=Array.from(e);return`${t}(${n.length}) [ ${n.join(`, `)} ]`}return inspectObject(e,t,n)}function inspectArray(e,t,n){let r=t.maxArrayLength??100,i=Math.min(e.length,r),a=[];for(let r=0;r<i;r++)a.push(inspectValue(e[r],t,n+1));e.length>r&&a.push(`... ${e.length-r} more items`),t.showHidden&&a.push(`[length]: ${e.length}`);let o=t.breakLength??72,s=t.compact??3;if(typeof s==`number`&&s>0&&e.length>s){let stripAnsi=e=>e.replace(/\x1b\[[0-9;]*m/g,``),e=Math.max(...a.map(e=>stripAnsi(e).length)),t=Math.max(e-2,1),n=a.length,r=Math.min(Math.round(Math.sqrt(2.5*t*n)/t),Math.floor((o-2)/t),Math.floor((2.5+n-1)/2),15);if(r>1){let e=[];for(let t=0;t<n;t+=r)e.push(` `+a.slice(t,Math.min(t+r,n)).join(`, `));return`[\n${e.join(`,
|
|
2
2
|
`)}\n]`}}let c=`[ ${a.join(`, `)} ]`;return c.length<=o?c:`[\n${a.map(e=>` `+e).join(`,
|
|
3
3
|
`)}\n]`}function inspectObject(e,t,n){let r=t.showHidden?Object.getOwnPropertyNames(e):Object.keys(e);if(t.sorted&&r.sort(),r.length===0){let t=Object.prototype.toString.call(e);return t===`[object Object]`?`{}`:t}let i=r.map(r=>`${r}: ${inspectValue(e[r],t,n+1)}`),a=t.breakLength??72,o=`{ ${i.join(`, `)} }`;return o.length<=a?o:`{\n${i.map(e=>` `+e).join(`,
|
|
4
|
-
`)}\n}`}function inspect(e,t){let n=typeof t==`boolean`?{showHidden:t}:{...t};return n.colors===void 0&&(n.colors=!1),inspectValue(e,n,0)}inspect.custom=r,inspect.defaultOptions={showHidden:!1,depth:2,colors:!1,maxArrayLength:100,maxStringLength:1e4,breakLength:72,compact:3,sorted:!1},inspect.colors={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],doubleunderline:[21,24],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],framed:[51,54],overlined:[53,55],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},inspect.styles={special:`cyan`,number:`yellow`,bigint:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,symbol:`green`,date:`magenta`,regexp:`red`,module:`underline`};function format(e,...t){if(e===void 0&&t.length===0)return``;if(typeof e!=`string`){if(t.length===0)return inspect(e);let n=[inspect(e)];for(let e of t)n.push(inspect(e));return n.join(` `)}let n=0,r=``,i=0;for(let a=0;a<e.length-1;a++){if(e[a]!==`%`)continue;a>i&&(r+=e.slice(i,a));let o=e[a+1];if(o===`%`){r+=`%`,i=a+2,a++;continue}if(n>=t.length){r+=`%`+o,i=a+2,a++;continue}let s=t[n];switch(o){case`s`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=s.toString();else if(typeof s==`number`&&Object.is(s,-0))r+=`-0`;else if(typeof s==`object`&&s)if(Object.getPrototypeOf(s)===null||typeof s.toString==`function`&&s.toString!==Object.prototype.toString&&s.toString!==Array.prototype.toString)try{let e=s.toString();typeof e==`string`&&e!==`[object Object]`?r+=e:r+=inspect(s,{depth:0})}catch{r+=inspect(s,{depth:0})}else r+=inspect(s,{depth:0});else r+=String(s);n++;break;case`d`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=`NaN`;else{let e=Number(s);r+=Object.is(e,-0)?`-0`:String(e)}n++;break;case`i`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=`NaN`;else{let e=Number(s);if(!isFinite(e))r+=`NaN`;else{let t=Math.trunc(e);r+=Object.is(t,-0)?`-0`:String(t)}}n++;break;case`f`:if(typeof s==`bigint`)r+=Number(s).toString();else if(typeof s==`symbol`)r+=`NaN`;else{let e=parseFloat(String(s));r+=Object.is(e,-0)?`-0`:String(e)}n++;break;case`j`:try{r+=JSON.stringify(t[n++])}catch{r+=`[Circular]`}break;case`o`:r+=inspect(t[n++],{showHidden:!0,depth:4});break;case`O`:r+=inspect(t[n++],{depth:4});break;default:r+=`%`+o;break}i=a+2,a++}for(i<e.length&&(r+=e.slice(i));n<t.length;n++){let e=t[n];typeof e==`string`?r+=` `+e:r+=` `+inspect(e)}return r}function formatWithOptions(e,t,...n){return format(t,...n)}const i=RegExp(`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`,`g`);function stripVTControlCharacters(e){if(typeof e!=`string`)throw TypeError(`The "str" argument must be of type string. Received `+typeof e);return e.indexOf(`\x1B`)===-1&&e.indexOf(``)===-1?e:e.replace(i,``)}function styleText(e,t,n){if(typeof t!=`string`)throw TypeError(`The "text" argument must be of type string. Received `+typeof t);if((n?.validateStream??!0)&&!(n?.stream??globalThis.process?.stdout)?.isTTY)return t;let r=Array.isArray(e)?e:[e],i=``,a=``;for(let e of r){if(e===`none`)continue;let t=inspect.colors[e];if(t===void 0)throw TypeError(`The "format" argument must be one of: ${Object.keys(inspect.colors).join(`, `)}. Received '${e}'`);i+=`[${t[0]}m`,a=`[${t[1]}m`+a}return`${i}${t}${a}`}const a=Symbol.for(`nodejs.util.promisify.custom`);function promisify(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);let t=e[a];if(typeof t==`function`)return t;function promisified(...t){return new Promise((n,r)=>{e.call(this,...t,(e,...t)=>{e?r(e):t.length<=1?n(t[0]):n(t)})})}return Object.setPrototypeOf(promisified,Object.getPrototypeOf(e)),Object.defineProperty(promisified,a,{value:promisified}),promisified}promisify.custom=a;function callbackify(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);return function(...t){let n=t.pop();if(typeof n!=`function`)throw TypeError(`The last argument must be of type Function`);e.apply(this,t).then(e=>Promise.resolve().then(()=>n(null,e)),e=>Promise.resolve().then(()=>n(e||Error())))}}function deprecate(e,t,n){let r=!1;function deprecated(...i){if(!r){r=!0;let e=n?`[${n}] ${t}`:t;console.warn(`DeprecationWarning: ${e}`)}return e.apply(this,i)}return Object.setPrototypeOf(deprecated,e),deprecated}function debuglog(e){let debug;return(...t)=>{if(debug===void 0){let t=typeof globalThis.process?.env?.NODE_DEBUG==`string`?globalThis.process.env.NODE_DEBUG:``;if(RegExp(`\\b${e}\\b`,`i`).test(t)){let t=typeof globalThis.process?.pid==`number`?globalThis.process.pid:0;debug=(...n)=>{console.error(`${e.toUpperCase()} ${t}:`,...n)}}else debug=()=>{}}debug(...t)}}function inherits(e,t){if(e==null){let t=TypeError(`The "ctor" argument must be of type Function. Received `+String(e));throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(t==null){let e=TypeError(`The "superCtor" argument must be of type Function. Received `+String(t));throw e.code=`ERR_INVALID_ARG_TYPE`,e}if(t.prototype===void 0){let e=TypeError(`The "superCtor.prototype" property must not be undefined`);throw e.code=`ERR_INVALID_ARG_TYPE`,e}Object.defineProperty(e,`super_`,{value:t,writable:!0,configurable:!0}),Object.setPrototypeOf(e.prototype,t.prototype)}function isBoolean(e){return typeof e==`boolean`}function isNull(e){return e===null}function isNullOrUndefined(e){return e==null}function isNumber(e){return typeof e==`number`}function isString(e){return typeof e==`string`}function isSymbol(e){return typeof e==`symbol`}function isUndefined(e){return e===void 0}function isObject(e){return typeof e==`object`&&!!e}function isError(e){return e instanceof Error}function isFunction(e){return typeof e==`function`}function isRegExp(e){return e instanceof RegExp}function isArray(e){return Array.isArray(e)}function isPrimitive(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function isDate(e){return e instanceof Date}function isBuffer(e){return e instanceof Uint8Array&&e.constructor?.name===`Buffer`}const o=globalThis.TextDecoder,s=globalThis.TextEncoder;function isDeepStrictEqual(e,t){if(Object.is(e,t))return!0;if(typeof e!=typeof t||e===null||t===null||typeof e!=`object`)return!1;let n=e,r=t;if(Array.isArray(n)&&Array.isArray(r)){if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!isDeepStrictEqual(n[e],r[e]))return!1;return!0}if(Array.isArray(n)!==Array.isArray(r))return!1;if(n instanceof Date&&r instanceof Date)return n.getTime()===r.getTime();if(n instanceof RegExp&&r instanceof RegExp)return n.source===r.source&&n.flags===r.flags;let i=Object.keys(n),a=Object.keys(r);if(i.length!==a.length)return!1;for(let e of i)if(!Object.prototype.hasOwnProperty.call(r,e)||!isDeepStrictEqual(n[e],r[e]))return!1;return!0}function toUSVString(e){return typeof e.toWellFormed==`function`?e.toWellFormed():e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,`�`)}var c={format,formatWithOptions,styleText,stripVTControlCharacters,inspect,promisify,callbackify,deprecate,debuglog,inherits,types:n,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isObject,isError,isFunction,isRegExp,isArray,isPrimitive,isDate,isBuffer,isDeepStrictEqual,toUSVString,TextDecoder:globalThis.TextDecoder,TextEncoder:globalThis.TextEncoder,getSystemErrorName:t,getSystemErrorMap:e};export{o as TextDecoder,s as TextEncoder,callbackify,debuglog,c as default,deprecate,format,formatWithOptions,e as getSystemErrorMap,t as getSystemErrorName,inherits,inspect,isArray,isBoolean,isBuffer,isDate,isDeepStrictEqual,isError,isFunction,isNull,isNullOrUndefined,isNumber,isObject,isPrimitive,isRegExp,isString,isSymbol,isUndefined,promisify,stripVTControlCharacters,styleText,toUSVString,n as types};
|
|
4
|
+
`)}\n}`}function inspect(e,t){let n=typeof t==`boolean`?{showHidden:t}:{...t};return n.colors===void 0&&(n.colors=!1),inspectValue(e,n,0)}inspect.custom=r,inspect.defaultOptions={showHidden:!1,depth:2,colors:!1,maxArrayLength:100,maxStringLength:1e4,breakLength:72,compact:3,sorted:!1},inspect.colors={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],doubleunderline:[21,24],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],framed:[51,54],overlined:[53,55],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},inspect.styles={special:`cyan`,number:`yellow`,bigint:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,symbol:`green`,date:`magenta`,regexp:`red`,module:`underline`};function format(e,...t){if(e===void 0&&t.length===0)return``;if(typeof e!=`string`){if(t.length===0)return inspect(e);let n=[inspect(e)];for(let e of t)n.push(inspect(e));return n.join(` `)}let n=0,r=``,i=0;for(let a=0;a<e.length-1;a++){if(e[a]!==`%`)continue;a>i&&(r+=e.slice(i,a));let o=e[a+1];if(o===`%`){r+=`%`,i=a+2,a++;continue}if(n>=t.length){r+=`%`+o,i=a+2,a++;continue}let s=t[n];switch(o){case`s`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=s.toString();else if(typeof s==`number`&&Object.is(s,-0))r+=`-0`;else if(typeof s==`object`&&s)if(Object.getPrototypeOf(s)===null||typeof s.toString==`function`&&s.toString!==Object.prototype.toString&&s.toString!==Array.prototype.toString)try{let e=s.toString();typeof e==`string`&&e!==`[object Object]`?r+=e:r+=inspect(s,{depth:0})}catch{r+=inspect(s,{depth:0})}else r+=inspect(s,{depth:0});else r+=String(s);n++;break;case`d`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=`NaN`;else{let e=Number(s);r+=Object.is(e,-0)?`-0`:String(e)}n++;break;case`i`:if(typeof s==`bigint`)r+=`${s}n`;else if(typeof s==`symbol`)r+=`NaN`;else{let e=Number(s);if(!isFinite(e))r+=`NaN`;else{let t=Math.trunc(e);r+=Object.is(t,-0)?`-0`:String(t)}}n++;break;case`f`:if(typeof s==`bigint`)r+=Number(s).toString();else if(typeof s==`symbol`)r+=`NaN`;else{let e=parseFloat(String(s));r+=Object.is(e,-0)?`-0`:String(e)}n++;break;case`j`:try{r+=JSON.stringify(t[n++])}catch{r+=`[Circular]`}break;case`o`:r+=inspect(t[n++],{showHidden:!0,depth:4});break;case`O`:r+=inspect(t[n++],{depth:4});break;default:r+=`%`+o;break}i=a+2,a++}for(i<e.length&&(r+=e.slice(i));n<t.length;n++){let e=t[n];typeof e==`string`?r+=` `+e:r+=` `+inspect(e)}return r}function formatWithOptions(e,t,...n){return format(t,...n)}const i=RegExp(`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/\\#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`,`g`);function stripVTControlCharacters(e){if(typeof e!=`string`)throw TypeError(`The "str" argument must be of type string. Received `+typeof e);return e.indexOf(`\x1B`)===-1&&e.indexOf(``)===-1?e:e.replace(i,``)}function styleText(e,t,n){if(typeof t!=`string`)throw TypeError(`The "text" argument must be of type string. Received `+typeof t);if((n?.validateStream??!0)&&!(n?.stream??globalThis.process?.stdout)?.isTTY)return t;let r=Array.isArray(e)?e:[e],i=``,a=``;for(let e of r){if(e===`none`)continue;let t=inspect.colors[e];if(t===void 0)throw TypeError(`The "format" argument must be one of: ${Object.keys(inspect.colors).join(`, `)}. Received '${e}'`);i+=`[${t[0]}m`,a=`[${t[1]}m`+a}return`${i}${t}${a}`}const a=Symbol.for(`nodejs.util.promisify.custom`);function promisify(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);let t=e[a];if(typeof t==`function`)return t;function promisified(...t){return new Promise((n,r)=>{e.call(this,...t,(e,...t)=>{e?r(e):t.length<=1?n(t[0]):n(t)})})}return Object.setPrototypeOf(promisified,Object.getPrototypeOf(e)),Object.defineProperty(promisified,a,{value:promisified}),promisified}promisify.custom=a;function callbackify(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);return function(...t){let n=t.pop();if(typeof n!=`function`)throw TypeError(`The last argument must be of type Function`);e.apply(this,t).then(e=>Promise.resolve().then(()=>n(null,e)),e=>Promise.resolve().then(()=>n(e||Error())))}}function deprecate(e,t,n){let r=!1;function deprecated(...i){if(!r){r=!0;let e=n?`[${n}] ${t}`:t;console.warn(`DeprecationWarning: ${e}`)}return e.apply(this,i)}return Object.setPrototypeOf(deprecated,e),deprecated}function debuglog(e){let debug;return(...t)=>{if(debug===void 0){let t=typeof globalThis.process?.env?.NODE_DEBUG==`string`?globalThis.process.env.NODE_DEBUG:``;if(RegExp(`\\b${e}\\b`,`i`).test(t)){let t=typeof globalThis.process?.pid==`number`?globalThis.process.pid:0;debug=(...n)=>{console.error(`${e.toUpperCase()} ${t}:`,...n)}}else debug=()=>{}}debug(...t)}}function inherits(e,t){if(e==null){let t=TypeError(`The "ctor" argument must be of type Function. Received `+String(e));throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(t==null){let e=TypeError(`The "superCtor" argument must be of type Function. Received `+String(t));throw e.code=`ERR_INVALID_ARG_TYPE`,e}if(t.prototype===void 0){let e=TypeError(`The "superCtor.prototype" property must not be undefined`);throw e.code=`ERR_INVALID_ARG_TYPE`,e}Object.defineProperty(e,`super_`,{value:t,writable:!0,configurable:!0}),Object.setPrototypeOf(e.prototype,t.prototype)}function isBoolean(e){return typeof e==`boolean`}function isNull(e){return e===null}function isNullOrUndefined(e){return e==null}function isNumber(e){return typeof e==`number`}function isString(e){return typeof e==`string`}function isSymbol(e){return typeof e==`symbol`}function isUndefined(e){return e===void 0}function isObject(e){return typeof e==`object`&&!!e}function isError(e){return e instanceof Error}function isFunction(e){return typeof e==`function`}function isRegExp(e){return e instanceof RegExp}function isArray(e){return Array.isArray(e)}function isPrimitive(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function isDate(e){return e instanceof Date}function isBuffer(e){return e instanceof Uint8Array&&e.constructor?.name===`Buffer`}const o=globalThis.TextDecoder,s=globalThis.TextEncoder;function isDeepStrictEqual(e,t){if(Object.is(e,t))return!0;if(typeof e!=typeof t||e===null||t===null||typeof e!=`object`)return!1;let n=e,r=t;if(Array.isArray(n)&&Array.isArray(r)){if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!isDeepStrictEqual(n[e],r[e]))return!1;return!0}if(Array.isArray(n)!==Array.isArray(r))return!1;if(n instanceof Date&&r instanceof Date)return n.getTime()===r.getTime();if(n instanceof RegExp&&r instanceof RegExp)return n.source===r.source&&n.flags===r.flags;let i=Object.keys(n),a=Object.keys(r);if(i.length!==a.length)return!1;for(let e of i)if(!Object.prototype.hasOwnProperty.call(r,e)||!isDeepStrictEqual(n[e],r[e]))return!1;return!0}function toUSVString(e){return typeof e.toWellFormed==`function`?e.toWellFormed():e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,`�`)}function aborted(e,t){return e==null||typeof e.aborted!=`boolean`?Promise.reject(TypeError(`The "signal" argument must be an instance of AbortSignal`)):typeof t!=`object`||!t?Promise.reject(TypeError(`The "resource" argument must be an non-null object`)):e.aborted?Promise.resolve():new Promise(t=>{let onAbort=()=>{e.removeEventListener(`abort`,onAbort),t()};e.addEventListener(`abort`,onAbort,{once:!0})})}var c={format,formatWithOptions,styleText,stripVTControlCharacters,inspect,promisify,callbackify,deprecate,debuglog,inherits,types:n,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isObject,isError,isFunction,isRegExp,isArray,isPrimitive,isDate,isBuffer,isDeepStrictEqual,toUSVString,aborted,TextDecoder:globalThis.TextDecoder,TextEncoder:globalThis.TextEncoder,getSystemErrorName:t,getSystemErrorMap:e};export{o as TextDecoder,s as TextEncoder,aborted,callbackify,debuglog,c as default,deprecate,format,formatWithOptions,e as getSystemErrorMap,t as getSystemErrorName,inherits,inspect,isArray,isBoolean,isBuffer,isDate,isDeepStrictEqual,isError,isFunction,isNull,isNullOrUndefined,isNumber,isObject,isPrimitive,isRegExp,isString,isSymbol,isUndefined,promisify,stripVTControlCharacters,styleText,toUSVString,n as types};
|
package/lib/esm/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Object.prototype.toString,t=BigInt.prototype.valueOf,n=Boolean.prototype.valueOf,r=Date.prototype.valueOf,i=Number.prototype.valueOf,a=String.prototype.valueOf,o=Symbol.prototype.valueOf,s=WeakMap.prototype.has,c=WeakSet.prototype.has,l=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get,u=typeof SharedArrayBuffer<`u`?Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,`byteLength`).get:void 0,d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array).prototype,Symbol.toStringTag).get,f=Object.getOwnPropertyDescriptor(Set.prototype,`size`).get,p=Object.getOwnPropertyDescriptor(Map.prototype,`size`).get;function isObjectLike(e){return typeof e==`object`&&!!e}function isAnyArrayBuffer(e){return isArrayBuffer(e)||isSharedArrayBuffer(e)}function isArrayBuffer(e){try{return l.call(e),!0}catch{return!1}}function isSharedArrayBuffer(e){if(u===void 0)return!1;try{return u.call(e),!0}catch{return!1}}function isArrayBufferView(e){return ArrayBuffer.isView(e)}function isTypedArray(e){return d.call(e)!==void 0}function isUint8Array(e){return d.call(e)===`Uint8Array`}function isUint8ClampedArray(e){return d.call(e)===`Uint8ClampedArray`}function isUint16Array(e){return d.call(e)===`Uint16Array`}function isUint32Array(e){return d.call(e)===`Uint32Array`}function isInt8Array(e){return d.call(e)===`Int8Array`}function isInt16Array(e){return d.call(e)===`Int16Array`}function isInt32Array(e){return d.call(e)===`Int32Array`}function isFloat32Array(e){return d.call(e)===`Float32Array`}function isFloat64Array(e){return d.call(e)===`Float64Array`}function isBigInt64Array(e){return d.call(e)===`BigInt64Array`}function isBigUint64Array(e){return d.call(e)===`BigUint64Array`}function isDataView(e){return ArrayBuffer.isView(e)&&d.call(e)===void 0}function isMap(e){try{return p.call(e),!0}catch{return!1}}function isSet(e){try{return f.call(e),!0}catch{return!1}}function isWeakMap(e){try{return s.call(e,null),!0}catch{return!1}}function isWeakSet(e){try{return c.call(e,null),!0}catch{return!1}}function isMapIterator(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Map Iterator`}function isSetIterator(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Set Iterator`}function isDate(e){try{return r.call(e),!0}catch{return!1}}function isRegExp(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object RegExp]`}function isNativeError(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object Error]`}function isAsyncFunction(e){return typeof e==`function`&&e[Symbol.toStringTag]===`AsyncFunction`}function isGeneratorFunction(e){return typeof e==`function`&&e[Symbol.toStringTag]===`GeneratorFunction`}function isGeneratorObject(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Generator`}function isPromise(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Promise`}function isBooleanObject(e){if(!isObjectLike(e))return!1;try{return n.call(e),!0}catch{return!1}}function isNumberObject(e){if(!isObjectLike(e))return!1;try{return i.call(e),!0}catch{return!1}}function isStringObject(e){if(!isObjectLike(e))return!1;try{return a.call(e),!0}catch{return!1}}function isSymbolObject(e){if(!isObjectLike(e))return!1;try{return o.call(e),!0}catch{return!1}}function isBigIntObject(e){if(!isObjectLike(e))return!1;try{return t.call(e),!0}catch{return!1}}function isBoxedPrimitive(e){return isBooleanObject(e)||isStringObject(e)||isNumberObject(e)||isSymbolObject(e)||isBigIntObject(e)}function isArgumentsObject(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object Arguments]`}function isModuleNamespaceObject(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Module`}function isProxy(e){return!1}function isCryptoKey(t){return isObjectLike(t)&&e.call(t)===`[object CryptoKey]`}function isKeyObject(e){return!1}const m={isAnyArrayBuffer,isArrayBuffer,isArrayBufferView,isArgumentsObject,isAsyncFunction,isBigInt64Array,isBigUint64Array,isBigIntObject,isBooleanObject,isBoxedPrimitive,isCryptoKey,isDataView,isDate,isFloat32Array,isFloat64Array,isGeneratorFunction,isGeneratorObject,isInt8Array,isInt16Array,isInt32Array,isKeyObject,isMap,isMapIterator,isModuleNamespaceObject,isNativeError,isNumberObject,isPromise,isProxy,isRegExp,isSet,isSetIterator,isSharedArrayBuffer,isStringObject,isSymbolObject,isTypedArray,isUint8Array,isUint8ClampedArray,isUint16Array,isUint32Array,isWeakMap,isWeakSet};export{m as default,isAnyArrayBuffer,isArgumentsObject,isArrayBuffer,isArrayBufferView,isAsyncFunction,isBigInt64Array,isBigIntObject,isBigUint64Array,isBooleanObject,isBoxedPrimitive,isCryptoKey,isDataView,isDate,isFloat32Array,isFloat64Array,isGeneratorFunction,isGeneratorObject,isInt16Array,isInt32Array,isInt8Array,isKeyObject,isMap,isMapIterator,isModuleNamespaceObject,isNativeError,isNumberObject,isPromise,isProxy,isRegExp,isSet,isSetIterator,isSharedArrayBuffer,isStringObject,isSymbolObject,isTypedArray,isUint16Array,isUint32Array,isUint8Array,isUint8ClampedArray,isWeakMap,isWeakSet};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";const e=Object.prototype.toString,t=BigInt.prototype.valueOf,n=Boolean.prototype.valueOf,r=Date.prototype.valueOf,i=Number.prototype.valueOf,a=String.prototype.valueOf,o=Symbol.prototype.valueOf,s=WeakMap.prototype.has,c=WeakSet.prototype.has,l=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get,u=typeof SharedArrayBuffer<`u`?Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,`byteLength`).get:void 0,d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array).prototype,Symbol.toStringTag).get,f=Object.getOwnPropertyDescriptor(Set.prototype,`size`).get,p=Object.getOwnPropertyDescriptor(Map.prototype,`size`).get;function isObjectLike(e){return typeof e==`object`&&!!e}function isAnyArrayBuffer(e){return isArrayBuffer(e)||isSharedArrayBuffer(e)}function isArrayBuffer(e){try{return l.call(e),!0}catch{return!1}}function isSharedArrayBuffer(e){if(u===void 0)return!1;try{return u.call(e),!0}catch{return!1}}function isArrayBufferView(e){return ArrayBuffer.isView(e)}function isTypedArray(e){return d.call(e)!==void 0}function isUint8Array(e){return d.call(e)===`Uint8Array`}function isUint8ClampedArray(e){return d.call(e)===`Uint8ClampedArray`}function isUint16Array(e){return d.call(e)===`Uint16Array`}function isUint32Array(e){return d.call(e)===`Uint32Array`}function isInt8Array(e){return d.call(e)===`Int8Array`}function isInt16Array(e){return d.call(e)===`Int16Array`}function isInt32Array(e){return d.call(e)===`Int32Array`}function isFloat32Array(e){return d.call(e)===`Float32Array`}function isFloat64Array(e){return d.call(e)===`Float64Array`}function isBigInt64Array(e){return d.call(e)===`BigInt64Array`}function isBigUint64Array(e){return d.call(e)===`BigUint64Array`}function isDataView(e){return ArrayBuffer.isView(e)&&d.call(e)===void 0}function isMap(e){try{return p.call(e),!0}catch{return!1}}function isSet(e){try{return f.call(e),!0}catch{return!1}}function isWeakMap(e){try{return s.call(e,null),!0}catch{return!1}}function isWeakSet(e){try{return c.call(e,null),!0}catch{return!1}}function isMapIterator(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Map Iterator`}function isSetIterator(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Set Iterator`}function isDate(e){try{return r.call(e),!0}catch{return!1}}function isRegExp(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object RegExp]`}function isNativeError(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object Error]`}function isAsyncFunction(e){return typeof e==`function`&&e[Symbol.toStringTag]===`AsyncFunction`}function isGeneratorFunction(e){return typeof e==`function`&&e[Symbol.toStringTag]===`GeneratorFunction`}function isGeneratorObject(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Generator`}function isPromise(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Promise`}function isBooleanObject(e){if(!isObjectLike(e))return!1;try{return n.call(e),!0}catch{return!1}}function isNumberObject(e){if(!isObjectLike(e))return!1;try{return i.call(e),!0}catch{return!1}}function isStringObject(e){if(!isObjectLike(e))return!1;try{return a.call(e),!0}catch{return!1}}function isSymbolObject(e){if(!isObjectLike(e))return!1;try{return o.call(e),!0}catch{return!1}}function isBigIntObject(e){if(!isObjectLike(e))return!1;try{return t.call(e),!0}catch{return!1}}function isBoxedPrimitive(e){return isBooleanObject(e)||isStringObject(e)||isNumberObject(e)||isSymbolObject(e)||isBigIntObject(e)}function isArgumentsObject(t){return isObjectLike(t)&&t[Symbol.toStringTag]===void 0&&e.call(t)===`[object Arguments]`}function isModuleNamespaceObject(e){return isObjectLike(e)&&e[Symbol.toStringTag]===`Module`}function isProxy(e){return!1}function isCryptoKey(t){return isObjectLike(t)&&e.call(t)===`[object CryptoKey]`}function isKeyObject(e){return!1}const m={isAnyArrayBuffer,isArrayBuffer,isArrayBufferView,isArgumentsObject,isAsyncFunction,isBigInt64Array,isBigUint64Array,isBigIntObject,isBooleanObject,isBoxedPrimitive,isCryptoKey,isDataView,isDate,isFloat32Array,isFloat64Array,isGeneratorFunction,isGeneratorObject,isInt8Array,isInt16Array,isInt32Array,isKeyObject,isMap,isMapIterator,isModuleNamespaceObject,isNativeError,isNumberObject,isPromise,isProxy,isRegExp,isSet,isSetIterator,isSharedArrayBuffer,isStringObject,isSymbolObject,isTypedArray,isUint8Array,isUint8ClampedArray,isUint16Array,isUint32Array,isWeakMap,isWeakSet};export{m as default,isAnyArrayBuffer,isArgumentsObject,isArrayBuffer,isArrayBufferView,isAsyncFunction,isBigInt64Array,isBigIntObject,isBigUint64Array,isBooleanObject,isBoxedPrimitive,isCryptoKey,isDataView,isDate,isFloat32Array,isFloat64Array,isGeneratorFunction,isGeneratorObject,isInt16Array,isInt32Array,isInt8Array,isKeyObject,isMap,isMapIterator,isModuleNamespaceObject,isNativeError,isNumberObject,isPromise,isProxy,isRegExp,isSet,isSetIterator,isSharedArrayBuffer,isStringObject,isSymbolObject,isTypedArray,isUint16Array,isUint32Array,isUint8Array,isUint8ClampedArray,isWeakMap,isWeakSet};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -71,6 +71,19 @@ export declare const TextEncoder: {
|
|
|
71
71
|
};
|
|
72
72
|
export declare function isDeepStrictEqual(a: unknown, b: unknown): boolean;
|
|
73
73
|
export declare function toUSVString(string: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Returns a Promise that resolves once `signal` aborts. The optional
|
|
76
|
+
* `resource` argument is accepted for Node compatibility — Node uses it
|
|
77
|
+
* for experimental "resource cleanup" tracking; we ignore it (no-op),
|
|
78
|
+
* which matches the observable behavior of `util.aborted()` for the
|
|
79
|
+
* documented use case.
|
|
80
|
+
*
|
|
81
|
+
* Reference: https://nodejs.org/api/util.html#utilabortedsignal-resource
|
|
82
|
+
*
|
|
83
|
+
* @param signal An `AbortSignal` to wait on.
|
|
84
|
+
* @param resource Any non-null object — accepted for Node parity.
|
|
85
|
+
*/
|
|
86
|
+
export declare function aborted(signal: AbortSignal, resource: object): Promise<void>;
|
|
74
87
|
declare const _default: {
|
|
75
88
|
format: typeof format;
|
|
76
89
|
formatWithOptions: typeof formatWithOptions;
|
|
@@ -100,6 +113,7 @@ declare const _default: {
|
|
|
100
113
|
isBuffer: typeof isBuffer;
|
|
101
114
|
isDeepStrictEqual: typeof isDeepStrictEqual;
|
|
102
115
|
toUSVString: typeof toUSVString;
|
|
116
|
+
aborted: typeof aborted;
|
|
103
117
|
TextDecoder: {
|
|
104
118
|
new (label?: string, options?: TextDecoderOptions): TextDecoder;
|
|
105
119
|
prototype: TextDecoder;
|
package/package.json
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"name": "@gjsify/util",
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "Node.js util module for Gjs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "lib/esm/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/esm/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./types": {
|
|
14
|
+
"types": "./lib/types/types.d.ts",
|
|
15
|
+
"default": "./lib/esm/types.js"
|
|
16
|
+
}
|
|
12
17
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
|
|
23
|
+
"check": "tsc --noEmit",
|
|
24
|
+
"build": "gjsify run build:gjsify && gjsify run build:types",
|
|
25
|
+
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
26
|
+
"build:types": "tsc",
|
|
27
|
+
"build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
|
|
28
|
+
"build:test:gjs": "gjsify build src/test.ts --app gjs --no-minify --outfile test.gjs.mjs",
|
|
29
|
+
"build:test:node": "gjsify build src/test.ts --app node --no-minify --outfile test.node.mjs",
|
|
30
|
+
"test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
|
|
31
|
+
"test:gjs": "gjsify run test.gjs.mjs",
|
|
32
|
+
"test:node": "node test.node.mjs"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"gjs",
|
|
36
|
+
"node",
|
|
37
|
+
"util"
|
|
38
|
+
],
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@gjsify/cli": "workspace:^",
|
|
41
|
+
"@gjsify/unit": "workspace:^",
|
|
42
|
+
"@types/inherits": "^2.0.0",
|
|
43
|
+
"@types/node": "^25.6.2",
|
|
44
|
+
"typescript": "^6.0.3"
|
|
16
45
|
}
|
|
17
|
-
|
|
18
|
-
"scripts": {
|
|
19
|
-
"clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
|
|
20
|
-
"check": "tsc --noEmit",
|
|
21
|
-
"build": "yarn build:gjsify && yarn build:types",
|
|
22
|
-
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
23
|
-
"build:types": "tsc",
|
|
24
|
-
"build:test": "yarn build:test:gjs && yarn build:test:node",
|
|
25
|
-
"build:test:gjs": "gjsify build src/test.ts --app gjs --no-minify --outfile test.gjs.mjs",
|
|
26
|
-
"build:test:node": "gjsify build src/test.ts --app node --no-minify --outfile test.node.mjs",
|
|
27
|
-
"test": "yarn build:gjsify && yarn build:test && yarn test:node && yarn test:gjs",
|
|
28
|
-
"test:gjs": "gjsify run test.gjs.mjs",
|
|
29
|
-
"test:node": "node test.node.mjs"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [
|
|
32
|
-
"gjs",
|
|
33
|
-
"node",
|
|
34
|
-
"util"
|
|
35
|
-
],
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@gjsify/cli": "^0.3.21",
|
|
38
|
-
"@gjsify/unit": "^0.3.21",
|
|
39
|
-
"@types/inherits": "^2.0.0",
|
|
40
|
-
"@types/node": "^25.6.2",
|
|
41
|
-
"typescript": "^6.0.3"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
46
|
+
}
|
package/src/errors.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// Reference: Node.js lib/internal/errors.js — system error name mapping (Linux errno codes)
|
|
2
|
-
// Reimplemented for GJS
|
|
3
|
-
|
|
4
|
-
const linuxErrors: Record<number, string> = {
|
|
5
|
-
[-1]: 'EPERM', [-2]: 'ENOENT', [-3]: 'ESRCH', [-4]: 'EINTR',
|
|
6
|
-
[-5]: 'EIO', [-6]: 'ENXIO', [-7]: 'E2BIG', [-8]: 'ENOEXEC',
|
|
7
|
-
[-9]: 'EBADF', [-10]: 'ECHILD', [-11]: 'EAGAIN', [-12]: 'ENOMEM',
|
|
8
|
-
[-13]: 'EACCES', [-14]: 'EFAULT', [-15]: 'ENOTBLK', [-16]: 'EBUSY',
|
|
9
|
-
[-17]: 'EEXIST', [-18]: 'EXDEV', [-19]: 'ENODEV', [-20]: 'ENOTDIR',
|
|
10
|
-
[-21]: 'EISDIR', [-22]: 'EINVAL', [-23]: 'ENFILE', [-24]: 'EMFILE',
|
|
11
|
-
[-25]: 'ENOTTY', [-26]: 'ETXTBSY', [-27]: 'EFBIG', [-28]: 'ENOSPC',
|
|
12
|
-
[-29]: 'ESPIPE', [-30]: 'EROFS', [-31]: 'EMLINK', [-32]: 'EPIPE',
|
|
13
|
-
[-33]: 'EDOM', [-34]: 'ERANGE', [-35]: 'EDEADLK', [-36]: 'ENAMETOOLONG',
|
|
14
|
-
[-37]: 'ENOLCK', [-38]: 'ENOSYS', [-39]: 'ENOTEMPTY', [-40]: 'ELOOP',
|
|
15
|
-
[-42]: 'ENOMSG', [-43]: 'EIDRM', [-44]: 'ECHRNG', [-45]: 'EL2NSYNC',
|
|
16
|
-
[-46]: 'EL3HLT', [-47]: 'EL3RST', [-48]: 'ELNRNG', [-49]: 'EUNATCH',
|
|
17
|
-
[-50]: 'ENOCSI', [-51]: 'EL2HLT', [-52]: 'EBADE', [-53]: 'EBADR',
|
|
18
|
-
[-54]: 'EXFULL', [-55]: 'ENOANO', [-56]: 'EBADRQC', [-57]: 'EBADSLT',
|
|
19
|
-
[-59]: 'EBFONT', [-60]: 'ENOSTR', [-61]: 'ENODATA', [-62]: 'ETIME',
|
|
20
|
-
[-63]: 'ENOSR', [-64]: 'ENONET', [-65]: 'ENOPKG', [-66]: 'EREMOTE',
|
|
21
|
-
[-67]: 'ENOLINK', [-68]: 'EADV', [-69]: 'ESRMNT', [-70]: 'ECOMM',
|
|
22
|
-
[-71]: 'EPROTO', [-72]: 'EMULTIHOP', [-73]: 'EDOTDOT', [-74]: 'EBADMSG',
|
|
23
|
-
[-75]: 'EOVERFLOW', [-76]: 'ENOTUNIQ', [-77]: 'EBADFD', [-78]: 'EREMCHG',
|
|
24
|
-
[-79]: 'ELIBACC', [-80]: 'ELIBBAD', [-81]: 'ELIBSCN', [-82]: 'ELIBMAX',
|
|
25
|
-
[-83]: 'ELIBEXEC', [-84]: 'EILSEQ', [-85]: 'ERESTART', [-86]: 'ESTRPIPE',
|
|
26
|
-
[-87]: 'EUSERS', [-88]: 'ENOTSOCK', [-89]: 'EDESTADDRREQ', [-90]: 'EMSGSIZE',
|
|
27
|
-
[-91]: 'EPROTOTYPE', [-92]: 'ENOPROTOOPT', [-93]: 'EPROTONOSUPPORT',
|
|
28
|
-
[-94]: 'ESOCKTNOSUPPORT', [-95]: 'ENOTSUP', [-96]: 'EPFNOSUPPORT',
|
|
29
|
-
[-97]: 'EAFNOSUPPORT', [-98]: 'EADDRINUSE', [-99]: 'EADDRNOTAVAIL',
|
|
30
|
-
[-100]: 'ENETDOWN', [-101]: 'ENETUNREACH', [-102]: 'ENETRESET',
|
|
31
|
-
[-103]: 'ECONNABORTED', [-104]: 'ECONNRESET', [-105]: 'ENOBUFS',
|
|
32
|
-
[-106]: 'EISCONN', [-107]: 'ENOTCONN', [-108]: 'ESHUTDOWN',
|
|
33
|
-
[-109]: 'ETOOMANYREFS', [-110]: 'ETIMEDOUT', [-111]: 'ECONNREFUSED',
|
|
34
|
-
[-112]: 'EHOSTDOWN', [-113]: 'EHOSTUNREACH', [-114]: 'EALREADY',
|
|
35
|
-
[-115]: 'EINPROGRESS', [-116]: 'ESTALE', [-117]: 'EUCLEAN',
|
|
36
|
-
[-118]: 'ENOTNAM', [-119]: 'ENAVAIL', [-120]: 'EISNAM',
|
|
37
|
-
[-121]: 'EREMOTEIO', [-122]: 'EDQUOT', [-123]: 'ENOMEDIUM',
|
|
38
|
-
[-124]: 'EMEDIUMTYPE', [-125]: 'ECANCELED', [-126]: 'ENOKEY',
|
|
39
|
-
[-127]: 'EKEYEXPIRED', [-128]: 'EKEYREVOKED', [-129]: 'EKEYREJECTED',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const darwinErrors: Record<number, string> = {
|
|
43
|
-
[-1]: 'EPERM', [-2]: 'ENOENT', [-3]: 'ESRCH', [-4]: 'EINTR',
|
|
44
|
-
[-5]: 'EIO', [-6]: 'ENXIO', [-7]: 'E2BIG', [-8]: 'ENOEXEC',
|
|
45
|
-
[-9]: 'EBADF', [-10]: 'ECHILD', [-11]: 'EDEADLK', [-12]: 'ENOMEM',
|
|
46
|
-
[-13]: 'EACCES', [-14]: 'EFAULT', [-15]: 'ENOTBLK', [-16]: 'EBUSY',
|
|
47
|
-
[-17]: 'EEXIST', [-18]: 'EXDEV', [-19]: 'ENODEV', [-20]: 'ENOTDIR',
|
|
48
|
-
[-21]: 'EISDIR', [-22]: 'EINVAL', [-23]: 'ENFILE', [-24]: 'EMFILE',
|
|
49
|
-
[-25]: 'ENOTTY', [-26]: 'ETXTBSY', [-27]: 'EFBIG', [-28]: 'ENOSPC',
|
|
50
|
-
[-29]: 'ESPIPE', [-30]: 'EROFS', [-31]: 'EMLINK', [-32]: 'EPIPE',
|
|
51
|
-
[-33]: 'EDOM', [-34]: 'ERANGE', [-35]: 'EAGAIN', [-36]: 'EINPROGRESS',
|
|
52
|
-
[-37]: 'EALREADY', [-38]: 'ENOTSOCK', [-39]: 'EDESTADDRREQ',
|
|
53
|
-
[-40]: 'EMSGSIZE', [-41]: 'EPROTOTYPE', [-42]: 'ENOPROTOOPT',
|
|
54
|
-
[-43]: 'EPROTONOSUPPORT', [-44]: 'ESOCKTNOSUPPORT', [-45]: 'ENOTSUP',
|
|
55
|
-
[-46]: 'EPFNOSUPPORT', [-47]: 'EAFNOSUPPORT', [-48]: 'EADDRINUSE',
|
|
56
|
-
[-49]: 'EADDRNOTAVAIL', [-50]: 'ENETDOWN', [-51]: 'ENETUNREACH',
|
|
57
|
-
[-52]: 'ENETRESET', [-53]: 'ECONNABORTED', [-54]: 'ECONNRESET',
|
|
58
|
-
[-55]: 'ENOBUFS', [-56]: 'EISCONN', [-57]: 'ENOTCONN',
|
|
59
|
-
[-58]: 'ESHUTDOWN', [-59]: 'ETOOMANYREFS', [-60]: 'ETIMEDOUT',
|
|
60
|
-
[-61]: 'ECONNREFUSED', [-62]: 'ELOOP', [-63]: 'ENAMETOOLONG',
|
|
61
|
-
[-64]: 'EHOSTDOWN', [-65]: 'EHOSTUNREACH', [-66]: 'ENOTEMPTY',
|
|
62
|
-
[-67]: 'EPROCLIM', [-68]: 'EUSERS', [-69]: 'EDQUOT', [-70]: 'ESTALE',
|
|
63
|
-
[-71]: 'EREMOTE', [-72]: 'EBADRPC', [-73]: 'ERPCMISMATCH',
|
|
64
|
-
[-74]: 'EPROGUNAVAIL', [-75]: 'EPROGMISMATCH', [-76]: 'EPROCUNAVAIL',
|
|
65
|
-
[-77]: 'ENOLCK', [-78]: 'ENOSYS', [-79]: 'EFTYPE', [-80]: 'EAUTH',
|
|
66
|
-
[-81]: 'ENEEDAUTH', [-82]: 'EPWROFF', [-83]: 'EDEVERR',
|
|
67
|
-
[-84]: 'EOVERFLOW', [-85]: 'EBADEXEC', [-86]: 'EBADARCH',
|
|
68
|
-
[-87]: 'ESHLIBVERS', [-88]: 'EBADMACHO', [-89]: 'ECANCELED',
|
|
69
|
-
[-90]: 'EIDRM', [-91]: 'ENOMSG', [-92]: 'EILSEQ', [-93]: 'ENOATTR',
|
|
70
|
-
[-94]: 'EBADMSG', [-95]: 'EMULTIHOP', [-96]: 'ENODATA',
|
|
71
|
-
[-97]: 'ENOLINK', [-98]: 'ENOSR', [-99]: 'ENOSTR', [-100]: 'EPROTO',
|
|
72
|
-
[-101]: 'ETIME', [-102]: 'EOPNOTSUPP',
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
function getPlatform(): string {
|
|
76
|
-
if (typeof globalThis.process?.platform === 'string') return globalThis.process.platform;
|
|
77
|
-
return 'linux';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function getSystemErrorName(err: number): string {
|
|
81
|
-
if (typeof err !== 'number') {
|
|
82
|
-
throw new TypeError('The "err" argument must be of type number. Received type ' + typeof err);
|
|
83
|
-
}
|
|
84
|
-
if (err >= 0) {
|
|
85
|
-
throw new RangeError(`The value of "err" is out of range. It must be a negative integer. Received ${err}`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const platform = getPlatform();
|
|
89
|
-
const map = platform === 'darwin' ? darwinErrors : linuxErrors;
|
|
90
|
-
return map[err] || `Unknown system error ${err}`;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function getSystemErrorMap(): Map<number, [string, string]> {
|
|
94
|
-
const platform = getPlatform();
|
|
95
|
-
const map = platform === 'darwin' ? darwinErrors : linuxErrors;
|
|
96
|
-
const result = new Map<number, [string, string]>();
|
|
97
|
-
for (const [key, name] of Object.entries(map)) {
|
|
98
|
-
result.set(Number(key), [name, '']);
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
}
|