nightingale-html-formatter 14.2.1 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
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
+ ## [16.0.0](https://github.com/christophehurpeau/nightingale/compare/v15.0.0...v16.0.0) (2025-03-30)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * drop node 18
11
+
12
+ ### Features
13
+
14
+ * drop node 18 ([1b11a55](https://github.com/christophehurpeau/nightingale/commit/1b11a55dd24c9435be50519a748316079f554414))
15
+
16
+ ### Bug Fixes
17
+
18
+ * fix lib exports ([5b562b2](https://github.com/christophehurpeau/nightingale/commit/5b562b245aac1aa86b728a9433f3c9d28c62fe04))
19
+
20
+ Version bump for dependency: nightingale
21
+ Version bump for dependency: nightingale-levels
22
+
23
+
24
+ ## [15.0.0](https://github.com/christophehurpeau/nightingale/compare/v14.2.1...v15.0.0) (2023-12-25)
25
+
26
+
27
+ ### ⚠ BREAKING CHANGES
28
+
29
+ * update babel and drop browser modern version
30
+
31
+ ### Features
32
+
33
+ * update babel and drop browser modern version ([5c76abc](https://github.com/christophehurpeau/nightingale/commit/5c76abc8bfb595a617fc4c8b795dae7e674ea664))
34
+
35
+ Version bump for dependency: nightingale-formatter
36
+ Version bump for dependency: nightingale-types
37
+ Version bump for dependency: nightingale-levels
38
+
39
+
6
40
  ## [14.2.1](https://github.com/christophehurpeau/nightingale/compare/v14.2.0...v14.2.1) (2023-11-05)
7
41
 
8
42
  Note: no notable changes
package/README.md CHANGED
@@ -1,27 +1,29 @@
1
- <h3 align="center">
1
+ <h1 align="center">
2
2
  nightingale-html-formatter
3
- </h3>
3
+ </h1>
4
4
 
5
5
  <p align="center">
6
- Nightingale HTML formatter
6
+ Deprecated: use HTMLFormatter from nightingale instead.
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/v/nightingale-html-formatter.svg?style=flat-square"></a>
11
- <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/dw/nightingale-html-formatter.svg?style=flat-square"></a>
12
- <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/node/v/nightingale-html-formatter.svg?style=flat-square"></a>
13
- <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/types/nightingale-html-formatter.svg?style=flat-square"></a>
10
+ <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/v/nightingale-html-formatter.svg?style=flat-square" alt="npm version"></a>
11
+ <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/dw/nightingale-html-formatter.svg?style=flat-square" alt="npm downloads"></a>
12
+ <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/node/v/nightingale-html-formatter.svg?style=flat-square" alt="node version"></a>
13
+ <a href="https://npmjs.org/package/nightingale-html-formatter"><img src="https://img.shields.io/npm/types/nightingale-html-formatter.svg?style=flat-square" alt="types"></a>
14
14
  <a href="https://codecov.io/gh/christophehurpeau/nightingale"><img src="https://img.shields.io/codecov/c/github/christophehurpeau/nightingale/master.svg?style=flat-square"></a>
15
15
  </p>
16
16
 
17
17
  ## Install
18
18
 
19
19
  ```sh
20
- npm install --save nightingale-html-formatter
20
+ npm install --save nightingale
21
21
  ```
22
22
 
23
23
  ## Usage
24
24
 
25
25
  ```js
26
- import htmlFormatter from 'nightingale-html-formatter';
26
+ import { HTMLFormatter } from "nightingale";
27
+
28
+ HTMLFormatter.format(record);
27
29
  ```
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { HTMLFormatter } from "nightingale";
2
+
3
+ export default HTMLFormatter.format;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nightingale-html-formatter",
3
- "version": "14.2.1",
4
- "description": "Nightingale HTML formatter",
3
+ "version": "16.0.0",
4
+ "description": "Deprecated: use HTMLFormatter from nightingale instead.",
5
5
  "keywords": [
6
6
  "nightingale",
7
7
  "nightingale-formatter"
@@ -16,79 +16,31 @@
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
17
  "type": "module",
18
18
  "engines": {
19
- "node": ">=18.12.0"
19
+ "node": ">=20.9.0"
20
20
  },
21
- "browserslist": {
22
- "production": [
23
- "defaults",
24
- "> 0.2%",
25
- "not ie < 12",
26
- "not safari < 10",
27
- "not ios_saf < 10"
28
- ]
29
- },
30
- "main": "./dist/index-node18.mjs",
31
- "types": "./dist/definitions/index.d.ts",
32
- "module": "./dist/index-browser.es.js",
33
- "browser": "./dist/index-browser.es.js",
21
+ "sideEffects": false,
22
+ "main": "./lib/index.js",
23
+ "types": "./lib/index.d.ts",
34
24
  "exports": {
35
25
  "./package.json": "./package.json",
36
- ".": {
37
- "types": "./dist/definitions/index.d.ts",
38
- "node": {
39
- "import": "./dist/index-node18.mjs"
40
- },
41
- "browser": {
42
- "browser:modern": {
43
- "import": "./dist/index-browsermodern.es.js"
44
- },
45
- "import": "./dist/index-browser.es.js"
46
- }
47
- }
26
+ ".": "./lib/index.js"
48
27
  },
49
- "sideEffects": false,
50
28
  "files": [
51
- "src",
52
- "dist"
29
+ "lib"
53
30
  ],
54
31
  "scripts": {
55
- "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
56
- "build:definitions": "tsc -p tsconfig.json",
57
32
  "clean": "yarn clean:build",
58
- "clean:build": "pob-babel-clean-out dist",
59
33
  "lint": "yarn run lint:eslint",
60
- "lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-html-formatter",
34
+ "lint:eslint": "yarn ../.. run eslint --quiet packages/nightingale-html-formatter",
61
35
  "test": "yarn ../../ run test -- packages/nightingale-html-formatter",
62
36
  "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
63
37
  },
38
+ "pob": {},
64
39
  "prettier": "@pob/root/prettier-config",
65
- "pob": {
66
- "babelEnvs": [
67
- {
68
- "target": "node",
69
- "version": "18"
70
- },
71
- {
72
- "target": "browser",
73
- "version": "modern"
74
- },
75
- {
76
- "target": "browser"
77
- }
78
- ],
79
- "entries": [
80
- "index"
81
- ]
82
- },
83
40
  "dependencies": {
84
- "nightingale-formatter": "14.2.1",
85
- "nightingale-types": "14.2.1"
41
+ "nightingale": "16.0.0"
86
42
  },
87
43
  "devDependencies": {
88
- "@babel/core": "7.23.2",
89
- "@babel/preset-env": "7.23.2",
90
- "nightingale-levels": "14.2.1",
91
- "pob-babel": "36.6.1",
92
- "typescript": "5.2.2"
44
+ "nightingale-levels": "16.0.0"
93
45
  }
94
46
  }
@@ -1,8 +0,0 @@
1
- import type { Styles, LogRecord, Metadata } from 'nightingale-types';
2
- export declare function style(styles: Styles, string: string): string;
3
- /**
4
- * @param {Object} record
5
- * @returns {string}
6
- */
7
- export default function format<T extends Metadata>(record: LogRecord<T>): string;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErE,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,SAAS,QAAQ,EAC/C,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,MAAM,CAER"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/index.test.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- function style(styles, string) {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
- return "<span style=\"" + styles.map(function (styleName) {
8
- return styleToHtmlStyleThemeLight[styleName].open;
9
- }).join('; ') + "\">" + string + "</span>";
10
- }
11
-
12
- /**
13
- * @param {Object} record
14
- * @returns {string}
15
- */
16
- function format(record) {
17
- return formatRecordToString(record, style);
18
- }
19
-
20
- export { format as default, style };
21
- //# sourceMappingURL=index-browser.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser.es.js","sources":["../src/index.ts"],"sourcesContent":["import {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n} from 'nightingale-formatter';\nimport type { Styles, LogRecord, Metadata } from 'nightingale-types';\n\nexport function style(styles: Styles, string: string): string {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n return `<span style=\"${styles\n .map((styleName: string) => styleToHtmlStyleThemeLight[styleName].open)\n .join('; ')}\">${string}</span>`;\n}\n\n/**\n * @param {Object} record\n * @returns {string}\n */\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return formatRecordToString(record, style);\n}\n"],"names":["style","styles","string","length","map","styleName","styleToHtmlStyleThemeLight","open","join","format","record","formatRecordToString"],"mappings":";;AAMO,SAASA,KAAKA,CAACC,MAAc,EAAEC,MAAc,EAAU;EAC5D,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAA,gBAAA,GAAuBD,MAAM,CAC1BG,GAAG,CAAC,UAACC,SAAiB,EAAA;AAAA,IAAA,OAAKC,0BAA0B,CAACD,SAAS,CAAC,CAACE,IAAI,CAAA;AAAA,GAAA,CAAC,CACtEC,IAAI,CAAC,IAAI,CAAC,WAAKN,MAAM,GAAA,SAAA,CAAA;AAC1B,CAAA;;AAEA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,MAAoB,EACZ;AACR,EAAA,OAAOC,oBAAoB,CAACD,MAAM,EAAEV,KAAK,CAAC,CAAA;AAC5C;;;;"}
@@ -1,19 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- function style(styles, string) {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
- return `<span style="${styles.map(styleName => styleToHtmlStyleThemeLight[styleName].open).join('; ')}">${string}</span>`;
8
- }
9
-
10
- /**
11
- * @param {Object} record
12
- * @returns {string}
13
- */
14
- function format(record) {
15
- return formatRecordToString(record, style);
16
- }
17
-
18
- export { format as default, style };
19
- //# sourceMappingURL=index-browsermodern.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browsermodern.es.js","sources":["../src/index.ts"],"sourcesContent":["import {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n} from 'nightingale-formatter';\nimport type { Styles, LogRecord, Metadata } from 'nightingale-types';\n\nexport function style(styles: Styles, string: string): string {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n return `<span style=\"${styles\n .map((styleName: string) => styleToHtmlStyleThemeLight[styleName].open)\n .join('; ')}\">${string}</span>`;\n}\n\n/**\n * @param {Object} record\n * @returns {string}\n */\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return formatRecordToString(record, style);\n}\n"],"names":["style","styles","string","length","map","styleName","styleToHtmlStyleThemeLight","open","join","format","record","formatRecordToString"],"mappings":";;AAMO,SAASA,KAAKA,CAACC,MAAc,EAAEC,MAAc,EAAU;EAC5D,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;EAEA,OAAQ,CAAA,aAAA,EAAeD,MAAM,CAC1BG,GAAG,CAAEC,SAAiB,IAAKC,0BAA0B,CAACD,SAAS,CAAC,CAACE,IAAI,CAAC,CACtEC,IAAI,CAAC,IAAI,CAAE,CAAIN,EAAAA,EAAAA,MAAO,CAAQ,OAAA,CAAA,CAAA;AACnC,CAAA;;AAEA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,MAAoB,EACZ;AACR,EAAA,OAAOC,oBAAoB,CAACD,MAAM,EAAEV,KAAK,CAAC,CAAA;AAC5C;;;;"}
@@ -1,19 +0,0 @@
1
- import { formatRecordToString, styleToHtmlStyleThemeLight } from 'nightingale-formatter';
2
-
3
- function style(styles, string) {
4
- if (!styles || styles.length === 0 || !string) {
5
- return string;
6
- }
7
- return `<span style="${styles.map(styleName => styleToHtmlStyleThemeLight[styleName].open).join('; ')}">${string}</span>`;
8
- }
9
-
10
- /**
11
- * @param {Object} record
12
- * @returns {string}
13
- */
14
- function format(record) {
15
- return formatRecordToString(record, style);
16
- }
17
-
18
- export { format as default, style };
19
- //# sourceMappingURL=index-node18.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node18.mjs","sources":["../src/index.ts"],"sourcesContent":["import {\n formatRecordToString,\n styleToHtmlStyleThemeLight,\n} from 'nightingale-formatter';\nimport type { Styles, LogRecord, Metadata } from 'nightingale-types';\n\nexport function style(styles: Styles, string: string): string {\n if (!styles || styles.length === 0 || !string) {\n return string;\n }\n\n return `<span style=\"${styles\n .map((styleName: string) => styleToHtmlStyleThemeLight[styleName].open)\n .join('; ')}\">${string}</span>`;\n}\n\n/**\n * @param {Object} record\n * @returns {string}\n */\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return formatRecordToString(record, style);\n}\n"],"names":["style","styles","string","length","map","styleName","styleToHtmlStyleThemeLight","open","join","format","record","formatRecordToString"],"mappings":";;AAMO,SAASA,KAAKA,CAACC,MAAc,EAAEC,MAAc,EAAU;EAC5D,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,IAAI,CAACD,MAAM,EAAE;AAC7C,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;EAEA,OAAQ,CAAA,aAAA,EAAeD,MAAM,CAC1BG,GAAG,CAAEC,SAAiB,IAAKC,0BAA0B,CAACD,SAAS,CAAC,CAACE,IAAI,CAAC,CACtEC,IAAI,CAAC,IAAI,CAAE,CAAIN,EAAAA,EAAAA,MAAO,CAAQ,OAAA,CAAA,CAAA;AACnC,CAAA;;AAEA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,MAAoB,EACZ;AACR,EAAA,OAAOC,oBAAoB,CAACD,MAAM,EAAEV,KAAK,CAAC,CAAA;AAC5C;;;;"}
@@ -1,27 +0,0 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "parserOptions": {
5
- "project": "packages/nightingale-html-formatter/tsconfig.json"
6
- },
7
- "plugins": ["@typescript-eslint"],
8
- "extends": ["@pob/eslint-config-typescript"],
9
- "ignorePatterns": ["*.d.ts"],
10
- "overrides": [
11
- {
12
- "files": ["**/*.test.ts", "__tests__/**/*.ts"],
13
- "extends": ["@pob/eslint-config-typescript/test"],
14
- "env": {
15
- "jest": true
16
- },
17
- "rules": {
18
- "import/no-extraneous-dependencies": [
19
- "error",
20
- {
21
- "devDependencies": true
22
- }
23
- ]
24
- }
25
- }
26
- ]
27
- }
package/src/index.test.ts DELETED
@@ -1,23 +0,0 @@
1
- import { Level } from 'nightingale-levels';
2
- import format, { style } from '.';
3
-
4
- test('blue bold color', () => {
5
- expect(style(['blue', 'bold'], 'test')).toBe(
6
- '<span style="color: #00a0ff; font-weight: bold">test</span>',
7
- );
8
- });
9
-
10
- test('format simple message', () => {
11
- const record = {
12
- key: 'record.key',
13
- level: Level.INFO,
14
- datetime: new Date(2000, 1, 1, 1, 0, 0),
15
- message: 'record.message',
16
- metadata: {},
17
- extra: {},
18
- };
19
-
20
- expect(format(record)).toBe(
21
- '<span style="color: #808080">record.key</span> <span style="color: gray; font-weight: bold">01:00:00</span> → record.message',
22
- );
23
- });
package/src/index.ts DELETED
@@ -1,25 +0,0 @@
1
- import {
2
- formatRecordToString,
3
- styleToHtmlStyleThemeLight,
4
- } from 'nightingale-formatter';
5
- import type { Styles, LogRecord, Metadata } from 'nightingale-types';
6
-
7
- export function style(styles: Styles, string: string): string {
8
- if (!styles || styles.length === 0 || !string) {
9
- return string;
10
- }
11
-
12
- return `<span style="${styles
13
- .map((styleName: string) => styleToHtmlStyleThemeLight[styleName].open)
14
- .join('; ')}">${string}</span>`;
15
- }
16
-
17
- /**
18
- * @param {Object} record
19
- * @returns {string}
20
- */
21
- export default function format<T extends Metadata>(
22
- record: LogRecord<T>,
23
- ): string {
24
- return formatRecordToString(record, style);
25
- }