@visulima/pail 4.0.0-alpha.2 → 4.0.0-alpha.21
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 +371 -0
- package/LICENSE.md +148 -879
- package/README.md +323 -0
- package/dist/error.d.ts +103 -0
- package/dist/error.js +5 -0
- package/dist/index.browser.d.ts +557 -45
- package/dist/index.browser.js +19 -12
- package/dist/index.server.d.ts +724 -63
- package/dist/index.server.js +27 -529
- package/dist/middleware/elysia.d.ts +73 -0
- package/dist/middleware/elysia.js +1 -0
- package/dist/middleware/express.d.ts +88 -0
- package/dist/middleware/express.js +1 -0
- package/dist/middleware/fastify.d.ts +83 -0
- package/dist/middleware/fastify.js +1 -0
- package/dist/middleware/hono.d.ts +87 -0
- package/dist/middleware/hono.js +1 -0
- package/dist/middleware/next/handler.d.ts +103 -0
- package/dist/middleware/next/handler.js +1 -0
- package/dist/middleware/sveltekit.d.ts +125 -0
- package/dist/middleware/sveltekit.js +1 -0
- package/dist/object-tree.d.ts +67 -70
- package/dist/object-tree.js +2 -89
- package/dist/packem_shared/AbstractJsonReporter-CF0KKdQS.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-CVwjgboT.js +1 -0
- package/dist/packem_shared/JsonReporter-BJFnahby.js +1 -0
- package/dist/packem_shared/JsonReporter-CnLM-d0U.js +2 -0
- package/dist/packem_shared/PrettyReporter-D75CJT0C.js +5 -0
- package/dist/packem_shared/PrettyReporter-D9aBMmxI.js +45 -0
- package/dist/packem_shared/abstract-json-reporter.d-Boj5w068.d.ts +61 -0
- package/dist/packem_shared/abstract-pretty-reporter-zijeSUgy.js +34 -0
- package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
- package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
- package/dist/packem_shared/create-middleware-logger.d-MK7moe4r.d.ts +47 -0
- package/dist/packem_shared/createPailError-CbU1Ogfa.js +5 -0
- package/dist/packem_shared/headers-D-K_EnkH.js +1 -0
- package/dist/packem_shared/index-COQEZODZ.js +1 -0
- package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
- package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
- package/dist/packem_shared/types.d-Ck_RSjLg.d.ts +246 -0
- package/dist/packem_shared/types.d-Cz9S7jZh.d.ts +201 -0
- package/dist/packem_shared/types.d-xxE3FOD3.d.ts +229 -0
- package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
- package/dist/packem_shared/wide-event.d-DkYD7YVK.d.ts +705 -0
- package/dist/packem_shared/write-console-log-based-on-level-DDSKGBKj.js +1 -0
- package/dist/packem_shared/write-stream-B6BXco86.js +1 -0
- package/dist/processor/caller/caller-processor.d.ts +49 -47
- package/dist/processor/caller/caller-processor.js +1 -59
- package/dist/processor/environment-processor.d.ts +124 -0
- package/dist/processor/environment-processor.js +1 -0
- package/dist/processor/message-formatter-processor.d.ts +51 -50
- package/dist/processor/message-formatter-processor.js +1 -66
- package/dist/processor/opentelemetry-processor.d.ts +69 -66
- package/dist/processor/opentelemetry-processor.js +1 -52
- package/dist/processor/redact-processor.d.ts +60 -41
- package/dist/processor/redact-processor.js +1 -30
- package/dist/processor/sampling-processor.d.ts +112 -0
- package/dist/processor/sampling-processor.js +1 -0
- package/dist/reporter/file/json-file-reporter.d.ts +91 -42
- package/dist/reporter/file/json-file-reporter.js +2 -136
- package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
- package/dist/reporter/http/abstract-http-reporter.js +2 -435
- package/dist/reporter/http/http-reporter.d.ts +40 -36
- package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
- package/dist/reporter/http/http-reporter.edge-light.js +2 -651
- package/dist/reporter/http/http-reporter.js +1 -13
- package/dist/reporter/json/index.browser.d.ts +98 -3
- package/dist/reporter/json/index.browser.js +1 -2
- package/dist/reporter/json/index.d.ts +51 -3
- package/dist/reporter/json/index.js +1 -2
- package/dist/reporter/pretty/index.browser.d.ts +105 -2
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +183 -2
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +133 -18
- package/dist/reporter/simple/simple-reporter.server.js +8 -186
- package/dist/wide-event.d.ts +5 -0
- package/dist/wide-event.js +1 -0
- package/package.json +87 -37
- package/dist/constants.d.ts +0 -37
- package/dist/interactive/index.d.ts +0 -2
- package/dist/interactive/index.js +0 -2
- package/dist/interactive/interactive-manager.d.ts +0 -108
- package/dist/interactive/interactive-stream-hook.d.ts +0 -68
- package/dist/packem_shared/AbstractJsonReporter-BaZ33PlE.js +0 -204
- package/dist/packem_shared/InteractiveManager-CbE7d1kY.js +0 -172
- package/dist/packem_shared/InteractiveStreamHook-DiSubbJ1.js +0 -21
- package/dist/packem_shared/JsonReporter-BRw4skd5.js +0 -28
- package/dist/packem_shared/JsonReporter-VzgyLEYz.js +0 -58
- package/dist/packem_shared/PrettyReporter-C2wVB7yu.js +0 -222
- package/dist/packem_shared/PrettyReporter-DySIXBjQ.js +0 -169
- package/dist/packem_shared/abstract-pretty-reporter-Di_sdm2r.js +0 -50
- package/dist/packem_shared/constants-omsTHUWB.js +0 -119
- package/dist/packem_shared/format-label-De49vNPd.js +0 -1193
- package/dist/packem_shared/get-longest-label-C9PWeyKq.js +0 -9
- package/dist/packem_shared/index-BomQ3E6J.js +0 -650
- package/dist/packem_shared/index-EZ_WSQZS.js +0 -1146
- package/dist/packem_shared/interactive-stream-hook-DG4BtN12.js +0 -141
- package/dist/packem_shared/pail.browser-u2CSR_af.js +0 -1427
- package/dist/packem_shared/write-console-log-based-on-level-DBmRYXpj.js +0 -14
- package/dist/packem_shared/write-stream-BG8fhcs3.js +0 -6
- package/dist/pail.browser.d.ts +0 -412
- package/dist/pail.server.d.ts +0 -233
- package/dist/processor/caller/get-caller-filename.d.ts +0 -23
- package/dist/progress-bar.d.ts +0 -136
- package/dist/progress-bar.js +0 -404
- package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
- package/dist/reporter/http/utils/compression.d.ts +0 -7
- package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
- package/dist/reporter/http/utils/retry.d.ts +0 -27
- package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
- package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
- package/dist/reporter/json/json-reporter.server.d.ts +0 -50
- package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
- package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
- package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
- package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
- package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
- package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
- package/dist/reporter/utils/format-label.d.ts +0 -3
- package/dist/spinner.d.ts +0 -220
- package/dist/spinner.js +0 -2150
- package/dist/types.d.ts +0 -241
- package/dist/utils/ansi-escapes.d.ts +0 -4
- package/dist/utils/arrayify.d.ts +0 -2
- package/dist/utils/get-longest-badge.d.ts +0 -4
- package/dist/utils/get-longest-label.d.ts +0 -4
- package/dist/utils/merge-types.d.ts +0 -4
- package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
- package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
- package/dist/utils/write-stream.d.ts +0 -2
|
@@ -1,189 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import{createRequire as V}from"node:module";import k from"@visulima/colorize";import{A as O,b as z,r as F,c as G,d as H,g as K,e as g,f as Q,a as U,h as v,U as W,_ as b,i as X}from"../../packem_shared/abstract-pretty-reporter-zijeSUgy.js";const ie=V(import.meta.url),Y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:B,stderr:D}=Y,{bgGrey:Z,bold:I,cyan:J,green:N,greenBright:ee,grey:a,red:x,underline:R,white:te}=k,se=/[\\/]pail[\\/]dist/,_=S=>!se.test(S);class ne extends O{#t;#s;#r;#a=!1;#i;#e;constructor(t={}){const{error:o,inspect:n,...i}=t;super({uppercase:{label:!0,...i.uppercase},...i}),this.#i={...z,indent:void 0,...n},this.#e={...o,color:{fileLine:N,hint:J,marker:x,message:x,method:ee,title:x}},this.#t=B,this.#s=D}setStdout(t){this.#t=t}setStderr(t){this.#s=t}setInteractiveManager(t){this.#r=t}setIsInteractive(t){this.#a=t}log(t){const o=this.formatMessage(t),n=t.type.level,i=["error","trace","warn"].includes(n)?"stderr":"stdout",p=i==="stderr"?this.#s:this.#t;this.#a&&this.#r!==void 0&&p.isTTY?this.#r.update(i,o.split(`
|
|
2
|
+
`),0):F(`${o}
|
|
3
|
+
`,p)}formatMessage(t){const{columns:o}=G();let n=o;typeof this.styles.messageLength=="number"&&(n=this.styles.messageLength);const{badge:i,context:p,date:l,error:T,file:c,groups:f,label:d,message:u,prefix:m,repeated:w,scope:y,suffix:$,traceError:j,type:A}=t,{color:M}=this.loggerTypes[A.name],C=M?k[M]:te,h=f.map(()=>" ").join(""),e=[];if(f.length>0&&e.push(`${h+a(`[${f.at(-1)??""}]`)} `),l&&e.push(`${a(this.styles.dateFormatter(typeof l=="string"?new Date(l):l))} `),i)e.push(I(C(i)));else{const s=H(this.loggerTypes);s.length>0&&e.push(a(" ".repeat(s.length)))}const q=K(this.loggerTypes),E=g(q);if(d){const s=g(d),r=Math.max(0,E-s);e.push(`${I(C(Q(d,this.styles)))} `," ".repeat(r))}else e.push(" ".repeat(E+1));w&&e.push(`${Z.white(`[${String(w)}x]`)} `),Array.isArray(y)&&y.length>0&&e.push(`${a(`[${y.join(" > ")}]`)} `),m&&e.push(`${a(`[${this.styles.underline.prefix?R(m):m}]`)} `);const L=g(e.join(""));if(u!==U){const s=typeof u=="string"?u:v(u,this.#i);e.push(h+W(s,{trim:!1,width:n-3,wrapMode:X.STRICT_WIDTH}))}if(p){let s=!1;e.push(...p.map(r=>{if(r instanceof Error)return s=!0,`
|
|
2
4
|
|
|
3
|
-
const
|
|
5
|
+
${b(r,{...this.#e,filterStacktrace:_,prefix:h})}`;if(typeof r=="object")return` ${v(r,this.#i)}`;const P=(s?`
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
`:" ")+String(r);return s=!1,P}))}if(T&&e.push(b(T,{...this.#e,filterStacktrace:_,prefix:h})),j&&e.push(`
|
|
6
8
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} = __cjs_getProcess;
|
|
11
|
-
import colorize, { red, greenBright, cyan, green, grey, bold, white, bgGrey, underline } from '@visulima/colorize';
|
|
12
|
-
import { d as defaultInspectorConfig, f as formatLabel, i as inspect, r as renderError } from '../../packem_shared/format-label-De49vNPd.js';
|
|
13
|
-
import { t as terminalSize, g as getStringWidth, w as wordWrap, W as WrapMode } from '../../packem_shared/index-EZ_WSQZS.js';
|
|
14
|
-
import { E as EMPTY_SYMBOL } from '../../packem_shared/constants-omsTHUWB.js';
|
|
15
|
-
import { A as AbstractPrettyReporter, g as getLongestBadge } from '../../packem_shared/abstract-pretty-reporter-Di_sdm2r.js';
|
|
16
|
-
import { g as getLongestLabel } from '../../packem_shared/get-longest-label-C9PWeyKq.js';
|
|
17
|
-
import { w as writeStream } from '../../packem_shared/write-stream-BG8fhcs3.js';
|
|
18
|
-
|
|
19
|
-
const pailFileFilter = (line) => !/[\\/]pail[\\/]dist/.test(line);
|
|
20
|
-
class SimpleReporter extends AbstractPrettyReporter {
|
|
21
|
-
#stdout;
|
|
22
|
-
#stderr;
|
|
23
|
-
#interactiveManager;
|
|
24
|
-
#interactive = false;
|
|
25
|
-
#inspectOptions;
|
|
26
|
-
#errorOptions;
|
|
27
|
-
constructor(options = {}) {
|
|
28
|
-
const { error: errorOptions, inspect: inspectOptions, ...rest } = options;
|
|
29
|
-
super({
|
|
30
|
-
uppercase: {
|
|
31
|
-
label: true,
|
|
32
|
-
...rest.uppercase
|
|
33
|
-
},
|
|
34
|
-
...rest
|
|
35
|
-
});
|
|
36
|
-
this.#inspectOptions = { ...defaultInspectorConfig, indent: void 0, ...inspectOptions };
|
|
37
|
-
this.#errorOptions = {
|
|
38
|
-
...errorOptions,
|
|
39
|
-
color: {
|
|
40
|
-
fileLine: green,
|
|
41
|
-
hint: cyan,
|
|
42
|
-
marker: red,
|
|
43
|
-
message: red,
|
|
44
|
-
method: greenBright,
|
|
45
|
-
title: red
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
this.#stdout = stdout;
|
|
49
|
-
this.#stderr = stderr;
|
|
50
|
-
}
|
|
51
|
-
setStdout(stdout_) {
|
|
52
|
-
this.#stdout = stdout_;
|
|
53
|
-
}
|
|
54
|
-
setStderr(stderr_) {
|
|
55
|
-
this.#stderr = stderr_;
|
|
56
|
-
}
|
|
57
|
-
setInteractiveManager(manager) {
|
|
58
|
-
this.#interactiveManager = manager;
|
|
59
|
-
}
|
|
60
|
-
setIsInteractive(interactive) {
|
|
61
|
-
this.#interactive = interactive;
|
|
62
|
-
}
|
|
63
|
-
log(meta) {
|
|
64
|
-
const message = this.formatMessage(meta);
|
|
65
|
-
const logLevel = meta.type.level;
|
|
66
|
-
const streamType = ["error", "trace", "warn"].includes(logLevel) ? "stderr" : "stdout";
|
|
67
|
-
const stream = streamType === "stderr" ? this.#stderr : this.#stdout;
|
|
68
|
-
if (this.#interactive && this.#interactiveManager !== void 0 && stream.isTTY) {
|
|
69
|
-
this.#interactiveManager.update(streamType, message.split("\n"), 0);
|
|
70
|
-
} else {
|
|
71
|
-
writeStream(`${message}
|
|
72
|
-
`, stream);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
76
|
-
formatMessage(data) {
|
|
77
|
-
const { columns } = terminalSize();
|
|
78
|
-
let size = columns;
|
|
79
|
-
if (typeof this.styles.messageLength === "number") {
|
|
80
|
-
size = this.styles.messageLength;
|
|
81
|
-
}
|
|
82
|
-
const { badge, context, date, error, file, groups, label, message, prefix, repeated, scope, suffix, traceError, type } = data;
|
|
83
|
-
const { color } = this.loggerTypes[type.name];
|
|
84
|
-
const colorized = color ? colorize[color] : white;
|
|
85
|
-
const groupSpaces = groups.map(() => " ").join("");
|
|
86
|
-
const items = [];
|
|
87
|
-
if (groups.length > 0) {
|
|
88
|
-
items.push(`${groupSpaces + grey(`[${groups.at(-1)}]`)} `);
|
|
89
|
-
}
|
|
90
|
-
if (date) {
|
|
91
|
-
items.push(`${grey(this.styles.dateFormatter(typeof date === "string" ? new Date(date) : date))} `);
|
|
92
|
-
}
|
|
93
|
-
if (badge) {
|
|
94
|
-
items.push(bold(colorized(badge)));
|
|
95
|
-
} else {
|
|
96
|
-
const longestBadge = getLongestBadge(this.loggerTypes);
|
|
97
|
-
if (longestBadge.length > 0) {
|
|
98
|
-
items.push(grey(" ".repeat(longestBadge.length)));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const longestLabel = getLongestLabel(this.loggerTypes);
|
|
102
|
-
const longestWidth = getStringWidth(longestLabel);
|
|
103
|
-
if (label) {
|
|
104
|
-
const labelWidth = getStringWidth(label);
|
|
105
|
-
const pad = Math.max(0, longestWidth - labelWidth);
|
|
106
|
-
items.push(`${bold(colorized(formatLabel(label, this.styles)))} `, " ".repeat(pad));
|
|
107
|
-
} else {
|
|
108
|
-
items.push(" ".repeat(longestWidth + 1));
|
|
109
|
-
}
|
|
110
|
-
if (repeated) {
|
|
111
|
-
items.push(`${bgGrey.white(`[${repeated}x]`)} `);
|
|
112
|
-
}
|
|
113
|
-
if (Array.isArray(scope) && scope.length > 0) {
|
|
114
|
-
items.push(`${grey(`[${scope.join(" > ")}]`)} `);
|
|
115
|
-
}
|
|
116
|
-
if (prefix) {
|
|
117
|
-
items.push(`${grey(`[${this.styles.underline.prefix ? underline(prefix) : prefix}]`)} `);
|
|
118
|
-
}
|
|
119
|
-
const titleSize = getStringWidth(items.join(""));
|
|
120
|
-
if (message !== EMPTY_SYMBOL) {
|
|
121
|
-
const formattedMessage = typeof message === "string" ? message : inspect(message, this.#inspectOptions);
|
|
122
|
-
items.push(
|
|
123
|
-
groupSpaces + wordWrap(formattedMessage, {
|
|
124
|
-
trim: false,
|
|
125
|
-
width: size - 3,
|
|
126
|
-
wrapMode: WrapMode.STRICT_WIDTH
|
|
127
|
-
})
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
if (context) {
|
|
131
|
-
let hasError = false;
|
|
132
|
-
items.push(
|
|
133
|
-
...context.map((value) => {
|
|
134
|
-
if (value instanceof Error) {
|
|
135
|
-
hasError = true;
|
|
136
|
-
return `
|
|
137
|
-
|
|
138
|
-
${renderError(value, {
|
|
139
|
-
...this.#errorOptions,
|
|
140
|
-
filterStacktrace: pailFileFilter,
|
|
141
|
-
prefix: groupSpaces
|
|
142
|
-
})}`;
|
|
143
|
-
}
|
|
144
|
-
if (typeof value === "object") {
|
|
145
|
-
return ` ${inspect(value, this.#inspectOptions)}`;
|
|
146
|
-
}
|
|
147
|
-
const newValue = (hasError ? "\n\n" : " ") + value;
|
|
148
|
-
hasError = false;
|
|
149
|
-
return newValue;
|
|
150
|
-
})
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
if (error) {
|
|
154
|
-
items.push(
|
|
155
|
-
renderError(error, {
|
|
156
|
-
...this.#errorOptions,
|
|
157
|
-
filterStacktrace: pailFileFilter,
|
|
158
|
-
prefix: groupSpaces
|
|
159
|
-
})
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
if (traceError) {
|
|
163
|
-
items.push(
|
|
164
|
-
`
|
|
165
|
-
|
|
166
|
-
${renderError(traceError, {
|
|
167
|
-
...this.#errorOptions,
|
|
168
|
-
filterStacktrace: pailFileFilter,
|
|
169
|
-
hideErrorCauseCodeView: true,
|
|
170
|
-
hideErrorCodeView: true,
|
|
171
|
-
hideErrorErrorsCodeView: true,
|
|
172
|
-
hideMessage: true,
|
|
173
|
-
prefix: groupSpaces
|
|
174
|
-
})}`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
if (suffix) {
|
|
178
|
-
items.push(` ${groupSpaces}${grey(this.styles.underline.suffix ? underline(suffix) : suffix)}`);
|
|
179
|
-
}
|
|
180
|
-
if (file) {
|
|
181
|
-
const fileMessage = file.name + (file.line ? `:${file.line}` : "");
|
|
182
|
-
const callerPad = Math.max(0, titleSize - getStringWidth("Caller: "));
|
|
183
|
-
items.push("\n", grey("Caller: "), " ".repeat(callerPad), fileMessage, "\n");
|
|
184
|
-
}
|
|
185
|
-
return items.join("");
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export { SimpleReporter };
|
|
9
|
+
${b(j,{...this.#e,filterStacktrace:_,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:h})}`),$&&e.push(` ${h}${a(this.styles.underline.suffix?R($):$)}`),c){const s=(c.name??"")+(c.line?`:${String(c.line)}`:""),r=Math.max(0,L-g("Caller: "));e.push(`
|
|
10
|
+
`,a("Caller: ")," ".repeat(r),s,`
|
|
11
|
+
`)}return e.join("")}}export{ne as SimpleReporter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { R as RequestLogEntry, S as SerializedError, W as WideEvent, a as WideEventFinishOptions, b as WideEventLevel, c as WideEventOptions, d as createWideEvent } from "./packem_shared/wide-event.d-DkYD7YVK.js";
|
|
2
|
+
import "./packem_shared/types.d-Ck_RSjLg.js";
|
|
3
|
+
import 'safe-stable-stringify';
|
|
4
|
+
import '@visulima/colorize';
|
|
5
|
+
import '@visulima/interactive-manager';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const h={debug:0,error:3,info:1,warn:2},c={debug:"debug",error:"error",info:"info",warn:"warn"},u=(s,t)=>{const e={...s},a=Object.keys(t);for(let i=0;i<a.length;i+=1){const r=a[i],o=t[r],n=e[r];o!==null&&typeof o=="object"&&!Array.isArray(o)&&n!==null&&typeof n=="object"&&!Array.isArray(n)?e[r]=u(n,o):e[r]=o}return e},m=s=>s<1e3?`${String(s)}ms`:`${(s/1e3).toFixed(2)}s`,d=s=>{const t={message:s.message,name:s.name};s.stack&&(t.stack=s.stack);const e=s;return e.status!==void 0?t.status=e.status:e.statusCode!==void 0&&(t.status=e.statusCode),e.data!==void 0&&(t.data=e.data),s.cause instanceof Error&&(t.cause=d(s.cause)),t};class l{name;autoEmit;data;emitted;attachedError;level;pail;requestLogs;service;startTime;status;timestamp;_type;constructor(t){this.name=t.name,this.pail=t.pail,this.data={},this.startTime=performance.now(),this.timestamp=new Date().toISOString(),this.emitted=!1,this.autoEmit=t.autoEmit??!0,this._type=t.type??"info",this.level="info",this.requestLogs=[],this.service=t.service}debug(t,e){return this.addLogEntry("debug",t,e)}emit(t){if(this.emitted)return;this.emitted=!0;const e=Math.round(performance.now()-this.startTime),a=this.attachedError?"error":this.level,i=t??c[a],r={duration:m(e),duration_ms:e,event:this.name,timestamp:this.timestamp,...this.data};this.service&&(r.service=this.service),this.status!==void 0&&(r.status=this.status),this.attachedError&&(r.error=d(this.attachedError)),this.requestLogs.length>0&&(r.requestLogs=this.requestLogs);const o=this.pail[i];o({message:r})}error(t,e,a){return e&&(this.attachedError=e),this.addLogEntry("error",t,a)}finish(t){t?.status!==void 0&&(this.status=t.status),t?.error&&(this.attachedError=t.error),this.emit()}getData(){return this.data}getLevel(){return this.attachedError?"error":this.level}getRequestLogs(){return this.requestLogs}info(t,e){return this.addLogEntry("info",t,e)}set(t){return this.data=u(this.data,t),this}setError(t){return this.attachedError=t,this}setStatus(t){return this.status=t,this}warn(t,e){return this.addLogEntry("warn",t,e)}[Symbol.dispose](){this.autoEmit&&!this.emitted&&this.emit()}addLogEntry(t,e,a){const i={level:t,message:e,timestamp:new Date().toISOString()};return a&&(i.context=a),this.requestLogs.push(i),this.escalateLevel(t),this}escalateLevel(t){(h[t]??0)>(h[this.level]??0)&&(this.level=t)}}const g=s=>new l(s);export{l as WideEvent,g as createWideEvent};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pail",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.21",
|
|
4
4
|
"description": "Highly configurable Logger for Node.js, Edge and Browser.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"ansi",
|
|
7
6
|
"anolilab",
|
|
7
|
+
"ansi",
|
|
8
8
|
"browser",
|
|
9
9
|
"browser-logger",
|
|
10
10
|
"callsite",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"json",
|
|
28
28
|
"json-logger",
|
|
29
29
|
"json-logging",
|
|
30
|
-
"log level",
|
|
31
30
|
"log",
|
|
31
|
+
"log level",
|
|
32
32
|
"log-cleaner",
|
|
33
33
|
"log-rotation",
|
|
34
34
|
"log4j",
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
"logger",
|
|
38
38
|
"logging",
|
|
39
39
|
"node",
|
|
40
|
-
"stream",
|
|
41
|
-
"pretty",
|
|
42
40
|
"node-logger",
|
|
43
41
|
"pail",
|
|
44
42
|
"pino",
|
|
43
|
+
"pretty",
|
|
45
44
|
"pretty-error",
|
|
46
45
|
"pretty-log",
|
|
47
46
|
"print",
|
|
@@ -49,16 +48,15 @@
|
|
|
49
48
|
"redact",
|
|
50
49
|
"rotating-log",
|
|
51
50
|
"show error",
|
|
51
|
+
"stream",
|
|
52
52
|
"timer",
|
|
53
53
|
"universal",
|
|
54
54
|
"visulima",
|
|
55
55
|
"warning-logging",
|
|
56
56
|
"winston"
|
|
57
57
|
],
|
|
58
|
-
"homepage": "https://
|
|
59
|
-
"bugs":
|
|
60
|
-
"url": "https://github.com/visulima/visulima/issues"
|
|
61
|
-
},
|
|
58
|
+
"homepage": "https://visulima.com/packages/pail/",
|
|
59
|
+
"bugs": "https://github.com/visulima/visulima/issues",
|
|
62
60
|
"repository": {
|
|
63
61
|
"type": "git",
|
|
64
62
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -84,11 +82,11 @@
|
|
|
84
82
|
"type": "module",
|
|
85
83
|
"exports": {
|
|
86
84
|
".": {
|
|
87
|
-
"browser": "./dist/index.browser.js",
|
|
88
85
|
"import": {
|
|
89
86
|
"types": "./dist/index.server.d.ts",
|
|
90
87
|
"default": "./dist/index.server.js"
|
|
91
|
-
}
|
|
88
|
+
},
|
|
89
|
+
"browser": "./dist/index.browser.js"
|
|
92
90
|
},
|
|
93
91
|
"./browser": {
|
|
94
92
|
"types": "./dist/index.browser.d.ts",
|
|
@@ -114,6 +112,18 @@
|
|
|
114
112
|
"types": "./dist/processor/opentelemetry-processor.d.ts",
|
|
115
113
|
"default": "./dist/processor/opentelemetry-processor.js"
|
|
116
114
|
},
|
|
115
|
+
"./processor/sampling": {
|
|
116
|
+
"types": "./dist/processor/sampling-processor.d.ts",
|
|
117
|
+
"default": "./dist/processor/sampling-processor.js"
|
|
118
|
+
},
|
|
119
|
+
"./processor/environment": {
|
|
120
|
+
"types": "./dist/processor/environment-processor.d.ts",
|
|
121
|
+
"default": "./dist/processor/environment-processor.js"
|
|
122
|
+
},
|
|
123
|
+
"./error": {
|
|
124
|
+
"types": "./dist/error.d.ts",
|
|
125
|
+
"default": "./dist/error.js"
|
|
126
|
+
},
|
|
117
127
|
"./reporter/file": {
|
|
118
128
|
"types": "./dist/reporter/file/json-file-reporter.d.ts",
|
|
119
129
|
"default": "./dist/reporter/file/json-file-reporter.js"
|
|
@@ -131,11 +141,11 @@
|
|
|
131
141
|
}
|
|
132
142
|
},
|
|
133
143
|
"./reporter/json": {
|
|
134
|
-
"browser": "./dist/reporter/json/index.browser.js",
|
|
135
144
|
"import": {
|
|
136
145
|
"types": "./dist/reporter/json/index.d.ts",
|
|
137
146
|
"default": "./dist/reporter/json/index.js"
|
|
138
|
-
}
|
|
147
|
+
},
|
|
148
|
+
"browser": "./dist/reporter/json/index.browser.js"
|
|
139
149
|
},
|
|
140
150
|
"./server/reporter/pretty": {
|
|
141
151
|
"import": {
|
|
@@ -150,11 +160,11 @@
|
|
|
150
160
|
}
|
|
151
161
|
},
|
|
152
162
|
"./reporter/pretty": {
|
|
153
|
-
"browser": "./dist/reporter/pretty/index.browser.js",
|
|
154
163
|
"import": {
|
|
155
164
|
"types": "./dist/reporter/pretty/index.d.ts",
|
|
156
165
|
"default": "./dist/reporter/pretty/index.js"
|
|
157
|
-
}
|
|
166
|
+
},
|
|
167
|
+
"browser": "./dist/reporter/pretty/index.browser.js"
|
|
158
168
|
},
|
|
159
169
|
"./reporter/simple": {
|
|
160
170
|
"types": "./dist/reporter/simple/simple-reporter.server.d.ts",
|
|
@@ -165,6 +175,10 @@
|
|
|
165
175
|
"default": "./dist/reporter/http/abstract-http-reporter.js"
|
|
166
176
|
},
|
|
167
177
|
"./reporter/http": {
|
|
178
|
+
"import": {
|
|
179
|
+
"types": "./dist/reporter/http/http-reporter.d.ts",
|
|
180
|
+
"default": "./dist/reporter/http/http-reporter.js"
|
|
181
|
+
},
|
|
168
182
|
"edge-light": {
|
|
169
183
|
"types": "./dist/reporter/http/http-reporter.edge-light.d.ts",
|
|
170
184
|
"default": "./dist/reporter/http/http-reporter.edge-light.js"
|
|
@@ -172,28 +186,40 @@
|
|
|
172
186
|
"browser": {
|
|
173
187
|
"types": "./dist/reporter/http/http-reporter.d.ts",
|
|
174
188
|
"default": "./dist/reporter/http/http-reporter.js"
|
|
175
|
-
},
|
|
176
|
-
"import": {
|
|
177
|
-
"types": "./dist/reporter/http/http-reporter.d.ts",
|
|
178
|
-
"default": "./dist/reporter/http/http-reporter.js"
|
|
179
189
|
}
|
|
180
190
|
},
|
|
181
|
-
"./progress-bar": {
|
|
182
|
-
"types": "./dist/progress-bar.d.ts",
|
|
183
|
-
"default": "./dist/progress-bar.js"
|
|
184
|
-
},
|
|
185
|
-
"./spinner": {
|
|
186
|
-
"types": "./dist/spinner.d.ts",
|
|
187
|
-
"default": "./dist/spinner.js"
|
|
188
|
-
},
|
|
189
|
-
"./interactive": {
|
|
190
|
-
"types": "./dist/interactive/index.d.ts",
|
|
191
|
-
"default": "./dist/interactive/index.js"
|
|
192
|
-
},
|
|
193
191
|
"./object-tree": {
|
|
194
192
|
"types": "./dist/object-tree.d.ts",
|
|
195
193
|
"default": "./dist/object-tree.js"
|
|
196
194
|
},
|
|
195
|
+
"./wide-event": {
|
|
196
|
+
"types": "./dist/wide-event.d.ts",
|
|
197
|
+
"default": "./dist/wide-event.js"
|
|
198
|
+
},
|
|
199
|
+
"./middleware/express": {
|
|
200
|
+
"types": "./dist/middleware/express.d.ts",
|
|
201
|
+
"default": "./dist/middleware/express.js"
|
|
202
|
+
},
|
|
203
|
+
"./middleware/fastify": {
|
|
204
|
+
"types": "./dist/middleware/fastify.d.ts",
|
|
205
|
+
"default": "./dist/middleware/fastify.js"
|
|
206
|
+
},
|
|
207
|
+
"./middleware/hono": {
|
|
208
|
+
"types": "./dist/middleware/hono.d.ts",
|
|
209
|
+
"default": "./dist/middleware/hono.js"
|
|
210
|
+
},
|
|
211
|
+
"./middleware/elysia": {
|
|
212
|
+
"types": "./dist/middleware/elysia.d.ts",
|
|
213
|
+
"default": "./dist/middleware/elysia.js"
|
|
214
|
+
},
|
|
215
|
+
"./middleware/sveltekit": {
|
|
216
|
+
"types": "./dist/middleware/sveltekit.d.ts",
|
|
217
|
+
"default": "./dist/middleware/sveltekit.js"
|
|
218
|
+
},
|
|
219
|
+
"./middleware/next": {
|
|
220
|
+
"types": "./dist/middleware/next/handler.d.ts",
|
|
221
|
+
"default": "./dist/middleware/next/handler.js"
|
|
222
|
+
},
|
|
197
223
|
"./package.json": "./package.json"
|
|
198
224
|
},
|
|
199
225
|
"files": [
|
|
@@ -203,27 +229,51 @@
|
|
|
203
229
|
"LICENSE.md"
|
|
204
230
|
],
|
|
205
231
|
"dependencies": {
|
|
206
|
-
"
|
|
207
|
-
"@visulima/
|
|
232
|
+
"@visulima/colorize": "2.0.0-alpha.13",
|
|
233
|
+
"@visulima/interactive-manager": "1.0.0-alpha.4"
|
|
208
234
|
},
|
|
209
235
|
"peerDependencies": {
|
|
210
|
-
"@opentelemetry/api": "^1.9",
|
|
211
|
-
"@
|
|
212
|
-
"
|
|
236
|
+
"@opentelemetry/api": "^1.9.1",
|
|
237
|
+
"@sveltejs/kit": ">=2.0",
|
|
238
|
+
"@visulima/redact": "3.0.0-alpha.13",
|
|
239
|
+
"elysia": ">=1.0",
|
|
240
|
+
"express": ">=4.0",
|
|
241
|
+
"fastify": ">=4.0",
|
|
242
|
+
"hono": ">=4.0",
|
|
243
|
+
"next": ">=14.0",
|
|
244
|
+
"rotating-file-stream": "3.2.9"
|
|
213
245
|
},
|
|
214
246
|
"peerDependenciesMeta": {
|
|
215
247
|
"@opentelemetry/api": {
|
|
216
248
|
"optional": true
|
|
217
249
|
},
|
|
250
|
+
"@sveltejs/kit": {
|
|
251
|
+
"optional": true
|
|
252
|
+
},
|
|
218
253
|
"@visulima/redact": {
|
|
219
254
|
"optional": true
|
|
220
255
|
},
|
|
256
|
+
"elysia": {
|
|
257
|
+
"optional": true
|
|
258
|
+
},
|
|
259
|
+
"express": {
|
|
260
|
+
"optional": true
|
|
261
|
+
},
|
|
262
|
+
"fastify": {
|
|
263
|
+
"optional": true
|
|
264
|
+
},
|
|
265
|
+
"hono": {
|
|
266
|
+
"optional": true
|
|
267
|
+
},
|
|
268
|
+
"next": {
|
|
269
|
+
"optional": true
|
|
270
|
+
},
|
|
221
271
|
"rotating-file-stream": {
|
|
222
272
|
"optional": true
|
|
223
273
|
}
|
|
224
274
|
},
|
|
225
275
|
"engines": {
|
|
226
|
-
"node": "
|
|
276
|
+
"node": "^22.14.0 || >=24.10.0"
|
|
227
277
|
},
|
|
228
278
|
"os": [
|
|
229
279
|
"darwin",
|
package/dist/constants.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { DefaultLoggerTypes } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Extended RFC 5424 Log Levels
|
|
4
|
-
*
|
|
5
|
-
* The log levels pail uses are those defined in the syslog protocol.
|
|
6
|
-
* Each level is assigned a numeric priority where lower numbers indicate higher priority.
|
|
7
|
-
* @see https://datatracker.ietf.org/doc/html/rfc5424#page-36
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { EXTENDED_RFC_5424_LOG_LEVELS } from "@visulima/pail";
|
|
11
|
-
*
|
|
12
|
-
* console.log(EXTENDED_RFC_5424_LOG_LEVELS.error); // 5
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare const EXTENDED_RFC_5424_LOG_LEVELS: Record<string, number>;
|
|
16
|
-
/**
|
|
17
|
-
* Default Logger Types Configuration
|
|
18
|
-
*
|
|
19
|
-
* Predefined logger types with their associated colors, labels, and log levels.
|
|
20
|
-
* These types provide semantic meaning to different kinds of log messages.
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import { LOG_TYPES } from "@visulima/pail";
|
|
24
|
-
*
|
|
25
|
-
* console.log(LOG_TYPES.error.color); // "red"
|
|
26
|
-
* console.log(LOG_TYPES.success.label); // "success"
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare const LOG_TYPES: DefaultLoggerTypes;
|
|
30
|
-
/**
|
|
31
|
-
* Empty Symbol
|
|
32
|
-
*
|
|
33
|
-
* A unique symbol used internally to represent empty or undefined message values.
|
|
34
|
-
* This helps distinguish between intentional empty messages and undefined values.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
export declare const EMPTY_SYMBOL: symbol;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type InteractiveStreamHook from "./interactive-stream-hook.d.ts";
|
|
2
|
-
/** Supported stream types for interactive output */
|
|
3
|
-
type StreamType = "stderr" | "stdout";
|
|
4
|
-
/**
|
|
5
|
-
* Interactive Manager.
|
|
6
|
-
*
|
|
7
|
-
* Manages interactive terminal output by coordinating stdout and stderr streams.
|
|
8
|
-
* Enables features like progress bars, spinners, and dynamic updates by temporarily
|
|
9
|
-
* capturing and controlling terminal output. Supports suspending and resuming
|
|
10
|
-
* interactive mode for external output.
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const manager = new InteractiveManager(stdoutHook, stderrHook);
|
|
14
|
-
*
|
|
15
|
-
* // Start interactive mode
|
|
16
|
-
* manager.hook();
|
|
17
|
-
*
|
|
18
|
-
* // Update output dynamically
|
|
19
|
-
* manager.update("stdout", ["Processing...", "50% complete"]);
|
|
20
|
-
*
|
|
21
|
-
* // Temporarily suspend for external output
|
|
22
|
-
* manager.suspend("stdout");
|
|
23
|
-
* console.log("External message");
|
|
24
|
-
* manager.resume("stdout");
|
|
25
|
-
*
|
|
26
|
-
* // End interactive mode and show final output
|
|
27
|
-
* manager.unhook();
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
declare class InteractiveManager {
|
|
31
|
-
#private;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a new InteractiveManager with the given stream hooks.
|
|
34
|
-
* @param stdout Hook for stdout stream
|
|
35
|
-
* @param stderr Hook for stderr stream
|
|
36
|
-
*/
|
|
37
|
-
constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
|
|
38
|
-
/**
|
|
39
|
-
* Last printed rows count.
|
|
40
|
-
*
|
|
41
|
-
* Tracks the number of rows that were last written to the terminal.
|
|
42
|
-
* Used internally for managing cursor positioning and output updates.
|
|
43
|
-
*/
|
|
44
|
-
get lastLength(): number;
|
|
45
|
-
/**
|
|
46
|
-
* Rows count outside editable area.
|
|
47
|
-
*
|
|
48
|
-
* Tracks the number of rows that extend beyond the current terminal height.
|
|
49
|
-
* Used for managing scrolling and ensuring all output remains visible.
|
|
50
|
-
*/
|
|
51
|
-
get outside(): number;
|
|
52
|
-
/**
|
|
53
|
-
* Hook activity status.
|
|
54
|
-
*
|
|
55
|
-
* Indicates whether the interactive hooks are currently active.
|
|
56
|
-
* When true, streams are being intercepted for interactive output.
|
|
57
|
-
*/
|
|
58
|
-
get isHooked(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Suspend status for active hooks.
|
|
61
|
-
*
|
|
62
|
-
* Indicates whether interactive mode is temporarily suspended.
|
|
63
|
-
* When suspended, external output can be written without interference.
|
|
64
|
-
*/
|
|
65
|
-
get isSuspended(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Removes lines from the terminal output.
|
|
68
|
-
*
|
|
69
|
-
* Erases the specified number of lines from the bottom of the output,
|
|
70
|
-
* moving the cursor up and clearing the lines. Useful for removing
|
|
71
|
-
* previous interactive output before displaying new content.
|
|
72
|
-
* @param stream The stream to erase lines from ("stdout" or "stderr")
|
|
73
|
-
* @param count Number of lines to remove (defaults to lastLength)
|
|
74
|
-
* @throws {TypeError} If the specified stream is not available
|
|
75
|
-
*/
|
|
76
|
-
erase(stream: StreamType, count?: number): void;
|
|
77
|
-
/**
|
|
78
|
-
* Hook stdout and stderr streams.
|
|
79
|
-
* @returns Success status
|
|
80
|
-
*/
|
|
81
|
-
hook(): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Resume suspend hooks.
|
|
84
|
-
* @param stream Stream to resume
|
|
85
|
-
* @param eraseRowCount erase output rows count
|
|
86
|
-
*/
|
|
87
|
-
resume(stream: StreamType, eraseRowCount?: number): void;
|
|
88
|
-
/**
|
|
89
|
-
* Suspend active hooks for external output.
|
|
90
|
-
* @param stream Stream to suspend
|
|
91
|
-
* @param erase erase output
|
|
92
|
-
*/
|
|
93
|
-
suspend(stream: StreamType, erase?: boolean): void;
|
|
94
|
-
/**
|
|
95
|
-
* Unhooks both stdout and stderr streams and print their story of logs.
|
|
96
|
-
* @param separateHistory If `true`, will add an empty line to the history output for individual recorded lines and console logs
|
|
97
|
-
* @returns Success status
|
|
98
|
-
*/
|
|
99
|
-
unhook(separateHistory?: boolean): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Update output.
|
|
102
|
-
* @param stream Stream to write to
|
|
103
|
-
* @param rows Text lines to write to standard output
|
|
104
|
-
* @param from Index of the line starting from which the contents of the terminal are being overwritten
|
|
105
|
-
*/
|
|
106
|
-
update(stream: StreamType, rows: string[], from?: number): void;
|
|
107
|
-
}
|
|
108
|
-
export default InteractiveManager;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive Stream Hook.
|
|
3
|
-
*
|
|
4
|
-
* A utility class that hooks into Node.js WriteStreams to capture output
|
|
5
|
-
* for interactive terminal applications. It allows temporarily intercepting
|
|
6
|
-
* stream writes to enable features like progress bars and dynamic updates.
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const hook = new InteractiveStreamHook(process.stdout);
|
|
10
|
-
* hook.active(); // Start capturing output
|
|
11
|
-
*
|
|
12
|
-
* // Output will be stored in history instead of being written to stdout
|
|
13
|
-
* console.log("This won't appear immediately");
|
|
14
|
-
*
|
|
15
|
-
* hook.inactive(); // Stop capturing and replay stored output
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare class InteractiveStreamHook {
|
|
19
|
-
#private;
|
|
20
|
-
/** Constant indicating the stream write operation was successful */
|
|
21
|
-
static readonly DRAIN = true;
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new InteractiveStreamHook for the given stream.
|
|
24
|
-
* @param stream The Node.js WriteStream to hook into (usually stdout or stderr)
|
|
25
|
-
*/
|
|
26
|
-
constructor(stream: NodeJS.WriteStream);
|
|
27
|
-
/**
|
|
28
|
-
* Activates the stream hook.
|
|
29
|
-
*
|
|
30
|
-
* When active, all writes to the stream are captured in history instead of
|
|
31
|
-
* being written immediately. This allows for interactive features like
|
|
32
|
-
* progress bars that can update dynamically.
|
|
33
|
-
*/
|
|
34
|
-
active(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Erases the specified number of lines from the terminal.
|
|
37
|
-
*
|
|
38
|
-
* Uses ANSI escape sequences to remove lines from the current cursor position
|
|
39
|
-
* upwards, which is useful for clearing previous output in interactive applications.
|
|
40
|
-
* @param count Number of lines to erase (including the current line)
|
|
41
|
-
*/
|
|
42
|
-
erase(count: number): void;
|
|
43
|
-
/**
|
|
44
|
-
* Deactivates the stream hook and replays captured output.
|
|
45
|
-
*
|
|
46
|
-
* Restores normal stream operation and outputs all captured history.
|
|
47
|
-
* Optionally adds a newline separator before replaying the history.
|
|
48
|
-
* @param separateHistory Whether to add a newline before replaying history
|
|
49
|
-
*/
|
|
50
|
-
inactive(separateHistory?: boolean): void;
|
|
51
|
-
/**
|
|
52
|
-
* Renews the stream hook state.
|
|
53
|
-
*
|
|
54
|
-
* Restores the original stream write method and shows the cursor.
|
|
55
|
-
* This is typically called when temporarily suspending interactive mode.
|
|
56
|
-
*/
|
|
57
|
-
renew(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Writes a message directly to the underlying stream.
|
|
60
|
-
*
|
|
61
|
-
* Bypasses the hook mechanism and writes directly using the original
|
|
62
|
-
* stream write method. Useful for writing control sequences or
|
|
63
|
-
* messages that should not be captured in history.
|
|
64
|
-
* @param message The message to write to the stream
|
|
65
|
-
*/
|
|
66
|
-
write(message: string): void;
|
|
67
|
-
}
|
|
68
|
-
export default InteractiveStreamHook;
|