@visulima/pail 2.1.9 → 2.1.10
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 +15 -0
- package/LICENSE.md +10 -24
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.server.cjs +1 -1
- package/dist/index.server.mjs +1 -1
- package/dist/packem_shared/pail.browser-BL-yRzuj.cjs +1 -0
- package/dist/packem_shared/pail.browser-D7k9K5zt.mjs +1 -0
- package/package.json +13 -13
- package/dist/packem_shared/pail.browser-BDLzjsVP.mjs +0 -1
- package/dist/packem_shared/pail.browser-i0kgt9fE.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @visulima/pail [2.1.10](https://github.com/visulima/visulima/compare/@visulima/pail@2.1.9...@visulima/pail@2.1.10) (2024-10-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* updated dev dependencies, updated packem to v1.0.7, fixed naming of some lint config files ([c071a9c](https://github.com/visulima/visulima/commit/c071a9c8e129014a962ff654a16f302ca18a5c67))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/colorize:** upgraded to 1.4.11
|
|
11
|
+
* **@visulima/error:** upgraded to 4.4.6
|
|
12
|
+
* **@visulima/fmt:** upgraded to 1.1.11
|
|
13
|
+
* **@visulima/inspector:** upgraded to 1.0.11
|
|
14
|
+
* **@visulima/redact:** upgraded to 1.0.9
|
|
15
|
+
|
|
1
16
|
## @visulima/pail [2.1.9](https://github.com/visulima/visulima/compare/@visulima/pail@2.1.8...@visulima/pail@2.1.9) (2024-09-24)
|
|
2
17
|
|
|
3
18
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -23,14 +23,11 @@ SOFTWARE.
|
|
|
23
23
|
<!-- DEPENDENCIES -->
|
|
24
24
|
|
|
25
25
|
# Licenses of bundled dependencies
|
|
26
|
-
|
|
27
26
|
The published @visulima/pail artifact additionally contains code with the following licenses:
|
|
28
27
|
MIT
|
|
29
28
|
|
|
30
29
|
# Bundled dependencies:
|
|
31
|
-
|
|
32
30
|
## ansi-regex
|
|
33
|
-
|
|
34
31
|
License: MIT
|
|
35
32
|
By: Sindre Sorhus
|
|
36
33
|
Repository: chalk/ansi-regex
|
|
@@ -45,10 +42,9 @@ Repository: chalk/ansi-regex
|
|
|
45
42
|
>
|
|
46
43
|
> 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.
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
---------------------------------------
|
|
49
46
|
|
|
50
47
|
## ansi-styles
|
|
51
|
-
|
|
52
48
|
License: MIT
|
|
53
49
|
By: Sindre Sorhus
|
|
54
50
|
Repository: chalk/ansi-styles
|
|
@@ -63,10 +59,9 @@ Repository: chalk/ansi-styles
|
|
|
63
59
|
>
|
|
64
60
|
> 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.
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
---------------------------------------
|
|
67
63
|
|
|
68
64
|
## emoji-regex
|
|
69
|
-
|
|
70
65
|
License: MIT
|
|
71
66
|
By: Mathias Bynens
|
|
72
67
|
Repository: https://github.com/mathiasbynens/emoji-regex.git
|
|
@@ -92,10 +87,9 @@ Repository: https://github.com/mathiasbynens/emoji-regex.git
|
|
|
92
87
|
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
93
88
|
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
94
89
|
|
|
95
|
-
|
|
90
|
+
---------------------------------------
|
|
96
91
|
|
|
97
92
|
## get-east-asian-width
|
|
98
|
-
|
|
99
93
|
License: MIT
|
|
100
94
|
By: Sindre Sorhus
|
|
101
95
|
Repository: sindresorhus/get-east-asian-width
|
|
@@ -110,10 +104,9 @@ Repository: sindresorhus/get-east-asian-width
|
|
|
110
104
|
>
|
|
111
105
|
> 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.
|
|
112
106
|
|
|
113
|
-
|
|
107
|
+
---------------------------------------
|
|
114
108
|
|
|
115
109
|
## string-length
|
|
116
|
-
|
|
117
110
|
License: MIT
|
|
118
111
|
By: Sindre Sorhus
|
|
119
112
|
Repository: sindresorhus/string-length
|
|
@@ -128,10 +121,9 @@ Repository: sindresorhus/string-length
|
|
|
128
121
|
>
|
|
129
122
|
> 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.
|
|
130
123
|
|
|
131
|
-
|
|
124
|
+
---------------------------------------
|
|
132
125
|
|
|
133
126
|
## string-width
|
|
134
|
-
|
|
135
127
|
License: MIT
|
|
136
128
|
By: Sindre Sorhus
|
|
137
129
|
Repository: sindresorhus/string-width
|
|
@@ -146,10 +138,9 @@ Repository: sindresorhus/string-width
|
|
|
146
138
|
>
|
|
147
139
|
> 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.
|
|
148
140
|
|
|
149
|
-
|
|
141
|
+
---------------------------------------
|
|
150
142
|
|
|
151
143
|
## strip-ansi
|
|
152
|
-
|
|
153
144
|
License: MIT
|
|
154
145
|
By: Sindre Sorhus
|
|
155
146
|
Repository: chalk/strip-ansi
|
|
@@ -164,10 +155,9 @@ Repository: chalk/strip-ansi
|
|
|
164
155
|
>
|
|
165
156
|
> 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.
|
|
166
157
|
|
|
167
|
-
|
|
158
|
+
---------------------------------------
|
|
168
159
|
|
|
169
160
|
## terminal-size
|
|
170
|
-
|
|
171
161
|
License: MIT
|
|
172
162
|
By: Sindre Sorhus
|
|
173
163
|
Repository: sindresorhus/terminal-size
|
|
@@ -182,10 +172,9 @@ Repository: sindresorhus/terminal-size
|
|
|
182
172
|
>
|
|
183
173
|
> 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.
|
|
184
174
|
|
|
185
|
-
|
|
175
|
+
---------------------------------------
|
|
186
176
|
|
|
187
177
|
## wrap-ansi
|
|
188
|
-
|
|
189
178
|
License: MIT
|
|
190
179
|
By: Sindre Sorhus
|
|
191
180
|
Repository: chalk/wrap-ansi
|
|
@@ -200,21 +189,18 @@ Repository: chalk/wrap-ansi
|
|
|
200
189
|
>
|
|
201
190
|
> 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.
|
|
202
191
|
|
|
203
|
-
<!-- DEPENDENCIES -->
|
|
192
|
+
<!-- /DEPENDENCIES -->
|
|
204
193
|
|
|
205
194
|
<!-- TYPE_DEPENDENCIES -->
|
|
206
195
|
|
|
207
196
|
# Licenses of bundled types
|
|
208
|
-
|
|
209
197
|
The published @visulima/pail artifact additionally contains code with the following licenses:
|
|
210
198
|
(MIT OR CC0-1.0)
|
|
211
199
|
|
|
212
200
|
# Bundled types:
|
|
213
|
-
|
|
214
201
|
## type-fest
|
|
215
|
-
|
|
216
202
|
License: (MIT OR CC0-1.0)
|
|
217
203
|
By: Sindre Sorhus
|
|
218
204
|
Repository: sindresorhus/type-fest
|
|
219
205
|
|
|
220
|
-
<!-- TYPE_DEPENDENCIES -->
|
|
206
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/index.browser.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var o=(e,r)=>a(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./packem_shared/pail.browser-
|
|
1
|
+
"use strict";var a=Object.defineProperty;var o=(e,r)=>a(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./packem_shared/pail.browser-BL-yRzuj.cjs"),i=require("./packem_shared/MessageFormatterProcessor-CCRIUIdT.cjs"),c=require("./packem_shared/JsonReporter-Be-Pmt7o.cjs");var n=Object.defineProperty,l=o((e,r)=>n(e,"name",{value:r,configurable:!0}),"e");const t=l(e=>new s.PailBrowser({processors:[new i],reporters:[new c],...e}),"createPail"),p=t();exports.createPail=t;exports.pail=p;
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{P as t}from"./packem_shared/pail.browser-
|
|
1
|
+
var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{P as t}from"./packem_shared/pail.browser-D7k9K5zt.mjs";import p from"./packem_shared/MessageFormatterProcessor-D_XajTuK.mjs";import i from"./packem_shared/JsonReporter-DInAbLuf.mjs";var m=Object.defineProperty,n=o((r,e)=>m(r,"name",{value:e,configurable:!0}),"e");const s=n(r=>new t({processors:[new p],reporters:[new i],...r}),"createPail"),w=s();export{s as createPail,w as pail};
|
package/dist/index.server.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty;var n=(r,t)=>P(r,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("node:process"),w=require("./packem_shared/format-label-v7wmniOZ.cjs"),E=require("node:string_decoder"),I=require("./packem_shared/pail.browser-
|
|
1
|
+
"use strict";var P=Object.defineProperty;var n=(r,t)=>P(r,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("node:process"),w=require("./packem_shared/format-label-v7wmniOZ.cjs"),E=require("node:string_decoder"),I=require("./packem_shared/pail.browser-BL-yRzuj.cjs"),f=require("@visulima/inspector"),$=require("./packem_shared/constants-BBH2bwRB.cjs"),M=require("./packem_shared/write-stream-Bgxqp0HI.cjs"),j=require("./packem_shared/MessageFormatterProcessor-CCRIUIdT.cjs"),O=require("./packem_shared/PrettyReporter-TmVtQa5X.cjs");var R=Object.defineProperty,A=n((r,t)=>R(r,"name",{value:t,configurable:!0}),"l$1");let q=class{static{n(this,"v")}static{A(this,"InteractiveManager")}#t;#e=!1;#r=!1;#s=0;#i=0;constructor(t,e){this.#t={stderr:e,stdout:t}}get lastLength(){return this.#s}get outside(){return this.#i}get isHooked(){return this.#e}get isSuspended(){return this.#r}erase(t,e=this.#s){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);this.#t[t].erase(e)}hook(){return this.#e||(Object.values(this.#t).forEach(t=>t.active()),this._clear(!0)),this.#e}resume(t,e){this.#r&&(this.#r=!1,e&&this.erase(t,e),this.#s=0,Object.values(this.#t).forEach(s=>s.active()))}suspend(t,e=!0){this.#r||(this.#r=!0,e&&this.erase(t),Object.values(this.#t).forEach(s=>s.renew()))}unhook(t=!0){return this.#e&&(Object.values(this.#t).forEach(e=>e.inactive(t)),this._clear()),!this.#e}update(t,e,s=0){if(e.length>0){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);const a=this.#t[t],{columns:p,rows:i}=w.terminalSize(),u=s>i?i-1:Math.max(0,Math.min(i-1,s)),l=this.lastLength-u,d=Math.max(l-i,this.outside);let o=e.reduce((b,L)=>[...b,w.wrapAnsi(L,p,{hard:!0,trim:!1,wordWrap:!0})],[]);i<=l?(a.erase(i),u<d&&(o=o.slice(d-u+1))):l&&a.erase(l),a.write(o.join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`),this.#s=d?d+o.length+1:o.length,this.#i=Math.max(this.lastLength-i,this.outside)}}_clear(t=!1){this.#e=t,this.#s=0,this.#i=0}};var T=Object.defineProperty,y=n((r,t)=>T(r,"name",{value:t,configurable:!0}),"n$1");const c="\x1B[",g=c+"2J",x=c+"2K",N=c+"G",D=y((r=1)=>c+r+"A","cursorUp"),m=process.platform==="win32"?`${g}${c}0f`:`${g}${c}3J${c}H`,B=c+"?25l",k=c+"?25h",G=y(r=>{let t="";for(let e=0;e<r;e++)t+=x+(e<r-1?D():"");return r&&(t+=N),t},"eraseLines");var H=Object.defineProperty,V=n((r,t)=>H(r,"name",{value:t,configurable:!0}),"s$1");class v{static{n(this,"t")}static{V(this,"InteractiveStreamHook")}static DRAIN=!0;#t=new E.StringDecoder;#e=[];#r;#s;constructor(t){this.#r=t.write,this.#s=t}active(){this.write(B),this.#s.write=(t,...e)=>{const s=e.at(-1);return this.#e.push(this.#t.write(typeof t=="string"?Buffer.from(t,typeof e[0]=="string"?e[0]:void 0):Buffer.from(t))),typeof s=="function"&&s(),v.DRAIN}}erase(t){t>0&&this.write(G(t+1))}inactive(t=!1){this.#e.length>0&&(t&&this.write(`
|
|
4
4
|
`),this.#e.forEach(e=>{this.write(e)}),this.#e=[]),this.renew()}renew(){this.#s.write=this.#r,this.write(k)}write(t){this.#r.apply(this.#s,[t])}}var Y=Object.defineProperty,C=n((r,t)=>Y(r,"name",{value:t,configurable:!0}),"c");let J=class{static{n(this,"v")}static{C(this,"RawReporter")}#t;#e;#r;#s=!1;#i;constructor(t={}){this.#t=h.stdout,this.#e=h.stderr,this.#i=t}setStdout(t){this.#t=t}setStderr(t){this.#e=t}setInteractiveManager(t){this.#r=t}setIsInteractive(t){this.#s=t}log(t){const{context:e,groups:s,message:a,type:p}=t,i=[];if(a!==$.EMPTY_SYMBOL){const o=typeof a=="string"?a:f.inspect(a,this.#i);i.push(o)}e&&i.push(...e.map(o=>typeof o=="object"?" "+f.inspect(o,this.#i):" "+o));const u=["error","trace","warn"].includes(p.level)?"stderr":"stdout",l=u==="stderr"?this.#e:this.#t,d=s.map(()=>" ").join("");this.#s&&this.#r!==void 0&&l.isTTY?this.#r.update(u,(d+i.join("")).split(`
|
package/dist/index.server.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var L=Object.defineProperty;var n=(r,t)=>L(r,"name",{value:t,configurable:!0});import{stdout as m,stderr as y,env as d}from"node:process";import{t as I,w as $}from"./packem_shared/format-label-mKzVo7-U.mjs";import{StringDecoder as j}from"node:string_decoder";import{a as M}from"./packem_shared/pail.browser-
|
|
1
|
+
var L=Object.defineProperty;var n=(r,t)=>L(r,"name",{value:t,configurable:!0});import{stdout as m,stderr as y,env as d}from"node:process";import{t as I,w as $}from"./packem_shared/format-label-mKzVo7-U.mjs";import{StringDecoder as j}from"node:string_decoder";import{a as M}from"./packem_shared/pail.browser-D7k9K5zt.mjs";import{inspect as v}from"@visulima/inspector";import{E as O}from"./packem_shared/constants-BMS51p6Y.mjs";import{n as P}from"./packem_shared/write-stream-C17GXSxA.mjs";import R from"./packem_shared/MessageFormatterProcessor-D_XajTuK.mjs";import{PrettyReporter as A}from"./packem_shared/PrettyReporter-LK4KD_vd.mjs";var x=Object.defineProperty,N=n((r,t)=>x(r,"name",{value:t,configurable:!0}),"l$1");let T=class{static{n(this,"v")}static{N(this,"InteractiveManager")}#t;#e=!1;#r=!1;#s=0;#i=0;constructor(t,e){this.#t={stderr:e,stdout:t}}get lastLength(){return this.#s}get outside(){return this.#i}get isHooked(){return this.#e}get isSuspended(){return this.#r}erase(t,e=this.#s){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);this.#t[t].erase(e)}hook(){return this.#e||(Object.values(this.#t).forEach(t=>t.active()),this._clear(!0)),this.#e}resume(t,e){this.#r&&(this.#r=!1,e&&this.erase(t,e),this.#s=0,Object.values(this.#t).forEach(s=>s.active()))}suspend(t,e=!0){this.#r||(this.#r=!0,e&&this.erase(t),Object.values(this.#t).forEach(s=>s.renew()))}unhook(t=!0){return this.#e&&(Object.values(this.#t).forEach(e=>e.inactive(t)),this._clear()),!this.#e}update(t,e,s=0){if(e.length>0){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);const a=this.#t[t],{columns:u,rows:i}=I(),c=s>i?i-1:Math.max(0,Math.min(i-1,s)),l=this.lastLength-c,p=Math.max(l-i,this.outside);let o=e.reduce((b,E)=>[...b,$(E,u,{hard:!0,trim:!1,wordWrap:!0})],[]);i<=l?(a.erase(i),c<p&&(o=o.slice(p-c+1))):l&&a.erase(l),a.write(o.join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`),this.#s=p?p+o.length+1:o.length,this.#i=Math.max(this.lastLength-i,this.outside)}}_clear(t=!1){this.#e=t,this.#s=0,this.#i=0}};var D=Object.defineProperty,S=n((r,t)=>D(r,"name",{value:t,configurable:!0}),"n$1");const h="\x1B[",w=h+"2J",B=h+"2K",k=h+"G",G=S((r=1)=>h+r+"A","cursorUp"),g=process.platform==="win32"?`${w}${h}0f`:`${w}${h}3J${h}H`,H=h+"?25l",V=h+"?25h",Y=S(r=>{let t="";for(let e=0;e<r;e++)t+=B+(e<r-1?G():"");return r&&(t+=k),t},"eraseLines");var C=Object.defineProperty,J=n((r,t)=>C(r,"name",{value:t,configurable:!0}),"s$1");class f{static{n(this,"t")}static{J(this,"InteractiveStreamHook")}static DRAIN=!0;#t=new j;#e=[];#r;#s;constructor(t){this.#r=t.write,this.#s=t}active(){this.write(H),this.#s.write=(t,...e)=>{const s=e.at(-1);return this.#e.push(this.#t.write(typeof t=="string"?Buffer.from(t,typeof e[0]=="string"?e[0]:void 0):Buffer.from(t))),typeof s=="function"&&s(),f.DRAIN}}erase(t){t>0&&this.write(Y(t+1))}inactive(t=!1){this.#e.length>0&&(t&&this.write(`
|
|
4
4
|
`),this.#e.forEach(e=>{this.write(e)}),this.#e=[]),this.renew()}renew(){this.#s.write=this.#r,this.write(V)}write(t){this.#r.apply(this.#s,[t])}}var U=Object.defineProperty,z=n((r,t)=>U(r,"name",{value:t,configurable:!0}),"c");let K=class{static{n(this,"v")}static{z(this,"RawReporter")}#t;#e;#r;#s=!1;#i;constructor(t={}){this.#t=m,this.#e=y,this.#i=t}setStdout(t){this.#t=t}setStderr(t){this.#e=t}setInteractiveManager(t){this.#r=t}setIsInteractive(t){this.#s=t}log(t){const{context:e,groups:s,message:a,type:u}=t,i=[];if(a!==O){const o=typeof a=="string"?a:v(a,this.#i);i.push(o)}e&&i.push(...e.map(o=>typeof o=="object"?" "+v(o,this.#i):" "+o));const c=["error","trace","warn"].includes(u.level)?"stderr":"stdout",l=c==="stderr"?this.#e:this.#t,p=s.map(()=>" ").join("");this.#s&&this.#r!==void 0&&l.isTTY?this.#r.update(c,(p+i.join("")).split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var n=(r,e)=>m(r,"name",{value:e,configurable:!0});const u=require("safe-stable-stringify"),p=require("./constants-BBH2bwRB.cjs"),L=require("./write-console-log-3G15muTS.cjs"),y=require("./get-longest-label-DXpzhu5N.cjs");var b=Object.defineProperty,v=n((r,e)=>b(r,"name",{value:e,configurable:!0}),"t");class w{static{n(this,"i")}static{v(this,"RawReporter")}log(e){const{context:t=[],message:s,type:o}=e;L.t(o.level)(s,...t)}}var _=Object.defineProperty,x=n((r,e)=>_(r,"name",{value:e,configurable:!0}),"a");const M=x(r=>r===void 0?[]:Array.isArray(r)?r:[r],"arrayify");var T=Object.defineProperty,E=n((r,e)=>T(r,"name",{value:e,configurable:!0}),"g");const R=E((r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},"mergeTypes");var S=Object.defineProperty,f=n((r,e)=>S(r,"name",{value:e,configurable:!0}),"l");class d{static{n(this,"PailBrowserImpl")}static{f(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5,this.stringify=u.configure({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",this.types=R(p.LOG_TYPES,e.types??{}),this.longestLabel=y.s(this.types),this.logLevels={...p.EXTENDED_RFC_5424_LOG_LEVELS,...e.logLevels},this.generalLogLevel=this._normalizeLogLevel(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.scopeName=M(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set;for(const t in this.types)this[t]=this._logger.bind(this,t,!1);this.lastLog={},Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new w),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}wrapConsole(){for(const e in this.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}time(e="default"){this.seqTimers.has(e)?this._logger("warn",!1,{message:"Timer '"+e+"' already exists",prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this._logger("start",!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...t){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this._logger("info",!1,{context:t,message:s<1e3?s+" ms":(s/1e3).toFixed(2)+" s",prefix:e})}else this._logger("warn",!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const t=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this._logger("stop",!1,{message:this.endTimerMessage+" "+(t<1e3?t+" ms":(t/1e3).toFixed(2)+" s"),prefix:e})}else this._logger("warn",!1,{message:"Timer not found",prefix:e})}group(e="console.group"){typeof window>"u"?this.groups.push(e):console.group(e)}groupEnd(){typeof window>"u"?this.groups.pop():console.groupEnd()}count(e="default"){const t=this.countMap.get(e)??0;this.countMap.set(e,t+1),this._logger("log",!1,{message:e+": "+(t+1),prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this._logger("warn",!1,{message:"Count for "+e+" does not exist",prefix:e})}clear(){console.clear()}raw(e,...t){this.disabled||this._logger("log",!0,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(const t of e)this.reporters.add(this.extendReporter(t))}_report(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}registerProcessors(e){for(const t of e)typeof t.setStringify=="function"&&t.setStringify(this.stringify),this.processors.add(t)}_normalizeLogLevel(e){return e&&this.logLevels[e]?e:"debug"}_buildMeta(e,t,...s){const o={badge:void 0,context:void 0,error:void 0,label:void 0,message:p.EMPTY_SYMBOL,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(o.type={level:t.logLevel,name:e},o.groups=this.groups,o.scope=this.scopeName,o.date=new Date,s.length===1&&typeof s[0]=="object"&&s[0]!==null)if(s[0]instanceof Error)o.error=s[0];else if("message"in s[0]){const{context:i,message:g,prefix:h,suffix:a}=s[0];i&&(o.context=i),h&&(o.prefix=h),a&&(o.suffix=a),o.message=g}else o.message=s[0];else s.length>1&&typeof s[0]=="string"?(o.message=s[0],o.context=s.slice(1)):o.message=s[0];return t.logLevel==="trace"&&(o.traceError=new Error("Trace")),t.badge&&(o.badge=t.badge),t.label&&(o.label=t.label),o}_logger(e,t,...s){if(this.disabled)return;const o=this._normalizeLogLevel(this.types[e].logLevel);if(this.logLevels[o]>=this.logLevels[this.generalLogLevel]){let i=this._buildMeta(e,this.types[e],...s);const g=f((a=!1)=>{const l=(this.lastLog.count||0)-this.throttleMin;if(this.lastLog.object&&l>0){const c={...this.lastLog.object};l>1&&(c.repeated=l),this._report(c,t),this.lastLog.count=1}if(a){for(const c of this.processors)i={...c.process(i)};this.lastLog.object=i,this._report(i,t)}},"resolveLog");clearTimeout(this.lastLog.timeout);const h=this.lastLog.time&&i.date?new Date(i.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(i.date),h<this.throttle)try{const a=JSON.stringify([i.label,i.scope,i.type,i.message,i.prefix,i.suffix,i.context]),l=this.lastLog.serialized===a;if(this.lastLog.serialized=a,l&&(this.lastLog.count=(this.lastLog.count||0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}const P=d;exports.PailBrowser=P;exports.PailBrowserImpl=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var n=(r,e)=>f(r,"name",{value:e,configurable:!0});import{configure as m}from"safe-stable-stringify";import{L as d,a as u,E as L}from"./constants-BMS51p6Y.mjs";import{t as y}from"./write-console-log-BP95fgQZ.mjs";import{s as b}from"./get-longest-label-4ISUsE2q.mjs";var v=Object.defineProperty,w=n((r,e)=>v(r,"name",{value:e,configurable:!0}),"t");class x{static{n(this,"i")}static{w(this,"RawReporter")}log(e){const{context:t=[],message:s,type:o}=e;y(o.level)(s,...t)}}var _=Object.defineProperty,M=n((r,e)=>_(r,"name",{value:e,configurable:!0}),"a");const T=M(r=>r===void 0?[]:Array.isArray(r)?r:[r],"arrayify");var E=Object.defineProperty,R=n((r,e)=>E(r,"name",{value:e,configurable:!0}),"g");const j=R((r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},"mergeTypes");var P=Object.defineProperty,c=n((r,e)=>P(r,"name",{value:e,configurable:!0}),"l");class S{static{n(this,"PailBrowserImpl")}static{c(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5,this.stringify=m({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",this.types=j(d,e.types??{}),this.longestLabel=b(this.types),this.logLevels={...u,...e.logLevels},this.generalLogLevel=this._normalizeLogLevel(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.scopeName=T(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set;for(const t in this.types)this[t]=this._logger.bind(this,t,!1);this.lastLog={},Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new x),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}wrapConsole(){for(const e in this.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}time(e="default"){this.seqTimers.has(e)?this._logger("warn",!1,{message:"Timer '"+e+"' already exists",prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this._logger("start",!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...t){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this._logger("info",!1,{context:t,message:s<1e3?s+" ms":(s/1e3).toFixed(2)+" s",prefix:e})}else this._logger("warn",!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const t=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this._logger("stop",!1,{message:this.endTimerMessage+" "+(t<1e3?t+" ms":(t/1e3).toFixed(2)+" s"),prefix:e})}else this._logger("warn",!1,{message:"Timer not found",prefix:e})}group(e="console.group"){typeof window>"u"?this.groups.push(e):console.group(e)}groupEnd(){typeof window>"u"?this.groups.pop():console.groupEnd()}count(e="default"){const t=this.countMap.get(e)??0;this.countMap.set(e,t+1),this._logger("log",!1,{message:e+": "+(t+1),prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this._logger("warn",!1,{message:"Count for "+e+" does not exist",prefix:e})}clear(){console.clear()}raw(e,...t){this.disabled||this._logger("log",!0,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(const t of e)this.reporters.add(this.extendReporter(t))}_report(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}registerProcessors(e){for(const t of e)typeof t.setStringify=="function"&&t.setStringify(this.stringify),this.processors.add(t)}_normalizeLogLevel(e){return e&&this.logLevels[e]?e:"debug"}_buildMeta(e,t,...s){const o={badge:void 0,context:void 0,error:void 0,label:void 0,message:L,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(o.type={level:t.logLevel,name:e},o.groups=this.groups,o.scope=this.scopeName,o.date=new Date,s.length===1&&typeof s[0]=="object"&&s[0]!==null)if(s[0]instanceof Error)o.error=s[0];else if("message"in s[0]){const{context:i,message:g,prefix:h,suffix:a}=s[0];i&&(o.context=i),h&&(o.prefix=h),a&&(o.suffix=a),o.message=g}else o.message=s[0];else s.length>1&&typeof s[0]=="string"?(o.message=s[0],o.context=s.slice(1)):o.message=s[0];return t.logLevel==="trace"&&(o.traceError=new Error("Trace")),t.badge&&(o.badge=t.badge),t.label&&(o.label=t.label),o}_logger(e,t,...s){if(this.disabled)return;const o=this._normalizeLogLevel(this.types[e].logLevel);if(this.logLevels[o]>=this.logLevels[this.generalLogLevel]){let i=this._buildMeta(e,this.types[e],...s);const g=c((a=!1)=>{const l=(this.lastLog.count||0)-this.throttleMin;if(this.lastLog.object&&l>0){const p={...this.lastLog.object};l>1&&(p.repeated=l),this._report(p,t),this.lastLog.count=1}if(a){for(const p of this.processors)i={...p.process(i)};this.lastLog.object=i,this._report(i,t)}},"resolveLog");clearTimeout(this.lastLog.timeout);const h=this.lastLog.time&&i.date?new Date(i.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(i.date),h<this.throttle)try{const a=JSON.stringify([i.label,i.scope,i.type,i.message,i.prefix,i.suffix,i.context]),l=this.lastLog.serialized===a;if(this.lastLog.serialized=a,l&&(this.lastLog.count=(this.lastLog.count||0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}const A=S;export{A as P,S as a};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pail",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "Find a file or directory by walking up parent directories.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -225,10 +225,10 @@
|
|
|
225
225
|
"LICENSE.md"
|
|
226
226
|
],
|
|
227
227
|
"dependencies": {
|
|
228
|
-
"@visulima/colorize": "1.4.
|
|
229
|
-
"@visulima/error": "4.4.
|
|
230
|
-
"@visulima/fmt": "1.1.
|
|
231
|
-
"@visulima/inspector": "1.0.
|
|
228
|
+
"@visulima/colorize": "1.4.11",
|
|
229
|
+
"@visulima/error": "4.4.6",
|
|
230
|
+
"@visulima/fmt": "1.1.11",
|
|
231
|
+
"@visulima/inspector": "1.0.11",
|
|
232
232
|
"safe-stable-stringify": "^2.5.0"
|
|
233
233
|
},
|
|
234
234
|
"devDependencies": {
|
|
@@ -237,15 +237,15 @@
|
|
|
237
237
|
"@anolilab/semantic-release-pnpm": "^1.1.3",
|
|
238
238
|
"@anolilab/semantic-release-preset": "^9.0.0",
|
|
239
239
|
"@arethetypeswrong/cli": "^0.16.4",
|
|
240
|
-
"@babel/core": "^7.25.
|
|
240
|
+
"@babel/core": "^7.25.7",
|
|
241
241
|
"@rushstack/eslint-plugin-security": "^0.8.3",
|
|
242
|
-
"@secretlint/secretlint-rule-preset-recommend": "^8.
|
|
242
|
+
"@secretlint/secretlint-rule-preset-recommend": "^8.3.0",
|
|
243
243
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
244
244
|
"@types/node": "18.19.15",
|
|
245
|
-
"@visulima/packem": "1.0.
|
|
246
|
-
"@visulima/redact": "1.0.
|
|
247
|
-
"@vitest/coverage-v8": "^2.1.
|
|
248
|
-
"@vitest/ui": "^2.1.
|
|
245
|
+
"@visulima/packem": "1.0.7",
|
|
246
|
+
"@visulima/redact": "1.0.9",
|
|
247
|
+
"@vitest/coverage-v8": "^2.1.2",
|
|
248
|
+
"@vitest/ui": "^2.1.2",
|
|
249
249
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
250
250
|
"cross-env": "^7.0.3",
|
|
251
251
|
"esbuild": "0.24.0",
|
|
@@ -265,11 +265,11 @@
|
|
|
265
265
|
"terminal-size": "^4.0.0",
|
|
266
266
|
"type-fest": "^4.26.1",
|
|
267
267
|
"typescript": "5.4.5",
|
|
268
|
-
"vitest": "^2.1.
|
|
268
|
+
"vitest": "^2.1.2",
|
|
269
269
|
"wrap-ansi": "^9.0.0"
|
|
270
270
|
},
|
|
271
271
|
"peerDependencies": {
|
|
272
|
-
"@visulima/redact": "1.0.
|
|
272
|
+
"@visulima/redact": "1.0.9",
|
|
273
273
|
"rotating-file-stream": "^3.1.1"
|
|
274
274
|
},
|
|
275
275
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var n=(r,e)=>f(r,"name",{value:e,configurable:!0});import{configure as m}from"safe-stable-stringify";import{L as d,a as u,E as L}from"./constants-BMS51p6Y.mjs";import{t as y}from"./write-console-log-BP95fgQZ.mjs";import{s as b}from"./get-longest-label-4ISUsE2q.mjs";var v=Object.defineProperty,w=n((r,e)=>v(r,"name",{value:e,configurable:!0}),"t");class x{static{n(this,"i")}static{w(this,"RawReporter")}log(e){const{context:t=[],message:s,type:o}=e;y(o.level)(s,...t)}}var _=Object.defineProperty,M=n((r,e)=>_(r,"name",{value:e,configurable:!0}),"a");const T=M(r=>r===void 0?[]:Array.isArray(r)?r:[r],"arrayify");var E=Object.defineProperty,R=n((r,e)=>E(r,"name",{value:e,configurable:!0}),"g");const j=R((r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},"mergeTypes");var P=Object.defineProperty,c=n((r,e)=>P(r,"name",{value:e,configurable:!0}),"l");class S{static{n(this,"PailBrowserImpl")}static{c(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5,this.stringify=m({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",this.types=j(d,e.types??{}),this.longestLabel=b(this.types),this.logLevels={...u,...e.logLevels},this.generalLogLevel=this._normalizeLogLevel(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.scopeName=T(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set;for(const t in this.types)this[t]=this._logger.bind(this,t,!1);this.lastLog={},Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new x),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}wrapConsole(){for(const e in this.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapException(){typeof process<"u"&&(process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)}))}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}time(e="default"){this.seqTimers.has(e)?this._logger("warn",!1,{message:"Timer '"+e+"' already exists",prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this._logger("start",!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...t){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this._logger("info",!1,{context:t,message:s<1e3?s+" ms":(s/1e3).toFixed(2)+" s",prefix:e})}else this._logger("warn",!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const t=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this._logger("stop",!1,{message:this.endTimerMessage+" "+(t<1e3?t+" ms":(t/1e3).toFixed(2)+" s"),prefix:e})}else this._logger("warn",!1,{message:"Timer not found",prefix:e})}group(e="console.group"){typeof window>"u"?this.groups.push(e):console.group(e)}groupEnd(){typeof window>"u"?this.groups.pop():console.groupEnd()}count(e="default"){const t=this.countMap.get(e)??0;this.countMap.set(e,t+1),this._logger("log",!1,{message:e+": "+(t+1),prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this._logger("warn",!1,{message:"Count for "+e+" does not exist",prefix:e})}clear(){console.clear()}raw(e,...t){this.disabled||this._logger("log",!0,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(const t of e)this.reporters.add(this.extendReporter(t))}_report(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}registerProcessors(e){for(const t of e)typeof t.setStringify=="function"&&t.setStringify(this.stringify),this.processors.add(t)}_normalizeLogLevel(e){return e&&this.logLevels[e]?e:"debug"}_buildMeta(e,t,...s){const o={badge:void 0,context:void 0,error:void 0,label:void 0,message:L,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(o.type={level:t.logLevel,name:e},o.groups=this.groups,o.scope=this.scopeName,o.date=new Date,s.length===1&&typeof s[0]=="object"&&s[0]!==null)if(s[0]instanceof Error)o.error=s[0];else if("message"in s[0]){const{context:i,message:g,prefix:h,suffix:a}=s[0];i&&(o.context=i),h&&(o.prefix=h),a&&(o.suffix=a),o.message=g}else o.message=s[0];else s.length>1&&typeof s[0]=="string"?(o.message=s[0],o.context=s.slice(1)):o.message=s[0];return t.logLevel==="trace"&&(o.traceError=new Error("Trace")),t.badge&&(o.badge=t.badge),t.label&&(o.label=t.label),o}_logger(e,t,...s){if(this.disabled)return;const o=this._normalizeLogLevel(this.types[e].logLevel);if(this.logLevels[o]>=this.logLevels[this.generalLogLevel]){let i=this._buildMeta(e,this.types[e],...s);const g=c((a=!1)=>{const l=(this.lastLog.count||0)-this.throttleMin;if(this.lastLog.object&&l>0){const p={...this.lastLog.object};l>1&&(p.repeated=l),this._report(p,t),this.lastLog.count=1}if(a){for(const p of this.processors)i={...p.process(i)};this.lastLog.object=i,this._report(i,t)}},"resolveLog");clearTimeout(this.lastLog.timeout);const h=this.lastLog.time&&i.date?new Date(i.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(i.date),h<this.throttle)try{const a=JSON.stringify([i.label,i.scope,i.type,i.message,i.prefix,i.suffix,i.context]),l=this.lastLog.serialized===a;if(this.lastLog.serialized=a,l&&(this.lastLog.count=(this.lastLog.count||0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}const A=S;export{A as P,S as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var n=(r,e)=>m(r,"name",{value:e,configurable:!0});const u=require("safe-stable-stringify"),p=require("./constants-BBH2bwRB.cjs"),L=require("./write-console-log-3G15muTS.cjs"),y=require("./get-longest-label-DXpzhu5N.cjs");var b=Object.defineProperty,v=n((r,e)=>b(r,"name",{value:e,configurable:!0}),"t");class w{static{n(this,"i")}static{v(this,"RawReporter")}log(e){const{context:t=[],message:s,type:o}=e;L.t(o.level)(s,...t)}}var _=Object.defineProperty,x=n((r,e)=>_(r,"name",{value:e,configurable:!0}),"a");const M=x(r=>r===void 0?[]:Array.isArray(r)?r:[r],"arrayify");var T=Object.defineProperty,E=n((r,e)=>T(r,"name",{value:e,configurable:!0}),"g");const R=E((r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},"mergeTypes");var S=Object.defineProperty,f=n((r,e)=>S(r,"name",{value:e,configurable:!0}),"l");class d{static{n(this,"PailBrowserImpl")}static{f(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5,this.stringify=u.configure({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",this.types=R(p.LOG_TYPES,e.types??{}),this.longestLabel=y.s(this.types),this.logLevels={...p.EXTENDED_RFC_5424_LOG_LEVELS,...e.logLevels},this.generalLogLevel=this._normalizeLogLevel(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.scopeName=M(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set;for(const t in this.types)this[t]=this._logger.bind(this,t,!1);this.lastLog={},Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new w),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}wrapConsole(){for(const e in this.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapException(){typeof process<"u"&&(process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)}))}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}time(e="default"){this.seqTimers.has(e)?this._logger("warn",!1,{message:"Timer '"+e+"' already exists",prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this._logger("start",!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...t){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this._logger("info",!1,{context:t,message:s<1e3?s+" ms":(s/1e3).toFixed(2)+" s",prefix:e})}else this._logger("warn",!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const t=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this._logger("stop",!1,{message:this.endTimerMessage+" "+(t<1e3?t+" ms":(t/1e3).toFixed(2)+" s"),prefix:e})}else this._logger("warn",!1,{message:"Timer not found",prefix:e})}group(e="console.group"){typeof window>"u"?this.groups.push(e):console.group(e)}groupEnd(){typeof window>"u"?this.groups.pop():console.groupEnd()}count(e="default"){const t=this.countMap.get(e)??0;this.countMap.set(e,t+1),this._logger("log",!1,{message:e+": "+(t+1),prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this._logger("warn",!1,{message:"Count for "+e+" does not exist",prefix:e})}clear(){console.clear()}raw(e,...t){this.disabled||this._logger("log",!0,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(const t of e)this.reporters.add(this.extendReporter(t))}_report(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}registerProcessors(e){for(const t of e)typeof t.setStringify=="function"&&t.setStringify(this.stringify),this.processors.add(t)}_normalizeLogLevel(e){return e&&this.logLevels[e]?e:"debug"}_buildMeta(e,t,...s){const o={badge:void 0,context:void 0,error:void 0,label:void 0,message:p.EMPTY_SYMBOL,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(o.type={level:t.logLevel,name:e},o.groups=this.groups,o.scope=this.scopeName,o.date=new Date,s.length===1&&typeof s[0]=="object"&&s[0]!==null)if(s[0]instanceof Error)o.error=s[0];else if("message"in s[0]){const{context:i,message:g,prefix:h,suffix:a}=s[0];i&&(o.context=i),h&&(o.prefix=h),a&&(o.suffix=a),o.message=g}else o.message=s[0];else s.length>1&&typeof s[0]=="string"?(o.message=s[0],o.context=s.slice(1)):o.message=s[0];return t.logLevel==="trace"&&(o.traceError=new Error("Trace")),t.badge&&(o.badge=t.badge),t.label&&(o.label=t.label),o}_logger(e,t,...s){if(this.disabled)return;const o=this._normalizeLogLevel(this.types[e].logLevel);if(this.logLevels[o]>=this.logLevels[this.generalLogLevel]){let i=this._buildMeta(e,this.types[e],...s);const g=f((a=!1)=>{const l=(this.lastLog.count||0)-this.throttleMin;if(this.lastLog.object&&l>0){const c={...this.lastLog.object};l>1&&(c.repeated=l),this._report(c,t),this.lastLog.count=1}if(a){for(const c of this.processors)i={...c.process(i)};this.lastLog.object=i,this._report(i,t)}},"resolveLog");clearTimeout(this.lastLog.timeout);const h=this.lastLog.time&&i.date?new Date(i.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(i.date),h<this.throttle)try{const a=JSON.stringify([i.label,i.scope,i.type,i.message,i.prefix,i.suffix,i.context]),l=this.lastLog.serialized===a;if(this.lastLog.serialized=a,l&&(this.lastLog.count=(this.lastLog.count||0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}const P=d;exports.PailBrowser=P;exports.PailBrowserImpl=d;
|