nightingale-json-formatter 14.2.0 → 15.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,31 @@
|
|
|
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
|
+
## [15.0.0](https://github.com/christophehurpeau/nightingale/compare/v14.2.1...v15.0.0) (2023-12-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* update babel and drop browser modern version
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* update babel and drop browser modern version ([5c76abc](https://github.com/christophehurpeau/nightingale/commit/5c76abc8bfb595a617fc4c8b795dae7e674ea664))
|
|
16
|
+
|
|
17
|
+
Version bump for dependency: nightingale-formatter
|
|
18
|
+
Version bump for dependency: nightingale-types
|
|
19
|
+
Version bump for dependency: nightingale-levels
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [14.2.1](https://github.com/christophehurpeau/nightingale/compare/v14.2.0...v14.2.1) (2023-11-05)
|
|
23
|
+
|
|
24
|
+
Note: no notable changes
|
|
25
|
+
|
|
26
|
+
Version bump for dependency: nightingale-formatter
|
|
27
|
+
Version bump for dependency: nightingale-types
|
|
28
|
+
Version bump for dependency: nightingale-levels
|
|
29
|
+
|
|
30
|
+
|
|
6
31
|
## [14.2.0](https://github.com/christophehurpeau/nightingale/compare/v14.1.0...v14.2.0) (2023-11-04)
|
|
7
32
|
|
|
8
33
|
Note: no notable changes
|
package/dist/index-browser.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function map2object(map) {
|
|
2
|
-
|
|
3
|
-
map.forEach(
|
|
2
|
+
const object = {};
|
|
3
|
+
map.forEach((value, key) => {
|
|
4
4
|
if (typeof key === 'object') {
|
|
5
5
|
// ignore key
|
|
6
6
|
return;
|
|
@@ -10,7 +10,7 @@ function map2object(map) {
|
|
|
10
10
|
return object;
|
|
11
11
|
}
|
|
12
12
|
function stringify(value, space) {
|
|
13
|
-
return JSON.stringify(value,
|
|
13
|
+
return JSON.stringify(value, (key, objectValue) => {
|
|
14
14
|
if (objectValue instanceof Map) {
|
|
15
15
|
return map2object(objectValue);
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { LogRecord, Metadata } from 'nightingale-types';\n\nfunction map2object(map: Map<unknown, unknown>): unknown {\n const object: Record<string, unknown> = {};\n\n map.forEach((value, key) => {\n if (typeof key === 'object') {\n // ignore key\n return;\n }\n\n object[String(key)] = value;\n });\n\n return object;\n}\n\nfunction stringify(value: unknown, space?: number | string): string {\n return JSON.stringify(\n value,\n (key, objectValue) => {\n if (objectValue instanceof Map) {\n return map2object(objectValue);\n }\n if (objectValue instanceof Error) {\n return {\n message: objectValue.message,\n stack: objectValue.stack,\n };\n }\n\n return objectValue as unknown;\n },\n space,\n );\n}\n\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return stringify({\n key: record.key,\n level: record.level,\n datetime: record.datetime,\n message: record.message,\n metadata: record.metadata,\n extra: record.extra,\n });\n}\n"],"names":["map2object","map","object","forEach","value","key","String","stringify","space","JSON","objectValue","Map","Error","message","stack","format","record","level","datetime","metadata","extra"],"mappings":"AAEA,SAASA,UAAUA,CAACC,GAA0B,EAAW;EACvD,
|
|
1
|
+
{"version":3,"file":"index-browser.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { LogRecord, Metadata } from 'nightingale-types';\n\nfunction map2object(map: Map<unknown, unknown>): unknown {\n const object: Record<string, unknown> = {};\n\n map.forEach((value, key) => {\n if (typeof key === 'object') {\n // ignore key\n return;\n }\n\n object[String(key)] = value;\n });\n\n return object;\n}\n\nfunction stringify(value: unknown, space?: number | string): string {\n return JSON.stringify(\n value,\n (key, objectValue) => {\n if (objectValue instanceof Map) {\n return map2object(objectValue);\n }\n if (objectValue instanceof Error) {\n return {\n message: objectValue.message,\n stack: objectValue.stack,\n };\n }\n\n return objectValue as unknown;\n },\n space,\n );\n}\n\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return stringify({\n key: record.key,\n level: record.level,\n datetime: record.datetime,\n message: record.message,\n metadata: record.metadata,\n extra: record.extra,\n });\n}\n"],"names":["map2object","map","object","forEach","value","key","String","stringify","space","JSON","objectValue","Map","Error","message","stack","format","record","level","datetime","metadata","extra"],"mappings":"AAEA,SAASA,UAAUA,CAACC,GAA0B,EAAW;EACvD,MAAMC,MAA+B,GAAG,EAAE,CAAA;AAE1CD,EAAAA,GAAG,CAACE,OAAO,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAC1B,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AAC3B;AACA,MAAA,OAAA;AACF,KAAA;AAEAH,IAAAA,MAAM,CAACI,MAAM,CAACD,GAAG,CAAC,CAAC,GAAGD,KAAK,CAAA;AAC7B,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOF,MAAM,CAAA;AACf,CAAA;AAEA,SAASK,SAASA,CAACH,KAAc,EAAEI,KAAuB,EAAU;EAClE,OAAOC,IAAI,CAACF,SAAS,CACnBH,KAAK,EACL,CAACC,GAAG,EAAEK,WAAW,KAAK;IACpB,IAAIA,WAAW,YAAYC,GAAG,EAAE;MAC9B,OAAOX,UAAU,CAACU,WAAW,CAAC,CAAA;AAChC,KAAA;IACA,IAAIA,WAAW,YAAYE,KAAK,EAAE;MAChC,OAAO;QACLC,OAAO,EAAEH,WAAW,CAACG,OAAO;QAC5BC,KAAK,EAAEJ,WAAW,CAACI,KAAAA;OACpB,CAAA;AACH,KAAA;AAEA,IAAA,OAAOJ,WAAW,CAAA;GACnB,EACDF,KACF,CAAC,CAAA;AACH,CAAA;AAEe,SAASO,MAAMA,CAC5BC,MAAoB,EACZ;AACR,EAAA,OAAOT,SAAS,CAAC;IACfF,GAAG,EAAEW,MAAM,CAACX,GAAG;IACfY,KAAK,EAAED,MAAM,CAACC,KAAK;IACnBC,QAAQ,EAAEF,MAAM,CAACE,QAAQ;IACzBL,OAAO,EAAEG,MAAM,CAACH,OAAO;IACvBM,QAAQ,EAAEH,MAAM,CAACG,QAAQ;IACzBC,KAAK,EAAEJ,MAAM,CAACI,KAAAA;AAChB,GAAC,CAAC,CAAA;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nightingale-json-formatter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "Nightingale JSON formatter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nightingale",
|
|
@@ -39,9 +39,6 @@
|
|
|
39
39
|
"import": "./dist/index-node18.mjs"
|
|
40
40
|
},
|
|
41
41
|
"browser": {
|
|
42
|
-
"browser:modern": {
|
|
43
|
-
"import": "./dist/index-browsermodern.es.js"
|
|
44
|
-
},
|
|
45
42
|
"import": "./dist/index-browser.es.js"
|
|
46
43
|
}
|
|
47
44
|
}
|
|
@@ -68,10 +65,6 @@
|
|
|
68
65
|
"target": "node",
|
|
69
66
|
"version": "18"
|
|
70
67
|
},
|
|
71
|
-
{
|
|
72
|
-
"target": "browser",
|
|
73
|
-
"version": "modern"
|
|
74
|
-
},
|
|
75
68
|
{
|
|
76
69
|
"target": "browser"
|
|
77
70
|
}
|
|
@@ -81,14 +74,14 @@
|
|
|
81
74
|
]
|
|
82
75
|
},
|
|
83
76
|
"dependencies": {
|
|
84
|
-
"nightingale-formatter": "
|
|
85
|
-
"nightingale-types": "
|
|
77
|
+
"nightingale-formatter": "15.0.0",
|
|
78
|
+
"nightingale-types": "15.0.0"
|
|
86
79
|
},
|
|
87
80
|
"devDependencies": {
|
|
88
|
-
"@babel/core": "7.23.
|
|
89
|
-
"@babel/preset-env": "7.23.
|
|
90
|
-
"nightingale-levels": "
|
|
91
|
-
"pob-babel": "
|
|
92
|
-
"typescript": "5.
|
|
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"
|
|
93
86
|
}
|
|
94
87
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function map2object(map) {
|
|
2
|
-
const object = {};
|
|
3
|
-
map.forEach((value, key) => {
|
|
4
|
-
if (typeof key === 'object') {
|
|
5
|
-
// ignore key
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
object[String(key)] = value;
|
|
9
|
-
});
|
|
10
|
-
return object;
|
|
11
|
-
}
|
|
12
|
-
function stringify(value, space) {
|
|
13
|
-
return JSON.stringify(value, (key, objectValue) => {
|
|
14
|
-
if (objectValue instanceof Map) {
|
|
15
|
-
return map2object(objectValue);
|
|
16
|
-
}
|
|
17
|
-
if (objectValue instanceof Error) {
|
|
18
|
-
return {
|
|
19
|
-
message: objectValue.message,
|
|
20
|
-
stack: objectValue.stack
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return objectValue;
|
|
24
|
-
}, space);
|
|
25
|
-
}
|
|
26
|
-
function format(record) {
|
|
27
|
-
return stringify({
|
|
28
|
-
key: record.key,
|
|
29
|
-
level: record.level,
|
|
30
|
-
datetime: record.datetime,
|
|
31
|
-
message: record.message,
|
|
32
|
-
metadata: record.metadata,
|
|
33
|
-
extra: record.extra
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { format as default };
|
|
38
|
-
//# sourceMappingURL=index-browsermodern.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-browsermodern.es.js","sources":["../src/index.ts"],"sourcesContent":["import type { LogRecord, Metadata } from 'nightingale-types';\n\nfunction map2object(map: Map<unknown, unknown>): unknown {\n const object: Record<string, unknown> = {};\n\n map.forEach((value, key) => {\n if (typeof key === 'object') {\n // ignore key\n return;\n }\n\n object[String(key)] = value;\n });\n\n return object;\n}\n\nfunction stringify(value: unknown, space?: number | string): string {\n return JSON.stringify(\n value,\n (key, objectValue) => {\n if (objectValue instanceof Map) {\n return map2object(objectValue);\n }\n if (objectValue instanceof Error) {\n return {\n message: objectValue.message,\n stack: objectValue.stack,\n };\n }\n\n return objectValue as unknown;\n },\n space,\n );\n}\n\nexport default function format<T extends Metadata>(\n record: LogRecord<T>,\n): string {\n return stringify({\n key: record.key,\n level: record.level,\n datetime: record.datetime,\n message: record.message,\n metadata: record.metadata,\n extra: record.extra,\n });\n}\n"],"names":["map2object","map","object","forEach","value","key","String","stringify","space","JSON","objectValue","Map","Error","message","stack","format","record","level","datetime","metadata","extra"],"mappings":"AAEA,SAASA,UAAUA,CAACC,GAA0B,EAAW;EACvD,MAAMC,MAA+B,GAAG,EAAE,CAAA;AAE1CD,EAAAA,GAAG,CAACE,OAAO,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAC1B,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AAC3B;AACA,MAAA,OAAA;AACF,KAAA;AAEAH,IAAAA,MAAM,CAACI,MAAM,CAACD,GAAG,CAAC,CAAC,GAAGD,KAAK,CAAA;AAC7B,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOF,MAAM,CAAA;AACf,CAAA;AAEA,SAASK,SAASA,CAACH,KAAc,EAAEI,KAAuB,EAAU;EAClE,OAAOC,IAAI,CAACF,SAAS,CACnBH,KAAK,EACL,CAACC,GAAG,EAAEK,WAAW,KAAK;IACpB,IAAIA,WAAW,YAAYC,GAAG,EAAE;MAC9B,OAAOX,UAAU,CAACU,WAAW,CAAC,CAAA;AAChC,KAAA;IACA,IAAIA,WAAW,YAAYE,KAAK,EAAE;MAChC,OAAO;QACLC,OAAO,EAAEH,WAAW,CAACG,OAAO;QAC5BC,KAAK,EAAEJ,WAAW,CAACI,KAAAA;OACpB,CAAA;AACH,KAAA;AAEA,IAAA,OAAOJ,WAAW,CAAA;GACnB,EACDF,KACF,CAAC,CAAA;AACH,CAAA;AAEe,SAASO,MAAMA,CAC5BC,MAAoB,EACZ;AACR,EAAA,OAAOT,SAAS,CAAC;IACfF,GAAG,EAAEW,MAAM,CAACX,GAAG;IACfY,KAAK,EAAED,MAAM,CAACC,KAAK;IACnBC,QAAQ,EAAEF,MAAM,CAACE,QAAQ;IACzBL,OAAO,EAAEG,MAAM,CAACH,OAAO;IACvBM,QAAQ,EAAEH,MAAM,CAACG,QAAQ;IACzBC,KAAK,EAAEJ,MAAM,CAACI,KAAAA;AAChB,GAAC,CAAC,CAAA;AACJ;;;;"}
|