nightingale-html-formatter 15.0.0 → 16.1.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,29 @@
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.1.0](https://github.com/christophehurpeau/nightingale/compare/v16.0.0...v16.1.0) (2025-03-30)
7
+
8
+ Version bump for dependency: nightingale
9
+
10
+
11
+ ## [16.0.0](https://github.com/christophehurpeau/nightingale/compare/v15.0.0...v16.0.0) (2025-03-30)
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * drop node 18
16
+
17
+ ### Features
18
+
19
+ * drop node 18 ([1b11a55](https://github.com/christophehurpeau/nightingale/commit/1b11a55dd24c9435be50519a748316079f554414))
20
+
21
+ ### Bug Fixes
22
+
23
+ * fix lib exports ([5b562b2](https://github.com/christophehurpeau/nightingale/commit/5b562b245aac1aa86b728a9433f3c9d28c62fe04))
24
+
25
+ Version bump for dependency: nightingale
26
+ Version bump for dependency: nightingale-levels
27
+
28
+
6
29
  ## [15.0.0](https://github.com/christophehurpeau/nightingale/compare/v14.2.1...v15.0.0) (2023-12-25)
7
30
 
8
31
 
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": "15.0.0",
4
- "description": "Nightingale HTML formatter",
3
+ "version": "16.1.0",
4
+ "description": "Deprecated: use HTMLFormatter from nightingale instead.",
5
5
  "keywords": [
6
6
  "nightingale",
7
7
  "nightingale-formatter"
@@ -16,72 +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
- "import": "./dist/index-browser.es.js"
43
- }
44
- }
26
+ ".": "./lib/index.js"
45
27
  },
46
- "sideEffects": false,
47
28
  "files": [
48
- "src",
49
- "dist"
29
+ "lib"
50
30
  ],
51
31
  "scripts": {
52
- "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
53
- "build:definitions": "tsc -p tsconfig.json",
54
32
  "clean": "yarn clean:build",
55
- "clean:build": "pob-babel-clean-out dist",
56
33
  "lint": "yarn run lint:eslint",
57
- "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",
58
35
  "test": "yarn ../../ run test -- packages/nightingale-html-formatter",
59
36
  "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
60
37
  },
38
+ "pob": {},
61
39
  "prettier": "@pob/root/prettier-config",
62
- "pob": {
63
- "babelEnvs": [
64
- {
65
- "target": "node",
66
- "version": "18"
67
- },
68
- {
69
- "target": "browser"
70
- }
71
- ],
72
- "entries": [
73
- "index"
74
- ]
75
- },
76
40
  "dependencies": {
77
- "nightingale-formatter": "15.0.0",
78
- "nightingale-types": "15.0.0"
41
+ "nightingale": "16.1.0"
79
42
  },
80
43
  "devDependencies": {
81
- "@babel/core": "7.23.6",
82
- "@babel/preset-env": "7.23.6",
83
- "nightingale-levels": "15.0.0",
84
- "pob-babel": "38.0.0",
85
- "typescript": "5.3.3"
44
+ "nightingale-levels": "16.0.0"
86
45
  }
87
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,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-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;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
- }