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