@libp2p/logger 4.0.17 → 4.0.18
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/dist/index.min.js +1 -1
- package/package.json +3 -3
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PLogger = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PLogger=(()=>{var oe=Object.create;var P=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var N=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),fe=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},q=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of ie(r))!ce.call(e,s)&&s!==t&&P(e,s,{get:()=>r[s],enumerable:!(o=se(r,s))||o.enumerable});return e};var ue=(e,r,t)=>(t=e!=null?oe(ae(e)):{},q(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),de=e=>q(P({},"__esModule",{value:!0}),e);var G=N((je,V)=>{var L=1e3,M=L*60,z=M*60,U=z*24,le=U*7,pe=U*365.25;V.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return he(e);if(t==="number"&&isFinite(e))return r.long?Ce(e):be(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function he(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*pe;case"weeks":case"week":case"w":return t*le;case"days":case"day":case"d":return t*U;case"hours":case"hour":case"hrs":case"hr":case"h":return t*z;case"minutes":case"minute":case"mins":case"min":case"m":return t*M;case"seconds":case"second":case"secs":case"sec":case"s":return t*L;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function be(e){var r=Math.abs(e);return r>=U?Math.round(e/U)+"d":r>=z?Math.round(e/z)+"h":r>=M?Math.round(e/M)+"m":r>=L?Math.round(e/L)+"s":e+"ms"}function Ce(e){var r=Math.abs(e);return r>=U?$(e,r,U,"day"):r>=z?$(e,r,z,"hour"):r>=M?$(e,r,M,"minute"):r>=L?$(e,r,L,"second"):e+" ms"}function $(e,r,t,o){var s=r>=t*1.5;return Math.round(e/t)+" "+o+(s?"s":"")}});var Z=N((De,X)=>{function ge(e){t.debug=t,t.default=t,t.coerce=x,t.disable=p,t.enable=s,t.enabled=m,t.humanize=G(),t.destroy=O,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function r(n){let i=0;for(let f=0;f<n.length;f++)i=(i<<5)-i+n.charCodeAt(f),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(n){let i,f=null,S,a;function c(...d){if(!c.enabled)return;let l=c,C=Number(new Date),F=C-(i||C);l.diff=F,l.prev=i,l.curr=C,i=C,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let h=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(v,w)=>{if(v==="%%")return"%";h++;let A=t.formatters[w];if(typeof A=="function"){let k=d[h];v=A.call(l,k),d.splice(h,1),h--}return v}),t.formatArgs.call(l,d),(l.log||t.log).apply(l,d)}return c.namespace=n,c.useColors=t.useColors(),c.color=t.selectColor(n),c.extend=o,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(S!==t.namespaces&&(S=t.namespaces,a=t.enabled(n)),a),set:d=>{f=d}}),typeof t.init=="function"&&t.init(c),c}function o(n,i){let f=t(this.namespace+(typeof i>"u"?":":i)+n);return f.log=this.log,f}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,f=(typeof n=="string"?n:"").split(/[\s,]+/),S=f.length;for(i=0;i<S;i++)f[i]&&(n=f[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function p(){let n=[...t.names.map(u),...t.skips.map(u).map(i=>"-"+i)].join(",");return t.enable(""),n}function m(n){if(n[n.length-1]==="*")return!0;let i,f;for(i=0,f=t.skips.length;i<f;i++)if(t.skips[i].test(n))return!1;for(i=0,f=t.names.length;i<f;i++)if(t.names[i].test(n))return!0;return!1}function u(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function x(n){return n instanceof Error?n.stack||n.message:n}function O(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=ge});var K=N((y,I)=>{y.formatArgs=xe;y.save=we;y.load=ye;y.useColors=me;y.storage=Fe();y.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();y.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function me(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function xe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+I.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(o=t))}),e.splice(o,0,r)}y.log=console.debug||console.log||(()=>{});function we(e){try{e?y.storage.setItem("debug",e):y.storage.removeItem("debug")}catch{}}function ye(){let e;try{e=y.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Fe(){try{return localStorage}catch{}}I.exports=Z()(y);var{formatters:ve}=I.exports;ve.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var Ie={};fe(Ie,{defaultLogger:()=>ze,disable:()=>Oe,enable:()=>Pe,enabled:()=>$e,logger:()=>T,peerLogger:()=>Me,prefixLogger:()=>ne});var b=ue(K(),1);var Re=new Uint8Array(0);function Q(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function Ae(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var s=0;s<e.length;s++){var p=e.charAt(s),m=p.charCodeAt(0);if(t[m]!==255)throw new TypeError(p+" is ambiguous");t[m]=s}var u=e.length,x=e.charAt(0),O=Math.log(u)/Math.log(256),n=Math.log(256)/Math.log(u);function i(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var c=0,d=0,l=0,C=a.length;l!==C&&a[l]===0;)l++,c++;for(var F=(C-l)*n+1>>>0,h=new Uint8Array(F);l!==C;){for(var E=a[l],v=0,w=F-1;(E!==0||v<d)&&w!==-1;w--,v++)E+=256*h[w]>>>0,h[w]=E%u>>>0,E=E/u>>>0;if(E!==0)throw new Error("Non-zero carry");d=v,l++}for(var A=F-d;A!==F&&h[A]===0;)A++;for(var k=x.repeat(c);A<F;++A)k+=e.charAt(h[A]);return k}function f(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var c=0;if(a[c]!==" "){for(var d=0,l=0;a[c]===x;)d++,c++;for(var C=(a.length-c)*O+1>>>0,F=new Uint8Array(C);a[c];){var h=t[a.charCodeAt(c)];if(h===255)return;for(var E=0,v=C-1;(h!==0||E<l)&&v!==-1;v--,E++)h+=u*F[v]>>>0,F[v]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");l=E,c++}if(a[c]!==" "){for(var w=C-l;w!==C&&F[w]===0;)w++;for(var A=new Uint8Array(d+(C-w)),k=d;w!==C;)A[k++]=F[w++];return A}}}function S(a){var c=f(a);if(c)return c;throw new Error(`Non-${r} character`)}return{encode:i,decodeUnsafe:f,decode:S}}var Ee=Ae,Ue=Ee,_=Ue;var j=class{name;prefix;baseEncode;constructor(r,t,o){this.name=r,this.prefix=t,this.baseEncode=o}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},D=class{name;prefix;baseDecode;prefixCodePoint;constructor(r,t,o){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return W(this,r)}},R=class{decoders;constructor(r){this.decoders=r}or(r){return W(this,r)}decode(r){let t=r[0],o=this.decoders[t];if(o!=null)return o.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function W(e,r){return new R({...e.decoders??{[e.prefix]:e},...r.decoders??{[r.prefix]:r}})}var B=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(r,t,o,s){this.name=r,this.prefix=t,this.baseEncode=o,this.baseDecode=s,this.encoder=new j(r,t,o),this.decoder=new D(r,t,s)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};function Y({name:e,prefix:r,encode:t,decode:o}){return new B(e,r,t,o)}function J({name:e,prefix:r,alphabet:t}){let{encode:o,decode:s}=_(t,e);return Y({prefix:r,name:e,encode:o,decode:p=>Q(s(p))})}function Se(e,r,t,o){let s={};for(let n=0;n<r.length;++n)s[r[n]]=n;let p=e.length;for(;e[p-1]==="=";)--p;let m=new Uint8Array(p*t/8|0),u=0,x=0,O=0;for(let n=0;n<p;++n){let i=s[e[n]];if(i===void 0)throw new SyntaxError(`Non-${o} character`);x=x<<t|i,u+=t,u>=8&&(u-=8,m[O++]=255&x>>u)}if(u>=t||255&x<<8-u)throw new SyntaxError("Unexpected end of data");return m}function ke(e,r,t){let o=r[r.length-1]==="=",s=(1<<t)-1,p="",m=0,u=0;for(let x=0;x<e.length;++x)for(u=u<<8|e[x],m+=8;m>t;)m-=t,p+=r[s&u>>m];if(m!==0&&(p+=r[s&u<<t-m]),o)for(;p.length*t&7;)p+="=";return p}function g({name:e,prefix:r,bitsPerChar:t,alphabet:o}){return Y({prefix:r,name:e,encode(s){return ke(s,o,t)},decode(s){return Se(s,o,t,e)}})}var H=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Xe=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ze=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ke=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Qe=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_e=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),We=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ye=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),He=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ee=J({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tr=J({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var re=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),sr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ir=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ar=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function te(e,r={}){let t=r.prefixLength??2,o=r.suffixLength??4,s=e.toString();return`${s.substring(0,t)}\u2026${s.substring(s.length,s.length-o)}`}b.default.formatters.b=e=>e==null?"undefined":ee.baseEncode(e);b.default.formatters.t=e=>e==null?"undefined":H.baseEncode(e);b.default.formatters.m=e=>e==null?"undefined":re.baseEncode(e);b.default.formatters.p=e=>e==null?"undefined":e.toString();b.default.formatters.c=e=>e==null?"undefined":e.toString();b.default.formatters.k=e=>e==null?"undefined":e.toString();b.default.formatters.a=e=>e==null?"undefined":e.toString();function Le(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r}function Me(e,r={}){return ne(te(e,r))}function ne(e){return{forComponent(r){return T(`${e}:${r}`)}}}function ze(){return{forComponent(e){return T(e)}}}function T(e){let r=Le(`${e}:trace`);return b.default.enabled(`${e}:trace`)&&b.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(r=(0,b.default)(`${e}:trace`)),Object.assign((0,b.default)(e),{error:(0,b.default)(`${e}:error`),trace:r})}function Oe(){b.default.disable()}function Pe(e){b.default.enable(e)}function $e(e){return b.default.enabled(e)}return de(Ie);})();
|
|
2
|
+
"use strict";var Libp2PLogger=(()=>{var oe=Object.create;var P=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var $=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),fe=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},q=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of ie(r))!ce.call(e,s)&&s!==t&&P(e,s,{get:()=>r[s],enumerable:!(o=se(r,s))||o.enumerable});return e};var ue=(e,r,t)=>(t=e!=null?oe(ae(e)):{},q(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),de=e=>q(P({},"__esModule",{value:!0}),e);var G=$((je,V)=>{var L=1e3,M=L*60,z=M*60,U=z*24,le=U*7,pe=U*365.25;V.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return he(e);if(t==="number"&&isFinite(e))return r.long?Ce(e):be(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function he(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*pe;case"weeks":case"week":case"w":return t*le;case"days":case"day":case"d":return t*U;case"hours":case"hour":case"hrs":case"hr":case"h":return t*z;case"minutes":case"minute":case"mins":case"min":case"m":return t*M;case"seconds":case"second":case"secs":case"sec":case"s":return t*L;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function be(e){var r=Math.abs(e);return r>=U?Math.round(e/U)+"d":r>=z?Math.round(e/z)+"h":r>=M?Math.round(e/M)+"m":r>=L?Math.round(e/L)+"s":e+"ms"}function Ce(e){var r=Math.abs(e);return r>=U?I(e,r,U,"day"):r>=z?I(e,r,z,"hour"):r>=M?I(e,r,M,"minute"):r>=L?I(e,r,L,"second"):e+" ms"}function I(e,r,t,o){var s=r>=t*1.5;return Math.round(e/t)+" "+o+(s?"s":"")}});var Z=$((De,X)=>{function ge(e){t.debug=t,t.default=t,t.coerce=x,t.disable=p,t.enable=s,t.enabled=m,t.humanize=G(),t.destroy=O,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function r(n){let i=0;for(let f=0;f<n.length;f++)i=(i<<5)-i+n.charCodeAt(f),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(n){let i,f=null,S,a;function c(...d){if(!c.enabled)return;let l=c,C=Number(new Date),F=C-(i||C);l.diff=F,l.prev=i,l.curr=C,i=C,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let h=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(v,w)=>{if(v==="%%")return"%";h++;let A=t.formatters[w];if(typeof A=="function"){let k=d[h];v=A.call(l,k),d.splice(h,1),h--}return v}),t.formatArgs.call(l,d),(l.log||t.log).apply(l,d)}return c.namespace=n,c.useColors=t.useColors(),c.color=t.selectColor(n),c.extend=o,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(S!==t.namespaces&&(S=t.namespaces,a=t.enabled(n)),a),set:d=>{f=d}}),typeof t.init=="function"&&t.init(c),c}function o(n,i){let f=t(this.namespace+(typeof i>"u"?":":i)+n);return f.log=this.log,f}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,f=(typeof n=="string"?n:"").split(/[\s,]+/),S=f.length;for(i=0;i<S;i++)f[i]&&(n=f[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function p(){let n=[...t.names.map(u),...t.skips.map(u).map(i=>"-"+i)].join(",");return t.enable(""),n}function m(n){if(n[n.length-1]==="*")return!0;let i,f;for(i=0,f=t.skips.length;i<f;i++)if(t.skips[i].test(n))return!1;for(i=0,f=t.names.length;i<f;i++)if(t.names[i].test(n))return!0;return!1}function u(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function x(n){return n instanceof Error?n.stack||n.message:n}function O(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=ge});var K=$((y,N)=>{y.formatArgs=xe;y.save=we;y.load=ye;y.useColors=me;y.storage=Fe();y.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();y.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function me(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function xe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+N.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(o=t))}),e.splice(o,0,r)}y.log=console.debug||console.log||(()=>{});function we(e){try{e?y.storage.setItem("debug",e):y.storage.removeItem("debug")}catch{}}function ye(){let e;try{e=y.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Fe(){try{return localStorage}catch{}}N.exports=Z()(y);var{formatters:ve}=N.exports;ve.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var Ne={};fe(Ne,{defaultLogger:()=>ze,disable:()=>Oe,enable:()=>Pe,enabled:()=>Ie,logger:()=>T,peerLogger:()=>Me,prefixLogger:()=>ne});var b=ue(K(),1);var Re=new Uint8Array(0);function Q(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function Ae(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var s=0;s<e.length;s++){var p=e.charAt(s),m=p.charCodeAt(0);if(t[m]!==255)throw new TypeError(p+" is ambiguous");t[m]=s}var u=e.length,x=e.charAt(0),O=Math.log(u)/Math.log(256),n=Math.log(256)/Math.log(u);function i(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var c=0,d=0,l=0,C=a.length;l!==C&&a[l]===0;)l++,c++;for(var F=(C-l)*n+1>>>0,h=new Uint8Array(F);l!==C;){for(var E=a[l],v=0,w=F-1;(E!==0||v<d)&&w!==-1;w--,v++)E+=256*h[w]>>>0,h[w]=E%u>>>0,E=E/u>>>0;if(E!==0)throw new Error("Non-zero carry");d=v,l++}for(var A=F-d;A!==F&&h[A]===0;)A++;for(var k=x.repeat(c);A<F;++A)k+=e.charAt(h[A]);return k}function f(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var c=0;if(a[c]!==" "){for(var d=0,l=0;a[c]===x;)d++,c++;for(var C=(a.length-c)*O+1>>>0,F=new Uint8Array(C);a[c];){var h=t[a.charCodeAt(c)];if(h===255)return;for(var E=0,v=C-1;(h!==0||E<l)&&v!==-1;v--,E++)h+=u*F[v]>>>0,F[v]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");l=E,c++}if(a[c]!==" "){for(var w=C-l;w!==C&&F[w]===0;)w++;for(var A=new Uint8Array(d+(C-w)),k=d;w!==C;)A[k++]=F[w++];return A}}}function S(a){var c=f(a);if(c)return c;throw new Error(`Non-${r} character`)}return{encode:i,decodeUnsafe:f,decode:S}}var Ee=Ae,Ue=Ee,_=Ue;var j=class{name;prefix;baseEncode;constructor(r,t,o){this.name=r,this.prefix=t,this.baseEncode=o}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},D=class{name;prefix;baseDecode;prefixCodePoint;constructor(r,t,o){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return W(this,r)}},R=class{decoders;constructor(r){this.decoders=r}or(r){return W(this,r)}decode(r){let t=r[0],o=this.decoders[t];if(o!=null)return o.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function W(e,r){return new R({...e.decoders??{[e.prefix]:e},...r.decoders??{[r.prefix]:r}})}var B=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(r,t,o,s){this.name=r,this.prefix=t,this.baseEncode=o,this.baseDecode=s,this.encoder=new j(r,t,o),this.decoder=new D(r,t,s)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};function Y({name:e,prefix:r,encode:t,decode:o}){return new B(e,r,t,o)}function J({name:e,prefix:r,alphabet:t}){let{encode:o,decode:s}=_(t,e);return Y({prefix:r,name:e,encode:o,decode:p=>Q(s(p))})}function Se(e,r,t,o){let s={};for(let n=0;n<r.length;++n)s[r[n]]=n;let p=e.length;for(;e[p-1]==="=";)--p;let m=new Uint8Array(p*t/8|0),u=0,x=0,O=0;for(let n=0;n<p;++n){let i=s[e[n]];if(i===void 0)throw new SyntaxError(`Non-${o} character`);x=x<<t|i,u+=t,u>=8&&(u-=8,m[O++]=255&x>>u)}if(u>=t||255&x<<8-u)throw new SyntaxError("Unexpected end of data");return m}function ke(e,r,t){let o=r[r.length-1]==="=",s=(1<<t)-1,p="",m=0,u=0;for(let x=0;x<e.length;++x)for(u=u<<8|e[x],m+=8;m>t;)m-=t,p+=r[s&u>>m];if(m!==0&&(p+=r[s&u<<t-m]),o)for(;p.length*t&7;)p+="=";return p}function g({name:e,prefix:r,bitsPerChar:t,alphabet:o}){return Y({prefix:r,name:e,encode(s){return ke(s,o,t)},decode(s){return Se(s,o,t,e)}})}var H=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Xe=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ze=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ke=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Qe=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_e=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),We=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ye=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),He=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ee=J({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tr=J({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var re=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),sr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ir=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ar=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function te(e,r={}){let t=r.prefixLength??2,o=r.suffixLength??4,s=e.toString();return`${s.substring(0,t)}\u2026${s.substring(s.length,s.length-o)}`}b.default.formatters.b=e=>e==null?"undefined":ee.baseEncode(e);b.default.formatters.t=e=>e==null?"undefined":H.baseEncode(e);b.default.formatters.m=e=>e==null?"undefined":re.baseEncode(e);b.default.formatters.p=e=>e==null?"undefined":e.toString();b.default.formatters.c=e=>e==null?"undefined":e.toString();b.default.formatters.k=e=>e==null?"undefined":e.toString();b.default.formatters.a=e=>e==null?"undefined":e.toString();function Le(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r}function Me(e,r={}){return ne(te(e,r))}function ne(e){return{forComponent(r){return T(`${e}:${r}`)}}}function ze(){return{forComponent(e){return T(e)}}}function T(e){let r=Le(`${e}:trace`);return b.default.enabled(`${e}:trace`)&&b.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(r=(0,b.default)(`${e}:trace`)),Object.assign((0,b.default)(e),{error:(0,b.default)(`${e}:error`),trace:r})}function Oe(){b.default.disable()}function Pe(e){b.default.enable(e)}function Ie(e){return b.default.enabled(e)}return de(Ne);})();
|
|
3
3
|
return Libp2PLogger}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/logger",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.18",
|
|
4
4
|
"description": "A logging component for use in js-libp2p modules",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/logger#readme",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"test:electron-main": "aegir test -t electron-main"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@libp2p/interface": "^1.6.
|
|
57
|
+
"@libp2p/interface": "^1.6.2",
|
|
58
58
|
"@multiformats/multiaddr": "^12.2.3",
|
|
59
59
|
"debug": "^4.3.4",
|
|
60
60
|
"interface-datastore": "^8.2.11",
|
|
61
61
|
"multiformats": "^13.1.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@libp2p/peer-id": "^4.2.
|
|
64
|
+
"@libp2p/peer-id": "^4.2.2",
|
|
65
65
|
"@types/debug": "^4.1.12",
|
|
66
66
|
"aegir": "^43.0.1",
|
|
67
67
|
"sinon": "^18.0.0",
|