@substrate-system/debug 0.9.13 → 0.9.17
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/README.md +45 -7
- package/dist/browser/index.cjs.map +2 -2
- package/dist/browser/index.d.ts +1 -4
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/index.min.cjs.map +2 -2
- package/dist/browser/index.min.js.map +2 -2
- package/dist/cloudflare/index.cjs +297 -0
- package/dist/cloudflare/index.cjs.map +7 -0
- package/dist/cloudflare/index.d.ts +6 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +276 -0
- package/dist/cloudflare/index.js.map +7 -0
- package/dist/cloudflare/index.min.cjs +2 -0
- package/dist/cloudflare/index.min.cjs.map +7 -0
- package/dist/cloudflare/index.min.js +2 -0
- package/dist/cloudflare/index.min.js.map +7 -0
- package/dist/common.d.ts +4 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/meta.json +2 -2
- package/dist/node.cjs.map +2 -2
- package/dist/node.js.map +2 -2
- package/dist/node.min.cjs +3 -3
- package/dist/node.min.cjs.map +2 -2
- package/dist/node.min.js.map +2 -2
- package/dist/noop.d.ts +1 -1
- package/dist/noop.d.ts.map +1 -1
- package/package.json +17 -6
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
[](https://bundlephobia.com/package/@substrate-system/web-component)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
+
* [x] Cloudflare
|
|
11
|
+
* [x] Node
|
|
12
|
+
* [x] browsers
|
|
10
13
|
|
|
11
14
|
A tiny JavaScript debugging utility that works in Node.js and browsers.
|
|
12
15
|
Use environment variables to control logging in Node.js, and `localStorage`
|
|
@@ -20,7 +23,7 @@ In Node.js, it uses the environment variable `DEBUG`.
|
|
|
20
23
|
|
|
21
24
|
**Featuring:**
|
|
22
25
|
* Use [exports](https://github.com/substrate-system/debug/blob/main/package.json#L31)
|
|
23
|
-
field in `package.json` to choose node JS or
|
|
26
|
+
field in `package.json` to choose node JS, browser, or cloudflare version
|
|
24
27
|
* ESM only
|
|
25
28
|
|
|
26
29
|
Plus, [see the docs](https://substrate-system.github.io/debug/)
|
|
@@ -33,6 +36,7 @@ generated by typescript.
|
|
|
33
36
|
- [Install](#install)
|
|
34
37
|
- [Browser](#browser)
|
|
35
38
|
* [Factor out of production](#factor-out-of-production)
|
|
39
|
+
- [Cloudflare](#cloudflare)
|
|
36
40
|
- [Node JS](#node-js)
|
|
37
41
|
- [Config](#config)
|
|
38
42
|
* [Namespace](#namespace)
|
|
@@ -43,7 +47,10 @@ generated by typescript.
|
|
|
43
47
|
* [browser](#browser)
|
|
44
48
|
* [Run the Node example](#run-the-node-example)
|
|
45
49
|
- [Test](#test)
|
|
50
|
+
* [All tests](#all-tests)
|
|
46
51
|
* [Node](#node)
|
|
52
|
+
* [Cloudlfare](#cloudlfare)
|
|
53
|
+
* [Browsers](#browsers)
|
|
47
54
|
|
|
48
55
|
<!-- tocstop -->
|
|
49
56
|
|
|
@@ -93,11 +100,26 @@ if (import.meta.env.DEV) {
|
|
|
93
100
|
> [!NOTE]
|
|
94
101
|
> We export `noop` here; it has the same type signature as `debug`.
|
|
95
102
|
|
|
103
|
+
## Cloudflare
|
|
104
|
+
|
|
105
|
+
Either pass in an env record, or will look at `globalThis` for
|
|
106
|
+
the `DEBUG` variable.
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import Debug from '@substrate-system/debug/cloudflare'
|
|
110
|
+
|
|
111
|
+
const myEnvVar = {
|
|
112
|
+
DEBUG: 'abc:*'
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const debug = Debug('abc:123', myEnvVar)
|
|
116
|
+
```
|
|
117
|
+
|
|
96
118
|
## Node JS
|
|
119
|
+
|
|
97
120
|
Run your script with an env variable, `DEBUG`.
|
|
98
121
|
|
|
99
122
|
```js
|
|
100
|
-
// in node JS
|
|
101
123
|
import createDebug from '@substrate-system/debug/node'
|
|
102
124
|
const debug = createDebug('fooo')
|
|
103
125
|
debug('testing')
|
|
@@ -146,9 +168,9 @@ const log = Debug('auth')
|
|
|
146
168
|
const logSign = log.extend('sign')
|
|
147
169
|
const logLogin = log.extend('login')
|
|
148
170
|
|
|
149
|
-
log('hello')
|
|
150
|
-
logSign('hello')
|
|
151
|
-
logLogin('hello')
|
|
171
|
+
log('hello') // auth hello
|
|
172
|
+
logSign('hello') // auth:sign hello
|
|
173
|
+
logLogin('hello') // auth:login hello
|
|
152
174
|
```
|
|
153
175
|
|
|
154
176
|
Chained extending is also supported:
|
|
@@ -193,10 +215,26 @@ npm run example:node
|
|
|
193
215
|
|
|
194
216
|
## Test
|
|
195
217
|
|
|
218
|
+
### All tests
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
npm test
|
|
222
|
+
```
|
|
223
|
+
|
|
196
224
|
### Node
|
|
197
225
|
|
|
198
|
-
|
|
226
|
+
```sh
|
|
227
|
+
npm run test:node
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Cloudlfare
|
|
199
231
|
|
|
200
232
|
```sh
|
|
201
|
-
npm test
|
|
233
|
+
npm run test:cloudflare
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Browsers
|
|
237
|
+
|
|
238
|
+
```sh
|
|
239
|
+
npm run test:browser
|
|
202
240
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 '#FFC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WAAW,SAAS,IAAI;AAC5B,aAAO,KAAK,MAAM,KAAK,CAAC,IAAI,MAAM,QAAQ,WAAW,MAAM;AAAA,IAC7D;AAHS;AAAA;AAAA;;;AC9JT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;;;ACMd,SAAS,OAAQ,KAAoB;AACxC,MAAI,eAAe,OAAO;AACtB,WAAO,IAAI,SAAS,IAAI;AAAA,EAC5B;AAEA,SAAO,OAAO,GAAG;AACrB;AANgB;AAaT,SAAS,YACZ,WACAC,SACY;AACZ,MAAI,OAAO;AAEX,WAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AACvC,YAAS,QAAQ,KAAK,OAAQ,UAAU,WAAW,CAAC;AACpD,YAAQ;AAAA,EACZ;AAEA,SAAOA,QAAO,KAAK,IAAI,IAAI,IAAIA,QAAO,MAAM;AAChD;AAZgB;AAcT,SAAS,sBAAuB,OAAuB;AAC1D,QAAM,QAAQ,MAAM,MAAM,QAAQ,EAAE,OAAO,OAAO;AAClD,QAAM,SAAS,MACV,IAAI,UAAQ,KAAK,QAAQ,OAAO,KAAK,CAAC,EACtC,IAAI,OAAK,IAAI,OAAO,MAAM,IAAI,GAAG,CAAC;AAEvC,SAAO;AACX;AAPgB;
|
|
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 type Debugger\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\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\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\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 './common.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,sCAAAA,SAAA;AAAA;AAIA,QAAI,IAAI;AACR,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ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ACL,YAAY,QAAQ,OACrB,UAAM,UAAAC,SAAS,MAAM,CAAC,CAAC;AAE3B,MAAI,CAAC,UAAW;AAEhB,QAAM,IAAI,YAAY;AACtB,OAAK,OAAO,GAAG,GAAG,GAAG,gBAAgB;AAKrC,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,OAAK,CAAC,EAAE,QAAQ,eAAe,WAAS;AACpC,QAAI,UAAU,MAAM;AAChB;AAAA,IACJ;AACA;AACA,QAAI,UAAU,MAAM;AAGhB,cAAQ;AAAA,IACZ;AAAA,EACJ,CAAC;AAED,OAAK,OAAO,OAAO,GAAG,CAAC;AAEvB,SAAO;AACX;AAtCS;AAwCT,SAAS,YAAa,WAAoC;AACtD,MAAI,cAAc,MAAO,QAAO;AAChC,QAAM,WAAW,OAAO,oBAAI,KAAK,CAAC;AAClC,QAAM,QAAQ;AAAA,IACV,OAAO,cAAc,WAAW,YAAY,qBAAqB,EAAE;AAAA,IACnE;AAAA,EACJ;AAGA,QAAM,gBAAgB,cAAc;AACpC,QAAM,kBAAkB,OAAO,cAAc,WAAW,YAAY;AAEpE,QAAM,QAAQ,mCAAa,MAAY;AACnC,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA,EAAE,UAAU,MAAM;AAAA,MAClB;AAAA,IACJ;AAAA,EACJ,GAPc;AASd,QAAM,SAAS,SAAU,WAA6B;AAClD,UAAM,oBAAoB,kBAAkB,MAAM;AAClD,WAAO,YAAY,iBAAiB;AAAA,EACxC;AAEA,SAAO;AACX;AA3BS;",
|
|
6
6
|
"names": ["module", "colors", "humanize"]
|
|
7
7
|
}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import { type Debugger } from '../common.js';
|
|
1
2
|
export { createDebug };
|
|
2
3
|
export default createDebug;
|
|
3
|
-
export type Debugger = {
|
|
4
|
-
(...args: any[]): void;
|
|
5
|
-
extend: (namespace: string) => Debugger;
|
|
6
|
-
};
|
|
7
4
|
declare function createDebug(namespace?: string | boolean): Debugger;
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AACA,OAAO,EAKH,KAAK,QAAQ,EAChB,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,WAAW,EAAE,CAAA;AACtB,eAAe,WAAW,CAAA;AA2K1B,iBAAS,WAAW,CAAE,SAAS,CAAC,EAAC,MAAM,GAAC,OAAO,GAAE,QAAQ,CA2BxD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAIA,QAAI,IAAI;AACR,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AAgBZ,WAAO,UAAU,SAAU,KAAK,SAAS;AACvC,gBAAU,WAAW,CAAC;AACtB,UAAI,OAAO,OAAO;AAClB,UAAI,SAAS,YAAY,IAAI,SAAS,GAAG;AACvC,eAAO,MAAM,GAAG;AAAA,MAClB,WAAW,SAAS,YAAY,SAAS,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,QAAO,KAAK,IAAI,IAAI,IAAIA,QAAO,MAAM;AAChD;AAZgB;AAcT,SAAS,sBAAuB,OAAuB;AAC1D,QAAM,QAAQ,MAAM,MAAM,QAAQ,EAAE,OAAO,OAAO;AAClD,QAAM,SAAS,MACV,IAAI,UAAQ,KAAK,QAAQ,OAAO,KAAK,CAAC,EACtC,IAAI,OAAK,IAAI,OAAO,MAAM,IAAI,GAAG,CAAC;AAEvC,SAAO;AACX;AAPgB;
|
|
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 type Debugger\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\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\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\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 './common.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAIA,QAAI,IAAI;AACR,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AACZ,QAAI,IAAI,IAAI;AAgBZ,WAAO,UAAU,SAAU,KAAK,SAAS;AACvC,gBAAU,WAAW,CAAC;AACtB,UAAI,OAAO,OAAO;AAClB,UAAI,SAAS,YAAY,IAAI,SAAS,GAAG;AACvC,eAAO,MAAM,GAAG;AAAA,MAClB,WAAW,SAAS,YAAY,SAAS,GAAG,GAAG;AAC7C,eAAO,QAAQ,OAAO,QAAQ,GAAG,IAAI,SAAS,GAAG;AAAA,MACnD;AACA,YAAM,IAAI;AAAA,QACR,0DACE,KAAK,UAAU,GAAG;AAAA,MACtB;AAAA,IACF;AAUA,aAAS,MAAM,KAAK;AAClB,YAAM,OAAO,GAAG;AAChB,UAAI,IAAI,SAAS,KAAK;AACpB;AAAA,MACF;AACA,UAAI,QAAQ,mIAAmI;AAAA,QAC7I;AAAA,MAC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,WAAW,YAAY,qBAAqB,EAAE;AAAA,IACnE;AAAA,EACJ;AAGA,QAAM,gBAAgB,cAAc;AACpC,QAAM,kBAAkB,OAAO,cAAc,WAAW,YAAY;AAEpE,QAAM,QAAQ,mCAAa,MAAY;AACnC,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA,EAAE,UAAU,MAAM;AAAA,MAClB;AAAA,IACJ;AAAA,EACJ,GAPc;AASd,QAAM,SAAS,SAAU,WAA6B;AAClD,UAAM,oBAAoB,kBAAkB,MAAM;AAClD,WAAO,YAAY,iBAAiB;AAAA,EACxC;AAEA,SAAO;AACX;AA3BS;",
|
|
6
6
|
"names": ["colors", "humanize"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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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\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 type Debugger\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\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\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\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 './common.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 '#F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AAqB,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
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
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 '#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AAU,WAAWG,CAAC,EACpDD,GAAQ,EAGZ,OAAOD,EAAO,KAAK,IAAIC,CAAI,EAAID,EAAO,MAAM,CAChD,CAZgBH,EAAAC,EAAA,eAcT,SAASK,EAAuBC,EAAuB,CAM1D,OALcA,EAAM,MAAM,QAAQ,EAAE,OAAO,OAAO,EAE7C,IAAIC,GAAQA,EAAK,QAAQ,MAAO,KAAK,CAAC,EACtC,IAAIC,GAAK,IAAI,OAAO,IAAMA,EAAI,GAAG,CAAC,CAG3C,CAPgBT,EAAAM,EAAA,
|
|
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 type Debugger\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\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\nexport type Debugger = {\n (...args: any[]): void;\n extend: (namespace: string) => Debugger;\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 './common.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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EAAK,CAAC,EAAE,QAAQ,cAAeQ,GAAS,CAChCA,IAAU,OAGdD,IACIC,IAAU,OAGVW,EAAQZ,GAEhB,CAAC,EAEDP,EAAK,OAAOmB,EAAO,EAAGD,CAAC,EAEhBlB,CACX,CAtCSL,EAAAkB,EAAA,cAwCT,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
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
7
|
}
|