nightingale-browser-console 12.1.0 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/root-commonjs"],
3
+ "extends": ["@pob/eslint-config/root-module"],
4
4
  "env": {
5
5
  "browser": true
6
6
  },
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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
+ ## [12.1.1](https://github.com/christophehurpeau/nightingale/compare/v12.1.0...v12.1.1) (2022-01-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * properly configure package type ([2e0cbf5](https://github.com/christophehurpeau/nightingale/commit/2e0cbf555bd3b9fa3c3851025452937f64408aa8))
12
+
13
+
14
+
15
+
16
+
6
17
  # [12.1.0](https://github.com/christophehurpeau/nightingale/compare/v12.0.1...v12.1.0) (2021-12-15)
7
18
 
8
19
  **Note:** Version bump only for package nightingale-browser-console
@@ -15,7 +15,7 @@ function getDebugString() {
15
15
 
16
16
  var debugFromQueryString = decodeURI(querystring.replace( // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
17
17
  new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'), '$1'));
18
- return (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') + debugFromQueryString;
18
+ return (debugFromLocalStorage ? debugFromLocalStorage + "," : '') + debugFromQueryString;
19
19
  }
20
20
 
21
21
  var findDebugLevel = function findDebugLevel(minLevel, key) {
@@ -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, prefer-regex-literals\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"],"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,GAAI,GAAEA,qBAAsB,GAA5B,GAAiC,EAAvD,IACAI,oBAFF;AAID;;ACRD,IAAMI,cAAc,GAAG,SAAjBA,cAAiB,CAACC,QAAD,EAAkBC,GAAlB;AAAA,SACrBC,oBAAoB,CAAChB,cAAc,EAAf,CAApB,CAAuCc,QAAvC,EAAiDC,GAAjD,CADqB;AAAA,CAAvB;;AAKA,IAAME,eAAe,GAAG,SAAlBA,eAAkB,GAAa;AACnC,MAAI;AACF,QAAMC,oBAAoB,GAAGX,YAAY,CAACC,OAAb,CAAqB,mBAArB,CAA7B;;AACA,QAAIU,oBAAoB,IAAIA,oBAAoB,KAAK,MAArD,EAA6D;AAC3D,aAAOA,oBAAP;AACD;AACF,GALD,CAKE,gBAAM;;AACR,SAAO,OAAP;AACD,CARD;;AAUA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAA8C;AAAA,MAA7CA,KAA6C;AAA7CA,IAAAA,KAA6C,GAA9BH,eAAe,EAAe;AAAA;;AAClE,MAAMI,uBAAuB,GAAGC,6BAA6B,CAACF,KAAD,CAA7D;AACA,SAAO,UAAqBG,MAArB,EAA8C;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAD,CAAxB,EAAkCA,MAAlC,CAAb;AACD,GAFD;AAGD,CALD;;IAWaE,qBAAb,GAOE,+BAAYX,QAAZ,EAA6BY,OAA7B,EAAyE;AAAA,MAA5CA,OAA4C;AAA5CA,IAAAA,OAA4C,GAAJ,EAAI;AAAA;;AAAA,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;;;;"}
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, prefer-regex-literals\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"],"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,CAF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,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-browser-console",
3
- "version": "12.1.0",
3
+ "version": "12.1.1",
4
4
  "description": "Browser console handler for nightingale",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/nightingale-browser-console"
15
15
  },
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
- "type": "commonjs",
17
+ "type": "module",
18
18
  "browserslist": [
19
19
  "defaults",
20
20
  "> 0.2%",
@@ -72,17 +72,17 @@
72
72
  ]
73
73
  },
74
74
  "dependencies": {
75
- "nightingale-browser-console-formatter": "12.1.0",
76
- "nightingale-console-output": "12.1.0",
77
- "nightingale-debug": "12.1.0",
78
- "nightingale-types": "12.1.0"
75
+ "nightingale-browser-console-formatter": "12.1.1",
76
+ "nightingale-console-output": "12.1.1",
77
+ "nightingale-debug": "12.1.1",
78
+ "nightingale-types": "12.1.1"
79
79
  },
80
80
  "devDependencies": {
81
- "@babel/core": "7.16.0",
82
- "@babel/preset-env": "7.16.4",
81
+ "@babel/core": "7.16.7",
82
+ "@babel/preset-env": "7.16.7",
83
83
  "babel-preset-modern-browsers": "15.0.2",
84
- "pob-babel": "29.4.2",
84
+ "pob-babel": "29.6.1",
85
85
  "typescript": "4.5.4"
86
86
  },
87
- "gitHead": "f2f75856d32f444f0ed08b5ab903537cb1f4c38f"
87
+ "gitHead": "719598e0a3d508801b18542a1054301200b62ed0"
88
88
  }