@visulima/pail 4.0.2 → 4.1.1
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/CHANGELOG.md +23 -0
- package/LICENSE.md +346 -0
- package/README.md +17 -0
- package/dist/error.d.ts +69 -69
- package/dist/index.browser.d.ts +446 -445
- package/dist/index.browser.js +17 -17
- package/dist/index.server.d.ts +582 -582
- package/dist/index.server.js +27 -27
- package/dist/middleware/elysia.d.ts +44 -42
- package/dist/middleware/elysia.js +1 -1
- package/dist/middleware/express.d.ts +58 -59
- package/dist/middleware/express.js +1 -1
- package/dist/middleware/fastify.d.ts +55 -56
- package/dist/middleware/fastify.js +1 -1
- package/dist/middleware/hono.d.ts +56 -57
- package/dist/middleware/hono.js +1 -1
- package/dist/middleware/next/handler.d.ts +67 -68
- package/dist/middleware/next/handler.js +1 -1
- package/dist/middleware/sveltekit.d.ts +72 -73
- package/dist/middleware/sveltekit.js +1 -1
- package/dist/object-tree.d.ts +44 -44
- package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
- package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
- package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
- package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
- package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
- package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
- package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
- package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
- package/dist/packem_shared/headers-DI58djdG.js +1 -0
- package/dist/packem_shared/index-CbkPnylC.js +1 -0
- package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
- package/dist/packem_shared/storage-DVcJumyk.js +1 -0
- package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
- package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
- package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
- package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
- package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
- package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
- package/dist/processor/caller/caller-processor.d.ts +32 -33
- package/dist/processor/environment-processor.d.ts +83 -84
- package/dist/processor/message-formatter-processor.d.ts +40 -45
- package/dist/processor/message-formatter-processor.js +1 -1
- package/dist/processor/opentelemetry-processor.d.ts +51 -52
- package/dist/processor/redact-processor.d.ts +57 -65
- package/dist/processor/sampling-processor.d.ts +90 -91
- package/dist/reporter/file/json-file-reporter.d.ts +77 -78
- package/dist/reporter/file/json-file-reporter.js +1 -1
- package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
- package/dist/reporter/http/abstract-http-reporter.js +2 -2
- package/dist/reporter/http/http-reporter.d.ts +33 -34
- package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
- package/dist/reporter/http/http-reporter.edge-light.js +2 -2
- package/dist/reporter/json/index.browser.d.ts +62 -61
- package/dist/reporter/json/index.browser.js +1 -1
- package/dist/reporter/json/index.d.ts +36 -37
- package/dist/reporter/json/index.js +1 -1
- package/dist/reporter/pretty/index.browser.d.ts +57 -56
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +133 -133
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
- package/dist/reporter/simple/simple-reporter.server.js +7 -7
- package/dist/wide-event.d.ts +2 -3
- package/dist/wide-event.js +1 -1
- package/package.json +58 -37
- package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
- package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
- package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
- package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
- package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
- package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
- package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
- package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
- package/dist/packem_shared/index-Q1764hvO.js +0 -1
- package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
- package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
- package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
- package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
- package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
- package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
- package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
package/dist/index.server.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
${e}`,
|
|
3
|
-
${L}`,
|
|
4
|
-
${L}`);const
|
|
5
|
-
${j}`),p.pop(),`[${
|
|
6
|
-
${L}`,
|
|
7
|
-
${L}${
|
|
8
|
-
${j}`),p.pop(),`{${
|
|
9
|
-
${L}`,
|
|
10
|
-
${L}`);const
|
|
11
|
-
${b}`),p.pop(),`[${
|
|
12
|
-
${L}`,j=" ");let E="";for(const
|
|
13
|
-
${L}${
|
|
14
|
-
${b}`),p.pop(),`{${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
${L}`,p.pop(),`[${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${L}`),p.pop(),`{${j}}`}case"number":return isFinite(n)?String(n):h?h(n):"null";case"boolean":return n===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(n);default:return h?h(n):void 0}}function Y(N,n,p){switch(typeof n){case"string":return o(n);case"object":{if(n===null)return"null";if(typeof n.toJSON=="function"){if(n=n.toJSON(N),typeof n!="object")return Y(N,n,p);if(n===null)return"null"}if(p.indexOf(n)!==-1)return u;let v="";const x=n.length!==void 0;if(x&&Array.isArray(n)){if(n.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(n);const j=Math.min(n.length,k);let E=0;for(;E<j-1;E++){const T=Y(String(E),n[E],p);v+=T!==void 0?T:"null",v+=","}const _=Y(String(E),n[E],p);if(v+=_!==void 0?_:"null",n.length-1>k){const T=n.length-k-1;v+=`,"... ${$(T)} not stringified"`}return p.pop(),`[${v}]`}let L=Object.keys(n);const b=L.length;if(b===0)return"{}";if(B<p.length+1)return'"[Object]"';let S="",O=Math.min(b,k);x&&g(n)&&(v+=m(n,",",k),L=L.slice(n.length),O-=n.length,S=","),A&&(L=l(L,M)),p.push(n);for(let j=0;j<O;j++){const E=L[j],_=Y(E,n[E],p);_!==void 0&&(v+=`${S}${o(E)}:${_}`,S=",")}if(b>k){const j=b-k;v+=`${S}"...":"${$(j)} not stringified"`}return p.pop(),`{${v}}`}case"number":return isFinite(n)?String(n):h?h(n):"null";case"boolean":return n===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(n);default:return h?h(n):void 0}}function De(N,n,p){if(arguments.length>1){let v="";if(typeof p=="number"?v=" ".repeat(Math.min(p,10)):typeof p=="string"&&(v=p.slice(0,10)),n!=null){if(typeof n=="function")return Q("",{"":N},[],n,v,"");if(Array.isArray(n))return X("",N,[],D(n),v,"")}if(v.length!==0)return z("",N,[],v,"")}return Y("",N,[])}return De}})(te,te.exports)),te.exports}var vt=St();class $t{#r=new Map;#t;constructor(e){this.#t=e}count(e="default"){const t=this.#r.get(e)??0;this.#r.set(e,t+1),this.#t("log",!1,!1,{message:`${e}: ${String(t+1)}`,prefix:e})}countReset(e="default"){this.#r.has(e)?this.#r.delete(e):this.#t("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}}const Lt=new Set(["alert","critical","emergency","error"]),Tt=r=>{const e=console;return Lt.has(r)?e.__error??console.error:r==="warning"?e.__warn??console.warn:r==="trace"?e.__trace??console.trace:e.__log??console.log};class kt{log(e){const{context:t=[],message:s,type:i}=e;Tt(i.level)(s,...t)}}class Et{#r=new Map;#t=new Set;#e;#i;#s;constructor(e,t,s){this.#s=e,this.#e=t,this.#i=s}time(e="default"){this.#t.has(e)?this.#s("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.#t.add(e),this.#r.set(e,Date.now()),this.#s("start",!1,!1,{message:this.#e,prefix:e}))}timeLog(e,...t){if(!e&&this.#t.size>0&&(e=[...this.#t].pop()),e&&this.#r.has(e)){const s=Date.now()-this.#r.get(e);this.#s("info",!1,!1,{context:t,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.#s("warn",!1,!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.#t.size>0&&(e=[...this.#t].pop()),e&&this.#r.has(e)){const t=Date.now()-this.#r.get(e);this.#r.delete(e),this.#s("stop",!1,!1,{message:`${this.#i} ${t<1e3?`${String(t)} ms`:`${(t/1e3).toFixed(2)} s`}`,prefix:e})}else this.#s("warn",!1,!1,{message:"Timer not found",prefix:e})}}const ye=r=>r===void 0?[]:Array.isArray(r)?r:[r],we=(r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},Mt=r=>{let e=!1;return function(...t){if(!e){e=!0;try{const s=r.apply(this,t);return e=!1,s}catch(s){throw e=!1,s}}}};class Le{timerManager;counterManager;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};#r=new Set;#t;#e;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const t=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,o=e.parentLogLevels;this.stringify=i??vt.configure({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&t?(this.types=s,this.longestLabel=t):(this.types=we(We,e.types??{}),this.longestLabel=ie(this.types)),this.logLevels=o&&!e.logLevels?o:{...Ue,...e.logLevels},this.generalLogLevel=this.#n(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=ye(e.scope).filter(Boolean),this.timerManager=new Et((l,a,g,...m)=>{this.logger(l,a,g,...m)},this.startTimerMessage,this.endTimerMessage),this.counterManager=new $t((l,a,g,...m)=>{this.logger(l,a,g,...m)}),this.groups=[],this.lastLog={},this.logger=Mt(this.logger.bind(this)),this.#i(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new kt),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#i(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){this.#t||this.#e||(this.#t=e=>{this.error(e)},this.#e=e=>{this.error(e)},process.on("uncaughtException",this.#t),process.on("unhandledRejection",this.#e))}restoreException(){this.#t&&(process.off("uncaughtException",this.#t),this.#t=void 0),this.#e&&(process.off("unhandledRejection",this.#e),this.#e=void 0)}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let t=0;t<e.length;t+=1){const{messageObject:s,raw:i,type:o}=e[t];this.logger(o,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}unscope(){this.scopeName=[]}child(e){const t=e?.types!==void 0,s=t?we(this.types,e.types):this.types,i=e?.reporters??[],o=i.length>0?[...this.reporters,...i]:[...this.reporters],l=e?.processors??[],a=l.length>0?[...this.processors,...l]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let m;if(e?.scope){const w=ye(e.scope).filter(Boolean);m=this.scopeName.length>0?[...this.scopeName,...w]:w}else m=this.scopeName.length>0?this.scopeName:[];const y=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},c={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:y,processors:a,rawReporter:e?.rawReporter??this.rawReporter,reporters:o,scope:m,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return t?(c.parentTypes=s,c.parentLongestLabel=ie(s)):(c.parentTypes=this.types,c.parentLongestLabel=this.longestLabel),e?.logLevels||(c.parentLogLevels=this.logLevels),e?.messages||(c.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),c.parentStringify=this.stringify,new Le(c)}time(e="default"){this.timerManager.time(e)}timeLog(e,...t){this.timerManager.timeLog(e,...t)}timeEnd(e){this.timerManager.timeEnd(e)}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){this.counterManager.count(e)}countReset(e="default"){this.counterManager.countReset(e)}clear(){console.clear()}raw(e,...t){this.disabled||this.logger("log",!0,!1,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let t=0;t<e.length;t+=1)this.reporters.add(this.extendReporter(e[t]))}registerProcessors(e){for(let t=0;t<e.length;t+=1){const s=e[t];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#s(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#n(e){let t="debug";return e!==void 0&&Object.hasOwn(this.logLevels,e)?t=e:e!==void 0&&!this.#r.has(e)&&(this.#r.add(e),console.warn(`[pail] Unknown log level "${String(e)}". Valid levels: ${Object.keys(this.logLevels).join(", ")}. Falling back to "debug".`)),t}#o(e,t,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:$e,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:t.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:o,message:l,prefix:a,suffix:g}=s[0];if(o&&(i.context=o),a&&(i.prefix=a),g&&(i.suffix=g),i.message=l,s.length>1){const m=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...m]:[i.context,...m]:i.context=m}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return t.logLevel==="trace"&&(i.traceError=new Error("Trace")),t.badge&&(i.badge=t.badge),t.label&&(i.label=t.label),i}logger(e,t,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:t,type:e});return}const o=this.types[e],l=this.#n(o.logLevel);if(s||this.logLevels[l]>=this.logLevels[this.generalLogLevel]){let a=this.#o(e,o,...i),g;try{g=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{g=void 0}const m=this.processors.size>0,y=(d=!1)=>{const $=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&$>0){const D={...this.lastLog.object};$>1&&(D.repeated=$),this.#s(D,t),this.lastLog.count=1}if(d){for(const D of this.processors)a=D.process(a);if(a.dropped===!0)return;if(this.lastLog.object=a,m)try{this.lastLog.signature=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{this.lastLog.signature=void 0}else this.lastLog.signature=g;this.#s(a,t)}};clearTimeout(this.lastLog.timeout);const c=a.date instanceof Date?a.date:new Date(a.date),w=this.lastLog.time?c.getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=c,w<this.throttle)try{const d=g;if(this.lastLog.object&&d!==void 0&&d===this.lastLog.signature&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(y,this.throttle);return}}catch{}y(!0)}}}let Ot=class{#r;#t;#e;#i=!1;#s;constructor(e={}){this.#r=Se,this.#t=ve,this.#s=e}setStdout(e){this.#r=e}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#i=e}log(e){const{context:t,groups:s,message:i,type:o}=e,l=[];if(i!==$e){const y=typeof i=="string"?i:oe(i,this.#s);l.push(y)}t&&l.push(...t.map(y=>typeof y=="object"?` ${oe(y,this.#s)}`:` ${String(y)}`));const a=Ie(o.level)?"stderr":"stdout",g=a==="stderr"?this.#t:this.#r,m=s.map(()=>" ").join("");this.#i&&this.#e!==void 0&&g.isTTY?this.#e.update(a,(m+l.join("")).split(`
|
|
21
|
-
`),0):Ne(m+l.join(""),g)}};class Te extends Le{constructor(e){const t=e.parentStderr,s=e.parentStdout,{interactive:i,processors:o,rawReporter:l,reporters:a,stderr:g,stdout:m}=e,y=t??g,c=s??m,w=e.parentLongestLabel,d=e.parentTypes,{parentLogLevels:$,parentMessages:D,parentStringify:J}=e,R={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},f="types"in e;d&&w&&!f?(R.parentTypes=d,R.parentLongestLabel=w):f&&e.types!==void 0&&(R.types=e.types),J&&(R.parentStringify=J),$&&!e.logLevels&&(R.parentLogLevels=$),D&&!e.messages&&(R.parentMessages=D),super(R),this.options=e,this.interactive=i??!1,this.stdout=c,this.stderr=y,this.interactive&&(this.interactiveManager=new Je(new ke(this.stdout),new ke(this.stderr))),Array.isArray(a)&&this.registerReporters(a),this.rawReporter=this.extendReporter(l??new Ot),Array.isArray(o)&&this.registerProcessors(o)}options;stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}child(e){const t=e?.types!==void 0,s=t?we(this.types,e.types):this.types,i=e?.reporters??[],o=i.length>0?[...this.reporters,...i]:[...this.reporters],l=e?.processors??[],a=l.length>0?[...this.processors,...l]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let m;if(e?.scope){const w=ye(e.scope).filter(Boolean);m=this.scopeName.length>0?[...this.scopeName,...w]:w}else m=this.scopeName.length>0?this.scopeName:[];const y=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},c={disabled:e?.disabled??this.disabled,interactive:e?.interactive??this.interactive,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:y,processors:a,rawReporter:e?.rawReporter??this.rawReporter,reporters:o,scope:m,stderr:e?.stderr??this.stderr,stdout:e?.stdout??this.stdout,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return this.#r(c,e,t,s),new Te(c)}#r(e,t,s,i){s?(e.parentTypes=i,e.parentLongestLabel=ie(i)):(e.parentTypes=this.types,e.parentLongestLabel=this.longestLabel),t?.logLevels||(e.parentLogLevels=this.logLevels),t?.messages||(e.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),e.parentStringify=this.stringify,t?.stdout||(e.parentStdout=this.stdout),t?.stderr||(e.parentStderr=this.stderr)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#t(this.stdout,"log"),this.#t(this.stderr,"error")}restoreStd(){this.#e(this.stdout),this.#e(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(Me),this.stderr.write(Me)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#t(e,t){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[t](String(s).trim())})}#e(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const jt=Te;let ue;const At=()=>(ue!==void 0||(ue=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]])),ue),_t=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,Bt=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,It=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,Nt=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,xe=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),je=/\s+/,ae=r=>{const e=At();e.has(r)&&(r=e.get(r));const t=_t.exec(r);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const s=Bt.exec(r);if(s)return[Number.parseInt(`${s[1]}${s[1]}`,16),Number.parseInt(`${s[2]}${s[2]}`,16),Number.parseInt(`${s[3]}${s[3]}`,16)];const i=It.exec(r);if(i)return[Math.round(Math.max(0,Math.min(255,Number(i[1])))),Math.round(Math.max(0,Math.min(255,Number(i[2])))),Math.round(Math.max(0,Math.min(255,Number(i[3]))))];const o=Nt.exec(r);if(o){let l=Number(o[1])%360;l<0&&(l+=360);const a=Math.max(0,Math.min(100,Number(o[2])))/100,g=Math.max(0,Math.min(100,Number(o[3])))/100,m=(1-Math.abs(2*g-1))*a,y=m*(1-Math.abs(l/60%2-1)),c=g-m/2;let w,d,$;return l<60?{0:w,1:d,2:$}=[m,y,0]:l<120?{0:w,1:d,2:$}=[y,m,0]:l<180?{0:w,1:d,2:$}=[0,m,y]:l<240?{0:w,1:d,2:$}=[0,y,m]:l<300?{0:w,1:d,2:$}=[y,0,m]:{0:w,1:d,2:$}=[m,0,y],[Math.round((w+c)*255),Math.round((d+c)*255),Math.round(($+c)*255)]}return null},ge=(r,e)=>r?.[0]===e?.[0]&&r?.[1]===e?.[1]&&r?.[2]===e?.[2],Pt=r=>{if(typeof r!="string")return xe();const e=xe(),t=[];let s=!1,i=null,o=0,l="";for(const a of r){if(a==="(")o+=1;else if(o>0)a===")"&&(o-=1);else if(s){if(a===";"){const g=l.trim();g!==""&&t.push([i,g]),i=null,l="",s=!1;continue}}else if(a===":"){i=l.trim(),l="",s=!0;continue}l+=a}if(s&&o===0){const a=l.trim();a!==""&&t.push([i,a]),i=null,l=""}for(const{0:a,1:g}of t)switch(a){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const m=g.split(je);for(const y of m){const c=ae(y);c!=null?e.textDecorationColor=c:["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y)}break}case"text-decoration-color":{const m=ae(g);m!=null&&(e.textDecorationColor=m);break}case"text-decoration-line":{e.textDecorationLine=[];const m=g.split(je);for(const y of m)["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y);break}}return e},Rt=(r,e)=>{e=e??xe();let t="";if(!ge(r.backgroundColor,e.backgroundColor))if(r.backgroundColor==null)t+="\x1B[49m";else switch(r.backgroundColor){case"black":{t+="\x1B[40m";break}case"blue":{t+="\x1B[44m";break}case"cyan":{t+="\x1B[46m";break}case"green":{t+="\x1B[42m";break}case"magenta":{t+="\x1B[45m";break}case"red":{t+="\x1B[41m";break}case"white":{t+="\x1B[47m";break}case"yellow":{t+="\x1B[43m";break}default:if(Array.isArray(r.backgroundColor)){const{0:s,1:i,2:o}=r.backgroundColor;t+=`\x1B[48;2;${String(s)};${String(i)};${String(o)}m`}else{const s=ae(r.backgroundColor);if(s===null)t+="\x1B[49m";else{const{0:i,1:o,2:l}=s;t+=`\x1B[48;2;${String(i)};${String(o)};${String(l)}m`}}}if(!ge(r.color,e.color))if(r.color==null)t+="\x1B[39m";else switch(r.color){case"black":{t+="\x1B[30m";break}case"blue":{t+="\x1B[34m";break}case"cyan":{t+="\x1B[36m";break}case"green":{t+="\x1B[32m";break}case"magenta":{t+="\x1B[35m";break}case"red":{t+="\x1B[31m";break}case"white":{t+="\x1B[37m";break}case"yellow":{t+="\x1B[33m";break}default:if(Array.isArray(r.color)){const{0:s,1:i,2:o}=r.color;t+=`\x1B[38;2;${String(s)};${String(i)};${String(o)}m`}else{const s=ae(r.color);if(s===null)t+="\x1B[39m";else{const{0:i,1:o,2:l}=s;t+=`\x1B[38;2;${String(i)};${String(o)};${String(l)}m`}}}if(r.fontWeight!==e.fontWeight&&(t+=r.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),r.fontStyle!==e.fontStyle&&(t+=r.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!ge(r.textDecorationColor,e.textDecorationColor))if(r.textDecorationColor==null)t+="\x1B[59m";else{const{0:s,1:i,2:o}=r.textDecorationColor;t+=`\x1B[58;2;${String(s)};${String(i)};${String(o)}m`}return r.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(t+=r.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),r.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(t+=r.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),r.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(t+=r.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t},Ct=r=>{try{return JSON.stringify(r)}catch{return'"[Circular]"'}},Ae="%".codePointAt(0),Dt="s".codePointAt(0),Gt="d".codePointAt(0),Ft="f".codePointAt(0),qt="i".codePointAt(0),Vt="O".codePointAt(0),Jt="o".codePointAt(0),Ut="j".codePointAt(0),Wt="c".codePointAt(0),_e=(r,e=[],t={})=>{if(typeof r!="string"&&typeof r!="object"||r===null)throw new TypeError(`fmt must be a string or object, got ${r===null?"null":typeof r}`);const s=t.stringify??Ct,i=1;if(typeof r=="object"){const c=e.length+i;if(c===1)return"{}";const w=Array.from({length:c});w[0]=s(r);for(let d=1;d<c;d+=1)w[d]=s(e[d-i]);return w.join(" ")}if(e.length===0)return r;let o="",l=1-i,a=-1,g=!1,m;const y=t.colors??globalThis.window===void 0;for(let c=0;c<r.length;){if(r.codePointAt(c)===Ae&&c+1<r.length){a=a>-1?a:0;const w=r.codePointAt(c+1);switch(w){case Wt:{if(y){const d=Pt(e[l]);a<c&&(o+=r.slice(a,c));const $=Rt(d,m);o+=$,$!==""&&(g=!0,m=d)}a=c+2,c+=1;break}case Gt:case Ft:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(o+=r.slice(a,c)),o+=(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case qt:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(o+=r.slice(a,c)),o+=Math.floor(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case Ut:case Vt:case Jt:{if(l>=e.length||e[l]===void 0)break;a<c&&(o+=r.slice(a,c));const d=e[l],$=typeof d;if($==="string"){o+=`'${d}'`,a=c+2,c+=1;break}if($==="function"){o+=d.name?`[Function: ${d.name}]`:"[Function: <anonymous>]",a=c+2,c+=1;break}o+=s(d),a=c+2,c+=1;break}case Ae:{a<c&&(o+=r.slice(a,c)),o+="%",a=c+2,c+=1,l-=1;break}case Dt:{if(l>=e.length)break;a<c&&(o+=r.slice(a,c));const d=e[l];o+=typeof d=="object"&&d!==null?s(d):String(d),a=c+2,c+=1;break}default:typeof t.formatters?.[w]=="function"?(a<c&&(o+=r.slice(a,c)),o+=t.formatters[w](e[l]),a=c+2,c+=1):l-=1}l+=1}c+=1}if(a===-1&&!(t.appendExtraArguments&&l<e.length))return r;if(a===-1?o=r:a<r.length&&(o+=r.slice(a)),a!==-1&&g&&(o+="\x1B[0m"),t.appendExtraArguments&&l<e.length)for(let c=Math.max(l,0);c<e.length;c+=1){const w=e[c];o+=` ${typeof w=="object"&&w!==null?s(w):String(w)}`}return o},zt=(r={})=>{const e={};typeof r.formatters=="object"&&Object.entries(r.formatters).forEach(([s,i])=>{if(s.length===0)throw new Error(`Formatter %${s} has no characters`);if(s.length>1)throw new Error(`Formatter %${s} has more than one character`);if(typeof i!="function")throw new TypeError(`Formatter for %${s} is not a function`);const o=s.codePointAt(0);if(o===void 0)throw new Error(`${s}.codePointAt(0) failed to return a value, please report this issue`);e[o]=i});const t=Object.freeze({formatters:e});return(s,i=[],o)=>o===void 0?_e(s,i,t):_e(s,i,{...o,formatters:e})};class Yt{#r;#t;#e;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#r=e}process(e){this.#e===void 0&&(this.#e=zt({formatters:this.#t}));const t=this.#e;return e.message!==void 0&&(e.message=this.#i(t,e.message,e.context??[])),e}#i(e,t,s=[]){if(typeof t=="string")return e(t,s);if(typeof t=="object"&&t!==null){const i=t,o=Object.keys(i);for(let l=0;l<o.length;l+=1){const a=o[l],g=i[a];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[a]=this.#i(e,g,s))}}return t}}const{bgGrey:Ht,cyan:Qt,green:Xt,greenBright:Kt,grey:F,red:de,underline:Be,white:Zt}=Pe,er=/[\\/]pail[\\/]dist/,pe=r=>!er.test(r);class tr extends ze{#r;#t;#e;#i=!1;#s;#n;#o;#a=!1;#l="";#c="";constructor(e={}){const{error:t,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#s={...Ye,...s},this.#n={...t,color:{fileLine:Xt,hint:Qt,marker:de,message:de,method:Kt,title:de}},this.#r=Se,this.#t=ve,this.#f()}setLoggerTypes(e){super.setLoggerTypes(e),this.#f()}setStdout(e){this.#r=e,this.#o=void 0,this.#a=!1}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#i=e}log(e){this._log(this._formatMessage(e),e.type.level)}#f(){this.#l=He(this.loggerTypes),this.#c=ie(this.loggerTypes)}#h(){return!this.#a&&typeof this.#r.on=="function"&&(this.#a=!0,this.#r.on("resize",()=>{this.#o=void 0})),this.#o===void 0&&(this.#o=Qe().columns),this.#o}_formatMessage(e){let t=this.#h();typeof this.styles.messageLength=="number"&&(t=this.styles.messageLength);const{badge:s,context:i,date:o,error:l,file:a,groups:g,label:m,message:y,prefix:c,repeated:w,scope:d,suffix:$,traceError:D,type:J}=e,{color:R}=this.loggerTypes[J.name],f=R?Pe[R]:Zt,h=g.map(()=>" ").join(""),u=[];if(g.length>0&&u.push(`${h+F(`[${g.at(-1)??""}]`)} `),o&&u.push(`${F(this.styles.dateFormatter(typeof o=="string"?new Date(o):o))} `),s)u.push(f(s));else{const M=this.#l;M.length>0&&u.push(`${F(".".repeat(M.length))} `)}const I=this.#c;if(m){const M=Z(I),B=Z(m);u.push(`${f(Xe(m,this.styles))} `,F(".".repeat(Math.max(0,M-B))))}else u.push(F(".".repeat(I.length+2)));w&&u.push(`${Ht.white(`[${String(w)}x]`)} `),Array.isArray(d)&&d.length>0&&u.push(` ${F(`[${d.join(" > ")}]`)} `),c&&u.push(`${F(`${Array.isArray(d)&&d.length>0?". ":" "}[${this.styles.underline.prefix?Be(c):c}]`)} `);const A=Z(u.join(" "));if(a){const M=(a.name??"")+(a.line?`:${String(a.line)}`:""),B=Z(M);if(B+A+2>t)u.push(F(` ${M}`));else{const k=Math.max(0,t-A-B-2);u.push(F(`${".".repeat(k)} ${M}`))}}else u.push(F(".".repeat(Math.max(0,t-A-1))));if(u.length>0&&u.push(`
|
|
1
|
+
import{createRequire as ir}from"node:module";import{InteractiveManager as qe,InteractiveStreamHook as ve}from"@visulima/interactive-manager";import{g as de,E as Ve,a as xe,L as Je,Y as se,r as Ie,b as Ne,A as Ue,c as Ye,d as We,e as ze,f as K,h as He,V as Qe,G as ne,S as Xe}from"./packem_shared/abstract-pretty-reporter-CyfTvmKf.js";import Pe from"@visulima/colorize";import{PailError as pr,createPailError as mr}from"./packem_shared/PailError-CbU1Ogfa.js";const Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const{stdout:ye,stderr:we,env:z}=Fe,Ke="\x1B",pe="\x1B[",Ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=Ze,et=(r,e,t,s)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),n=Object.getOwnPropertyDescriptor(e,t);!tt(i,n)&&s||Object.defineProperty(r,t,n)},tt=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},rt=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},st=(r,e)=>`/* Wrapped ${r}*/
|
|
2
|
+
${e}`,it=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ot=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),nt=(r,e,t)=>{const s=t===""?"":`with ${t.trim()}() `,i=st.bind(null,s,e.toString());Object.defineProperty(i,"name",ot);const{writable:n,enumerable:l,configurable:a}=it;Object.defineProperty(r,"toString",{value:i,writable:n,enumerable:l,configurable:a})};function at(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:s}=r;for(const i of Reflect.ownKeys(e))et(r,e,i,t);return rt(r,e),nt(r,e,s),r}const ie=new WeakMap,Ce=(r,e={})=>{if(typeof r!="function")throw new TypeError("Expected a function");let t,s=0;const i=r.displayName||r.name||"<anonymous>",n=function(...l){if(ie.set(n,++s),s===1)t=r.apply(this,l),r=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t};return at(n,r),ie.set(n,s),n};Ce.callCount=r=>{if(!ie.has(r))throw new Error(`The given function \`${r.name}\` is not wrapped by the \`onetime\` package`);return ie.get(r)};const U=[];U.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&U.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&U.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const te=r=>!!r&&!0&&typeof r.removeListener=="function"&&typeof r.emit=="function"&&typeof r.reallyExit=="function"&&typeof r.listeners=="function"&&typeof r.kill=="function"&&typeof r.pid=="number"&&typeof r.on=="function",ae=Symbol.for("signal-exit emitter"),le=globalThis,lt=Object.defineProperty.bind(Object);class ct{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(le[ae])return le[ae];lt(le,ae,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const s=this.listeners[e],i=s.indexOf(t);i!==-1&&(i===0&&s.length===1?s.length=0:s.splice(i,1))}emit(e,t,s){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(const n of this.listeners[e])i=n(t,s)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,s)||i),i}}let Re=class{};const ft=r=>({onExit(e,t){return r.onExit(e,t)},load(){return r.load()},unload(){return r.unload()}});let ut=class extends Re{onExit(){return()=>{}}load(){}unload(){}},ht=class extends Re{#r=me.platform==="win32"?"SIGINT":"SIGHUP";#e=new ct;#t;#i;#s;#n={};#o=!1;constructor(e){super(),this.#t=e,this.#n={};for(const t of U)this.#n[t]=()=>{const s=this.#t.listeners(t);let{count:i}=this.#e;const n=e;if(typeof n.__signal_exit_emitter__=="object"&&typeof n.__signal_exit_emitter__.count=="number"&&(i+=n.__signal_exit_emitter__.count),s.length===i){this.unload();const l=this.#e.emit("exit",null,t),a=t==="SIGHUP"?this.#r:t;l||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#i=e.emit}onExit(e,t){if(!te(this.#t))return()=>{};this.#o===!1&&this.load();const s=t?.alwaysLast?"afterExit":"exit";return this.#e.on(s,e),()=>{this.#e.removeListener(s,e),this.#e.listeners.exit.length===0&&this.#e.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#e.count+=1;for(const e of U)try{const t=this.#n[e];t&&this.#t.on(e,t)}catch{}this.#t.emit=(e,...t)=>this.#l(e,...t),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,U.forEach(e=>{const t=this.#n[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,t)}catch{}}),this.#t.emit=this.#i,this.#t.reallyExit=this.#s,this.#e.count-=1)}#a(e){return te(this.#t)?(this.#t.exitCode=e||0,this.#e.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#l(e,...t){const s=this.#i;if(e==="exit"&&te(this.#t)){typeof t[0]=="number"&&(this.#t.exitCode=t[0]);const i=s.call(this.#t,e,...t);return this.#e.emit("exit",this.#t.exitCode,null),i}else return s.call(this.#t,e,...t)}};const me=globalThis.process,{onExit:gt}=ft(te(me)?new ht(me):new ut),Le=Z.stderr.isTTY?Z.stderr:Z.stdout.isTTY?Z.stdout:void 0;Le&&Ce(()=>{gt(()=>{Le.write("\x1B[?25h")},{alwaysLast:!0})});const dt=typeof globalThis<"u"&&typeof globalThis.window=="object"&&globalThis.window.document!==void 0,pt=/^(?:msys|cygwin)$/,De=process,ke=De?.env??{},mt=!dt&&(De?.platform==="win32"||ke.OSTYPE!==void 0&&pt.test(ke.OSTYPE));var bt=(r=>(r[r.Default=0]="Default",r[r.BlinkingBlock=1]="BlinkingBlock",r[r.SteadyBlock=2]="SteadyBlock",r[r.BlinkingUnderline=3]="BlinkingUnderline",r[r.SteadyUnderline=4]="SteadyUnderline",r[r.BlinkingBar=5]="BlinkingBar",r[r.SteadyBar=6]="SteadyBar",r))(bt||{}),re=(r=>(r[r.ToEnd=0]="ToEnd",r[r.ToBeginning=1]="ToBeginning",r[r.EntireScreen=2]="EntireScreen",r[r.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",r))(re||{});const ce=r=>{const e=r>=0&&r<=3?r:0;return`${pe}${e===0?"":String(e)}J`};var yt=(r=>(r[r.ToEnd=0]="ToEnd",r[r.ToBeginning=1]="ToBeginning",r[r.EntireLine=2]="EntireLine",r))(yt||{});const Te=mt?`${ce(re.EntireScreen)}${pe}0f`:`${ce(re.EntireScreen)}${ce(re.EntireScreenAndScrollback)}${pe}H${Ke}c`;var ee={exports:{}},Ee;function wt(){return Ee||(Ee=1,(function(r,e){const{hasOwnProperty:t}=Object.prototype,s=C();s.configure=C,s.stringify=s,s.default=s,e.stringify=s,e.configure=C,r.exports=s;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function n(f){return f.length<5e3&&!i.test(f)?`"${f}"`:JSON.stringify(f)}function l(f,u){if(f.length>200||u)return f.sort(u);for(let h=1;h<f.length;h++){const I=f[h];let _=h;for(;_!==0&&f[_-1]>I;)f[_]=f[_-1],_--;f[_]=I}return f}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function g(f){return a.call(f)!==void 0&&f.length!==0}function m(f,u,h){f.length<h&&(h=f.length);const I=u===","?"":" ";let _=`"0":${I}${f[0]}`;for(let O=1;O<h;O++)_+=`${u}"${O}":${I}${f[O]}`;return _}function y(f){if(t.call(f,"circularValue")){const u=f.circularValue;if(typeof u=="string")return`"${u}"`;if(u==null)return u;if(u===Error||u===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function c(f){let u;if(t.call(f,"deterministic")&&(u=f.deterministic,typeof u!="boolean"&&typeof u!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return u===void 0?!0:u}function S(f,u){let h;if(t.call(f,u)&&(h=f[u],typeof h!="boolean"))throw new TypeError(`The "${u}" argument must be of type boolean`);return h===void 0?!0:h}function d(f,u){let h;if(t.call(f,u)){if(h=f[u],typeof h!="number")throw new TypeError(`The "${u}" argument must be of type number`);if(!Number.isInteger(h))throw new TypeError(`The "${u}" argument must be an integer`);if(h<1)throw new RangeError(`The "${u}" argument must be >= 1`)}return h===void 0?1/0:h}function v(f){return f===1?"1 item":`${f} items`}function D(f){const u=new Set;for(const h of f)(typeof h=="string"||typeof h=="number")&&u.add(String(h));return u}function J(f){if(t.call(f,"strict")){const u=f.strict;if(typeof u!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(u)return h=>{let I=`Object can not safely be stringified. Received type ${typeof h}`;throw typeof h!="function"&&(I+=` (${h.toString()})`),new Error(I)}}}function C(f){f={...f};const u=J(f);u&&(f.bigint===void 0&&(f.bigint=!1),"circularValue"in f||(f.circularValue=Error));const h=y(f),I=S(f,"bigint"),_=c(f),O=typeof _=="function"?_:void 0,B=d(f,"maximumDepth"),T=d(f,"maximumBreadth");function H(N,o,p,$,w,L){let b=o[N];switch(typeof b=="object"&&b!==null&&typeof b.toJSON=="function"&&(b=b.toJSON(N)),b=$.call(o,N,b),typeof b){case"string":return n(b);case"object":{if(b===null)return"null";if(p.indexOf(b)!==-1)return h;let x="",M=",";const j=L;if(Array.isArray(b)){if(b.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(b),w!==""&&(L+=w,x+=`
|
|
3
|
+
${L}`,M=`,
|
|
4
|
+
${L}`);const R=Math.min(b.length,T);let q=0;for(;q<R-1;q++){const X=H(String(q),b,p,$,w,L);x+=X!==void 0?X:"null",x+=M}const V=H(String(q),b,p,$,w,L);if(x+=V!==void 0?V:"null",b.length-1>T){const X=b.length-T-1;x+=`${M}"... ${v(X)} not stringified"`}return w!==""&&(x+=`
|
|
5
|
+
${j}`),p.pop(),`[${x}]`}let E=Object.keys(b);const A=E.length;if(A===0)return"{}";if(B<p.length+1)return'"[Object]"';let k="",P="";w!==""&&(L+=w,M=`,
|
|
6
|
+
${L}`,k=" ");const G=Math.min(A,T);_&&!g(b)&&(E=l(E,O)),p.push(b);for(let R=0;R<G;R++){const q=E[R],V=H(q,b,p,$,w,L);V!==void 0&&(x+=`${P}${n(q)}:${k}${V}`,P=M)}if(A>T){const R=A-T;x+=`${P}"...":${k}"${v(R)} not stringified"`,P=M}return w!==""&&P.length>1&&(x=`
|
|
7
|
+
${L}${x}
|
|
8
|
+
${j}`),p.pop(),`{${x}}`}case"number":return isFinite(b)?String(b):u?u(b):"null";case"boolean":return b===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(b);default:return u?u(b):void 0}}function Q(N,o,p,$,w,L){switch(typeof o=="object"&&o!==null&&typeof o.toJSON=="function"&&(o=o.toJSON(N)),typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(p.indexOf(o)!==-1)return h;const b=L;let x="",M=",";if(Array.isArray(o)){if(o.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(o),w!==""&&(L+=w,x+=`
|
|
9
|
+
${L}`,M=`,
|
|
10
|
+
${L}`);const A=Math.min(o.length,T);let k=0;for(;k<A-1;k++){const G=Q(String(k),o[k],p,$,w,L);x+=G!==void 0?G:"null",x+=M}const P=Q(String(k),o[k],p,$,w,L);if(x+=P!==void 0?P:"null",o.length-1>T){const G=o.length-T-1;x+=`${M}"... ${v(G)} not stringified"`}return w!==""&&(x+=`
|
|
11
|
+
${b}`),p.pop(),`[${x}]`}p.push(o);let j="";w!==""&&(L+=w,M=`,
|
|
12
|
+
${L}`,j=" ");let E="";for(const A of $){const k=Q(A,o[A],p,$,w,L);k!==void 0&&(x+=`${E}${n(A)}:${j}${k}`,E=M)}return w!==""&&E.length>1&&(x=`
|
|
13
|
+
${L}${x}
|
|
14
|
+
${b}`),p.pop(),`{${x}}`}case"number":return isFinite(o)?String(o):u?u(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(o);default:return u?u(o):void 0}}function Y(N,o,p,$,w){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(N),typeof o!="object")return Y(N,o,p,$,w);if(o===null)return"null"}if(p.indexOf(o)!==-1)return h;const L=w;if(Array.isArray(o)){if(o.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(o),w+=$;let k=`
|
|
15
|
+
${w}`;const P=`,
|
|
16
|
+
${w}`,G=Math.min(o.length,T);let R=0;for(;R<G-1;R++){const V=Y(String(R),o[R],p,$,w);k+=V!==void 0?V:"null",k+=P}const q=Y(String(R),o[R],p,$,w);if(k+=q!==void 0?q:"null",o.length-1>T){const V=o.length-T-1;k+=`${P}"... ${v(V)} not stringified"`}return k+=`
|
|
17
|
+
${L}`,p.pop(),`[${k}]`}let b=Object.keys(o);const x=b.length;if(x===0)return"{}";if(B<p.length+1)return'"[Object]"';w+=$;const M=`,
|
|
18
|
+
${w}`;let j="",E="",A=Math.min(x,T);g(o)&&(j+=m(o,M,T),b=b.slice(o.length),A-=o.length,E=M),_&&(b=l(b,O)),p.push(o);for(let k=0;k<A;k++){const P=b[k],G=Y(P,o[P],p,$,w);G!==void 0&&(j+=`${E}${n(P)}: ${G}`,E=M)}if(x>T){const k=x-T;j+=`${E}"...": "${v(k)} not stringified"`,E=M}return E!==""&&(j=`
|
|
19
|
+
${w}${j}
|
|
20
|
+
${L}`),p.pop(),`{${j}}`}case"number":return isFinite(o)?String(o):u?u(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(o);default:return u?u(o):void 0}}function W(N,o,p){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(N),typeof o!="object")return W(N,o,p);if(o===null)return"null"}if(p.indexOf(o)!==-1)return h;let $="";const w=o.length!==void 0;if(w&&Array.isArray(o)){if(o.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(o);const j=Math.min(o.length,T);let E=0;for(;E<j-1;E++){const k=W(String(E),o[E],p);$+=k!==void 0?k:"null",$+=","}const A=W(String(E),o[E],p);if($+=A!==void 0?A:"null",o.length-1>T){const k=o.length-T-1;$+=`,"... ${v(k)} not stringified"`}return p.pop(),`[${$}]`}let L=Object.keys(o);const b=L.length;if(b===0)return"{}";if(B<p.length+1)return'"[Object]"';let x="",M=Math.min(b,T);w&&g(o)&&($+=m(o,",",T),L=L.slice(o.length),M-=o.length,x=","),_&&(L=l(L,O)),p.push(o);for(let j=0;j<M;j++){const E=L[j],A=W(E,o[E],p);A!==void 0&&($+=`${x}${n(E)}:${A}`,x=",")}if(b>T){const j=b-T;$+=`${x}"...":"${v(j)} not stringified"`}return p.pop(),`{${$}}`}case"number":return isFinite(o)?String(o):u?u(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(o);default:return u?u(o):void 0}}function Ge(N,o,p){if(arguments.length>1){let $="";if(typeof p=="number"?$=" ".repeat(Math.min(p,10)):typeof p=="string"&&($=p.slice(0,10)),o!=null){if(typeof o=="function")return H("",{"":N},[],o,$,"");if(Array.isArray(o))return Q("",N,[],D(o),$,"")}if($.length!==0)return Y("",N,[],$,"")}return W("",N,[])}return Ge}})(ee,ee.exports)),ee.exports}var xt=wt();class St{#r=new Map;#e;constructor(e){this.#e=e}count(e="default"){const t=this.#r.get(e)??0;this.#r.set(e,t+1),this.#e("log",!1,!1,{message:`${e}: ${String(t+1)}`,prefix:e})}countReset(e="default"){this.#r.has(e)?this.#r.delete(e):this.#e("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}}const $t=new Set(["alert","critical","emergency","error"]),vt=r=>{const e=console;return $t.has(r)?e.__error??console.error:r==="warning"?e.__warn??console.warn:r==="trace"?e.__trace??console.trace:e.__log??console.log};class Lt{log(e){const{context:t=[],message:s,type:i}=e;vt(i.level)(s,...t)}}class kt{#r=new Map;#e=new Set;#t;#i;#s;constructor(e,t,s){this.#s=e,this.#t=t,this.#i=s}time(e="default"){this.#e.has(e)?this.#s("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.#e.add(e),this.#r.set(e,Date.now()),this.#s("start",!1,!1,{message:this.#t,prefix:e}))}timeLog(e,...t){if(!e&&this.#e.size>0&&(e=[...this.#e].pop()),e&&this.#r.has(e)){const s=Date.now()-this.#r.get(e);this.#s("info",!1,!1,{context:t,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.#s("warn",!1,!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.#e.size>0&&(e=[...this.#e].pop()),e&&this.#r.has(e)){const t=Date.now()-this.#r.get(e);this.#r.delete(e),this.#e.delete(e),this.#s("stop",!1,!1,{message:`${this.#i} ${t<1e3?`${String(t)} ms`:`${(t/1e3).toFixed(2)} s`}`,prefix:e})}else this.#s("warn",!1,!1,{message:"Timer not found",prefix:e})}}const Oe=r=>r===void 0?[]:Array.isArray(r)?r:[r],Me=(r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},Tt=r=>{let e=!1;return function(...t){if(!e){e=!0;try{const s=r.apply(this,t);return e=!1,s}catch(s){throw e=!1,s}}}};class Se{timerManager;counterManager;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};#r=new Set;#e;#t;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const t=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,n=e.parentLogLevels;this.stringify=i??xt.configure({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&t?(this.types=s,this.longestLabel=t):(this.types=Me(Je,e.types??{}),this.longestLabel=de(this.types)),this.logLevels=n&&!e.logLevels?n:{...Ve,...e.logLevels},this.generalLogLevel=this.#n(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=Oe(e.scope).filter(Boolean),this.timerManager=new kt((l,a,g,...m)=>{this.logger(l,a,g,...m)},this.startTimerMessage,this.endTimerMessage),this.counterManager=new St((l,a,g,...m)=>{this.logger(l,a,g,...m)}),this.groups=[],this.lastLog={},this.logger=Tt(this.logger.bind(this)),this.#i(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new Lt),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#i(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)Object.hasOwn(console,`__${e}`)||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)if(Object.hasOwn(console,`__${e}`)){const t=console[`__${e}`];t===void 0?delete console[e]:console[e]=t,delete console[`__${e}`]}}wrapException(){this.#e||this.#t||(this.#e=e=>{this.error(e)},this.#t=e=>{this.error(e)},process.on("uncaughtException",this.#e),process.on("unhandledRejection",this.#t))}restoreException(){this.#e&&(process.off("uncaughtException",this.#e),this.#e=void 0),this.#t&&(process.off("unhandledRejection",this.#t),this.#t=void 0)}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let t=0;t<e.length;t+=1){const{messageObject:s,raw:i,type:n}=e[t];this.logger(n,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}unscope(){this.scopeName=[]}child(e){return new Se(this.buildChildOptions(e))}time(e="default"){this.timerManager.time(e)}timeLog(e,...t){this.timerManager.timeLog(e,...t)}timeEnd(e){this.timerManager.timeEnd(e)}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){this.counterManager.count(e)}countReset(e="default"){this.counterManager.countReset(e)}clear(){console.clear()}raw(e,...t){this.disabled||this.logger("log",!0,!1,{context:t,message:e})}buildChildOptions(e){const t=e?.types!==void 0,s=t?Me(this.types,e.types):this.types,i=e?.reporters??[],n=i.length>0?[...this.reporters,...i]:[...this.reporters],l=e?.processors??[],a=l.length>0?[...this.processors,...l]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let m;if(e?.scope){const S=Oe(e.scope).filter(Boolean);m=this.scopeName.length>0?[...this.scopeName,...S]:S}else m=this.scopeName.length>0?this.scopeName:[];const y=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},c={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:y,processors:a,rawReporter:e?.rawReporter??this.rawReporter,reporters:n,scope:m,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return t?(c.parentTypes=s,c.parentLongestLabel=de(s)):(c.parentTypes=this.types,c.parentLongestLabel=this.longestLabel),e?.logLevels||(c.parentLogLevels=this.logLevels),e?.messages||(c.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),c.parentStringify=this.stringify,c}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let t=0;t<e.length;t+=1)this.reporters.add(this.extendReporter(e[t]))}registerProcessors(e){for(let t=0;t<e.length;t+=1){const s=e[t];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#s(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#n(e){let t="debug";return e!==void 0&&Object.hasOwn(this.logLevels,e)?t=e:e!==void 0&&!this.#r.has(e)&&(this.#r.add(e),console.warn(`[pail] Unknown log level "${String(e)}". Valid levels: ${Object.keys(this.logLevels).join(", ")}. Falling back to "debug".`)),t}#o(e,t,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:xe,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:t.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:n,message:l,prefix:a,suffix:g}=s[0];if(n&&(i.context=n),a&&(i.prefix=a),g&&(i.suffix=g),i.message=l,s.length>1){const m=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...m]:[i.context,...m]:i.context=m}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return t.logLevel==="trace"&&(i.traceError=new Error("Trace")),t.badge&&(i.badge=t.badge),t.label&&(i.label=t.label),i}logger(e,t,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:t,type:e});return}const n=this.types[e],l=this.#n(n.logLevel);if(s||this.logLevels[l]>=this.logLevels[this.generalLogLevel]){let a=this.#o(e,n,...i),g;try{g=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{g=void 0}const m=this.processors.size>0,y=(d=!1)=>{const v=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&v>0){const D={...this.lastLog.object};v>1&&(D.repeated=v),this.#s(D,t),this.lastLog.count=1}if(d){for(const D of this.processors)a=D.process(a);if(a.dropped===!0)return;if(this.lastLog.object=a,m)try{this.lastLog.signature=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{this.lastLog.signature=void 0}else this.lastLog.signature=g;this.#s(a,t)}};clearTimeout(this.lastLog.timeout);const c=a.date instanceof Date?a.date:new Date(a.date),S=this.lastLog.time?c.getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=c,S<this.throttle)try{const d=g;if(this.lastLog.object&&d!==void 0&&d===this.lastLog.signature&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(y,this.throttle);return}}catch{}y(!0)}}}let Et=class{#r;#e;#t;#i=!1;#s;constructor(e={}){this.#r=ye,this.#e=we,this.#s=e}setStdout(e){this.#r=e}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#i=e}log(e){const{context:t,groups:s,message:i,type:n}=e,l=[];if(i!==xe){const y=typeof i=="string"?i:se(i,this.#s);l.push(y)}t&&l.push(...t.map(y=>typeof y=="object"?` ${se(y,this.#s)}`:` ${String(y)}`));const a=Ie(n.level)?"stderr":"stdout",g=a==="stderr"?this.#e:this.#r,m=s.map(()=>" ").join("");this.#i&&this.#t!==void 0&&g.isTTY?this.#t.update(a,(m+l.join("")).split(`
|
|
21
|
+
`),0):Ne(m+l.join(""),g)}};class $e extends Se{constructor(e){const t=e.parentStderr,s=e.parentStdout,{interactive:i,processors:n,rawReporter:l,reporters:a,stderr:g,stdout:m}=e,y=t??g,c=s??m,S=e.parentLongestLabel,d=e.parentTypes,{parentLogLevels:v,parentMessages:D,parentStringify:J}=e,C={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},f="types"in e;d&&S&&!f?(C.parentTypes=d,C.parentLongestLabel=S):f&&e.types!==void 0&&(C.types=e.types),J&&(C.parentStringify=J),v&&!e.logLevels&&(C.parentLogLevels=v),D&&!e.messages&&(C.parentMessages=D),super(C),this.options=e,this.interactive=i??!1,this.stdout=c,this.stderr=y,this.interactive&&this.stdout&&this.stderr&&(this.interactiveManager=new qe(new ve(this.stdout),new ve(this.stderr))),Array.isArray(a)&&this.registerReporters(a),this.rawReporter=this.extendReporter(l??new Et),Array.isArray(n)&&this.registerProcessors(n)}options;stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}child(e){const t=this.buildChildOptions(e);return t.interactive=e?.interactive??this.interactive,t.stderr=e?.stderr??this.stderr,t.stdout=e?.stdout??this.stdout,e?.stdout||(t.parentStdout=this.stdout),e?.stderr||(t.parentStderr=this.stderr),new $e(t)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#r(this.stdout,"log"),this.#r(this.stderr,"error")}restoreStd(){this.#e(this.stdout),this.#e(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout?.write(Te),this.stderr?.write(Te)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#r(e,t){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[t](String(s).trim())})}#e(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const Ot=$e;let fe;const Mt=()=>(fe!==void 0||(fe=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]])),fe),jt=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,_t=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,At=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,Bt=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,be=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),je=/\s+/,oe=r=>{const e=Mt();e.has(r)&&(r=e.get(r));const t=jt.exec(r);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const s=_t.exec(r);if(s)return[Number.parseInt(`${s[1]}${s[1]}`,16),Number.parseInt(`${s[2]}${s[2]}`,16),Number.parseInt(`${s[3]}${s[3]}`,16)];const i=At.exec(r);if(i)return[Math.round(Math.max(0,Math.min(255,Number(i[1])))),Math.round(Math.max(0,Math.min(255,Number(i[2])))),Math.round(Math.max(0,Math.min(255,Number(i[3]))))];const n=Bt.exec(r);if(n){let l=Number(n[1])%360;l<0&&(l+=360);const a=Math.max(0,Math.min(100,Number(n[2])))/100,g=Math.max(0,Math.min(100,Number(n[3])))/100,m=(1-Math.abs(2*g-1))*a,y=m*(1-Math.abs(l/60%2-1)),c=g-m/2;let S,d,v;return l<60?{0:S,1:d,2:v}=[m,y,0]:l<120?{0:S,1:d,2:v}=[y,m,0]:l<180?{0:S,1:d,2:v}=[0,m,y]:l<240?{0:S,1:d,2:v}=[0,y,m]:l<300?{0:S,1:d,2:v}=[y,0,m]:{0:S,1:d,2:v}=[m,0,y],[Math.round((S+c)*255),Math.round((d+c)*255),Math.round((v+c)*255)]}return null},ue=(r,e)=>typeof r=="string"||typeof e=="string"?r===e:r?.[0]===e?.[0]&&r?.[1]===e?.[1]&&r?.[2]===e?.[2],It=r=>{if(typeof r!="string")return be();const e=be(),t=[];let s=!1,i=null,n=0,l="";for(const a of r){if(a==="(")n+=1;else if(n>0)a===")"&&(n-=1);else if(s){if(a===";"){const g=l.trim();g!==""&&t.push([i,g]),i=null,l="",s=!1;continue}}else if(a===":"){i=l.trim(),l="",s=!0;continue}l+=a}if(s&&n===0){const a=l.trim();a!==""&&t.push([i,a]),i=null,l=""}for(const{0:a,1:g}of t)switch(a){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const m=g.split(je);for(const y of m){const c=oe(y);c!=null?e.textDecorationColor=c:["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y)}break}case"text-decoration-color":{const m=oe(g);m!=null&&(e.textDecorationColor=m);break}case"text-decoration-line":{e.textDecorationLine=[];const m=g.split(je);for(const y of m)["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y);break}}return e},Nt=(r,e)=>{e=e??be();let t="";if(!ue(r.backgroundColor,e.backgroundColor))if(r.backgroundColor==null)t+="\x1B[49m";else switch(r.backgroundColor){case"black":{t+="\x1B[40m";break}case"blue":{t+="\x1B[44m";break}case"cyan":{t+="\x1B[46m";break}case"green":{t+="\x1B[42m";break}case"magenta":{t+="\x1B[45m";break}case"red":{t+="\x1B[41m";break}case"white":{t+="\x1B[47m";break}case"yellow":{t+="\x1B[43m";break}default:if(Array.isArray(r.backgroundColor)){const{0:s,1:i,2:n}=r.backgroundColor;t+=`\x1B[48;2;${String(s)};${String(i)};${String(n)}m`}else{const s=oe(r.backgroundColor);if(s===null)t+="\x1B[49m";else{const{0:i,1:n,2:l}=s;t+=`\x1B[48;2;${String(i)};${String(n)};${String(l)}m`}}}if(!ue(r.color,e.color))if(r.color==null)t+="\x1B[39m";else switch(r.color){case"black":{t+="\x1B[30m";break}case"blue":{t+="\x1B[34m";break}case"cyan":{t+="\x1B[36m";break}case"green":{t+="\x1B[32m";break}case"magenta":{t+="\x1B[35m";break}case"red":{t+="\x1B[31m";break}case"white":{t+="\x1B[37m";break}case"yellow":{t+="\x1B[33m";break}default:if(Array.isArray(r.color)){const{0:s,1:i,2:n}=r.color;t+=`\x1B[38;2;${String(s)};${String(i)};${String(n)}m`}else{const s=oe(r.color);if(s===null)t+="\x1B[39m";else{const{0:i,1:n,2:l}=s;t+=`\x1B[38;2;${String(i)};${String(n)};${String(l)}m`}}}if(r.fontWeight!==e.fontWeight&&(t+=r.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),r.fontStyle!==e.fontStyle&&(t+=r.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!ue(r.textDecorationColor,e.textDecorationColor))if(r.textDecorationColor==null)t+="\x1B[59m";else{const{0:s,1:i,2:n}=r.textDecorationColor;t+=`\x1B[58;2;${String(s)};${String(i)};${String(n)}m`}return r.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(t+=r.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),r.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(t+=r.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),r.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(t+=r.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t},Pt=r=>{try{return JSON.stringify(r)}catch{return'"[Circular]"'}},_e="%".codePointAt(0),Ct="s".codePointAt(0),Rt="d".codePointAt(0),Dt="f".codePointAt(0),Gt="i".codePointAt(0),Ft="O".codePointAt(0),qt="o".codePointAt(0),Vt="j".codePointAt(0),Jt="c".codePointAt(0),Ae=(r,e=[],t={})=>{if(typeof r!="string"&&typeof r!="object"||r===null)throw new TypeError(`fmt must be a string or object, got ${r===null?"null":typeof r}`);const s=t.stringify??Pt,i=1;if(typeof r=="object"){const c=e.length+i;if(c===1)return"{}";const S=Array.from({length:c});S[0]=s(r);for(let d=1;d<c;d+=1)S[d]=s(e[d-i]);return S.join(" ")}if(e.length===0)return r;let n="",l=1-i,a=-1,g=!1,m;const y=t.colors??globalThis.window===void 0;for(let c=0;c<r.length;){if(r.codePointAt(c)===_e&&c+1<r.length){a=a>-1?a:0;const S=r.codePointAt(c+1);switch(S){case Jt:{if(a<c&&(n+=r.slice(a,c)),y){const d=It(e[l]),v=Nt(d,m);n+=v,v!==""&&(g=!0,m=d)}a=c+2,c+=1;break}case Rt:case Dt:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(n+=r.slice(a,c)),n+=(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case Gt:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(n+=r.slice(a,c)),n+=Math.floor(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case Vt:case Ft:case qt:{if(l>=e.length||e[l]===void 0)break;a<c&&(n+=r.slice(a,c));const d=e[l],v=typeof d;if(v==="string"){n+=`'${d}'`,a=c+2,c+=1;break}if(v==="function"){n+=d.name?`[Function: ${d.name}]`:"[Function: <anonymous>]",a=c+2,c+=1;break}n+=s(d),a=c+2,c+=1;break}case _e:{a<c&&(n+=r.slice(a,c)),n+="%",a=c+2,c+=1,l-=1;break}case Ct:{if(l>=e.length)break;a<c&&(n+=r.slice(a,c));const d=e[l];n+=typeof d=="object"&&d!==null?s(d):String(d),a=c+2,c+=1;break}default:typeof t.formatters?.[S]=="function"?(a<c&&(n+=r.slice(a,c)),n+=t.formatters[S](e[l]),a=c+2,c+=1):l-=1}l+=1}c+=1}if(a===-1&&!(t.appendExtraArguments&&l<e.length))return r;if(a===-1?n=r:a<r.length&&(n+=r.slice(a)),a!==-1&&g&&(n+="\x1B[0m"),t.appendExtraArguments&&l<e.length)for(let c=Math.max(l,0);c<e.length;c+=1){const S=e[c];n+=` ${typeof S=="object"&&S!==null?s(S):String(S)}`}return n},Ut=(r={})=>{const e={};typeof r.formatters=="object"&&Object.entries(r.formatters).forEach(([i,n])=>{if(i.length===0)throw new Error(`Formatter %${i} has no characters`);if(i.length>1)throw new Error(`Formatter %${i} has more than one character`);if(typeof n!="function")throw new TypeError(`Formatter for %${i} is not a function`);const l=i.codePointAt(0);if(l===void 0)throw new Error(`${i}.codePointAt(0) failed to return a value, please report this issue`);e[l]=n});const t={...r};delete t.formatters;const s=Object.freeze({...t,formatters:e});return(i,n=[],l)=>l===void 0?Ae(i,n,s):Ae(i,n,{...t,...l,formatters:e})},Yt='"[Circular]"';class Wt{#r;#e;#t;constructor(e={}){this.#e=e.formatters}setStringify(e){this.#r=e}process(e){this.#t===void 0&&(this.#t=Ut({formatters:this.#e,stringify:s=>this.#i(s)}));const t=this.#t;return e.message!==void 0&&(e.message=this.#s(t,e.message,e.context??[])),e}#i(e){if(this.#r===void 0)try{return JSON.stringify(e)}catch{return Yt}try{return this.#r(e)}catch(t){return JSON.stringify(`[unserializable: ${t instanceof Error?t.message:String(t)}]`)}}#s(e,t,s=[]){if(typeof t=="string")return e(t,s);if(typeof t=="object"&&t!==null){const i=t,n=Object.keys(i);for(let l=0;l<n.length;l+=1){const a=n[l],g=i[a];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[a]=this.#s(e,g,s))}}return t}}const{bgGrey:zt,cyan:Ht,green:Qt,greenBright:Xt,grey:F,red:he,underline:Be,white:Kt}=Pe,Zt=/[\\/]pail[\\/]dist/,ge=r=>!Zt.test(r);class er extends Ue{#r;#e;#t;#i=!1;#s;#n;#o;#a=!1;#l="";#c="";constructor(e={}){const{error:t,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#s={...Ye,...s},this.#n={...t,color:{fileLine:Qt,hint:Ht,marker:he,message:he,method:Xt,title:he}},this.#r=ye,this.#e=we,this.#f()}setLoggerTypes(e){super.setLoggerTypes(e),this.#f()}setStdout(e){this.#r=e,this.#o=void 0,this.#a=!1}setStderr(e){this.#e=e}setInteractiveManager(e){this.#t=e}setIsInteractive(e){this.#i=e}log(e){this._log(this._formatMessage(e),e.type.level)}#f(){this.#l=We(this.loggerTypes),this.#c=de(this.loggerTypes)}#u(){return!this.#a&&typeof this.#r.on=="function"&&(this.#a=!0,this.#r.on("resize",()=>{this.#o=void 0})),this.#o===void 0&&(this.#o=ze().columns),this.#o}_formatMessage(e){let t=this.#u();typeof this.styles.messageLength=="number"&&(t=this.styles.messageLength);const{badge:s,context:i,date:n,error:l,file:a,groups:g,label:m,message:y,prefix:c,repeated:S,scope:d,suffix:v,traceError:D,type:J}=e,{color:C}=this.loggerTypes[J.name],f=C?Pe[C]:Kt,u=g.map(()=>" ").join(""),h=[];if(g.length>0&&h.push(`${u+F(`[${g.at(-1)??""}]`)} `),n&&h.push(`${F(this.styles.dateFormatter(typeof n=="string"?new Date(n):n))} `),s)h.push(f(s));else{const O=this.#l;O.length>0&&h.push(`${F(".".repeat(O.length))} `)}const I=this.#c;if(m){const O=K(I),B=K(m);h.push(`${f(He(m,this.styles))} `,F(".".repeat(Math.max(0,O-B))))}else h.push(F(".".repeat(I.length+2)));S&&h.push(`${zt.white(`[${String(S)}x]`)} `),Array.isArray(d)&&d.length>0&&h.push(` ${F(`[${d.join(" > ")}]`)} `),c&&h.push(`${F(`${Array.isArray(d)&&d.length>0?". ":" "}[${this.styles.underline.prefix?Be(c):c}]`)} `);const _=K(h.join(" "));if(a){const O=(a.name??"")+(a.line?`:${String(a.line)}`:""),B=K(O);if(B+_+2>t)h.push(F(` ${O}`));else{const T=Math.max(0,t-_-B-2);h.push(F(`${".".repeat(T)} ${O}`))}}else h.push(F(".".repeat(Math.max(0,t-_-1))));if(h.length>0&&h.push(`
|
|
22
22
|
|
|
23
|
-
`),y
|
|
23
|
+
`),y!==xe){const O=typeof y=="string"?y:se(y,this.#s);h.push(u+Qe(O,{trim:!1,width:t-3,wrapMode:Xe.STRICT_WIDTH}))}if(i){let O=!1;h.push(...i.map(B=>{if(B instanceof Error)return O=!0,`
|
|
24
24
|
|
|
25
|
-
${
|
|
25
|
+
${ne(B,{...this.#n,filterStacktrace:ge,prefix:u})}`;if(typeof B=="object")return` ${se(B,this.#s)}`;const T=(O?`
|
|
26
26
|
|
|
27
|
-
`:" ")+String(B);return
|
|
27
|
+
`:" ")+String(B);return O=!1,T}))}return l&&h.push(ne(l,{...this.#n,filterStacktrace:ge,prefix:u})),D&&h.push(`
|
|
28
28
|
|
|
29
|
-
${
|
|
30
|
-
`,
|
|
29
|
+
${ne(D,{...this.#n,filterStacktrace:ge,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:u})}`),v&&h.push(`
|
|
30
|
+
`,u+F(this.styles.underline.suffix?Be(v):v)),h.join("")}_log(e,t){const s=Ie(t)?"stderr":"stdout",i=s==="stderr"?this.#e:this.#r;this.#i&&this.#t!==void 0&&i.isTTY?this.#t.update(s,e.split(`
|
|
31
31
|
`),0):Ne(`${e}
|
|
32
|
-
`,i)}}const
|
|
32
|
+
`,i)}}const tr=()=>z.NODE_ENV==="debug"||z.DEBUG!==void 0?"debug":z.NODE_ENV==="test"?"warning":"informational",rr=r=>{let e=tr();return z.PAIL_LOG_LEVEL!==void 0&&(e=z.PAIL_LOG_LEVEL),new Ot({logLevel:e,processors:[new Wt],reporters:[new er],stderr:we,stdout:ye,...r})},hr=rr();export{pr as PailError,rr as createPail,mr as createPailError,hr as pail};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { W as WideEvent } from "../packem_shared/wide-event.d-
|
|
2
|
-
import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-
|
|
1
|
+
import { W as WideEvent } from "../packem_shared/wide-event.d-BMLastMR.js";
|
|
2
|
+
import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-BRkkBMlk.js";
|
|
3
3
|
import "../packem_shared/index.d-T71KjNAr.js";
|
|
4
|
-
import
|
|
5
|
-
import "../packem_shared/types.d-bWnqHJKL.js";
|
|
4
|
+
import "../packem_shared/types.d-4ge_rME4.js";
|
|
6
5
|
import '@visulima/colorize';
|
|
7
6
|
import '@visulima/interactive-manager';
|
|
8
7
|
/**
|
|
9
|
-
* An Elysia-like instance that supports the derive/hook registration API.
|
|
10
|
-
* Compatible with Elysia v1+.
|
|
11
|
-
*/
|
|
8
|
+
* An Elysia-like instance that supports the derive/hook registration API.
|
|
9
|
+
* Compatible with Elysia v1+.
|
|
10
|
+
*/
|
|
12
11
|
interface PailElysiaInstance {
|
|
13
12
|
derive: (options: {
|
|
14
13
|
as: string;
|
|
@@ -31,44 +30,47 @@ interface PailElysiaInstance {
|
|
|
31
30
|
}) => Promise<void>) => PailElysiaInstance;
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
|
-
* Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
|
|
35
|
-
* Must be called within a request handler where pail middleware is active.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
33
|
+
* Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
|
|
34
|
+
* Must be called within a request handler where pail middleware is active.
|
|
35
|
+
*
|
|
36
|
+
* Not available on runtimes that reject `AsyncLocalStorage.enterWith()` (workerd and
|
|
37
|
+
* other edge runtimes); use the `log` property on the handler context instead.
|
|
38
|
+
* @returns The request-scoped WideEvent logger
|
|
39
|
+
* @throws Error if called outside of the middleware context
|
|
40
|
+
*/
|
|
39
41
|
declare const useLogger: () => WideEvent;
|
|
40
42
|
/**
|
|
41
|
-
* Configuration options for the Elysia pail plugin.
|
|
42
|
-
* @template T - Custom logger type names from the pail instance
|
|
43
|
-
*/
|
|
43
|
+
* Configuration options for the Elysia pail plugin.
|
|
44
|
+
* @template T - Custom logger type names from the pail instance
|
|
45
|
+
*/
|
|
44
46
|
type ElysiaPluginOptions<T extends string = string> = PailMiddlewareOptions<T>;
|
|
45
47
|
/**
|
|
46
|
-
* Register pail wide event logging as an Elysia plugin.
|
|
47
|
-
*
|
|
48
|
-
* Injects a `log` property into handler context via `derive`, accessible via:
|
|
49
|
-
* - `context.log` in route handlers (auto-injected)
|
|
50
|
-
* - `useLogger()` from anywhere in the async call stack
|
|
51
|
-
*
|
|
52
|
-
* The wide event is automatically emitted on response or error.
|
|
53
|
-
* @param app The Elysia instance
|
|
54
|
-
* @param options Plugin configuration
|
|
55
|
-
* @returns The Elysia instance (for chaining)
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* import { Elysia } from "elysia";
|
|
59
|
-
* import { createPail } from "@visulima/pail";
|
|
60
|
-
* import { pailPlugin, useLogger } from "@visulima/pail/middleware/elysia";
|
|
61
|
-
*
|
|
62
|
-
* const logger = createPail();
|
|
63
|
-
* const app = new Elysia();
|
|
64
|
-
*
|
|
65
|
-
* pailPlugin(app, { pail: logger });
|
|
66
|
-
*
|
|
67
|
-
* app.get("/api/users", ({ log }) => {
|
|
68
|
-
* log.set({ user: { id: 1 } });
|
|
69
|
-
* return { ok: true };
|
|
70
|
-
* });
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
48
|
+
* Register pail wide event logging as an Elysia plugin.
|
|
49
|
+
*
|
|
50
|
+
* Injects a `log` property into handler context via `derive`, accessible via:
|
|
51
|
+
* - `context.log` in route handlers (auto-injected)
|
|
52
|
+
* - `useLogger()` from anywhere in the async call stack
|
|
53
|
+
*
|
|
54
|
+
* The wide event is automatically emitted on response or error.
|
|
55
|
+
* @param app The Elysia instance
|
|
56
|
+
* @param options Plugin configuration
|
|
57
|
+
* @returns The Elysia instance (for chaining)
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* import { Elysia } from "elysia";
|
|
61
|
+
* import { createPail } from "@visulima/pail";
|
|
62
|
+
* import { pailPlugin, useLogger } from "@visulima/pail/middleware/elysia";
|
|
63
|
+
*
|
|
64
|
+
* const logger = createPail();
|
|
65
|
+
* const app = new Elysia();
|
|
66
|
+
*
|
|
67
|
+
* pailPlugin(app, { pail: logger });
|
|
68
|
+
*
|
|
69
|
+
* app.get("/api/users", ({ log }) => {
|
|
70
|
+
* log.set({ user: { id: 1 } });
|
|
71
|
+
* return { ok: true };
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
73
75
|
declare const pailPlugin: <T extends string = string>(app: PailElysiaInstance, options: ElysiaPluginOptions<T>) => PailElysiaInstance;
|
|
74
76
|
export { type ElysiaPluginOptions, type PailElysiaInstance, type WideEvent, pailPlugin, useLogger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as p}from"node:module";import{e as y,c as w}from"../packem_shared/headers-DI58djdG.js";let h;const f=e=>(h??=p(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[s,n]=i.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return i.getBuiltinModule(e)}return f(e)},{AsyncLocalStorage:m}=_("node:async_hooks"),g=new m,c=new WeakSet;let d;const b=e=>{try{return g.enterWith(e),d=void 0,!0}catch(s){return d=s instanceof Error?s.message:String(s),!1}},k=()=>{const e=g.getStore();if(!e||!c.has(e))throw d!==void 0?new Error(`[pail] useLogger() is unavailable here: AsyncLocalStorage.enterWith() was rejected by this runtime with "${d}". Use the \`log\` property on the Elysia handler context instead.`):new Error("[pail] useLogger() called outside of Elysia pail plugin context.");return e},v=(e,s)=>{const n=new WeakMap,l=new WeakSet;return e.derive({as:"global"},({request:r})=>{const o=new URL(r.url),t=r.headers.get("x-request-id")??crypto.randomUUID(),u=y(r.headers),a=w(s,{headers:u,method:r.method,path:o.pathname,requestId:t});return n.set(r,a),a.skipped||(c.add(a.logger),b(a.logger)),{log:a.logger}}).onAfterHandle({as:"global"},async({request:r,set:o})=>{const t=n.get(r);!t?.skipped&&t&&!l.has(r)&&(l.add(r),t.finish({status:o.status??200}),c.delete(t.logger))}).onError({as:"global"},async({error:r,request:o})=>{const t=n.get(o);!t?.skipped&&t&&!l.has(o)&&(l.add(o),t.finish({error:r}),c.delete(t.logger))})};export{v as pailPlugin,k as useLogger};
|
|
@@ -1,89 +1,88 @@
|
|
|
1
|
-
import { W as WideEvent } from "../packem_shared/wide-event.d-
|
|
2
|
-
import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-
|
|
1
|
+
import { W as WideEvent } from "../packem_shared/wide-event.d-BMLastMR.js";
|
|
2
|
+
import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-BRkkBMlk.js";
|
|
3
3
|
import "../packem_shared/index.d-T71KjNAr.js";
|
|
4
|
-
import
|
|
5
|
-
import "../packem_shared/types.d-bWnqHJKL.js";
|
|
4
|
+
import "../packem_shared/types.d-4ge_rME4.js";
|
|
6
5
|
import '@visulima/colorize';
|
|
7
6
|
import '@visulima/interactive-manager';
|
|
8
7
|
/**
|
|
9
|
-
* An Express-like request object with the pail logger attached.
|
|
10
|
-
* Use this to type your route handlers when accessing `req.log`.
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import type { PailRequest } from "@visulima/pail/middleware/express";
|
|
14
|
-
*
|
|
15
|
-
* app.get("/api/users", (req: PailRequest, res) => {
|
|
16
|
-
* req.log?.set({ user: { id: 1 } });
|
|
17
|
-
* });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
8
|
+
* An Express-like request object with the pail logger attached.
|
|
9
|
+
* Use this to type your route handlers when accessing `req.log`.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import type { PailRequest } from "@visulima/pail/middleware/express";
|
|
13
|
+
*
|
|
14
|
+
* app.get("/api/users", (req: PailRequest, res) => {
|
|
15
|
+
* req.log?.set({ user: { id: 1 } });
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
20
19
|
interface PailRequest {
|
|
21
20
|
[key: string]: unknown;
|
|
22
21
|
headers: Record<string, string | string[] | undefined>;
|
|
23
22
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
* The request-scoped WideEvent logger, attached by pail middleware.
|
|
24
|
+
* Only present for non-excluded routes.
|
|
25
|
+
*/
|
|
27
26
|
log?: WideEvent;
|
|
28
27
|
method: string;
|
|
29
28
|
originalUrl?: string;
|
|
30
29
|
path: string;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
|
-
* An Express-like response object.
|
|
34
|
-
*/
|
|
32
|
+
* An Express-like response object.
|
|
33
|
+
*/
|
|
35
34
|
interface PailResponse {
|
|
36
35
|
[key: string]: unknown;
|
|
37
36
|
on: (event: string, listener: () => void) => void;
|
|
38
37
|
statusCode: number;
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
|
-
* Express-compatible next function.
|
|
42
|
-
*/
|
|
40
|
+
* Express-compatible next function.
|
|
41
|
+
*/
|
|
43
42
|
type PailNextFunction = (error?: unknown) => void;
|
|
44
43
|
/**
|
|
45
|
-
* The Express middleware function signature returned by `pailMiddleware()`.
|
|
46
|
-
*/
|
|
44
|
+
* The Express middleware function signature returned by `pailMiddleware()`.
|
|
45
|
+
*/
|
|
47
46
|
type PailExpressMiddleware = (request: PailRequest, response: PailResponse, next: PailNextFunction) => void;
|
|
48
47
|
/**
|
|
49
|
-
* Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
|
|
50
|
-
* Must be called within a request handled by the pail Express middleware.
|
|
51
|
-
* @returns The request-scoped WideEvent logger
|
|
52
|
-
* @throws Error if called outside of the middleware context
|
|
53
|
-
*/
|
|
48
|
+
* Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
|
|
49
|
+
* Must be called within a request handled by the pail Express middleware.
|
|
50
|
+
* @returns The request-scoped WideEvent logger
|
|
51
|
+
* @throws Error if called outside of the middleware context
|
|
52
|
+
*/
|
|
54
53
|
declare const useLogger: () => WideEvent;
|
|
55
54
|
/**
|
|
56
|
-
* Configuration options for the Express pail middleware.
|
|
57
|
-
* @template T - Custom logger type names from the pail instance
|
|
58
|
-
*/
|
|
55
|
+
* Configuration options for the Express pail middleware.
|
|
56
|
+
* @template T - Custom logger type names from the pail instance
|
|
57
|
+
*/
|
|
59
58
|
type ExpressMiddlewareOptions<T extends string = string> = PailMiddlewareOptions<T>;
|
|
60
59
|
/**
|
|
61
|
-
* Create Express middleware that attaches a WideEvent logger to each request.
|
|
62
|
-
*
|
|
63
|
-
* The logger is available via:
|
|
64
|
-
* - `req.log` on the request object
|
|
65
|
-
* - `useLogger()` from anywhere in the async call stack
|
|
66
|
-
*
|
|
67
|
-
* The wide event is automatically emitted when the response finishes.
|
|
68
|
-
* @param options Middleware configuration
|
|
69
|
-
* @returns Express middleware function
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* import express from "express";
|
|
73
|
-
* import { createPail } from "@visulima/pail";
|
|
74
|
-
* import { pailMiddleware, useLogger } from "@visulima/pail/middleware/express";
|
|
75
|
-
*
|
|
76
|
-
* const app = express();
|
|
77
|
-
* const logger = createPail();
|
|
78
|
-
*
|
|
79
|
-
* app.use(pailMiddleware({ pail: logger }));
|
|
80
|
-
*
|
|
81
|
-
* app.get("/api/users", (req, res) => {
|
|
82
|
-
* req.log.set({ user: { id: 1 } });
|
|
83
|
-
* // or: useLogger().set({ user: { id: 1 } });
|
|
84
|
-
* res.json({ ok: true });
|
|
85
|
-
* });
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
60
|
+
* Create Express middleware that attaches a WideEvent logger to each request.
|
|
61
|
+
*
|
|
62
|
+
* The logger is available via:
|
|
63
|
+
* - `req.log` on the request object
|
|
64
|
+
* - `useLogger()` from anywhere in the async call stack
|
|
65
|
+
*
|
|
66
|
+
* The wide event is automatically emitted when the response finishes.
|
|
67
|
+
* @param options Middleware configuration
|
|
68
|
+
* @returns Express middleware function
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* import express from "express";
|
|
72
|
+
* import { createPail } from "@visulima/pail";
|
|
73
|
+
* import { pailMiddleware, useLogger } from "@visulima/pail/middleware/express";
|
|
74
|
+
*
|
|
75
|
+
* const app = express();
|
|
76
|
+
* const logger = createPail();
|
|
77
|
+
*
|
|
78
|
+
* app.use(pailMiddleware({ pail: logger }));
|
|
79
|
+
*
|
|
80
|
+
* app.get("/api/users", (req, res) => {
|
|
81
|
+
* req.log.set({ user: { id: 1 } });
|
|
82
|
+
* // or: useLogger().set({ user: { id: 1 } });
|
|
83
|
+
* res.json({ ok: true });
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
88
87
|
declare const pailMiddleware: <T extends string = string>(options: ExpressMiddlewareOptions<T>) => PailExpressMiddleware;
|
|
89
88
|
export { type ExpressMiddlewareOptions, type PailExpressMiddleware, type PailNextFunction, type PailRequest, type PailResponse, type WideEvent, pailMiddleware, useLogger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as p,c as u}from"../packem_shared/headers-DI58djdG.js";import{c}from"../packem_shared/storage-DVcJumyk.js";const o=c("Express middleware context. Make sure pail middleware is registered before your route handlers."),f=()=>o.useLogger(),w=t=>(e,r,s)=>{const d=e.headers["x-request-id"]??crypto.randomUUID(),i=(e.originalUrl??e.url??"/").split("?")[0],g=p(e.headers),{finish:l,logger:a,skipped:n}=u(t,{headers:g,method:e.method,path:i,requestId:d});if(n){s();return}e.log=a,r.on("finish",()=>{l({status:r.statusCode})}),o.storage.run(a,()=>{s()})};export{w as pailMiddleware,f as useLogger};
|