@substrate-system/debug 0.9.10 → 0.9.13

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/ms/index.js", "../../src/browser/index.ts", "../../src/common.ts", "../../src/noop.ts", "../../src/browser/util.ts"],
4
+ "sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "import humanize from 'ms'\nimport {\n generateRandomString,\n coerce,\n selectColor,\n createRegexFromEnvVar\n} from '../common.js'\nimport { noop } from '../noop.js'\nimport { colors } from './util.js'\n\nconst log = console.log || (() => {})\n\nexport { createDebug }\nexport default createDebug\n\n/**\n * Check if the given namespace is enabled.\n * `namespace` is the name that is passed into debug.\n * `forcedEnabled` is a boolean that forces logging when true.\n * Only checks localStorage for the DEBUG key, unless forced.\n */\nfunction isEnabled (namespace:string, forcedEnabled?:boolean):boolean {\n // If explicitly forced to be enabled via boolean true\n if (forcedEnabled === true) return true\n\n const DEBUG = localStorage?.getItem('DEBUG')\n\n // Check for wildcard\n if (DEBUG === '*') return true\n\n // if we were not called with a namespace\n if (namespace === 'DEV') {\n // We want to log iff there is no DEBUG variable.\n if (!DEBUG) {\n return true\n }\n return false\n }\n\n // No DEBUG variable set\n if (!DEBUG) return false\n\n const envVars = createRegexFromEnvVar(DEBUG)\n return envVars.some(regex => regex.test(namespace))\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\nfunction createFormatters () {\n return {\n j: function (v:any) {\n try {\n return JSON.stringify(v)\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + String(error)\n }\n }\n }\n}\n\nfunction logger (\n namespace:string,\n args:any[],\n { prevTime, color },\n forcedEnabled?:boolean\n) {\n args = args || []\n if (!isEnabled(namespace, forcedEnabled)) return\n\n // Set `diff` timestamp\n const curr = Number(new Date())\n const diff = curr - (prevTime || curr)\n prevTime = curr\n\n args[0] = coerce(args[0])\n const formatters = createFormatters()\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O')\n }\n\n // Apply any `formatters` transformations\n let index = 0\n args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n // If we encounter an escaped %, then don't increase the\n // array index\n if (match === '%%') return '%'\n\n index++\n\n const formatter = formatters[format]\n if (typeof formatter === 'function') {\n const val = args[index]\n match = formatter.call(self, val)\n\n // Now we need to remove `args[index]` since it's inlined\n // in the `format`\n args.splice(index, 1)\n index--\n }\n return match\n })\n\n // Apply env-specific formatting (colors, etc.)\n const _args = formatArgs({\n diff,\n color,\n useColors: shouldUseColors(),\n namespace\n }, args)\n\n log(..._args)\n}\n\nfunction shouldUseColors ():boolean {\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false\n }\n\n // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native:\n // https://github.com/facebook/react-native/pull/1632\n return !!((typeof document !== 'undefined' && document.documentElement &&\n document.documentElement.style &&\n document.documentElement.style.webkitAppearance) ||\n // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) &&\n parseInt(RegExp.$1, 10) >= 31) ||\n // Double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)))\n}\n\n/**\n * Colorize log arguments if enabled.\n */\nfunction formatArgs ({ diff, color, namespace, useColors }:{\n diff:number,\n color:number,\n namespace:string,\n useColors:boolean\n}, args) {\n args[0] = (useColors ? '%c' : '') +\n namespace +\n (useColors ? ' %c' : ' ') +\n args[0] +\n (useColors ? '%c ' : ' ') +\n '+' + humanize(diff, {})\n\n if (!useColors) return\n\n const c = 'color: ' + color\n args.splice(1, 0, c, 'color: inherit')\n\n // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n let index = 0\n let lastC = 0\n args[0].replace(/%[a-zA-Z%]/g, match => {\n if (match === '%%') {\n return\n }\n index++\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index\n }\n })\n\n args.splice(lastC, 0, c)\n\n return args\n}\n\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\n}\n\nfunction createDebug (namespace?:string|boolean):Debugger {\n if (namespace === false) return noop\n const prevTime = Number(new Date())\n const color = selectColor(\n typeof namespace === 'string' ? namespace : generateRandomString(10),\n colors\n )\n\n // Determine if this is a boolean true passed as the namespace\n const forcedEnabled = namespace === true\n const actualNamespace = typeof namespace === 'string' ? namespace : 'DEV'\n\n const debug = function (...args:any[]) {\n return logger(\n actualNamespace,\n args,\n { prevTime, color },\n forcedEnabled\n )\n }\n\n debug.extend = function (extension: string): Debugger {\n const extendedNamespace = actualNamespace + ':' + extension\n return createDebug(extendedNamespace)\n }\n\n return debug as Debugger\n}\n", "/**\n* Coerce `val`.\n*\n* @param {unknown} val\n* @return {string}\n*/\nexport function coerce (val:unknown):string {\n if (val instanceof Error) {\n return val.stack || val.message\n }\n\n return String(val)\n}\n\n/**\n * Selects a color for a debug namespace\n * @param {string} namespace The namespace string for the debug instance to be colored\n * @return {number|string} An ANSI color code for the given namespace\n */\nexport function selectColor (\n namespace:string,\n colors:string[]|number[]\n):number|string {\n let hash = 0\n\n for (let i = 0; i < namespace.length; i++) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i)\n hash |= 0 // Convert to 32bit integer\n }\n\n return colors[Math.abs(hash) % colors.length]\n}\n\nexport function createRegexFromEnvVar (names:string):RegExp[] {\n const split = names.split(/[\\s,]+/).filter(Boolean)\n const regexs = split\n .map(word => word.replace(/\\*/g, '.*?'))\n .map(r => new RegExp('^' + r + '$'))\n\n return regexs\n}\n\n/**\n * Use this to create a random namespace in the case that `debug`\n * is called without any arguments.\n * @param {number} length Lenght of the random string\n * @returns {string}\n */\nexport function generateRandomString (length = 6):string {\n return Math.random().toString(20).substring(2, length)\n}\n", "import { type Debugger } from './browser/index.js'\n\nexport const noop:Debugger = function (_args:any[]) {}\nnoop.extend = function (_namespace:string) { return noop }\n\n", "export const colors = [\n '#0000CC',\n '#0000FF',\n '#0033CC',\n '#0033FF',\n '#0066CC',\n '#0066FF',\n '#0099CC',\n '#0099FF',\n '#00CC00',\n '#00CC33',\n '#00CC66',\n '#00CC99',\n '#00CCCC',\n '#00CCFF',\n '#3300CC',\n '#3300FF',\n '#3333CC',\n '#3333FF',\n '#3366CC',\n '#3366FF',\n '#3399CC',\n '#3399FF',\n '#33CC00',\n '#33CC33',\n '#33CC66',\n '#33CC99',\n '#33CCCC',\n '#33CCFF',\n '#6600CC',\n '#6600FF',\n '#6633CC',\n '#6633FF',\n '#66CC00',\n '#66CC33',\n '#9900CC',\n '#9900FF',\n '#9933CC',\n '#9933FF',\n '#99CC00',\n '#99CC33',\n '#CC0000',\n '#CC0033',\n '#CC0066',\n '#CC0099',\n '#CC00CC',\n '#CC00FF',\n '#CC3300',\n '#CC3333',\n '#CC3366',\n '#CC3399',\n '#CC33CC',\n '#CC33FF',\n '#CC6600',\n '#CC6633',\n '#CC9900',\n '#CC9933',\n '#CCCC00',\n '#CCCC33',\n '#FF0000',\n '#FF0033',\n '#FF0066',\n '#FF0099',\n '#FF00CC',\n '#FF00FF',\n '#FF3300',\n '#FF3333',\n '#FF3366',\n '#FF3399',\n '#FF33CC',\n '#FF33FF',\n '#FF6600',\n '#FF6633',\n '#FF9900',\n '#FF9933',\n '#FFCC00',\n '#FFCC33'\n]\n"],
5
+ "mappings": "uqBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAIA,IAAIC,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZJ,EAAO,QAAU,SAAUO,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAC,EACtB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,CACtB,CACF,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,CACF,EACA,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,CAAC,EACvBL,GAAQK,EAAM,CAAC,GAAK,MAAM,YAAY,EAC1C,OAAQL,EAAM,CACZ,IAAK,QACL,IAAK,OAC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AAS,CAChCA,IAAU,OAGdD,IACIC,IAAU,OAGVW,EAAQZ,GAEhB,CAAC,EAEDP,EAAK,OAAOmB,EAAO,EAAGD,CAAC,EAEhBlB,CACX,CAtCSL,EAAAkB,EAAA,cA6CT,SAASzB,EAAaE,EAAoC,CACtD,GAAIA,IAAc,GAAO,OAAO8B,EAChC,IAAMnB,EAAW,OAAO,IAAI,IAAM,EAC5BC,EAAQmB,EACV,OAAO/B,GAAc,SAAWA,EAAYgC,EAAqB,EAAE,EACnEC,CACJ,EAGMhC,EAAgBD,IAAc,GAC9BkC,EAAkB,OAAOlC,GAAc,SAAWA,EAAY,MAE9DmC,EAAQ9B,EAAA,YAAaK,EAAY,CACnC,OAAOD,EACHyB,EACAxB,EACA,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAClBX,CACJ,CACJ,EAPc,SASd,OAAAkC,EAAM,OAAS,SAAUC,EAA6B,CAClD,IAAMC,EAAoBH,EAAkB,IAAME,EAClD,OAAOtC,EAAYuC,CAAiB,CACxC,EAEOF,CACX,CA3BS9B,EAAAP,EAAA",
6
+ "names": ["require_ms", "__commonJSMin", "exports", "module", "s", "m", "h", "d", "w", "y", "val", "options", "type", "parse", "fmtLong", "fmtShort", "str", "match", "n", "__name", "ms", "msAbs", "plural", "name", "isPlural", "index_exports", "__export", "createDebug", "index_default", "__toCommonJS", "import_ms", "coerce", "val", "__name", "selectColor", "namespace", "colors", "hash", "i", "createRegexFromEnvVar", "names", "word", "r", "generateRandomString", "length", "noop", "__name", "_args", "_namespace", "colors", "log", "index_default", "createDebug", "isEnabled", "namespace", "forcedEnabled", "DEBUG", "createRegexFromEnvVar", "regex", "__name", "createFormatters", "v", "error", "logger", "args", "prevTime", "color", "curr", "diff", "coerce", "formatters", "index", "match", "format", "formatter", "val", "_args", "formatArgs", "shouldUseColors", "log", "useColors", "humanize", "c", "lastC", "noop", "selectColor", "generateRandomString", "colors", "actualNamespace", "debug", "extension", "extendedNamespace"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var R=Object.create;var p=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var s=(e,r)=>p(e,"name",{value:r,configurable:!0});var z=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var B=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of L(r))!U.call(e,o)&&o!==t&&p(e,o,{get:()=>r[o],enumerable:!(n=V(r,o))||n.enumerable});return e};var J=(e,r,t)=>(t=e!=null?R(O(e)):{},B(r||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e));var b=z((W,h)=>{"use strict";var f=1e3,F=f*60,g=F*60,c=g*24,_=c*7,$=c*365.25;h.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return G(e);if(t==="number"&&isFinite(e))return r.long?P(e):I(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function G(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]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*$;case"weeks":case"week":case"w":return t*_;case"days":case"day":case"d":return t*c;case"hours":case"hour":case"hrs":case"hr":case"h":return t*g;case"minutes":case"minute":case"mins":case"min":case"m":return t*F;case"seconds":case"second":case"secs":case"sec":case"s":return t*f;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}s(G,"parse");function I(e){var r=Math.abs(e);return r>=c?Math.round(e/c)+"d":r>=g?Math.round(e/g)+"h":r>=F?Math.round(e/F)+"m":r>=f?Math.round(e/f)+"s":e+"ms"}s(I,"fmtShort");function P(e){var r=Math.abs(e);return r>=c?l(e,r,c,"day"):r>=g?l(e,r,g,"hour"):r>=F?l(e,r,F,"minute"):r>=f?l(e,r,f,"second"):e+" ms"}s(P,"fmtLong");function l(e,r,t,n){var o=r>=t*1.5;return Math.round(e/t)+" "+n+(o?"s":"")}s(l,"plural")});var A=J(b(),1);function x(e){return e instanceof Error?e.stack||e.message:String(e)}s(x,"coerce");function v(e,r){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r[Math.abs(t)%r.length]}s(v,"selectColor");function w(e){return e.split(/[\s,]+/).filter(Boolean).map(n=>n.replace(/\*/g,".*?")).map(n=>new RegExp("^"+n+"$"))}s(w,"createRegexFromEnvVar");function E(e=6){return Math.random().toString(20).substring(2,e)}s(E,"generateRandomString");var d=s(function(e){},"noop");d.extend=function(e){return d};var D=["#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"];var Z=console.log||(()=>{});var ae=S;function j(e,r){if(r===!0)return!0;let t=localStorage?.getItem("DEBUG");return t==="*"?!0:e==="DEV"?!t:t?w(t).some(o=>o.test(e)):!1}s(j,"isEnabled");function q(){return{j:s(function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+String(r)}},"j")}}s(q,"createFormatters");function H(e,r,{prevTime:t,color:n},o){if(r=r||[],!j(e,o))return;let i=Number(new Date),a=i-(t||i);t=i,r[0]=x(r[0]);let C=q();typeof r[0]!="string"&&r.unshift("%O");let u=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(m,k)=>{if(m==="%%")return"%";u++;let y=C[k];if(typeof y=="function"){let N=r[u];m=y.call(self,N),r.splice(u,1),u--}return m});let M=Q({diff:a,color:n,useColors:K(),namespace:e},r);Z(...M)}s(H,"logger");function K(){return 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 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+)/))}s(K,"shouldUseColors");function Q({diff:e,color:r,namespace:t,useColors:n},o){if(o[0]=(n?"%c":"")+t+(n?" %c":" ")+o[0]+(n?"%c ":" ")+"+"+(0,A.default)(e,{}),!n)return;let i="color: "+r;o.splice(1,0,i,"color: inherit");let a=0,C=0;return o[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(a++,u==="%c"&&(C=a))}),o.splice(C,0,i),o}s(Q,"formatArgs");function S(e){if(e===!1)return d;let r=Number(new Date),t=v(typeof e=="string"?e:E(10),D),n=e===!0,o=typeof e=="string"?e:"DEV",i=s(function(...a){return H(o,a,{prevTime:r,color:t},n)},"debug");return i.extend=function(a){let C=o+":"+a;return S(C)},i}s(S,"createDebug");export{S as createDebug,ae as default};
2
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/ms/index.js", "../../src/browser/index.ts", "../../src/common.ts", "../../src/noop.ts", "../../src/browser/util.ts"],
4
+ "sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "import humanize from 'ms'\nimport {\n generateRandomString,\n coerce,\n selectColor,\n createRegexFromEnvVar\n} from '../common.js'\nimport { noop } from '../noop.js'\nimport { colors } from './util.js'\n\nconst log = console.log || (() => {})\n\nexport { createDebug }\nexport default createDebug\n\n/**\n * Check if the given namespace is enabled.\n * `namespace` is the name that is passed into debug.\n * `forcedEnabled` is a boolean that forces logging when true.\n * Only checks localStorage for the DEBUG key, unless forced.\n */\nfunction isEnabled (namespace:string, forcedEnabled?:boolean):boolean {\n // If explicitly forced to be enabled via boolean true\n if (forcedEnabled === true) return true\n\n const DEBUG = localStorage?.getItem('DEBUG')\n\n // Check for wildcard\n if (DEBUG === '*') return true\n\n // if we were not called with a namespace\n if (namespace === 'DEV') {\n // We want to log iff there is no DEBUG variable.\n if (!DEBUG) {\n return true\n }\n return false\n }\n\n // No DEBUG variable set\n if (!DEBUG) return false\n\n const envVars = createRegexFromEnvVar(DEBUG)\n return envVars.some(regex => regex.test(namespace))\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\nfunction createFormatters () {\n return {\n j: function (v:any) {\n try {\n return JSON.stringify(v)\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + String(error)\n }\n }\n }\n}\n\nfunction logger (\n namespace:string,\n args:any[],\n { prevTime, color },\n forcedEnabled?:boolean\n) {\n args = args || []\n if (!isEnabled(namespace, forcedEnabled)) return\n\n // Set `diff` timestamp\n const curr = Number(new Date())\n const diff = curr - (prevTime || curr)\n prevTime = curr\n\n args[0] = coerce(args[0])\n const formatters = createFormatters()\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O')\n }\n\n // Apply any `formatters` transformations\n let index = 0\n args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n // If we encounter an escaped %, then don't increase the\n // array index\n if (match === '%%') return '%'\n\n index++\n\n const formatter = formatters[format]\n if (typeof formatter === 'function') {\n const val = args[index]\n match = formatter.call(self, val)\n\n // Now we need to remove `args[index]` since it's inlined\n // in the `format`\n args.splice(index, 1)\n index--\n }\n return match\n })\n\n // Apply env-specific formatting (colors, etc.)\n const _args = formatArgs({\n diff,\n color,\n useColors: shouldUseColors(),\n namespace\n }, args)\n\n log(..._args)\n}\n\nfunction shouldUseColors ():boolean {\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false\n }\n\n // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native:\n // https://github.com/facebook/react-native/pull/1632\n return !!((typeof document !== 'undefined' && document.documentElement &&\n document.documentElement.style &&\n document.documentElement.style.webkitAppearance) ||\n // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) &&\n parseInt(RegExp.$1, 10) >= 31) ||\n // Double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)))\n}\n\n/**\n * Colorize log arguments if enabled.\n */\nfunction formatArgs ({ diff, color, namespace, useColors }:{\n diff:number,\n color:number,\n namespace:string,\n useColors:boolean\n}, args) {\n args[0] = (useColors ? '%c' : '') +\n namespace +\n (useColors ? ' %c' : ' ') +\n args[0] +\n (useColors ? '%c ' : ' ') +\n '+' + humanize(diff, {})\n\n if (!useColors) return\n\n const c = 'color: ' + color\n args.splice(1, 0, c, 'color: inherit')\n\n // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n let index = 0\n let lastC = 0\n args[0].replace(/%[a-zA-Z%]/g, match => {\n if (match === '%%') {\n return\n }\n index++\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index\n }\n })\n\n args.splice(lastC, 0, c)\n\n return args\n}\n\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\n}\n\nfunction createDebug (namespace?:string|boolean):Debugger {\n if (namespace === false) return noop\n const prevTime = Number(new Date())\n const color = selectColor(\n typeof namespace === 'string' ? namespace : generateRandomString(10),\n colors\n )\n\n // Determine if this is a boolean true passed as the namespace\n const forcedEnabled = namespace === true\n const actualNamespace = typeof namespace === 'string' ? namespace : 'DEV'\n\n const debug = function (...args:any[]) {\n return logger(\n actualNamespace,\n args,\n { prevTime, color },\n forcedEnabled\n )\n }\n\n debug.extend = function (extension: string): Debugger {\n const extendedNamespace = actualNamespace + ':' + extension\n return createDebug(extendedNamespace)\n }\n\n return debug as Debugger\n}\n", "/**\n* Coerce `val`.\n*\n* @param {unknown} val\n* @return {string}\n*/\nexport function coerce (val:unknown):string {\n if (val instanceof Error) {\n return val.stack || val.message\n }\n\n return String(val)\n}\n\n/**\n * Selects a color for a debug namespace\n * @param {string} namespace The namespace string for the debug instance to be colored\n * @return {number|string} An ANSI color code for the given namespace\n */\nexport function selectColor (\n namespace:string,\n colors:string[]|number[]\n):number|string {\n let hash = 0\n\n for (let i = 0; i < namespace.length; i++) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i)\n hash |= 0 // Convert to 32bit integer\n }\n\n return colors[Math.abs(hash) % colors.length]\n}\n\nexport function createRegexFromEnvVar (names:string):RegExp[] {\n const split = names.split(/[\\s,]+/).filter(Boolean)\n const regexs = split\n .map(word => word.replace(/\\*/g, '.*?'))\n .map(r => new RegExp('^' + r + '$'))\n\n return regexs\n}\n\n/**\n * Use this to create a random namespace in the case that `debug`\n * is called without any arguments.\n * @param {number} length Lenght of the random string\n * @returns {string}\n */\nexport function generateRandomString (length = 6):string {\n return Math.random().toString(20).substring(2, length)\n}\n", "import { type Debugger } from './browser/index.js'\n\nexport const noop:Debugger = function (_args:any[]) {}\nnoop.extend = function (_namespace:string) { return noop }\n\n", "export const colors = [\n '#0000CC',\n '#0000FF',\n '#0033CC',\n '#0033FF',\n '#0066CC',\n '#0066FF',\n '#0099CC',\n '#0099FF',\n '#00CC00',\n '#00CC33',\n '#00CC66',\n '#00CC99',\n '#00CCCC',\n '#00CCFF',\n '#3300CC',\n '#3300FF',\n '#3333CC',\n '#3333FF',\n '#3366CC',\n '#3366FF',\n '#3399CC',\n '#3399FF',\n '#33CC00',\n '#33CC33',\n '#33CC66',\n '#33CC99',\n '#33CCCC',\n '#33CCFF',\n '#6600CC',\n '#6600FF',\n '#6633CC',\n '#6633FF',\n '#66CC00',\n '#66CC33',\n '#9900CC',\n '#9900FF',\n '#9933CC',\n '#9933FF',\n '#99CC00',\n '#99CC33',\n '#CC0000',\n '#CC0033',\n '#CC0066',\n '#CC0099',\n '#CC00CC',\n '#CC00FF',\n '#CC3300',\n '#CC3333',\n '#CC3366',\n '#CC3399',\n '#CC33CC',\n '#CC33FF',\n '#CC6600',\n '#CC6633',\n '#CC9900',\n '#CC9933',\n '#CCCC00',\n '#CCCC33',\n '#FF0000',\n '#FF0033',\n '#FF0066',\n '#FF0099',\n '#FF00CC',\n '#FF00FF',\n '#FF3300',\n '#FF3333',\n '#FF3366',\n '#FF3399',\n '#FF33CC',\n '#FF33FF',\n '#FF6600',\n '#FF6633',\n '#FF9900',\n '#FF9933',\n '#FFCC00',\n '#FFCC33'\n]\n"],
5
+ "mappings": "4jBAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,cAIA,IAAIC,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZJ,EAAO,QAAU,SAAUO,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAC,EACtB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,CACtB,CACF,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,CACF,EACA,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,CAAC,EACvBL,GAAQK,EAAM,CAAC,GAAK,MAAM,YAAY,EAC1C,OAAQL,EAAM,CACZ,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOM,EAAIT,EACb,IAAK,QACL,IAAK,OACL,IAAK,IACH,OAAOS,EAAIV,EACb,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOU,EAAIX,EACb,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOW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qB,EAAE,EACnEC,CACJ,EAGMhC,EAAgBD,IAAc,GAC9BkC,EAAkB,OAAOlC,GAAc,SAAWA,EAAY,MAE9DmC,EAAQ9B,EAAA,YAAaK,EAAY,CACnC,OAAOD,EACHyB,EACAxB,EACA,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAClBX,CACJ,CACJ,EAPc,SASd,OAAAkC,EAAM,OAAS,SAAUC,EAA6B,CAClD,IAAMC,EAAoBH,EAAkB,IAAME,EAClD,OAAOtC,EAAYuC,CAAiB,CACxC,EAEOF,CACX,CA3BS9B,EAAAP,EAAA",
6
+ "names": ["require_ms", "__commonJSMin", "exports", "module", "s", "m", "h", "d", "w", "y", "val", "options", "type", "parse", "fmtLong", "fmtShort", "str", "match", "n", "__name", "ms", "msAbs", "plural", "name", "isPlural", "import_ms", "coerce", "val", "__name", "selectColor", "namespace", "colors", "hash", "i", "createRegexFromEnvVar", "names", "word", "r", "generateRandomString", "length", "noop", "__name", "_args", "_namespace", "colors", "log", "index_default", "createDebug", "isEnabled", "namespace", "forcedEnabled", "DEBUG", "createRegexFromEnvVar", "regex", "__name", "createFormatters", "v", "error", "logger", "args", "prevTime", "color", "curr", "diff", "coerce", "formatters", "index", "match", "format", "formatter", "val", "_args", "formatArgs", "shouldUseColors", "log", "useColors", "humanize", "c", "lastC", "noop", "selectColor", "generateRandomString", "colors", "actualNamespace", "debug", "extension", "extendedNamespace"]
7
+ }
package/dist/meta.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "inputs": {
3
+ "src/ms.ts": {
4
+ "bytes": 3347,
5
+ "imports": [
6
+ {
7
+ "path": "<runtime>",
8
+ "kind": "import-statement",
9
+ "external": true
10
+ }
11
+ ],
12
+ "format": "esm"
13
+ },
14
+ "src/common.ts": {
15
+ "bytes": 1325,
16
+ "imports": [
17
+ {
18
+ "path": "<runtime>",
19
+ "kind": "import-statement",
20
+ "external": true
21
+ }
22
+ ],
23
+ "format": "esm"
24
+ },
25
+ "src/node.ts": {
26
+ "bytes": 6553,
27
+ "imports": [
28
+ {
29
+ "path": "@substrate-system/util/node/self",
30
+ "kind": "import-statement",
31
+ "external": true
32
+ },
33
+ {
34
+ "path": "supports-color",
35
+ "kind": "import-statement",
36
+ "external": true
37
+ },
38
+ {
39
+ "path": "src/ms.ts",
40
+ "kind": "import-statement",
41
+ "original": "./ms.js"
42
+ },
43
+ {
44
+ "path": "node:tty",
45
+ "kind": "import-statement",
46
+ "external": true
47
+ },
48
+ {
49
+ "path": "node:util",
50
+ "kind": "import-statement",
51
+ "external": true
52
+ },
53
+ {
54
+ "path": "src/common.ts",
55
+ "kind": "import-statement",
56
+ "original": "./common.js"
57
+ },
58
+ {
59
+ "path": "<runtime>",
60
+ "kind": "import-statement",
61
+ "external": true
62
+ }
63
+ ],
64
+ "format": "esm"
65
+ }
66
+ },
67
+ "outputs": {
68
+ "dist/node.js.map": {
69
+ "imports": [],
70
+ "exports": [],
71
+ "inputs": {},
72
+ "bytes": 17973
73
+ },
74
+ "dist/node.js": {
75
+ "imports": [
76
+ {
77
+ "path": "@substrate-system/util/node/self",
78
+ "kind": "import-statement",
79
+ "external": true
80
+ },
81
+ {
82
+ "path": "supports-color",
83
+ "kind": "import-statement",
84
+ "external": true
85
+ },
86
+ {
87
+ "path": "node:tty",
88
+ "kind": "import-statement",
89
+ "external": true
90
+ },
91
+ {
92
+ "path": "node:util",
93
+ "kind": "import-statement",
94
+ "external": true
95
+ }
96
+ ],
97
+ "exports": [
98
+ "createDebug",
99
+ "default"
100
+ ],
101
+ "entryPoint": "src/node.ts",
102
+ "inputs": {
103
+ "src/node.ts": {
104
+ "bytesInOutput": 4368
105
+ },
106
+ "src/ms.ts": {
107
+ "bytesInOutput": 2506
108
+ },
109
+ "src/common.ts": {
110
+ "bytesInOutput": 576
111
+ }
112
+ },
113
+ "bytes": 7745
114
+ }
115
+ }
116
+ }
package/dist/node.cjs ADDED
@@ -0,0 +1,379 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/node.ts
32
+ var node_exports = {};
33
+ __export(node_exports, {
34
+ createDebug: () => createDebug,
35
+ default: () => node_default
36
+ });
37
+ module.exports = __toCommonJS(node_exports);
38
+ var import_self = require("@substrate-system/util/node/self");
39
+ var import_supports_color = __toESM(require("supports-color"), 1);
40
+
41
+ // src/ms.ts
42
+ var s = 1e3;
43
+ var m = s * 60;
44
+ var h = m * 60;
45
+ var d = h * 24;
46
+ var w = d * 7;
47
+ var y = d * 365.25;
48
+ function ms_default(val, options = {}) {
49
+ options = options || {};
50
+ const type = typeof val;
51
+ if (type === "string" && val.length > 0) {
52
+ return parse(val);
53
+ } else if (type === "number" && isFinite(val)) {
54
+ return options.long ? fmtLong(val) : fmtShort(val);
55
+ }
56
+ throw new Error(
57
+ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
58
+ );
59
+ }
60
+ __name(ms_default, "default");
61
+ function parse(str) {
62
+ str = String(str);
63
+ if (str.length > 100) {
64
+ return;
65
+ }
66
+ const match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
67
+ str
68
+ );
69
+ if (!match) {
70
+ return;
71
+ }
72
+ const n = parseFloat(match[1]);
73
+ const type = (match[2] || "ms").toLowerCase();
74
+ switch (type) {
75
+ case "years":
76
+ case "year":
77
+ case "yrs":
78
+ case "yr":
79
+ case "y":
80
+ return n * y;
81
+ case "weeks":
82
+ case "week":
83
+ case "w":
84
+ return n * w;
85
+ case "days":
86
+ case "day":
87
+ case "d":
88
+ return n * d;
89
+ case "hours":
90
+ case "hour":
91
+ case "hrs":
92
+ case "hr":
93
+ case "h":
94
+ return n * h;
95
+ case "minutes":
96
+ case "minute":
97
+ case "mins":
98
+ case "min":
99
+ case "m":
100
+ return n * m;
101
+ case "seconds":
102
+ case "second":
103
+ case "secs":
104
+ case "sec":
105
+ case "s":
106
+ return n * s;
107
+ case "milliseconds":
108
+ case "millisecond":
109
+ case "msecs":
110
+ case "msec":
111
+ case "ms":
112
+ return n;
113
+ default:
114
+ return void 0;
115
+ }
116
+ }
117
+ __name(parse, "parse");
118
+ function fmtShort(ms) {
119
+ const msAbs = Math.abs(ms);
120
+ if (msAbs >= d) {
121
+ return Math.round(ms / d) + "d";
122
+ }
123
+ if (msAbs >= h) {
124
+ return Math.round(ms / h) + "h";
125
+ }
126
+ if (msAbs >= m) {
127
+ return Math.round(ms / m) + "m";
128
+ }
129
+ if (msAbs >= s) {
130
+ return Math.round(ms / s) + "s";
131
+ }
132
+ return ms + "ms";
133
+ }
134
+ __name(fmtShort, "fmtShort");
135
+ function fmtLong(ms) {
136
+ const msAbs = Math.abs(ms);
137
+ if (msAbs >= d) {
138
+ return plural(ms, msAbs, d, "day");
139
+ }
140
+ if (msAbs >= h) {
141
+ return plural(ms, msAbs, h, "hour");
142
+ }
143
+ if (msAbs >= m) {
144
+ return plural(ms, msAbs, m, "minute");
145
+ }
146
+ if (msAbs >= s) {
147
+ return plural(ms, msAbs, s, "second");
148
+ }
149
+ return ms + " ms";
150
+ }
151
+ __name(fmtLong, "fmtLong");
152
+ function plural(ms, msAbs, n, name) {
153
+ const isPlural = msAbs >= n * 1.5;
154
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
155
+ }
156
+ __name(plural, "plural");
157
+
158
+ // src/node.ts
159
+ var import_node_tty = __toESM(require("node:tty"), 1);
160
+ var import_node_util = __toESM(require("node:util"), 1);
161
+
162
+ // src/common.ts
163
+ function coerce(val) {
164
+ if (val instanceof Error) {
165
+ return val.stack || val.message;
166
+ }
167
+ return String(val);
168
+ }
169
+ __name(coerce, "coerce");
170
+ function createRegexFromEnvVar(names) {
171
+ const split = names.split(/[\s,]+/).filter(Boolean);
172
+ const regexs = split.map((word) => word.replace(/\*/g, ".*?")).map((r) => new RegExp("^" + r + "$"));
173
+ return regexs;
174
+ }
175
+ __name(createRegexFromEnvVar, "createRegexFromEnvVar");
176
+ function generateRandomString(length = 6) {
177
+ return Math.random().toString(20).substring(2, length);
178
+ }
179
+ __name(generateRandomString, "generateRandomString");
180
+
181
+ // src/node.ts
182
+ var colors = import_supports_color.default && // @ts-expect-error ???
183
+ (import_supports_color.default.stderr || import_supports_color.default).level >= 2 ? [
184
+ 20,
185
+ 21,
186
+ 26,
187
+ 27,
188
+ 32,
189
+ 33,
190
+ 38,
191
+ 39,
192
+ 40,
193
+ 41,
194
+ 42,
195
+ 43,
196
+ 44,
197
+ 45,
198
+ 56,
199
+ 57,
200
+ 62,
201
+ 63,
202
+ 68,
203
+ 69,
204
+ 74,
205
+ 75,
206
+ 76,
207
+ 77,
208
+ 78,
209
+ 79,
210
+ 80,
211
+ 81,
212
+ 92,
213
+ 93,
214
+ 98,
215
+ 99,
216
+ 112,
217
+ 113,
218
+ 128,
219
+ 129,
220
+ 134,
221
+ 135,
222
+ 148,
223
+ 149,
224
+ 160,
225
+ 161,
226
+ 162,
227
+ 163,
228
+ 164,
229
+ 165,
230
+ 166,
231
+ 167,
232
+ 168,
233
+ 169,
234
+ 170,
235
+ 171,
236
+ 172,
237
+ 173,
238
+ 178,
239
+ 179,
240
+ 184,
241
+ 185,
242
+ 196,
243
+ 197,
244
+ 198,
245
+ 199,
246
+ 200,
247
+ 201,
248
+ 202,
249
+ 203,
250
+ 204,
251
+ 205,
252
+ 206,
253
+ 207,
254
+ 208,
255
+ 209,
256
+ 214,
257
+ 215,
258
+ 220,
259
+ 221
260
+ ] : [6, 2, 3, 4, 5, 1];
261
+ function shouldUseColors() {
262
+ return import_node_tty.default.isatty(process.stderr.fd) || !!process.env.FORCE_COLOR;
263
+ }
264
+ __name(shouldUseColors, "shouldUseColors");
265
+ function getDate() {
266
+ return (/* @__PURE__ */ new Date()).toISOString();
267
+ }
268
+ __name(getDate, "getDate");
269
+ function log(...args) {
270
+ return process.stderr.write(import_node_util.default.format(...args) + "\n");
271
+ }
272
+ __name(log, "log");
273
+ function createFormatters(useColors, inspectOpts = {}) {
274
+ return {
275
+ o: /* @__PURE__ */ __name(function(v) {
276
+ return import_node_util.default.inspect(v, Object.assign({}, inspectOpts, {
277
+ colors: useColors
278
+ })).split("\n").map((str) => str.trim()).join(" ");
279
+ }, "o"),
280
+ O: /* @__PURE__ */ __name(function(v) {
281
+ return import_node_util.default.inspect(v, Object.assign({}, inspectOpts, {
282
+ colors: shouldUseColors()
283
+ }));
284
+ }, "O")
285
+ };
286
+ }
287
+ __name(createFormatters, "createFormatters");
288
+ var randomNamespace = "";
289
+ function createDebug(namespace, env) {
290
+ let prevTime = Number(/* @__PURE__ */ new Date());
291
+ if (!randomNamespace) randomNamespace = generateRandomString(10);
292
+ const _namespace = namespace || randomNamespace;
293
+ const color = selectColor(_namespace, colors);
294
+ function debug(...args) {
295
+ if (isEnabled(namespace, env)) {
296
+ return logger(namespace || "DEV", args, { prevTime, color });
297
+ }
298
+ }
299
+ __name(debug, "debug");
300
+ debug.extend = function(extension) {
301
+ const extendedNamespace = _namespace + ":" + extension;
302
+ return createDebug(extendedNamespace, env);
303
+ };
304
+ return debug;
305
+ }
306
+ __name(createDebug, "createDebug");
307
+ createDebug.shouldLog = function(envString) {
308
+ return envString && (envString === "development" || envString === "test");
309
+ };
310
+ var node_default = createDebug;
311
+ function logger(namespace, args, { prevTime, color }) {
312
+ const curr = Number(/* @__PURE__ */ new Date());
313
+ const diff = curr - (prevTime || curr);
314
+ prevTime = curr;
315
+ args[0] = coerce(args[0]);
316
+ const formatters = createFormatters(shouldUseColors());
317
+ if (typeof args[0] !== "string") {
318
+ args.unshift("%O");
319
+ }
320
+ let index = 0;
321
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
322
+ if (match === "%%") return "%";
323
+ index++;
324
+ const formatter = formatters[format];
325
+ if (typeof formatter === "function") {
326
+ const val = args[index];
327
+ match = formatter.call(self, val);
328
+ args.splice(index, 1);
329
+ index--;
330
+ }
331
+ return match;
332
+ });
333
+ const _args = formatArgs({
334
+ diff,
335
+ color,
336
+ useColors: shouldUseColors(),
337
+ namespace
338
+ }, args);
339
+ log(..._args);
340
+ }
341
+ __name(logger, "logger");
342
+ function isEnabled(namespace, _env) {
343
+ const env = _env || process.env;
344
+ if (!namespace) {
345
+ return !!createDebug.shouldLog(env.NODE_ENV);
346
+ }
347
+ if (!env.DEBUG) return false;
348
+ const envVars = createRegexFromEnvVar(env.DEBUG);
349
+ return envVars.some((regex) => regex.test(namespace));
350
+ }
351
+ __name(isEnabled, "isEnabled");
352
+ function formatArgs({ diff, color, namespace, useColors }, args) {
353
+ args = args || [];
354
+ if (useColors) {
355
+ const c = color;
356
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
357
+ const prefix = ` ${colorCode};1m${namespace} \x1B[0m`;
358
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
359
+ args.push(colorCode + "m+" + ms_default(diff) + "\x1B[0m");
360
+ } else {
361
+ args[0] = getDate() + " " + namespace + " " + args[0];
362
+ }
363
+ return args;
364
+ }
365
+ __name(formatArgs, "formatArgs");
366
+ function selectColor(namespace, colors2) {
367
+ let hash = 0;
368
+ for (let i = 0; i < namespace.length; i++) {
369
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
370
+ hash |= 0;
371
+ }
372
+ return colors2[Math.abs(hash) % colors2.length];
373
+ }
374
+ __name(selectColor, "selectColor");
375
+ // Annotate the CommonJS export names for ESM import in node:
376
+ 0 && (module.exports = {
377
+ createDebug
378
+ });
379
+ //# sourceMappingURL=node.cjs.map