llonebot-dist 7.12.14 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/default_config.json +85 -85
- package/llbot.js +48383 -41473
- package/llbot.js.map +1 -1
- package/node_modules/ws/lib/receiver.js +54 -0
- package/node_modules/ws/lib/sender.js +6 -1
- package/node_modules/ws/lib/websocket-server.js +8 -0
- package/node_modules/ws/lib/websocket.js +14 -0
- package/node_modules/ws/package.json +1 -1
- package/package.json +1 -1
- package/sign-proxy.linux-arm64.node +0 -0
- package/sign-proxy.linux-x64.node +0 -0
- package/sign-proxy.package.json +7 -0
- package/sign-proxy.win-x64.node +0 -0
- package/webui/assets/index-DW9CNxRt.js +34 -0
- package/webui/assets/index-Dr4PXp_0.css +2 -0
- package/webui/index.html +13 -13
- package/webui/logo.jpg +0 -0
- package//344/275/277/347/224/250/350/257/264/346/230/216.txt +6 -6
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +892 -892
- package/node_modules/cosmokit/LICENSE +0 -21
- package/node_modules/cosmokit/README.md +0 -24
- package/node_modules/cosmokit/lib/index.cjs +0 -419
- package/node_modules/cosmokit/lib/index.cjs.map +0 -6
- package/node_modules/cosmokit/lib/index.d.ts +0 -142
- package/node_modules/cosmokit/lib/index.mjs +0 -357
- package/node_modules/cosmokit/lib/index.mjs.map +0 -6
- package/node_modules/cosmokit/package.json +0 -57
- package/node_modules/cosmokit/src/array.ts +0 -35
- package/node_modules/cosmokit/src/index.ts +0 -5
- package/node_modules/cosmokit/src/misc.ts +0 -57
- package/node_modules/cosmokit/src/string.ts +0 -101
- package/node_modules/cosmokit/src/time.ts +0 -91
- package/node_modules/cosmokit/src/types.ts +0 -131
- package/node_modules/object-inspect/CHANGELOG.md +0 -424
- package/node_modules/object-inspect/LICENSE +0 -21
- package/node_modules/object-inspect/example/all.js +0 -23
- package/node_modules/object-inspect/example/circular.js +0 -6
- package/node_modules/object-inspect/example/fn.js +0 -5
- package/node_modules/object-inspect/example/inspect.js +0 -10
- package/node_modules/object-inspect/index.js +0 -544
- package/node_modules/object-inspect/package-support.json +0 -20
- package/node_modules/object-inspect/package.json +0 -105
- package/node_modules/object-inspect/readme.markdown +0 -84
- package/node_modules/object-inspect/test/bigint.js +0 -58
- package/node_modules/object-inspect/test/browser/dom.js +0 -15
- package/node_modules/object-inspect/test/circular.js +0 -16
- package/node_modules/object-inspect/test/deep.js +0 -12
- package/node_modules/object-inspect/test/element.js +0 -53
- package/node_modules/object-inspect/test/err.js +0 -48
- package/node_modules/object-inspect/test/fakes.js +0 -29
- package/node_modules/object-inspect/test/fn.js +0 -76
- package/node_modules/object-inspect/test/global.js +0 -17
- package/node_modules/object-inspect/test/has.js +0 -15
- package/node_modules/object-inspect/test/holes.js +0 -15
- package/node_modules/object-inspect/test/indent-option.js +0 -271
- package/node_modules/object-inspect/test/inspect.js +0 -139
- package/node_modules/object-inspect/test/lowbyte.js +0 -12
- package/node_modules/object-inspect/test/number.js +0 -58
- package/node_modules/object-inspect/test/quoteStyle.js +0 -26
- package/node_modules/object-inspect/test/toStringTag.js +0 -40
- package/node_modules/object-inspect/test/undef.js +0 -12
- package/node_modules/object-inspect/test/values.js +0 -261
- package/node_modules/object-inspect/test-core-js.js +0 -26
- package/node_modules/object-inspect/util.inspect.js +0 -1
- package/node_modules/reggol/LICENSE +0 -21
- package/node_modules/reggol/README.md +0 -8
- package/node_modules/reggol/lib/browser.d.ts +0 -1
- package/node_modules/reggol/lib/browser.js +0 -255
- package/node_modules/reggol/lib/node.d.ts +0 -1
- package/node_modules/reggol/lib/node.js +0 -255
- package/node_modules/reggol/lib/shared.d.ts +0 -78
- package/node_modules/reggol/package.json +0 -61
- package/node_modules/supports-color/browser.d.ts +0 -1
- package/node_modules/supports-color/browser.js +0 -35
- package/node_modules/supports-color/index.d.ts +0 -55
- package/node_modules/supports-color/index.js +0 -202
- package/node_modules/supports-color/license +0 -9
- package/node_modules/supports-color/package.json +0 -64
- package/node_modules/supports-color/readme.md +0 -75
- package/webui/assets/index-CM5wLm3n.css +0 -2
- package/webui/assets/index-DKpc1KFv.js +0 -37
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var inspect = require('../');
|
|
4
|
-
var test = require('tape');
|
|
5
|
-
var mockProperty = require('mock-property');
|
|
6
|
-
var hasSymbols = require('has-symbols/shams')();
|
|
7
|
-
var hasToStringTag = require('has-tostringtag/shams')();
|
|
8
|
-
var forEach = require('for-each');
|
|
9
|
-
var semver = require('semver');
|
|
10
|
-
|
|
11
|
-
test('values', function (t) {
|
|
12
|
-
t.plan(1);
|
|
13
|
-
var obj = [{}, [], { 'a-b': 5 }];
|
|
14
|
-
t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('arrays with properties', function (t) {
|
|
18
|
-
t.plan(1);
|
|
19
|
-
var arr = [3];
|
|
20
|
-
arr.foo = 'bar';
|
|
21
|
-
var obj = [1, 2, arr];
|
|
22
|
-
obj.baz = 'quux';
|
|
23
|
-
obj.index = -1;
|
|
24
|
-
t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('has', function (t) {
|
|
28
|
-
t.plan(1);
|
|
29
|
-
t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true }));
|
|
30
|
-
|
|
31
|
-
t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('indexOf seen', function (t) {
|
|
35
|
-
t.plan(1);
|
|
36
|
-
var xs = [1, 2, 3, {}];
|
|
37
|
-
xs.push(xs);
|
|
38
|
-
|
|
39
|
-
var seen = [];
|
|
40
|
-
seen.indexOf = undefined;
|
|
41
|
-
|
|
42
|
-
t.equal(
|
|
43
|
-
inspect(xs, {}, 0, seen),
|
|
44
|
-
'[ 1, 2, 3, {}, [Circular] ]'
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('seen seen', function (t) {
|
|
49
|
-
t.plan(1);
|
|
50
|
-
var xs = [1, 2, 3];
|
|
51
|
-
|
|
52
|
-
var seen = [xs];
|
|
53
|
-
seen.indexOf = undefined;
|
|
54
|
-
|
|
55
|
-
t.equal(
|
|
56
|
-
inspect(xs, {}, 0, seen),
|
|
57
|
-
'[Circular]'
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('seen seen seen', function (t) {
|
|
62
|
-
t.plan(1);
|
|
63
|
-
var xs = [1, 2, 3];
|
|
64
|
-
|
|
65
|
-
var seen = [5, xs];
|
|
66
|
-
seen.indexOf = undefined;
|
|
67
|
-
|
|
68
|
-
t.equal(
|
|
69
|
-
inspect(xs, {}, 0, seen),
|
|
70
|
-
'[Circular]'
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('symbols', { skip: !hasSymbols }, function (t) {
|
|
75
|
-
var sym = Symbol('foo');
|
|
76
|
-
t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"');
|
|
77
|
-
if (typeof sym === 'symbol') {
|
|
78
|
-
// Symbol shams are incapable of differentiating boxed from unboxed symbols
|
|
79
|
-
t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
t.test('toStringTag', { skip: !hasToStringTag }, function (st) {
|
|
83
|
-
st.plan(1);
|
|
84
|
-
|
|
85
|
-
var faker = {};
|
|
86
|
-
faker[Symbol.toStringTag] = 'Symbol';
|
|
87
|
-
st.equal(
|
|
88
|
-
inspect(faker),
|
|
89
|
-
'{ [Symbol(Symbol.toStringTag)]: \'Symbol\' }',
|
|
90
|
-
'object lying about being a Symbol inspects as an object'
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
t.end();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('Map', { skip: typeof Map !== 'function' }, function (t) {
|
|
98
|
-
var map = new Map();
|
|
99
|
-
map.set({ a: 1 }, ['b']);
|
|
100
|
-
map.set(3, NaN);
|
|
101
|
-
var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}';
|
|
102
|
-
t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents');
|
|
103
|
-
t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty');
|
|
104
|
-
|
|
105
|
-
var nestedMap = new Map();
|
|
106
|
-
nestedMap.set(nestedMap, map);
|
|
107
|
-
t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work');
|
|
108
|
-
|
|
109
|
-
t.end();
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('WeakMap', { skip: typeof WeakMap !== 'function' }, function (t) {
|
|
113
|
-
var map = new WeakMap();
|
|
114
|
-
map.set({ a: 1 }, ['b']);
|
|
115
|
-
var expectedString = 'WeakMap { ? }';
|
|
116
|
-
t.equal(inspect(map), expectedString, 'new WeakMap([[{ a: 1 }, ["b"]]]) should not show size or contents');
|
|
117
|
-
t.equal(inspect(new WeakMap()), 'WeakMap { ? }', 'empty WeakMap should not show as empty');
|
|
118
|
-
|
|
119
|
-
t.end();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test('Set', { skip: typeof Set !== 'function' }, function (t) {
|
|
123
|
-
var set = new Set();
|
|
124
|
-
set.add({ a: 1 });
|
|
125
|
-
set.add(['b']);
|
|
126
|
-
var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}';
|
|
127
|
-
t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents');
|
|
128
|
-
t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty');
|
|
129
|
-
|
|
130
|
-
var nestedSet = new Set();
|
|
131
|
-
nestedSet.add(set);
|
|
132
|
-
nestedSet.add(nestedSet);
|
|
133
|
-
t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work');
|
|
134
|
-
|
|
135
|
-
t.end();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) {
|
|
139
|
-
var map = new WeakSet();
|
|
140
|
-
map.add({ a: 1 });
|
|
141
|
-
var expectedString = 'WeakSet { ? }';
|
|
142
|
-
t.equal(inspect(map), expectedString, 'new WeakSet([{ a: 1 }]) should not show size or contents');
|
|
143
|
-
t.equal(inspect(new WeakSet()), 'WeakSet { ? }', 'empty WeakSet should not show as empty');
|
|
144
|
-
|
|
145
|
-
t.end();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test('WeakRef', { skip: typeof WeakRef !== 'function' }, function (t) {
|
|
149
|
-
var ref = new WeakRef({ a: 1 });
|
|
150
|
-
var expectedString = 'WeakRef { ? }';
|
|
151
|
-
t.equal(inspect(ref), expectedString, 'new WeakRef({ a: 1 }) should not show contents');
|
|
152
|
-
|
|
153
|
-
t.end();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('FinalizationRegistry', { skip: typeof FinalizationRegistry !== 'function' }, function (t) {
|
|
157
|
-
var registry = new FinalizationRegistry(function () {});
|
|
158
|
-
var expectedString = 'FinalizationRegistry [FinalizationRegistry] {}';
|
|
159
|
-
t.equal(inspect(registry), expectedString, 'new FinalizationRegistry(function () {}) should work normallys');
|
|
160
|
-
|
|
161
|
-
t.end();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test('Strings', function (t) {
|
|
165
|
-
var str = 'abc';
|
|
166
|
-
|
|
167
|
-
t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such');
|
|
168
|
-
t.equal(inspect(str, { quoteStyle: 'single' }), "'" + str + "'", 'primitive string shows as such, single quoted');
|
|
169
|
-
t.equal(inspect(str, { quoteStyle: 'double' }), '"' + str + '"', 'primitive string shows as such, double quoted');
|
|
170
|
-
t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such');
|
|
171
|
-
t.equal(inspect(Object(str), { quoteStyle: 'single' }), 'Object(' + inspect(str, { quoteStyle: 'single' }) + ')', 'String object shows as such, single quoted');
|
|
172
|
-
t.equal(inspect(Object(str), { quoteStyle: 'double' }), 'Object(' + inspect(str, { quoteStyle: 'double' }) + ')', 'String object shows as such, double quoted');
|
|
173
|
-
|
|
174
|
-
t.end();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('Numbers', function (t) {
|
|
178
|
-
var num = 42;
|
|
179
|
-
|
|
180
|
-
t.equal(inspect(num), String(num), 'primitive number shows as such');
|
|
181
|
-
t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such');
|
|
182
|
-
|
|
183
|
-
t.end();
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
test('Booleans', function (t) {
|
|
187
|
-
t.equal(inspect(true), String(true), 'primitive true shows as such');
|
|
188
|
-
t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such');
|
|
189
|
-
|
|
190
|
-
t.equal(inspect(false), String(false), 'primitive false shows as such');
|
|
191
|
-
t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such');
|
|
192
|
-
|
|
193
|
-
t.end();
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
test('Date', function (t) {
|
|
197
|
-
var now = new Date();
|
|
198
|
-
t.equal(inspect(now), String(now), 'Date shows properly');
|
|
199
|
-
t.equal(inspect(new Date(NaN)), 'Invalid Date', 'Invalid Date shows properly');
|
|
200
|
-
|
|
201
|
-
t.end();
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('RegExps', function (t) {
|
|
205
|
-
t.equal(inspect(/a/g), '/a/g', 'regex shows properly');
|
|
206
|
-
t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly');
|
|
207
|
-
|
|
208
|
-
var match = 'abc abc'.match(/[ab]+/);
|
|
209
|
-
delete match.groups; // for node < 10
|
|
210
|
-
t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\' ]', 'RegExp match object shows properly');
|
|
211
|
-
|
|
212
|
-
t.end();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, function (t) {
|
|
216
|
-
var target = { proxy: true };
|
|
217
|
-
var fake = new Proxy(target, { has: function () { return false; } });
|
|
218
|
-
|
|
219
|
-
// needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged
|
|
220
|
-
var isNode60 = semver.satisfies(process.version, '6.0 - 6.4');
|
|
221
|
-
|
|
222
|
-
forEach([
|
|
223
|
-
'Boolean',
|
|
224
|
-
'Number',
|
|
225
|
-
'String',
|
|
226
|
-
'Symbol',
|
|
227
|
-
'Date'
|
|
228
|
-
], function (tag) {
|
|
229
|
-
target[Symbol.toStringTag] = tag;
|
|
230
|
-
|
|
231
|
-
t.equal(
|
|
232
|
-
inspect(fake),
|
|
233
|
-
'{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
234
|
-
'Proxy for + ' + tag + ' shows as the target, which has no slots'
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
t.end();
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
test('fakers', { skip: !hasToStringTag }, function (t) {
|
|
242
|
-
var target = { proxy: false };
|
|
243
|
-
|
|
244
|
-
forEach([
|
|
245
|
-
'Boolean',
|
|
246
|
-
'Number',
|
|
247
|
-
'String',
|
|
248
|
-
'Symbol',
|
|
249
|
-
'Date'
|
|
250
|
-
], function (tag) {
|
|
251
|
-
target[Symbol.toStringTag] = tag;
|
|
252
|
-
|
|
253
|
-
t.equal(
|
|
254
|
-
inspect(target),
|
|
255
|
-
'{ proxy: false, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
256
|
-
'Object pretending to be ' + tag + ' does not trick us'
|
|
257
|
-
);
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
t.end();
|
|
261
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('core-js');
|
|
4
|
-
|
|
5
|
-
var inspect = require('./');
|
|
6
|
-
var test = require('tape');
|
|
7
|
-
|
|
8
|
-
test('Maps', function (t) {
|
|
9
|
-
t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}');
|
|
10
|
-
t.end();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('WeakMaps', function (t) {
|
|
14
|
-
t.equal(inspect(new WeakMap([[{}, 2]])), 'WeakMap { ? }');
|
|
15
|
-
t.end();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('Sets', function (t) {
|
|
19
|
-
t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}');
|
|
20
|
-
t.end();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('WeakSets', function (t) {
|
|
24
|
-
t.equal(inspect(new WeakSet([[1, 2]])), 'WeakSet { ? }');
|
|
25
|
-
t.end();
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('util').inspect;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021-present Shigma
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# reggol
|
|
2
|
-
|
|
3
|
-
[](https://codecov.io/gh/shigma/reggol)
|
|
4
|
-
[](https://www.npmjs.com/package/reggol)
|
|
5
|
-
[](https://www.npmjs.com/package/reggol)
|
|
6
|
-
[](https://github.com/shigma/reggol/blob/master/LICENSE)
|
|
7
|
-
|
|
8
|
-
Logger for professionals.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './shared';
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/browser.ts
|
|
5
|
-
import inspect from "object-inspect";
|
|
6
|
-
|
|
7
|
-
// src/shared.ts
|
|
8
|
-
import supportsColor from "supports-color";
|
|
9
|
-
import { Time } from "cosmokit";
|
|
10
|
-
var c16 = [6, 2, 3, 4, 5, 1];
|
|
11
|
-
var c256 = [
|
|
12
|
-
20,
|
|
13
|
-
21,
|
|
14
|
-
26,
|
|
15
|
-
27,
|
|
16
|
-
32,
|
|
17
|
-
33,
|
|
18
|
-
38,
|
|
19
|
-
39,
|
|
20
|
-
40,
|
|
21
|
-
41,
|
|
22
|
-
42,
|
|
23
|
-
43,
|
|
24
|
-
44,
|
|
25
|
-
45,
|
|
26
|
-
56,
|
|
27
|
-
57,
|
|
28
|
-
62,
|
|
29
|
-
63,
|
|
30
|
-
68,
|
|
31
|
-
69,
|
|
32
|
-
74,
|
|
33
|
-
75,
|
|
34
|
-
76,
|
|
35
|
-
77,
|
|
36
|
-
78,
|
|
37
|
-
79,
|
|
38
|
-
80,
|
|
39
|
-
81,
|
|
40
|
-
92,
|
|
41
|
-
93,
|
|
42
|
-
98,
|
|
43
|
-
99,
|
|
44
|
-
112,
|
|
45
|
-
113,
|
|
46
|
-
129,
|
|
47
|
-
134,
|
|
48
|
-
135,
|
|
49
|
-
148,
|
|
50
|
-
149,
|
|
51
|
-
160,
|
|
52
|
-
161,
|
|
53
|
-
162,
|
|
54
|
-
163,
|
|
55
|
-
164,
|
|
56
|
-
165,
|
|
57
|
-
166,
|
|
58
|
-
167,
|
|
59
|
-
168,
|
|
60
|
-
169,
|
|
61
|
-
170,
|
|
62
|
-
171,
|
|
63
|
-
172,
|
|
64
|
-
173,
|
|
65
|
-
178,
|
|
66
|
-
179,
|
|
67
|
-
184,
|
|
68
|
-
185,
|
|
69
|
-
196,
|
|
70
|
-
197,
|
|
71
|
-
198,
|
|
72
|
-
199,
|
|
73
|
-
200,
|
|
74
|
-
201,
|
|
75
|
-
202,
|
|
76
|
-
203,
|
|
77
|
-
204,
|
|
78
|
-
205,
|
|
79
|
-
206,
|
|
80
|
-
207,
|
|
81
|
-
208,
|
|
82
|
-
209,
|
|
83
|
-
214,
|
|
84
|
-
215,
|
|
85
|
-
220,
|
|
86
|
-
221
|
|
87
|
-
];
|
|
88
|
-
function isAggregateError(error) {
|
|
89
|
-
return error instanceof Error && Array.isArray(error["errors"]);
|
|
90
|
-
}
|
|
91
|
-
__name(isAggregateError, "isAggregateError");
|
|
92
|
-
var Level = /* @__PURE__ */ ((Level2) => {
|
|
93
|
-
Level2[Level2["SILENT"] = 0] = "SILENT";
|
|
94
|
-
Level2[Level2["SUCCESS"] = 1] = "SUCCESS";
|
|
95
|
-
Level2[Level2["ERROR"] = 1] = "ERROR";
|
|
96
|
-
Level2[Level2["INFO"] = 2] = "INFO";
|
|
97
|
-
Level2[Level2["WARN"] = 2] = "WARN";
|
|
98
|
-
Level2[Level2["DEBUG"] = 3] = "DEBUG";
|
|
99
|
-
return Level2;
|
|
100
|
-
})(Level || {});
|
|
101
|
-
var Logger = class {
|
|
102
|
-
constructor(options, factory) {
|
|
103
|
-
this.factory = factory;
|
|
104
|
-
Object.assign(this, options);
|
|
105
|
-
this.success = this._method("success", 1 /* SUCCESS */);
|
|
106
|
-
this.error = this._method("error", 1 /* ERROR */);
|
|
107
|
-
this.info = this._method("info", 2 /* INFO */);
|
|
108
|
-
this.warn = this._method("warn", 2 /* WARN */);
|
|
109
|
-
this.debug = this._method("debug", 3 /* DEBUG */);
|
|
110
|
-
}
|
|
111
|
-
static {
|
|
112
|
-
__name(this, "Logger");
|
|
113
|
-
}
|
|
114
|
-
static color(exporter, code, value, decoration = "") {
|
|
115
|
-
if (!exporter.colors) return "" + value;
|
|
116
|
-
return `\x1B[3${code < 8 ? code : "8;5;" + code}${exporter.colors >= 2 ? decoration : ""}m${value}\x1B[0m`;
|
|
117
|
-
}
|
|
118
|
-
static code(name, level) {
|
|
119
|
-
let hash = 0;
|
|
120
|
-
for (let i = 0; i < name.length; i++) {
|
|
121
|
-
hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
|
|
122
|
-
hash |= 0;
|
|
123
|
-
}
|
|
124
|
-
const colors = !level ? [] : level >= 2 ? c256 : c16;
|
|
125
|
-
return colors[Math.abs(hash) % colors.length];
|
|
126
|
-
}
|
|
127
|
-
_method(type, level) {
|
|
128
|
-
return (...args) => {
|
|
129
|
-
if (args.length === 1 && args[0] instanceof Error) {
|
|
130
|
-
if (args[0].cause) {
|
|
131
|
-
this[type](args[0].cause);
|
|
132
|
-
} else if (isAggregateError(args[0])) {
|
|
133
|
-
args[0].errors.forEach((error) => this[type](error));
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const sn = ++this.factory._snMessage;
|
|
138
|
-
const ts = Date.now();
|
|
139
|
-
for (const exporter of this.factory.exporters.values()) {
|
|
140
|
-
const targetLevel = exporter.levels?.[this.name] ?? exporter.levels?.default ?? this.level ?? 2 /* INFO */;
|
|
141
|
-
if (targetLevel < level) continue;
|
|
142
|
-
const body = this._format(exporter, args.slice());
|
|
143
|
-
const message = { sn, ts, type, level, name: this.name, ...this.meta, body };
|
|
144
|
-
exporter.export(message);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
_format(exporter, args) {
|
|
149
|
-
if (args[0] instanceof Error) {
|
|
150
|
-
args[0] = args[0].stack || args[0].message;
|
|
151
|
-
args.unshift("%s");
|
|
152
|
-
} else if (typeof args[0] !== "string") {
|
|
153
|
-
args.unshift("%o");
|
|
154
|
-
}
|
|
155
|
-
let format = args.shift();
|
|
156
|
-
format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
|
|
157
|
-
if (match === "%%") return "%";
|
|
158
|
-
const formatter = this.factory.formatters[char];
|
|
159
|
-
if (typeof formatter === "function") {
|
|
160
|
-
const value = args.shift();
|
|
161
|
-
return formatter(value, exporter, this);
|
|
162
|
-
}
|
|
163
|
-
return match;
|
|
164
|
-
});
|
|
165
|
-
for (let arg of args) {
|
|
166
|
-
if (typeof arg === "object" && arg) {
|
|
167
|
-
arg = this.factory.formatters["o"](arg, exporter, this);
|
|
168
|
-
}
|
|
169
|
-
format += " " + arg;
|
|
170
|
-
}
|
|
171
|
-
const { maxLength = 10240 } = exporter;
|
|
172
|
-
return format.split(/\r?\n/g).map((line) => {
|
|
173
|
-
return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
|
|
174
|
-
}).join("\n");
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
var Factory = class _Factory {
|
|
178
|
-
static {
|
|
179
|
-
__name(this, "Factory");
|
|
180
|
-
}
|
|
181
|
-
static formatters = {
|
|
182
|
-
s: /* @__PURE__ */ __name((value) => value, "s"),
|
|
183
|
-
j: /* @__PURE__ */ __name((value) => JSON.stringify(value), "j"),
|
|
184
|
-
c: /* @__PURE__ */ __name((value, exporter, logger) => {
|
|
185
|
-
return Logger.color(exporter, Logger.code(logger.name, exporter.colors), value);
|
|
186
|
-
}, "c")
|
|
187
|
-
};
|
|
188
|
-
_snMessage = 0;
|
|
189
|
-
_snExporter = 0;
|
|
190
|
-
exporters = /* @__PURE__ */ new Map();
|
|
191
|
-
formatters = Object.create(_Factory.formatters);
|
|
192
|
-
createLogger(name, options = {}) {
|
|
193
|
-
return new Logger({ name, ...options }, this);
|
|
194
|
-
}
|
|
195
|
-
addExporter(exporter) {
|
|
196
|
-
this.exporters.set(++this._snExporter, exporter);
|
|
197
|
-
return () => this.exporters.delete(this._snExporter);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
var Exporter;
|
|
201
|
-
((Exporter2) => {
|
|
202
|
-
class Console {
|
|
203
|
-
static {
|
|
204
|
-
__name(this, "Console");
|
|
205
|
-
}
|
|
206
|
-
constructor(options) {
|
|
207
|
-
Object.assign(this, {
|
|
208
|
-
colors: supportsColor.stdout ? supportsColor.stdout.level : 0,
|
|
209
|
-
showTime: "yyyy-MM-dd hh:mm:ss ",
|
|
210
|
-
showDiff: false,
|
|
211
|
-
...options
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
export(message) {
|
|
215
|
-
console.log(this.render(message));
|
|
216
|
-
}
|
|
217
|
-
render(message) {
|
|
218
|
-
const prefix = `[${message.type[0].toUpperCase()}]`;
|
|
219
|
-
const space = " ".repeat(this.label?.margin ?? 1);
|
|
220
|
-
let indent = 3 + space.length, output = "";
|
|
221
|
-
if (this.showTime) {
|
|
222
|
-
indent += this.showTime.length;
|
|
223
|
-
output += Logger.color(this, 8, Time.template(this.showTime));
|
|
224
|
-
}
|
|
225
|
-
const code = Logger.code(message.name, this.colors);
|
|
226
|
-
const label = Logger.color(this, code, message.name, ";1");
|
|
227
|
-
const padLength = (this.label?.width ?? 0) + label.length - message.name.length;
|
|
228
|
-
if (this.label?.align === "right") {
|
|
229
|
-
output += label.padStart(padLength) + space + prefix + space;
|
|
230
|
-
indent += (this.label.width ?? 0) + space.length;
|
|
231
|
-
} else {
|
|
232
|
-
output += prefix + space + label.padEnd(padLength) + space;
|
|
233
|
-
}
|
|
234
|
-
output += message.body.replace(/\n/g, "\n" + " ".repeat(indent));
|
|
235
|
-
if (this.showDiff && this.timestamp) {
|
|
236
|
-
const diff = message.ts - this.timestamp;
|
|
237
|
-
output += Logger.color(this, code, " +" + Time.format(diff));
|
|
238
|
-
}
|
|
239
|
-
this.timestamp = message.ts;
|
|
240
|
-
return output;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
Exporter2.Console = Console;
|
|
244
|
-
})(Exporter || (Exporter = {}));
|
|
245
|
-
|
|
246
|
-
// src/browser.ts
|
|
247
|
-
Factory.formatters["o"] = (value, target) => {
|
|
248
|
-
return inspect(value, { depth: Infinity });
|
|
249
|
-
};
|
|
250
|
-
export {
|
|
251
|
-
Exporter,
|
|
252
|
-
Factory,
|
|
253
|
-
Level,
|
|
254
|
-
Logger
|
|
255
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './shared';
|