nightingale-browser-console-formatter 11.6.0 → 11.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.md +35 -0
- package/babel.config.cjs +14 -0
- package/dist/index-browser-dev.cjs.js +25 -14
- package/dist/index-browser-dev.cjs.js.map +1 -1
- package/dist/index-browser-dev.es.js +25 -15
- package/dist/index-browser-dev.es.js.map +1 -1
- package/dist/index-browser.cjs.js +25 -14
- package/dist/index-browser.cjs.js.map +1 -1
- package/dist/index-browser.es.js +25 -15
- package/dist/index-browser.es.js.map +1 -1
- package/dist/index-browsermodern-dev.es.js +2 -4
- package/dist/index-browsermodern-dev.es.js.map +1 -1
- package/dist/index-browsermodern.es.js +2 -4
- package/dist/index-browsermodern.es.js.map +1 -1
- package/dist/index-node12-dev.cjs.js +2 -3
- package/dist/index-node12-dev.cjs.js.map +1 -1
- package/dist/index-node12-dev.mjs +2 -4
- package/dist/index-node12-dev.mjs.map +1 -1
- package/dist/index-node12.cjs.js +2 -3
- package/dist/index-node12.cjs.js.map +1 -1
- package/dist/index-node12.mjs +2 -4
- package/dist/index-node12.mjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +23 -36
- package/rollup.config.mjs +3 -0
- package/src/index.test.ts +1 -1
- package/src/index.ts +13 -12
- package/index.js +0 -6
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.4](https://github.com/christophehurpeau/nightingale/compare/v11.7.3...v11.7.4) (2021-11-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package nightingale-browser-console-formatter
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [11.7.2](https://github.com/christophehurpeau/nightingale/compare/v11.7.1...v11.7.2) (2021-11-27)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package nightingale-browser-console-formatter
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [11.7.1](https://github.com/christophehurpeau/nightingale/compare/v11.7.0...v11.7.1) (2021-06-29)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update pob-babel to bring back webpack 4 support ([4887431](https://github.com/christophehurpeau/nightingale/commit/4887431b3b272496511f879af022638723b9056e))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [11.7.0](https://github.com/christophehurpeau/nightingale/compare/v11.6.0...v11.7.0) (2021-03-29)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package nightingale-browser-console-formatter
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
# [11.6.0](https://github.com/christophehurpeau/nightingale/compare/v11.5.4...v11.6.0) (2021-03-21)
|
|
7
42
|
|
|
8
43
|
|
package/babel.config.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
module.exports = function babelConfig(api) {
|
|
6
|
+
const isTest = api.env('test');
|
|
7
|
+
|
|
8
|
+
if (!isTest) return {};
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
only: [path.resolve(__dirname, 'src')],
|
|
12
|
+
presets: [require.resolve('pob-babel/preset')],
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -4,22 +4,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var nightingaleFormatter = require('nightingale-formatter');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
return [string
|
|
31
|
+
var args = [];
|
|
32
|
+
var string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
|
|
33
|
+
return [string].concat(args);
|
|
23
34
|
};
|
|
24
35
|
}
|
|
25
36
|
/** @deprecated use createBrowserConsoleFormatter */
|
|
@@ -27,6 +38,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
27
38
|
var index = createBrowserConsoleFormatter('light');
|
|
28
39
|
|
|
29
40
|
exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
|
|
30
|
-
exports
|
|
41
|
+
exports["default"] = index;
|
|
31
42
|
exports.style = style;
|
|
32
43
|
//# sourceMappingURL=index-browser-dev.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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":";;;;;;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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
return [string
|
|
27
|
+
var args = [];
|
|
28
|
+
var string = formatRecordToString(record, style(styleToHtmlStyle, args));
|
|
29
|
+
return [string].concat(args);
|
|
19
30
|
};
|
|
20
31
|
}
|
|
21
32
|
/** @deprecated use createBrowserConsoleFormatter */
|
|
22
33
|
|
|
23
34
|
var index = createBrowserConsoleFormatter('light');
|
|
24
35
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
36
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
37
|
//# sourceMappingURL=index-browser-dev.es.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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":";;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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
|
@@ -4,22 +4,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var nightingaleFormatter = require('nightingale-formatter');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
return [string
|
|
31
|
+
var args = [];
|
|
32
|
+
var string = nightingaleFormatter.formatRecordToString(record, style(styleToHtmlStyle, args));
|
|
33
|
+
return [string].concat(args);
|
|
23
34
|
};
|
|
24
35
|
}
|
|
25
36
|
/** @deprecated use createBrowserConsoleFormatter */
|
|
@@ -27,6 +38,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
27
38
|
var index = createBrowserConsoleFormatter('light');
|
|
28
39
|
|
|
29
40
|
exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
|
|
30
|
-
exports
|
|
41
|
+
exports["default"] = index;
|
|
31
42
|
exports.style = style;
|
|
32
43
|
//# 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
|
|
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\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":";;;;;;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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
|
package/dist/index-browser.es.js
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import { formatRecordToString, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
return [string
|
|
27
|
+
var args = [];
|
|
28
|
+
var string = formatRecordToString(record, style(styleToHtmlStyle, args));
|
|
29
|
+
return [string].concat(args);
|
|
19
30
|
};
|
|
20
31
|
}
|
|
21
32
|
/** @deprecated use createBrowserConsoleFormatter */
|
|
22
33
|
|
|
23
34
|
var index = createBrowserConsoleFormatter('light');
|
|
24
35
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
36
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
37
|
//# 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
|
|
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\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":";;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;AAED;;AACA,YAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
|
@@ -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') {
|
|
@@ -22,6 +21,5 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
22
21
|
|
|
23
22
|
const index = createBrowserConsoleFormatter('light');
|
|
24
23
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
24
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
25
|
//# sourceMappingURL=index-browsermodern-dev.es.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
|
@@ -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') {
|
|
@@ -22,6 +21,5 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
22
21
|
|
|
23
22
|
const index = createBrowserConsoleFormatter('light');
|
|
24
23
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
24
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
25
|
//# 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
|
|
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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
|
@@ -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') {
|
|
@@ -27,6 +26,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
27
26
|
const index = createBrowserConsoleFormatter('light');
|
|
28
27
|
|
|
29
28
|
exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
|
|
30
|
-
exports
|
|
29
|
+
exports["default"] = index;
|
|
31
30
|
exports.style = style;
|
|
32
31
|
//# sourceMappingURL=index-node12-dev.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
|
|
@@ -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') {
|
|
@@ -22,6 +21,5 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
22
21
|
|
|
23
22
|
const index = createBrowserConsoleFormatter('light');
|
|
24
23
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
24
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
25
|
//# sourceMappingURL=index-node12-dev.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
package/dist/index-node12.cjs.js
CHANGED
|
@@ -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') {
|
|
@@ -27,6 +26,6 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
27
26
|
const index = createBrowserConsoleFormatter('light');
|
|
28
27
|
|
|
29
28
|
exports.createBrowserConsoleFormatter = createBrowserConsoleFormatter;
|
|
30
|
-
exports
|
|
29
|
+
exports["default"] = index;
|
|
31
30
|
exports.style = style;
|
|
32
31
|
//# sourceMappingURL=index-node12.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;;;"}
|
package/dist/index-node12.mjs
CHANGED
|
@@ -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') {
|
|
@@ -22,6 +21,5 @@ function createBrowserConsoleFormatter(theme = 'light') {
|
|
|
22
21
|
|
|
23
22
|
const index = createBrowserConsoleFormatter('light');
|
|
24
23
|
|
|
25
|
-
export default
|
|
26
|
-
export { createBrowserConsoleFormatter, style };
|
|
24
|
+
export { createBrowserConsoleFormatter, index as default, style };
|
|
27
25
|
//# sourceMappingURL=index-node12.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =\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\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,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;AAED;;AACA,cAAeY,6BAA6B,CAAC,OAAD,CAA5C;;;;"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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;;AAED,oDAAoD;AACpD,wBAAsD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nightingale-browser-console-formatter",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.7.4",
|
|
4
4
|
"description": "Nightingale Browser console formatter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nightingale",
|
|
@@ -14,26 +14,23 @@
|
|
|
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": "
|
|
19
|
+
"node": "^12.20.0 || ^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
|
|
29
|
-
"not
|
|
30
|
-
"not op_mini all"
|
|
25
|
+
"not safari < 10",
|
|
26
|
+
"not ios_saf < 10"
|
|
31
27
|
],
|
|
32
|
-
"main": "./index.js",
|
|
28
|
+
"main": "./dist/index-node12.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
36
|
"development": {
|
|
@@ -72,9 +69,9 @@
|
|
|
72
69
|
"clean": "rm -Rf docs dist test/node6 coverage",
|
|
73
70
|
"generate:test-coverage": "rm -Rf docs/coverage/ ; NODE_ENV=production BABEL_ENV=test jest --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/",
|
|
74
71
|
"lint": "yarn run lint:eslint",
|
|
75
|
-
"lint:eslint": "
|
|
72
|
+
"lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-browser-console-formatter",
|
|
76
73
|
"test": "jest",
|
|
77
|
-
"test:watch": "jest",
|
|
74
|
+
"test:watch": "jest --watch",
|
|
78
75
|
"watch": "pob-watch"
|
|
79
76
|
},
|
|
80
77
|
"prettier": {
|
|
@@ -131,33 +128,23 @@
|
|
|
131
128
|
]
|
|
132
129
|
},
|
|
133
130
|
"dependencies": {
|
|
134
|
-
"nightingale-formatter": "^11.
|
|
135
|
-
"nightingale-types": "^11.
|
|
131
|
+
"nightingale-formatter": "^11.7.4",
|
|
132
|
+
"nightingale-types": "^11.7.4"
|
|
136
133
|
},
|
|
137
134
|
"devDependencies": {
|
|
138
|
-
"@babel/core": "7.
|
|
139
|
-
"@babel/preset-env": "7.
|
|
140
|
-
"@
|
|
141
|
-
"
|
|
142
|
-
"@pob/eslint-config-typescript": "43.0.0",
|
|
143
|
-
"@types/jest": "26.0.21",
|
|
144
|
-
"@typescript-eslint/eslint-plugin": "4.18.0",
|
|
145
|
-
"@typescript-eslint/parser": "4.18.0",
|
|
146
|
-
"babel-jest": "26.6.3",
|
|
135
|
+
"@babel/core": "7.16.0",
|
|
136
|
+
"@babel/preset-env": "7.16.4",
|
|
137
|
+
"@types/jest": "27.0.3",
|
|
138
|
+
"babel-jest": "27.3.1",
|
|
147
139
|
"babel-preset-latest-node": "5.5.1",
|
|
148
140
|
"babel-preset-modern-browsers": "15.0.2",
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"nightingale-levels": "^11.6.0",
|
|
156
|
-
"pob-babel": "26.8.0",
|
|
157
|
-
"pob-lcov-reporter": "4.0.1",
|
|
158
|
-
"rollup": "2.42.1",
|
|
159
|
-
"typescript": "4.2.3",
|
|
141
|
+
"jest": "27.3.1",
|
|
142
|
+
"nightingale-levels": "^11.7.2",
|
|
143
|
+
"pob-babel": "28.5.0",
|
|
144
|
+
"pob-lcov-reporter": "5.4.0",
|
|
145
|
+
"rollup": "2.60.1",
|
|
146
|
+
"typescript": "4.5.2",
|
|
160
147
|
"xunit-file": "1.0.0"
|
|
161
148
|
},
|
|
162
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "70f6b4ba634ff778fc94bef7e2455e8b6a7db06a"
|
|
163
150
|
}
|
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 =
|
|
10
|
-
|
|
11
|
-
string: string
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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',
|