@getcronit/pylon 1.2.0-beta.2 → 1.2.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/dist/index.js +5 -2876
- package/dist/index.js.map +3 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2875 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
-
|
|
20
|
-
// ../../node_modules/safe-buffer/index.js
|
|
21
|
-
var require_safe_buffer = __commonJS((exports, module) => {
|
|
22
|
-
var copyProps = function(src, dst) {
|
|
23
|
-
for (var key in src) {
|
|
24
|
-
dst[key] = src[key];
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var SafeBuffer = function(arg, encodingOrOffset, length) {
|
|
28
|
-
return Buffer(arg, encodingOrOffset, length);
|
|
29
|
-
};
|
|
30
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
31
|
-
var buffer = import.meta.require("buffer");
|
|
32
|
-
var Buffer = buffer.Buffer;
|
|
33
|
-
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
34
|
-
module.exports = buffer;
|
|
35
|
-
} else {
|
|
36
|
-
copyProps(buffer, exports);
|
|
37
|
-
exports.Buffer = SafeBuffer;
|
|
38
|
-
}
|
|
39
|
-
SafeBuffer.prototype = Object.create(Buffer.prototype);
|
|
40
|
-
copyProps(Buffer, SafeBuffer);
|
|
41
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
42
|
-
if (typeof arg === "number") {
|
|
43
|
-
throw new TypeError("Argument must not be a number");
|
|
44
|
-
}
|
|
45
|
-
return Buffer(arg, encodingOrOffset, length);
|
|
46
|
-
};
|
|
47
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
48
|
-
if (typeof size !== "number") {
|
|
49
|
-
throw new TypeError("Argument must be a number");
|
|
50
|
-
}
|
|
51
|
-
var buf = Buffer(size);
|
|
52
|
-
if (fill !== undefined) {
|
|
53
|
-
if (typeof encoding === "string") {
|
|
54
|
-
buf.fill(fill, encoding);
|
|
55
|
-
} else {
|
|
56
|
-
buf.fill(fill);
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
buf.fill(0);
|
|
60
|
-
}
|
|
61
|
-
return buf;
|
|
62
|
-
};
|
|
63
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
64
|
-
if (typeof size !== "number") {
|
|
65
|
-
throw new TypeError("Argument must be a number");
|
|
66
|
-
}
|
|
67
|
-
return Buffer(size);
|
|
68
|
-
};
|
|
69
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
70
|
-
if (typeof size !== "number") {
|
|
71
|
-
throw new TypeError("Argument must be a number");
|
|
72
|
-
}
|
|
73
|
-
return buffer.SlowBuffer(size);
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// ../../node_modules/string_decoder/lib/string_decoder.js
|
|
78
|
-
var require_string_decoder = __commonJS((exports) => {
|
|
79
|
-
var _normalizeEncoding = function(enc) {
|
|
80
|
-
if (!enc)
|
|
81
|
-
return "utf8";
|
|
82
|
-
var retried;
|
|
83
|
-
while (true) {
|
|
84
|
-
switch (enc) {
|
|
85
|
-
case "utf8":
|
|
86
|
-
case "utf-8":
|
|
87
|
-
return "utf8";
|
|
88
|
-
case "ucs2":
|
|
89
|
-
case "ucs-2":
|
|
90
|
-
case "utf16le":
|
|
91
|
-
case "utf-16le":
|
|
92
|
-
return "utf16le";
|
|
93
|
-
case "latin1":
|
|
94
|
-
case "binary":
|
|
95
|
-
return "latin1";
|
|
96
|
-
case "base64":
|
|
97
|
-
case "ascii":
|
|
98
|
-
case "hex":
|
|
99
|
-
return enc;
|
|
100
|
-
default:
|
|
101
|
-
if (retried)
|
|
102
|
-
return;
|
|
103
|
-
enc = ("" + enc).toLowerCase();
|
|
104
|
-
retried = true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
var normalizeEncoding = function(enc) {
|
|
109
|
-
var nenc = _normalizeEncoding(enc);
|
|
110
|
-
if (typeof nenc !== "string" && (Buffer.isEncoding === isEncoding || !isEncoding(enc)))
|
|
111
|
-
throw new Error("Unknown encoding: " + enc);
|
|
112
|
-
return nenc || enc;
|
|
113
|
-
};
|
|
114
|
-
var StringDecoder = function(encoding) {
|
|
115
|
-
this.encoding = normalizeEncoding(encoding);
|
|
116
|
-
var nb;
|
|
117
|
-
switch (this.encoding) {
|
|
118
|
-
case "utf16le":
|
|
119
|
-
this.text = utf16Text;
|
|
120
|
-
this.end = utf16End;
|
|
121
|
-
nb = 4;
|
|
122
|
-
break;
|
|
123
|
-
case "utf8":
|
|
124
|
-
this.fillLast = utf8FillLast;
|
|
125
|
-
nb = 4;
|
|
126
|
-
break;
|
|
127
|
-
case "base64":
|
|
128
|
-
this.text = base64Text;
|
|
129
|
-
this.end = base64End;
|
|
130
|
-
nb = 3;
|
|
131
|
-
break;
|
|
132
|
-
default:
|
|
133
|
-
this.write = simpleWrite;
|
|
134
|
-
this.end = simpleEnd;
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
this.lastNeed = 0;
|
|
138
|
-
this.lastTotal = 0;
|
|
139
|
-
this.lastChar = Buffer.allocUnsafe(nb);
|
|
140
|
-
};
|
|
141
|
-
var utf8CheckByte = function(byte) {
|
|
142
|
-
if (byte <= 127)
|
|
143
|
-
return 0;
|
|
144
|
-
else if (byte >> 5 === 6)
|
|
145
|
-
return 2;
|
|
146
|
-
else if (byte >> 4 === 14)
|
|
147
|
-
return 3;
|
|
148
|
-
else if (byte >> 3 === 30)
|
|
149
|
-
return 4;
|
|
150
|
-
return byte >> 6 === 2 ? -1 : -2;
|
|
151
|
-
};
|
|
152
|
-
var utf8CheckIncomplete = function(self2, buf, i) {
|
|
153
|
-
var j = buf.length - 1;
|
|
154
|
-
if (j < i)
|
|
155
|
-
return 0;
|
|
156
|
-
var nb = utf8CheckByte(buf[j]);
|
|
157
|
-
if (nb >= 0) {
|
|
158
|
-
if (nb > 0)
|
|
159
|
-
self2.lastNeed = nb - 1;
|
|
160
|
-
return nb;
|
|
161
|
-
}
|
|
162
|
-
if (--j < i || nb === -2)
|
|
163
|
-
return 0;
|
|
164
|
-
nb = utf8CheckByte(buf[j]);
|
|
165
|
-
if (nb >= 0) {
|
|
166
|
-
if (nb > 0)
|
|
167
|
-
self2.lastNeed = nb - 2;
|
|
168
|
-
return nb;
|
|
169
|
-
}
|
|
170
|
-
if (--j < i || nb === -2)
|
|
171
|
-
return 0;
|
|
172
|
-
nb = utf8CheckByte(buf[j]);
|
|
173
|
-
if (nb >= 0) {
|
|
174
|
-
if (nb > 0) {
|
|
175
|
-
if (nb === 2)
|
|
176
|
-
nb = 0;
|
|
177
|
-
else
|
|
178
|
-
self2.lastNeed = nb - 3;
|
|
179
|
-
}
|
|
180
|
-
return nb;
|
|
181
|
-
}
|
|
182
|
-
return 0;
|
|
183
|
-
};
|
|
184
|
-
var utf8CheckExtraBytes = function(self2, buf, p) {
|
|
185
|
-
if ((buf[0] & 192) !== 128) {
|
|
186
|
-
self2.lastNeed = 0;
|
|
187
|
-
return "\uFFFD";
|
|
188
|
-
}
|
|
189
|
-
if (self2.lastNeed > 1 && buf.length > 1) {
|
|
190
|
-
if ((buf[1] & 192) !== 128) {
|
|
191
|
-
self2.lastNeed = 1;
|
|
192
|
-
return "\uFFFD";
|
|
193
|
-
}
|
|
194
|
-
if (self2.lastNeed > 2 && buf.length > 2) {
|
|
195
|
-
if ((buf[2] & 192) !== 128) {
|
|
196
|
-
self2.lastNeed = 2;
|
|
197
|
-
return "\uFFFD";
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var utf8FillLast = function(buf) {
|
|
203
|
-
var p = this.lastTotal - this.lastNeed;
|
|
204
|
-
var r = utf8CheckExtraBytes(this, buf, p);
|
|
205
|
-
if (r !== undefined)
|
|
206
|
-
return r;
|
|
207
|
-
if (this.lastNeed <= buf.length) {
|
|
208
|
-
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
|
209
|
-
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
210
|
-
}
|
|
211
|
-
buf.copy(this.lastChar, p, 0, buf.length);
|
|
212
|
-
this.lastNeed -= buf.length;
|
|
213
|
-
};
|
|
214
|
-
var utf8Text = function(buf, i) {
|
|
215
|
-
var total = utf8CheckIncomplete(this, buf, i);
|
|
216
|
-
if (!this.lastNeed)
|
|
217
|
-
return buf.toString("utf8", i);
|
|
218
|
-
this.lastTotal = total;
|
|
219
|
-
var end = buf.length - (total - this.lastNeed);
|
|
220
|
-
buf.copy(this.lastChar, 0, end);
|
|
221
|
-
return buf.toString("utf8", i, end);
|
|
222
|
-
};
|
|
223
|
-
var utf8End = function(buf) {
|
|
224
|
-
var r = buf && buf.length ? this.write(buf) : "";
|
|
225
|
-
if (this.lastNeed)
|
|
226
|
-
return r + "\uFFFD";
|
|
227
|
-
return r;
|
|
228
|
-
};
|
|
229
|
-
var utf16Text = function(buf, i) {
|
|
230
|
-
if ((buf.length - i) % 2 === 0) {
|
|
231
|
-
var r = buf.toString("utf16le", i);
|
|
232
|
-
if (r) {
|
|
233
|
-
var c = r.charCodeAt(r.length - 1);
|
|
234
|
-
if (c >= 55296 && c <= 56319) {
|
|
235
|
-
this.lastNeed = 2;
|
|
236
|
-
this.lastTotal = 4;
|
|
237
|
-
this.lastChar[0] = buf[buf.length - 2];
|
|
238
|
-
this.lastChar[1] = buf[buf.length - 1];
|
|
239
|
-
return r.slice(0, -1);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return r;
|
|
243
|
-
}
|
|
244
|
-
this.lastNeed = 1;
|
|
245
|
-
this.lastTotal = 2;
|
|
246
|
-
this.lastChar[0] = buf[buf.length - 1];
|
|
247
|
-
return buf.toString("utf16le", i, buf.length - 1);
|
|
248
|
-
};
|
|
249
|
-
var utf16End = function(buf) {
|
|
250
|
-
var r = buf && buf.length ? this.write(buf) : "";
|
|
251
|
-
if (this.lastNeed) {
|
|
252
|
-
var end = this.lastTotal - this.lastNeed;
|
|
253
|
-
return r + this.lastChar.toString("utf16le", 0, end);
|
|
254
|
-
}
|
|
255
|
-
return r;
|
|
256
|
-
};
|
|
257
|
-
var base64Text = function(buf, i) {
|
|
258
|
-
var n = (buf.length - i) % 3;
|
|
259
|
-
if (n === 0)
|
|
260
|
-
return buf.toString("base64", i);
|
|
261
|
-
this.lastNeed = 3 - n;
|
|
262
|
-
this.lastTotal = 3;
|
|
263
|
-
if (n === 1) {
|
|
264
|
-
this.lastChar[0] = buf[buf.length - 1];
|
|
265
|
-
} else {
|
|
266
|
-
this.lastChar[0] = buf[buf.length - 2];
|
|
267
|
-
this.lastChar[1] = buf[buf.length - 1];
|
|
268
|
-
}
|
|
269
|
-
return buf.toString("base64", i, buf.length - n);
|
|
270
|
-
};
|
|
271
|
-
var base64End = function(buf) {
|
|
272
|
-
var r = buf && buf.length ? this.write(buf) : "";
|
|
273
|
-
if (this.lastNeed)
|
|
274
|
-
return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
|
|
275
|
-
return r;
|
|
276
|
-
};
|
|
277
|
-
var simpleWrite = function(buf) {
|
|
278
|
-
return buf.toString(this.encoding);
|
|
279
|
-
};
|
|
280
|
-
var simpleEnd = function(buf) {
|
|
281
|
-
return buf && buf.length ? this.write(buf) : "";
|
|
282
|
-
};
|
|
283
|
-
var Buffer = require_safe_buffer().Buffer;
|
|
284
|
-
var isEncoding = Buffer.isEncoding || function(encoding) {
|
|
285
|
-
encoding = "" + encoding;
|
|
286
|
-
switch (encoding && encoding.toLowerCase()) {
|
|
287
|
-
case "hex":
|
|
288
|
-
case "utf8":
|
|
289
|
-
case "utf-8":
|
|
290
|
-
case "ascii":
|
|
291
|
-
case "binary":
|
|
292
|
-
case "base64":
|
|
293
|
-
case "ucs2":
|
|
294
|
-
case "ucs-2":
|
|
295
|
-
case "utf16le":
|
|
296
|
-
case "utf-16le":
|
|
297
|
-
case "raw":
|
|
298
|
-
return true;
|
|
299
|
-
default:
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
exports.StringDecoder = StringDecoder;
|
|
304
|
-
StringDecoder.prototype.write = function(buf) {
|
|
305
|
-
if (buf.length === 0)
|
|
306
|
-
return "";
|
|
307
|
-
var r;
|
|
308
|
-
var i;
|
|
309
|
-
if (this.lastNeed) {
|
|
310
|
-
r = this.fillLast(buf);
|
|
311
|
-
if (r === undefined)
|
|
312
|
-
return "";
|
|
313
|
-
i = this.lastNeed;
|
|
314
|
-
this.lastNeed = 0;
|
|
315
|
-
} else {
|
|
316
|
-
i = 0;
|
|
317
|
-
}
|
|
318
|
-
if (i < buf.length)
|
|
319
|
-
return r ? r + this.text(buf, i) : this.text(buf, i);
|
|
320
|
-
return r || "";
|
|
321
|
-
};
|
|
322
|
-
StringDecoder.prototype.end = utf8End;
|
|
323
|
-
StringDecoder.prototype.text = utf8Text;
|
|
324
|
-
StringDecoder.prototype.fillLast = function(buf) {
|
|
325
|
-
if (this.lastNeed <= buf.length) {
|
|
326
|
-
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
|
327
|
-
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
328
|
-
}
|
|
329
|
-
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
|
330
|
-
this.lastNeed -= buf.length;
|
|
331
|
-
};
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// ../../node_modules/readable-stream/lib/internal/streams/buffer_list.js
|
|
335
|
-
var require_buffer_list = __commonJS((exports, module) => {
|
|
336
|
-
var ownKeys = function(object, enumerableOnly) {
|
|
337
|
-
var keys = Object.keys(object);
|
|
338
|
-
if (Object.getOwnPropertySymbols) {
|
|
339
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
340
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
341
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
342
|
-
})), keys.push.apply(keys, symbols);
|
|
343
|
-
}
|
|
344
|
-
return keys;
|
|
345
|
-
};
|
|
346
|
-
var _objectSpread = function(target) {
|
|
347
|
-
for (var i = 1;i < arguments.length; i++) {
|
|
348
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
349
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
350
|
-
_defineProperty(target, key, source[key]);
|
|
351
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
352
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return target;
|
|
356
|
-
};
|
|
357
|
-
var _defineProperty = function(obj, key, value) {
|
|
358
|
-
key = _toPropertyKey(key);
|
|
359
|
-
if (key in obj) {
|
|
360
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
361
|
-
} else {
|
|
362
|
-
obj[key] = value;
|
|
363
|
-
}
|
|
364
|
-
return obj;
|
|
365
|
-
};
|
|
366
|
-
var _classCallCheck = function(instance, Constructor) {
|
|
367
|
-
if (!(instance instanceof Constructor)) {
|
|
368
|
-
throw new TypeError("Cannot call a class as a function");
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
var _defineProperties = function(target, props) {
|
|
372
|
-
for (var i = 0;i < props.length; i++) {
|
|
373
|
-
var descriptor = props[i];
|
|
374
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
375
|
-
descriptor.configurable = true;
|
|
376
|
-
if ("value" in descriptor)
|
|
377
|
-
descriptor.writable = true;
|
|
378
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
var _createClass = function(Constructor, protoProps, staticProps) {
|
|
382
|
-
if (protoProps)
|
|
383
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
384
|
-
if (staticProps)
|
|
385
|
-
_defineProperties(Constructor, staticProps);
|
|
386
|
-
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
387
|
-
return Constructor;
|
|
388
|
-
};
|
|
389
|
-
var _toPropertyKey = function(arg) {
|
|
390
|
-
var key = _toPrimitive(arg, "string");
|
|
391
|
-
return typeof key === "symbol" ? key : String(key);
|
|
392
|
-
};
|
|
393
|
-
var _toPrimitive = function(input, hint) {
|
|
394
|
-
if (typeof input !== "object" || input === null)
|
|
395
|
-
return input;
|
|
396
|
-
var prim = input[Symbol.toPrimitive];
|
|
397
|
-
if (prim !== undefined) {
|
|
398
|
-
var res = prim.call(input, hint || "default");
|
|
399
|
-
if (typeof res !== "object")
|
|
400
|
-
return res;
|
|
401
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
402
|
-
}
|
|
403
|
-
return (hint === "string" ? String : Number)(input);
|
|
404
|
-
};
|
|
405
|
-
var copyBuffer = function(src, target, offset) {
|
|
406
|
-
Buffer.prototype.copy.call(src, target, offset);
|
|
407
|
-
};
|
|
408
|
-
var _require = import.meta.require("buffer");
|
|
409
|
-
var Buffer = _require.Buffer;
|
|
410
|
-
var _require2 = import.meta.require("util");
|
|
411
|
-
var inspect = _require2.inspect;
|
|
412
|
-
var custom = inspect && inspect.custom || "inspect";
|
|
413
|
-
module.exports = function() {
|
|
414
|
-
function BufferList() {
|
|
415
|
-
_classCallCheck(this, BufferList);
|
|
416
|
-
this.head = null;
|
|
417
|
-
this.tail = null;
|
|
418
|
-
this.length = 0;
|
|
419
|
-
}
|
|
420
|
-
_createClass(BufferList, [{
|
|
421
|
-
key: "push",
|
|
422
|
-
value: function push(v) {
|
|
423
|
-
var entry = {
|
|
424
|
-
data: v,
|
|
425
|
-
next: null
|
|
426
|
-
};
|
|
427
|
-
if (this.length > 0)
|
|
428
|
-
this.tail.next = entry;
|
|
429
|
-
else
|
|
430
|
-
this.head = entry;
|
|
431
|
-
this.tail = entry;
|
|
432
|
-
++this.length;
|
|
433
|
-
}
|
|
434
|
-
}, {
|
|
435
|
-
key: "unshift",
|
|
436
|
-
value: function unshift(v) {
|
|
437
|
-
var entry = {
|
|
438
|
-
data: v,
|
|
439
|
-
next: this.head
|
|
440
|
-
};
|
|
441
|
-
if (this.length === 0)
|
|
442
|
-
this.tail = entry;
|
|
443
|
-
this.head = entry;
|
|
444
|
-
++this.length;
|
|
445
|
-
}
|
|
446
|
-
}, {
|
|
447
|
-
key: "shift",
|
|
448
|
-
value: function shift() {
|
|
449
|
-
if (this.length === 0)
|
|
450
|
-
return;
|
|
451
|
-
var ret = this.head.data;
|
|
452
|
-
if (this.length === 1)
|
|
453
|
-
this.head = this.tail = null;
|
|
454
|
-
else
|
|
455
|
-
this.head = this.head.next;
|
|
456
|
-
--this.length;
|
|
457
|
-
return ret;
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "clear",
|
|
461
|
-
value: function clear() {
|
|
462
|
-
this.head = this.tail = null;
|
|
463
|
-
this.length = 0;
|
|
464
|
-
}
|
|
465
|
-
}, {
|
|
466
|
-
key: "join",
|
|
467
|
-
value: function join(s) {
|
|
468
|
-
if (this.length === 0)
|
|
469
|
-
return "";
|
|
470
|
-
var p = this.head;
|
|
471
|
-
var ret = "" + p.data;
|
|
472
|
-
while (p = p.next)
|
|
473
|
-
ret += s + p.data;
|
|
474
|
-
return ret;
|
|
475
|
-
}
|
|
476
|
-
}, {
|
|
477
|
-
key: "concat",
|
|
478
|
-
value: function concat(n) {
|
|
479
|
-
if (this.length === 0)
|
|
480
|
-
return Buffer.alloc(0);
|
|
481
|
-
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
482
|
-
var p = this.head;
|
|
483
|
-
var i = 0;
|
|
484
|
-
while (p) {
|
|
485
|
-
copyBuffer(p.data, ret, i);
|
|
486
|
-
i += p.data.length;
|
|
487
|
-
p = p.next;
|
|
488
|
-
}
|
|
489
|
-
return ret;
|
|
490
|
-
}
|
|
491
|
-
}, {
|
|
492
|
-
key: "consume",
|
|
493
|
-
value: function consume(n, hasStrings) {
|
|
494
|
-
var ret;
|
|
495
|
-
if (n < this.head.data.length) {
|
|
496
|
-
ret = this.head.data.slice(0, n);
|
|
497
|
-
this.head.data = this.head.data.slice(n);
|
|
498
|
-
} else if (n === this.head.data.length) {
|
|
499
|
-
ret = this.shift();
|
|
500
|
-
} else {
|
|
501
|
-
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
|
|
502
|
-
}
|
|
503
|
-
return ret;
|
|
504
|
-
}
|
|
505
|
-
}, {
|
|
506
|
-
key: "first",
|
|
507
|
-
value: function first() {
|
|
508
|
-
return this.head.data;
|
|
509
|
-
}
|
|
510
|
-
}, {
|
|
511
|
-
key: "_getString",
|
|
512
|
-
value: function _getString(n) {
|
|
513
|
-
var p = this.head;
|
|
514
|
-
var c = 1;
|
|
515
|
-
var ret = p.data;
|
|
516
|
-
n -= ret.length;
|
|
517
|
-
while (p = p.next) {
|
|
518
|
-
var str = p.data;
|
|
519
|
-
var nb = n > str.length ? str.length : n;
|
|
520
|
-
if (nb === str.length)
|
|
521
|
-
ret += str;
|
|
522
|
-
else
|
|
523
|
-
ret += str.slice(0, n);
|
|
524
|
-
n -= nb;
|
|
525
|
-
if (n === 0) {
|
|
526
|
-
if (nb === str.length) {
|
|
527
|
-
++c;
|
|
528
|
-
if (p.next)
|
|
529
|
-
this.head = p.next;
|
|
530
|
-
else
|
|
531
|
-
this.head = this.tail = null;
|
|
532
|
-
} else {
|
|
533
|
-
this.head = p;
|
|
534
|
-
p.data = str.slice(nb);
|
|
535
|
-
}
|
|
536
|
-
break;
|
|
537
|
-
}
|
|
538
|
-
++c;
|
|
539
|
-
}
|
|
540
|
-
this.length -= c;
|
|
541
|
-
return ret;
|
|
542
|
-
}
|
|
543
|
-
}, {
|
|
544
|
-
key: "_getBuffer",
|
|
545
|
-
value: function _getBuffer(n) {
|
|
546
|
-
var ret = Buffer.allocUnsafe(n);
|
|
547
|
-
var p = this.head;
|
|
548
|
-
var c = 1;
|
|
549
|
-
p.data.copy(ret);
|
|
550
|
-
n -= p.data.length;
|
|
551
|
-
while (p = p.next) {
|
|
552
|
-
var buf = p.data;
|
|
553
|
-
var nb = n > buf.length ? buf.length : n;
|
|
554
|
-
buf.copy(ret, ret.length - n, 0, nb);
|
|
555
|
-
n -= nb;
|
|
556
|
-
if (n === 0) {
|
|
557
|
-
if (nb === buf.length) {
|
|
558
|
-
++c;
|
|
559
|
-
if (p.next)
|
|
560
|
-
this.head = p.next;
|
|
561
|
-
else
|
|
562
|
-
this.head = this.tail = null;
|
|
563
|
-
} else {
|
|
564
|
-
this.head = p;
|
|
565
|
-
p.data = buf.slice(nb);
|
|
566
|
-
}
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
++c;
|
|
570
|
-
}
|
|
571
|
-
this.length -= c;
|
|
572
|
-
return ret;
|
|
573
|
-
}
|
|
574
|
-
}, {
|
|
575
|
-
key: custom,
|
|
576
|
-
value: function value(_, options) {
|
|
577
|
-
return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
|
|
578
|
-
depth: 0,
|
|
579
|
-
customInspect: false
|
|
580
|
-
}));
|
|
581
|
-
}
|
|
582
|
-
}]);
|
|
583
|
-
return BufferList;
|
|
584
|
-
}();
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
// ../../node_modules/readable-stream/lib/internal/streams/destroy.js
|
|
588
|
-
var require_destroy = __commonJS((exports, module) => {
|
|
589
|
-
var destroy = function(err, cb) {
|
|
590
|
-
var _this = this;
|
|
591
|
-
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
|
592
|
-
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
|
593
|
-
if (readableDestroyed || writableDestroyed) {
|
|
594
|
-
if (cb) {
|
|
595
|
-
cb(err);
|
|
596
|
-
} else if (err) {
|
|
597
|
-
if (!this._writableState) {
|
|
598
|
-
process.nextTick(emitErrorNT, this, err);
|
|
599
|
-
} else if (!this._writableState.errorEmitted) {
|
|
600
|
-
this._writableState.errorEmitted = true;
|
|
601
|
-
process.nextTick(emitErrorNT, this, err);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
return this;
|
|
605
|
-
}
|
|
606
|
-
if (this._readableState) {
|
|
607
|
-
this._readableState.destroyed = true;
|
|
608
|
-
}
|
|
609
|
-
if (this._writableState) {
|
|
610
|
-
this._writableState.destroyed = true;
|
|
611
|
-
}
|
|
612
|
-
this._destroy(err || null, function(err2) {
|
|
613
|
-
if (!cb && err2) {
|
|
614
|
-
if (!_this._writableState) {
|
|
615
|
-
process.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
616
|
-
} else if (!_this._writableState.errorEmitted) {
|
|
617
|
-
_this._writableState.errorEmitted = true;
|
|
618
|
-
process.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
619
|
-
} else {
|
|
620
|
-
process.nextTick(emitCloseNT, _this);
|
|
621
|
-
}
|
|
622
|
-
} else if (cb) {
|
|
623
|
-
process.nextTick(emitCloseNT, _this);
|
|
624
|
-
cb(err2);
|
|
625
|
-
} else {
|
|
626
|
-
process.nextTick(emitCloseNT, _this);
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
return this;
|
|
630
|
-
};
|
|
631
|
-
var emitErrorAndCloseNT = function(self2, err) {
|
|
632
|
-
emitErrorNT(self2, err);
|
|
633
|
-
emitCloseNT(self2);
|
|
634
|
-
};
|
|
635
|
-
var emitCloseNT = function(self2) {
|
|
636
|
-
if (self2._writableState && !self2._writableState.emitClose)
|
|
637
|
-
return;
|
|
638
|
-
if (self2._readableState && !self2._readableState.emitClose)
|
|
639
|
-
return;
|
|
640
|
-
self2.emit("close");
|
|
641
|
-
};
|
|
642
|
-
var undestroy = function() {
|
|
643
|
-
if (this._readableState) {
|
|
644
|
-
this._readableState.destroyed = false;
|
|
645
|
-
this._readableState.reading = false;
|
|
646
|
-
this._readableState.ended = false;
|
|
647
|
-
this._readableState.endEmitted = false;
|
|
648
|
-
}
|
|
649
|
-
if (this._writableState) {
|
|
650
|
-
this._writableState.destroyed = false;
|
|
651
|
-
this._writableState.ended = false;
|
|
652
|
-
this._writableState.ending = false;
|
|
653
|
-
this._writableState.finalCalled = false;
|
|
654
|
-
this._writableState.prefinished = false;
|
|
655
|
-
this._writableState.finished = false;
|
|
656
|
-
this._writableState.errorEmitted = false;
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
var emitErrorNT = function(self2, err) {
|
|
660
|
-
self2.emit("error", err);
|
|
661
|
-
};
|
|
662
|
-
var errorOrDestroy = function(stream, err) {
|
|
663
|
-
var rState = stream._readableState;
|
|
664
|
-
var wState = stream._writableState;
|
|
665
|
-
if (rState && rState.autoDestroy || wState && wState.autoDestroy)
|
|
666
|
-
stream.destroy(err);
|
|
667
|
-
else
|
|
668
|
-
stream.emit("error", err);
|
|
669
|
-
};
|
|
670
|
-
module.exports = {
|
|
671
|
-
destroy,
|
|
672
|
-
undestroy,
|
|
673
|
-
errorOrDestroy
|
|
674
|
-
};
|
|
675
|
-
});
|
|
676
|
-
|
|
677
|
-
// ../../node_modules/readable-stream/errors.js
|
|
678
|
-
var require_errors = __commonJS((exports, module) => {
|
|
679
|
-
var createErrorType = function(code, message, Base) {
|
|
680
|
-
if (!Base) {
|
|
681
|
-
Base = Error;
|
|
682
|
-
}
|
|
683
|
-
function getMessage(arg1, arg2, arg3) {
|
|
684
|
-
if (typeof message === "string") {
|
|
685
|
-
return message;
|
|
686
|
-
} else {
|
|
687
|
-
return message(arg1, arg2, arg3);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
class NodeError extends Base {
|
|
692
|
-
constructor(arg1, arg2, arg3) {
|
|
693
|
-
super(getMessage(arg1, arg2, arg3));
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
NodeError.prototype.name = Base.name;
|
|
697
|
-
NodeError.prototype.code = code;
|
|
698
|
-
codes[code] = NodeError;
|
|
699
|
-
};
|
|
700
|
-
var oneOf = function(expected, thing) {
|
|
701
|
-
if (Array.isArray(expected)) {
|
|
702
|
-
const len = expected.length;
|
|
703
|
-
expected = expected.map((i) => String(i));
|
|
704
|
-
if (len > 2) {
|
|
705
|
-
return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
|
|
706
|
-
} else if (len === 2) {
|
|
707
|
-
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
|
708
|
-
} else {
|
|
709
|
-
return `of ${thing} ${expected[0]}`;
|
|
710
|
-
}
|
|
711
|
-
} else {
|
|
712
|
-
return `of ${thing} ${String(expected)}`;
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
var startsWith = function(str, search, pos) {
|
|
716
|
-
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
|
717
|
-
};
|
|
718
|
-
var endsWith = function(str, search, this_len) {
|
|
719
|
-
if (this_len === undefined || this_len > str.length) {
|
|
720
|
-
this_len = str.length;
|
|
721
|
-
}
|
|
722
|
-
return str.substring(this_len - search.length, this_len) === search;
|
|
723
|
-
};
|
|
724
|
-
var includes = function(str, search, start) {
|
|
725
|
-
if (typeof start !== "number") {
|
|
726
|
-
start = 0;
|
|
727
|
-
}
|
|
728
|
-
if (start + search.length > str.length) {
|
|
729
|
-
return false;
|
|
730
|
-
} else {
|
|
731
|
-
return str.indexOf(search, start) !== -1;
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
var codes = {};
|
|
735
|
-
createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
|
|
736
|
-
return 'The value "' + value + '" is invalid for option "' + name + '"';
|
|
737
|
-
}, TypeError);
|
|
738
|
-
createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
|
|
739
|
-
let determiner;
|
|
740
|
-
if (typeof expected === "string" && startsWith(expected, "not ")) {
|
|
741
|
-
determiner = "must not be";
|
|
742
|
-
expected = expected.replace(/^not /, "");
|
|
743
|
-
} else {
|
|
744
|
-
determiner = "must be";
|
|
745
|
-
}
|
|
746
|
-
let msg;
|
|
747
|
-
if (endsWith(name, " argument")) {
|
|
748
|
-
msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`;
|
|
749
|
-
} else {
|
|
750
|
-
const type = includes(name, ".") ? "property" : "argument";
|
|
751
|
-
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`;
|
|
752
|
-
}
|
|
753
|
-
msg += `. Received type ${typeof actual}`;
|
|
754
|
-
return msg;
|
|
755
|
-
}, TypeError);
|
|
756
|
-
createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
|
|
757
|
-
createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
|
|
758
|
-
return "The " + name + " method is not implemented";
|
|
759
|
-
});
|
|
760
|
-
createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
|
|
761
|
-
createErrorType("ERR_STREAM_DESTROYED", function(name) {
|
|
762
|
-
return "Cannot call " + name + " after a stream was destroyed";
|
|
763
|
-
});
|
|
764
|
-
createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
|
|
765
|
-
createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
|
|
766
|
-
createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
|
|
767
|
-
createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
|
|
768
|
-
createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
|
|
769
|
-
return "Unknown encoding: " + arg;
|
|
770
|
-
}, TypeError);
|
|
771
|
-
createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
|
|
772
|
-
exports.codes = codes;
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
// ../../node_modules/readable-stream/lib/internal/streams/state.js
|
|
776
|
-
var require_state = __commonJS((exports, module) => {
|
|
777
|
-
var highWaterMarkFrom = function(options, isDuplex, duplexKey) {
|
|
778
|
-
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
|
779
|
-
};
|
|
780
|
-
var getHighWaterMark = function(state, options, duplexKey, isDuplex) {
|
|
781
|
-
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
|
782
|
-
if (hwm != null) {
|
|
783
|
-
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
|
784
|
-
var name = isDuplex ? duplexKey : "highWaterMark";
|
|
785
|
-
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
|
786
|
-
}
|
|
787
|
-
return Math.floor(hwm);
|
|
788
|
-
}
|
|
789
|
-
return state.objectMode ? 16 : 16 * 1024;
|
|
790
|
-
};
|
|
791
|
-
var ERR_INVALID_OPT_VALUE = require_errors().codes.ERR_INVALID_OPT_VALUE;
|
|
792
|
-
module.exports = {
|
|
793
|
-
getHighWaterMark
|
|
794
|
-
};
|
|
795
|
-
});
|
|
796
|
-
|
|
797
|
-
// ../../node_modules/inherits/inherits_browser.js
|
|
798
|
-
var require_inherits_browser = __commonJS((exports, module) => {
|
|
799
|
-
if (typeof Object.create === "function") {
|
|
800
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
801
|
-
if (superCtor) {
|
|
802
|
-
ctor.super_ = superCtor;
|
|
803
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
804
|
-
constructor: {
|
|
805
|
-
value: ctor,
|
|
806
|
-
enumerable: false,
|
|
807
|
-
writable: true,
|
|
808
|
-
configurable: true
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
} else {
|
|
814
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
815
|
-
if (superCtor) {
|
|
816
|
-
ctor.super_ = superCtor;
|
|
817
|
-
var TempCtor = function() {
|
|
818
|
-
};
|
|
819
|
-
TempCtor.prototype = superCtor.prototype;
|
|
820
|
-
ctor.prototype = new TempCtor;
|
|
821
|
-
ctor.prototype.constructor = ctor;
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
// ../../node_modules/inherits/inherits.js
|
|
828
|
-
var require_inherits = __commonJS((exports, module) => {
|
|
829
|
-
try {
|
|
830
|
-
util = import.meta.require("util");
|
|
831
|
-
if (typeof util.inherits !== "function")
|
|
832
|
-
throw "";
|
|
833
|
-
module.exports = util.inherits;
|
|
834
|
-
} catch (e) {
|
|
835
|
-
module.exports = require_inherits_browser();
|
|
836
|
-
}
|
|
837
|
-
var util;
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
// ../../node_modules/readable-stream/lib/internal/streams/end-of-stream.js
|
|
841
|
-
var require_end_of_stream = __commonJS((exports, module) => {
|
|
842
|
-
var once = function(callback) {
|
|
843
|
-
var called = false;
|
|
844
|
-
return function() {
|
|
845
|
-
if (called)
|
|
846
|
-
return;
|
|
847
|
-
called = true;
|
|
848
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0;_key < _len; _key++) {
|
|
849
|
-
args[_key] = arguments[_key];
|
|
850
|
-
}
|
|
851
|
-
callback.apply(this, args);
|
|
852
|
-
};
|
|
853
|
-
};
|
|
854
|
-
var noop = function() {
|
|
855
|
-
};
|
|
856
|
-
var isRequest = function(stream) {
|
|
857
|
-
return stream.setHeader && typeof stream.abort === "function";
|
|
858
|
-
};
|
|
859
|
-
var eos = function(stream, opts, callback) {
|
|
860
|
-
if (typeof opts === "function")
|
|
861
|
-
return eos(stream, null, opts);
|
|
862
|
-
if (!opts)
|
|
863
|
-
opts = {};
|
|
864
|
-
callback = once(callback || noop);
|
|
865
|
-
var readable = opts.readable || opts.readable !== false && stream.readable;
|
|
866
|
-
var writable = opts.writable || opts.writable !== false && stream.writable;
|
|
867
|
-
var onlegacyfinish = function onlegacyfinish() {
|
|
868
|
-
if (!stream.writable)
|
|
869
|
-
onfinish();
|
|
870
|
-
};
|
|
871
|
-
var writableEnded = stream._writableState && stream._writableState.finished;
|
|
872
|
-
var onfinish = function onfinish() {
|
|
873
|
-
writable = false;
|
|
874
|
-
writableEnded = true;
|
|
875
|
-
if (!readable)
|
|
876
|
-
callback.call(stream);
|
|
877
|
-
};
|
|
878
|
-
var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
|
879
|
-
var onend = function onend() {
|
|
880
|
-
readable = false;
|
|
881
|
-
readableEnded = true;
|
|
882
|
-
if (!writable)
|
|
883
|
-
callback.call(stream);
|
|
884
|
-
};
|
|
885
|
-
var onerror = function onerror(err) {
|
|
886
|
-
callback.call(stream, err);
|
|
887
|
-
};
|
|
888
|
-
var onclose = function onclose() {
|
|
889
|
-
var err;
|
|
890
|
-
if (readable && !readableEnded) {
|
|
891
|
-
if (!stream._readableState || !stream._readableState.ended)
|
|
892
|
-
err = new ERR_STREAM_PREMATURE_CLOSE;
|
|
893
|
-
return callback.call(stream, err);
|
|
894
|
-
}
|
|
895
|
-
if (writable && !writableEnded) {
|
|
896
|
-
if (!stream._writableState || !stream._writableState.ended)
|
|
897
|
-
err = new ERR_STREAM_PREMATURE_CLOSE;
|
|
898
|
-
return callback.call(stream, err);
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
var onrequest = function onrequest() {
|
|
902
|
-
stream.req.on("finish", onfinish);
|
|
903
|
-
};
|
|
904
|
-
if (isRequest(stream)) {
|
|
905
|
-
stream.on("complete", onfinish);
|
|
906
|
-
stream.on("abort", onclose);
|
|
907
|
-
if (stream.req)
|
|
908
|
-
onrequest();
|
|
909
|
-
else
|
|
910
|
-
stream.on("request", onrequest);
|
|
911
|
-
} else if (writable && !stream._writableState) {
|
|
912
|
-
stream.on("end", onlegacyfinish);
|
|
913
|
-
stream.on("close", onlegacyfinish);
|
|
914
|
-
}
|
|
915
|
-
stream.on("end", onend);
|
|
916
|
-
stream.on("finish", onfinish);
|
|
917
|
-
if (opts.error !== false)
|
|
918
|
-
stream.on("error", onerror);
|
|
919
|
-
stream.on("close", onclose);
|
|
920
|
-
return function() {
|
|
921
|
-
stream.removeListener("complete", onfinish);
|
|
922
|
-
stream.removeListener("abort", onclose);
|
|
923
|
-
stream.removeListener("request", onrequest);
|
|
924
|
-
if (stream.req)
|
|
925
|
-
stream.req.removeListener("finish", onfinish);
|
|
926
|
-
stream.removeListener("end", onlegacyfinish);
|
|
927
|
-
stream.removeListener("close", onlegacyfinish);
|
|
928
|
-
stream.removeListener("finish", onfinish);
|
|
929
|
-
stream.removeListener("end", onend);
|
|
930
|
-
stream.removeListener("error", onerror);
|
|
931
|
-
stream.removeListener("close", onclose);
|
|
932
|
-
};
|
|
933
|
-
};
|
|
934
|
-
var ERR_STREAM_PREMATURE_CLOSE = require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;
|
|
935
|
-
module.exports = eos;
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
// ../../node_modules/readable-stream/lib/internal/streams/async_iterator.js
|
|
939
|
-
var require_async_iterator = __commonJS((exports, module) => {
|
|
940
|
-
var _defineProperty = function(obj, key, value) {
|
|
941
|
-
key = _toPropertyKey(key);
|
|
942
|
-
if (key in obj) {
|
|
943
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
944
|
-
} else {
|
|
945
|
-
obj[key] = value;
|
|
946
|
-
}
|
|
947
|
-
return obj;
|
|
948
|
-
};
|
|
949
|
-
var _toPropertyKey = function(arg) {
|
|
950
|
-
var key = _toPrimitive(arg, "string");
|
|
951
|
-
return typeof key === "symbol" ? key : String(key);
|
|
952
|
-
};
|
|
953
|
-
var _toPrimitive = function(input, hint) {
|
|
954
|
-
if (typeof input !== "object" || input === null)
|
|
955
|
-
return input;
|
|
956
|
-
var prim = input[Symbol.toPrimitive];
|
|
957
|
-
if (prim !== undefined) {
|
|
958
|
-
var res = prim.call(input, hint || "default");
|
|
959
|
-
if (typeof res !== "object")
|
|
960
|
-
return res;
|
|
961
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
962
|
-
}
|
|
963
|
-
return (hint === "string" ? String : Number)(input);
|
|
964
|
-
};
|
|
965
|
-
var createIterResult = function(value, done) {
|
|
966
|
-
return {
|
|
967
|
-
value,
|
|
968
|
-
done
|
|
969
|
-
};
|
|
970
|
-
};
|
|
971
|
-
var readAndResolve = function(iter) {
|
|
972
|
-
var resolve = iter[kLastResolve];
|
|
973
|
-
if (resolve !== null) {
|
|
974
|
-
var data = iter[kStream].read();
|
|
975
|
-
if (data !== null) {
|
|
976
|
-
iter[kLastPromise] = null;
|
|
977
|
-
iter[kLastResolve] = null;
|
|
978
|
-
iter[kLastReject] = null;
|
|
979
|
-
resolve(createIterResult(data, false));
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
var onReadable = function(iter) {
|
|
984
|
-
process.nextTick(readAndResolve, iter);
|
|
985
|
-
};
|
|
986
|
-
var wrapForNext = function(lastPromise, iter) {
|
|
987
|
-
return function(resolve, reject) {
|
|
988
|
-
lastPromise.then(function() {
|
|
989
|
-
if (iter[kEnded]) {
|
|
990
|
-
resolve(createIterResult(undefined, true));
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
iter[kHandlePromise](resolve, reject);
|
|
994
|
-
}, reject);
|
|
995
|
-
};
|
|
996
|
-
};
|
|
997
|
-
var _Object$setPrototypeO;
|
|
998
|
-
var finished = require_end_of_stream();
|
|
999
|
-
var kLastResolve = Symbol("lastResolve");
|
|
1000
|
-
var kLastReject = Symbol("lastReject");
|
|
1001
|
-
var kError = Symbol("error");
|
|
1002
|
-
var kEnded = Symbol("ended");
|
|
1003
|
-
var kLastPromise = Symbol("lastPromise");
|
|
1004
|
-
var kHandlePromise = Symbol("handlePromise");
|
|
1005
|
-
var kStream = Symbol("stream");
|
|
1006
|
-
var AsyncIteratorPrototype = Object.getPrototypeOf(function() {
|
|
1007
|
-
});
|
|
1008
|
-
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
|
|
1009
|
-
get stream() {
|
|
1010
|
-
return this[kStream];
|
|
1011
|
-
},
|
|
1012
|
-
next: function next() {
|
|
1013
|
-
var _this = this;
|
|
1014
|
-
var error = this[kError];
|
|
1015
|
-
if (error !== null) {
|
|
1016
|
-
return Promise.reject(error);
|
|
1017
|
-
}
|
|
1018
|
-
if (this[kEnded]) {
|
|
1019
|
-
return Promise.resolve(createIterResult(undefined, true));
|
|
1020
|
-
}
|
|
1021
|
-
if (this[kStream].destroyed) {
|
|
1022
|
-
return new Promise(function(resolve, reject) {
|
|
1023
|
-
process.nextTick(function() {
|
|
1024
|
-
if (_this[kError]) {
|
|
1025
|
-
reject(_this[kError]);
|
|
1026
|
-
} else {
|
|
1027
|
-
resolve(createIterResult(undefined, true));
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
var lastPromise = this[kLastPromise];
|
|
1033
|
-
var promise;
|
|
1034
|
-
if (lastPromise) {
|
|
1035
|
-
promise = new Promise(wrapForNext(lastPromise, this));
|
|
1036
|
-
} else {
|
|
1037
|
-
var data = this[kStream].read();
|
|
1038
|
-
if (data !== null) {
|
|
1039
|
-
return Promise.resolve(createIterResult(data, false));
|
|
1040
|
-
}
|
|
1041
|
-
promise = new Promise(this[kHandlePromise]);
|
|
1042
|
-
}
|
|
1043
|
-
this[kLastPromise] = promise;
|
|
1044
|
-
return promise;
|
|
1045
|
-
}
|
|
1046
|
-
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
|
|
1047
|
-
return this;
|
|
1048
|
-
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
1049
|
-
var _this2 = this;
|
|
1050
|
-
return new Promise(function(resolve, reject) {
|
|
1051
|
-
_this2[kStream].destroy(null, function(err) {
|
|
1052
|
-
if (err) {
|
|
1053
|
-
reject(err);
|
|
1054
|
-
return;
|
|
1055
|
-
}
|
|
1056
|
-
resolve(createIterResult(undefined, true));
|
|
1057
|
-
});
|
|
1058
|
-
});
|
|
1059
|
-
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
1060
|
-
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
|
1061
|
-
var _Object$create;
|
|
1062
|
-
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
|
|
1063
|
-
value: stream,
|
|
1064
|
-
writable: true
|
|
1065
|
-
}), _defineProperty(_Object$create, kLastResolve, {
|
|
1066
|
-
value: null,
|
|
1067
|
-
writable: true
|
|
1068
|
-
}), _defineProperty(_Object$create, kLastReject, {
|
|
1069
|
-
value: null,
|
|
1070
|
-
writable: true
|
|
1071
|
-
}), _defineProperty(_Object$create, kError, {
|
|
1072
|
-
value: null,
|
|
1073
|
-
writable: true
|
|
1074
|
-
}), _defineProperty(_Object$create, kEnded, {
|
|
1075
|
-
value: stream._readableState.endEmitted,
|
|
1076
|
-
writable: true
|
|
1077
|
-
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
1078
|
-
value: function value(resolve, reject) {
|
|
1079
|
-
var data = iterator[kStream].read();
|
|
1080
|
-
if (data) {
|
|
1081
|
-
iterator[kLastPromise] = null;
|
|
1082
|
-
iterator[kLastResolve] = null;
|
|
1083
|
-
iterator[kLastReject] = null;
|
|
1084
|
-
resolve(createIterResult(data, false));
|
|
1085
|
-
} else {
|
|
1086
|
-
iterator[kLastResolve] = resolve;
|
|
1087
|
-
iterator[kLastReject] = reject;
|
|
1088
|
-
}
|
|
1089
|
-
},
|
|
1090
|
-
writable: true
|
|
1091
|
-
}), _Object$create));
|
|
1092
|
-
iterator[kLastPromise] = null;
|
|
1093
|
-
finished(stream, function(err) {
|
|
1094
|
-
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
1095
|
-
var reject = iterator[kLastReject];
|
|
1096
|
-
if (reject !== null) {
|
|
1097
|
-
iterator[kLastPromise] = null;
|
|
1098
|
-
iterator[kLastResolve] = null;
|
|
1099
|
-
iterator[kLastReject] = null;
|
|
1100
|
-
reject(err);
|
|
1101
|
-
}
|
|
1102
|
-
iterator[kError] = err;
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
var resolve = iterator[kLastResolve];
|
|
1106
|
-
if (resolve !== null) {
|
|
1107
|
-
iterator[kLastPromise] = null;
|
|
1108
|
-
iterator[kLastResolve] = null;
|
|
1109
|
-
iterator[kLastReject] = null;
|
|
1110
|
-
resolve(createIterResult(undefined, true));
|
|
1111
|
-
}
|
|
1112
|
-
iterator[kEnded] = true;
|
|
1113
|
-
});
|
|
1114
|
-
stream.on("readable", onReadable.bind(null, iterator));
|
|
1115
|
-
return iterator;
|
|
1116
|
-
};
|
|
1117
|
-
module.exports = createReadableStreamAsyncIterator;
|
|
1118
|
-
});
|
|
1119
|
-
|
|
1120
|
-
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
1121
|
-
var require_from = __commonJS((exports, module) => {
|
|
1122
|
-
var asyncGeneratorStep = function(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1123
|
-
try {
|
|
1124
|
-
var info = gen[key](arg);
|
|
1125
|
-
var value = info.value;
|
|
1126
|
-
} catch (error) {
|
|
1127
|
-
reject(error);
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
if (info.done) {
|
|
1131
|
-
resolve(value);
|
|
1132
|
-
} else {
|
|
1133
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
var _asyncToGenerator = function(fn) {
|
|
1137
|
-
return function() {
|
|
1138
|
-
var self2 = this, args = arguments;
|
|
1139
|
-
return new Promise(function(resolve, reject) {
|
|
1140
|
-
var gen = fn.apply(self2, args);
|
|
1141
|
-
function _next(value) {
|
|
1142
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1143
|
-
}
|
|
1144
|
-
function _throw(err) {
|
|
1145
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1146
|
-
}
|
|
1147
|
-
_next(undefined);
|
|
1148
|
-
});
|
|
1149
|
-
};
|
|
1150
|
-
};
|
|
1151
|
-
var ownKeys = function(object, enumerableOnly) {
|
|
1152
|
-
var keys = Object.keys(object);
|
|
1153
|
-
if (Object.getOwnPropertySymbols) {
|
|
1154
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1155
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1156
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1157
|
-
})), keys.push.apply(keys, symbols);
|
|
1158
|
-
}
|
|
1159
|
-
return keys;
|
|
1160
|
-
};
|
|
1161
|
-
var _objectSpread = function(target) {
|
|
1162
|
-
for (var i = 1;i < arguments.length; i++) {
|
|
1163
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1164
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
1165
|
-
_defineProperty(target, key, source[key]);
|
|
1166
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1167
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
return target;
|
|
1171
|
-
};
|
|
1172
|
-
var _defineProperty = function(obj, key, value) {
|
|
1173
|
-
key = _toPropertyKey(key);
|
|
1174
|
-
if (key in obj) {
|
|
1175
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1176
|
-
} else {
|
|
1177
|
-
obj[key] = value;
|
|
1178
|
-
}
|
|
1179
|
-
return obj;
|
|
1180
|
-
};
|
|
1181
|
-
var _toPropertyKey = function(arg) {
|
|
1182
|
-
var key = _toPrimitive(arg, "string");
|
|
1183
|
-
return typeof key === "symbol" ? key : String(key);
|
|
1184
|
-
};
|
|
1185
|
-
var _toPrimitive = function(input, hint) {
|
|
1186
|
-
if (typeof input !== "object" || input === null)
|
|
1187
|
-
return input;
|
|
1188
|
-
var prim = input[Symbol.toPrimitive];
|
|
1189
|
-
if (prim !== undefined) {
|
|
1190
|
-
var res = prim.call(input, hint || "default");
|
|
1191
|
-
if (typeof res !== "object")
|
|
1192
|
-
return res;
|
|
1193
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1194
|
-
}
|
|
1195
|
-
return (hint === "string" ? String : Number)(input);
|
|
1196
|
-
};
|
|
1197
|
-
var from = function(Readable, iterable, opts) {
|
|
1198
|
-
var iterator;
|
|
1199
|
-
if (iterable && typeof iterable.next === "function") {
|
|
1200
|
-
iterator = iterable;
|
|
1201
|
-
} else if (iterable && iterable[Symbol.asyncIterator])
|
|
1202
|
-
iterator = iterable[Symbol.asyncIterator]();
|
|
1203
|
-
else if (iterable && iterable[Symbol.iterator])
|
|
1204
|
-
iterator = iterable[Symbol.iterator]();
|
|
1205
|
-
else
|
|
1206
|
-
throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
|
|
1207
|
-
var readable = new Readable(_objectSpread({
|
|
1208
|
-
objectMode: true
|
|
1209
|
-
}, opts));
|
|
1210
|
-
var reading = false;
|
|
1211
|
-
readable._read = function() {
|
|
1212
|
-
if (!reading) {
|
|
1213
|
-
reading = true;
|
|
1214
|
-
next();
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
function next() {
|
|
1218
|
-
return _next2.apply(this, arguments);
|
|
1219
|
-
}
|
|
1220
|
-
function _next2() {
|
|
1221
|
-
_next2 = _asyncToGenerator(function* () {
|
|
1222
|
-
try {
|
|
1223
|
-
var _yield$iterator$next = yield iterator.next(), value = _yield$iterator$next.value, done = _yield$iterator$next.done;
|
|
1224
|
-
if (done) {
|
|
1225
|
-
readable.push(null);
|
|
1226
|
-
} else if (readable.push(yield value)) {
|
|
1227
|
-
next();
|
|
1228
|
-
} else {
|
|
1229
|
-
reading = false;
|
|
1230
|
-
}
|
|
1231
|
-
} catch (err) {
|
|
1232
|
-
readable.destroy(err);
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1235
|
-
return _next2.apply(this, arguments);
|
|
1236
|
-
}
|
|
1237
|
-
return readable;
|
|
1238
|
-
};
|
|
1239
|
-
var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
|
|
1240
|
-
module.exports = from;
|
|
1241
|
-
});
|
|
1242
|
-
|
|
1243
|
-
// ../../node_modules/readable-stream/lib/_stream_readable.js
|
|
1244
|
-
var require__stream_readable = __commonJS((exports, module) => {
|
|
1245
|
-
var _uint8ArrayToBuffer = function(chunk) {
|
|
1246
|
-
return Buffer.from(chunk);
|
|
1247
|
-
};
|
|
1248
|
-
var _isUint8Array = function(obj) {
|
|
1249
|
-
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
1250
|
-
};
|
|
1251
|
-
var prependListener = function(emitter, event, fn) {
|
|
1252
|
-
if (typeof emitter.prependListener === "function")
|
|
1253
|
-
return emitter.prependListener(event, fn);
|
|
1254
|
-
if (!emitter._events || !emitter._events[event])
|
|
1255
|
-
emitter.on(event, fn);
|
|
1256
|
-
else if (Array.isArray(emitter._events[event]))
|
|
1257
|
-
emitter._events[event].unshift(fn);
|
|
1258
|
-
else
|
|
1259
|
-
emitter._events[event] = [fn, emitter._events[event]];
|
|
1260
|
-
};
|
|
1261
|
-
var ReadableState = function(options, stream, isDuplex) {
|
|
1262
|
-
Duplex = Duplex || require__stream_duplex();
|
|
1263
|
-
options = options || {};
|
|
1264
|
-
if (typeof isDuplex !== "boolean")
|
|
1265
|
-
isDuplex = stream instanceof Duplex;
|
|
1266
|
-
this.objectMode = !!options.objectMode;
|
|
1267
|
-
if (isDuplex)
|
|
1268
|
-
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
|
1269
|
-
this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
|
|
1270
|
-
this.buffer = new BufferList;
|
|
1271
|
-
this.length = 0;
|
|
1272
|
-
this.pipes = null;
|
|
1273
|
-
this.pipesCount = 0;
|
|
1274
|
-
this.flowing = null;
|
|
1275
|
-
this.ended = false;
|
|
1276
|
-
this.endEmitted = false;
|
|
1277
|
-
this.reading = false;
|
|
1278
|
-
this.sync = true;
|
|
1279
|
-
this.needReadable = false;
|
|
1280
|
-
this.emittedReadable = false;
|
|
1281
|
-
this.readableListening = false;
|
|
1282
|
-
this.resumeScheduled = false;
|
|
1283
|
-
this.paused = true;
|
|
1284
|
-
this.emitClose = options.emitClose !== false;
|
|
1285
|
-
this.autoDestroy = !!options.autoDestroy;
|
|
1286
|
-
this.destroyed = false;
|
|
1287
|
-
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
1288
|
-
this.awaitDrain = 0;
|
|
1289
|
-
this.readingMore = false;
|
|
1290
|
-
this.decoder = null;
|
|
1291
|
-
this.encoding = null;
|
|
1292
|
-
if (options.encoding) {
|
|
1293
|
-
if (!StringDecoder)
|
|
1294
|
-
StringDecoder = require_string_decoder().StringDecoder;
|
|
1295
|
-
this.decoder = new StringDecoder(options.encoding);
|
|
1296
|
-
this.encoding = options.encoding;
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
var Readable = function(options) {
|
|
1300
|
-
Duplex = Duplex || require__stream_duplex();
|
|
1301
|
-
if (!(this instanceof Readable))
|
|
1302
|
-
return new Readable(options);
|
|
1303
|
-
var isDuplex = this instanceof Duplex;
|
|
1304
|
-
this._readableState = new ReadableState(options, this, isDuplex);
|
|
1305
|
-
this.readable = true;
|
|
1306
|
-
if (options) {
|
|
1307
|
-
if (typeof options.read === "function")
|
|
1308
|
-
this._read = options.read;
|
|
1309
|
-
if (typeof options.destroy === "function")
|
|
1310
|
-
this._destroy = options.destroy;
|
|
1311
|
-
}
|
|
1312
|
-
Stream.call(this);
|
|
1313
|
-
};
|
|
1314
|
-
var readableAddChunk = function(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
|
1315
|
-
debug("readableAddChunk", chunk);
|
|
1316
|
-
var state = stream._readableState;
|
|
1317
|
-
if (chunk === null) {
|
|
1318
|
-
state.reading = false;
|
|
1319
|
-
onEofChunk(stream, state);
|
|
1320
|
-
} else {
|
|
1321
|
-
var er;
|
|
1322
|
-
if (!skipChunkCheck)
|
|
1323
|
-
er = chunkInvalid(state, chunk);
|
|
1324
|
-
if (er) {
|
|
1325
|
-
errorOrDestroy(stream, er);
|
|
1326
|
-
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
1327
|
-
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
|
1328
|
-
chunk = _uint8ArrayToBuffer(chunk);
|
|
1329
|
-
}
|
|
1330
|
-
if (addToFront) {
|
|
1331
|
-
if (state.endEmitted)
|
|
1332
|
-
errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);
|
|
1333
|
-
else
|
|
1334
|
-
addChunk(stream, state, chunk, true);
|
|
1335
|
-
} else if (state.ended) {
|
|
1336
|
-
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF);
|
|
1337
|
-
} else if (state.destroyed) {
|
|
1338
|
-
return false;
|
|
1339
|
-
} else {
|
|
1340
|
-
state.reading = false;
|
|
1341
|
-
if (state.decoder && !encoding) {
|
|
1342
|
-
chunk = state.decoder.write(chunk);
|
|
1343
|
-
if (state.objectMode || chunk.length !== 0)
|
|
1344
|
-
addChunk(stream, state, chunk, false);
|
|
1345
|
-
else
|
|
1346
|
-
maybeReadMore(stream, state);
|
|
1347
|
-
} else {
|
|
1348
|
-
addChunk(stream, state, chunk, false);
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
} else if (!addToFront) {
|
|
1352
|
-
state.reading = false;
|
|
1353
|
-
maybeReadMore(stream, state);
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
|
|
1357
|
-
};
|
|
1358
|
-
var addChunk = function(stream, state, chunk, addToFront) {
|
|
1359
|
-
if (state.flowing && state.length === 0 && !state.sync) {
|
|
1360
|
-
state.awaitDrain = 0;
|
|
1361
|
-
stream.emit("data", chunk);
|
|
1362
|
-
} else {
|
|
1363
|
-
state.length += state.objectMode ? 1 : chunk.length;
|
|
1364
|
-
if (addToFront)
|
|
1365
|
-
state.buffer.unshift(chunk);
|
|
1366
|
-
else
|
|
1367
|
-
state.buffer.push(chunk);
|
|
1368
|
-
if (state.needReadable)
|
|
1369
|
-
emitReadable(stream);
|
|
1370
|
-
}
|
|
1371
|
-
maybeReadMore(stream, state);
|
|
1372
|
-
};
|
|
1373
|
-
var chunkInvalid = function(state, chunk) {
|
|
1374
|
-
var er;
|
|
1375
|
-
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
|
|
1376
|
-
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
|
|
1377
|
-
}
|
|
1378
|
-
return er;
|
|
1379
|
-
};
|
|
1380
|
-
var computeNewHighWaterMark = function(n) {
|
|
1381
|
-
if (n >= MAX_HWM) {
|
|
1382
|
-
n = MAX_HWM;
|
|
1383
|
-
} else {
|
|
1384
|
-
n--;
|
|
1385
|
-
n |= n >>> 1;
|
|
1386
|
-
n |= n >>> 2;
|
|
1387
|
-
n |= n >>> 4;
|
|
1388
|
-
n |= n >>> 8;
|
|
1389
|
-
n |= n >>> 16;
|
|
1390
|
-
n++;
|
|
1391
|
-
}
|
|
1392
|
-
return n;
|
|
1393
|
-
};
|
|
1394
|
-
var howMuchToRead = function(n, state) {
|
|
1395
|
-
if (n <= 0 || state.length === 0 && state.ended)
|
|
1396
|
-
return 0;
|
|
1397
|
-
if (state.objectMode)
|
|
1398
|
-
return 1;
|
|
1399
|
-
if (n !== n) {
|
|
1400
|
-
if (state.flowing && state.length)
|
|
1401
|
-
return state.buffer.head.data.length;
|
|
1402
|
-
else
|
|
1403
|
-
return state.length;
|
|
1404
|
-
}
|
|
1405
|
-
if (n > state.highWaterMark)
|
|
1406
|
-
state.highWaterMark = computeNewHighWaterMark(n);
|
|
1407
|
-
if (n <= state.length)
|
|
1408
|
-
return n;
|
|
1409
|
-
if (!state.ended) {
|
|
1410
|
-
state.needReadable = true;
|
|
1411
|
-
return 0;
|
|
1412
|
-
}
|
|
1413
|
-
return state.length;
|
|
1414
|
-
};
|
|
1415
|
-
var onEofChunk = function(stream, state) {
|
|
1416
|
-
debug("onEofChunk");
|
|
1417
|
-
if (state.ended)
|
|
1418
|
-
return;
|
|
1419
|
-
if (state.decoder) {
|
|
1420
|
-
var chunk = state.decoder.end();
|
|
1421
|
-
if (chunk && chunk.length) {
|
|
1422
|
-
state.buffer.push(chunk);
|
|
1423
|
-
state.length += state.objectMode ? 1 : chunk.length;
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
state.ended = true;
|
|
1427
|
-
if (state.sync) {
|
|
1428
|
-
emitReadable(stream);
|
|
1429
|
-
} else {
|
|
1430
|
-
state.needReadable = false;
|
|
1431
|
-
if (!state.emittedReadable) {
|
|
1432
|
-
state.emittedReadable = true;
|
|
1433
|
-
emitReadable_(stream);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
};
|
|
1437
|
-
var emitReadable = function(stream) {
|
|
1438
|
-
var state = stream._readableState;
|
|
1439
|
-
debug("emitReadable", state.needReadable, state.emittedReadable);
|
|
1440
|
-
state.needReadable = false;
|
|
1441
|
-
if (!state.emittedReadable) {
|
|
1442
|
-
debug("emitReadable", state.flowing);
|
|
1443
|
-
state.emittedReadable = true;
|
|
1444
|
-
process.nextTick(emitReadable_, stream);
|
|
1445
|
-
}
|
|
1446
|
-
};
|
|
1447
|
-
var emitReadable_ = function(stream) {
|
|
1448
|
-
var state = stream._readableState;
|
|
1449
|
-
debug("emitReadable_", state.destroyed, state.length, state.ended);
|
|
1450
|
-
if (!state.destroyed && (state.length || state.ended)) {
|
|
1451
|
-
stream.emit("readable");
|
|
1452
|
-
state.emittedReadable = false;
|
|
1453
|
-
}
|
|
1454
|
-
state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
|
|
1455
|
-
flow(stream);
|
|
1456
|
-
};
|
|
1457
|
-
var maybeReadMore = function(stream, state) {
|
|
1458
|
-
if (!state.readingMore) {
|
|
1459
|
-
state.readingMore = true;
|
|
1460
|
-
process.nextTick(maybeReadMore_, stream, state);
|
|
1461
|
-
}
|
|
1462
|
-
};
|
|
1463
|
-
var maybeReadMore_ = function(stream, state) {
|
|
1464
|
-
while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
|
|
1465
|
-
var len = state.length;
|
|
1466
|
-
debug("maybeReadMore read 0");
|
|
1467
|
-
stream.read(0);
|
|
1468
|
-
if (len === state.length)
|
|
1469
|
-
break;
|
|
1470
|
-
}
|
|
1471
|
-
state.readingMore = false;
|
|
1472
|
-
};
|
|
1473
|
-
var pipeOnDrain = function(src) {
|
|
1474
|
-
return function pipeOnDrainFunctionResult() {
|
|
1475
|
-
var state = src._readableState;
|
|
1476
|
-
debug("pipeOnDrain", state.awaitDrain);
|
|
1477
|
-
if (state.awaitDrain)
|
|
1478
|
-
state.awaitDrain--;
|
|
1479
|
-
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
|
|
1480
|
-
state.flowing = true;
|
|
1481
|
-
flow(src);
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
};
|
|
1485
|
-
var updateReadableListening = function(self2) {
|
|
1486
|
-
var state = self2._readableState;
|
|
1487
|
-
state.readableListening = self2.listenerCount("readable") > 0;
|
|
1488
|
-
if (state.resumeScheduled && !state.paused) {
|
|
1489
|
-
state.flowing = true;
|
|
1490
|
-
} else if (self2.listenerCount("data") > 0) {
|
|
1491
|
-
self2.resume();
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
var nReadingNextTick = function(self2) {
|
|
1495
|
-
debug("readable nexttick read 0");
|
|
1496
|
-
self2.read(0);
|
|
1497
|
-
};
|
|
1498
|
-
var resume = function(stream, state) {
|
|
1499
|
-
if (!state.resumeScheduled) {
|
|
1500
|
-
state.resumeScheduled = true;
|
|
1501
|
-
process.nextTick(resume_, stream, state);
|
|
1502
|
-
}
|
|
1503
|
-
};
|
|
1504
|
-
var resume_ = function(stream, state) {
|
|
1505
|
-
debug("resume", state.reading);
|
|
1506
|
-
if (!state.reading) {
|
|
1507
|
-
stream.read(0);
|
|
1508
|
-
}
|
|
1509
|
-
state.resumeScheduled = false;
|
|
1510
|
-
stream.emit("resume");
|
|
1511
|
-
flow(stream);
|
|
1512
|
-
if (state.flowing && !state.reading)
|
|
1513
|
-
stream.read(0);
|
|
1514
|
-
};
|
|
1515
|
-
var flow = function(stream) {
|
|
1516
|
-
var state = stream._readableState;
|
|
1517
|
-
debug("flow", state.flowing);
|
|
1518
|
-
while (state.flowing && stream.read() !== null)
|
|
1519
|
-
;
|
|
1520
|
-
};
|
|
1521
|
-
var fromList = function(n, state) {
|
|
1522
|
-
if (state.length === 0)
|
|
1523
|
-
return null;
|
|
1524
|
-
var ret;
|
|
1525
|
-
if (state.objectMode)
|
|
1526
|
-
ret = state.buffer.shift();
|
|
1527
|
-
else if (!n || n >= state.length) {
|
|
1528
|
-
if (state.decoder)
|
|
1529
|
-
ret = state.buffer.join("");
|
|
1530
|
-
else if (state.buffer.length === 1)
|
|
1531
|
-
ret = state.buffer.first();
|
|
1532
|
-
else
|
|
1533
|
-
ret = state.buffer.concat(state.length);
|
|
1534
|
-
state.buffer.clear();
|
|
1535
|
-
} else {
|
|
1536
|
-
ret = state.buffer.consume(n, state.decoder);
|
|
1537
|
-
}
|
|
1538
|
-
return ret;
|
|
1539
|
-
};
|
|
1540
|
-
var endReadable = function(stream) {
|
|
1541
|
-
var state = stream._readableState;
|
|
1542
|
-
debug("endReadable", state.endEmitted);
|
|
1543
|
-
if (!state.endEmitted) {
|
|
1544
|
-
state.ended = true;
|
|
1545
|
-
process.nextTick(endReadableNT, state, stream);
|
|
1546
|
-
}
|
|
1547
|
-
};
|
|
1548
|
-
var endReadableNT = function(state, stream) {
|
|
1549
|
-
debug("endReadableNT", state.endEmitted, state.length);
|
|
1550
|
-
if (!state.endEmitted && state.length === 0) {
|
|
1551
|
-
state.endEmitted = true;
|
|
1552
|
-
stream.readable = false;
|
|
1553
|
-
stream.emit("end");
|
|
1554
|
-
if (state.autoDestroy) {
|
|
1555
|
-
var wState = stream._writableState;
|
|
1556
|
-
if (!wState || wState.autoDestroy && wState.finished) {
|
|
1557
|
-
stream.destroy();
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
};
|
|
1562
|
-
var indexOf = function(xs, x) {
|
|
1563
|
-
for (var i = 0, l = xs.length;i < l; i++) {
|
|
1564
|
-
if (xs[i] === x)
|
|
1565
|
-
return i;
|
|
1566
|
-
}
|
|
1567
|
-
return -1;
|
|
1568
|
-
};
|
|
1569
|
-
module.exports = Readable;
|
|
1570
|
-
var Duplex;
|
|
1571
|
-
Readable.ReadableState = ReadableState;
|
|
1572
|
-
var EE = import.meta.require("events").EventEmitter;
|
|
1573
|
-
var EElistenerCount = function EElistenerCount(emitter, type) {
|
|
1574
|
-
return emitter.listeners(type).length;
|
|
1575
|
-
};
|
|
1576
|
-
var Stream = import.meta.require("stream");
|
|
1577
|
-
var Buffer = import.meta.require("buffer").Buffer;
|
|
1578
|
-
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
1579
|
-
};
|
|
1580
|
-
var debugUtil = import.meta.require("util");
|
|
1581
|
-
var debug;
|
|
1582
|
-
if (debugUtil && debugUtil.debuglog) {
|
|
1583
|
-
debug = debugUtil.debuglog("stream");
|
|
1584
|
-
} else {
|
|
1585
|
-
debug = function debug() {
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
var BufferList = require_buffer_list();
|
|
1589
|
-
var destroyImpl = require_destroy();
|
|
1590
|
-
var _require = require_state();
|
|
1591
|
-
var getHighWaterMark = _require.getHighWaterMark;
|
|
1592
|
-
var _require$codes = require_errors().codes;
|
|
1593
|
-
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
|
|
1594
|
-
var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
|
|
1595
|
-
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
|
|
1596
|
-
var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
1597
|
-
var StringDecoder;
|
|
1598
|
-
var createReadableStreamAsyncIterator;
|
|
1599
|
-
var from;
|
|
1600
|
-
require_inherits()(Readable, Stream);
|
|
1601
|
-
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
1602
|
-
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
|
|
1603
|
-
Object.defineProperty(Readable.prototype, "destroyed", {
|
|
1604
|
-
enumerable: false,
|
|
1605
|
-
get: function get() {
|
|
1606
|
-
if (this._readableState === undefined) {
|
|
1607
|
-
return false;
|
|
1608
|
-
}
|
|
1609
|
-
return this._readableState.destroyed;
|
|
1610
|
-
},
|
|
1611
|
-
set: function set(value) {
|
|
1612
|
-
if (!this._readableState) {
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
this._readableState.destroyed = value;
|
|
1616
|
-
}
|
|
1617
|
-
});
|
|
1618
|
-
Readable.prototype.destroy = destroyImpl.destroy;
|
|
1619
|
-
Readable.prototype._undestroy = destroyImpl.undestroy;
|
|
1620
|
-
Readable.prototype._destroy = function(err, cb) {
|
|
1621
|
-
cb(err);
|
|
1622
|
-
};
|
|
1623
|
-
Readable.prototype.push = function(chunk, encoding) {
|
|
1624
|
-
var state = this._readableState;
|
|
1625
|
-
var skipChunkCheck;
|
|
1626
|
-
if (!state.objectMode) {
|
|
1627
|
-
if (typeof chunk === "string") {
|
|
1628
|
-
encoding = encoding || state.defaultEncoding;
|
|
1629
|
-
if (encoding !== state.encoding) {
|
|
1630
|
-
chunk = Buffer.from(chunk, encoding);
|
|
1631
|
-
encoding = "";
|
|
1632
|
-
}
|
|
1633
|
-
skipChunkCheck = true;
|
|
1634
|
-
}
|
|
1635
|
-
} else {
|
|
1636
|
-
skipChunkCheck = true;
|
|
1637
|
-
}
|
|
1638
|
-
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
|
1639
|
-
};
|
|
1640
|
-
Readable.prototype.unshift = function(chunk) {
|
|
1641
|
-
return readableAddChunk(this, chunk, null, true, false);
|
|
1642
|
-
};
|
|
1643
|
-
Readable.prototype.isPaused = function() {
|
|
1644
|
-
return this._readableState.flowing === false;
|
|
1645
|
-
};
|
|
1646
|
-
Readable.prototype.setEncoding = function(enc) {
|
|
1647
|
-
if (!StringDecoder)
|
|
1648
|
-
StringDecoder = require_string_decoder().StringDecoder;
|
|
1649
|
-
var decoder = new StringDecoder(enc);
|
|
1650
|
-
this._readableState.decoder = decoder;
|
|
1651
|
-
this._readableState.encoding = this._readableState.decoder.encoding;
|
|
1652
|
-
var p = this._readableState.buffer.head;
|
|
1653
|
-
var content = "";
|
|
1654
|
-
while (p !== null) {
|
|
1655
|
-
content += decoder.write(p.data);
|
|
1656
|
-
p = p.next;
|
|
1657
|
-
}
|
|
1658
|
-
this._readableState.buffer.clear();
|
|
1659
|
-
if (content !== "")
|
|
1660
|
-
this._readableState.buffer.push(content);
|
|
1661
|
-
this._readableState.length = content.length;
|
|
1662
|
-
return this;
|
|
1663
|
-
};
|
|
1664
|
-
var MAX_HWM = 1073741824;
|
|
1665
|
-
Readable.prototype.read = function(n) {
|
|
1666
|
-
debug("read", n);
|
|
1667
|
-
n = parseInt(n, 10);
|
|
1668
|
-
var state = this._readableState;
|
|
1669
|
-
var nOrig = n;
|
|
1670
|
-
if (n !== 0)
|
|
1671
|
-
state.emittedReadable = false;
|
|
1672
|
-
if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
|
|
1673
|
-
debug("read: emitReadable", state.length, state.ended);
|
|
1674
|
-
if (state.length === 0 && state.ended)
|
|
1675
|
-
endReadable(this);
|
|
1676
|
-
else
|
|
1677
|
-
emitReadable(this);
|
|
1678
|
-
return null;
|
|
1679
|
-
}
|
|
1680
|
-
n = howMuchToRead(n, state);
|
|
1681
|
-
if (n === 0 && state.ended) {
|
|
1682
|
-
if (state.length === 0)
|
|
1683
|
-
endReadable(this);
|
|
1684
|
-
return null;
|
|
1685
|
-
}
|
|
1686
|
-
var doRead = state.needReadable;
|
|
1687
|
-
debug("need readable", doRead);
|
|
1688
|
-
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
|
1689
|
-
doRead = true;
|
|
1690
|
-
debug("length less than watermark", doRead);
|
|
1691
|
-
}
|
|
1692
|
-
if (state.ended || state.reading) {
|
|
1693
|
-
doRead = false;
|
|
1694
|
-
debug("reading or ended", doRead);
|
|
1695
|
-
} else if (doRead) {
|
|
1696
|
-
debug("do read");
|
|
1697
|
-
state.reading = true;
|
|
1698
|
-
state.sync = true;
|
|
1699
|
-
if (state.length === 0)
|
|
1700
|
-
state.needReadable = true;
|
|
1701
|
-
this._read(state.highWaterMark);
|
|
1702
|
-
state.sync = false;
|
|
1703
|
-
if (!state.reading)
|
|
1704
|
-
n = howMuchToRead(nOrig, state);
|
|
1705
|
-
}
|
|
1706
|
-
var ret;
|
|
1707
|
-
if (n > 0)
|
|
1708
|
-
ret = fromList(n, state);
|
|
1709
|
-
else
|
|
1710
|
-
ret = null;
|
|
1711
|
-
if (ret === null) {
|
|
1712
|
-
state.needReadable = state.length <= state.highWaterMark;
|
|
1713
|
-
n = 0;
|
|
1714
|
-
} else {
|
|
1715
|
-
state.length -= n;
|
|
1716
|
-
state.awaitDrain = 0;
|
|
1717
|
-
}
|
|
1718
|
-
if (state.length === 0) {
|
|
1719
|
-
if (!state.ended)
|
|
1720
|
-
state.needReadable = true;
|
|
1721
|
-
if (nOrig !== n && state.ended)
|
|
1722
|
-
endReadable(this);
|
|
1723
|
-
}
|
|
1724
|
-
if (ret !== null)
|
|
1725
|
-
this.emit("data", ret);
|
|
1726
|
-
return ret;
|
|
1727
|
-
};
|
|
1728
|
-
Readable.prototype._read = function(n) {
|
|
1729
|
-
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
|
|
1730
|
-
};
|
|
1731
|
-
Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
1732
|
-
var src = this;
|
|
1733
|
-
var state = this._readableState;
|
|
1734
|
-
switch (state.pipesCount) {
|
|
1735
|
-
case 0:
|
|
1736
|
-
state.pipes = dest;
|
|
1737
|
-
break;
|
|
1738
|
-
case 1:
|
|
1739
|
-
state.pipes = [state.pipes, dest];
|
|
1740
|
-
break;
|
|
1741
|
-
default:
|
|
1742
|
-
state.pipes.push(dest);
|
|
1743
|
-
break;
|
|
1744
|
-
}
|
|
1745
|
-
state.pipesCount += 1;
|
|
1746
|
-
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
|
1747
|
-
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
|
1748
|
-
var endFn = doEnd ? onend : unpipe;
|
|
1749
|
-
if (state.endEmitted)
|
|
1750
|
-
process.nextTick(endFn);
|
|
1751
|
-
else
|
|
1752
|
-
src.once("end", endFn);
|
|
1753
|
-
dest.on("unpipe", onunpipe);
|
|
1754
|
-
function onunpipe(readable, unpipeInfo) {
|
|
1755
|
-
debug("onunpipe");
|
|
1756
|
-
if (readable === src) {
|
|
1757
|
-
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
|
1758
|
-
unpipeInfo.hasUnpiped = true;
|
|
1759
|
-
cleanup();
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
function onend() {
|
|
1764
|
-
debug("onend");
|
|
1765
|
-
dest.end();
|
|
1766
|
-
}
|
|
1767
|
-
var ondrain = pipeOnDrain(src);
|
|
1768
|
-
dest.on("drain", ondrain);
|
|
1769
|
-
var cleanedUp = false;
|
|
1770
|
-
function cleanup() {
|
|
1771
|
-
debug("cleanup");
|
|
1772
|
-
dest.removeListener("close", onclose);
|
|
1773
|
-
dest.removeListener("finish", onfinish);
|
|
1774
|
-
dest.removeListener("drain", ondrain);
|
|
1775
|
-
dest.removeListener("error", onerror);
|
|
1776
|
-
dest.removeListener("unpipe", onunpipe);
|
|
1777
|
-
src.removeListener("end", onend);
|
|
1778
|
-
src.removeListener("end", unpipe);
|
|
1779
|
-
src.removeListener("data", ondata);
|
|
1780
|
-
cleanedUp = true;
|
|
1781
|
-
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
|
|
1782
|
-
ondrain();
|
|
1783
|
-
}
|
|
1784
|
-
src.on("data", ondata);
|
|
1785
|
-
function ondata(chunk) {
|
|
1786
|
-
debug("ondata");
|
|
1787
|
-
var ret = dest.write(chunk);
|
|
1788
|
-
debug("dest.write", ret);
|
|
1789
|
-
if (ret === false) {
|
|
1790
|
-
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
1791
|
-
debug("false write response, pause", state.awaitDrain);
|
|
1792
|
-
state.awaitDrain++;
|
|
1793
|
-
}
|
|
1794
|
-
src.pause();
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
function onerror(er) {
|
|
1798
|
-
debug("onerror", er);
|
|
1799
|
-
unpipe();
|
|
1800
|
-
dest.removeListener("error", onerror);
|
|
1801
|
-
if (EElistenerCount(dest, "error") === 0)
|
|
1802
|
-
errorOrDestroy(dest, er);
|
|
1803
|
-
}
|
|
1804
|
-
prependListener(dest, "error", onerror);
|
|
1805
|
-
function onclose() {
|
|
1806
|
-
dest.removeListener("finish", onfinish);
|
|
1807
|
-
unpipe();
|
|
1808
|
-
}
|
|
1809
|
-
dest.once("close", onclose);
|
|
1810
|
-
function onfinish() {
|
|
1811
|
-
debug("onfinish");
|
|
1812
|
-
dest.removeListener("close", onclose);
|
|
1813
|
-
unpipe();
|
|
1814
|
-
}
|
|
1815
|
-
dest.once("finish", onfinish);
|
|
1816
|
-
function unpipe() {
|
|
1817
|
-
debug("unpipe");
|
|
1818
|
-
src.unpipe(dest);
|
|
1819
|
-
}
|
|
1820
|
-
dest.emit("pipe", src);
|
|
1821
|
-
if (!state.flowing) {
|
|
1822
|
-
debug("pipe resume");
|
|
1823
|
-
src.resume();
|
|
1824
|
-
}
|
|
1825
|
-
return dest;
|
|
1826
|
-
};
|
|
1827
|
-
Readable.prototype.unpipe = function(dest) {
|
|
1828
|
-
var state = this._readableState;
|
|
1829
|
-
var unpipeInfo = {
|
|
1830
|
-
hasUnpiped: false
|
|
1831
|
-
};
|
|
1832
|
-
if (state.pipesCount === 0)
|
|
1833
|
-
return this;
|
|
1834
|
-
if (state.pipesCount === 1) {
|
|
1835
|
-
if (dest && dest !== state.pipes)
|
|
1836
|
-
return this;
|
|
1837
|
-
if (!dest)
|
|
1838
|
-
dest = state.pipes;
|
|
1839
|
-
state.pipes = null;
|
|
1840
|
-
state.pipesCount = 0;
|
|
1841
|
-
state.flowing = false;
|
|
1842
|
-
if (dest)
|
|
1843
|
-
dest.emit("unpipe", this, unpipeInfo);
|
|
1844
|
-
return this;
|
|
1845
|
-
}
|
|
1846
|
-
if (!dest) {
|
|
1847
|
-
var dests = state.pipes;
|
|
1848
|
-
var len = state.pipesCount;
|
|
1849
|
-
state.pipes = null;
|
|
1850
|
-
state.pipesCount = 0;
|
|
1851
|
-
state.flowing = false;
|
|
1852
|
-
for (var i = 0;i < len; i++)
|
|
1853
|
-
dests[i].emit("unpipe", this, {
|
|
1854
|
-
hasUnpiped: false
|
|
1855
|
-
});
|
|
1856
|
-
return this;
|
|
1857
|
-
}
|
|
1858
|
-
var index = indexOf(state.pipes, dest);
|
|
1859
|
-
if (index === -1)
|
|
1860
|
-
return this;
|
|
1861
|
-
state.pipes.splice(index, 1);
|
|
1862
|
-
state.pipesCount -= 1;
|
|
1863
|
-
if (state.pipesCount === 1)
|
|
1864
|
-
state.pipes = state.pipes[0];
|
|
1865
|
-
dest.emit("unpipe", this, unpipeInfo);
|
|
1866
|
-
return this;
|
|
1867
|
-
};
|
|
1868
|
-
Readable.prototype.on = function(ev, fn) {
|
|
1869
|
-
var res = Stream.prototype.on.call(this, ev, fn);
|
|
1870
|
-
var state = this._readableState;
|
|
1871
|
-
if (ev === "data") {
|
|
1872
|
-
state.readableListening = this.listenerCount("readable") > 0;
|
|
1873
|
-
if (state.flowing !== false)
|
|
1874
|
-
this.resume();
|
|
1875
|
-
} else if (ev === "readable") {
|
|
1876
|
-
if (!state.endEmitted && !state.readableListening) {
|
|
1877
|
-
state.readableListening = state.needReadable = true;
|
|
1878
|
-
state.flowing = false;
|
|
1879
|
-
state.emittedReadable = false;
|
|
1880
|
-
debug("on readable", state.length, state.reading);
|
|
1881
|
-
if (state.length) {
|
|
1882
|
-
emitReadable(this);
|
|
1883
|
-
} else if (!state.reading) {
|
|
1884
|
-
process.nextTick(nReadingNextTick, this);
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
return res;
|
|
1889
|
-
};
|
|
1890
|
-
Readable.prototype.addListener = Readable.prototype.on;
|
|
1891
|
-
Readable.prototype.removeListener = function(ev, fn) {
|
|
1892
|
-
var res = Stream.prototype.removeListener.call(this, ev, fn);
|
|
1893
|
-
if (ev === "readable") {
|
|
1894
|
-
process.nextTick(updateReadableListening, this);
|
|
1895
|
-
}
|
|
1896
|
-
return res;
|
|
1897
|
-
};
|
|
1898
|
-
Readable.prototype.removeAllListeners = function(ev) {
|
|
1899
|
-
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
|
|
1900
|
-
if (ev === "readable" || ev === undefined) {
|
|
1901
|
-
process.nextTick(updateReadableListening, this);
|
|
1902
|
-
}
|
|
1903
|
-
return res;
|
|
1904
|
-
};
|
|
1905
|
-
Readable.prototype.resume = function() {
|
|
1906
|
-
var state = this._readableState;
|
|
1907
|
-
if (!state.flowing) {
|
|
1908
|
-
debug("resume");
|
|
1909
|
-
state.flowing = !state.readableListening;
|
|
1910
|
-
resume(this, state);
|
|
1911
|
-
}
|
|
1912
|
-
state.paused = false;
|
|
1913
|
-
return this;
|
|
1914
|
-
};
|
|
1915
|
-
Readable.prototype.pause = function() {
|
|
1916
|
-
debug("call pause flowing=%j", this._readableState.flowing);
|
|
1917
|
-
if (this._readableState.flowing !== false) {
|
|
1918
|
-
debug("pause");
|
|
1919
|
-
this._readableState.flowing = false;
|
|
1920
|
-
this.emit("pause");
|
|
1921
|
-
}
|
|
1922
|
-
this._readableState.paused = true;
|
|
1923
|
-
return this;
|
|
1924
|
-
};
|
|
1925
|
-
Readable.prototype.wrap = function(stream) {
|
|
1926
|
-
var _this = this;
|
|
1927
|
-
var state = this._readableState;
|
|
1928
|
-
var paused = false;
|
|
1929
|
-
stream.on("end", function() {
|
|
1930
|
-
debug("wrapped end");
|
|
1931
|
-
if (state.decoder && !state.ended) {
|
|
1932
|
-
var chunk = state.decoder.end();
|
|
1933
|
-
if (chunk && chunk.length)
|
|
1934
|
-
_this.push(chunk);
|
|
1935
|
-
}
|
|
1936
|
-
_this.push(null);
|
|
1937
|
-
});
|
|
1938
|
-
stream.on("data", function(chunk) {
|
|
1939
|
-
debug("wrapped data");
|
|
1940
|
-
if (state.decoder)
|
|
1941
|
-
chunk = state.decoder.write(chunk);
|
|
1942
|
-
if (state.objectMode && (chunk === null || chunk === undefined))
|
|
1943
|
-
return;
|
|
1944
|
-
else if (!state.objectMode && (!chunk || !chunk.length))
|
|
1945
|
-
return;
|
|
1946
|
-
var ret = _this.push(chunk);
|
|
1947
|
-
if (!ret) {
|
|
1948
|
-
paused = true;
|
|
1949
|
-
stream.pause();
|
|
1950
|
-
}
|
|
1951
|
-
});
|
|
1952
|
-
for (var i in stream) {
|
|
1953
|
-
if (this[i] === undefined && typeof stream[i] === "function") {
|
|
1954
|
-
this[i] = function methodWrap(method) {
|
|
1955
|
-
return function methodWrapReturnFunction() {
|
|
1956
|
-
return stream[method].apply(stream, arguments);
|
|
1957
|
-
};
|
|
1958
|
-
}(i);
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
for (var n = 0;n < kProxyEvents.length; n++) {
|
|
1962
|
-
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
|
1963
|
-
}
|
|
1964
|
-
this._read = function(n2) {
|
|
1965
|
-
debug("wrapped _read", n2);
|
|
1966
|
-
if (paused) {
|
|
1967
|
-
paused = false;
|
|
1968
|
-
stream.resume();
|
|
1969
|
-
}
|
|
1970
|
-
};
|
|
1971
|
-
return this;
|
|
1972
|
-
};
|
|
1973
|
-
if (typeof Symbol === "function") {
|
|
1974
|
-
Readable.prototype[Symbol.asyncIterator] = function() {
|
|
1975
|
-
if (createReadableStreamAsyncIterator === undefined) {
|
|
1976
|
-
createReadableStreamAsyncIterator = require_async_iterator();
|
|
1977
|
-
}
|
|
1978
|
-
return createReadableStreamAsyncIterator(this);
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
|
|
1982
|
-
enumerable: false,
|
|
1983
|
-
get: function get() {
|
|
1984
|
-
return this._readableState.highWaterMark;
|
|
1985
|
-
}
|
|
1986
|
-
});
|
|
1987
|
-
Object.defineProperty(Readable.prototype, "readableBuffer", {
|
|
1988
|
-
enumerable: false,
|
|
1989
|
-
get: function get() {
|
|
1990
|
-
return this._readableState && this._readableState.buffer;
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
|
-
Object.defineProperty(Readable.prototype, "readableFlowing", {
|
|
1994
|
-
enumerable: false,
|
|
1995
|
-
get: function get() {
|
|
1996
|
-
return this._readableState.flowing;
|
|
1997
|
-
},
|
|
1998
|
-
set: function set(state) {
|
|
1999
|
-
if (this._readableState) {
|
|
2000
|
-
this._readableState.flowing = state;
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
});
|
|
2004
|
-
Readable._fromList = fromList;
|
|
2005
|
-
Object.defineProperty(Readable.prototype, "readableLength", {
|
|
2006
|
-
enumerable: false,
|
|
2007
|
-
get: function get() {
|
|
2008
|
-
return this._readableState.length;
|
|
2009
|
-
}
|
|
2010
|
-
});
|
|
2011
|
-
if (typeof Symbol === "function") {
|
|
2012
|
-
Readable.from = function(iterable, opts) {
|
|
2013
|
-
if (from === undefined) {
|
|
2014
|
-
from = require_from();
|
|
2015
|
-
}
|
|
2016
|
-
return from(Readable, iterable, opts);
|
|
2017
|
-
};
|
|
2018
|
-
}
|
|
2019
|
-
});
|
|
2020
|
-
|
|
2021
|
-
// ../../node_modules/readable-stream/lib/_stream_duplex.js
|
|
2022
|
-
var require__stream_duplex = __commonJS((exports, module) => {
|
|
2023
|
-
var Duplex = function(options) {
|
|
2024
|
-
if (!(this instanceof Duplex))
|
|
2025
|
-
return new Duplex(options);
|
|
2026
|
-
Readable.call(this, options);
|
|
2027
|
-
Writable.call(this, options);
|
|
2028
|
-
this.allowHalfOpen = true;
|
|
2029
|
-
if (options) {
|
|
2030
|
-
if (options.readable === false)
|
|
2031
|
-
this.readable = false;
|
|
2032
|
-
if (options.writable === false)
|
|
2033
|
-
this.writable = false;
|
|
2034
|
-
if (options.allowHalfOpen === false) {
|
|
2035
|
-
this.allowHalfOpen = false;
|
|
2036
|
-
this.once("end", onend);
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
};
|
|
2040
|
-
var onend = function() {
|
|
2041
|
-
if (this._writableState.ended)
|
|
2042
|
-
return;
|
|
2043
|
-
process.nextTick(onEndNT, this);
|
|
2044
|
-
};
|
|
2045
|
-
var onEndNT = function(self2) {
|
|
2046
|
-
self2.end();
|
|
2047
|
-
};
|
|
2048
|
-
var objectKeys = Object.keys || function(obj) {
|
|
2049
|
-
var keys2 = [];
|
|
2050
|
-
for (var key in obj)
|
|
2051
|
-
keys2.push(key);
|
|
2052
|
-
return keys2;
|
|
2053
|
-
};
|
|
2054
|
-
module.exports = Duplex;
|
|
2055
|
-
var Readable = require__stream_readable();
|
|
2056
|
-
var Writable = require__stream_writable();
|
|
2057
|
-
require_inherits()(Duplex, Readable);
|
|
2058
|
-
{
|
|
2059
|
-
keys = objectKeys(Writable.prototype);
|
|
2060
|
-
for (v = 0;v < keys.length; v++) {
|
|
2061
|
-
method = keys[v];
|
|
2062
|
-
if (!Duplex.prototype[method])
|
|
2063
|
-
Duplex.prototype[method] = Writable.prototype[method];
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
var keys;
|
|
2067
|
-
var method;
|
|
2068
|
-
var v;
|
|
2069
|
-
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
|
|
2070
|
-
enumerable: false,
|
|
2071
|
-
get: function get() {
|
|
2072
|
-
return this._writableState.highWaterMark;
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
Object.defineProperty(Duplex.prototype, "writableBuffer", {
|
|
2076
|
-
enumerable: false,
|
|
2077
|
-
get: function get() {
|
|
2078
|
-
return this._writableState && this._writableState.getBuffer();
|
|
2079
|
-
}
|
|
2080
|
-
});
|
|
2081
|
-
Object.defineProperty(Duplex.prototype, "writableLength", {
|
|
2082
|
-
enumerable: false,
|
|
2083
|
-
get: function get() {
|
|
2084
|
-
return this._writableState.length;
|
|
2085
|
-
}
|
|
2086
|
-
});
|
|
2087
|
-
Object.defineProperty(Duplex.prototype, "destroyed", {
|
|
2088
|
-
enumerable: false,
|
|
2089
|
-
get: function get() {
|
|
2090
|
-
if (this._readableState === undefined || this._writableState === undefined) {
|
|
2091
|
-
return false;
|
|
2092
|
-
}
|
|
2093
|
-
return this._readableState.destroyed && this._writableState.destroyed;
|
|
2094
|
-
},
|
|
2095
|
-
set: function set(value) {
|
|
2096
|
-
if (this._readableState === undefined || this._writableState === undefined) {
|
|
2097
|
-
return;
|
|
2098
|
-
}
|
|
2099
|
-
this._readableState.destroyed = value;
|
|
2100
|
-
this._writableState.destroyed = value;
|
|
2101
|
-
}
|
|
2102
|
-
});
|
|
2103
|
-
});
|
|
2104
|
-
|
|
2105
|
-
// ../../node_modules/util-deprecate/node.js
|
|
2106
|
-
var require_node = __commonJS((exports, module) => {
|
|
2107
|
-
module.exports = import.meta.require("util").deprecate;
|
|
2108
|
-
});
|
|
2109
|
-
|
|
2110
|
-
// ../../node_modules/readable-stream/lib/_stream_writable.js
|
|
2111
|
-
var require__stream_writable = __commonJS((exports, module) => {
|
|
2112
|
-
var CorkedRequest = function(state) {
|
|
2113
|
-
var _this = this;
|
|
2114
|
-
this.next = null;
|
|
2115
|
-
this.entry = null;
|
|
2116
|
-
this.finish = function() {
|
|
2117
|
-
onCorkedFinish(_this, state);
|
|
2118
|
-
};
|
|
2119
|
-
};
|
|
2120
|
-
var _uint8ArrayToBuffer = function(chunk) {
|
|
2121
|
-
return Buffer.from(chunk);
|
|
2122
|
-
};
|
|
2123
|
-
var _isUint8Array = function(obj) {
|
|
2124
|
-
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
2125
|
-
};
|
|
2126
|
-
var nop = function() {
|
|
2127
|
-
};
|
|
2128
|
-
var WritableState = function(options, stream, isDuplex) {
|
|
2129
|
-
Duplex = Duplex || require__stream_duplex();
|
|
2130
|
-
options = options || {};
|
|
2131
|
-
if (typeof isDuplex !== "boolean")
|
|
2132
|
-
isDuplex = stream instanceof Duplex;
|
|
2133
|
-
this.objectMode = !!options.objectMode;
|
|
2134
|
-
if (isDuplex)
|
|
2135
|
-
this.objectMode = this.objectMode || !!options.writableObjectMode;
|
|
2136
|
-
this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
|
|
2137
|
-
this.finalCalled = false;
|
|
2138
|
-
this.needDrain = false;
|
|
2139
|
-
this.ending = false;
|
|
2140
|
-
this.ended = false;
|
|
2141
|
-
this.finished = false;
|
|
2142
|
-
this.destroyed = false;
|
|
2143
|
-
var noDecode = options.decodeStrings === false;
|
|
2144
|
-
this.decodeStrings = !noDecode;
|
|
2145
|
-
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
2146
|
-
this.length = 0;
|
|
2147
|
-
this.writing = false;
|
|
2148
|
-
this.corked = 0;
|
|
2149
|
-
this.sync = true;
|
|
2150
|
-
this.bufferProcessing = false;
|
|
2151
|
-
this.onwrite = function(er) {
|
|
2152
|
-
onwrite(stream, er);
|
|
2153
|
-
};
|
|
2154
|
-
this.writecb = null;
|
|
2155
|
-
this.writelen = 0;
|
|
2156
|
-
this.bufferedRequest = null;
|
|
2157
|
-
this.lastBufferedRequest = null;
|
|
2158
|
-
this.pendingcb = 0;
|
|
2159
|
-
this.prefinished = false;
|
|
2160
|
-
this.errorEmitted = false;
|
|
2161
|
-
this.emitClose = options.emitClose !== false;
|
|
2162
|
-
this.autoDestroy = !!options.autoDestroy;
|
|
2163
|
-
this.bufferedRequestCount = 0;
|
|
2164
|
-
this.corkedRequestsFree = new CorkedRequest(this);
|
|
2165
|
-
};
|
|
2166
|
-
var Writable = function(options) {
|
|
2167
|
-
Duplex = Duplex || require__stream_duplex();
|
|
2168
|
-
var isDuplex = this instanceof Duplex;
|
|
2169
|
-
if (!isDuplex && !realHasInstance.call(Writable, this))
|
|
2170
|
-
return new Writable(options);
|
|
2171
|
-
this._writableState = new WritableState(options, this, isDuplex);
|
|
2172
|
-
this.writable = true;
|
|
2173
|
-
if (options) {
|
|
2174
|
-
if (typeof options.write === "function")
|
|
2175
|
-
this._write = options.write;
|
|
2176
|
-
if (typeof options.writev === "function")
|
|
2177
|
-
this._writev = options.writev;
|
|
2178
|
-
if (typeof options.destroy === "function")
|
|
2179
|
-
this._destroy = options.destroy;
|
|
2180
|
-
if (typeof options.final === "function")
|
|
2181
|
-
this._final = options.final;
|
|
2182
|
-
}
|
|
2183
|
-
Stream.call(this);
|
|
2184
|
-
};
|
|
2185
|
-
var writeAfterEnd = function(stream, cb) {
|
|
2186
|
-
var er = new ERR_STREAM_WRITE_AFTER_END;
|
|
2187
|
-
errorOrDestroy(stream, er);
|
|
2188
|
-
process.nextTick(cb, er);
|
|
2189
|
-
};
|
|
2190
|
-
var validChunk = function(stream, state, chunk, cb) {
|
|
2191
|
-
var er;
|
|
2192
|
-
if (chunk === null) {
|
|
2193
|
-
er = new ERR_STREAM_NULL_VALUES;
|
|
2194
|
-
} else if (typeof chunk !== "string" && !state.objectMode) {
|
|
2195
|
-
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
|
|
2196
|
-
}
|
|
2197
|
-
if (er) {
|
|
2198
|
-
errorOrDestroy(stream, er);
|
|
2199
|
-
process.nextTick(cb, er);
|
|
2200
|
-
return false;
|
|
2201
|
-
}
|
|
2202
|
-
return true;
|
|
2203
|
-
};
|
|
2204
|
-
var decodeChunk = function(state, chunk, encoding) {
|
|
2205
|
-
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
|
|
2206
|
-
chunk = Buffer.from(chunk, encoding);
|
|
2207
|
-
}
|
|
2208
|
-
return chunk;
|
|
2209
|
-
};
|
|
2210
|
-
var writeOrBuffer = function(stream, state, isBuf, chunk, encoding, cb) {
|
|
2211
|
-
if (!isBuf) {
|
|
2212
|
-
var newChunk = decodeChunk(state, chunk, encoding);
|
|
2213
|
-
if (chunk !== newChunk) {
|
|
2214
|
-
isBuf = true;
|
|
2215
|
-
encoding = "buffer";
|
|
2216
|
-
chunk = newChunk;
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
var len = state.objectMode ? 1 : chunk.length;
|
|
2220
|
-
state.length += len;
|
|
2221
|
-
var ret = state.length < state.highWaterMark;
|
|
2222
|
-
if (!ret)
|
|
2223
|
-
state.needDrain = true;
|
|
2224
|
-
if (state.writing || state.corked) {
|
|
2225
|
-
var last = state.lastBufferedRequest;
|
|
2226
|
-
state.lastBufferedRequest = {
|
|
2227
|
-
chunk,
|
|
2228
|
-
encoding,
|
|
2229
|
-
isBuf,
|
|
2230
|
-
callback: cb,
|
|
2231
|
-
next: null
|
|
2232
|
-
};
|
|
2233
|
-
if (last) {
|
|
2234
|
-
last.next = state.lastBufferedRequest;
|
|
2235
|
-
} else {
|
|
2236
|
-
state.bufferedRequest = state.lastBufferedRequest;
|
|
2237
|
-
}
|
|
2238
|
-
state.bufferedRequestCount += 1;
|
|
2239
|
-
} else {
|
|
2240
|
-
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
2241
|
-
}
|
|
2242
|
-
return ret;
|
|
2243
|
-
};
|
|
2244
|
-
var doWrite = function(stream, state, writev, len, chunk, encoding, cb) {
|
|
2245
|
-
state.writelen = len;
|
|
2246
|
-
state.writecb = cb;
|
|
2247
|
-
state.writing = true;
|
|
2248
|
-
state.sync = true;
|
|
2249
|
-
if (state.destroyed)
|
|
2250
|
-
state.onwrite(new ERR_STREAM_DESTROYED("write"));
|
|
2251
|
-
else if (writev)
|
|
2252
|
-
stream._writev(chunk, state.onwrite);
|
|
2253
|
-
else
|
|
2254
|
-
stream._write(chunk, encoding, state.onwrite);
|
|
2255
|
-
state.sync = false;
|
|
2256
|
-
};
|
|
2257
|
-
var onwriteError = function(stream, state, sync, er, cb) {
|
|
2258
|
-
--state.pendingcb;
|
|
2259
|
-
if (sync) {
|
|
2260
|
-
process.nextTick(cb, er);
|
|
2261
|
-
process.nextTick(finishMaybe, stream, state);
|
|
2262
|
-
stream._writableState.errorEmitted = true;
|
|
2263
|
-
errorOrDestroy(stream, er);
|
|
2264
|
-
} else {
|
|
2265
|
-
cb(er);
|
|
2266
|
-
stream._writableState.errorEmitted = true;
|
|
2267
|
-
errorOrDestroy(stream, er);
|
|
2268
|
-
finishMaybe(stream, state);
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
var onwriteStateUpdate = function(state) {
|
|
2272
|
-
state.writing = false;
|
|
2273
|
-
state.writecb = null;
|
|
2274
|
-
state.length -= state.writelen;
|
|
2275
|
-
state.writelen = 0;
|
|
2276
|
-
};
|
|
2277
|
-
var onwrite = function(stream, er) {
|
|
2278
|
-
var state = stream._writableState;
|
|
2279
|
-
var sync = state.sync;
|
|
2280
|
-
var cb = state.writecb;
|
|
2281
|
-
if (typeof cb !== "function")
|
|
2282
|
-
throw new ERR_MULTIPLE_CALLBACK;
|
|
2283
|
-
onwriteStateUpdate(state);
|
|
2284
|
-
if (er)
|
|
2285
|
-
onwriteError(stream, state, sync, er, cb);
|
|
2286
|
-
else {
|
|
2287
|
-
var finished = needFinish(state) || stream.destroyed;
|
|
2288
|
-
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
|
2289
|
-
clearBuffer(stream, state);
|
|
2290
|
-
}
|
|
2291
|
-
if (sync) {
|
|
2292
|
-
process.nextTick(afterWrite, stream, state, finished, cb);
|
|
2293
|
-
} else {
|
|
2294
|
-
afterWrite(stream, state, finished, cb);
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
};
|
|
2298
|
-
var afterWrite = function(stream, state, finished, cb) {
|
|
2299
|
-
if (!finished)
|
|
2300
|
-
onwriteDrain(stream, state);
|
|
2301
|
-
state.pendingcb--;
|
|
2302
|
-
cb();
|
|
2303
|
-
finishMaybe(stream, state);
|
|
2304
|
-
};
|
|
2305
|
-
var onwriteDrain = function(stream, state) {
|
|
2306
|
-
if (state.length === 0 && state.needDrain) {
|
|
2307
|
-
state.needDrain = false;
|
|
2308
|
-
stream.emit("drain");
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
var clearBuffer = function(stream, state) {
|
|
2312
|
-
state.bufferProcessing = true;
|
|
2313
|
-
var entry = state.bufferedRequest;
|
|
2314
|
-
if (stream._writev && entry && entry.next) {
|
|
2315
|
-
var l = state.bufferedRequestCount;
|
|
2316
|
-
var buffer = new Array(l);
|
|
2317
|
-
var holder = state.corkedRequestsFree;
|
|
2318
|
-
holder.entry = entry;
|
|
2319
|
-
var count = 0;
|
|
2320
|
-
var allBuffers = true;
|
|
2321
|
-
while (entry) {
|
|
2322
|
-
buffer[count] = entry;
|
|
2323
|
-
if (!entry.isBuf)
|
|
2324
|
-
allBuffers = false;
|
|
2325
|
-
entry = entry.next;
|
|
2326
|
-
count += 1;
|
|
2327
|
-
}
|
|
2328
|
-
buffer.allBuffers = allBuffers;
|
|
2329
|
-
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
|
|
2330
|
-
state.pendingcb++;
|
|
2331
|
-
state.lastBufferedRequest = null;
|
|
2332
|
-
if (holder.next) {
|
|
2333
|
-
state.corkedRequestsFree = holder.next;
|
|
2334
|
-
holder.next = null;
|
|
2335
|
-
} else {
|
|
2336
|
-
state.corkedRequestsFree = new CorkedRequest(state);
|
|
2337
|
-
}
|
|
2338
|
-
state.bufferedRequestCount = 0;
|
|
2339
|
-
} else {
|
|
2340
|
-
while (entry) {
|
|
2341
|
-
var chunk = entry.chunk;
|
|
2342
|
-
var encoding = entry.encoding;
|
|
2343
|
-
var cb = entry.callback;
|
|
2344
|
-
var len = state.objectMode ? 1 : chunk.length;
|
|
2345
|
-
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
2346
|
-
entry = entry.next;
|
|
2347
|
-
state.bufferedRequestCount--;
|
|
2348
|
-
if (state.writing) {
|
|
2349
|
-
break;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
if (entry === null)
|
|
2353
|
-
state.lastBufferedRequest = null;
|
|
2354
|
-
}
|
|
2355
|
-
state.bufferedRequest = entry;
|
|
2356
|
-
state.bufferProcessing = false;
|
|
2357
|
-
};
|
|
2358
|
-
var needFinish = function(state) {
|
|
2359
|
-
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
|
2360
|
-
};
|
|
2361
|
-
var callFinal = function(stream, state) {
|
|
2362
|
-
stream._final(function(err) {
|
|
2363
|
-
state.pendingcb--;
|
|
2364
|
-
if (err) {
|
|
2365
|
-
errorOrDestroy(stream, err);
|
|
2366
|
-
}
|
|
2367
|
-
state.prefinished = true;
|
|
2368
|
-
stream.emit("prefinish");
|
|
2369
|
-
finishMaybe(stream, state);
|
|
2370
|
-
});
|
|
2371
|
-
};
|
|
2372
|
-
var prefinish = function(stream, state) {
|
|
2373
|
-
if (!state.prefinished && !state.finalCalled) {
|
|
2374
|
-
if (typeof stream._final === "function" && !state.destroyed) {
|
|
2375
|
-
state.pendingcb++;
|
|
2376
|
-
state.finalCalled = true;
|
|
2377
|
-
process.nextTick(callFinal, stream, state);
|
|
2378
|
-
} else {
|
|
2379
|
-
state.prefinished = true;
|
|
2380
|
-
stream.emit("prefinish");
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
};
|
|
2384
|
-
var finishMaybe = function(stream, state) {
|
|
2385
|
-
var need = needFinish(state);
|
|
2386
|
-
if (need) {
|
|
2387
|
-
prefinish(stream, state);
|
|
2388
|
-
if (state.pendingcb === 0) {
|
|
2389
|
-
state.finished = true;
|
|
2390
|
-
stream.emit("finish");
|
|
2391
|
-
if (state.autoDestroy) {
|
|
2392
|
-
var rState = stream._readableState;
|
|
2393
|
-
if (!rState || rState.autoDestroy && rState.endEmitted) {
|
|
2394
|
-
stream.destroy();
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
return need;
|
|
2400
|
-
};
|
|
2401
|
-
var endWritable = function(stream, state, cb) {
|
|
2402
|
-
state.ending = true;
|
|
2403
|
-
finishMaybe(stream, state);
|
|
2404
|
-
if (cb) {
|
|
2405
|
-
if (state.finished)
|
|
2406
|
-
process.nextTick(cb);
|
|
2407
|
-
else
|
|
2408
|
-
stream.once("finish", cb);
|
|
2409
|
-
}
|
|
2410
|
-
state.ended = true;
|
|
2411
|
-
stream.writable = false;
|
|
2412
|
-
};
|
|
2413
|
-
var onCorkedFinish = function(corkReq, state, err) {
|
|
2414
|
-
var entry = corkReq.entry;
|
|
2415
|
-
corkReq.entry = null;
|
|
2416
|
-
while (entry) {
|
|
2417
|
-
var cb = entry.callback;
|
|
2418
|
-
state.pendingcb--;
|
|
2419
|
-
cb(err);
|
|
2420
|
-
entry = entry.next;
|
|
2421
|
-
}
|
|
2422
|
-
state.corkedRequestsFree.next = corkReq;
|
|
2423
|
-
};
|
|
2424
|
-
module.exports = Writable;
|
|
2425
|
-
var Duplex;
|
|
2426
|
-
Writable.WritableState = WritableState;
|
|
2427
|
-
var internalUtil = {
|
|
2428
|
-
deprecate: require_node()
|
|
2429
|
-
};
|
|
2430
|
-
var Stream = import.meta.require("stream");
|
|
2431
|
-
var Buffer = import.meta.require("buffer").Buffer;
|
|
2432
|
-
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
2433
|
-
};
|
|
2434
|
-
var destroyImpl = require_destroy();
|
|
2435
|
-
var _require = require_state();
|
|
2436
|
-
var getHighWaterMark = _require.getHighWaterMark;
|
|
2437
|
-
var _require$codes = require_errors().codes;
|
|
2438
|
-
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
|
|
2439
|
-
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
|
|
2440
|
-
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
|
|
2441
|
-
var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
|
|
2442
|
-
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
|
2443
|
-
var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
|
|
2444
|
-
var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
|
|
2445
|
-
var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
|
2446
|
-
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
2447
|
-
require_inherits()(Writable, Stream);
|
|
2448
|
-
WritableState.prototype.getBuffer = function getBuffer() {
|
|
2449
|
-
var current = this.bufferedRequest;
|
|
2450
|
-
var out = [];
|
|
2451
|
-
while (current) {
|
|
2452
|
-
out.push(current);
|
|
2453
|
-
current = current.next;
|
|
2454
|
-
}
|
|
2455
|
-
return out;
|
|
2456
|
-
};
|
|
2457
|
-
(function() {
|
|
2458
|
-
try {
|
|
2459
|
-
Object.defineProperty(WritableState.prototype, "buffer", {
|
|
2460
|
-
get: internalUtil.deprecate(function writableStateBufferGetter() {
|
|
2461
|
-
return this.getBuffer();
|
|
2462
|
-
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer " + "instead.", "DEP0003")
|
|
2463
|
-
});
|
|
2464
|
-
} catch (_) {
|
|
2465
|
-
}
|
|
2466
|
-
})();
|
|
2467
|
-
var realHasInstance;
|
|
2468
|
-
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
|
|
2469
|
-
realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
2470
|
-
Object.defineProperty(Writable, Symbol.hasInstance, {
|
|
2471
|
-
value: function value(object) {
|
|
2472
|
-
if (realHasInstance.call(this, object))
|
|
2473
|
-
return true;
|
|
2474
|
-
if (this !== Writable)
|
|
2475
|
-
return false;
|
|
2476
|
-
return object && object._writableState instanceof WritableState;
|
|
2477
|
-
}
|
|
2478
|
-
});
|
|
2479
|
-
} else {
|
|
2480
|
-
realHasInstance = function realHasInstance(object) {
|
|
2481
|
-
return object instanceof this;
|
|
2482
|
-
};
|
|
2483
|
-
}
|
|
2484
|
-
Writable.prototype.pipe = function() {
|
|
2485
|
-
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE);
|
|
2486
|
-
};
|
|
2487
|
-
Writable.prototype.write = function(chunk, encoding, cb) {
|
|
2488
|
-
var state = this._writableState;
|
|
2489
|
-
var ret = false;
|
|
2490
|
-
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
2491
|
-
if (isBuf && !Buffer.isBuffer(chunk)) {
|
|
2492
|
-
chunk = _uint8ArrayToBuffer(chunk);
|
|
2493
|
-
}
|
|
2494
|
-
if (typeof encoding === "function") {
|
|
2495
|
-
cb = encoding;
|
|
2496
|
-
encoding = null;
|
|
2497
|
-
}
|
|
2498
|
-
if (isBuf)
|
|
2499
|
-
encoding = "buffer";
|
|
2500
|
-
else if (!encoding)
|
|
2501
|
-
encoding = state.defaultEncoding;
|
|
2502
|
-
if (typeof cb !== "function")
|
|
2503
|
-
cb = nop;
|
|
2504
|
-
if (state.ending)
|
|
2505
|
-
writeAfterEnd(this, cb);
|
|
2506
|
-
else if (isBuf || validChunk(this, state, chunk, cb)) {
|
|
2507
|
-
state.pendingcb++;
|
|
2508
|
-
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
|
2509
|
-
}
|
|
2510
|
-
return ret;
|
|
2511
|
-
};
|
|
2512
|
-
Writable.prototype.cork = function() {
|
|
2513
|
-
this._writableState.corked++;
|
|
2514
|
-
};
|
|
2515
|
-
Writable.prototype.uncork = function() {
|
|
2516
|
-
var state = this._writableState;
|
|
2517
|
-
if (state.corked) {
|
|
2518
|
-
state.corked--;
|
|
2519
|
-
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)
|
|
2520
|
-
clearBuffer(this, state);
|
|
2521
|
-
}
|
|
2522
|
-
};
|
|
2523
|
-
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
2524
|
-
if (typeof encoding === "string")
|
|
2525
|
-
encoding = encoding.toLowerCase();
|
|
2526
|
-
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
|
|
2527
|
-
throw new ERR_UNKNOWN_ENCODING(encoding);
|
|
2528
|
-
this._writableState.defaultEncoding = encoding;
|
|
2529
|
-
return this;
|
|
2530
|
-
};
|
|
2531
|
-
Object.defineProperty(Writable.prototype, "writableBuffer", {
|
|
2532
|
-
enumerable: false,
|
|
2533
|
-
get: function get() {
|
|
2534
|
-
return this._writableState && this._writableState.getBuffer();
|
|
2535
|
-
}
|
|
2536
|
-
});
|
|
2537
|
-
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
|
|
2538
|
-
enumerable: false,
|
|
2539
|
-
get: function get() {
|
|
2540
|
-
return this._writableState.highWaterMark;
|
|
2541
|
-
}
|
|
2542
|
-
});
|
|
2543
|
-
Writable.prototype._write = function(chunk, encoding, cb) {
|
|
2544
|
-
cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
|
|
2545
|
-
};
|
|
2546
|
-
Writable.prototype._writev = null;
|
|
2547
|
-
Writable.prototype.end = function(chunk, encoding, cb) {
|
|
2548
|
-
var state = this._writableState;
|
|
2549
|
-
if (typeof chunk === "function") {
|
|
2550
|
-
cb = chunk;
|
|
2551
|
-
chunk = null;
|
|
2552
|
-
encoding = null;
|
|
2553
|
-
} else if (typeof encoding === "function") {
|
|
2554
|
-
cb = encoding;
|
|
2555
|
-
encoding = null;
|
|
2556
|
-
}
|
|
2557
|
-
if (chunk !== null && chunk !== undefined)
|
|
2558
|
-
this.write(chunk, encoding);
|
|
2559
|
-
if (state.corked) {
|
|
2560
|
-
state.corked = 1;
|
|
2561
|
-
this.uncork();
|
|
2562
|
-
}
|
|
2563
|
-
if (!state.ending)
|
|
2564
|
-
endWritable(this, state, cb);
|
|
2565
|
-
return this;
|
|
2566
|
-
};
|
|
2567
|
-
Object.defineProperty(Writable.prototype, "writableLength", {
|
|
2568
|
-
enumerable: false,
|
|
2569
|
-
get: function get() {
|
|
2570
|
-
return this._writableState.length;
|
|
2571
|
-
}
|
|
2572
|
-
});
|
|
2573
|
-
Object.defineProperty(Writable.prototype, "destroyed", {
|
|
2574
|
-
enumerable: false,
|
|
2575
|
-
get: function get() {
|
|
2576
|
-
if (this._writableState === undefined) {
|
|
2577
|
-
return false;
|
|
2578
|
-
}
|
|
2579
|
-
return this._writableState.destroyed;
|
|
2580
|
-
},
|
|
2581
|
-
set: function set(value) {
|
|
2582
|
-
if (!this._writableState) {
|
|
2583
|
-
return;
|
|
2584
|
-
}
|
|
2585
|
-
this._writableState.destroyed = value;
|
|
2586
|
-
}
|
|
2587
|
-
});
|
|
2588
|
-
Writable.prototype.destroy = destroyImpl.destroy;
|
|
2589
|
-
Writable.prototype._undestroy = destroyImpl.undestroy;
|
|
2590
|
-
Writable.prototype._destroy = function(err, cb) {
|
|
2591
|
-
cb(err);
|
|
2592
|
-
};
|
|
2593
|
-
});
|
|
2594
|
-
|
|
2595
|
-
// ../../node_modules/triple-beam/config/cli.js
|
|
2596
|
-
var require_cli = __commonJS((exports) => {
|
|
2597
|
-
exports.levels = {
|
|
2598
|
-
error: 0,
|
|
2599
|
-
warn: 1,
|
|
2600
|
-
help: 2,
|
|
2601
|
-
data: 3,
|
|
2602
|
-
info: 4,
|
|
2603
|
-
debug: 5,
|
|
2604
|
-
prompt: 6,
|
|
2605
|
-
verbose: 7,
|
|
2606
|
-
input: 8,
|
|
2607
|
-
silly: 9
|
|
2608
|
-
};
|
|
2609
|
-
exports.colors = {
|
|
2610
|
-
error: "red",
|
|
2611
|
-
warn: "yellow",
|
|
2612
|
-
help: "cyan",
|
|
2613
|
-
data: "grey",
|
|
2614
|
-
info: "green",
|
|
2615
|
-
debug: "blue",
|
|
2616
|
-
prompt: "grey",
|
|
2617
|
-
verbose: "cyan",
|
|
2618
|
-
input: "grey",
|
|
2619
|
-
silly: "magenta"
|
|
2620
|
-
};
|
|
2621
|
-
});
|
|
2622
|
-
|
|
2623
|
-
// ../../node_modules/triple-beam/config/npm.js
|
|
2624
|
-
var require_npm = __commonJS((exports) => {
|
|
2625
|
-
exports.levels = {
|
|
2626
|
-
error: 0,
|
|
2627
|
-
warn: 1,
|
|
2628
|
-
info: 2,
|
|
2629
|
-
http: 3,
|
|
2630
|
-
verbose: 4,
|
|
2631
|
-
debug: 5,
|
|
2632
|
-
silly: 6
|
|
2633
|
-
};
|
|
2634
|
-
exports.colors = {
|
|
2635
|
-
error: "red",
|
|
2636
|
-
warn: "yellow",
|
|
2637
|
-
info: "green",
|
|
2638
|
-
http: "green",
|
|
2639
|
-
verbose: "cyan",
|
|
2640
|
-
debug: "blue",
|
|
2641
|
-
silly: "magenta"
|
|
2642
|
-
};
|
|
2643
|
-
});
|
|
2644
|
-
|
|
2645
|
-
// ../../node_modules/triple-beam/config/syslog.js
|
|
2646
|
-
var require_syslog = __commonJS((exports) => {
|
|
2647
|
-
exports.levels = {
|
|
2648
|
-
emerg: 0,
|
|
2649
|
-
alert: 1,
|
|
2650
|
-
crit: 2,
|
|
2651
|
-
error: 3,
|
|
2652
|
-
warning: 4,
|
|
2653
|
-
notice: 5,
|
|
2654
|
-
info: 6,
|
|
2655
|
-
debug: 7
|
|
2656
|
-
};
|
|
2657
|
-
exports.colors = {
|
|
2658
|
-
emerg: "red",
|
|
2659
|
-
alert: "yellow",
|
|
2660
|
-
crit: "red",
|
|
2661
|
-
error: "red",
|
|
2662
|
-
warning: "red",
|
|
2663
|
-
notice: "yellow",
|
|
2664
|
-
info: "green",
|
|
2665
|
-
debug: "blue"
|
|
2666
|
-
};
|
|
2667
|
-
});
|
|
2668
|
-
|
|
2669
|
-
// ../../node_modules/triple-beam/config/index.js
|
|
2670
|
-
var require_config = __commonJS((exports) => {
|
|
2671
|
-
Object.defineProperty(exports, "cli", {
|
|
2672
|
-
value: require_cli()
|
|
2673
|
-
});
|
|
2674
|
-
Object.defineProperty(exports, "npm", {
|
|
2675
|
-
value: require_npm()
|
|
2676
|
-
});
|
|
2677
|
-
Object.defineProperty(exports, "syslog", {
|
|
2678
|
-
value: require_syslog()
|
|
2679
|
-
});
|
|
2680
|
-
});
|
|
2681
|
-
|
|
2682
|
-
// ../../node_modules/triple-beam/index.js
|
|
2683
|
-
var require_triple_beam = __commonJS((exports) => {
|
|
2684
|
-
Object.defineProperty(exports, "LEVEL", {
|
|
2685
|
-
value: Symbol.for("level")
|
|
2686
|
-
});
|
|
2687
|
-
Object.defineProperty(exports, "MESSAGE", {
|
|
2688
|
-
value: Symbol.for("message")
|
|
2689
|
-
});
|
|
2690
|
-
Object.defineProperty(exports, "SPLAT", {
|
|
2691
|
-
value: Symbol.for("splat")
|
|
2692
|
-
});
|
|
2693
|
-
Object.defineProperty(exports, "configs", {
|
|
2694
|
-
value: require_config()
|
|
2695
|
-
});
|
|
2696
|
-
});
|
|
2697
|
-
|
|
2698
|
-
// ../../node_modules/winston-transport/modern.js
|
|
2699
|
-
var require_modern = __commonJS((exports, module) => {
|
|
2700
|
-
var util = import.meta.require("util");
|
|
2701
|
-
var Writable = require__stream_writable();
|
|
2702
|
-
var { LEVEL } = require_triple_beam();
|
|
2703
|
-
var TransportStream = module.exports = function TransportStream(options = {}) {
|
|
2704
|
-
Writable.call(this, { objectMode: true, highWaterMark: options.highWaterMark });
|
|
2705
|
-
this.format = options.format;
|
|
2706
|
-
this.level = options.level;
|
|
2707
|
-
this.handleExceptions = options.handleExceptions;
|
|
2708
|
-
this.handleRejections = options.handleRejections;
|
|
2709
|
-
this.silent = options.silent;
|
|
2710
|
-
if (options.log)
|
|
2711
|
-
this.log = options.log;
|
|
2712
|
-
if (options.logv)
|
|
2713
|
-
this.logv = options.logv;
|
|
2714
|
-
if (options.close)
|
|
2715
|
-
this.close = options.close;
|
|
2716
|
-
this.once("pipe", (logger) => {
|
|
2717
|
-
this.levels = logger.levels;
|
|
2718
|
-
this.parent = logger;
|
|
2719
|
-
});
|
|
2720
|
-
this.once("unpipe", (src) => {
|
|
2721
|
-
if (src === this.parent) {
|
|
2722
|
-
this.parent = null;
|
|
2723
|
-
if (this.close) {
|
|
2724
|
-
this.close();
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
});
|
|
2728
|
-
};
|
|
2729
|
-
util.inherits(TransportStream, Writable);
|
|
2730
|
-
TransportStream.prototype._write = function _write(info, enc, callback) {
|
|
2731
|
-
if (this.silent || info.exception === true && !this.handleExceptions) {
|
|
2732
|
-
return callback(null);
|
|
2733
|
-
}
|
|
2734
|
-
const level = this.level || this.parent && this.parent.level;
|
|
2735
|
-
if (!level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
|
2736
|
-
if (info && !this.format) {
|
|
2737
|
-
return this.log(info, callback);
|
|
2738
|
-
}
|
|
2739
|
-
let errState;
|
|
2740
|
-
let transformed;
|
|
2741
|
-
try {
|
|
2742
|
-
transformed = this.format.transform(Object.assign({}, info), this.format.options);
|
|
2743
|
-
} catch (err) {
|
|
2744
|
-
errState = err;
|
|
2745
|
-
}
|
|
2746
|
-
if (errState || !transformed) {
|
|
2747
|
-
callback();
|
|
2748
|
-
if (errState)
|
|
2749
|
-
throw errState;
|
|
2750
|
-
return;
|
|
2751
|
-
}
|
|
2752
|
-
return this.log(transformed, callback);
|
|
2753
|
-
}
|
|
2754
|
-
this._writableState.sync = false;
|
|
2755
|
-
return callback(null);
|
|
2756
|
-
};
|
|
2757
|
-
TransportStream.prototype._writev = function _writev(chunks, callback) {
|
|
2758
|
-
if (this.logv) {
|
|
2759
|
-
const infos = chunks.filter(this._accept, this);
|
|
2760
|
-
if (!infos.length) {
|
|
2761
|
-
return callback(null);
|
|
2762
|
-
}
|
|
2763
|
-
return this.logv(infos, callback);
|
|
2764
|
-
}
|
|
2765
|
-
for (let i = 0;i < chunks.length; i++) {
|
|
2766
|
-
if (!this._accept(chunks[i]))
|
|
2767
|
-
continue;
|
|
2768
|
-
if (chunks[i].chunk && !this.format) {
|
|
2769
|
-
this.log(chunks[i].chunk, chunks[i].callback);
|
|
2770
|
-
continue;
|
|
2771
|
-
}
|
|
2772
|
-
let errState;
|
|
2773
|
-
let transformed;
|
|
2774
|
-
try {
|
|
2775
|
-
transformed = this.format.transform(Object.assign({}, chunks[i].chunk), this.format.options);
|
|
2776
|
-
} catch (err) {
|
|
2777
|
-
errState = err;
|
|
2778
|
-
}
|
|
2779
|
-
if (errState || !transformed) {
|
|
2780
|
-
chunks[i].callback();
|
|
2781
|
-
if (errState) {
|
|
2782
|
-
callback(null);
|
|
2783
|
-
throw errState;
|
|
2784
|
-
}
|
|
2785
|
-
} else {
|
|
2786
|
-
this.log(transformed, chunks[i].callback);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
return callback(null);
|
|
2790
|
-
};
|
|
2791
|
-
TransportStream.prototype._accept = function _accept(write) {
|
|
2792
|
-
const info = write.chunk;
|
|
2793
|
-
if (this.silent) {
|
|
2794
|
-
return false;
|
|
2795
|
-
}
|
|
2796
|
-
const level = this.level || this.parent && this.parent.level;
|
|
2797
|
-
if (info.exception === true || !level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
|
2798
|
-
if (this.handleExceptions || info.exception !== true) {
|
|
2799
|
-
return true;
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
|
-
return false;
|
|
2803
|
-
};
|
|
2804
|
-
TransportStream.prototype._nop = function _nop() {
|
|
2805
|
-
return;
|
|
2806
|
-
};
|
|
2807
|
-
});
|
|
2808
|
-
|
|
2809
|
-
// ../../node_modules/winston-transport/legacy.js
|
|
2810
|
-
var require_legacy = __commonJS((exports, module) => {
|
|
2811
|
-
var util = import.meta.require("util");
|
|
2812
|
-
var { LEVEL } = require_triple_beam();
|
|
2813
|
-
var TransportStream = require_modern();
|
|
2814
|
-
var LegacyTransportStream = module.exports = function LegacyTransportStream(options = {}) {
|
|
2815
|
-
TransportStream.call(this, options);
|
|
2816
|
-
if (!options.transport || typeof options.transport.log !== "function") {
|
|
2817
|
-
throw new Error("Invalid transport, must be an object with a log method.");
|
|
2818
|
-
}
|
|
2819
|
-
this.transport = options.transport;
|
|
2820
|
-
this.level = this.level || options.transport.level;
|
|
2821
|
-
this.handleExceptions = this.handleExceptions || options.transport.handleExceptions;
|
|
2822
|
-
this._deprecated();
|
|
2823
|
-
function transportError(err) {
|
|
2824
|
-
this.emit("error", err, this.transport);
|
|
2825
|
-
}
|
|
2826
|
-
if (!this.transport.__winstonError) {
|
|
2827
|
-
this.transport.__winstonError = transportError.bind(this);
|
|
2828
|
-
this.transport.on("error", this.transport.__winstonError);
|
|
2829
|
-
}
|
|
2830
|
-
};
|
|
2831
|
-
util.inherits(LegacyTransportStream, TransportStream);
|
|
2832
|
-
LegacyTransportStream.prototype._write = function _write(info, enc, callback) {
|
|
2833
|
-
if (this.silent || info.exception === true && !this.handleExceptions) {
|
|
2834
|
-
return callback(null);
|
|
2835
|
-
}
|
|
2836
|
-
if (!this.level || this.levels[this.level] >= this.levels[info[LEVEL]]) {
|
|
2837
|
-
this.transport.log(info[LEVEL], info.message, info, this._nop);
|
|
2838
|
-
}
|
|
2839
|
-
callback(null);
|
|
2840
|
-
};
|
|
2841
|
-
LegacyTransportStream.prototype._writev = function _writev(chunks, callback) {
|
|
2842
|
-
for (let i = 0;i < chunks.length; i++) {
|
|
2843
|
-
if (this._accept(chunks[i])) {
|
|
2844
|
-
this.transport.log(chunks[i].chunk[LEVEL], chunks[i].chunk.message, chunks[i].chunk, this._nop);
|
|
2845
|
-
chunks[i].callback();
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2848
|
-
return callback(null);
|
|
2849
|
-
};
|
|
2850
|
-
LegacyTransportStream.prototype._deprecated = function _deprecated() {
|
|
2851
|
-
console.error([
|
|
2852
|
-
`${this.transport.name} is a legacy winston transport. Consider upgrading: `,
|
|
2853
|
-
"- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"
|
|
2854
|
-
].join("\n"));
|
|
2855
|
-
};
|
|
2856
|
-
LegacyTransportStream.prototype.close = function close() {
|
|
2857
|
-
if (this.transport.close) {
|
|
2858
|
-
this.transport.close();
|
|
2859
|
-
}
|
|
2860
|
-
if (this.transport.__winstonError) {
|
|
2861
|
-
this.transport.removeListener("error", this.transport.__winstonError);
|
|
2862
|
-
this.transport.__winstonError = null;
|
|
2863
|
-
}
|
|
2864
|
-
};
|
|
2865
|
-
});
|
|
2866
|
-
|
|
2867
|
-
// ../../node_modules/winston-transport/index.js
|
|
2868
|
-
var require_winston_transport = __commonJS((exports, module) => {
|
|
2869
|
-
module.exports = require_modern();
|
|
2870
|
-
module.exports.LegacyTransportStream = require_legacy();
|
|
2871
|
-
});
|
|
2872
|
-
|
|
2873
2
|
// src/define-pylon.ts
|
|
2874
3
|
import {
|
|
2875
4
|
GraphQLError
|
|
@@ -2932,7 +61,7 @@ async function wrapFunctionsRecursively(obj, wrapper, that = null, selectionSet
|
|
|
2932
61
|
return await obj;
|
|
2933
62
|
}
|
|
2934
63
|
}
|
|
2935
|
-
|
|
64
|
+
function spreadFunctionArguments(fn) {
|
|
2936
65
|
return (otherArgs, c, info) => {
|
|
2937
66
|
const selections = arguments[1];
|
|
2938
67
|
let args = {};
|
|
@@ -2959,7 +88,7 @@ var spreadFunctionArguments = function(fn) {
|
|
|
2959
88
|
const result = wrapFunctionsRecursively(fn.call(that, ...orderedArgs), spreadFunctionArguments, this, selections);
|
|
2960
89
|
return result;
|
|
2961
90
|
};
|
|
2962
|
-
}
|
|
91
|
+
}
|
|
2963
92
|
var defineService = (plainResolvers, options) => {
|
|
2964
93
|
const typedPlainResolvers = plainResolvers;
|
|
2965
94
|
typedPlainResolvers.Query = {
|
|
@@ -3062,8 +191,8 @@ class ServiceError extends GraphQLError {
|
|
|
3062
191
|
import winston from "winston";
|
|
3063
192
|
|
|
3064
193
|
// src/logger/winston-sentry-transport.ts
|
|
3065
|
-
var import_winston_transport = __toESM(require_winston_transport(), 1);
|
|
3066
194
|
import * as Sentry2 from "@sentry/bun";
|
|
195
|
+
import TransportStream from "winston-transport";
|
|
3067
196
|
var DEFAULT_LEVELS_MAP = {
|
|
3068
197
|
silly: "debug" /* Debug */,
|
|
3069
198
|
verbose: "debug" /* Debug */,
|
|
@@ -3083,7 +212,7 @@ class ExtendedError extends Error {
|
|
|
3083
212
|
}
|
|
3084
213
|
}
|
|
3085
214
|
|
|
3086
|
-
class SentryTransport extends
|
|
215
|
+
class SentryTransport extends TransportStream {
|
|
3087
216
|
silent = false;
|
|
3088
217
|
levelsMap = {};
|
|
3089
218
|
constructor(opts) {
|
|
@@ -3425,4 +554,4 @@ export {
|
|
|
3425
554
|
ServiceError
|
|
3426
555
|
};
|
|
3427
556
|
|
|
3428
|
-
//# debugId=
|
|
557
|
+
//# debugId=1536EF647381168764756E2164756E21
|