nightingale-browser-console 11.7.1 → 11.7.2
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/.eslintrc.json +1 -1
- package/CHANGELOG.md +8 -0
- package/README.md +11 -0
- package/dist/index-browser-dev.es.js +3 -4
- package/dist/index-browser-dev.es.js.map +1 -1
- package/dist/index-browser.es.js +3 -4
- package/dist/index-browser.es.js.map +1 -1
- package/dist/index-browsermodern-dev.es.js +2 -3
- package/dist/index-browsermodern-dev.es.js.map +1 -1
- package/dist/index-browsermodern.es.js +2 -3
- package/dist/index-browsermodern.es.js.map +1 -1
- package/package.json +14 -23
- package/rollup.config.mjs +3 -0
- package/src/index.ts +1 -1
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.2](https://github.com/christophehurpeau/nightingale/compare/v11.7.1...v11.7.2) (2021-11-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package nightingale-browser-console
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.1](https://github.com/christophehurpeau/nightingale/compare/v11.7.0...v11.7.1) (2021-06-29)
|
|
7
15
|
|
|
8
16
|
|
package/README.md
CHANGED
|
@@ -68,3 +68,14 @@ localStorage.debug = '*,-app:*'; // debug everything except app and all its chil
|
|
|
68
68
|
?DEBUG=*,-app // debug everything except app
|
|
69
69
|
?DEBUG=*,-app:* // debug everything except app and all its children
|
|
70
70
|
```
|
|
71
|
+
|
|
72
|
+
## Use source maps to display error stack trace
|
|
73
|
+
|
|
74
|
+
In production:
|
|
75
|
+
|
|
76
|
+
Send your log to an external tool like [sentry](https://sentry.io/). Sentry allows you to send the source maps after building (if you use webpack, you can use `hidden-source-map` to generate `.map` files, send them to sentry, and remove them so they are not accessible).
|
|
77
|
+
|
|
78
|
+
In development:
|
|
79
|
+
|
|
80
|
+
- Configure your build tool to generate sourcemaps. For webpack: use proper [`devtool` configuration](https://webpack.js.org/configuration/devtool/). For best stack trace, use `source-map` but it's the slowest option.
|
|
81
|
+
- Make sure your project uses [source-map-support](https://www.npmjs.com/package/source-map-support) or similar tool. If not, you can install and simply import `source-map-support/register`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';
|
|
2
2
|
import consoleOutput from 'nightingale-console-output';
|
|
3
|
-
import createFindDebugLevel from 'nightingale-debug';
|
|
3
|
+
import { createFindDebugLevel } from 'nightingale-debug';
|
|
4
4
|
|
|
5
5
|
function getDebugString() {
|
|
6
6
|
var _document$location;
|
|
@@ -15,7 +15,7 @@ function getDebugString() {
|
|
|
15
15
|
|
|
16
16
|
var debugFromQueryString = decodeURI(querystring.replace( // eslint-disable-next-line unicorn/no-unsafe-regex
|
|
17
17
|
new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'), '$1'));
|
|
18
|
-
return (debugFromLocalStorage ? debugFromLocalStorage
|
|
18
|
+
return (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') + debugFromQueryString;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
var findDebugLevel = function findDebugLevel(minLevel, key) {
|
|
@@ -59,6 +59,5 @@ var BrowserConsoleHandler = function BrowserConsoleHandler(minLevel, options) {
|
|
|
59
59
|
this.handle = createHandler(options.theme);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export default
|
|
63
|
-
export { BrowserConsoleHandler };
|
|
62
|
+
export { BrowserConsoleHandler, BrowserConsoleHandler as default };
|
|
64
63
|
//# sourceMappingURL=index-browser-dev.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser-dev.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,MAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,qBAAG,mBAAmBC,MAAvC;AACA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC,OAAb,CAAqB,OAArB,CAAxB,IAA0D,EAD5D;;AAGA,MAAI,CAACP,WAAL,EAAkB;AAChB,WAAOI,qBAAP;AACD,GAPsC;;;AAUvC,MAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAZ;AAEE,MAAIC,MAAJ,CAAW,uCAAX,EAAoD,GAApD,CAFF,EAGE,IAHF,CADoC,CAAtC;AAQA,SACE,CAACP,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index-browser-dev.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,MAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,qBAAG,mBAAmBC,MAAvC;AACA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,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A,OANzEZ,QAMyE,GANvD,CAMuD;;AACvE,OAAKa,UAAL,GAAkB,UAACC,KAAD,EAAeb,GAAf;AAAA,WAChBa,KAAK,IAAIf,cAAc,CAACC,QAAD,EAAWC,GAAX,CADP;AAAA,GAAlB;;AAGA,OAAKc,MAAL,GAAcV,aAAa,CAACO,OAAO,CAACN,KAAT,CAA3B;AACD;;;;"}
|
package/dist/index-browser.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';
|
|
2
2
|
import consoleOutput from 'nightingale-console-output';
|
|
3
|
-
import createFindDebugLevel from 'nightingale-debug';
|
|
3
|
+
import { createFindDebugLevel } from 'nightingale-debug';
|
|
4
4
|
|
|
5
5
|
function getDebugString() {
|
|
6
6
|
var _document$location;
|
|
@@ -15,7 +15,7 @@ function getDebugString() {
|
|
|
15
15
|
|
|
16
16
|
var debugFromQueryString = decodeURI(querystring.replace( // eslint-disable-next-line unicorn/no-unsafe-regex
|
|
17
17
|
new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'), '$1'));
|
|
18
|
-
return (debugFromLocalStorage ? debugFromLocalStorage
|
|
18
|
+
return (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') + debugFromQueryString;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
var findDebugLevel = function findDebugLevel(minLevel, key) {
|
|
@@ -59,6 +59,5 @@ var BrowserConsoleHandler = function BrowserConsoleHandler(minLevel, options) {
|
|
|
59
59
|
this.handle = createHandler(options.theme);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export default
|
|
63
|
-
export { BrowserConsoleHandler };
|
|
62
|
+
export { BrowserConsoleHandler, BrowserConsoleHandler as default };
|
|
64
63
|
//# sourceMappingURL=index-browser.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,MAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,qBAAG,mBAAmBC,MAAvC;AACA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC,OAAb,CAAqB,OAArB,CAAxB,IAA0D,EAD5D;;AAGA,MAAI,CAACP,WAAL,EAAkB;AAChB,WAAOI,qBAAP;AACD,GAPsC;;;AAUvC,MAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAZ;AAEE,MAAIC,MAAJ,CAAW,uCAAX,EAAoD,GAApD,CAFF,EAGE,IAHF,CADoC,CAAtC;AAQA,SACE,CAACP,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index-browser.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,MAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,qBAAG,mBAAmBC,MAAvC;AACA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC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ANvD,CAMuD;;AACvE,OAAKa,UAAL,GAAkB,UAACC,KAAD,EAAeb,GAAf;AAAA,WAChBa,KAAK,IAAIf,cAAc,CAACC,QAAD,EAAWC,GAAX,CADP;AAAA,GAAlB;;AAGA,OAAKc,MAAL,GAAcV,aAAa,CAACO,OAAO,CAACN,KAAT,CAA3B;AACD;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';
|
|
2
2
|
import consoleOutput from 'nightingale-console-output';
|
|
3
|
-
import createFindDebugLevel from 'nightingale-debug';
|
|
3
|
+
import { createFindDebugLevel } from 'nightingale-debug';
|
|
4
4
|
|
|
5
5
|
function getDebugString() {
|
|
6
6
|
var _document$location;
|
|
@@ -50,6 +50,5 @@ class BrowserConsoleHandler {
|
|
|
50
50
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export default
|
|
54
|
-
export { BrowserConsoleHandler };
|
|
53
|
+
export { BrowserConsoleHandler, BrowserConsoleHandler as default };
|
|
55
54
|
//# sourceMappingURL=index-browsermodern-dev.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browsermodern-dev.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,QAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,uDAAG,mBAAmBC,MAAvC;AACA,QAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAAC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Aa,CAACQ,OAAO,CAACP,KAAT,CAA3B;AACD;;AAZmD
|
|
1
|
+
{"version":3,"file":"index-browsermodern-dev.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,QAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,uDAAG,mBAAmBC,MAAvC;AACA,QAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC,OAAb,CAAqB,OAArB,CAAxB,IAA0D,EAD5D;;AAGA,MAAI,CAACP,WAAL,EAAkB;AAChB,WAAOI,qBAAP;AACD,GAPsC;;;AAUvC,QAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAZ;AAEE,MAAIC,MAAJ,CAAW,uCAAX,EAAoD,GAApD,CAFF,EAGE,IAHF,CADoC,CAAtC;AAQA,SACE,CAACP,qBAAqB,GAAI,GAAEA,qBAAsB,GAA5B,GAAiC,EAAvD,IACAI,oBAFF;AAID;;ACRD,MAAMI,cAAc,GAAG,CAACC,QAAD,EAAkBC,GAAlB,KACrBC,oBAAoB,CAAChB,cAAc,EAAf,CAApB,CAAuCc,QAAvC,EAAiDC,GAAjD,CADF;;AAKA,MAAME,eAAe,GAAG,MAAa;AACnC,MAAI;AACF,UAAMC,oBAAoB,GAAGX,YAAY,CAACC,OAAb,CAAqB,mBAArB,CAA7B;;AACA,QAAIU,oBAAoB,IAAIA,oBAAoB,KAAK,MAArD,EAA6D;AAC3D,aAAOA,oBAAP;AACD;AACF,GALD,CAKE,MAAM;;AACR,SAAO,OAAP;AACD,CARD;;AAUA,MAAMC,aAAa,GAAG,CAACC,KAAY,GAAGH,eAAe,EAA/B,KAA8C;AAClE,QAAMI,uBAAuB,GAAGC,6BAA6B,CAACF,KAAD,CAA7D;AACA,SAA4BG,MAArB,IAA8C;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAD,CAAxB,EAAkCA,MAAlC,CAAb;AACD,GAFD;AAGD,CALD;;AAWO,MAAME,qBAAN,CAA+C;AAOpDC,EAAAA,WAAW,CAACZ,QAAD,EAAkBa,OAAqC,GAAG,EAA1D,EAA8D;AAAA,SANzEb,QAMyE,GANvD,CAMuD;;AACvE,SAAKc,UAAL,GAAkB,CAACC,KAAD,EAAed,GAAf,KAChBc,KAAK,IAAIhB,cAAc,CAACC,QAAD,EAAWC,GAAX,CADzB;;AAGA,SAAKe,MAAL,GAAcX,aAAa,CAACQ,OAAO,CAACP,KAAT,CAA3B;AACD;;AAZmD;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';
|
|
2
2
|
import consoleOutput from 'nightingale-console-output';
|
|
3
|
-
import createFindDebugLevel from 'nightingale-debug';
|
|
3
|
+
import { createFindDebugLevel } from 'nightingale-debug';
|
|
4
4
|
|
|
5
5
|
function getDebugString() {
|
|
6
6
|
var _document$location;
|
|
@@ -50,6 +50,5 @@ class BrowserConsoleHandler {
|
|
|
50
50
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export default
|
|
54
|
-
export { BrowserConsoleHandler };
|
|
53
|
+
export { BrowserConsoleHandler, BrowserConsoleHandler as default };
|
|
55
54
|
//# sourceMappingURL=index-browsermodern.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browsermodern.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,QAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,uDAAG,mBAAmBC,MAAvC;AACA,QAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC,OAAb,CAAqB,OAArB,CAAxB,IAA0D,EAD5D;;AAGA,MAAI,CAACP,WAAL,EAAkB;AAChB,WAAOI,qBAAP;AACD,GAPsC;;;AAUvC,QAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAZ;AAEE,MAAIC,MAAJ,CAAW,uCAAX,EAAoD,GAApD,CAFF,EAGE,IAHF,CADoC,CAAtC;AAQA,SACE,CAACP,qBAAqB,GAAI,GAAEA,qBAAsB,GAA5B,GAAiC,EAAvD,IACAI,oBAFF;AAID;;ACRD,MAAMI,cAAc,GAAG,CAACC,QAAD,EAAkBC,GAAlB,KACrBC,oBAAoB,CAAChB,cAAc,EAAf,CAApB,CAAuCc,QAAvC,EAAiDC,GAAjD,CADF;;AAKA,MAAME,eAAe,GAAG,MAAa;AACnC,MAAI;AACF,UAAMC,oBAAoB,GAAGX,YAAY,CAACC,OAAb,CAAqB,mBAArB,CAA7B;;AACA,QAAIU,oBAAoB,IAAIA,oBAAoB,KAAK,MAArD,EAA6D;AAC3D,aAAOA,oBAAP;AACD;AACF,GALD,CAKE,MAAM;;AACR,SAAO,OAAP;AACD,CARD;;AAUA,MAAMC,aAAa,GAAG,CAACC,KAAY,GAAGH,eAAe,EAA/B,KAA8C;AAClE,QAAMI,uBAAuB,GAAGC,6BAA6B,CAACF,KAAD,CAA7D;AACA,SAA4BG,MAArB,IAA8C;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAD,CAAxB,EAAkCA,MAAlC,CAAb;AACD,GAFD;AAGD,CALD;;AAWO,MAAME,qBAAN,CAA+C;AAOpDC,EAAAA,WAAW,CAACZ,QAAD,EAAkBa,OAAqC,GAAG,EAA1D,EAA8D;AAAA,SANzEb,QAMyE,GANvD,CAMuD;;AACvE,SAAKc,UAAL,GAAkB,CAACC,KAAD,EAAed,GAAf,KAChBc,KAAK,IAAIhB,cAAc,CAACC,QAAD,EAAWC,GAAX,CADzB;;AAGA,SAAKe,MAAL,GAAcX,aAAa,CAACQ,OAAO,CAACP,KAAT,CAA3B;AACD;;AAZmD
|
|
1
|
+
{"version":3,"file":"index-browsermodern.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'light' | 'dark';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\ninterface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n\n/** @deprecated use named export instead */\nexport default BrowserConsoleHandler;\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAT,GAAkC;AAAA;;AACvC,QAAMC,WAAW,yBAAGC,QAAQ,CAACC,QAAZ,uDAAG,mBAAmBC,MAAvC;AACA,QAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAP,IAAuBA,YAAY,CAACC,OAAb,CAAqB,OAArB,CAAxB,IAA0D,EAD5D;;AAGA,MAAI,CAACP,WAAL,EAAkB;AAChB,WAAOI,qBAAP;AACD,GAPsC;;;AAUvC,QAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAZ;AAEE,MAAIC,MAAJ,CAAW,uCAAX,EAAoD,GAApD,CAFF,EAGE,IAHF,CADoC,CAAtC;AAQA,SACE,CAACP,qBAAqB,GAAI,GAAEA,qBAAsB,GAA5B,GAAiC,EAAvD,IACAI,oBAFF;AAID;;ACRD,MAAMI,cAAc,GAAG,CAACC,QAAD,EAAkBC,GAAlB,KACrBC,oBAAoB,CAAChB,cAAc,EAAf,CAApB,CAAuCc,QAAvC,EAAiDC,GAAjD,CADF;;AAKA,MAAME,eAAe,GAAG,MAAa;AACnC,MAAI;AACF,UAAMC,oBAAoB,GAAGX,YAAY,CAACC,OAAb,CAAqB,mBAArB,CAA7B;;AACA,QAAIU,oBAAoB,IAAIA,oBAAoB,KAAK,MAArD,EAA6D;AAC3D,aAAOA,oBAAP;AACD;AACF,GALD,CAKE,MAAM;;AACR,SAAO,OAAP;AACD,CARD;;AAUA,MAAMC,aAAa,GAAG,CAACC,KAAY,GAAGH,eAAe,EAA/B,KAA8C;AAClE,QAAMI,uBAAuB,GAAGC,6BAA6B,CAACF,KAAD,CAA7D;AACA,SAA4BG,MAArB,IAA8C;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAD,CAAxB,EAAkCA,MAAlC,CAAb;AACD,GAFD;AAGD,CALD;;AAWO,MAAME,qBAAN,CAA+C;AAOpDC,EAAAA,WAAW,CAACZ,QAAD,EAAkBa,OAAqC,GAAG,EAA1D,EAA8D;AAAA,SANzEb,QAMyE,GANvD,CAMuD;;AACvE,SAAKc,UAAL,GAAkB,CAACC,KAAD,EAAed,GAAf,KAChBc,KAAK,IAAIhB,cAAc,CAACC,QAAD,EAAWC,GAAX,CADzB;;AAGA,SAAKe,MAAL,GAAcX,aAAa,CAACQ,OAAO,CAACP,KAAT,CAA3B;AACD;;AAZmD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nightingale-browser-console",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.2",
|
|
4
4
|
"description": "Browser console handler for nightingale",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nightingale",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"directory": "packages/nightingale-browser-console"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/christophehurpeau/nightingale",
|
|
17
|
+
"type": "commonjs",
|
|
17
18
|
"browserslist": [
|
|
18
19
|
"defaults",
|
|
19
20
|
"> 0.2%",
|
|
@@ -21,11 +22,11 @@
|
|
|
21
22
|
"not safari < 10",
|
|
22
23
|
"not ios_saf < 10"
|
|
23
24
|
],
|
|
24
|
-
"main": "./dist/index-browser.es.js",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"module": "./dist/index-browser.es.js",
|
|
27
27
|
"browser": "./dist/index-browser.es.js",
|
|
28
28
|
"exports": {
|
|
29
|
+
"./package.json": "./package.json",
|
|
29
30
|
".": {
|
|
30
31
|
"browser": {
|
|
31
32
|
"browser:modern": {
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"build:definitions": "tsc -p tsconfig.build.json",
|
|
52
53
|
"clean": "rm -Rf docs dist test/node6 coverage",
|
|
53
54
|
"lint": "yarn run lint:eslint",
|
|
54
|
-
"lint:eslint": "
|
|
55
|
+
"lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-browser-console",
|
|
55
56
|
"watch": "pob-watch"
|
|
56
57
|
},
|
|
57
58
|
"prettier": {
|
|
@@ -80,28 +81,18 @@
|
|
|
80
81
|
]
|
|
81
82
|
},
|
|
82
83
|
"dependencies": {
|
|
83
|
-
"nightingale-browser-console-formatter": "^11.7.
|
|
84
|
-
"nightingale-console-output": "^11.7.
|
|
85
|
-
"nightingale-debug": "^11.7.
|
|
86
|
-
"nightingale-types": "^11.7.
|
|
84
|
+
"nightingale-browser-console-formatter": "^11.7.2",
|
|
85
|
+
"nightingale-console-output": "^11.7.2",
|
|
86
|
+
"nightingale-debug": "^11.7.2",
|
|
87
|
+
"nightingale-types": "^11.7.2"
|
|
87
88
|
},
|
|
88
89
|
"devDependencies": {
|
|
89
|
-
"@babel/core": "7.
|
|
90
|
-
"@babel/preset-env": "7.
|
|
91
|
-
"@pob/eslint-config": "43.2.0",
|
|
92
|
-
"@pob/eslint-config-node": "43.2.0",
|
|
93
|
-
"@pob/eslint-config-typescript": "43.2.0",
|
|
94
|
-
"@typescript-eslint/eslint-plugin": "4.28.1",
|
|
95
|
-
"@typescript-eslint/parser": "4.28.1",
|
|
90
|
+
"@babel/core": "7.16.0",
|
|
91
|
+
"@babel/preset-env": "7.16.4",
|
|
96
92
|
"babel-preset-modern-browsers": "15.0.2",
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"eslint-plugin-node": "11.1.0",
|
|
101
|
-
"eslint-plugin-unicorn": "29.0.0",
|
|
102
|
-
"pob-babel": "27.0.3",
|
|
103
|
-
"rollup": "2.52.3",
|
|
104
|
-
"typescript": "4.3.4"
|
|
93
|
+
"pob-babel": "28.5.0",
|
|
94
|
+
"rollup": "2.60.1",
|
|
95
|
+
"typescript": "4.5.2"
|
|
105
96
|
},
|
|
106
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "00b1ec6c7468b320e268a12eaac70d59a177787b"
|
|
107
98
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';
|
|
2
2
|
import consoleOutput from 'nightingale-console-output';
|
|
3
|
-
import createFindDebugLevel from 'nightingale-debug';
|
|
3
|
+
import { createFindDebugLevel } from 'nightingale-debug';
|
|
4
4
|
import type {
|
|
5
5
|
Level,
|
|
6
6
|
Handle,
|