nightingale-browser-console-formatter 12.1.4 → 14.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
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
+ ## [14.0.0](https://github.com/christophehurpeau/nightingale/compare/v13.0.0...v14.0.0) (2023-06-30)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **deps:** require node 18
12
+ * requires node 18
13
+
14
+ ### Features
15
+
16
+ * requires node 18 ([4452b11](https://github.com/christophehurpeau/nightingale/commit/4452b116188e58c293be85e462e04922f7ad51f0))
17
+
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * **deps:** update dependency @pob/root to v8 ([#760](https://github.com/christophehurpeau/nightingale/issues/760)) ([22dc3cc](https://github.com/christophehurpeau/nightingale/commit/22dc3cceabdfd465d04ee36fec8fdac31febab69))
22
+
23
+
24
+
25
+ # [13.0.0](https://github.com/christophehurpeau/nightingale/compare/v12.1.4...v13.0.0) (2022-11-19)
26
+
27
+
28
+ ### Code Refactoring
29
+
30
+ * drop node 14 and cjs ([9a8ca06](https://github.com/christophehurpeau/nightingale/commit/9a8ca064449ddc0d69e26543e21c2d522536c50a))
31
+
32
+
33
+ ### Features
34
+
35
+ * build for node 16 ([30ae3e9](https://github.com/christophehurpeau/nightingale/commit/30ae3e9c455dbad793c2f704b9d860069dc80c32))
36
+
37
+
38
+ ### BREAKING CHANGES
39
+
40
+ * dropped node 14 and cjs
41
+ * drop node 14
42
+
43
+
44
+
45
+
46
+
6
47
  ## [12.1.4](https://github.com/christophehurpeau/nightingale/compare/v12.1.3...v12.1.4) (2022-02-05)
7
48
 
8
49
 
package/README.md CHANGED
@@ -8,6 +8,10 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://npmjs.org/package/nightingale-browser-console-formatter"><img src="https://img.shields.io/npm/v/nightingale-browser-console-formatter.svg?style=flat-square"></a>
11
+ <a href="https://npmjs.org/package/nightingale-browser-console-formatter"><img src="https://img.shields.io/npm/dw/nightingale-browser-console-formatter.svg?style=flat-square"></a>
12
+ <a href="https://npmjs.org/package/nightingale-browser-console-formatter"><img src="https://img.shields.io/node/v/nightingale-browser-console-formatter.svg?style=flat-square"></a>
13
+ <a href="https://npmjs.org/package/nightingale-browser-console-formatter"><img src="https://img.shields.io/npm/types/nightingale-browser-console-formatter.svg?style=flat-square"></a>
14
+ <a href="https://codecov.io/gh/christophehurpeau/nightingale"><img src="https://img.shields.io/codecov/c/github/christophehurpeau/nightingale/master.svg?style=flat-square"></a>
11
15
  </p>
12
16
 
13
17
  ## Install
@@ -1,5 +1,5 @@
1
1
  import type { StyleToHtmlStyle } from 'nightingale-formatter';
2
2
  import type { LogRecord, Metadata, Styles } from 'nightingale-types';
3
3
  export declare const style: (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (styles: Styles, string: string) => string;
4
- export declare function createBrowserConsoleFormatter(theme?: 'light' | 'dark'): <T extends Metadata>(record: LogRecord<T>) => string[];
4
+ export declare function createBrowserConsoleFormatter(theme?: 'dark' | 'light'): <T extends Metadata>(record: LogRecord<T>) => string[];
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAM9D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAErE,eAAO,MAAM,KAAK,qBACG,gBAAgB,QAAQ,MAAM,EAAE,cAC1C,MAAM,UAAU,MAAM,KAAG,MAWjC,CAAC;AAEJ,wBAAgB,6BAA6B,CAC3C,KAAK,GAAE,MAAM,GAAG,OAAiB,GAChC,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAQxD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/index.test.ts"],"names":[],"mappings":""}
@@ -5,7 +5,6 @@ var style = function style(styleToHtmlStyle, args) {
5
5
  if (!styles || styles.length === 0 || !string) {
6
6
  return string;
7
7
  }
8
-
9
8
  var htmlStyles = styles.map(function (styleName) {
10
9
  return styleToHtmlStyle[styleName];
11
10
  });
@@ -21,7 +20,6 @@ function createBrowserConsoleFormatter(theme) {
21
20
  if (theme === void 0) {
22
21
  theme = 'light';
23
22
  }
24
-
25
23
  var styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
26
24
  return function format(record) {
27
25
  var args = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'light' | 'dark' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;IAQaA,KAAK,GAChB,SADWA,KACX,CAACC,gBAAD,EAAqCC,IAArC;AAAA,SACA,UAACC,MAAD,EAAiBC,MAAjB,EAA4C;AAC1C,QAAI,CAACD,MAAD,IAAWA,MAAM,CAACE,MAAP,KAAkB,CAA7B,IAAkC,CAACD,MAAvC,EAA+C;AAC7C,aAAOA,MAAP;AACD;;AAED,QAAME,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,UAACC,SAAD;AAAA,aAAeP,gBAAgB,CAACO,SAAD,CAA/B;AAAA,KAAX,CAAnB;AACAN,IAAAA,IAAI,CAACO,IAAL,CACEH,UAAU,CAACC,GAAX,CAAe,UAACG,CAAD;AAAA,aAAOA,CAAC,CAACC,IAAT;AAAA,KAAf,EAA8BC,IAA9B,CAAmC,IAAnC,CADF,EAEEN,UAAU,CAACC,GAAX,CAAe,UAACG,CAAD;AAAA,aAAOA,CAAC,CAACG,KAAT;AAAA,KAAf,EAA+BD,IAA/B,CAAoC,IAApC,CAFF;AAIA,kBAAYR,MAAZ;AACD,GAZD;AAAA;AAcK,SAASU,6BAAT,CACLC,KADK,EAEmD;AAAA,MADxDA,KACwD;AADxDA,IAAAA,KACwD,GAD9B,OAC8B;AAAA;;AACxD,MAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAV,GAAmBC,yBAAnB,GAA+CC,0BADjD;AAEA,SAAO,SAASC,MAAT,CAAoCC,MAApC,EAAoE;AACzE,QAAMjB,IAAc,GAAG,EAAvB;AACA,QAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAD,EAASnB,KAAK,CAACC,gBAAD,EAAmBC,IAAnB,CAAd,CAAnC;AACA,YAAQE,MAAR,SAAmBF,IAAnB;AACD,GAJD;AAKD;;;;"}
1
+ {"version":3,"file":"index-browser.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'dark' | 'light' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString","concat"],"mappings":";;AAQO,IAAMA,KAAK,GAChB,SADWA,KAAKA,CACfC,gBAAkC,EAAEC,IAAc,EAAA;AAAA,EAAA,OACnD,UAACC,MAAc,EAAEC,MAAc,EAAa;IAC1C,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,MAAA,OAAOA,MAAM,CAAA;AACf,KAAA;AAEA,IAAA,IAAME,UAAU,GAAGH,MAAM,CAACI,GAAG,CAAC,UAACC,SAAS,EAAA;MAAA,OAAKP,gBAAgB,CAACO,SAAS,CAAC,CAAA;KAAC,CAAA,CAAA;IACzEN,IAAI,CAACO,IAAI,CACPH,UAAU,CAACC,GAAG,CAAC,UAACG,CAAC,EAAA;MAAA,OAAKA,CAAC,CAACC,IAAI,CAAA;KAAC,CAAA,CAACC,IAAI,CAAC,IAAI,CAAC,EACxCN,UAAU,CAACC,GAAG,CAAC,UAACG,CAAC,EAAA;MAAA,OAAKA,CAAC,CAACG,KAAK,CAAA;AAAA,KAAA,CAAC,CAACD,IAAI,CAAC,IAAI,CAC1C,CAAC,CAAA;AACD,IAAA,OAAA,IAAA,GAAYR,MAAM,GAAA,IAAA,CAAA;GACnB,CAAA;AAAA,EAAA;AAEI,SAASU,6BAA6BA,CAC3CC,KAAuB,EACiC;AAAA,EAAA,IADxDA,KAAuB,KAAA,KAAA,CAAA,EAAA;AAAvBA,IAAAA,KAAuB,GAAG,OAAO,CAAA;AAAA,GAAA;EAEjC,IAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAM,GAAGC,yBAAyB,GAAGC,0BAA0B,CAAA;AAC3E,EAAA,OAAO,SAASC,MAAMA,CAAqBC,MAAoB,EAAY;IACzE,IAAMjB,IAAc,GAAG,EAAE,CAAA;AACzB,IAAA,IAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAM,EAAEnB,KAAK,CAACC,gBAAgB,EAAEC,IAAI,CAAC,CAAC,CAAA;AAC1E,IAAA,OAAA,CAAQE,MAAM,CAAA,CAAAiB,MAAA,CAAKnB,IAAI,CAAA,CAAA;GACxB,CAAA;AACH;;;;"}
@@ -4,7 +4,6 @@ const style = (styleToHtmlStyle, args) => (styles, string) => {
4
4
  if (!styles || styles.length === 0 || !string) {
5
5
  return string;
6
6
  }
7
-
8
7
  const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
8
  args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
10
9
  return `%c${string}%c`;
@@ -1 +1 @@
1
- {"version":3,"file":"index-browsermodern.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'light' | 'dark' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;MAQaA,KAAK,GAChB,CAACC,gBAAD,EAAqCC,IAArC,KACA,CAACC,MAAD,EAAiBC,MAAjB,KAA4C;AAC1C,MAAI,CAACD,MAAD,IAAWA,MAAM,CAACE,MAAP,KAAkB,CAA7B,IAAkC,CAACD,MAAvC,EAA+C;AAC7C,WAAOA,MAAP;AACD;;AAED,QAAME,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAYC,SAAD,IAAeP,gBAAgB,CAACO,SAAD,CAA1C,CAAnB;AACAN,EAAAA,IAAI,CAACO,IAAL,CACEH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CADF,EAEEN,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAFF;AAIA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEI,SAASU,6BAAT,CACLC,KAAuB,GAAG,OADrB,EAEmD;AACxD,QAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAV,GAAmBC,yBAAnB,GAA+CC,0BADjD;AAEA,SAAO,SAASC,MAAT,CAAoCC,MAApC,EAAoE;AACzE,UAAMjB,IAAc,GAAG,EAAvB;AACA,UAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAD,EAASnB,KAAK,CAACC,gBAAD,EAAmBC,IAAnB,CAAd,CAAnC;AACA,WAAO,CAACE,MAAD,EAAS,GAAGF,IAAZ,CAAP;AACD,GAJD;AAKD;;;;"}
1
+ {"version":3,"file":"index-browsermodern.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'dark' | 'light' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;AAQaA,MAAAA,KAAK,GAChBA,CAACC,gBAAkC,EAAEC,IAAc,KACnD,CAACC,MAAc,EAAEC,MAAc,KAAa;EAC1C,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,MAAME,UAAU,GAAGH,MAAM,CAACI,GAAG,CAAEC,SAAS,IAAKP,gBAAgB,CAACO,SAAS,CAAC,CAAC,CAAA;AACzEN,EAAAA,IAAI,CAACO,IAAI,CACPH,UAAU,CAACC,GAAG,CAAEG,CAAC,IAAKA,CAAC,CAACC,IAAI,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,EACxCN,UAAU,CAACC,GAAG,CAAEG,CAAC,IAAKA,CAAC,CAACG,KAAK,CAAC,CAACD,IAAI,CAAC,IAAI,CAC1C,CAAC,CAAA;EACD,OAAQ,CAAA,EAAA,EAAIR,MAAO,CAAG,EAAA,CAAA,CAAA;AACxB,EAAC;AAEI,SAASU,6BAA6BA,CAC3CC,KAAuB,GAAG,OAAO,EACuB;EACxD,MAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAM,GAAGC,yBAAyB,GAAGC,0BAA0B,CAAA;AAC3E,EAAA,OAAO,SAASC,MAAMA,CAAqBC,MAAoB,EAAY;IACzE,MAAMjB,IAAc,GAAG,EAAE,CAAA;AACzB,IAAA,MAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAM,EAAEnB,KAAK,CAACC,gBAAgB,EAAEC,IAAI,CAAC,CAAC,CAAA;AAC1E,IAAA,OAAO,CAACE,MAAM,EAAE,GAAGF,IAAI,CAAC,CAAA;GACzB,CAAA;AACH;;;;"}
@@ -4,7 +4,6 @@ const style = (styleToHtmlStyle, args) => (styles, string) => {
4
4
  if (!styles || styles.length === 0 || !string) {
5
5
  return string;
6
6
  }
7
-
8
7
  const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
8
  args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
10
9
  return `%c${string}%c`;
@@ -19,4 +18,4 @@ function createBrowserConsoleFormatter(theme = 'light') {
19
18
  }
20
19
 
21
20
  export { createBrowserConsoleFormatter, style };
22
- //# sourceMappingURL=index-node14.mjs.map
21
+ //# sourceMappingURL=index-node18.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-node14.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'light' | 'dark' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;MAQaA,KAAK,GAChB,CAACC,gBAAD,EAAqCC,IAArC,KACA,CAACC,MAAD,EAAiBC,MAAjB,KAA4C;AAC1C,MAAI,CAACD,MAAD,IAAWA,MAAM,CAACE,MAAP,KAAkB,CAA7B,IAAkC,CAACD,MAAvC,EAA+C;AAC7C,WAAOA,MAAP;AACD;;AAED,QAAME,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAYC,SAAD,IAAeP,gBAAgB,CAACO,SAAD,CAA1C,CAAnB;AACAN,EAAAA,IAAI,CAACO,IAAL,CACEH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CADF,EAEEN,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAFF;AAIA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEI,SAASU,6BAAT,CACLC,KAAuB,GAAG,OADrB,EAEmD;AACxD,QAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAV,GAAmBC,yBAAnB,GAA+CC,0BADjD;AAEA,SAAO,SAASC,MAAT,CAAoCC,MAApC,EAAoE;AACzE,UAAMjB,IAAc,GAAG,EAAvB;AACA,UAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAD,EAASnB,KAAK,CAACC,gBAAD,EAAmBC,IAAnB,CAAd,CAAnC;AACA,WAAO,CAACE,MAAD,EAAS,GAAGF,IAAZ,CAAP;AACD,GAJD;AAKD;;;;"}
1
+ {"version":3,"file":"index-node18.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'dark' | 'light' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;AAQaA,MAAAA,KAAK,GAChBA,CAACC,gBAAkC,EAAEC,IAAc,KACnD,CAACC,MAAc,EAAEC,MAAc,KAAa;EAC1C,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,MAAME,UAAU,GAAGH,MAAM,CAACI,GAAG,CAAEC,SAAS,IAAKP,gBAAgB,CAACO,SAAS,CAAC,CAAC,CAAA;AACzEN,EAAAA,IAAI,CAACO,IAAI,CACPH,UAAU,CAACC,GAAG,CAAEG,CAAC,IAAKA,CAAC,CAACC,IAAI,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,EACxCN,UAAU,CAACC,GAAG,CAAEG,CAAC,IAAKA,CAAC,CAACG,KAAK,CAAC,CAACD,IAAI,CAAC,IAAI,CAC1C,CAAC,CAAA;EACD,OAAQ,CAAA,EAAA,EAAIR,MAAO,CAAG,EAAA,CAAA,CAAA;AACxB,EAAC;AAEI,SAASU,6BAA6BA,CAC3CC,KAAuB,GAAG,OAAO,EACuB;EACxD,MAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAM,GAAGC,yBAAyB,GAAGC,0BAA0B,CAAA;AAC3E,EAAA,OAAO,SAASC,MAAMA,CAAqBC,MAAoB,EAAY;IACzE,MAAMjB,IAAc,GAAG,EAAE,CAAA;AACzB,IAAA,MAAME,MAAM,GAAGgB,oBAAoB,CAACD,MAAM,EAAEnB,KAAK,CAACC,gBAAgB,EAAEC,IAAI,CAAC,CAAC,CAAA;AAC1E,IAAA,OAAO,CAACE,MAAM,EAAE,GAAGF,IAAI,CAAC,CAAA;GACzB,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-browser-console-formatter",
3
- "version": "12.1.4",
3
+ "version": "14.0.0",
4
4
  "description": "Nightingale Browser console formatter",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -16,74 +16,59 @@
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
17
  "type": "module",
18
18
  "engines": {
19
- "node": "^14.13.1 || >=16.0.0"
19
+ "node": ">=18.12.0"
20
20
  },
21
- "browserslist": [
22
- "defaults",
23
- "> 0.2%",
24
- "not ie < 12",
25
- "not safari < 10",
26
- "not ios_saf < 10"
27
- ],
28
- "main": "./dist/index-node14.mjs",
29
- "types": "./dist/index.d.ts",
21
+ "browserslist": {
22
+ "production": [
23
+ "defaults",
24
+ "> 0.2%",
25
+ "not ie < 12",
26
+ "not safari < 10",
27
+ "not ios_saf < 10"
28
+ ]
29
+ },
30
+ "main": "./dist/index-node18.mjs",
31
+ "types": "./dist/definitions/index.d.ts",
30
32
  "module": "./dist/index-browser.es.js",
31
33
  "browser": "./dist/index-browser.es.js",
32
34
  "exports": {
33
35
  "./package.json": "./package.json",
34
36
  ".": {
35
37
  "node": {
36
- "import": "./dist/index-node14.mjs",
37
- "require": "./dist/index-node14.cjs"
38
+ "import": "./dist/index-node18.mjs"
38
39
  },
39
40
  "browser": {
40
41
  "browser:modern": {
41
42
  "import": "./dist/index-browsermodern.es.js"
42
43
  },
43
- "import": "./dist/index-browser.es.js",
44
- "require": "./dist/index-browser.cjs.js"
44
+ "import": "./dist/index-browser.es.js"
45
45
  }
46
46
  }
47
47
  },
48
- "module:node": "./dist/index-node14.mjs",
49
- "module:modern-browsers": "./dist/index-browsermodern.es.js",
50
48
  "sideEffects": false,
51
49
  "scripts": {
52
- "build": "pob-build && yarn run build:definitions",
53
- "build:definitions": "tsc -p tsconfig.build.json",
54
- "clean": "rm -Rf dist",
50
+ "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
51
+ "build:definitions": "tsc -p tsconfig.json",
52
+ "clean": "yarn clean:build",
53
+ "clean:build": "pob-babel-clean-out dist",
55
54
  "lint": "yarn run lint:eslint",
56
- "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-browser-console-formatter",
57
- "watch": "pob-watch"
58
- },
59
- "prettier": {
60
- "trailingComma": "all",
61
- "singleQuote": true,
62
- "arrowParens": "always"
55
+ "lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-browser-console-formatter",
56
+ "test": "yarn ../../ run test -- packages/nightingale-browser-console-formatter",
57
+ "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
63
58
  },
59
+ "prettier": "@pob/root/prettier-config",
64
60
  "pob": {
65
61
  "babelEnvs": [
66
62
  {
67
63
  "target": "node",
68
- "version": "14",
69
- "formats": [
70
- "cjs",
71
- "es"
72
- ]
64
+ "version": "18"
73
65
  },
74
66
  {
75
67
  "target": "browser",
76
- "version": "modern",
77
- "formats": [
78
- "es"
79
- ]
68
+ "version": "modern"
80
69
  },
81
70
  {
82
- "target": "browser",
83
- "formats": [
84
- "cjs",
85
- "es"
86
- ]
71
+ "target": "browser"
87
72
  }
88
73
  ],
89
74
  "entries": [
@@ -91,16 +76,15 @@
91
76
  ]
92
77
  },
93
78
  "dependencies": {
94
- "nightingale-formatter": "12.1.4",
95
- "nightingale-types": "12.1.4"
79
+ "nightingale-formatter": "14.0.0",
80
+ "nightingale-types": "14.0.0"
96
81
  },
97
82
  "devDependencies": {
98
- "@babel/core": "7.17.0",
99
- "@babel/preset-env": "7.16.11",
100
- "babel-preset-modern-browsers": "15.0.2",
101
- "nightingale-levels": "12.1.4",
102
- "pob-babel": "30.0.1",
103
- "typescript": "4.5.5"
83
+ "@babel/core": "7.22.5",
84
+ "@babel/preset-env": "7.22.5",
85
+ "nightingale-levels": "14.0.0",
86
+ "pob-babel": "36.1.0",
87
+ "typescript": "5.1.6"
104
88
  },
105
- "gitHead": "3754d4575d948b5bb8c5227d3c3f4ca25e801db5"
89
+ "gitHead": "bc20e0f093a4fecd4d87f9374f6dbc375c09c25e"
106
90
  }
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ export const style =
22
22
  };
23
23
 
24
24
  export function createBrowserConsoleFormatter(
25
- theme: 'light' | 'dark' = 'light',
25
+ theme: 'dark' | 'light' = 'light',
26
26
  ): <T extends Metadata>(record: LogRecord<T>) => string[] {
27
27
  const styleToHtmlStyle: StyleToHtmlStyle =
28
28
  theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var nightingaleFormatter = require('nightingale-formatter');
6
-
7
- var style = function style(styleToHtmlStyle, args) {
8
- return function (styles, string) {
9
- if (!styles || styles.length === 0 || !string) {
10
- return string;
11
- }
12
-
13
- var htmlStyles = styles.map(function (styleName) {
14
- return styleToHtmlStyle[styleName];
15
- });
16
- args.push(htmlStyles.map(function (s) {
17
- return s.open;
18
- }).join('; '), htmlStyles.map(function (s) {
19
- return s.close;
20
- }).join('; '));
21
- return "%c" + string + "%c";
22
- };
23
- };
24
- function createBrowserConsoleFormatter(theme) {
25
- if (theme === void 0) {
26
- theme = 'light';
27
- }
28
-
29
- var styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
30
- return function format(record) {
31
- var args = [];
32
- var string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
33
- return [string].concat(args);
34
- };
35
- }
36
-
37
- exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
38
- exports.style = style;
39
- //# sourceMappingURL=index-browser.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'light' | 'dark' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;;;;;IAQaA,KAAK,GAChB,SADWA,KACX,CAACC,gBAAD,EAAqCC,IAArC;AAAA,SACA,UAACC,MAAD,EAAiBC,MAAjB,EAA4C;AAC1C,QAAI,CAACD,MAAD,IAAWA,MAAM,CAACE,MAAP,KAAkB,CAA7B,IAAkC,CAACD,MAAvC,EAA+C;AAC7C,aAAOA,MAAP;AACD;;AAED,QAAME,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,UAACC,SAAD;AAAA,aAAeP,gBAAgB,CAACO,SAAD,CAA/B;AAAA,KAAX,CAAnB;AACAN,IAAAA,IAAI,CAACO,IAAL,CACEH,UAAU,CAACC,GAAX,CAAe,UAACG,CAAD;AAAA,aAAOA,CAAC,CAACC,IAAT;AAAA,KAAf,EAA8BC,IAA9B,CAAmC,IAAnC,CADF,EAEEN,UAAU,CAACC,GAAX,CAAe,UAACG,CAAD;AAAA,aAAOA,CAAC,CAACG,KAAT;AAAA,KAAf,EAA+BD,IAA/B,CAAoC,IAApC,CAFF;AAIA,kBAAYR,MAAZ;AACD,GAZD;AAAA;AAcK,SAASU,6BAAT,CACLC,KADK,EAEmD;AAAA,MADxDA,KACwD;AADxDA,IAAAA,KACwD,GAD9B,OAC8B;AAAA;;AACxD,MAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAV,GAAmBC,8CAAnB,GAA+CC,+CADjD;AAEA,SAAO,SAASC,MAAT,CAAoCC,MAApC,EAAoE;AACzE,QAAMjB,IAAc,GAAG,EAAvB;AACA,QAAME,MAAM,GAAGgB,yCAAoB,CAACD,MAAD,EAASnB,KAAK,CAACC,gBAAD,EAAmBC,IAAnB,CAAd,CAAnC;AACA,YAAQE,MAAR,SAAmBF,IAAnB;AACD,GAJD;AAKD;;;;;"}
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const nightingaleFormatter = require('nightingale-formatter');
6
-
7
- const style = (styleToHtmlStyle, args) => (styles, string) => {
8
- if (!styles || styles.length === 0 || !string) {
9
- return string;
10
- }
11
-
12
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
13
- args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
14
- return `%c${string}%c`;
15
- };
16
- function createBrowserConsoleFormatter(theme = 'light') {
17
- const styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
18
- return function format(record) {
19
- const args = [];
20
- const string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
21
- return [string, ...args];
22
- };
23
- }
24
-
25
- exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
26
- exports.style = style;
27
- //# sourceMappingURL=index-node14.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node14.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { StyleToHtmlStyle } from 'nightingale-formatter';\nimport {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n styleToHtmlStyleThemeDark,\n} from 'nightingale-formatter';\nimport type { LogRecord, Metadata, Styles } from 'nightingale-types';\n\nexport const style =\n (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>\n (styles: Styles, string: string): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(\n htmlStyles.map((s) => s.open).join('; '),\n htmlStyles.map((s) => s.close).join('; '),\n );\n return `%c${string}%c`;\n };\n\nexport function createBrowserConsoleFormatter(\n theme: 'light' | 'dark' = 'light',\n): <T extends Metadata>(record: LogRecord<T>) => string[] {\n const styleToHtmlStyle: StyleToHtmlStyle =\n theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;\n return function format<T extends Metadata>(record: LogRecord<T>): string[] {\n const args: string[] = [];\n const string = formatRecordToString(record, style(styleToHtmlStyle, args));\n return [string, ...args];\n };\n}\n"],"names":["style","styleToHtmlStyle","args","styles","string","length","htmlStyles","map","styleName","push","s","open","join","close","createBrowserConsoleFormatter","theme","styleToHtmlStyleThemeDark","styleToHtmlStyleThemeLight","format","record","formatRecordToString"],"mappings":";;;;;;MAQaA,KAAK,GAChB,CAACC,gBAAD,EAAqCC,IAArC,KACA,CAACC,MAAD,EAAiBC,MAAjB,KAA4C;AAC1C,MAAI,CAACD,MAAD,IAAWA,MAAM,CAACE,MAAP,KAAkB,CAA7B,IAAkC,CAACD,MAAvC,EAA+C;AAC7C,WAAOA,MAAP;AACD;;AAED,QAAME,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAYC,SAAD,IAAeP,gBAAgB,CAACO,SAAD,CAA1C,CAAnB;AACAN,EAAAA,IAAI,CAACO,IAAL,CACEH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CADF,EAEEN,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAFF;AAIA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEI,SAASU,6BAAT,CACLC,KAAuB,GAAG,OADrB,EAEmD;AACxD,QAAMd,gBAAkC,GACtCc,KAAK,KAAK,MAAV,GAAmBC,8CAAnB,GAA+CC,+CADjD;AAEA,SAAO,SAASC,MAAT,CAAoCC,MAApC,EAAoE;AACzE,UAAMjB,IAAc,GAAG,EAAvB;AACA,UAAME,MAAM,GAAGgB,yCAAoB,CAACD,MAAD,EAASnB,KAAK,CAACC,gBAAD,EAAmBC,IAAnB,CAAd,CAAnC;AACA,WAAO,CAACE,MAAD,EAAS,GAAGF,IAAZ,CAAP;AACD,GAJD;AAKD;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAM9D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAErE,eAAO,MAAM,KAAK,qBACG,gBAAgB,QAAQ,MAAM,EAAE,cAC1C,MAAM,UAAU,MAAM,KAAG,MAWjC,CAAC;AAEJ,wBAAgB,6BAA6B,CAC3C,KAAK,GAAE,OAAO,GAAG,MAAgB,GAChC,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAQxD"}
package/rollup.config.mjs DELETED
@@ -1,3 +0,0 @@
1
- import createRollupConfig from 'pob-babel/createRollupConfig.js';
2
-
3
- export default createRollupConfig({});