@vidavidorra/bunyan-pretty-stream 5.0.0 → 6.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/README.md +1 -1
- package/dist/bunyan/from-json-string.d.ts +1 -1
- package/dist/bunyan/index.d.ts +2 -1
- package/dist/bunyan/index.js +1 -0
- package/dist/bunyan/is-record.d.ts +1 -1
- package/dist/bunyan/is-record.js +3 -3
- package/dist/bunyan/is-source.d.ts +3 -0
- package/dist/bunyan/is-source.js +9 -0
- package/dist/bunyan/record.d.ts +7 -6
- package/dist/bunyan-pretty-stream.d.ts +2 -3
- package/dist/formatter/extras.d.ts +1 -1
- package/dist/formatter/formatter.d.ts +4 -4
- package/dist/formatter/time.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/options.js +2 -2
- package/dist/parser/extras.d.ts +1 -1
- package/dist/parser/parser.d.ts +3 -3
- package/dist/parser/parser.js +3 -2
- package/package.json +3 -3
package/README.md
CHANGED
@@ -58,7 +58,7 @@ Please refer to the [Security Policy on GitHub](https://github.com/vidavidorra/b
|
|
58
58
|
|
59
59
|
This project is licensed under the [GPLv3 license](https://www.gnu.org/licenses/gpl.html).
|
60
60
|
|
61
|
-
Copyright © 2021 Jeroen de Bruijn
|
61
|
+
Copyright © 2021-2023 Jeroen de Bruijn
|
62
62
|
|
63
63
|
<details><summary>License details.</summary>
|
64
64
|
<p>
|
package/dist/bunyan/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
export { default as isSource } from './is-source.js';
|
1
2
|
export { default as isBunyanRecord } from './is-record.js';
|
2
|
-
export
|
3
|
+
export type { BunyanRecord, Source } from './record.js';
|
3
4
|
export { default as coreFields } from './core-fields.js';
|
4
5
|
export { default as fromJsonString } from './from-json-string.js';
|
5
6
|
export { default as levels } from './levels.js';
|
package/dist/bunyan/index.js
CHANGED
package/dist/bunyan/is-record.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import is from '@sindresorhus/is';
|
2
|
+
import isSource from './is-source.js';
|
2
3
|
function isBunyanRecord(value) {
|
3
4
|
return (is.plainObject(value) &&
|
4
5
|
is.number(value.v) &&
|
@@ -9,9 +10,8 @@ function isBunyanRecord(value) {
|
|
9
10
|
is.date(value.time) &&
|
10
11
|
is.string(value.msg) &&
|
11
12
|
(is.undefined(value.src) ||
|
12
|
-
|
13
|
-
|
14
|
-
(is.undefined(value.src.func) || is.string(value.src.func)))));
|
13
|
+
is.emptyObject(value.src) ||
|
14
|
+
isSource(value.src)));
|
15
15
|
}
|
16
16
|
export default isBunyanRecord;
|
17
17
|
//# sourceMappingURL=is-record.js.map
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import is from '@sindresorhus/is';
|
2
|
+
function isSource(value) {
|
3
|
+
return (is.plainObject(value) &&
|
4
|
+
is.string(value.file) &&
|
5
|
+
is.number(value.line) &&
|
6
|
+
(is.undefined(value.func) || is.string(value.func)));
|
7
|
+
}
|
8
|
+
export default isSource;
|
9
|
+
//# sourceMappingURL=is-source.js.map
|
package/dist/bunyan/record.d.ts
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
type Source = {
|
2
|
+
file: string;
|
3
|
+
line: number;
|
4
|
+
func?: string;
|
5
|
+
};
|
1
6
|
type BunyanRecord = {
|
2
7
|
[key: string]: unknown;
|
3
8
|
v: number;
|
@@ -7,10 +12,6 @@ type BunyanRecord = {
|
|
7
12
|
pid: number;
|
8
13
|
time: Date;
|
9
14
|
msg: string;
|
10
|
-
src?:
|
11
|
-
file: string;
|
12
|
-
line: number;
|
13
|
-
func?: string;
|
14
|
-
};
|
15
|
+
src?: Source | Record<string, never>;
|
15
16
|
};
|
16
|
-
export
|
17
|
+
export type { Source, BunyanRecord };
|
@@ -1,8 +1,7 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
3
|
-
import type
|
4
|
-
import {
|
5
|
-
import type { PublicOptions as Options } from './options.js';
|
3
|
+
import { type TransformCallback, Transform } from 'node:stream';
|
4
|
+
import { type PublicOptions as Options } from './options.js';
|
6
5
|
declare class PrettyStream extends Transform {
|
7
6
|
private readonly _formatter;
|
8
7
|
constructor(options?: Options);
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type
|
2
|
-
import type BunyanRecord from '../bunyan/
|
3
|
-
import type
|
4
|
-
import type
|
1
|
+
import { type ChalkInstance as Chalk } from 'chalk';
|
2
|
+
import { type BunyanRecord } from '../bunyan/index.js';
|
3
|
+
import { type PublicOptions } from '../options.js';
|
4
|
+
import { type ParsedRecord } from '../parser/parser.js';
|
5
5
|
declare class Formatter {
|
6
6
|
private readonly _options;
|
7
7
|
private readonly _parser;
|
package/dist/formatter/time.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/options.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { z } from 'zod';
|
2
|
-
import
|
2
|
+
import { coreFields } from './bunyan/index.js';
|
3
3
|
import normalisePath from './helpers/normalise-path.js';
|
4
4
|
const extras = z
|
5
5
|
.object({
|
6
6
|
key: z
|
7
7
|
.string()
|
8
8
|
.min(1)
|
9
|
-
.regex(new RegExp(`^((?!(${
|
9
|
+
.regex(new RegExp(`^((?!(${coreFields.join('|')})).)*$`))
|
10
10
|
.optional(),
|
11
11
|
maxLength: z
|
12
12
|
.object({
|
package/dist/parser/extras.d.ts
CHANGED
package/dist/parser/parser.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import type BunyanRecord from '../bunyan/
|
2
|
-
import type
|
1
|
+
import { type BunyanRecord, type Source } from '../bunyan/index.js';
|
2
|
+
import { type Options } from '../options.js';
|
3
3
|
type ParsedRecord = {
|
4
4
|
version: BunyanRecord['v'];
|
5
5
|
message: BunyanRecord['msg'];
|
6
|
-
source
|
6
|
+
source?: Source;
|
7
7
|
extras: string[];
|
8
8
|
details: Record<string, unknown>;
|
9
9
|
} & Pick<BunyanRecord, 'level' | 'name' | 'hostname' | 'pid' | 'time'>;
|
package/dist/parser/parser.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import is from '@sindresorhus/is';
|
2
|
+
import { isSource } from '../bunyan/index.js';
|
2
3
|
import Extras from './extras.js';
|
3
4
|
class Parser {
|
4
5
|
_extras;
|
@@ -34,7 +35,7 @@ class Parser {
|
|
34
35
|
return record;
|
35
36
|
}
|
36
37
|
toRecord(bunyanRecord) {
|
37
|
-
const { v: version, level, name, hostname, pid, time, msg: message, src
|
38
|
+
const { v: version, level, name, hostname, pid, time, msg: message, src, ...leftOvers } = bunyanRecord;
|
38
39
|
return {
|
39
40
|
version,
|
40
41
|
level,
|
@@ -43,7 +44,7 @@ class Parser {
|
|
43
44
|
pid,
|
44
45
|
time,
|
45
46
|
message,
|
46
|
-
source,
|
47
|
+
source: isSource(src) ? src : undefined,
|
47
48
|
extras: [],
|
48
49
|
details: leftOvers,
|
49
50
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vidavidorra/bunyan-pretty-stream",
|
3
|
-
"version": "
|
3
|
+
"version": "6.0.0",
|
4
4
|
"description": "Highly configurable Bunyan stream with pretty output",
|
5
5
|
"type": "module",
|
6
6
|
"exports": "./dist/index.js",
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"@types/bunyan": "1.8.8",
|
53
53
|
"@types/luxon": "3.2.0",
|
54
54
|
"@types/node": "18.15.0",
|
55
|
-
"@vidavidorra/commitlint-config": "4.0.
|
55
|
+
"@vidavidorra/commitlint-config": "4.0.17",
|
56
56
|
"ava": "5.2.0",
|
57
57
|
"bunyan": "*",
|
58
58
|
"bunyan-1.x": "npm:bunyan@1.8.15",
|
@@ -64,7 +64,7 @@
|
|
64
64
|
"lint-staged": "13.2.0",
|
65
65
|
"npm-run-all": "4.1.5",
|
66
66
|
"prettier": "2.8.4",
|
67
|
-
"semantic-release": "
|
67
|
+
"semantic-release": "21.0.1",
|
68
68
|
"strip-ansi": "7.0.1",
|
69
69
|
"typescript": "5.0.3",
|
70
70
|
"xo": "0.53.1"
|