@solana/web3.js 1.87.7 → 1.88.1
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/README.md +1 -1
- package/lib/index.browser.cjs.js +27 -13
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +27 -13
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +45 -1627
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +42 -1622
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +205 -589
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +7 -8
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +27 -13
- package/lib/index.native.js.map +1 -1
- package/package.json +29 -29
- package/src/connection.ts +4 -6
- package/src/programs/stake.ts +3 -3
- package/src/transaction/legacy.ts +37 -15
package/lib/index.esm.js
CHANGED
|
@@ -7,11 +7,9 @@ import { serialize, deserialize, deserializeUnchecked } from 'borsh';
|
|
|
7
7
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
8
8
|
import { blob } from '@solana/buffer-layout';
|
|
9
9
|
import { toBigIntLE, toBufferLE } from 'bigint-buffer';
|
|
10
|
-
import require$$0$1 from 'tty';
|
|
11
10
|
import require$$0 from 'util';
|
|
12
|
-
import require$$0$
|
|
13
|
-
import require$$0$
|
|
14
|
-
import require$$0$4, { Agent as Agent$1 } from 'https';
|
|
11
|
+
import require$$0$1 from 'http';
|
|
12
|
+
import require$$0$2, { Agent as Agent$1 } from 'https';
|
|
15
13
|
import { coerce, instance, string, tuple, literal, unknown, type, number, array, nullable, optional, boolean, record, union, create, any, assert as assert$1 } from 'superstruct';
|
|
16
14
|
import RpcClient from 'jayson/lib/client/browser';
|
|
17
15
|
import * as nodeFetch from 'node-fetch';
|
|
@@ -1151,6 +1149,8 @@ const VersionedMessage = {
|
|
|
1151
1149
|
}
|
|
1152
1150
|
};
|
|
1153
1151
|
|
|
1152
|
+
/** @internal */
|
|
1153
|
+
|
|
1154
1154
|
/**
|
|
1155
1155
|
* Transaction signature as base-58 encoded string
|
|
1156
1156
|
*/
|
|
@@ -1766,29 +1766,31 @@ class Transaction {
|
|
|
1766
1766
|
*
|
|
1767
1767
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1768
1768
|
*/
|
|
1769
|
-
verifySignatures(requireAllSignatures) {
|
|
1770
|
-
|
|
1769
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1770
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1771
|
+
return !signatureErrors;
|
|
1771
1772
|
}
|
|
1772
1773
|
|
|
1773
1774
|
/**
|
|
1774
1775
|
* @internal
|
|
1775
1776
|
*/
|
|
1776
|
-
|
|
1777
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1778
|
+
const errors = {};
|
|
1777
1779
|
for (const {
|
|
1778
1780
|
signature,
|
|
1779
1781
|
publicKey
|
|
1780
1782
|
} of this.signatures) {
|
|
1781
1783
|
if (signature === null) {
|
|
1782
1784
|
if (requireAllSignatures) {
|
|
1783
|
-
|
|
1785
|
+
(errors.missing ||= []).push(publicKey);
|
|
1784
1786
|
}
|
|
1785
1787
|
} else {
|
|
1786
|
-
if (!verify(signature,
|
|
1787
|
-
|
|
1788
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1789
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1788
1790
|
}
|
|
1789
1791
|
}
|
|
1790
1792
|
}
|
|
1791
|
-
return
|
|
1793
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1792
1794
|
}
|
|
1793
1795
|
|
|
1794
1796
|
/**
|
|
@@ -1807,8 +1809,18 @@ class Transaction {
|
|
|
1807
1809
|
verifySignatures: true
|
|
1808
1810
|
}, config);
|
|
1809
1811
|
const signData = this.serializeMessage();
|
|
1810
|
-
if (verifySignatures
|
|
1811
|
-
|
|
1812
|
+
if (verifySignatures) {
|
|
1813
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1814
|
+
if (sigErrors) {
|
|
1815
|
+
let errorMessage = 'Signature verification failed.';
|
|
1816
|
+
if (sigErrors.invalid) {
|
|
1817
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1818
|
+
}
|
|
1819
|
+
if (sigErrors.missing) {
|
|
1820
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1821
|
+
}
|
|
1822
|
+
throw new Error(errorMessage);
|
|
1823
|
+
}
|
|
1812
1824
|
}
|
|
1813
1825
|
return this._serialize(signData);
|
|
1814
1826
|
}
|
|
@@ -3275,7 +3287,7 @@ var y = d * 365.25;
|
|
|
3275
3287
|
* @api public
|
|
3276
3288
|
*/
|
|
3277
3289
|
|
|
3278
|
-
var ms$
|
|
3290
|
+
var ms$2 = function (val, options) {
|
|
3279
3291
|
options = options || {};
|
|
3280
3292
|
var type = typeof val;
|
|
3281
3293
|
if (type === 'string' && val.length > 0) {
|
|
@@ -3424,11 +3436,11 @@ function plural(ms, msAbs, n, name) {
|
|
|
3424
3436
|
*/
|
|
3425
3437
|
|
|
3426
3438
|
var util = require$$0;
|
|
3427
|
-
var ms$
|
|
3439
|
+
var ms$1 = ms$2;
|
|
3428
3440
|
|
|
3429
3441
|
var humanizeMs = function (t) {
|
|
3430
3442
|
if (typeof t === 'number') return t;
|
|
3431
|
-
var r = ms$
|
|
3443
|
+
var r = ms$1(t);
|
|
3432
3444
|
if (r === undefined) {
|
|
3433
3445
|
var err = new Error(util.format('humanize-ms(%j) result undefined', t));
|
|
3434
3446
|
console.warn(err.stack);
|
|
@@ -3436,1602 +3448,6 @@ var humanizeMs = function (t) {
|
|
|
3436
3448
|
return r;
|
|
3437
3449
|
};
|
|
3438
3450
|
|
|
3439
|
-
var src = {exports: {}};
|
|
3440
|
-
|
|
3441
|
-
var browser$1 = {exports: {}};
|
|
3442
|
-
|
|
3443
|
-
/**
|
|
3444
|
-
* Helpers.
|
|
3445
|
-
*/
|
|
3446
|
-
|
|
3447
|
-
var ms$1;
|
|
3448
|
-
var hasRequiredMs;
|
|
3449
|
-
|
|
3450
|
-
function requireMs () {
|
|
3451
|
-
if (hasRequiredMs) return ms$1;
|
|
3452
|
-
hasRequiredMs = 1;
|
|
3453
|
-
var s = 1000;
|
|
3454
|
-
var m = s * 60;
|
|
3455
|
-
var h = m * 60;
|
|
3456
|
-
var d = h * 24;
|
|
3457
|
-
var w = d * 7;
|
|
3458
|
-
var y = d * 365.25;
|
|
3459
|
-
|
|
3460
|
-
/**
|
|
3461
|
-
* Parse or format the given `val`.
|
|
3462
|
-
*
|
|
3463
|
-
* Options:
|
|
3464
|
-
*
|
|
3465
|
-
* - `long` verbose formatting [false]
|
|
3466
|
-
*
|
|
3467
|
-
* @param {String|Number} val
|
|
3468
|
-
* @param {Object} [options]
|
|
3469
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
3470
|
-
* @return {String|Number}
|
|
3471
|
-
* @api public
|
|
3472
|
-
*/
|
|
3473
|
-
|
|
3474
|
-
ms$1 = function(val, options) {
|
|
3475
|
-
options = options || {};
|
|
3476
|
-
var type = typeof val;
|
|
3477
|
-
if (type === 'string' && val.length > 0) {
|
|
3478
|
-
return parse(val);
|
|
3479
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
3480
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
3481
|
-
}
|
|
3482
|
-
throw new Error(
|
|
3483
|
-
'val is not a non-empty string or a valid number. val=' +
|
|
3484
|
-
JSON.stringify(val)
|
|
3485
|
-
);
|
|
3486
|
-
};
|
|
3487
|
-
|
|
3488
|
-
/**
|
|
3489
|
-
* Parse the given `str` and return milliseconds.
|
|
3490
|
-
*
|
|
3491
|
-
* @param {String} str
|
|
3492
|
-
* @return {Number}
|
|
3493
|
-
* @api private
|
|
3494
|
-
*/
|
|
3495
|
-
|
|
3496
|
-
function parse(str) {
|
|
3497
|
-
str = String(str);
|
|
3498
|
-
if (str.length > 100) {
|
|
3499
|
-
return;
|
|
3500
|
-
}
|
|
3501
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
3502
|
-
str
|
|
3503
|
-
);
|
|
3504
|
-
if (!match) {
|
|
3505
|
-
return;
|
|
3506
|
-
}
|
|
3507
|
-
var n = parseFloat(match[1]);
|
|
3508
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
3509
|
-
switch (type) {
|
|
3510
|
-
case 'years':
|
|
3511
|
-
case 'year':
|
|
3512
|
-
case 'yrs':
|
|
3513
|
-
case 'yr':
|
|
3514
|
-
case 'y':
|
|
3515
|
-
return n * y;
|
|
3516
|
-
case 'weeks':
|
|
3517
|
-
case 'week':
|
|
3518
|
-
case 'w':
|
|
3519
|
-
return n * w;
|
|
3520
|
-
case 'days':
|
|
3521
|
-
case 'day':
|
|
3522
|
-
case 'd':
|
|
3523
|
-
return n * d;
|
|
3524
|
-
case 'hours':
|
|
3525
|
-
case 'hour':
|
|
3526
|
-
case 'hrs':
|
|
3527
|
-
case 'hr':
|
|
3528
|
-
case 'h':
|
|
3529
|
-
return n * h;
|
|
3530
|
-
case 'minutes':
|
|
3531
|
-
case 'minute':
|
|
3532
|
-
case 'mins':
|
|
3533
|
-
case 'min':
|
|
3534
|
-
case 'm':
|
|
3535
|
-
return n * m;
|
|
3536
|
-
case 'seconds':
|
|
3537
|
-
case 'second':
|
|
3538
|
-
case 'secs':
|
|
3539
|
-
case 'sec':
|
|
3540
|
-
case 's':
|
|
3541
|
-
return n * s;
|
|
3542
|
-
case 'milliseconds':
|
|
3543
|
-
case 'millisecond':
|
|
3544
|
-
case 'msecs':
|
|
3545
|
-
case 'msec':
|
|
3546
|
-
case 'ms':
|
|
3547
|
-
return n;
|
|
3548
|
-
default:
|
|
3549
|
-
return undefined;
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
|
|
3553
|
-
/**
|
|
3554
|
-
* Short format for `ms`.
|
|
3555
|
-
*
|
|
3556
|
-
* @param {Number} ms
|
|
3557
|
-
* @return {String}
|
|
3558
|
-
* @api private
|
|
3559
|
-
*/
|
|
3560
|
-
|
|
3561
|
-
function fmtShort(ms) {
|
|
3562
|
-
var msAbs = Math.abs(ms);
|
|
3563
|
-
if (msAbs >= d) {
|
|
3564
|
-
return Math.round(ms / d) + 'd';
|
|
3565
|
-
}
|
|
3566
|
-
if (msAbs >= h) {
|
|
3567
|
-
return Math.round(ms / h) + 'h';
|
|
3568
|
-
}
|
|
3569
|
-
if (msAbs >= m) {
|
|
3570
|
-
return Math.round(ms / m) + 'm';
|
|
3571
|
-
}
|
|
3572
|
-
if (msAbs >= s) {
|
|
3573
|
-
return Math.round(ms / s) + 's';
|
|
3574
|
-
}
|
|
3575
|
-
return ms + 'ms';
|
|
3576
|
-
}
|
|
3577
|
-
|
|
3578
|
-
/**
|
|
3579
|
-
* Long format for `ms`.
|
|
3580
|
-
*
|
|
3581
|
-
* @param {Number} ms
|
|
3582
|
-
* @return {String}
|
|
3583
|
-
* @api private
|
|
3584
|
-
*/
|
|
3585
|
-
|
|
3586
|
-
function fmtLong(ms) {
|
|
3587
|
-
var msAbs = Math.abs(ms);
|
|
3588
|
-
if (msAbs >= d) {
|
|
3589
|
-
return plural(ms, msAbs, d, 'day');
|
|
3590
|
-
}
|
|
3591
|
-
if (msAbs >= h) {
|
|
3592
|
-
return plural(ms, msAbs, h, 'hour');
|
|
3593
|
-
}
|
|
3594
|
-
if (msAbs >= m) {
|
|
3595
|
-
return plural(ms, msAbs, m, 'minute');
|
|
3596
|
-
}
|
|
3597
|
-
if (msAbs >= s) {
|
|
3598
|
-
return plural(ms, msAbs, s, 'second');
|
|
3599
|
-
}
|
|
3600
|
-
return ms + ' ms';
|
|
3601
|
-
}
|
|
3602
|
-
|
|
3603
|
-
/**
|
|
3604
|
-
* Pluralization helper.
|
|
3605
|
-
*/
|
|
3606
|
-
|
|
3607
|
-
function plural(ms, msAbs, n, name) {
|
|
3608
|
-
var isPlural = msAbs >= n * 1.5;
|
|
3609
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
3610
|
-
}
|
|
3611
|
-
return ms$1;
|
|
3612
|
-
}
|
|
3613
|
-
|
|
3614
|
-
var common;
|
|
3615
|
-
var hasRequiredCommon;
|
|
3616
|
-
|
|
3617
|
-
function requireCommon () {
|
|
3618
|
-
if (hasRequiredCommon) return common;
|
|
3619
|
-
hasRequiredCommon = 1;
|
|
3620
|
-
/**
|
|
3621
|
-
* This is the common logic for both the Node.js and web browser
|
|
3622
|
-
* implementations of `debug()`.
|
|
3623
|
-
*/
|
|
3624
|
-
|
|
3625
|
-
function setup(env) {
|
|
3626
|
-
createDebug.debug = createDebug;
|
|
3627
|
-
createDebug.default = createDebug;
|
|
3628
|
-
createDebug.coerce = coerce;
|
|
3629
|
-
createDebug.disable = disable;
|
|
3630
|
-
createDebug.enable = enable;
|
|
3631
|
-
createDebug.enabled = enabled;
|
|
3632
|
-
createDebug.humanize = requireMs();
|
|
3633
|
-
createDebug.destroy = destroy;
|
|
3634
|
-
|
|
3635
|
-
Object.keys(env).forEach(key => {
|
|
3636
|
-
createDebug[key] = env[key];
|
|
3637
|
-
});
|
|
3638
|
-
|
|
3639
|
-
/**
|
|
3640
|
-
* The currently active debug mode names, and names to skip.
|
|
3641
|
-
*/
|
|
3642
|
-
|
|
3643
|
-
createDebug.names = [];
|
|
3644
|
-
createDebug.skips = [];
|
|
3645
|
-
|
|
3646
|
-
/**
|
|
3647
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
3648
|
-
*
|
|
3649
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
3650
|
-
*/
|
|
3651
|
-
createDebug.formatters = {};
|
|
3652
|
-
|
|
3653
|
-
/**
|
|
3654
|
-
* Selects a color for a debug namespace
|
|
3655
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
3656
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
3657
|
-
* @api private
|
|
3658
|
-
*/
|
|
3659
|
-
function selectColor(namespace) {
|
|
3660
|
-
let hash = 0;
|
|
3661
|
-
|
|
3662
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
3663
|
-
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
3664
|
-
hash |= 0; // Convert to 32bit integer
|
|
3665
|
-
}
|
|
3666
|
-
|
|
3667
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
3668
|
-
}
|
|
3669
|
-
createDebug.selectColor = selectColor;
|
|
3670
|
-
|
|
3671
|
-
/**
|
|
3672
|
-
* Create a debugger with the given `namespace`.
|
|
3673
|
-
*
|
|
3674
|
-
* @param {String} namespace
|
|
3675
|
-
* @return {Function}
|
|
3676
|
-
* @api public
|
|
3677
|
-
*/
|
|
3678
|
-
function createDebug(namespace) {
|
|
3679
|
-
let prevTime;
|
|
3680
|
-
let enableOverride = null;
|
|
3681
|
-
let namespacesCache;
|
|
3682
|
-
let enabledCache;
|
|
3683
|
-
|
|
3684
|
-
function debug(...args) {
|
|
3685
|
-
// Disabled?
|
|
3686
|
-
if (!debug.enabled) {
|
|
3687
|
-
return;
|
|
3688
|
-
}
|
|
3689
|
-
|
|
3690
|
-
const self = debug;
|
|
3691
|
-
|
|
3692
|
-
// Set `diff` timestamp
|
|
3693
|
-
const curr = Number(new Date());
|
|
3694
|
-
const ms = curr - (prevTime || curr);
|
|
3695
|
-
self.diff = ms;
|
|
3696
|
-
self.prev = prevTime;
|
|
3697
|
-
self.curr = curr;
|
|
3698
|
-
prevTime = curr;
|
|
3699
|
-
|
|
3700
|
-
args[0] = createDebug.coerce(args[0]);
|
|
3701
|
-
|
|
3702
|
-
if (typeof args[0] !== 'string') {
|
|
3703
|
-
// Anything else let's inspect with %O
|
|
3704
|
-
args.unshift('%O');
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
|
-
// Apply any `formatters` transformations
|
|
3708
|
-
let index = 0;
|
|
3709
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
3710
|
-
// If we encounter an escaped % then don't increase the array index
|
|
3711
|
-
if (match === '%%') {
|
|
3712
|
-
return '%';
|
|
3713
|
-
}
|
|
3714
|
-
index++;
|
|
3715
|
-
const formatter = createDebug.formatters[format];
|
|
3716
|
-
if (typeof formatter === 'function') {
|
|
3717
|
-
const val = args[index];
|
|
3718
|
-
match = formatter.call(self, val);
|
|
3719
|
-
|
|
3720
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
3721
|
-
args.splice(index, 1);
|
|
3722
|
-
index--;
|
|
3723
|
-
}
|
|
3724
|
-
return match;
|
|
3725
|
-
});
|
|
3726
|
-
|
|
3727
|
-
// Apply env-specific formatting (colors, etc.)
|
|
3728
|
-
createDebug.formatArgs.call(self, args);
|
|
3729
|
-
|
|
3730
|
-
const logFn = self.log || createDebug.log;
|
|
3731
|
-
logFn.apply(self, args);
|
|
3732
|
-
}
|
|
3733
|
-
|
|
3734
|
-
debug.namespace = namespace;
|
|
3735
|
-
debug.useColors = createDebug.useColors();
|
|
3736
|
-
debug.color = createDebug.selectColor(namespace);
|
|
3737
|
-
debug.extend = extend;
|
|
3738
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
3739
|
-
|
|
3740
|
-
Object.defineProperty(debug, 'enabled', {
|
|
3741
|
-
enumerable: true,
|
|
3742
|
-
configurable: false,
|
|
3743
|
-
get: () => {
|
|
3744
|
-
if (enableOverride !== null) {
|
|
3745
|
-
return enableOverride;
|
|
3746
|
-
}
|
|
3747
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
3748
|
-
namespacesCache = createDebug.namespaces;
|
|
3749
|
-
enabledCache = createDebug.enabled(namespace);
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
return enabledCache;
|
|
3753
|
-
},
|
|
3754
|
-
set: v => {
|
|
3755
|
-
enableOverride = v;
|
|
3756
|
-
}
|
|
3757
|
-
});
|
|
3758
|
-
|
|
3759
|
-
// Env-specific initialization logic for debug instances
|
|
3760
|
-
if (typeof createDebug.init === 'function') {
|
|
3761
|
-
createDebug.init(debug);
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
|
-
return debug;
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
function extend(namespace, delimiter) {
|
|
3768
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
3769
|
-
newDebug.log = this.log;
|
|
3770
|
-
return newDebug;
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3773
|
-
/**
|
|
3774
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
3775
|
-
* separated by a colon and wildcards.
|
|
3776
|
-
*
|
|
3777
|
-
* @param {String} namespaces
|
|
3778
|
-
* @api public
|
|
3779
|
-
*/
|
|
3780
|
-
function enable(namespaces) {
|
|
3781
|
-
createDebug.save(namespaces);
|
|
3782
|
-
createDebug.namespaces = namespaces;
|
|
3783
|
-
|
|
3784
|
-
createDebug.names = [];
|
|
3785
|
-
createDebug.skips = [];
|
|
3786
|
-
|
|
3787
|
-
let i;
|
|
3788
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
3789
|
-
const len = split.length;
|
|
3790
|
-
|
|
3791
|
-
for (i = 0; i < len; i++) {
|
|
3792
|
-
if (!split[i]) {
|
|
3793
|
-
// ignore empty strings
|
|
3794
|
-
continue;
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
3798
|
-
|
|
3799
|
-
if (namespaces[0] === '-') {
|
|
3800
|
-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
3801
|
-
} else {
|
|
3802
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
|
|
3807
|
-
/**
|
|
3808
|
-
* Disable debug output.
|
|
3809
|
-
*
|
|
3810
|
-
* @return {String} namespaces
|
|
3811
|
-
* @api public
|
|
3812
|
-
*/
|
|
3813
|
-
function disable() {
|
|
3814
|
-
const namespaces = [
|
|
3815
|
-
...createDebug.names.map(toNamespace),
|
|
3816
|
-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
3817
|
-
].join(',');
|
|
3818
|
-
createDebug.enable('');
|
|
3819
|
-
return namespaces;
|
|
3820
|
-
}
|
|
3821
|
-
|
|
3822
|
-
/**
|
|
3823
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
3824
|
-
*
|
|
3825
|
-
* @param {String} name
|
|
3826
|
-
* @return {Boolean}
|
|
3827
|
-
* @api public
|
|
3828
|
-
*/
|
|
3829
|
-
function enabled(name) {
|
|
3830
|
-
if (name[name.length - 1] === '*') {
|
|
3831
|
-
return true;
|
|
3832
|
-
}
|
|
3833
|
-
|
|
3834
|
-
let i;
|
|
3835
|
-
let len;
|
|
3836
|
-
|
|
3837
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
3838
|
-
if (createDebug.skips[i].test(name)) {
|
|
3839
|
-
return false;
|
|
3840
|
-
}
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
|
-
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
3844
|
-
if (createDebug.names[i].test(name)) {
|
|
3845
|
-
return true;
|
|
3846
|
-
}
|
|
3847
|
-
}
|
|
3848
|
-
|
|
3849
|
-
return false;
|
|
3850
|
-
}
|
|
3851
|
-
|
|
3852
|
-
/**
|
|
3853
|
-
* Convert regexp to namespace
|
|
3854
|
-
*
|
|
3855
|
-
* @param {RegExp} regxep
|
|
3856
|
-
* @return {String} namespace
|
|
3857
|
-
* @api private
|
|
3858
|
-
*/
|
|
3859
|
-
function toNamespace(regexp) {
|
|
3860
|
-
return regexp.toString()
|
|
3861
|
-
.substring(2, regexp.toString().length - 2)
|
|
3862
|
-
.replace(/\.\*\?$/, '*');
|
|
3863
|
-
}
|
|
3864
|
-
|
|
3865
|
-
/**
|
|
3866
|
-
* Coerce `val`.
|
|
3867
|
-
*
|
|
3868
|
-
* @param {Mixed} val
|
|
3869
|
-
* @return {Mixed}
|
|
3870
|
-
* @api private
|
|
3871
|
-
*/
|
|
3872
|
-
function coerce(val) {
|
|
3873
|
-
if (val instanceof Error) {
|
|
3874
|
-
return val.stack || val.message;
|
|
3875
|
-
}
|
|
3876
|
-
return val;
|
|
3877
|
-
}
|
|
3878
|
-
|
|
3879
|
-
/**
|
|
3880
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
3881
|
-
* XXX It WILL be removed in the next major release.
|
|
3882
|
-
*/
|
|
3883
|
-
function destroy() {
|
|
3884
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
|
-
createDebug.enable(createDebug.load());
|
|
3888
|
-
|
|
3889
|
-
return createDebug;
|
|
3890
|
-
}
|
|
3891
|
-
|
|
3892
|
-
common = setup;
|
|
3893
|
-
return common;
|
|
3894
|
-
}
|
|
3895
|
-
|
|
3896
|
-
/* eslint-env browser */
|
|
3897
|
-
|
|
3898
|
-
var hasRequiredBrowser$1;
|
|
3899
|
-
|
|
3900
|
-
function requireBrowser$1 () {
|
|
3901
|
-
if (hasRequiredBrowser$1) return browser$1.exports;
|
|
3902
|
-
hasRequiredBrowser$1 = 1;
|
|
3903
|
-
(function (module, exports) {
|
|
3904
|
-
/**
|
|
3905
|
-
* This is the web browser implementation of `debug()`.
|
|
3906
|
-
*/
|
|
3907
|
-
|
|
3908
|
-
exports.formatArgs = formatArgs;
|
|
3909
|
-
exports.save = save;
|
|
3910
|
-
exports.load = load;
|
|
3911
|
-
exports.useColors = useColors;
|
|
3912
|
-
exports.storage = localstorage();
|
|
3913
|
-
exports.destroy = (() => {
|
|
3914
|
-
let warned = false;
|
|
3915
|
-
|
|
3916
|
-
return () => {
|
|
3917
|
-
if (!warned) {
|
|
3918
|
-
warned = true;
|
|
3919
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
3920
|
-
}
|
|
3921
|
-
};
|
|
3922
|
-
})();
|
|
3923
|
-
|
|
3924
|
-
/**
|
|
3925
|
-
* Colors.
|
|
3926
|
-
*/
|
|
3927
|
-
|
|
3928
|
-
exports.colors = [
|
|
3929
|
-
'#0000CC',
|
|
3930
|
-
'#0000FF',
|
|
3931
|
-
'#0033CC',
|
|
3932
|
-
'#0033FF',
|
|
3933
|
-
'#0066CC',
|
|
3934
|
-
'#0066FF',
|
|
3935
|
-
'#0099CC',
|
|
3936
|
-
'#0099FF',
|
|
3937
|
-
'#00CC00',
|
|
3938
|
-
'#00CC33',
|
|
3939
|
-
'#00CC66',
|
|
3940
|
-
'#00CC99',
|
|
3941
|
-
'#00CCCC',
|
|
3942
|
-
'#00CCFF',
|
|
3943
|
-
'#3300CC',
|
|
3944
|
-
'#3300FF',
|
|
3945
|
-
'#3333CC',
|
|
3946
|
-
'#3333FF',
|
|
3947
|
-
'#3366CC',
|
|
3948
|
-
'#3366FF',
|
|
3949
|
-
'#3399CC',
|
|
3950
|
-
'#3399FF',
|
|
3951
|
-
'#33CC00',
|
|
3952
|
-
'#33CC33',
|
|
3953
|
-
'#33CC66',
|
|
3954
|
-
'#33CC99',
|
|
3955
|
-
'#33CCCC',
|
|
3956
|
-
'#33CCFF',
|
|
3957
|
-
'#6600CC',
|
|
3958
|
-
'#6600FF',
|
|
3959
|
-
'#6633CC',
|
|
3960
|
-
'#6633FF',
|
|
3961
|
-
'#66CC00',
|
|
3962
|
-
'#66CC33',
|
|
3963
|
-
'#9900CC',
|
|
3964
|
-
'#9900FF',
|
|
3965
|
-
'#9933CC',
|
|
3966
|
-
'#9933FF',
|
|
3967
|
-
'#99CC00',
|
|
3968
|
-
'#99CC33',
|
|
3969
|
-
'#CC0000',
|
|
3970
|
-
'#CC0033',
|
|
3971
|
-
'#CC0066',
|
|
3972
|
-
'#CC0099',
|
|
3973
|
-
'#CC00CC',
|
|
3974
|
-
'#CC00FF',
|
|
3975
|
-
'#CC3300',
|
|
3976
|
-
'#CC3333',
|
|
3977
|
-
'#CC3366',
|
|
3978
|
-
'#CC3399',
|
|
3979
|
-
'#CC33CC',
|
|
3980
|
-
'#CC33FF',
|
|
3981
|
-
'#CC6600',
|
|
3982
|
-
'#CC6633',
|
|
3983
|
-
'#CC9900',
|
|
3984
|
-
'#CC9933',
|
|
3985
|
-
'#CCCC00',
|
|
3986
|
-
'#CCCC33',
|
|
3987
|
-
'#FF0000',
|
|
3988
|
-
'#FF0033',
|
|
3989
|
-
'#FF0066',
|
|
3990
|
-
'#FF0099',
|
|
3991
|
-
'#FF00CC',
|
|
3992
|
-
'#FF00FF',
|
|
3993
|
-
'#FF3300',
|
|
3994
|
-
'#FF3333',
|
|
3995
|
-
'#FF3366',
|
|
3996
|
-
'#FF3399',
|
|
3997
|
-
'#FF33CC',
|
|
3998
|
-
'#FF33FF',
|
|
3999
|
-
'#FF6600',
|
|
4000
|
-
'#FF6633',
|
|
4001
|
-
'#FF9900',
|
|
4002
|
-
'#FF9933',
|
|
4003
|
-
'#FFCC00',
|
|
4004
|
-
'#FFCC33'
|
|
4005
|
-
];
|
|
4006
|
-
|
|
4007
|
-
/**
|
|
4008
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
4009
|
-
* and the Firebug extension (any Firefox version) are known
|
|
4010
|
-
* to support "%c" CSS customizations.
|
|
4011
|
-
*
|
|
4012
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
4013
|
-
*/
|
|
4014
|
-
|
|
4015
|
-
// eslint-disable-next-line complexity
|
|
4016
|
-
function useColors() {
|
|
4017
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
4018
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
4019
|
-
// explicitly
|
|
4020
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
4021
|
-
return true;
|
|
4022
|
-
}
|
|
4023
|
-
|
|
4024
|
-
// Internet Explorer and Edge do not support colors.
|
|
4025
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
4026
|
-
return false;
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4029
|
-
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
4030
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
4031
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
4032
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
4033
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
4034
|
-
// Is firefox >= v31?
|
|
4035
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
4036
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
4037
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
4038
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
4039
|
-
}
|
|
4040
|
-
|
|
4041
|
-
/**
|
|
4042
|
-
* Colorize log arguments if enabled.
|
|
4043
|
-
*
|
|
4044
|
-
* @api public
|
|
4045
|
-
*/
|
|
4046
|
-
|
|
4047
|
-
function formatArgs(args) {
|
|
4048
|
-
args[0] = (this.useColors ? '%c' : '') +
|
|
4049
|
-
this.namespace +
|
|
4050
|
-
(this.useColors ? ' %c' : ' ') +
|
|
4051
|
-
args[0] +
|
|
4052
|
-
(this.useColors ? '%c ' : ' ') +
|
|
4053
|
-
'+' + module.exports.humanize(this.diff);
|
|
4054
|
-
|
|
4055
|
-
if (!this.useColors) {
|
|
4056
|
-
return;
|
|
4057
|
-
}
|
|
4058
|
-
|
|
4059
|
-
const c = 'color: ' + this.color;
|
|
4060
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
4061
|
-
|
|
4062
|
-
// The final "%c" is somewhat tricky, because there could be other
|
|
4063
|
-
// arguments passed either before or after the %c, so we need to
|
|
4064
|
-
// figure out the correct index to insert the CSS into
|
|
4065
|
-
let index = 0;
|
|
4066
|
-
let lastC = 0;
|
|
4067
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
4068
|
-
if (match === '%%') {
|
|
4069
|
-
return;
|
|
4070
|
-
}
|
|
4071
|
-
index++;
|
|
4072
|
-
if (match === '%c') {
|
|
4073
|
-
// We only are interested in the *last* %c
|
|
4074
|
-
// (the user may have provided their own)
|
|
4075
|
-
lastC = index;
|
|
4076
|
-
}
|
|
4077
|
-
});
|
|
4078
|
-
|
|
4079
|
-
args.splice(lastC, 0, c);
|
|
4080
|
-
}
|
|
4081
|
-
|
|
4082
|
-
/**
|
|
4083
|
-
* Invokes `console.debug()` when available.
|
|
4084
|
-
* No-op when `console.debug` is not a "function".
|
|
4085
|
-
* If `console.debug` is not available, falls back
|
|
4086
|
-
* to `console.log`.
|
|
4087
|
-
*
|
|
4088
|
-
* @api public
|
|
4089
|
-
*/
|
|
4090
|
-
exports.log = console.debug || console.log || (() => {});
|
|
4091
|
-
|
|
4092
|
-
/**
|
|
4093
|
-
* Save `namespaces`.
|
|
4094
|
-
*
|
|
4095
|
-
* @param {String} namespaces
|
|
4096
|
-
* @api private
|
|
4097
|
-
*/
|
|
4098
|
-
function save(namespaces) {
|
|
4099
|
-
try {
|
|
4100
|
-
if (namespaces) {
|
|
4101
|
-
exports.storage.setItem('debug', namespaces);
|
|
4102
|
-
} else {
|
|
4103
|
-
exports.storage.removeItem('debug');
|
|
4104
|
-
}
|
|
4105
|
-
} catch (error) {
|
|
4106
|
-
// Swallow
|
|
4107
|
-
// XXX (@Qix-) should we be logging these?
|
|
4108
|
-
}
|
|
4109
|
-
}
|
|
4110
|
-
|
|
4111
|
-
/**
|
|
4112
|
-
* Load `namespaces`.
|
|
4113
|
-
*
|
|
4114
|
-
* @return {String} returns the previously persisted debug modes
|
|
4115
|
-
* @api private
|
|
4116
|
-
*/
|
|
4117
|
-
function load() {
|
|
4118
|
-
let r;
|
|
4119
|
-
try {
|
|
4120
|
-
r = exports.storage.getItem('debug');
|
|
4121
|
-
} catch (error) {
|
|
4122
|
-
// Swallow
|
|
4123
|
-
// XXX (@Qix-) should we be logging these?
|
|
4124
|
-
}
|
|
4125
|
-
|
|
4126
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
4127
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
4128
|
-
r = process.env.DEBUG;
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
|
-
return r;
|
|
4132
|
-
}
|
|
4133
|
-
|
|
4134
|
-
/**
|
|
4135
|
-
* Localstorage attempts to return the localstorage.
|
|
4136
|
-
*
|
|
4137
|
-
* This is necessary because safari throws
|
|
4138
|
-
* when a user disables cookies/localstorage
|
|
4139
|
-
* and you attempt to access it.
|
|
4140
|
-
*
|
|
4141
|
-
* @return {LocalStorage}
|
|
4142
|
-
* @api private
|
|
4143
|
-
*/
|
|
4144
|
-
|
|
4145
|
-
function localstorage() {
|
|
4146
|
-
try {
|
|
4147
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
4148
|
-
// The Browser also has localStorage in the global context.
|
|
4149
|
-
return localStorage;
|
|
4150
|
-
} catch (error) {
|
|
4151
|
-
// Swallow
|
|
4152
|
-
// XXX (@Qix-) should we be logging these?
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
4155
|
-
|
|
4156
|
-
module.exports = requireCommon()(exports);
|
|
4157
|
-
|
|
4158
|
-
const {formatters} = module.exports;
|
|
4159
|
-
|
|
4160
|
-
/**
|
|
4161
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
4162
|
-
*/
|
|
4163
|
-
|
|
4164
|
-
formatters.j = function (v) {
|
|
4165
|
-
try {
|
|
4166
|
-
return JSON.stringify(v);
|
|
4167
|
-
} catch (error) {
|
|
4168
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
4169
|
-
}
|
|
4170
|
-
};
|
|
4171
|
-
} (browser$1, browser$1.exports));
|
|
4172
|
-
return browser$1.exports;
|
|
4173
|
-
}
|
|
4174
|
-
|
|
4175
|
-
var node = {exports: {}};
|
|
4176
|
-
|
|
4177
|
-
/* eslint-env browser */
|
|
4178
|
-
|
|
4179
|
-
var browser;
|
|
4180
|
-
var hasRequiredBrowser;
|
|
4181
|
-
|
|
4182
|
-
function requireBrowser () {
|
|
4183
|
-
if (hasRequiredBrowser) return browser;
|
|
4184
|
-
hasRequiredBrowser = 1;
|
|
4185
|
-
|
|
4186
|
-
function getChromeVersion() {
|
|
4187
|
-
const matches = /(Chrome|Chromium)\/(?<chromeVersion>\d+)\./.exec(navigator.userAgent);
|
|
4188
|
-
|
|
4189
|
-
if (!matches) {
|
|
4190
|
-
return;
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
return Number.parseInt(matches.groups.chromeVersion, 10);
|
|
4194
|
-
}
|
|
4195
|
-
|
|
4196
|
-
const colorSupport = getChromeVersion() >= 69 ? {
|
|
4197
|
-
level: 1,
|
|
4198
|
-
hasBasic: true,
|
|
4199
|
-
has256: false,
|
|
4200
|
-
has16m: false
|
|
4201
|
-
} : false;
|
|
4202
|
-
|
|
4203
|
-
browser = {
|
|
4204
|
-
stdout: colorSupport,
|
|
4205
|
-
stderr: colorSupport
|
|
4206
|
-
};
|
|
4207
|
-
return browser;
|
|
4208
|
-
}
|
|
4209
|
-
|
|
4210
|
-
/**
|
|
4211
|
-
* Module dependencies.
|
|
4212
|
-
*/
|
|
4213
|
-
|
|
4214
|
-
var hasRequiredNode;
|
|
4215
|
-
|
|
4216
|
-
function requireNode () {
|
|
4217
|
-
if (hasRequiredNode) return node.exports;
|
|
4218
|
-
hasRequiredNode = 1;
|
|
4219
|
-
(function (module, exports) {
|
|
4220
|
-
const tty = require$$0$1;
|
|
4221
|
-
const util = require$$0;
|
|
4222
|
-
|
|
4223
|
-
/**
|
|
4224
|
-
* This is the Node.js implementation of `debug()`.
|
|
4225
|
-
*/
|
|
4226
|
-
|
|
4227
|
-
exports.init = init;
|
|
4228
|
-
exports.log = log;
|
|
4229
|
-
exports.formatArgs = formatArgs;
|
|
4230
|
-
exports.save = save;
|
|
4231
|
-
exports.load = load;
|
|
4232
|
-
exports.useColors = useColors;
|
|
4233
|
-
exports.destroy = util.deprecate(
|
|
4234
|
-
() => {},
|
|
4235
|
-
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
4236
|
-
);
|
|
4237
|
-
|
|
4238
|
-
/**
|
|
4239
|
-
* Colors.
|
|
4240
|
-
*/
|
|
4241
|
-
|
|
4242
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
4243
|
-
|
|
4244
|
-
try {
|
|
4245
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
4246
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4247
|
-
const supportsColor = requireBrowser();
|
|
4248
|
-
|
|
4249
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
4250
|
-
exports.colors = [
|
|
4251
|
-
20,
|
|
4252
|
-
21,
|
|
4253
|
-
26,
|
|
4254
|
-
27,
|
|
4255
|
-
32,
|
|
4256
|
-
33,
|
|
4257
|
-
38,
|
|
4258
|
-
39,
|
|
4259
|
-
40,
|
|
4260
|
-
41,
|
|
4261
|
-
42,
|
|
4262
|
-
43,
|
|
4263
|
-
44,
|
|
4264
|
-
45,
|
|
4265
|
-
56,
|
|
4266
|
-
57,
|
|
4267
|
-
62,
|
|
4268
|
-
63,
|
|
4269
|
-
68,
|
|
4270
|
-
69,
|
|
4271
|
-
74,
|
|
4272
|
-
75,
|
|
4273
|
-
76,
|
|
4274
|
-
77,
|
|
4275
|
-
78,
|
|
4276
|
-
79,
|
|
4277
|
-
80,
|
|
4278
|
-
81,
|
|
4279
|
-
92,
|
|
4280
|
-
93,
|
|
4281
|
-
98,
|
|
4282
|
-
99,
|
|
4283
|
-
112,
|
|
4284
|
-
113,
|
|
4285
|
-
128,
|
|
4286
|
-
129,
|
|
4287
|
-
134,
|
|
4288
|
-
135,
|
|
4289
|
-
148,
|
|
4290
|
-
149,
|
|
4291
|
-
160,
|
|
4292
|
-
161,
|
|
4293
|
-
162,
|
|
4294
|
-
163,
|
|
4295
|
-
164,
|
|
4296
|
-
165,
|
|
4297
|
-
166,
|
|
4298
|
-
167,
|
|
4299
|
-
168,
|
|
4300
|
-
169,
|
|
4301
|
-
170,
|
|
4302
|
-
171,
|
|
4303
|
-
172,
|
|
4304
|
-
173,
|
|
4305
|
-
178,
|
|
4306
|
-
179,
|
|
4307
|
-
184,
|
|
4308
|
-
185,
|
|
4309
|
-
196,
|
|
4310
|
-
197,
|
|
4311
|
-
198,
|
|
4312
|
-
199,
|
|
4313
|
-
200,
|
|
4314
|
-
201,
|
|
4315
|
-
202,
|
|
4316
|
-
203,
|
|
4317
|
-
204,
|
|
4318
|
-
205,
|
|
4319
|
-
206,
|
|
4320
|
-
207,
|
|
4321
|
-
208,
|
|
4322
|
-
209,
|
|
4323
|
-
214,
|
|
4324
|
-
215,
|
|
4325
|
-
220,
|
|
4326
|
-
221
|
|
4327
|
-
];
|
|
4328
|
-
}
|
|
4329
|
-
} catch (error) {
|
|
4330
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
4331
|
-
}
|
|
4332
|
-
|
|
4333
|
-
/**
|
|
4334
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
4335
|
-
*
|
|
4336
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
4337
|
-
*/
|
|
4338
|
-
|
|
4339
|
-
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
4340
|
-
return /^debug_/i.test(key);
|
|
4341
|
-
}).reduce((obj, key) => {
|
|
4342
|
-
// Camel-case
|
|
4343
|
-
const prop = key
|
|
4344
|
-
.substring(6)
|
|
4345
|
-
.toLowerCase()
|
|
4346
|
-
.replace(/_([a-z])/g, (_, k) => {
|
|
4347
|
-
return k.toUpperCase();
|
|
4348
|
-
});
|
|
4349
|
-
|
|
4350
|
-
// Coerce string value into JS value
|
|
4351
|
-
let val = process.env[key];
|
|
4352
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
4353
|
-
val = true;
|
|
4354
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
4355
|
-
val = false;
|
|
4356
|
-
} else if (val === 'null') {
|
|
4357
|
-
val = null;
|
|
4358
|
-
} else {
|
|
4359
|
-
val = Number(val);
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
obj[prop] = val;
|
|
4363
|
-
return obj;
|
|
4364
|
-
}, {});
|
|
4365
|
-
|
|
4366
|
-
/**
|
|
4367
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
4368
|
-
*/
|
|
4369
|
-
|
|
4370
|
-
function useColors() {
|
|
4371
|
-
return 'colors' in exports.inspectOpts ?
|
|
4372
|
-
Boolean(exports.inspectOpts.colors) :
|
|
4373
|
-
tty.isatty(process.stderr.fd);
|
|
4374
|
-
}
|
|
4375
|
-
|
|
4376
|
-
/**
|
|
4377
|
-
* Adds ANSI color escape codes if enabled.
|
|
4378
|
-
*
|
|
4379
|
-
* @api public
|
|
4380
|
-
*/
|
|
4381
|
-
|
|
4382
|
-
function formatArgs(args) {
|
|
4383
|
-
const {namespace: name, useColors} = this;
|
|
4384
|
-
|
|
4385
|
-
if (useColors) {
|
|
4386
|
-
const c = this.color;
|
|
4387
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
4388
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
4389
|
-
|
|
4390
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
4391
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
4392
|
-
} else {
|
|
4393
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
4394
|
-
}
|
|
4395
|
-
}
|
|
4396
|
-
|
|
4397
|
-
function getDate() {
|
|
4398
|
-
if (exports.inspectOpts.hideDate) {
|
|
4399
|
-
return '';
|
|
4400
|
-
}
|
|
4401
|
-
return new Date().toISOString() + ' ';
|
|
4402
|
-
}
|
|
4403
|
-
|
|
4404
|
-
/**
|
|
4405
|
-
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
4406
|
-
*/
|
|
4407
|
-
|
|
4408
|
-
function log(...args) {
|
|
4409
|
-
return process.stderr.write(util.format(...args) + '\n');
|
|
4410
|
-
}
|
|
4411
|
-
|
|
4412
|
-
/**
|
|
4413
|
-
* Save `namespaces`.
|
|
4414
|
-
*
|
|
4415
|
-
* @param {String} namespaces
|
|
4416
|
-
* @api private
|
|
4417
|
-
*/
|
|
4418
|
-
function save(namespaces) {
|
|
4419
|
-
if (namespaces) {
|
|
4420
|
-
process.env.DEBUG = namespaces;
|
|
4421
|
-
} else {
|
|
4422
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
4423
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
4424
|
-
delete process.env.DEBUG;
|
|
4425
|
-
}
|
|
4426
|
-
}
|
|
4427
|
-
|
|
4428
|
-
/**
|
|
4429
|
-
* Load `namespaces`.
|
|
4430
|
-
*
|
|
4431
|
-
* @return {String} returns the previously persisted debug modes
|
|
4432
|
-
* @api private
|
|
4433
|
-
*/
|
|
4434
|
-
|
|
4435
|
-
function load() {
|
|
4436
|
-
return process.env.DEBUG;
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4439
|
-
/**
|
|
4440
|
-
* Init logic for `debug` instances.
|
|
4441
|
-
*
|
|
4442
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
4443
|
-
* differently for a particular `debug` instance.
|
|
4444
|
-
*/
|
|
4445
|
-
|
|
4446
|
-
function init(debug) {
|
|
4447
|
-
debug.inspectOpts = {};
|
|
4448
|
-
|
|
4449
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
4450
|
-
for (let i = 0; i < keys.length; i++) {
|
|
4451
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
4452
|
-
}
|
|
4453
|
-
}
|
|
4454
|
-
|
|
4455
|
-
module.exports = requireCommon()(exports);
|
|
4456
|
-
|
|
4457
|
-
const {formatters} = module.exports;
|
|
4458
|
-
|
|
4459
|
-
/**
|
|
4460
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
4461
|
-
*/
|
|
4462
|
-
|
|
4463
|
-
formatters.o = function (v) {
|
|
4464
|
-
this.inspectOpts.colors = this.useColors;
|
|
4465
|
-
return util.inspect(v, this.inspectOpts)
|
|
4466
|
-
.split('\n')
|
|
4467
|
-
.map(str => str.trim())
|
|
4468
|
-
.join(' ');
|
|
4469
|
-
};
|
|
4470
|
-
|
|
4471
|
-
/**
|
|
4472
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
4473
|
-
*/
|
|
4474
|
-
|
|
4475
|
-
formatters.O = function (v) {
|
|
4476
|
-
this.inspectOpts.colors = this.useColors;
|
|
4477
|
-
return util.inspect(v, this.inspectOpts);
|
|
4478
|
-
};
|
|
4479
|
-
} (node, node.exports));
|
|
4480
|
-
return node.exports;
|
|
4481
|
-
}
|
|
4482
|
-
|
|
4483
|
-
/**
|
|
4484
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
4485
|
-
* treat as a browser.
|
|
4486
|
-
*/
|
|
4487
|
-
|
|
4488
|
-
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
4489
|
-
src.exports = requireBrowser$1();
|
|
4490
|
-
} else {
|
|
4491
|
-
src.exports = requireNode();
|
|
4492
|
-
}
|
|
4493
|
-
|
|
4494
|
-
var srcExports = src.exports;
|
|
4495
|
-
|
|
4496
|
-
/*!
|
|
4497
|
-
* depd
|
|
4498
|
-
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
4499
|
-
* MIT Licensed
|
|
4500
|
-
*/
|
|
4501
|
-
|
|
4502
|
-
/**
|
|
4503
|
-
* Module dependencies.
|
|
4504
|
-
*/
|
|
4505
|
-
|
|
4506
|
-
var relative = require$$0$2.relative;
|
|
4507
|
-
|
|
4508
|
-
/**
|
|
4509
|
-
* Module exports.
|
|
4510
|
-
*/
|
|
4511
|
-
|
|
4512
|
-
var depd_1 = depd;
|
|
4513
|
-
|
|
4514
|
-
/**
|
|
4515
|
-
* Get the path to base files on.
|
|
4516
|
-
*/
|
|
4517
|
-
|
|
4518
|
-
var basePath = process.cwd();
|
|
4519
|
-
|
|
4520
|
-
/**
|
|
4521
|
-
* Determine if namespace is contained in the string.
|
|
4522
|
-
*/
|
|
4523
|
-
|
|
4524
|
-
function containsNamespace (str, namespace) {
|
|
4525
|
-
var vals = str.split(/[ ,]+/);
|
|
4526
|
-
var ns = String(namespace).toLowerCase();
|
|
4527
|
-
|
|
4528
|
-
for (var i = 0; i < vals.length; i++) {
|
|
4529
|
-
var val = vals[i];
|
|
4530
|
-
|
|
4531
|
-
// namespace contained
|
|
4532
|
-
if (val && (val === '*' || val.toLowerCase() === ns)) {
|
|
4533
|
-
return true
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
|
|
4537
|
-
return false
|
|
4538
|
-
}
|
|
4539
|
-
|
|
4540
|
-
/**
|
|
4541
|
-
* Convert a data descriptor to accessor descriptor.
|
|
4542
|
-
*/
|
|
4543
|
-
|
|
4544
|
-
function convertDataDescriptorToAccessor (obj, prop, message) {
|
|
4545
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
4546
|
-
var value = descriptor.value;
|
|
4547
|
-
|
|
4548
|
-
descriptor.get = function getter () { return value };
|
|
4549
|
-
|
|
4550
|
-
if (descriptor.writable) {
|
|
4551
|
-
descriptor.set = function setter (val) { return (value = val) };
|
|
4552
|
-
}
|
|
4553
|
-
|
|
4554
|
-
delete descriptor.value;
|
|
4555
|
-
delete descriptor.writable;
|
|
4556
|
-
|
|
4557
|
-
Object.defineProperty(obj, prop, descriptor);
|
|
4558
|
-
|
|
4559
|
-
return descriptor
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
/**
|
|
4563
|
-
* Create arguments string to keep arity.
|
|
4564
|
-
*/
|
|
4565
|
-
|
|
4566
|
-
function createArgumentsString (arity) {
|
|
4567
|
-
var str = '';
|
|
4568
|
-
|
|
4569
|
-
for (var i = 0; i < arity; i++) {
|
|
4570
|
-
str += ', arg' + i;
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
return str.substr(2)
|
|
4574
|
-
}
|
|
4575
|
-
|
|
4576
|
-
/**
|
|
4577
|
-
* Create stack string from stack.
|
|
4578
|
-
*/
|
|
4579
|
-
|
|
4580
|
-
function createStackString (stack) {
|
|
4581
|
-
var str = this.name + ': ' + this.namespace;
|
|
4582
|
-
|
|
4583
|
-
if (this.message) {
|
|
4584
|
-
str += ' deprecated ' + this.message;
|
|
4585
|
-
}
|
|
4586
|
-
|
|
4587
|
-
for (var i = 0; i < stack.length; i++) {
|
|
4588
|
-
str += '\n at ' + stack[i].toString();
|
|
4589
|
-
}
|
|
4590
|
-
|
|
4591
|
-
return str
|
|
4592
|
-
}
|
|
4593
|
-
|
|
4594
|
-
/**
|
|
4595
|
-
* Create deprecate for namespace in caller.
|
|
4596
|
-
*/
|
|
4597
|
-
|
|
4598
|
-
function depd (namespace) {
|
|
4599
|
-
if (!namespace) {
|
|
4600
|
-
throw new TypeError('argument namespace is required')
|
|
4601
|
-
}
|
|
4602
|
-
|
|
4603
|
-
var stack = getStack();
|
|
4604
|
-
var site = callSiteLocation(stack[1]);
|
|
4605
|
-
var file = site[0];
|
|
4606
|
-
|
|
4607
|
-
function deprecate (message) {
|
|
4608
|
-
// call to self as log
|
|
4609
|
-
log.call(deprecate, message);
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4612
|
-
deprecate._file = file;
|
|
4613
|
-
deprecate._ignored = isignored(namespace);
|
|
4614
|
-
deprecate._namespace = namespace;
|
|
4615
|
-
deprecate._traced = istraced(namespace);
|
|
4616
|
-
deprecate._warned = Object.create(null);
|
|
4617
|
-
|
|
4618
|
-
deprecate.function = wrapfunction;
|
|
4619
|
-
deprecate.property = wrapproperty;
|
|
4620
|
-
|
|
4621
|
-
return deprecate
|
|
4622
|
-
}
|
|
4623
|
-
|
|
4624
|
-
/**
|
|
4625
|
-
* Determine if event emitter has listeners of a given type.
|
|
4626
|
-
*
|
|
4627
|
-
* The way to do this check is done three different ways in Node.js >= 0.8
|
|
4628
|
-
* so this consolidates them into a minimal set using instance methods.
|
|
4629
|
-
*
|
|
4630
|
-
* @param {EventEmitter} emitter
|
|
4631
|
-
* @param {string} type
|
|
4632
|
-
* @returns {boolean}
|
|
4633
|
-
* @private
|
|
4634
|
-
*/
|
|
4635
|
-
|
|
4636
|
-
function eehaslisteners (emitter, type) {
|
|
4637
|
-
var count = typeof emitter.listenerCount !== 'function'
|
|
4638
|
-
? emitter.listeners(type).length
|
|
4639
|
-
: emitter.listenerCount(type);
|
|
4640
|
-
|
|
4641
|
-
return count > 0
|
|
4642
|
-
}
|
|
4643
|
-
|
|
4644
|
-
/**
|
|
4645
|
-
* Determine if namespace is ignored.
|
|
4646
|
-
*/
|
|
4647
|
-
|
|
4648
|
-
function isignored (namespace) {
|
|
4649
|
-
if (process.noDeprecation) {
|
|
4650
|
-
// --no-deprecation support
|
|
4651
|
-
return true
|
|
4652
|
-
}
|
|
4653
|
-
|
|
4654
|
-
var str = process.env.NO_DEPRECATION || '';
|
|
4655
|
-
|
|
4656
|
-
// namespace ignored
|
|
4657
|
-
return containsNamespace(str, namespace)
|
|
4658
|
-
}
|
|
4659
|
-
|
|
4660
|
-
/**
|
|
4661
|
-
* Determine if namespace is traced.
|
|
4662
|
-
*/
|
|
4663
|
-
|
|
4664
|
-
function istraced (namespace) {
|
|
4665
|
-
if (process.traceDeprecation) {
|
|
4666
|
-
// --trace-deprecation support
|
|
4667
|
-
return true
|
|
4668
|
-
}
|
|
4669
|
-
|
|
4670
|
-
var str = process.env.TRACE_DEPRECATION || '';
|
|
4671
|
-
|
|
4672
|
-
// namespace traced
|
|
4673
|
-
return containsNamespace(str, namespace)
|
|
4674
|
-
}
|
|
4675
|
-
|
|
4676
|
-
/**
|
|
4677
|
-
* Display deprecation message.
|
|
4678
|
-
*/
|
|
4679
|
-
|
|
4680
|
-
function log (message, site) {
|
|
4681
|
-
var haslisteners = eehaslisteners(process, 'deprecation');
|
|
4682
|
-
|
|
4683
|
-
// abort early if no destination
|
|
4684
|
-
if (!haslisteners && this._ignored) {
|
|
4685
|
-
return
|
|
4686
|
-
}
|
|
4687
|
-
|
|
4688
|
-
var caller;
|
|
4689
|
-
var callFile;
|
|
4690
|
-
var callSite;
|
|
4691
|
-
var depSite;
|
|
4692
|
-
var i = 0;
|
|
4693
|
-
var seen = false;
|
|
4694
|
-
var stack = getStack();
|
|
4695
|
-
var file = this._file;
|
|
4696
|
-
|
|
4697
|
-
if (site) {
|
|
4698
|
-
// provided site
|
|
4699
|
-
depSite = site;
|
|
4700
|
-
callSite = callSiteLocation(stack[1]);
|
|
4701
|
-
callSite.name = depSite.name;
|
|
4702
|
-
file = callSite[0];
|
|
4703
|
-
} else {
|
|
4704
|
-
// get call site
|
|
4705
|
-
i = 2;
|
|
4706
|
-
depSite = callSiteLocation(stack[i]);
|
|
4707
|
-
callSite = depSite;
|
|
4708
|
-
}
|
|
4709
|
-
|
|
4710
|
-
// get caller of deprecated thing in relation to file
|
|
4711
|
-
for (; i < stack.length; i++) {
|
|
4712
|
-
caller = callSiteLocation(stack[i]);
|
|
4713
|
-
callFile = caller[0];
|
|
4714
|
-
|
|
4715
|
-
if (callFile === file) {
|
|
4716
|
-
seen = true;
|
|
4717
|
-
} else if (callFile === this._file) {
|
|
4718
|
-
file = this._file;
|
|
4719
|
-
} else if (seen) {
|
|
4720
|
-
break
|
|
4721
|
-
}
|
|
4722
|
-
}
|
|
4723
|
-
|
|
4724
|
-
var key = caller
|
|
4725
|
-
? depSite.join(':') + '__' + caller.join(':')
|
|
4726
|
-
: undefined;
|
|
4727
|
-
|
|
4728
|
-
if (key !== undefined && key in this._warned) {
|
|
4729
|
-
// already warned
|
|
4730
|
-
return
|
|
4731
|
-
}
|
|
4732
|
-
|
|
4733
|
-
this._warned[key] = true;
|
|
4734
|
-
|
|
4735
|
-
// generate automatic message from call site
|
|
4736
|
-
var msg = message;
|
|
4737
|
-
if (!msg) {
|
|
4738
|
-
msg = callSite === depSite || !callSite.name
|
|
4739
|
-
? defaultMessage(depSite)
|
|
4740
|
-
: defaultMessage(callSite);
|
|
4741
|
-
}
|
|
4742
|
-
|
|
4743
|
-
// emit deprecation if listeners exist
|
|
4744
|
-
if (haslisteners) {
|
|
4745
|
-
var err = DeprecationError(this._namespace, msg, stack.slice(i));
|
|
4746
|
-
process.emit('deprecation', err);
|
|
4747
|
-
return
|
|
4748
|
-
}
|
|
4749
|
-
|
|
4750
|
-
// format and write message
|
|
4751
|
-
var format = process.stderr.isTTY
|
|
4752
|
-
? formatColor
|
|
4753
|
-
: formatPlain;
|
|
4754
|
-
var output = format.call(this, msg, caller, stack.slice(i));
|
|
4755
|
-
process.stderr.write(output + '\n', 'utf8');
|
|
4756
|
-
}
|
|
4757
|
-
|
|
4758
|
-
/**
|
|
4759
|
-
* Get call site location as array.
|
|
4760
|
-
*/
|
|
4761
|
-
|
|
4762
|
-
function callSiteLocation (callSite) {
|
|
4763
|
-
var file = callSite.getFileName() || '<anonymous>';
|
|
4764
|
-
var line = callSite.getLineNumber();
|
|
4765
|
-
var colm = callSite.getColumnNumber();
|
|
4766
|
-
|
|
4767
|
-
if (callSite.isEval()) {
|
|
4768
|
-
file = callSite.getEvalOrigin() + ', ' + file;
|
|
4769
|
-
}
|
|
4770
|
-
|
|
4771
|
-
var site = [file, line, colm];
|
|
4772
|
-
|
|
4773
|
-
site.callSite = callSite;
|
|
4774
|
-
site.name = callSite.getFunctionName();
|
|
4775
|
-
|
|
4776
|
-
return site
|
|
4777
|
-
}
|
|
4778
|
-
|
|
4779
|
-
/**
|
|
4780
|
-
* Generate a default message from the site.
|
|
4781
|
-
*/
|
|
4782
|
-
|
|
4783
|
-
function defaultMessage (site) {
|
|
4784
|
-
var callSite = site.callSite;
|
|
4785
|
-
var funcName = site.name;
|
|
4786
|
-
|
|
4787
|
-
// make useful anonymous name
|
|
4788
|
-
if (!funcName) {
|
|
4789
|
-
funcName = '<anonymous@' + formatLocation(site) + '>';
|
|
4790
|
-
}
|
|
4791
|
-
|
|
4792
|
-
var context = callSite.getThis();
|
|
4793
|
-
var typeName = context && callSite.getTypeName();
|
|
4794
|
-
|
|
4795
|
-
// ignore useless type name
|
|
4796
|
-
if (typeName === 'Object') {
|
|
4797
|
-
typeName = undefined;
|
|
4798
|
-
}
|
|
4799
|
-
|
|
4800
|
-
// make useful type name
|
|
4801
|
-
if (typeName === 'Function') {
|
|
4802
|
-
typeName = context.name || typeName;
|
|
4803
|
-
}
|
|
4804
|
-
|
|
4805
|
-
return typeName && callSite.getMethodName()
|
|
4806
|
-
? typeName + '.' + funcName
|
|
4807
|
-
: funcName
|
|
4808
|
-
}
|
|
4809
|
-
|
|
4810
|
-
/**
|
|
4811
|
-
* Format deprecation message without color.
|
|
4812
|
-
*/
|
|
4813
|
-
|
|
4814
|
-
function formatPlain (msg, caller, stack) {
|
|
4815
|
-
var timestamp = new Date().toUTCString();
|
|
4816
|
-
|
|
4817
|
-
var formatted = timestamp +
|
|
4818
|
-
' ' + this._namespace +
|
|
4819
|
-
' deprecated ' + msg;
|
|
4820
|
-
|
|
4821
|
-
// add stack trace
|
|
4822
|
-
if (this._traced) {
|
|
4823
|
-
for (var i = 0; i < stack.length; i++) {
|
|
4824
|
-
formatted += '\n at ' + stack[i].toString();
|
|
4825
|
-
}
|
|
4826
|
-
|
|
4827
|
-
return formatted
|
|
4828
|
-
}
|
|
4829
|
-
|
|
4830
|
-
if (caller) {
|
|
4831
|
-
formatted += ' at ' + formatLocation(caller);
|
|
4832
|
-
}
|
|
4833
|
-
|
|
4834
|
-
return formatted
|
|
4835
|
-
}
|
|
4836
|
-
|
|
4837
|
-
/**
|
|
4838
|
-
* Format deprecation message with color.
|
|
4839
|
-
*/
|
|
4840
|
-
|
|
4841
|
-
function formatColor (msg, caller, stack) {
|
|
4842
|
-
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
|
|
4843
|
-
' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
|
|
4844
|
-
' \x1b[0m' + msg + '\x1b[39m'; // reset
|
|
4845
|
-
|
|
4846
|
-
// add stack trace
|
|
4847
|
-
if (this._traced) {
|
|
4848
|
-
for (var i = 0; i < stack.length; i++) {
|
|
4849
|
-
formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m'; // cyan
|
|
4850
|
-
}
|
|
4851
|
-
|
|
4852
|
-
return formatted
|
|
4853
|
-
}
|
|
4854
|
-
|
|
4855
|
-
if (caller) {
|
|
4856
|
-
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m'; // cyan
|
|
4857
|
-
}
|
|
4858
|
-
|
|
4859
|
-
return formatted
|
|
4860
|
-
}
|
|
4861
|
-
|
|
4862
|
-
/**
|
|
4863
|
-
* Format call site location.
|
|
4864
|
-
*/
|
|
4865
|
-
|
|
4866
|
-
function formatLocation (callSite) {
|
|
4867
|
-
return relative(basePath, callSite[0]) +
|
|
4868
|
-
':' + callSite[1] +
|
|
4869
|
-
':' + callSite[2]
|
|
4870
|
-
}
|
|
4871
|
-
|
|
4872
|
-
/**
|
|
4873
|
-
* Get the stack as array of call sites.
|
|
4874
|
-
*/
|
|
4875
|
-
|
|
4876
|
-
function getStack () {
|
|
4877
|
-
var limit = Error.stackTraceLimit;
|
|
4878
|
-
var obj = {};
|
|
4879
|
-
var prep = Error.prepareStackTrace;
|
|
4880
|
-
|
|
4881
|
-
Error.prepareStackTrace = prepareObjectStackTrace;
|
|
4882
|
-
Error.stackTraceLimit = Math.max(10, limit);
|
|
4883
|
-
|
|
4884
|
-
// capture the stack
|
|
4885
|
-
Error.captureStackTrace(obj);
|
|
4886
|
-
|
|
4887
|
-
// slice this function off the top
|
|
4888
|
-
var stack = obj.stack.slice(1);
|
|
4889
|
-
|
|
4890
|
-
Error.prepareStackTrace = prep;
|
|
4891
|
-
Error.stackTraceLimit = limit;
|
|
4892
|
-
|
|
4893
|
-
return stack
|
|
4894
|
-
}
|
|
4895
|
-
|
|
4896
|
-
/**
|
|
4897
|
-
* Capture call site stack from v8.
|
|
4898
|
-
*/
|
|
4899
|
-
|
|
4900
|
-
function prepareObjectStackTrace (obj, stack) {
|
|
4901
|
-
return stack
|
|
4902
|
-
}
|
|
4903
|
-
|
|
4904
|
-
/**
|
|
4905
|
-
* Return a wrapped function in a deprecation message.
|
|
4906
|
-
*/
|
|
4907
|
-
|
|
4908
|
-
function wrapfunction (fn, message) {
|
|
4909
|
-
if (typeof fn !== 'function') {
|
|
4910
|
-
throw new TypeError('argument fn must be a function')
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
var args = createArgumentsString(fn.length);
|
|
4914
|
-
var stack = getStack();
|
|
4915
|
-
var site = callSiteLocation(stack[1]);
|
|
4916
|
-
|
|
4917
|
-
site.name = fn.name;
|
|
4918
|
-
|
|
4919
|
-
// eslint-disable-next-line no-new-func
|
|
4920
|
-
var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
|
|
4921
|
-
'"use strict"\n' +
|
|
4922
|
-
'return function (' + args + ') {' +
|
|
4923
|
-
'log.call(deprecate, message, site)\n' +
|
|
4924
|
-
'return fn.apply(this, arguments)\n' +
|
|
4925
|
-
'}')(fn, log, this, message, site);
|
|
4926
|
-
|
|
4927
|
-
return deprecatedfn
|
|
4928
|
-
}
|
|
4929
|
-
|
|
4930
|
-
/**
|
|
4931
|
-
* Wrap property in a deprecation message.
|
|
4932
|
-
*/
|
|
4933
|
-
|
|
4934
|
-
function wrapproperty (obj, prop, message) {
|
|
4935
|
-
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
4936
|
-
throw new TypeError('argument obj must be object')
|
|
4937
|
-
}
|
|
4938
|
-
|
|
4939
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
4940
|
-
|
|
4941
|
-
if (!descriptor) {
|
|
4942
|
-
throw new TypeError('must call property on owner object')
|
|
4943
|
-
}
|
|
4944
|
-
|
|
4945
|
-
if (!descriptor.configurable) {
|
|
4946
|
-
throw new TypeError('property must be configurable')
|
|
4947
|
-
}
|
|
4948
|
-
|
|
4949
|
-
var deprecate = this;
|
|
4950
|
-
var stack = getStack();
|
|
4951
|
-
var site = callSiteLocation(stack[1]);
|
|
4952
|
-
|
|
4953
|
-
// set site name
|
|
4954
|
-
site.name = prop;
|
|
4955
|
-
|
|
4956
|
-
// convert data descriptor
|
|
4957
|
-
if ('value' in descriptor) {
|
|
4958
|
-
descriptor = convertDataDescriptorToAccessor(obj, prop);
|
|
4959
|
-
}
|
|
4960
|
-
|
|
4961
|
-
var get = descriptor.get;
|
|
4962
|
-
var set = descriptor.set;
|
|
4963
|
-
|
|
4964
|
-
// wrap getter
|
|
4965
|
-
if (typeof get === 'function') {
|
|
4966
|
-
descriptor.get = function getter () {
|
|
4967
|
-
log.call(deprecate, message, site);
|
|
4968
|
-
return get.apply(this, arguments)
|
|
4969
|
-
};
|
|
4970
|
-
}
|
|
4971
|
-
|
|
4972
|
-
// wrap setter
|
|
4973
|
-
if (typeof set === 'function') {
|
|
4974
|
-
descriptor.set = function setter () {
|
|
4975
|
-
log.call(deprecate, message, site);
|
|
4976
|
-
return set.apply(this, arguments)
|
|
4977
|
-
};
|
|
4978
|
-
}
|
|
4979
|
-
|
|
4980
|
-
Object.defineProperty(obj, prop, descriptor);
|
|
4981
|
-
}
|
|
4982
|
-
|
|
4983
|
-
/**
|
|
4984
|
-
* Create DeprecationError for deprecation
|
|
4985
|
-
*/
|
|
4986
|
-
|
|
4987
|
-
function DeprecationError (namespace, message, stack) {
|
|
4988
|
-
var error = new Error();
|
|
4989
|
-
var stackString;
|
|
4990
|
-
|
|
4991
|
-
Object.defineProperty(error, 'constructor', {
|
|
4992
|
-
value: DeprecationError
|
|
4993
|
-
});
|
|
4994
|
-
|
|
4995
|
-
Object.defineProperty(error, 'message', {
|
|
4996
|
-
configurable: true,
|
|
4997
|
-
enumerable: false,
|
|
4998
|
-
value: message,
|
|
4999
|
-
writable: true
|
|
5000
|
-
});
|
|
5001
|
-
|
|
5002
|
-
Object.defineProperty(error, 'name', {
|
|
5003
|
-
enumerable: false,
|
|
5004
|
-
configurable: true,
|
|
5005
|
-
value: 'DeprecationError',
|
|
5006
|
-
writable: true
|
|
5007
|
-
});
|
|
5008
|
-
|
|
5009
|
-
Object.defineProperty(error, 'namespace', {
|
|
5010
|
-
configurable: true,
|
|
5011
|
-
enumerable: false,
|
|
5012
|
-
value: namespace,
|
|
5013
|
-
writable: true
|
|
5014
|
-
});
|
|
5015
|
-
|
|
5016
|
-
Object.defineProperty(error, 'stack', {
|
|
5017
|
-
configurable: true,
|
|
5018
|
-
enumerable: false,
|
|
5019
|
-
get: function () {
|
|
5020
|
-
if (stackString !== undefined) {
|
|
5021
|
-
return stackString
|
|
5022
|
-
}
|
|
5023
|
-
|
|
5024
|
-
// prepare stack trace
|
|
5025
|
-
return (stackString = createStackString.call(this, stack))
|
|
5026
|
-
},
|
|
5027
|
-
set: function setter (val) {
|
|
5028
|
-
stackString = val;
|
|
5029
|
-
}
|
|
5030
|
-
});
|
|
5031
|
-
|
|
5032
|
-
return error
|
|
5033
|
-
}
|
|
5034
|
-
|
|
5035
3451
|
var constants = {
|
|
5036
3452
|
// agent
|
|
5037
3453
|
CURRENT_ID: Symbol('agentkeepalive#currentId'),
|
|
@@ -5045,10 +3461,9 @@ var constants = {
|
|
|
5045
3461
|
SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
|
|
5046
3462
|
};
|
|
5047
3463
|
|
|
5048
|
-
const OriginalAgent = require$$0$
|
|
3464
|
+
const OriginalAgent = require$$0$1.Agent;
|
|
5049
3465
|
const ms = humanizeMs;
|
|
5050
|
-
const debug =
|
|
5051
|
-
const deprecate = depd_1('agentkeepalive');
|
|
3466
|
+
const debug = require$$0.debuglog('agentkeepalive');
|
|
5052
3467
|
const {
|
|
5053
3468
|
INIT_SOCKET: INIT_SOCKET$1,
|
|
5054
3469
|
CURRENT_ID,
|
|
@@ -5072,6 +3487,10 @@ if (majorVersion >= 11 && majorVersion <= 12) {
|
|
|
5072
3487
|
defaultTimeoutListenerCount = 3;
|
|
5073
3488
|
}
|
|
5074
3489
|
|
|
3490
|
+
function deprecate(message) {
|
|
3491
|
+
console.log('[agentkeepalive:deprecated] %s', message);
|
|
3492
|
+
}
|
|
3493
|
+
|
|
5075
3494
|
class Agent extends OriginalAgent {
|
|
5076
3495
|
constructor(options) {
|
|
5077
3496
|
options = options || {};
|
|
@@ -5275,6 +3694,7 @@ class Agent extends OriginalAgent {
|
|
|
5275
3694
|
|
|
5276
3695
|
const newSocket = super.createConnection(options, onNewCreate);
|
|
5277
3696
|
if (newSocket) onNewCreate(null, newSocket);
|
|
3697
|
+
return newSocket;
|
|
5278
3698
|
}
|
|
5279
3699
|
|
|
5280
3700
|
get statusChanged() {
|
|
@@ -5442,7 +3862,7 @@ function inspect(obj) {
|
|
|
5442
3862
|
return res;
|
|
5443
3863
|
}
|
|
5444
3864
|
|
|
5445
|
-
const OriginalHttpsAgent = require$$0$
|
|
3865
|
+
const OriginalHttpsAgent = require$$0$2.Agent;
|
|
5446
3866
|
const HttpAgent = agent;
|
|
5447
3867
|
const {
|
|
5448
3868
|
INIT_SOCKET,
|
|
@@ -5467,8 +3887,8 @@ let HttpsAgent$1 = class HttpsAgent extends HttpAgent {
|
|
|
5467
3887
|
};
|
|
5468
3888
|
}
|
|
5469
3889
|
|
|
5470
|
-
createConnection(options) {
|
|
5471
|
-
const socket = this[CREATE_HTTPS_CONNECTION](options);
|
|
3890
|
+
createConnection(options, oncreate) {
|
|
3891
|
+
const socket = this[CREATE_HTTPS_CONNECTION](options, oncreate);
|
|
5472
3892
|
this[INIT_SOCKET](socket, options);
|
|
5473
3893
|
return socket;
|
|
5474
3894
|
}
|
|
@@ -7357,7 +5777,7 @@ const LogsNotificationResult = type({
|
|
|
7357
5777
|
|
|
7358
5778
|
/** @internal */
|
|
7359
5779
|
const COMMON_HTTP_HEADERS = {
|
|
7360
|
-
'solana-client': `js/${"1.
|
|
5780
|
+
'solana-client': `js/${"1.88.1" }`
|
|
7361
5781
|
};
|
|
7362
5782
|
|
|
7363
5783
|
/**
|
|
@@ -11558,7 +9978,7 @@ class StakeProgram {
|
|
|
11558
9978
|
if (custodianPubkey) {
|
|
11559
9979
|
keys.push({
|
|
11560
9980
|
pubkey: custodianPubkey,
|
|
11561
|
-
isSigner:
|
|
9981
|
+
isSigner: true,
|
|
11562
9982
|
isWritable: false
|
|
11563
9983
|
});
|
|
11564
9984
|
}
|
|
@@ -11606,7 +10026,7 @@ class StakeProgram {
|
|
|
11606
10026
|
if (custodianPubkey) {
|
|
11607
10027
|
keys.push({
|
|
11608
10028
|
pubkey: custodianPubkey,
|
|
11609
|
-
isSigner:
|
|
10029
|
+
isSigner: true,
|
|
11610
10030
|
isWritable: false
|
|
11611
10031
|
});
|
|
11612
10032
|
}
|
|
@@ -11771,7 +10191,7 @@ class StakeProgram {
|
|
|
11771
10191
|
if (custodianPubkey) {
|
|
11772
10192
|
keys.push({
|
|
11773
10193
|
pubkey: custodianPubkey,
|
|
11774
|
-
isSigner:
|
|
10194
|
+
isSigner: true,
|
|
11775
10195
|
isWritable: false
|
|
11776
10196
|
});
|
|
11777
10197
|
}
|