@visulima/pail 4.0.0-alpha.10 → 4.0.0-alpha.11
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 +40 -0
- package/LICENSE.md +0 -46
- package/dist/index.browser.js +1 -1
- package/dist/index.server.d.ts +0 -4
- package/dist/index.server.js +23 -407
- package/dist/middleware/elysia.js +2 -2
- package/dist/middleware/express.js +1 -1
- package/dist/middleware/fastify.js +2 -2
- package/dist/middleware/next/handler.d.ts +1 -1
- package/dist/middleware/next/middleware.d.ts +1 -1
- package/dist/packem_shared/{AbstractJsonReporter-DlugSJpY.js → AbstractJsonReporter-BO8Calb4.js} +1 -5
- package/dist/packem_shared/{AbstractJsonReporter-CjtVgHbU.js → AbstractJsonReporter-nOj0Ft1F.js} +1 -5
- package/dist/packem_shared/{JsonReporter-Dbw82ewj.js → JsonReporter-CCmj7oYL.js} +1 -1
- package/dist/packem_shared/{JsonReporter-BgPvIyC2.js → JsonReporter-Ck2PIAEw.js} +2 -2
- package/dist/packem_shared/{PrettyReporter-gMqa7j_m.js → PrettyReporter-BCvyNzXO.js} +1239 -7
- package/dist/packem_shared/{PrettyReporter-C2dCzIaf.js → PrettyReporter-BtTr13Ha.js} +1 -3
- package/dist/packem_shared/{abstract-pretty-reporter-szQO-IgK.js → abstract-pretty-reporter-CXAKYCb8.js} +2296 -2296
- package/dist/packem_shared/{write-stream-BuFtjATz.js → write-stream-MDqyXmc_.js} +1 -1
- package/dist/pail.server.d.ts +1 -76
- package/dist/processor/caller/caller-processor.js +1 -1
- package/dist/processor/environment-processor.js +10 -3
- package/dist/reporter/file/json-file-reporter.js +1 -1
- package/dist/reporter/http/abstract-http-reporter.js +1 -1
- package/dist/reporter/http/http-reporter.edge-light.js +1 -5
- package/dist/reporter/json/index.browser.js +2 -2
- package/dist/reporter/json/index.js +2 -2
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/pretty/pretty-reporter.server.d.ts +1 -1
- package/dist/reporter/raw/raw-reporter.server.d.ts +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +1 -1
- package/dist/reporter/simple/simple-reporter.server.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/write-console-log-based-on-level.d.ts +1 -1
- package/dist/wide-event.d.ts +1 -1
- package/dist/wide-event.js +3 -2
- package/package.json +6 -17
- 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/InteractiveManager-CowYA3Hx.js +0 -178
- package/dist/packem_shared/InteractiveStreamHook-BypRlYTX.js +0 -133
- package/dist/packem_shared/Spinner-Cokext9b.js +0 -2183
- package/dist/packem_shared/getBarChar-D7JfmdTr.js +0 -459
- package/dist/packem_shared/index-BEfVUy9P.js +0 -1256
- package/dist/progress-bar.d.ts +0 -145
- package/dist/progress-bar.js +0 -459
- package/dist/spinner.d.ts +0 -220
- package/dist/spinner.js +0 -2183
- package/dist/utils/ansi-escapes.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## @visulima/pail [4.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/pail@4.0.0-alpha.10...@visulima/pail@4.0.0-alpha.11) (2026-04-22)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* **pail:** Removed createSpinner(), createMultiSpinner(),
|
|
6
|
+
createProgressBar(), createMultiProgressBar() methods and the
|
|
7
|
+
./spinner, ./progress-bar, ./interactive exports. Use the standalone
|
|
8
|
+
packages @visulima/spinner, @visulima/progress-bar, and
|
|
9
|
+
@visulima/interactive-manager instead. See MIGRATION-GUIDE.md for
|
|
10
|
+
details.
|
|
11
|
+
|
|
12
|
+
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **pail:** remove spinner, progress-bar, and interactive from pail ([b600f82](https://github.com/visulima/visulima/commit/b600f82876330d55ba98c090b3cf37745ee1e5ed))
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **error-debugging:** resolve eslint and type-safety issues ([886dbff](https://github.com/visulima/visulima/commit/886dbffe3f744c9493fcc54e781de3fd21eebf78))
|
|
21
|
+
* fixed package version ([710e732](https://github.com/visulima/visulima/commit/710e73235b82699c511cfcc2482c491c767b2376))
|
|
22
|
+
* **pail, boxen:** resolve eslint unsafe type issues ([d6e852e](https://github.com/visulima/visulima/commit/d6e852e63f4572a12c31ac44a4ae687c743cf7db))
|
|
23
|
+
* **pail:** disable noUncheckedIndexedAccess and fix middleware return types ([0e94d32](https://github.com/visulima/visulima/commit/0e94d32a6315008e17633374c6e916bc625bc617))
|
|
24
|
+
* **pail:** resolve eslint and formatting issues ([3697233](https://github.com/visulima/visulima/commit/3697233aecdeac382774e5c00a0ad0e8e83b2397))
|
|
25
|
+
* **pail:** resolve eslint issues with terminal-size and interactive-manager ([0776deb](https://github.com/visulima/visulima/commit/0776debc2c2031cb1c13c1958a3188cecae60e8e))
|
|
26
|
+
* **pail:** resolve typescript-eslint strict lint errors ([a0e6b1f](https://github.com/visulima/visulima/commit/a0e6b1f3ce6518450488d4c5385333534cd22b71))
|
|
27
|
+
* Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
* **api-platform:** apply pending lint and source updates ([3fb0043](https://github.com/visulima/visulima/commit/3fb0043a4cf35f752ca89a09a077100ae0142da8))
|
|
32
|
+
* bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
|
|
33
|
+
* fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
|
|
34
|
+
* **pail:** apply formatter and lint fixes ([73e4e1f](https://github.com/visulima/visulima/commit/73e4e1fbdf4c7541fb6fa6419dfe43f0c6225ac9))
|
|
35
|
+
* **pail:** apply formatter and lint fixes ([367292b](https://github.com/visulima/visulima/commit/367292bb3bf0effc94ec9828a85e926e84acd1f9))
|
|
36
|
+
* **pail:** apply pending changes ([e777058](https://github.com/visulima/visulima/commit/e7770582a222e586bf3f84d2c10989a26e95451d))
|
|
37
|
+
* **pail:** apply pending lint and source updates ([e71aa5b](https://github.com/visulima/visulima/commit/e71aa5b970e596a5b3099825d0007a9bf63425f8))
|
|
38
|
+
* **pail:** apply pending lint and source updates ([4c0069a](https://github.com/visulima/visulima/commit/4c0069aac50254a3329bf7f5627a9fd807f5fbca))
|
|
39
|
+
* **pail:** enforce curly braces and apply lint fixes ([08945a9](https://github.com/visulima/visulima/commit/08945a91e090abf6ccd5e687525ed791abb2f5c7))
|
|
40
|
+
|
|
1
41
|
## @visulima/pail [4.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/pail@4.0.0-alpha.9...@visulima/pail@4.0.0-alpha.10) (2026-04-08)
|
|
2
42
|
|
|
3
43
|
### Features
|
package/LICENSE.md
CHANGED
|
@@ -985,52 +985,6 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
985
985
|
|
|
986
986
|
---------------------------------------
|
|
987
987
|
|
|
988
|
-
## cli-spinners
|
|
989
|
-
License: MIT
|
|
990
|
-
By: Sindre Sorhus
|
|
991
|
-
Repository: sindresorhus/cli-spinners
|
|
992
|
-
|
|
993
|
-
> MIT License
|
|
994
|
-
>
|
|
995
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
996
|
-
>
|
|
997
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
998
|
-
>
|
|
999
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1000
|
-
>
|
|
1001
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1002
|
-
|
|
1003
|
-
---------------------------------------
|
|
1004
|
-
|
|
1005
|
-
## safe-stable-stringify
|
|
1006
|
-
License: MIT
|
|
1007
|
-
By: Ruben Bridgewater
|
|
1008
|
-
Repository: git+https://github.com/BridgeAR/safe-stable-stringify.git
|
|
1009
|
-
|
|
1010
|
-
> The MIT License (MIT)
|
|
1011
|
-
>
|
|
1012
|
-
> Copyright (c) Ruben Bridgewater
|
|
1013
|
-
>
|
|
1014
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1015
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
1016
|
-
> in the Software without restriction, including without limitation the rights
|
|
1017
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1018
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
1019
|
-
> furnished to do so, subject to the following conditions:
|
|
1020
|
-
>
|
|
1021
|
-
> The above copyright notice and this permission notice shall be included in all
|
|
1022
|
-
> copies or substantial portions of the Software.
|
|
1023
|
-
>
|
|
1024
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1025
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1026
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1027
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1028
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1029
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1030
|
-
> SOFTWARE.
|
|
1031
|
-
|
|
1032
|
-
---------------------------------------
|
|
1033
|
-
|
|
1034
988
|
## terminal-size
|
|
1035
989
|
License: MIT
|
|
1036
990
|
By: Sindre Sorhus
|
package/dist/index.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as EXTENDED_RFC_5424_LOG_LEVELS, E as EMPTY_SYMBOL, L as LOG_TYPES } from './packem_shared/constants-omsTHUWB.js';
|
|
2
2
|
import { w as writeConsoleLogBasedOnLevel } from './packem_shared/write-console-log-based-on-level-ree2lDPw.js';
|
|
3
3
|
import { g as getLongestLabel, b as build } from './packem_shared/index-Bx3-C0j9.js';
|
|
4
|
-
import JsonReporter from './packem_shared/JsonReporter-
|
|
4
|
+
import JsonReporter from './packem_shared/JsonReporter-CCmj7oYL.js';
|
|
5
5
|
export { PailError, createPailError } from './packem_shared/createPailError-B_sgL0nF.js';
|
|
6
6
|
|
|
7
7
|
function getDefaultExportFromCjs(x) {
|
package/dist/index.server.d.ts
CHANGED
|
@@ -60,8 +60,4 @@ export declare const pail: PailServerType;
|
|
|
60
60
|
export type { PailErrorOptions } from "./error.d.ts";
|
|
61
61
|
export { createPailError, PailError } from "./error.d.ts";
|
|
62
62
|
export type { PailServerType as Pail } from "./pail.d.ts";
|
|
63
|
-
export type { MultiBarOptions, ProgressBarOptions, ProgressBarPayload, ProgressBarStyle, SingleBarOptions } from "./progress-bar.d.ts";
|
|
64
|
-
export { getBarChar, MultiProgressBar, ProgressBar } from "./progress-bar.d.ts";
|
|
65
|
-
export type { SpinnerIcons, SpinnerOptions, SpinnerStartOptions, SpinnerStyle } from "./spinner.d.ts";
|
|
66
|
-
export { MultiSpinner, Spinner } from "./spinner.d.ts";
|
|
67
63
|
export type { ConstructorOptions, DefaultLoggerTypes, DefaultLogTypes, ExtendedRfc5424LogLevels, LoggerConfiguration, LoggerFunction, LoggerTypesAwareReporter, LoggerTypesConfig, Processor, Reporter, StreamAwareReporter, } from "./types.d.ts";
|
package/dist/index.server.js
CHANGED
|
@@ -4,325 +4,36 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
6
6
|
|
|
7
|
-
const __cjs_getBuiltinModule = (module) => {
|
|
8
|
-
// Check if we're in Node.js and version supports getBuiltinModule
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
7
|
const {
|
|
21
8
|
stdout,
|
|
22
9
|
stderr,
|
|
23
10
|
env
|
|
24
11
|
} = __cjs_getProcess;
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
StringDecoder
|
|
28
|
-
} = __cjs_getBuiltinModule("node:string_decoder");
|
|
29
|
-
import { ProgressBar, applyStyleToOptions, MultiProgressBar } from './packem_shared/getBarChar-D7JfmdTr.js';
|
|
30
|
-
export { getBarChar } from './packem_shared/getBarChar-D7JfmdTr.js';
|
|
31
|
-
import { Spinner, MultiSpinner } from './packem_shared/Spinner-Cokext9b.js';
|
|
12
|
+
import { InteractiveManager, InteractiveStreamHook } from '@visulima/interactive-manager';
|
|
13
|
+
import { g as getLongestLabel, E as EXTENDED_RFC_5424_LOG_LEVELS, a as EMPTY_SYMBOL, L as LOG_TYPES, i as inspect, w as writeStream, A as AbstractPrettyReporter, d as defaultInspectorConfig, t as terminalSize, b as getLongestBadge, c as getStringWidth, f as formatLabel, e as wordWrap, r as renderError, W as WrapMode } from './packem_shared/abstract-pretty-reporter-CXAKYCb8.js';
|
|
32
14
|
import colorize, { red, greenBright, cyan, green, grey, bgGrey, underline, white } from '@visulima/colorize';
|
|
33
15
|
export { PailError, createPailError } from './packem_shared/createPailError-B_sgL0nF.js';
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#isActive = false;
|
|
38
|
-
#isSuspended = false;
|
|
39
|
-
#lastLength = 0;
|
|
40
|
-
#outside = 0;
|
|
41
|
-
/**
|
|
42
|
-
* Creates a new InteractiveManager with the given stream hooks.
|
|
43
|
-
* @param stdout Hook for stdout stream
|
|
44
|
-
* @param stderr Hook for stderr stream
|
|
45
|
-
*/
|
|
46
|
-
constructor(stdout, stderr) {
|
|
47
|
-
this.#stream = {
|
|
48
|
-
stderr,
|
|
49
|
-
stdout
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Last printed rows count.
|
|
54
|
-
*
|
|
55
|
-
* Tracks the number of rows that were last written to the terminal.
|
|
56
|
-
* Used internally for managing cursor positioning and output updates.
|
|
57
|
-
*/
|
|
58
|
-
get lastLength() {
|
|
59
|
-
return this.#lastLength;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Rows count outside editable area.
|
|
63
|
-
*
|
|
64
|
-
* Tracks the number of rows that extend beyond the current terminal height.
|
|
65
|
-
* Used for managing scrolling and ensuring all output remains visible.
|
|
66
|
-
*/
|
|
67
|
-
get outside() {
|
|
68
|
-
return this.#outside;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Hook activity status.
|
|
72
|
-
*
|
|
73
|
-
* Indicates whether the interactive hooks are currently active.
|
|
74
|
-
* When true, streams are being intercepted for interactive output.
|
|
75
|
-
*/
|
|
76
|
-
get isHooked() {
|
|
77
|
-
return this.#isActive;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Suspend status for active hooks.
|
|
81
|
-
*
|
|
82
|
-
* Indicates whether interactive mode is temporarily suspended.
|
|
83
|
-
* When suspended, external output can be written without interference.
|
|
84
|
-
*/
|
|
85
|
-
get isSuspended() {
|
|
86
|
-
return this.#isSuspended;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Removes lines from the terminal output.
|
|
90
|
-
*
|
|
91
|
-
* Erases the specified number of lines from the bottom of the output,
|
|
92
|
-
* moving the cursor up and clearing the lines. Useful for removing
|
|
93
|
-
* previous interactive output before displaying new content.
|
|
94
|
-
* @param stream The stream to erase lines from ("stdout" or "stderr")
|
|
95
|
-
* @param count Number of lines to remove (defaults to lastLength)
|
|
96
|
-
* @throws {TypeError} If the specified stream is not available
|
|
97
|
-
*/
|
|
98
|
-
erase(stream, count = this.#lastLength) {
|
|
99
|
-
this.#stream[stream].erase(count);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Hook stdout and stderr streams.
|
|
103
|
-
* @returns Success status
|
|
104
|
-
*/
|
|
105
|
-
hook() {
|
|
106
|
-
if (!this.#isActive) {
|
|
107
|
-
const hooks = Object.values(this.#stream);
|
|
108
|
-
for (let i = 0; i < hooks.length; i += 1) {
|
|
109
|
-
hooks[i].active();
|
|
110
|
-
}
|
|
111
|
-
this.#clear(true);
|
|
112
|
-
}
|
|
113
|
-
return this.#isActive;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Resume suspend hooks.
|
|
117
|
-
* @param stream Stream to resume
|
|
118
|
-
* @param eraseRowCount erase output rows count
|
|
119
|
-
*/
|
|
120
|
-
resume(stream, eraseRowCount) {
|
|
121
|
-
if (this.#isSuspended) {
|
|
122
|
-
this.#isSuspended = false;
|
|
123
|
-
if (eraseRowCount) {
|
|
124
|
-
this.erase(stream, eraseRowCount);
|
|
125
|
-
}
|
|
126
|
-
this.#lastLength = 0;
|
|
127
|
-
const hooks = Object.values(this.#stream);
|
|
128
|
-
for (let i = 0; i < hooks.length; i += 1) {
|
|
129
|
-
hooks[i].active();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Suspend active hooks for external output.
|
|
135
|
-
* @param stream Stream to suspend
|
|
136
|
-
* @param erase erase output
|
|
137
|
-
*/
|
|
138
|
-
suspend(stream, erase = true) {
|
|
139
|
-
if (!this.#isSuspended) {
|
|
140
|
-
this.#isSuspended = true;
|
|
141
|
-
if (erase) {
|
|
142
|
-
this.erase(stream);
|
|
143
|
-
}
|
|
144
|
-
const hooks = Object.values(this.#stream);
|
|
145
|
-
for (let i = 0; i < hooks.length; i += 1) {
|
|
146
|
-
hooks[i].renew();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Unhooks both stdout and stderr streams and print their story of logs.
|
|
152
|
-
* @param separateHistory If `true`, will add an empty line to the history output for individual recorded lines and console logs
|
|
153
|
-
* @returns Success status
|
|
154
|
-
*/
|
|
155
|
-
unhook(separateHistory = true) {
|
|
156
|
-
if (this.#isActive) {
|
|
157
|
-
const hooks = Object.values(this.#stream);
|
|
158
|
-
for (let i = 0; i < hooks.length; i += 1) {
|
|
159
|
-
hooks[i].inactive(separateHistory);
|
|
160
|
-
}
|
|
161
|
-
this.#clear();
|
|
162
|
-
}
|
|
163
|
-
return !this.#isActive;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Update output.
|
|
167
|
-
* @param stream Stream to write to
|
|
168
|
-
* @param rows Text lines to write to standard output
|
|
169
|
-
* @param from Index of the line starting from which the contents of the terminal are being overwritten
|
|
170
|
-
*/
|
|
171
|
-
update(stream, rows, from = 0) {
|
|
172
|
-
if (rows.length > 0) {
|
|
173
|
-
const hook = this.#stream[stream];
|
|
174
|
-
const { columns: width, rows: height } = terminalSize();
|
|
175
|
-
const position = from > height ? height - 1 : Math.max(0, Math.min(height - 1, from));
|
|
176
|
-
const actualLength = this.lastLength - position;
|
|
177
|
-
const outside = Math.max(actualLength - height, this.outside);
|
|
178
|
-
let output = rows.reduce(
|
|
179
|
-
(accumulator, row) => [
|
|
180
|
-
...accumulator,
|
|
181
|
-
wordWrap(row, {
|
|
182
|
-
trim: false,
|
|
183
|
-
width,
|
|
184
|
-
wrapMode: WrapMode.STRICT_WIDTH
|
|
185
|
-
})
|
|
186
|
-
],
|
|
187
|
-
[]
|
|
188
|
-
);
|
|
189
|
-
if (height <= actualLength) {
|
|
190
|
-
hook.erase(height);
|
|
191
|
-
if (position < outside) {
|
|
192
|
-
output = output.slice(outside - position + 1);
|
|
193
|
-
}
|
|
194
|
-
} else if (actualLength) {
|
|
195
|
-
hook.erase(actualLength);
|
|
196
|
-
}
|
|
197
|
-
hook.write(`${output.join("\n")}
|
|
198
|
-
`);
|
|
199
|
-
this.#lastLength = outside ? outside + output.length + 1 : output.length;
|
|
200
|
-
this.#outside = Math.max(this.lastLength - height, this.outside);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
#clear(status = false) {
|
|
204
|
-
this.#isActive = status;
|
|
205
|
-
this.#lastLength = 0;
|
|
206
|
-
this.#outside = 0;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
17
|
+
const ESC = "\x1B";
|
|
18
|
+
const CSI = `${ESC}[`;
|
|
209
19
|
|
|
210
|
-
const
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
const eraseLines = (count) => {
|
|
225
|
-
let clear = "";
|
|
226
|
-
for (let index = 0; index < count; index++) {
|
|
227
|
-
clear += eraseLine + (index < count - 1 ? cursorUp() : "");
|
|
228
|
-
}
|
|
229
|
-
if (count) {
|
|
230
|
-
clear += cursorLeft;
|
|
231
|
-
}
|
|
232
|
-
return clear;
|
|
20
|
+
const isBrowser = typeof globalThis !== "undefined" && typeof globalThis.window === "object" && globalThis.window.document !== void 0;
|
|
21
|
+
const OSTYPE_REGEX = /^(?:msys|cygwin)$/;
|
|
22
|
+
const isWindows = !isBrowser && (process.platform === "win32" || OSTYPE_REGEX.test(process.env.OSTYPE));
|
|
23
|
+
|
|
24
|
+
var EraseDisplayMode = /* @__PURE__ */ ((EraseDisplayMode2) => {
|
|
25
|
+
EraseDisplayMode2[EraseDisplayMode2["ToEnd"] = 0] = "ToEnd";
|
|
26
|
+
EraseDisplayMode2[EraseDisplayMode2["ToBeginning"] = 1] = "ToBeginning";
|
|
27
|
+
EraseDisplayMode2[EraseDisplayMode2["EntireScreen"] = 2] = "EntireScreen";
|
|
28
|
+
EraseDisplayMode2[EraseDisplayMode2["EntireScreenAndScrollback"] = 3] = "EntireScreenAndScrollback";
|
|
29
|
+
return EraseDisplayMode2;
|
|
30
|
+
})(EraseDisplayMode || {});
|
|
31
|
+
const eraseDisplay = (mode) => {
|
|
32
|
+
const validMode = mode >= 0 && mode <= 3 ? mode : 0;
|
|
33
|
+
return `${CSI}${validMode === 0 ? "" : String(validMode)}J`;
|
|
233
34
|
};
|
|
234
35
|
|
|
235
|
-
|
|
236
|
-
/** Constant indicating the stream write operation was successful */
|
|
237
|
-
static DRAIN = true;
|
|
238
|
-
#decoder = new StringDecoder();
|
|
239
|
-
#history = [];
|
|
240
|
-
#method;
|
|
241
|
-
#stream;
|
|
242
|
-
/**
|
|
243
|
-
* Creates a new InteractiveStreamHook for the given stream.
|
|
244
|
-
* @param stream The Node.js WriteStream to hook into (usually stdout or stderr)
|
|
245
|
-
*/
|
|
246
|
-
constructor(stream) {
|
|
247
|
-
this.#method = stream.write.bind(stream);
|
|
248
|
-
this.#stream = stream;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Activates the stream hook.
|
|
252
|
-
*
|
|
253
|
-
* When active, all writes to the stream are captured in history instead of
|
|
254
|
-
* being written immediately. This allows for interactive features like
|
|
255
|
-
* progress bars that can update dynamically.
|
|
256
|
-
*/
|
|
257
|
-
active() {
|
|
258
|
-
this.write(cursorHide);
|
|
259
|
-
this.#stream.write = (data, ...arguments_) => {
|
|
260
|
-
const callback = arguments_.at(-1);
|
|
261
|
-
this.#history.push(
|
|
262
|
-
// prettier-ignore
|
|
263
|
-
this.#decoder.write(
|
|
264
|
-
typeof data === "string" ? Buffer.from(data, typeof arguments_[0] === "string" ? arguments_[0] : void 0) : Buffer.from(data)
|
|
265
|
-
)
|
|
266
|
-
);
|
|
267
|
-
if (typeof callback === "function") {
|
|
268
|
-
callback();
|
|
269
|
-
}
|
|
270
|
-
return InteractiveStreamHook.DRAIN;
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Erases the specified number of lines from the terminal.
|
|
275
|
-
*
|
|
276
|
-
* Uses ANSI escape sequences to remove lines from the current cursor position
|
|
277
|
-
* upwards, which is useful for clearing previous output in interactive applications.
|
|
278
|
-
* @param count Number of lines to erase (including the current line)
|
|
279
|
-
*/
|
|
280
|
-
erase(count) {
|
|
281
|
-
if (count > 0) {
|
|
282
|
-
this.write(eraseLines(count + 1));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Deactivates the stream hook and replays captured output.
|
|
287
|
-
*
|
|
288
|
-
* Restores normal stream operation and outputs all captured history.
|
|
289
|
-
* Optionally adds a newline separator before replaying the history.
|
|
290
|
-
* @param separateHistory Whether to add a newline before replaying history
|
|
291
|
-
*/
|
|
292
|
-
inactive(separateHistory = false) {
|
|
293
|
-
if (this.#history.length > 0) {
|
|
294
|
-
if (separateHistory) {
|
|
295
|
-
this.write("\n");
|
|
296
|
-
}
|
|
297
|
-
this.#history.forEach((element) => {
|
|
298
|
-
this.write(element);
|
|
299
|
-
});
|
|
300
|
-
this.#history = [];
|
|
301
|
-
}
|
|
302
|
-
this.renew();
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Renews the stream hook state.
|
|
306
|
-
*
|
|
307
|
-
* Restores the original stream write method and shows the cursor.
|
|
308
|
-
* This is typically called when temporarily suspending interactive mode.
|
|
309
|
-
*/
|
|
310
|
-
renew() {
|
|
311
|
-
this.#stream.write = this.#method;
|
|
312
|
-
this.write(cursorShow);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Writes a message directly to the underlying stream.
|
|
316
|
-
*
|
|
317
|
-
* Bypasses the hook mechanism and writes directly using the original
|
|
318
|
-
* stream write method. Useful for writing control sequences or
|
|
319
|
-
* messages that should not be captured in history.
|
|
320
|
-
* @param message The message to write to the stream
|
|
321
|
-
*/
|
|
322
|
-
write(message) {
|
|
323
|
-
this.#method.apply(this.#stream, [message]);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
36
|
+
const resetTerminal = isWindows ? `${eraseDisplay(EraseDisplayMode.EntireScreen)}${CSI}0f` : `${eraseDisplay(EraseDisplayMode.EntireScreen)}${eraseDisplay(EraseDisplayMode.EntireScreenAndScrollback)}${CSI}H${ESC}c`;
|
|
326
37
|
|
|
327
38
|
function getDefaultExportFromCjs(x) {
|
|
328
39
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -2086,99 +1797,6 @@ class PailServerImpl extends PailBrowserImpl {
|
|
|
2086
1797
|
this.restoreConsole();
|
|
2087
1798
|
this.restoreStd();
|
|
2088
1799
|
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Creates a single progress bar.
|
|
2091
|
-
* @param options Configuration options for the progress bar
|
|
2092
|
-
* @returns A new ProgressBar instance
|
|
2093
|
-
* @example
|
|
2094
|
-
* ```typescript
|
|
2095
|
-
* const logger = createPail({ interactive: true });
|
|
2096
|
-
* const bar = logger.createProgressBar({
|
|
2097
|
-
* total: 100,
|
|
2098
|
-
* format: 'Downloading [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'
|
|
2099
|
-
* });
|
|
2100
|
-
*
|
|
2101
|
-
* bar.start();
|
|
2102
|
-
* // ... do work and update progress
|
|
2103
|
-
* bar.update(50);
|
|
2104
|
-
* bar.stop();
|
|
2105
|
-
* ```
|
|
2106
|
-
*/
|
|
2107
|
-
createProgressBar(options) {
|
|
2108
|
-
if (!this.interactiveManager) {
|
|
2109
|
-
throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use progress bars.");
|
|
2110
|
-
}
|
|
2111
|
-
const styledOptions = applyStyleToOptions(options);
|
|
2112
|
-
return new ProgressBar(styledOptions, this.interactiveManager);
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Creates a multi-bar progress manager for displaying multiple progress bars.
|
|
2116
|
-
* @param options Configuration options for the multi-bar manager
|
|
2117
|
-
* @returns A new MultiProgressBar instance
|
|
2118
|
-
* @example
|
|
2119
|
-
* ```typescript
|
|
2120
|
-
* const logger = createPail({ interactive: true });
|
|
2121
|
-
* const multiBar = logger.createMultiProgressBar();
|
|
2122
|
-
*
|
|
2123
|
-
* const bar1 = multiBar.create(100);
|
|
2124
|
-
* const bar2 = multiBar.create(200);
|
|
2125
|
-
*
|
|
2126
|
-
* bar1.start();
|
|
2127
|
-
* bar2.start();
|
|
2128
|
-
* // ... update bars as needed
|
|
2129
|
-
* multiBar.stop();
|
|
2130
|
-
* ```
|
|
2131
|
-
*/
|
|
2132
|
-
createMultiProgressBar(options = {}) {
|
|
2133
|
-
if (!this.interactiveManager) {
|
|
2134
|
-
throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use progress bars.");
|
|
2135
|
-
}
|
|
2136
|
-
const styledOptions = applyStyleToOptions(options);
|
|
2137
|
-
return new MultiProgressBar(styledOptions, this.interactiveManager);
|
|
2138
|
-
}
|
|
2139
|
-
/**
|
|
2140
|
-
* Creates a single spinner.
|
|
2141
|
-
* @param options Configuration options for the spinner
|
|
2142
|
-
* @returns A new Spinner instance
|
|
2143
|
-
* @example
|
|
2144
|
-
* ```typescript
|
|
2145
|
-
* const logger = createPail({ interactive: true });
|
|
2146
|
-
* const spinner = logger.createSpinner({ name: 'dots' });
|
|
2147
|
-
* spinner.start('Loading...');
|
|
2148
|
-
* // ... do work
|
|
2149
|
-
* spinner.succeed('Done');
|
|
2150
|
-
* ```
|
|
2151
|
-
*/
|
|
2152
|
-
createSpinner(options = {}) {
|
|
2153
|
-
if (!this.interactiveManager) {
|
|
2154
|
-
throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use spinners.");
|
|
2155
|
-
}
|
|
2156
|
-
return new Spinner(options, this.interactiveManager);
|
|
2157
|
-
}
|
|
2158
|
-
/**
|
|
2159
|
-
* Creates a multi-spinner manager for displaying multiple spinners.
|
|
2160
|
-
* @param options Configuration options for the multi-spinner manager
|
|
2161
|
-
* @returns A new MultiSpinner instance
|
|
2162
|
-
* @example
|
|
2163
|
-
* ```typescript
|
|
2164
|
-
* const logger = createPail({ interactive: true });
|
|
2165
|
-
* const multiSpinner = logger.createMultiSpinner();
|
|
2166
|
-
*
|
|
2167
|
-
* const spinner1 = multiSpinner.create('Loading 1');
|
|
2168
|
-
* const spinner2 = multiSpinner.create('Loading 2');
|
|
2169
|
-
*
|
|
2170
|
-
* spinner1.start();
|
|
2171
|
-
* spinner2.start();
|
|
2172
|
-
* // ... update spinners as needed
|
|
2173
|
-
* multiSpinner.stop();
|
|
2174
|
-
* ```
|
|
2175
|
-
*/
|
|
2176
|
-
createMultiSpinner(options = {}) {
|
|
2177
|
-
if (!this.interactiveManager) {
|
|
2178
|
-
throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use spinners.");
|
|
2179
|
-
}
|
|
2180
|
-
return new MultiSpinner(options, this.interactiveManager);
|
|
2181
|
-
}
|
|
2182
1800
|
/**
|
|
2183
1801
|
* Clears the terminal screen.
|
|
2184
1802
|
*
|
|
@@ -2193,8 +1811,8 @@ class PailServerImpl extends PailBrowserImpl {
|
|
|
2193
1811
|
* ```
|
|
2194
1812
|
*/
|
|
2195
1813
|
clear() {
|
|
2196
|
-
this.stdout.write(
|
|
2197
|
-
this.stderr.write(
|
|
1814
|
+
this.stdout.write(resetTerminal);
|
|
1815
|
+
this.stderr.write(resetTerminal);
|
|
2198
1816
|
}
|
|
2199
1817
|
extendReporter(reporter) {
|
|
2200
1818
|
if (typeof reporter.setStdout === "function") {
|
|
@@ -3064,9 +2682,7 @@ class PrettyReporter extends AbstractPrettyReporter {
|
|
|
3064
2682
|
items.push(` ${grey(`[${scope.join(" > ")}]`)} `);
|
|
3065
2683
|
}
|
|
3066
2684
|
if (prefix) {
|
|
3067
|
-
items.push(
|
|
3068
|
-
`${grey(`${Array.isArray(scope) && scope.length > 0 ? ". " : " "}[${this.styles.underline.prefix ? underline(prefix) : prefix}]`)} `
|
|
3069
|
-
);
|
|
2685
|
+
items.push(`${grey(`${Array.isArray(scope) && scope.length > 0 ? ". " : " "}[${this.styles.underline.prefix ? underline(prefix) : prefix}]`)} `);
|
|
3070
2686
|
}
|
|
3071
2687
|
const titleSize = getStringWidth(items.join(" "));
|
|
3072
2688
|
if (file) {
|
|
@@ -3184,4 +2800,4 @@ const createPail = (options) => {
|
|
|
3184
2800
|
};
|
|
3185
2801
|
const pail = createPail();
|
|
3186
2802
|
|
|
3187
|
-
export {
|
|
2803
|
+
export { createPail, pail };
|
|
@@ -50,14 +50,14 @@ const pailPlugin = (app, options) => {
|
|
|
50
50
|
storage.enterWith(result.logger);
|
|
51
51
|
}
|
|
52
52
|
return { log: result.logger };
|
|
53
|
-
}).onAfterHandle({ as: "global" }, ({ request, set }) => {
|
|
53
|
+
}).onAfterHandle({ as: "global" }, async ({ request, set }) => {
|
|
54
54
|
const state = requestState.get(request);
|
|
55
55
|
if (!state?.skipped && state && !emitted.has(request)) {
|
|
56
56
|
emitted.add(request);
|
|
57
57
|
state.finish({ status: set.status ?? 200 });
|
|
58
58
|
activeLoggers.delete(state.logger);
|
|
59
59
|
}
|
|
60
|
-
}).onError({ as: "global" }, ({ error, request }) => {
|
|
60
|
+
}).onError({ as: "global" }, async ({ error, request }) => {
|
|
61
61
|
const state = requestState.get(request);
|
|
62
62
|
if (!state?.skipped && state && !emitted.has(request)) {
|
|
63
63
|
emitted.add(request);
|
|
@@ -5,7 +5,7 @@ const loggerStorage = createLoggerStorage("Express middleware context. Make sure
|
|
|
5
5
|
const useLogger = () => loggerStorage.useLogger();
|
|
6
6
|
const pailMiddleware = (options) => (request, response, next) => {
|
|
7
7
|
const requestId = request.headers["x-request-id"] ?? crypto.randomUUID();
|
|
8
|
-
const path = request.originalUrl;
|
|
8
|
+
const path = request.originalUrl ?? request.url ?? "/";
|
|
9
9
|
const safeHeaders = extractSafeNodeHeaders(request.headers);
|
|
10
10
|
const { finish, logger, skipped } = createMiddlewareLogger(options, {
|
|
11
11
|
headers: safeHeaders,
|
|
@@ -25,7 +25,7 @@ const pailPlugin = (fastify, options) => {
|
|
|
25
25
|
done();
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
fastify.addHook("onResponse", (request, reply) => {
|
|
28
|
+
fastify.addHook("onResponse", async (request, reply) => {
|
|
29
29
|
const state = requestState.get(request);
|
|
30
30
|
if (!state || emitted.has(request)) {
|
|
31
31
|
return;
|
|
@@ -33,7 +33,7 @@ const pailPlugin = (fastify, options) => {
|
|
|
33
33
|
emitted.add(request);
|
|
34
34
|
state.finish({ status: reply.statusCode });
|
|
35
35
|
});
|
|
36
|
-
fastify.addHook("onError", (request, _reply, error) => {
|
|
36
|
+
fastify.addHook("onError", async (request, _reply, error) => {
|
|
37
37
|
const state = requestState.get(request);
|
|
38
38
|
if (!state || emitted.has(request)) {
|
|
39
39
|
return;
|
|
@@ -28,7 +28,7 @@ type NextPailOptions<T extends string = string> = PailMiddlewareOptions<T>;
|
|
|
28
28
|
* });
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare const createWithPail: <T extends string = string>(options: NextPailOptions<T>) => <TArgs extends unknown[], TReturn>(handler: (...args: TArgs) => Promise<TReturn> | TReturn) => (...args: TArgs) => Promise<TReturn
|
|
31
|
+
export declare const createWithPail: <T extends string = string>(options: NextPailOptions<T>) => <TArgs extends unknown[], TReturn>(handler: (...args: TArgs) => Promise<TReturn> | TReturn) => ((...args: TArgs) => Promise<TReturn>);
|
|
32
32
|
export type { NextPailOptions };
|
|
33
33
|
export type { WideEvent } from "../../wide-event.d.ts";
|
|
34
34
|
export type { PailNextMiddlewareOptions } from "./middleware/next/middleware.d.ts";
|
|
@@ -55,5 +55,5 @@ interface PailNextMiddlewareOptions {
|
|
|
55
55
|
* export default middleware;
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export declare const pailMiddleware: (NextResponseClass: NextResponseConstructor, options?: PailNextMiddlewareOptions) => (request: NextRequest) => NextResponse;
|
|
58
|
+
export declare const pailMiddleware: (NextResponseClass: NextResponseConstructor, options?: PailNextMiddlewareOptions) => ((request: NextRequest) => NextResponse);
|
|
59
59
|
export type { PailNextMiddlewareOptions };
|
package/dist/packem_shared/{AbstractJsonReporter-DlugSJpY.js → AbstractJsonReporter-BO8Calb4.js}
RENAMED
|
@@ -258,11 +258,7 @@ class AbstractJsonReporter {
|
|
|
258
258
|
if (file) {
|
|
259
259
|
rest.file = `${file.name ?? ""}:${String(file.line)}${file.column ? `:${String(file.column)}` : ""}`;
|
|
260
260
|
}
|
|
261
|
-
|
|
262
|
-
rest.message = void 0;
|
|
263
|
-
} else {
|
|
264
|
-
rest.message = message;
|
|
265
|
-
}
|
|
261
|
+
rest.message = message === EMPTY_SYMBOL ? void 0 : message;
|
|
266
262
|
if (error) {
|
|
267
263
|
rest.error = serialize(error, this.errorOptions);
|
|
268
264
|
}
|