nightingale-browser-console-formatter 11.7.0 → 12.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/.eslintrc.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/root", "@pob/eslint-config-node"],
3
+ "extends": ["@pob/eslint-config/root-commonjs"],
4
4
  "ignorePatterns": ["*.d.ts", "/dist"]
5
5
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,55 @@
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.0.0](https://github.com/christophehurpeau/nightingale/compare/v11.9.0...v12.0.0) (2021-12-11)
7
+
8
+
9
+ ### Build System
10
+
11
+ * node 14 and remove dev builds ([432ecd1](https://github.com/christophehurpeau/nightingale/commit/432ecd1faafd0419f57dea00fce560e4cccc207f))
12
+
13
+
14
+ ### Features
15
+
16
+ * drop default exports ([8878e49](https://github.com/christophehurpeau/nightingale/commit/8878e492b94852fcb892fd6d12c02c15c31b38b9))
17
+
18
+
19
+ ### BREAKING CHANGES
20
+
21
+ * use named imports instead of default exports
22
+ * requires node 14
23
+
24
+
25
+
26
+
27
+
28
+ ## [11.7.4](https://github.com/christophehurpeau/nightingale/compare/v11.7.3...v11.7.4) (2021-11-27)
29
+
30
+ **Note:** Version bump only for package nightingale-browser-console-formatter
31
+
32
+
33
+
34
+
35
+
36
+ ## [11.7.2](https://github.com/christophehurpeau/nightingale/compare/v11.7.1...v11.7.2) (2021-11-27)
37
+
38
+ **Note:** Version bump only for package nightingale-browser-console-formatter
39
+
40
+
41
+
42
+
43
+
44
+ ## [11.7.1](https://github.com/christophehurpeau/nightingale/compare/v11.7.0...v11.7.1) (2021-06-29)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * update pob-babel to bring back webpack 4 support ([4887431](https://github.com/christophehurpeau/nightingale/commit/4887431b3b272496511f879af022638723b9056e))
50
+
51
+
52
+
53
+
54
+
6
55
  # [11.7.0](https://github.com/christophehurpeau/nightingale/compare/v11.6.0...v11.7.0) (2021-03-29)
7
56
 
8
57
  **Note:** Version bump only for package nightingale-browser-console-formatter
@@ -4,29 +4,36 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var nightingaleFormatter = require('nightingale-formatter');
6
6
 
7
- const style = (styleToHtmlStyle, args) => (styles, string) => {
8
- if (!styles || styles.length === 0 || !string) {
9
- return string;
10
- }
7
+ var style = function style(styleToHtmlStyle, args) {
8
+ return function (styles, string) {
9
+ if (!styles || styles.length === 0 || !string) {
10
+ return string;
11
+ }
11
12
 
12
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
13
- args.push(htmlStyles.map(s => s.open).join('; '));
14
- args.push(htmlStyles.map(s => s.close).join('; '));
15
- return `%c${string}%c`;
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
+ };
16
23
  };
17
- function createBrowserConsoleFormatter(theme = 'light') {
18
- const styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
24
+ function createBrowserConsoleFormatter(theme) {
25
+ if (theme === void 0) {
26
+ theme = 'light';
27
+ }
28
+
29
+ var styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
19
30
  return function format(record) {
20
- const args = [];
21
- const string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
22
- return [string, ...args];
31
+ var args = [];
32
+ var string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
33
+ return [string].concat(args);
23
34
  };
24
35
  }
25
- /** @deprecated use createBrowserConsoleFormatter */
26
-
27
- var index = createBrowserConsoleFormatter('light');
28
36
 
29
37
  exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
30
- exports.default = index;
31
38
  exports.style = style;
32
39
  //# sourceMappingURL=index-browser.cjs.js.map
@@ -1 +1 @@
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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
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,WAAQ,KAAIR,MAAO,IAAnB;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 +1,34 @@
1
1
  import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
2
 
3
- const style = (styleToHtmlStyle, args) => (styles, string) => {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
3
+ var style = function style(styleToHtmlStyle, args) {
4
+ return function (styles, string) {
5
+ if (!styles || styles.length === 0 || !string) {
6
+ return string;
7
+ }
7
8
 
8
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
11
- return `%c${string}%c`;
9
+ var htmlStyles = styles.map(function (styleName) {
10
+ return styleToHtmlStyle[styleName];
11
+ });
12
+ args.push(htmlStyles.map(function (s) {
13
+ return s.open;
14
+ }).join('; '), htmlStyles.map(function (s) {
15
+ return s.close;
16
+ }).join('; '));
17
+ return `%c${string}%c`;
18
+ };
12
19
  };
13
- function createBrowserConsoleFormatter(theme = 'light') {
14
- const styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
20
+ function createBrowserConsoleFormatter(theme) {
21
+ if (theme === void 0) {
22
+ theme = 'light';
23
+ }
24
+
25
+ var styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
15
26
  return function format(record) {
16
- const args = [];
17
- const string = formatRecordToString(record, style(styleToHtmlStyle, args));
18
- return [string, ...args];
27
+ var args = [];
28
+ var string = formatRecordToString(record, style(styleToHtmlStyle, args));
29
+ return [string].concat(args);
19
30
  };
20
31
  }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
-
23
- var index = createBrowserConsoleFormatter('light');
24
32
 
25
- export default index;
26
33
  export { createBrowserConsoleFormatter, style };
27
34
  //# sourceMappingURL=index-browser.es.js.map
@@ -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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
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,WAAQ,KAAIR,MAAO,IAAnB;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;;;;"}
@@ -6,8 +6,7 @@ const style = (styleToHtmlStyle, args) => (styles, string) => {
6
6
  }
7
7
 
8
8
  const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
9
+ args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
11
10
  return `%c${string}%c`;
12
11
  };
13
12
  function createBrowserConsoleFormatter(theme = 'light') {
@@ -18,10 +17,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
18
17
  return [string, ...args];
19
18
  };
20
19
  }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
20
 
23
- const index = createBrowserConsoleFormatter('light');
24
-
25
- export default index;
26
21
  export { createBrowserConsoleFormatter, style };
27
22
  //# sourceMappingURL=index-browsermodern.es.js.map
@@ -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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
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;;;;"}
@@ -10,8 +10,7 @@ const style = (styleToHtmlStyle, args) => (styles, string) => {
10
10
  }
11
11
 
12
12
  const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
13
- args.push(htmlStyles.map(s => s.open).join('; '));
14
- args.push(htmlStyles.map(s => s.close).join('; '));
13
+ args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
15
14
  return `%c${string}%c`;
16
15
  };
17
16
  function createBrowserConsoleFormatter(theme = 'light') {
@@ -22,11 +21,7 @@ function createBrowserConsoleFormatter(theme = 'light') {
22
21
  return [string, ...args];
23
22
  };
24
23
  }
25
- /** @deprecated use createBrowserConsoleFormatter */
26
-
27
- const index = createBrowserConsoleFormatter('light');
28
24
 
29
25
  exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
30
- exports.default = index;
31
26
  exports.style = style;
32
- //# sourceMappingURL=index-node12.cjs.js.map
27
+ //# sourceMappingURL=index-node14.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node14.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":";;;;;;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;;;;;"}
@@ -6,8 +6,7 @@ const style = (styleToHtmlStyle, args) => (styles, string) => {
6
6
  }
7
7
 
8
8
  const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
9
+ args.push(htmlStyles.map(s => s.open).join('; '), htmlStyles.map(s => s.close).join('; '));
11
10
  return `%c${string}%c`;
12
11
  };
13
12
  function createBrowserConsoleFormatter(theme = 'light') {
@@ -18,10 +17,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
18
17
  return [string, ...args];
19
18
  };
20
19
  }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
20
 
23
- const index = createBrowserConsoleFormatter('light');
24
-
25
- export default index;
26
21
  export { createBrowserConsoleFormatter, style };
27
- //# sourceMappingURL=index-node12.mjs.map
22
+ //# sourceMappingURL=index-node14.mjs.map
@@ -0,0 +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;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,4 @@ 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
4
  export declare function createBrowserConsoleFormatter(theme?: 'light' | 'dark'): <T extends Metadata>(record: LogRecord<T>) => string[];
5
- declare const _default: <T extends Metadata>(record: LogRecord<T>) => string[];
6
- /** @deprecated use createBrowserConsoleFormatter */
7
- export default _default;
8
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,qBAAsB,gBAAgB,QAAQ,MAAM,EAAE,cAC9D,MAAM,UACN,MAAM,KACb,MASF,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,KAAK,GAAE,OAAO,GAAG,MAAgB,GAChC,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAQxD;;AAED,oDAAoD;AACpD,wBAAsD"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-browser-console-formatter",
3
- "version": "11.7.0",
3
+ "version": "12.0.0",
4
4
  "description": "Nightingale Browser console formatter",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -14,67 +14,46 @@
14
14
  "directory": "packages/nightingale-browser-console-formatter"
15
15
  },
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
+ "type": "commonjs",
17
18
  "engines": {
18
- "node": ">=12.10.0"
19
+ "node": "^14.13.1 || >=16.0.0"
19
20
  },
20
21
  "browserslist": [
22
+ "defaults",
21
23
  "> 0.2%",
22
- "Firefox ESR",
23
- "last 2 Chrome versions",
24
- "last 2 iOS versions",
25
- "last 2 Edge versions",
26
- "last 2 Safari versions",
27
24
  "not ie < 12",
28
- "not ios_saf < 10",
29
- "not dead",
30
- "not op_mini all"
25
+ "not safari < 10",
26
+ "not ios_saf < 10"
31
27
  ],
32
- "main": "./index.js",
28
+ "main": "./dist/index-node14.cjs.js",
33
29
  "types": "./dist/index.d.ts",
34
30
  "module": "./dist/index-browser.es.js",
35
31
  "browser": "./dist/index-browser.es.js",
36
32
  "exports": {
33
+ "./package.json": "./package.json",
37
34
  ".": {
38
35
  "node": {
39
- "development": {
40
- "import": "./dist/index-node12-dev.mjs",
41
- "require": "./dist/index-node12-dev.cjs.js"
42
- },
43
- "import": "./dist/index-node12.mjs",
44
- "require": "./dist/index-node12.cjs.js"
36
+ "import": "./dist/index-node14.mjs",
37
+ "require": "./dist/index-node14.cjs.js"
45
38
  },
46
39
  "browser": {
47
40
  "browser:modern": {
48
- "development": {
49
- "import": "./dist/index-browsermodern-dev.es.js"
50
- },
51
41
  "import": "./dist/index-browsermodern.es.js"
52
42
  },
53
- "development": {
54
- "import": "./dist/index-browser-dev.es.js",
55
- "require": "./dist/index-browser-dev.cjs.js"
56
- },
57
43
  "import": "./dist/index-browser.es.js",
58
44
  "require": "./dist/index-browser.cjs.js"
59
45
  }
60
46
  }
61
47
  },
62
- "module:node": "./dist/index-node12.mjs",
63
- "module:node-dev": "./dist/index-node12-dev.mjs",
64
- "module:browser": "./dist/index-browser.es.js",
65
- "module:browser-dev": "./dist/index-browser-dev.es.js",
48
+ "module:node": "./dist/index-node14.mjs",
66
49
  "module:modern-browsers": "./dist/index-browsermodern.es.js",
67
- "module:modern-browsers-dev": "./dist/index-browsermodern-dev.es.js",
68
50
  "sideEffects": false,
69
51
  "scripts": {
70
52
  "build": "pob-build && yarn run build:definitions",
71
53
  "build:definitions": "tsc -p tsconfig.build.json",
72
- "clean": "rm -Rf docs dist test/node6 coverage",
73
- "generate:test-coverage": "rm -Rf docs/coverage/ ; NODE_ENV=production BABEL_ENV=test jest --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/",
54
+ "clean": "rm -Rf dist",
74
55
  "lint": "yarn run lint:eslint",
75
- "lint:eslint": "yarn --cwd ../.. run eslint --ext .js,.mjs,.ts --report-unused-disable-directives --quiet packages/nightingale-browser-console-formatter",
76
- "test": "jest",
77
- "test:watch": "jest",
56
+ "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-browser-console-formatter",
78
57
  "watch": "pob-watch"
79
58
  },
80
59
  "prettier": {
@@ -82,30 +61,11 @@
82
61
  "singleQuote": true,
83
62
  "arrowParens": "always"
84
63
  },
85
- "jest": {
86
- "cacheDirectory": "./node_modules/.cache/jest",
87
- "testMatch": [
88
- "<rootDir>/src/**/__tests__/**/*.ts",
89
- "<rootDir>/src/**/*.test.ts"
90
- ],
91
- "collectCoverageFrom": [
92
- "src/**/*.ts"
93
- ],
94
- "moduleFileExtensions": [
95
- "ts",
96
- "js",
97
- "json"
98
- ],
99
- "transform": {
100
- "^.+\\.ts$": "babel-jest"
101
- },
102
- "testEnvironment": "node"
103
- },
104
64
  "pob": {
105
65
  "babelEnvs": [
106
66
  {
107
67
  "target": "node",
108
- "version": "12",
68
+ "version": "14",
109
69
  "formats": [
110
70
  "cjs",
111
71
  "es"
@@ -131,33 +91,16 @@
131
91
  ]
132
92
  },
133
93
  "dependencies": {
134
- "nightingale-formatter": "^11.7.0",
135
- "nightingale-types": "^11.7.0"
94
+ "nightingale-formatter": "^12.0.0",
95
+ "nightingale-types": "^12.0.0"
136
96
  },
137
97
  "devDependencies": {
138
- "@babel/core": "7.13.10",
139
- "@babel/preset-env": "7.13.10",
140
- "@pob/eslint-config": "43.0.0",
141
- "@pob/eslint-config-node": "43.1.0",
142
- "@pob/eslint-config-typescript": "43.0.0",
143
- "@types/jest": "26.0.22",
144
- "@typescript-eslint/eslint-plugin": "4.19.0",
145
- "@typescript-eslint/parser": "4.19.0",
146
- "babel-jest": "26.6.3",
147
- "babel-preset-latest-node": "5.5.1",
98
+ "@babel/core": "7.16.0",
99
+ "@babel/preset-env": "7.16.4",
148
100
  "babel-preset-modern-browsers": "15.0.2",
149
- "eslint": "7.23.0",
150
- "eslint-import-resolver-node": "0.3.4",
151
- "eslint-plugin-import": "2.22.1",
152
- "eslint-plugin-node": "11.1.0",
153
- "eslint-plugin-unicorn": "25.0.1",
154
- "jest": "26.6.3",
155
- "nightingale-levels": "^11.7.0",
156
- "pob-babel": "26.8.0",
157
- "pob-lcov-reporter": "4.0.1",
158
- "rollup": "2.43.1",
159
- "typescript": "4.2.3",
160
- "xunit-file": "1.0.0"
101
+ "nightingale-levels": "^12.0.0",
102
+ "pob-babel": "29.3.0",
103
+ "typescript": "4.5.3"
161
104
  },
162
- "gitHead": "cc85b26dbfce264e968f288517a1af98d6f5156d"
105
+ "gitHead": "682f57fa30eaca9732681d16008abb2680b24174"
163
106
  }
@@ -0,0 +1,3 @@
1
+ import createRollupConfig from 'pob-babel/createRollupConfig.js';
2
+
3
+ export default createRollupConfig({});
package/src/index.test.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { StyleToHtmlStyle } from 'nightingale-formatter';
2
2
  import { styleToHtmlStyleThemeLight } from 'nightingale-formatter';
3
- import Level from 'nightingale-levels';
3
+ import { Level } from 'nightingale-levels';
4
4
  import { createBrowserConsoleFormatter, style } from '.';
5
5
 
6
6
  const styleToHtmlStyle: StyleToHtmlStyle = styleToHtmlStyleThemeLight;
package/src/index.ts CHANGED
@@ -6,19 +6,20 @@ import {
6
6
  } from 'nightingale-formatter';
7
7
  import type { LogRecord, Metadata, Styles } from 'nightingale-types';
8
8
 
9
- export const style = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (
10
- styles: Styles,
11
- string: string,
12
- ): string => {
13
- if (!styles || styles.length === 0 || !string) {
14
- return string;
15
- }
9
+ export const style =
10
+ (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) =>
11
+ (styles: Styles, string: string): string => {
12
+ if (!styles || styles.length === 0 || !string) {
13
+ return string;
14
+ }
16
15
 
17
- const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);
18
- args.push(htmlStyles.map((s) => s.open).join('; '));
19
- args.push(htmlStyles.map((s) => s.close).join('; '));
20
- return `%c${string}%c`;
21
- };
16
+ const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);
17
+ args.push(
18
+ htmlStyles.map((s) => s.open).join('; '),
19
+ htmlStyles.map((s) => s.close).join('; '),
20
+ );
21
+ return `%c${string}%c`;
22
+ };
22
23
 
23
24
  export function createBrowserConsoleFormatter(
24
25
  theme: 'light' | 'dark' = 'light',
@@ -31,6 +32,3 @@ export function createBrowserConsoleFormatter(
31
32
  return [string, ...args];
32
33
  };
33
34
  }
34
-
35
- /** @deprecated use createBrowserConsoleFormatter */
36
- export default createBrowserConsoleFormatter('light');
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var 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('; '));
14
- args.push(htmlStyles.map(s => s.close).join('; '));
15
- return `%c${string}%c`;
16
- };
17
- function createBrowserConsoleFormatter(theme = 'light') {
18
- const styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
19
- return function format(record) {
20
- const args = [];
21
- const string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
22
- return [string, ...args];
23
- };
24
- }
25
- /** @deprecated use createBrowserConsoleFormatter */
26
-
27
- var index = createBrowserConsoleFormatter('light');
28
-
29
- exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
30
- exports.default = index;
31
- exports.style = style;
32
- //# sourceMappingURL=index-browser-dev.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser-dev.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
@@ -1,27 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- const style = (styleToHtmlStyle, args) => (styles, string) => {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
-
8
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
11
- return `%c${string}%c`;
12
- };
13
- function createBrowserConsoleFormatter(theme = 'light') {
14
- const styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
15
- return function format(record) {
16
- const args = [];
17
- const string = formatRecordToString(record, style(styleToHtmlStyle, args));
18
- return [string, ...args];
19
- };
20
- }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
-
23
- var index = createBrowserConsoleFormatter('light');
24
-
25
- export default index;
26
- export { createBrowserConsoleFormatter, style };
27
- //# sourceMappingURL=index-browser-dev.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser-dev.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
@@ -1,27 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- const style = (styleToHtmlStyle, args) => (styles, string) => {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
-
8
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
11
- return `%c${string}%c`;
12
- };
13
- function createBrowserConsoleFormatter(theme = 'light') {
14
- const styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
15
- return function format(record) {
16
- const args = [];
17
- const string = formatRecordToString(record, style(styleToHtmlStyle, args));
18
- return [string, ...args];
19
- };
20
- }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
-
23
- const index = createBrowserConsoleFormatter('light');
24
-
25
- export default index;
26
- export { createBrowserConsoleFormatter, style };
27
- //# sourceMappingURL=index-browsermodern-dev.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browsermodern-dev.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
@@ -1,32 +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('; '));
14
- args.push(htmlStyles.map(s => s.close).join('; '));
15
- return `%c${string}%c`;
16
- };
17
- function createBrowserConsoleFormatter(theme = 'light') {
18
- const styleToHtmlStyle = theme === 'dark' ? nightingaleFormatter.styleToHtmlStyleThemeDark : nightingaleFormatter.styleToHtmlStyleThemeLight;
19
- return function format(record) {
20
- const args = [];
21
- const string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
22
- return [string, ...args];
23
- };
24
- }
25
- /** @deprecated use createBrowserConsoleFormatter */
26
-
27
- const index = createBrowserConsoleFormatter('light');
28
-
29
- exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
30
- exports.default = index;
31
- exports.style = style;
32
- //# sourceMappingURL=index-node12-dev.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12-dev.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
@@ -1,27 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- const style = (styleToHtmlStyle, args) => (styles, string) => {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
-
8
- const htmlStyles = styles.map(styleName => styleToHtmlStyle[styleName]);
9
- args.push(htmlStyles.map(s => s.open).join('; '));
10
- args.push(htmlStyles.map(s => s.close).join('; '));
11
- return `%c${string}%c`;
12
- };
13
- function createBrowserConsoleFormatter(theme = 'light') {
14
- const styleToHtmlStyle = theme === 'dark' ? styleToHtmlStyleThemeDark : styleToHtmlStyleThemeLight;
15
- return function format(record) {
16
- const args = [];
17
- const string = formatRecordToString(record, style(styleToHtmlStyle, args));
18
- return [string, ...args];
19
- };
20
- }
21
- /** @deprecated use createBrowserConsoleFormatter */
22
-
23
- const index = createBrowserConsoleFormatter('light');
24
-
25
- export default index;
26
- export { createBrowserConsoleFormatter, style };
27
- //# sourceMappingURL=index-node12-dev.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12-dev.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.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 = (styleToHtmlStyle: StyleToHtmlStyle, args: string[]) => (\n styles: Styles,\n string: string,\n): string => {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n const htmlStyles = styles.map((styleName) => styleToHtmlStyle[styleName]);\n args.push(htmlStyles.map((s) => s.open).join('; '));\n args.push(htmlStyles.map((s) => s.close).join('; '));\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\n/** @deprecated use createBrowserConsoleFormatter */\nexport default createBrowserConsoleFormatter('light');\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,GAAG,CAACC,gBAAD,EAAqCC,IAArC,KAAwD,CAC3EC,MAD2E,EAE3EC,MAF2E,KAGhE;AACX,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,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACC,IAAxB,EAA8BC,IAA9B,CAAmC,IAAnC,CAAV;AACAV,EAAAA,IAAI,CAACO,IAAL,CAAUH,UAAU,CAACC,GAAX,CAAgBG,CAAD,IAAOA,CAAC,CAACG,KAAxB,EAA+BD,IAA/B,CAAoC,IAApC,CAAV;AACA,SAAQ,KAAIR,MAAO,IAAnB;AACD;AAEM,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;"}
package/index.js DELETED
@@ -1,6 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
-
3
- 'use strict';
4
-
5
- const production = process.env.NODE_ENV === 'production';
6
- module.exports = require(`./dist/index-node12${production ? '' : '-dev'}.cjs`);