@visulima/pail 1.0.0 → 1.1.1
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 +27 -0
- package/README.md +3 -3
- package/dist/{abstract-pretty-reporter-doXJ0wsq.d.ts → abstract-pretty-reporter-L82dKD7X.d.ts} +1 -2
- package/dist/{abstract-pretty-reporter-dDQbeuZX.d.cts → abstract-pretty-reporter-SBWxNXW5.d.cts} +1 -2
- package/dist/chunk-2SZMC2SJ.cjs +13 -0
- package/dist/chunk-2SZMC2SJ.cjs.map +1 -0
- package/dist/chunk-576JQ6DN.js +9 -0
- package/dist/chunk-576JQ6DN.js.map +1 -0
- package/dist/chunk-5MNFJRLM.cjs +10 -0
- package/dist/chunk-5MNFJRLM.cjs.map +1 -0
- package/dist/{chunk-4RK45K5E.cjs → chunk-AFMDCM5W.js} +2 -4
- package/dist/chunk-AFMDCM5W.js.map +1 -0
- package/dist/chunk-ETY4VGL2.js +21 -0
- package/dist/chunk-ETY4VGL2.js.map +1 -0
- package/dist/chunk-F4FJCQ4L.cjs +9 -0
- package/dist/chunk-F4FJCQ4L.cjs.map +1 -0
- package/dist/chunk-KERJDMYV.js +8 -0
- package/dist/chunk-KERJDMYV.js.map +1 -0
- package/dist/{chunk-PVAYQO5O.js → chunk-N2UPJYJR.cjs} +4 -2
- package/dist/chunk-N2UPJYJR.cjs.map +1 -0
- package/dist/{chunk-EBP7SMYV.js → chunk-NF47XQ47.js} +3 -3
- package/dist/{chunk-EBP7SMYV.js.map → chunk-NF47XQ47.js.map} +1 -1
- package/dist/chunk-O34IIMWQ.cjs +31 -0
- package/dist/chunk-O34IIMWQ.cjs.map +1 -0
- package/dist/{chunk-MU2CRXVO.cjs → chunk-QINSQ6TU.cjs} +1 -1
- package/dist/{chunk-MU2CRXVO.cjs.map → chunk-QINSQ6TU.cjs.map} +1 -1
- package/dist/chunk-SR3Q3EUO.js +7 -0
- package/dist/chunk-SR3Q3EUO.js.map +1 -0
- package/dist/chunk-TAH23BHM.js +5 -0
- package/dist/chunk-TAH23BHM.js.map +1 -0
- package/dist/chunk-YP3U3DTV.cjs +10 -0
- package/dist/chunk-YP3U3DTV.cjs.map +1 -0
- package/dist/chunk-ZB7IIFHO.js +7 -0
- package/dist/chunk-ZB7IIFHO.js.map +1 -0
- package/dist/chunk-ZJMTPHZR.cjs +7 -0
- package/dist/chunk-ZJMTPHZR.cjs.map +1 -0
- package/dist/index.browser.cjs +7 -8
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +4 -5
- package/dist/index.browser.d.ts +4 -5
- package/dist/index.browser.js +6 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.server.cjs +16 -17
- package/dist/index.server.cjs.map +1 -1
- package/dist/index.server.d.cts +4 -5
- package/dist/index.server.d.ts +4 -5
- package/dist/index.server.js +14 -15
- package/dist/index.server.js.map +1 -1
- package/dist/{pail.browser-DH-2bBhK.d.ts → pail.browser-0Ej0KEkV.d.ts} +1 -2
- package/dist/{pail.browser-eQgV1vak.d.cts → pail.browser-qG_FNUeK.d.cts} +1 -2
- package/dist/processor.browser.cjs +2 -3
- package/dist/processor.browser.d.cts +1 -2
- package/dist/processor.browser.d.ts +1 -2
- package/dist/processor.browser.js +1 -2
- package/dist/processor.server.cjs +2 -3
- package/dist/processor.server.cjs.map +1 -1
- package/dist/processor.server.d.cts +1 -2
- package/dist/processor.server.d.ts +1 -2
- package/dist/processor.server.js +1 -2
- package/dist/processor.server.js.map +1 -1
- package/dist/reporter.browser.cjs +7 -8
- package/dist/reporter.browser.cjs.map +1 -1
- package/dist/reporter.browser.d.cts +2 -3
- package/dist/reporter.browser.d.ts +2 -3
- package/dist/reporter.browser.js +5 -6
- package/dist/reporter.browser.js.map +1 -1
- package/dist/reporter.server.cjs +13 -14
- package/dist/reporter.server.cjs.map +1 -1
- package/dist/reporter.server.d.cts +2 -3
- package/dist/reporter.server.d.ts +2 -3
- package/dist/reporter.server.js +10 -11
- package/dist/reporter.server.js.map +1 -1
- package/dist/{types.d-RNxsa9NR.d.cts → types--_CcxoUw.d.cts} +19 -51
- package/dist/{types.d-RNxsa9NR.d.ts → types--_CcxoUw.d.ts} +19 -51
- package/package.json +6 -9
- package/dist/chunk-32FAOPTJ.cjs +0 -10
- package/dist/chunk-32FAOPTJ.cjs.map +0 -1
- package/dist/chunk-46NTLZF7.cjs +0 -10
- package/dist/chunk-46NTLZF7.cjs.map +0 -1
- package/dist/chunk-4RK45K5E.cjs.map +0 -1
- package/dist/chunk-57OYT2NC.js +0 -7
- package/dist/chunk-57OYT2NC.js.map +0 -1
- package/dist/chunk-6ATEEAVC.cjs +0 -9
- package/dist/chunk-6ATEEAVC.cjs.map +0 -1
- package/dist/chunk-7OFJLC7L.cjs +0 -7
- package/dist/chunk-7OFJLC7L.cjs.map +0 -1
- package/dist/chunk-FJCEDFRI.js +0 -9
- package/dist/chunk-FJCEDFRI.js.map +0 -1
- package/dist/chunk-G62M5WJH.js +0 -8
- package/dist/chunk-G62M5WJH.js.map +0 -1
- package/dist/chunk-GZRIZCRG.cjs +0 -32
- package/dist/chunk-GZRIZCRG.cjs.map +0 -1
- package/dist/chunk-HKIS52YX.js +0 -22
- package/dist/chunk-HKIS52YX.js.map +0 -1
- package/dist/chunk-ICPHL4AR.js +0 -8
- package/dist/chunk-ICPHL4AR.js.map +0 -1
- package/dist/chunk-IQF3SXQR.cjs +0 -10
- package/dist/chunk-IQF3SXQR.cjs.map +0 -1
- package/dist/chunk-JYHWIRFR.js +0 -5
- package/dist/chunk-JYHWIRFR.js.map +0 -1
- package/dist/chunk-PVAYQO5O.js.map +0 -1
- package/dist/chunk-Y36365SA.cjs +0 -13
- package/dist/chunk-Y36365SA.cjs.map +0 -1
- package/dist/chunk-YKHMQW6V.js +0 -5
- package/dist/chunk-YKHMQW6V.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/rotating-file-stream.ts","../src/util/safe-stream-handler.ts","../src/reporter/file/abstract-file-reporter.ts","../src/reporter/file/json-file-reporter.ts","../src/reporter/json/json.server.ts"],"names":["createRfsStream","SafeStreamHandler","stream","name","message","arguments_","error","RotatingFileStream","filePath","writeImmediately","options","fileStream","AbstractFileReporter","rfsOptions","meta","
|
|
1
|
+
{"version":3,"sources":["../src/util/rotating-file-stream.ts","../src/util/safe-stream-handler.ts","../src/reporter/file/abstract-file-reporter.ts","../src/reporter/file/json-file-reporter.ts","../src/reporter/json/json.server.ts"],"names":["createRfsStream","SafeStreamHandler","stream","name","message","arguments_","error","RotatingFileStream","filePath","writeImmediately","options","fileStream","AbstractFileReporter","rfsOptions","meta","JsonFileReporter","#stringify","function_","type","rest","process","JsonReporter","AbstractJsonReporter","#stdout","#stderr","stdout","stderr","logLevel","writeStream"],"mappings":"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","sourcesContent":["import type { Writable } from \"node:stream\";\n\nimport type { Options as RfsOptions } from \"rotating-file-stream\";\nimport { createStream as createRfsStream } from \"rotating-file-stream\";\n\nimport { SafeStreamHandler } from \"./safe-stream-handler\";\n\n/**\n * A wrapper for the `rfs` module that will optionally write to disk immediately\n * by creating and closing a new stream on each write.\n */\nexport class RotatingFileStream {\n private readonly _filePath: string;\n\n private readonly _immediate: boolean;\n\n private readonly _stream: Writable | undefined;\n\n private readonly _options: RfsOptions;\n\n public constructor(filePath: string, writeImmediately = false, options: RfsOptions = {}) {\n this._filePath = filePath;\n this._immediate = writeImmediately;\n this._options = options;\n\n if (!this._immediate) {\n this._stream = createRfsStream(this._filePath, options);\n }\n }\n\n /**\n * Writes `message` to the instance's internal _stream\n * @param message Message to write\n */\n public write(message: string): void {\n let fileStream = this._stream;\n\n if (this._immediate) {\n fileStream = createRfsStream(this._filePath, this._options);\n }\n\n const stream = new SafeStreamHandler(fileStream as Writable, this._filePath);\n\n stream.write(message);\n\n if (this._immediate) {\n stream.end();\n }\n }\n\n /**\n * Ends the instance's internal _stream\n *\n * When `immediate` is not `true`, a call to `write` after calling this method\n * will throw an error.\n */\n public end(): void {\n if (this._stream !== undefined) {\n this._stream.end();\n }\n }\n}\n","import type { Writable } from \"node:stream\";\n\n/**\n * A handler for writable streams that only writes if the stream has finished\n * processing or draining\n */\nexport class SafeStreamHandler {\n public _ready = true;\n\n protected _stream: Writable;\n\n protected _name: string;\n\n public constructor(stream: Writable, name: string) {\n this._stream = stream;\n this._name = name;\n }\n\n /**\n * Writes `message` to the instance's internal stream\n * @param message Message to write\n */\n public write(message: string): void {\n this.writeStream(message);\n }\n\n /**\n * Calls `end` on this instance's internal stream\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public end(...arguments_: any[]): void {\n this._stream.end(...arguments_);\n }\n\n protected writeStream(message: string): void {\n if (!this._ready) {\n // eslint-disable-next-line no-console\n console.warn(\"Stream busy: \" + this._name + '. Write will be dropped: \"' + message + '\"');\n return;\n }\n this._ready = false;\n\n this._stream.on(\"error\", (error) => {\n throw error;\n });\n this._stream.on(\"drain\", () => {\n this._ready = true;\n });\n this._stream.on(\"finish\", () => {\n this._ready = true;\n });\n this._ready = this._stream.write(message, () => {});\n }\n}\n","import type { Options as RfsOptions } from \"rotating-file-stream\";\n\nimport type { ReadonlyMeta, Reporter } from \"../../types\";\nimport { RotatingFileStream } from \"../../util/rotating-file-stream\";\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport type Options = RfsOptions & {\n filePath: string;\n writeImmediately?: boolean;\n};\n\nexport abstract class AbstractFileReporter<L extends string = never> implements Reporter<L> {\n protected _stream: RotatingFileStream;\n\n protected constructor(options: Options) {\n const { filePath, writeImmediately = false, ...rfsOptions } = options;\n\n this._stream = new RotatingFileStream(filePath, writeImmediately, rfsOptions);\n }\n\n public log(meta: ReadonlyMeta<L>): void {\n this._stream.write(this._formatMessage(meta as ReadonlyMeta<L>) + \"\\n\");\n }\n\n protected abstract _formatMessage(data: ReadonlyMeta<L>): string;\n}\n","import type { stringify } from \"safe-stable-stringify\";\n\nimport type { Meta } from \"../../types\";\nimport type { Options as FileReporterOptions } from \"./abstract-file-reporter\";\nimport { AbstractFileReporter } from \"./abstract-file-reporter\";\n\nexport class JsonFileReporter<L extends string = never> extends AbstractFileReporter<L> {\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n #stringify: typeof stringify | undefined;\n\n public constructor(options: FileReporterOptions) {\n super({\n compress: \"gzip\", // compress rotated files\n interval: \"1d\", // rotate daily\n size: \"10M\", // rotate every 10 MegaBytes written\n ...options,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n public setStringify(function_: any): void {\n this.#stringify = function_;\n }\n\n protected _formatMessage(meta: Meta<L>): string {\n const { type, ...rest } = meta;\n\n if (rest.label) {\n rest.label = rest.label.trim();\n }\n\n if (rest.file) {\n // This is a hack to make the file property a string\n (rest as unknown as Omit<Meta<L>, \"file\"> & { file: string }).file =\n rest.file.name + \":\" + rest.file.line + (rest.file.column ? \":\" + rest.file.column : \"\");\n }\n\n return (this.#stringify as typeof stringify)(rest) as string;\n }\n}\n","import process from \"node:process\";\n\nimport type { ExtendedRfc5424LogLevels, LiteralUnion, StreamAwareReporter } from \"../../types\";\nimport { writeStream } from \"../../util/write-stream\";\nimport { AbstractJsonReporter } from \"./abstract-json-reporter\";\n\nexport class JsonReporter<L extends string = never> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {\n #stdout: NodeJS.WriteStream;\n\n #stderr: NodeJS.WriteStream;\n\n public constructor() {\n super();\n\n this.#stdout = process.stdout;\n this.#stderr = process.stderr;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n public setStdout(stdout: NodeJS.WriteStream) {\n this.#stdout = stdout;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n public setStderr(stderr: NodeJS.WriteStream) {\n this.#stderr = stderr;\n }\n\n protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void {\n const stream = [\"error\", \"warn\"].includes(logLevel as string) ? this.#stderr : this.#stdout;\n\n writeStream(message + \"\\n\", stream);\n }\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Options as Options$1 } from 'rotating-file-stream';
|
|
2
|
-
import { R as Reporter,
|
|
3
|
-
import {
|
|
4
|
-
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './abstract-pretty-reporter-dDQbeuZX.cjs';
|
|
2
|
+
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './types--_CcxoUw.cjs';
|
|
3
|
+
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './abstract-pretty-reporter-SBWxNXW5.cjs';
|
|
5
4
|
import '@visulima/colorize';
|
|
6
5
|
import 'safe-stable-stringify';
|
|
7
6
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Options as Options$1 } from 'rotating-file-stream';
|
|
2
|
-
import { R as Reporter,
|
|
3
|
-
import {
|
|
4
|
-
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './abstract-pretty-reporter-doXJ0wsq.js';
|
|
2
|
+
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './types--_CcxoUw.js';
|
|
3
|
+
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './abstract-pretty-reporter-L82dKD7X.js';
|
|
5
4
|
import '@visulima/colorize';
|
|
6
5
|
import 'safe-stable-stringify';
|
|
7
6
|
|
package/dist/reporter.server.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { a as a$
|
|
2
|
-
export { b as PrettyReporter } from './chunk-
|
|
3
|
-
import { a
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import { b, c, a as a$1 } from './chunk-YKHMQW6V.js';
|
|
1
|
+
import { a as a$1 } from './chunk-ETY4VGL2.js';
|
|
2
|
+
export { b as PrettyReporter } from './chunk-ETY4VGL2.js';
|
|
3
|
+
import { a } from './chunk-TAH23BHM.js';
|
|
4
|
+
import './chunk-ZB7IIFHO.js';
|
|
5
|
+
import './chunk-NF47XQ47.js';
|
|
7
6
|
import { createStream } from 'rotating-file-stream';
|
|
8
|
-
import
|
|
7
|
+
import h from 'node:process';
|
|
9
8
|
|
|
10
|
-
var
|
|
11
|
-
`);}};var
|
|
12
|
-
`,
|
|
9
|
+
var n=class{_ready=!0;_stream;_name;constructor(t,r){this._stream=t,this._name=r;}write(t){this.writeStream(t);}end(...t){this._stream.end(...t);}writeStream(t){if(!this._ready){console.warn("Stream busy: "+this._name+'. Write will be dropped: "'+t+'"');return}this._ready=!1,this._stream.on("error",r=>{throw r}),this._stream.on("drain",()=>{this._ready=!0;}),this._stream.on("finish",()=>{this._ready=!0;}),this._ready=this._stream.write(t,()=>{});}};var p=class{_filePath;_immediate;_stream;_options;constructor(t,r=!1,e={}){this._filePath=t,this._immediate=r,this._options=e,this._immediate||(this._stream=createStream(this._filePath,e));}write(t){let r=this._stream;this._immediate&&(r=createStream(this._filePath,this._options));let e=new n(r,this._filePath);e.write(t),this._immediate&&e.end();}end(){this._stream!==void 0&&this._stream.end();}};var o=class{_stream;constructor(t){let{filePath:r,writeImmediately:e=!1,...y}=t;this._stream=new p(r,e,y);}log(t){this._stream.write(this._formatMessage(t)+`
|
|
10
|
+
`);}};var m=class extends o{#t;constructor(t){super({compress:"gzip",interval:"1d",size:"10M",...t});}setStringify(t){this.#t=t;}_formatMessage(t){let{type:r,...e}=t;return e.label&&(e.label=e.label.trim()),e.file&&(e.file=e.file.name+":"+e.file.line+(e.file.column?":"+e.file.column:"")),this.#t(e)}};var l=class extends a{#t;#e;constructor(){super(),this.#t=h.stdout,this.#e=h.stderr;}setStdout(t){this.#t=t;}setStderr(t){this.#e=t;}_log(t,r){let e=["error","warn"].includes(r)?this.#e:this.#t;a$1(t+`
|
|
11
|
+
`,e);}};
|
|
13
12
|
|
|
14
|
-
export {
|
|
13
|
+
export { o as AbstractFileReporter, m as JsonFileReporter, l as JsonReporter };
|
|
15
14
|
//# sourceMappingURL=out.js.map
|
|
16
15
|
//# sourceMappingURL=reporter.server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/rotating-file-stream.ts","../src/util/safe-stream-handler.ts","../src/reporter/file/abstract-file-reporter.ts","../src/reporter/file/json-file-reporter.ts","../src/reporter/json/json.server.ts"],"names":["createRfsStream","SafeStreamHandler","stream","name","message","arguments_","error","RotatingFileStream","filePath","writeImmediately","options","fileStream","AbstractFileReporter","rfsOptions","meta","
|
|
1
|
+
{"version":3,"sources":["../src/util/rotating-file-stream.ts","../src/util/safe-stream-handler.ts","../src/reporter/file/abstract-file-reporter.ts","../src/reporter/file/json-file-reporter.ts","../src/reporter/json/json.server.ts"],"names":["createRfsStream","SafeStreamHandler","stream","name","message","arguments_","error","RotatingFileStream","filePath","writeImmediately","options","fileStream","AbstractFileReporter","rfsOptions","meta","JsonFileReporter","#stringify","function_","type","rest","process","JsonReporter","AbstractJsonReporter","#stdout","#stderr","stdout","stderr","logLevel","writeStream"],"mappings":"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","sourcesContent":["import type { Writable } from \"node:stream\";\n\nimport type { Options as RfsOptions } from \"rotating-file-stream\";\nimport { createStream as createRfsStream } from \"rotating-file-stream\";\n\nimport { SafeStreamHandler } from \"./safe-stream-handler\";\n\n/**\n * A wrapper for the `rfs` module that will optionally write to disk immediately\n * by creating and closing a new stream on each write.\n */\nexport class RotatingFileStream {\n private readonly _filePath: string;\n\n private readonly _immediate: boolean;\n\n private readonly _stream: Writable | undefined;\n\n private readonly _options: RfsOptions;\n\n public constructor(filePath: string, writeImmediately = false, options: RfsOptions = {}) {\n this._filePath = filePath;\n this._immediate = writeImmediately;\n this._options = options;\n\n if (!this._immediate) {\n this._stream = createRfsStream(this._filePath, options);\n }\n }\n\n /**\n * Writes `message` to the instance's internal _stream\n * @param message Message to write\n */\n public write(message: string): void {\n let fileStream = this._stream;\n\n if (this._immediate) {\n fileStream = createRfsStream(this._filePath, this._options);\n }\n\n const stream = new SafeStreamHandler(fileStream as Writable, this._filePath);\n\n stream.write(message);\n\n if (this._immediate) {\n stream.end();\n }\n }\n\n /**\n * Ends the instance's internal _stream\n *\n * When `immediate` is not `true`, a call to `write` after calling this method\n * will throw an error.\n */\n public end(): void {\n if (this._stream !== undefined) {\n this._stream.end();\n }\n }\n}\n","import type { Writable } from \"node:stream\";\n\n/**\n * A handler for writable streams that only writes if the stream has finished\n * processing or draining\n */\nexport class SafeStreamHandler {\n public _ready = true;\n\n protected _stream: Writable;\n\n protected _name: string;\n\n public constructor(stream: Writable, name: string) {\n this._stream = stream;\n this._name = name;\n }\n\n /**\n * Writes `message` to the instance's internal stream\n * @param message Message to write\n */\n public write(message: string): void {\n this.writeStream(message);\n }\n\n /**\n * Calls `end` on this instance's internal stream\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public end(...arguments_: any[]): void {\n this._stream.end(...arguments_);\n }\n\n protected writeStream(message: string): void {\n if (!this._ready) {\n // eslint-disable-next-line no-console\n console.warn(\"Stream busy: \" + this._name + '. Write will be dropped: \"' + message + '\"');\n return;\n }\n this._ready = false;\n\n this._stream.on(\"error\", (error) => {\n throw error;\n });\n this._stream.on(\"drain\", () => {\n this._ready = true;\n });\n this._stream.on(\"finish\", () => {\n this._ready = true;\n });\n this._ready = this._stream.write(message, () => {});\n }\n}\n","import type { Options as RfsOptions } from \"rotating-file-stream\";\n\nimport type { ReadonlyMeta, Reporter } from \"../../types\";\nimport { RotatingFileStream } from \"../../util/rotating-file-stream\";\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport type Options = RfsOptions & {\n filePath: string;\n writeImmediately?: boolean;\n};\n\nexport abstract class AbstractFileReporter<L extends string = never> implements Reporter<L> {\n protected _stream: RotatingFileStream;\n\n protected constructor(options: Options) {\n const { filePath, writeImmediately = false, ...rfsOptions } = options;\n\n this._stream = new RotatingFileStream(filePath, writeImmediately, rfsOptions);\n }\n\n public log(meta: ReadonlyMeta<L>): void {\n this._stream.write(this._formatMessage(meta as ReadonlyMeta<L>) + \"\\n\");\n }\n\n protected abstract _formatMessage(data: ReadonlyMeta<L>): string;\n}\n","import type { stringify } from \"safe-stable-stringify\";\n\nimport type { Meta } from \"../../types\";\nimport type { Options as FileReporterOptions } from \"./abstract-file-reporter\";\nimport { AbstractFileReporter } from \"./abstract-file-reporter\";\n\nexport class JsonFileReporter<L extends string = never> extends AbstractFileReporter<L> {\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n #stringify: typeof stringify | undefined;\n\n public constructor(options: FileReporterOptions) {\n super({\n compress: \"gzip\", // compress rotated files\n interval: \"1d\", // rotate daily\n size: \"10M\", // rotate every 10 MegaBytes written\n ...options,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n public setStringify(function_: any): void {\n this.#stringify = function_;\n }\n\n protected _formatMessage(meta: Meta<L>): string {\n const { type, ...rest } = meta;\n\n if (rest.label) {\n rest.label = rest.label.trim();\n }\n\n if (rest.file) {\n // This is a hack to make the file property a string\n (rest as unknown as Omit<Meta<L>, \"file\"> & { file: string }).file =\n rest.file.name + \":\" + rest.file.line + (rest.file.column ? \":\" + rest.file.column : \"\");\n }\n\n return (this.#stringify as typeof stringify)(rest) as string;\n }\n}\n","import process from \"node:process\";\n\nimport type { ExtendedRfc5424LogLevels, LiteralUnion, StreamAwareReporter } from \"../../types\";\nimport { writeStream } from \"../../util/write-stream\";\nimport { AbstractJsonReporter } from \"./abstract-json-reporter\";\n\nexport class JsonReporter<L extends string = never> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {\n #stdout: NodeJS.WriteStream;\n\n #stderr: NodeJS.WriteStream;\n\n public constructor() {\n super();\n\n this.#stdout = process.stdout;\n this.#stderr = process.stderr;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n public setStdout(stdout: NodeJS.WriteStream) {\n this.#stdout = stdout;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n public setStderr(stderr: NodeJS.WriteStream) {\n this.#stderr = stderr;\n }\n\n protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void {\n const stream = [\"error\", \"warn\"].includes(logLevel as string) ? this.#stderr : this.#stdout;\n\n writeStream(message + \"\\n\", stream);\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { LiteralUnion, Primitive, UnknownArray, UnknownRecord } from 'type-fest';
|
|
3
2
|
|
|
4
3
|
declare class InteractiveStreamHook {
|
|
5
4
|
#private;
|
|
@@ -29,103 +28,70 @@ declare class InteractiveManager {
|
|
|
29
28
|
private _clear;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
/**
|
|
33
|
-
* * This is a special exported interface for other packages/app to declare additional metadata for the logger.
|
|
34
|
-
*/
|
|
35
31
|
declare global {
|
|
36
32
|
namespace VisulimaPail {
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
interface CustomMeta<L> {
|
|
34
|
+
}
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
|
-
|
|
37
|
+
type Primitive = bigint | boolean | number | string | symbol | null | undefined;
|
|
38
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
42
39
|
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
43
40
|
badge: string | undefined;
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
41
|
context: any[] | undefined;
|
|
46
42
|
date: Date | string;
|
|
47
43
|
error: Error | undefined;
|
|
48
44
|
groups: string[];
|
|
49
45
|
label: string | undefined;
|
|
50
|
-
message: Primitive |
|
|
46
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
|
|
51
47
|
prefix: string | undefined;
|
|
52
48
|
repeated?: number | undefined;
|
|
53
49
|
scope: string[] | undefined;
|
|
54
50
|
suffix: string | undefined;
|
|
55
|
-
traceError: Error | undefined;
|
|
51
|
+
traceError: Error | undefined;
|
|
56
52
|
type: {
|
|
57
53
|
level: ExtendedRfc5424LogLevels | L;
|
|
58
54
|
name: string;
|
|
59
55
|
};
|
|
60
56
|
}
|
|
61
|
-
|
|
62
57
|
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| "critical"
|
|
69
|
-
| "debug"
|
|
70
|
-
| "emergency"
|
|
71
|
-
| "error"
|
|
72
|
-
| "info"
|
|
73
|
-
| "log"
|
|
74
|
-
| "notice"
|
|
75
|
-
| "pending"
|
|
76
|
-
| "start"
|
|
77
|
-
| "stop"
|
|
78
|
-
| "success"
|
|
79
|
-
| "trace"
|
|
80
|
-
| "wait"
|
|
81
|
-
| "warn"
|
|
82
|
-
| "watch";
|
|
83
|
-
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
type LoggerFunction = (...message: any[]) => void;
|
|
86
|
-
// alias for backward-compatibility
|
|
58
|
+
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
59
|
+
interface LoggerFunction {
|
|
60
|
+
(...message: any[]): void;
|
|
61
|
+
(message: Message): void;
|
|
62
|
+
}
|
|
87
63
|
interface LoggerConfiguration<L extends string = never> {
|
|
88
64
|
badge?: string;
|
|
89
65
|
color?: AnsiColors | undefined;
|
|
90
66
|
label: string;
|
|
91
67
|
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
92
68
|
}
|
|
93
|
-
|
|
94
69
|
type LoggerTypesConfig<T extends string, L extends string = never> = Record<T, Partial<LoggerConfiguration<L>>>;
|
|
95
70
|
type DefaultLoggerTypes<L extends string = never> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
|
|
96
|
-
|
|
97
71
|
type ReadonlyMeta<L extends string = never> = Readonly<Meta<L>>;
|
|
98
|
-
|
|
99
72
|
interface Reporter<L extends string = never> {
|
|
100
73
|
log: (meta: ReadonlyMeta<L>) => void;
|
|
101
74
|
}
|
|
102
|
-
|
|
103
75
|
interface StreamAwareReporter<L extends string = never> extends Reporter<L> {
|
|
104
76
|
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
105
77
|
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
106
78
|
}
|
|
107
|
-
|
|
108
79
|
interface LoggerTypesAwareReporter<T extends string = never, L extends string = never> extends Reporter<L> {
|
|
109
80
|
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
110
81
|
}
|
|
111
|
-
|
|
112
82
|
interface StringifyAwareReporter<L extends string = never> extends Reporter<L> {
|
|
113
83
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
114
84
|
}
|
|
115
|
-
|
|
116
85
|
interface InteractiveStreamReporter<L extends string = never> extends StreamAwareReporter<L> {
|
|
117
86
|
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
118
87
|
setIsInteractive: (interactive: boolean) => void;
|
|
119
88
|
}
|
|
120
|
-
|
|
121
89
|
interface Processor<L extends string = never> {
|
|
122
90
|
process: (meta: Meta<L>) => Meta<L>;
|
|
123
91
|
}
|
|
124
|
-
|
|
125
92
|
interface StringifyAwareProcessor<L extends string = never> extends Processor<L> {
|
|
126
93
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
127
94
|
}
|
|
128
|
-
|
|
129
95
|
interface ConstructorOptions<T extends string = never, L extends string = never> {
|
|
130
96
|
disabled?: boolean;
|
|
131
97
|
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
@@ -140,16 +106,18 @@ interface ConstructorOptions<T extends string = never, L extends string = never>
|
|
|
140
106
|
scope?: string[] | string;
|
|
141
107
|
throttle?: number;
|
|
142
108
|
throttleMin?: number;
|
|
143
|
-
// we can't negate DefaultLogTypes from string
|
|
144
|
-
// see https://github.com/microsoft/TypeScript/pull/29317 (not merged as for 31 march 2021)
|
|
145
|
-
// so we can't distinguish logger configuration between default log types and passed one
|
|
146
109
|
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
147
110
|
}
|
|
148
|
-
|
|
149
111
|
interface ServerConstructorOptions<T extends string = never, L extends string = never> extends ConstructorOptions<T, L> {
|
|
150
112
|
interactive?: boolean;
|
|
151
113
|
stderr?: NodeJS.WriteStream;
|
|
152
114
|
stdout?: NodeJS.WriteStream;
|
|
153
115
|
}
|
|
154
|
-
|
|
155
|
-
|
|
116
|
+
type Message = {
|
|
117
|
+
context?: any[] | undefined;
|
|
118
|
+
message: Primitive | ReadonlyArray<unknown> | undefined;
|
|
119
|
+
prefix?: string;
|
|
120
|
+
suffix?: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { type ConstructorOptions as C, type DefaultLoggerTypes as D, type ExtendedRfc5424LogLevels as E, InteractiveManager as I, type LoggerConfiguration as L, type Meta as M, type Processor as P, type Reporter as R, type StreamAwareReporter as S, type DefaultLogTypes as a, type LoggerFunction as b, type LoggerTypesAwareReporter as c, type LoggerTypesConfig as d, type LiteralUnion as e, type ServerConstructorOptions as f, type ReadonlyMeta as g, type StringifyAwareReporter as h, type InteractiveStreamReporter as i, type StringifyAwareProcessor as j };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { LiteralUnion, Primitive, UnknownArray, UnknownRecord } from 'type-fest';
|
|
3
2
|
|
|
4
3
|
declare class InteractiveStreamHook {
|
|
5
4
|
#private;
|
|
@@ -29,103 +28,70 @@ declare class InteractiveManager {
|
|
|
29
28
|
private _clear;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
/**
|
|
33
|
-
* * This is a special exported interface for other packages/app to declare additional metadata for the logger.
|
|
34
|
-
*/
|
|
35
31
|
declare global {
|
|
36
32
|
namespace VisulimaPail {
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
interface CustomMeta<L> {
|
|
34
|
+
}
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
|
-
|
|
37
|
+
type Primitive = bigint | boolean | number | string | symbol | null | undefined;
|
|
38
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
42
39
|
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
43
40
|
badge: string | undefined;
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
41
|
context: any[] | undefined;
|
|
46
42
|
date: Date | string;
|
|
47
43
|
error: Error | undefined;
|
|
48
44
|
groups: string[];
|
|
49
45
|
label: string | undefined;
|
|
50
|
-
message: Primitive |
|
|
46
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
|
|
51
47
|
prefix: string | undefined;
|
|
52
48
|
repeated?: number | undefined;
|
|
53
49
|
scope: string[] | undefined;
|
|
54
50
|
suffix: string | undefined;
|
|
55
|
-
traceError: Error | undefined;
|
|
51
|
+
traceError: Error | undefined;
|
|
56
52
|
type: {
|
|
57
53
|
level: ExtendedRfc5424LogLevels | L;
|
|
58
54
|
name: string;
|
|
59
55
|
};
|
|
60
56
|
}
|
|
61
|
-
|
|
62
57
|
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| "critical"
|
|
69
|
-
| "debug"
|
|
70
|
-
| "emergency"
|
|
71
|
-
| "error"
|
|
72
|
-
| "info"
|
|
73
|
-
| "log"
|
|
74
|
-
| "notice"
|
|
75
|
-
| "pending"
|
|
76
|
-
| "start"
|
|
77
|
-
| "stop"
|
|
78
|
-
| "success"
|
|
79
|
-
| "trace"
|
|
80
|
-
| "wait"
|
|
81
|
-
| "warn"
|
|
82
|
-
| "watch";
|
|
83
|
-
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
type LoggerFunction = (...message: any[]) => void;
|
|
86
|
-
// alias for backward-compatibility
|
|
58
|
+
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
59
|
+
interface LoggerFunction {
|
|
60
|
+
(...message: any[]): void;
|
|
61
|
+
(message: Message): void;
|
|
62
|
+
}
|
|
87
63
|
interface LoggerConfiguration<L extends string = never> {
|
|
88
64
|
badge?: string;
|
|
89
65
|
color?: AnsiColors | undefined;
|
|
90
66
|
label: string;
|
|
91
67
|
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
92
68
|
}
|
|
93
|
-
|
|
94
69
|
type LoggerTypesConfig<T extends string, L extends string = never> = Record<T, Partial<LoggerConfiguration<L>>>;
|
|
95
70
|
type DefaultLoggerTypes<L extends string = never> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
|
|
96
|
-
|
|
97
71
|
type ReadonlyMeta<L extends string = never> = Readonly<Meta<L>>;
|
|
98
|
-
|
|
99
72
|
interface Reporter<L extends string = never> {
|
|
100
73
|
log: (meta: ReadonlyMeta<L>) => void;
|
|
101
74
|
}
|
|
102
|
-
|
|
103
75
|
interface StreamAwareReporter<L extends string = never> extends Reporter<L> {
|
|
104
76
|
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
105
77
|
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
106
78
|
}
|
|
107
|
-
|
|
108
79
|
interface LoggerTypesAwareReporter<T extends string = never, L extends string = never> extends Reporter<L> {
|
|
109
80
|
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
110
81
|
}
|
|
111
|
-
|
|
112
82
|
interface StringifyAwareReporter<L extends string = never> extends Reporter<L> {
|
|
113
83
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
114
84
|
}
|
|
115
|
-
|
|
116
85
|
interface InteractiveStreamReporter<L extends string = never> extends StreamAwareReporter<L> {
|
|
117
86
|
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
118
87
|
setIsInteractive: (interactive: boolean) => void;
|
|
119
88
|
}
|
|
120
|
-
|
|
121
89
|
interface Processor<L extends string = never> {
|
|
122
90
|
process: (meta: Meta<L>) => Meta<L>;
|
|
123
91
|
}
|
|
124
|
-
|
|
125
92
|
interface StringifyAwareProcessor<L extends string = never> extends Processor<L> {
|
|
126
93
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
127
94
|
}
|
|
128
|
-
|
|
129
95
|
interface ConstructorOptions<T extends string = never, L extends string = never> {
|
|
130
96
|
disabled?: boolean;
|
|
131
97
|
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
@@ -140,16 +106,18 @@ interface ConstructorOptions<T extends string = never, L extends string = never>
|
|
|
140
106
|
scope?: string[] | string;
|
|
141
107
|
throttle?: number;
|
|
142
108
|
throttleMin?: number;
|
|
143
|
-
// we can't negate DefaultLogTypes from string
|
|
144
|
-
// see https://github.com/microsoft/TypeScript/pull/29317 (not merged as for 31 march 2021)
|
|
145
|
-
// so we can't distinguish logger configuration between default log types and passed one
|
|
146
109
|
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
147
110
|
}
|
|
148
|
-
|
|
149
111
|
interface ServerConstructorOptions<T extends string = never, L extends string = never> extends ConstructorOptions<T, L> {
|
|
150
112
|
interactive?: boolean;
|
|
151
113
|
stderr?: NodeJS.WriteStream;
|
|
152
114
|
stdout?: NodeJS.WriteStream;
|
|
153
115
|
}
|
|
154
|
-
|
|
155
|
-
|
|
116
|
+
type Message = {
|
|
117
|
+
context?: any[] | undefined;
|
|
118
|
+
message: Primitive | ReadonlyArray<unknown> | undefined;
|
|
119
|
+
prefix?: string;
|
|
120
|
+
suffix?: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { type ConstructorOptions as C, type DefaultLoggerTypes as D, type ExtendedRfc5424LogLevels as E, InteractiveManager as I, type LoggerConfiguration as L, type Meta as M, type Processor as P, type Reporter as R, type StreamAwareReporter as S, type DefaultLogTypes as a, type LoggerFunction as b, type LoggerTypesAwareReporter as c, type LoggerTypesConfig as d, type LiteralUnion as e, type ServerConstructorOptions as f, type ReadonlyMeta as g, type StringifyAwareReporter as h, type InteractiveStreamReporter as i, type StringifyAwareProcessor as j };
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pail",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Find a file or directory by walking up parent directories.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
7
|
-
"box",
|
|
8
|
-
"boxen",
|
|
9
7
|
"browser",
|
|
10
8
|
"browser-logger",
|
|
11
9
|
"callsite",
|
|
@@ -166,7 +164,7 @@
|
|
|
166
164
|
],
|
|
167
165
|
"scripts": {
|
|
168
166
|
"build": "cross-env NODE_ENV=development tsup",
|
|
169
|
-
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
167
|
+
"build:prod": "node ./scripts/wait.js && cross-env NODE_ENV=production tsup",
|
|
170
168
|
"clean": "rimraf node_modules dist .eslintcache",
|
|
171
169
|
"dev": "pnpm run build --watch",
|
|
172
170
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
@@ -181,8 +179,8 @@
|
|
|
181
179
|
"test:watch": "vitest"
|
|
182
180
|
},
|
|
183
181
|
"dependencies": {
|
|
184
|
-
"@visulima/colorize": "1.
|
|
185
|
-
"@visulima/fmt": "1.1.
|
|
182
|
+
"@visulima/colorize": "1.3.0",
|
|
183
|
+
"@visulima/fmt": "1.1.3",
|
|
186
184
|
"safe-stable-stringify": "^2.4.3",
|
|
187
185
|
"string-length": "^6.0.0",
|
|
188
186
|
"terminal-size": "^4.0.0",
|
|
@@ -192,7 +190,7 @@
|
|
|
192
190
|
"@anolilab/eslint-config": "^15.0.3",
|
|
193
191
|
"@anolilab/prettier-config": "^5.0.14",
|
|
194
192
|
"@anolilab/semantic-release-preset": "^8.0.3",
|
|
195
|
-
"@babel/core": "^7.
|
|
193
|
+
"@babel/core": "^7.24.0",
|
|
196
194
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
197
195
|
"@secretlint/secretlint-rule-preset-recommend": "^8.1.2",
|
|
198
196
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
@@ -214,8 +212,7 @@
|
|
|
214
212
|
"semantic-release": "^23.0.2",
|
|
215
213
|
"sort-package-json": "^2.8.0",
|
|
216
214
|
"tsup": "^8.0.2",
|
|
217
|
-
"
|
|
218
|
-
"typescript": "^5.3.3",
|
|
215
|
+
"typescript": "^5.4.2",
|
|
219
216
|
"vitest": "^1.3.1"
|
|
220
217
|
},
|
|
221
218
|
"peerDependencies": {
|
package/dist/chunk-32FAOPTJ.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk4RK45K5E_cjs = require('./chunk-4RK45K5E.cjs');
|
|
4
|
-
var chunk7OFJLC7L_cjs = require('./chunk-7OFJLC7L.cjs');
|
|
5
|
-
|
|
6
|
-
var t=class extends chunk7OFJLC7L_cjs.a{constructor(){super();}_log(r,n){chunk4RK45K5E_cjs.a(n)(r);}};
|
|
7
|
-
|
|
8
|
-
exports.a = t;
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-32FAOPTJ.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/reporter/json/json.browser.ts"],"names":["JsonReporter","AbstractJsonReporter","message","logLevel","writeConsoleLogBasedOnLevel"],"mappings":"kFAMO,IAAMA,EAAN,cAAqDC,CAAwB,CACzE,aAAc,CACjB,MAAM,CACV,CAGmB,KAAKC,EAAiBC,EAA2D,CACrEC,EAA4BD,CAAQ,EAE5CD,CAAO,CAC9B,CACJ","sourcesContent":["import type { LiteralUnion } from \"type-fest\";\n\nimport type { ExtendedRfc5424LogLevels } from \"../../types\";\nimport { writeConsoleLogBasedOnLevel } from \"../../util/write-console-log\";\nimport { AbstractJsonReporter } from \"./abstract-json-reporter\";\n\nexport class JsonReporter<L extends string = never> extends AbstractJsonReporter<L> {\n public constructor() {\n super();\n }\n\n // eslint-disable-next-line class-methods-use-this\n protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void {\n const consoleLogFunction = writeConsoleLogBasedOnLevel(logLevel);\n\n consoleLogFunction(message);\n }\n}\n"]}
|
package/dist/chunk-46NTLZF7.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkMU2CRXVO_cjs = require('./chunk-MU2CRXVO.cjs');
|
|
4
|
-
|
|
5
|
-
var a=o=>{let e=Object.keys(o).map(t=>o[t].badge??"");return e.length===0?"":e.reduce((t,r)=>t.length>r.length?t:r)};var n=class{constructor(e){this._styles={bold:{label:!1},dateFormatter:t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(r=>String(r).padStart(2,"0")).join(":"),underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this._loggerTypes=chunkMU2CRXVO_cjs.b;}setStringify(e){this._stringify=e;}setLoggerTypes(e){this._loggerTypes=e;}};
|
|
6
|
-
|
|
7
|
-
exports.a = a;
|
|
8
|
-
exports.b = n;
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-46NTLZF7.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/get-longest-badge.ts","../src/reporter/pretty/abstract-pretty-reporter.ts"],"names":["getLongestBadge","types","badges","x","y","AbstractPrettyReporter","options","date","n","LOG_TYPES","function_"],"mappings":"yCAIO,IAAMA,EAAuDC,GAA0E,CAE1I,IAAMC,EAAS,OAAO,KAAKD,CAAK,EAAE,IAAKE,GAAMF,EAAME,CAAM,EAAE,OAAS,EAAE,EAEtE,OAAID,EAAO,SAAW,EACX,GAIJA,EAAO,OAAO,CAACC,EAAGC,IAAOD,EAAE,OAASC,EAAE,OAASD,EAAIC,CAAE,CAChE,ECRO,IAAeC,EAAf,KAEP,CAOc,YAAYC,EAAsC,CACxD,KAAK,QAAU,CACX,KAAM,CACF,MAAO,EACX,EACA,cAAgBC,GAAe,CAACA,EAAK,SAAS,EAAGA,EAAK,WAAW,EAAGA,EAAK,WAAW,CAAC,EAAE,IAAKC,GAAM,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,CAAC,EAAE,KAAK,GAAG,EACtI,UAAW,CACP,MAAO,GACP,QAAS,GACT,OAAQ,GACR,OAAQ,EACZ,EACA,UAAW,CACP,MAAO,EACX,EACA,GAAGF,CACP,EAEA,KAAK,aAAeG,CACxB,CAGO,aAAaC,EAAsB,CACtC,KAAK,WAAaA,CACtB,CAEO,eAAeT,EAAqE,CACvF,KAAK,aAAeA,CACxB,CAGJ","sourcesContent":["import type { LiteralUnion } from \"type-fest\";\n\nimport type { DefaultLogTypes, LoggerTypesConfig } from \"../types\";\n\nexport const getLongestBadge = <L extends string, T extends string>(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): string => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const badges = Object.keys(types).map((x) => types[x as T].badge ?? \"\");\n\n if (badges.length === 0) {\n return \"\";\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return badges.reduce((x, y) => (x.length > y.length ? x : y));\n};\n","import type { stringify } from \"safe-stable-stringify\";\nimport type { LiteralUnion } from \"type-fest\";\n\nimport { LOG_TYPES } from \"../../constants\";\nimport type { DefaultLogTypes, LoggerTypesAwareReporter, LoggerTypesConfig, ReadonlyMeta, StringifyAwareReporter } from \"../../types\";\n\nexport abstract class AbstractPrettyReporter<T extends string = never, L extends string = never>\n implements LoggerTypesAwareReporter<T, L>, StringifyAwareReporter<L>\n{\n protected readonly _styles: PrettyStyleOptions;\n\n protected _loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;\n\n protected _stringify: typeof stringify | undefined;\n\n protected constructor(options: Partial<PrettyStyleOptions>) {\n this._styles = {\n bold: {\n label: false,\n },\n dateFormatter: (date: Date) => [date.getHours(), date.getMinutes(), date.getSeconds()].map((n) => String(n).padStart(2, \"0\")).join(\":\"),\n underline: {\n label: false,\n message: false,\n prefix: false,\n suffix: false,\n },\n uppercase: {\n label: false,\n },\n ...options,\n } as PrettyStyleOptions;\n\n this._loggerTypes = LOG_TYPES as LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n public setStringify(function_: any): void {\n this._stringify = function_;\n }\n\n public setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void {\n this._loggerTypes = types;\n }\n\n public abstract log(meta: ReadonlyMeta<L>): void;\n}\n\nexport type PrettyStyleOptions = {\n bold: {\n label: boolean;\n };\n dateFormatter: (date: Date) => string;\n // Length of the message before a line break is inserted\n messageLength: number | undefined;\n underline: {\n label: boolean;\n prefix: boolean;\n suffix: boolean;\n };\n uppercase: {\n label: boolean;\n };\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/write-console-log.ts"],"names":["writeConsoleLogBasedOnLevel","level"],"mappings":"AAKO,IAAMA,EAAyDC,GAC9DA,IAAU,QAEF,QAAgB,SAAW,QAAQ,MAG3CA,IAAU,OAEF,QAAgB,QAAU,QAAQ,KAG1CA,IAAU,QAEF,QAAgB,SAAW,QAAQ,MAIvC,QAAgB,OAAS,QAAQ","sourcesContent":["import type { LiteralUnion } from \"type-fest\";\n\nimport type { ExtendedRfc5424LogLevels } from \"../types\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const writeConsoleLogBasedOnLevel = <L extends string = never>(level: LiteralUnion<ExtendedRfc5424LogLevels, L>): ((...data: any[]) => void) => {\n if (level === \"error\") {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,no-console\n return (console as any).__error ?? console.error;\n }\n\n if (level === \"warn\") {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,no-console\n return (console as any).__warn ?? console.warn;\n }\n\n if (level === \"trace\") {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,no-console\n return (console as any).__trace ?? console.trace;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,no-console\n return (console as any).__log ?? console.log;\n};\n"]}
|
package/dist/chunk-57OYT2NC.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { b } from './chunk-EBP7SMYV.js';
|
|
2
|
-
|
|
3
|
-
var g=o=>{let e=Object.keys(o).map(t=>o[t].badge??"");return e.length===0?"":e.reduce((t,r)=>t.length>r.length?t:r)};var n=class{constructor(e){this._styles={bold:{label:!1},dateFormatter:t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(r=>String(r).padStart(2,"0")).join(":"),underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this._loggerTypes=b;}setStringify(e){this._stringify=e;}setLoggerTypes(e){this._loggerTypes=e;}};
|
|
4
|
-
|
|
5
|
-
export { g as a, n as b };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-57OYT2NC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/get-longest-badge.ts","../src/reporter/pretty/abstract-pretty-reporter.ts"],"names":["getLongestBadge","types","badges","x","y","AbstractPrettyReporter","options","date","n","LOG_TYPES","function_"],"mappings":"wCAIO,IAAMA,EAAuDC,GAA0E,CAE1I,IAAMC,EAAS,OAAO,KAAKD,CAAK,EAAE,IAAKE,GAAMF,EAAME,CAAM,EAAE,OAAS,EAAE,EAEtE,OAAID,EAAO,SAAW,EACX,GAIJA,EAAO,OAAO,CAACC,EAAGC,IAAOD,EAAE,OAASC,EAAE,OAASD,EAAIC,CAAE,CAChE,ECRO,IAAeC,EAAf,KAEP,CAOc,YAAYC,EAAsC,CACxD,KAAK,QAAU,CACX,KAAM,CACF,MAAO,EACX,EACA,cAAgBC,GAAe,CAACA,EAAK,SAAS,EAAGA,EAAK,WAAW,EAAGA,EAAK,WAAW,CAAC,EAAE,IAAKC,GAAM,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,CAAC,EAAE,KAAK,GAAG,EACtI,UAAW,CACP,MAAO,GACP,QAAS,GACT,OAAQ,GACR,OAAQ,EACZ,EACA,UAAW,CACP,MAAO,EACX,EACA,GAAGF,CACP,EAEA,KAAK,aAAeG,CACxB,CAGO,aAAaC,EAAsB,CACtC,KAAK,WAAaA,CACtB,CAEO,eAAeT,EAAqE,CACvF,KAAK,aAAeA,CACxB,CAGJ","sourcesContent":["import type { LiteralUnion } from \"type-fest\";\n\nimport type { DefaultLogTypes, LoggerTypesConfig } from \"../types\";\n\nexport const getLongestBadge = <L extends string, T extends string>(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): string => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const badges = Object.keys(types).map((x) => types[x as T].badge ?? \"\");\n\n if (badges.length === 0) {\n return \"\";\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return badges.reduce((x, y) => (x.length > y.length ? x : y));\n};\n","import type { stringify } from \"safe-stable-stringify\";\nimport type { LiteralUnion } from \"type-fest\";\n\nimport { LOG_TYPES } from \"../../constants\";\nimport type { DefaultLogTypes, LoggerTypesAwareReporter, LoggerTypesConfig, ReadonlyMeta, StringifyAwareReporter } from \"../../types\";\n\nexport abstract class AbstractPrettyReporter<T extends string = never, L extends string = never>\n implements LoggerTypesAwareReporter<T, L>, StringifyAwareReporter<L>\n{\n protected readonly _styles: PrettyStyleOptions;\n\n protected _loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;\n\n protected _stringify: typeof stringify | undefined;\n\n protected constructor(options: Partial<PrettyStyleOptions>) {\n this._styles = {\n bold: {\n label: false,\n },\n dateFormatter: (date: Date) => [date.getHours(), date.getMinutes(), date.getSeconds()].map((n) => String(n).padStart(2, \"0\")).join(\":\"),\n underline: {\n label: false,\n message: false,\n prefix: false,\n suffix: false,\n },\n uppercase: {\n label: false,\n },\n ...options,\n } as PrettyStyleOptions;\n\n this._loggerTypes = LOG_TYPES as LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n public setStringify(function_: any): void {\n this._stringify = function_;\n }\n\n public setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void {\n this._loggerTypes = types;\n }\n\n public abstract log(meta: ReadonlyMeta<L>): void;\n}\n\nexport type PrettyStyleOptions = {\n bold: {\n label: boolean;\n };\n dateFormatter: (date: Date) => string;\n // Length of the message before a line break is inserted\n messageLength: number | undefined;\n underline: {\n label: boolean;\n prefix: boolean;\n suffix: boolean;\n };\n uppercase: {\n label: boolean;\n };\n};\n"]}
|
package/dist/chunk-6ATEEAVC.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var e=(a,b,c)=>{if(!b.has(a))throw TypeError("Cannot "+c)};var f=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),g=(a,b,c)=>{if(b.has(a))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(a):b.set(a,c);},h=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c);
|
|
4
|
-
|
|
5
|
-
exports.a = f;
|
|
6
|
-
exports.b = g;
|
|
7
|
-
exports.c = h;
|
|
8
|
-
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-6ATEEAVC.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/dist/chunk-7OFJLC7L.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var n=class{setStringify(i){this._stringify=i;}log(i){let{file:t,type:s,...e}=i;e.label&&(e.label=e.label.trim()),t&&(e.file=t.name+":"+t.line+(t.column?":"+t.column:"")),e.scope?.length===0&&delete e.scope,this._log(this._stringify(e),s.level);}};
|
|
4
|
-
|
|
5
|
-
exports.a = n;
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-7OFJLC7L.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/reporter/json/abstract-json-reporter.ts"],"names":["AbstractJsonReporter","function_","meta","file","type","rest"],"mappings":"AAKO,IAAeA,EAAf,KAAmG,CAI/F,aAAaC,EAAsB,CACtC,KAAK,WAAaA,CACtB,CAEO,IAAIC,EAA6B,CAEpC,GAAM,CAAE,KAAAC,EAAM,KAAAC,EAAM,GAAGC,CAAK,EAAIH,EAE5BG,EAAK,QACLA,EAAK,MAAQA,EAAK,MAAM,KAAK,GAG7BF,IAECE,EAAqE,KAAOF,EAAK,KAAO,IAAMA,EAAK,MAAQA,EAAK,OAAS,IAAMA,EAAK,OAAS,KAG9IE,EAAK,OAAO,SAAW,GACvB,OAAOA,EAAK,MAGhB,KAAK,KAAM,KAAK,WAAgCA,CAAI,EAAaD,EAAK,KAAK,CAC/E,CAGJ","sourcesContent":["import type { stringify } from \"safe-stable-stringify\";\nimport type { LiteralUnion } from \"type-fest\";\n\nimport type { ExtendedRfc5424LogLevels, ReadonlyMeta, StringifyAwareReporter } from \"../../types\";\n\nexport abstract class AbstractJsonReporter<L extends string = never> implements StringifyAwareReporter<L> {\n protected _stringify: typeof stringify | undefined;\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n public setStringify(function_: any): void {\n this._stringify = function_;\n }\n\n public log(meta: ReadonlyMeta<L>): void {\n // @ts-expect-error -- tsup can find the type\n const { file, type, ...rest } = meta;\n\n if (rest.label) {\n rest.label = rest.label.trim();\n }\n\n if (file) {\n // This is a hack to make the file property a string\n (rest as unknown as Omit<ReadonlyMeta<L>, \"file\"> & { file: string }).file = file.name + \":\" + file.line + (file.column ? \":\" + file.column : \"\");\n }\n\n if (rest.scope?.length === 0) {\n delete rest.scope;\n }\n\n this._log((this._stringify as typeof stringify)(rest) as string, type.level);\n }\n\n protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;\n}\n"]}
|