qs 6.10.4 → 6.10.6
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/.eslintrc +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +9 -3
- package/dist/qs.js +726 -192
- package/lib/parse.js +4 -4
- package/lib/stringify.js +5 -3
- package/lib/utils.js +7 -7
- package/package.json +1 -1
- package/test/stringify.js +28 -11
package/dist/qs.js
CHANGED
|
@@ -90,7 +90,7 @@ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
|
90
90
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
91
91
|
var obj = {};
|
|
92
92
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
93
|
-
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
93
|
+
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
|
94
94
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
95
95
|
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
96
96
|
var i;
|
|
@@ -215,7 +215,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
keys.
|
|
218
|
+
keys[keys.length] = parent;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// Loop through children appending to the array until we hit depth
|
|
@@ -228,13 +228,13 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
|
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
keys.
|
|
231
|
+
keys[keys.length] = segment[1];
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
// If there's a remainder, just add whatever is left
|
|
235
235
|
|
|
236
236
|
if (segment) {
|
|
237
|
-
keys.
|
|
237
|
+
keys[keys.length] = '[' + key.slice(segment.index + ']');
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
return parseObject(keys, val, options, valuesParsed);
|
|
@@ -430,7 +430,7 @@ var stringify = function stringify(
|
|
|
430
430
|
for (var i = 0; i < valuesArray.length; ++i) {
|
|
431
431
|
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
432
432
|
}
|
|
433
|
-
return [formatter(keyValue) + (
|
|
433
|
+
return [formatter(keyValue) + (isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
|
434
434
|
}
|
|
435
435
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
436
436
|
}
|
|
@@ -454,6 +454,8 @@ var stringify = function stringify(
|
|
|
454
454
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
+
var adjustedPrefix = generateArrayPrefix === 'comma' && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
|
458
|
+
|
|
457
459
|
for (var j = 0; j < objKeys.length; ++j) {
|
|
458
460
|
var key = objKeys[j];
|
|
459
461
|
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
@@ -463,8 +465,8 @@ var stringify = function stringify(
|
|
|
463
465
|
}
|
|
464
466
|
|
|
465
467
|
var keyPrefix = isArray(obj)
|
|
466
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(
|
|
467
|
-
:
|
|
468
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
|
469
|
+
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
468
470
|
|
|
469
471
|
sideChannel.set(object, step);
|
|
470
472
|
var valueSideChannel = getSideChannel();
|
|
@@ -620,7 +622,7 @@ module.exports = function (object, opts) {
|
|
|
620
622
|
return joined.length > 0 ? prefix + joined : '';
|
|
621
623
|
};
|
|
622
624
|
|
|
623
|
-
},{"./formats":1,"./utils":5,"side-channel":
|
|
625
|
+
},{"./formats":1,"./utils":5,"side-channel":46}],5:[function(require,module,exports){
|
|
624
626
|
'use strict';
|
|
625
627
|
|
|
626
628
|
var formats = require('./formats');
|
|
@@ -631,7 +633,7 @@ var isArray = Array.isArray;
|
|
|
631
633
|
var hexTable = (function () {
|
|
632
634
|
var array = [];
|
|
633
635
|
for (var i = 0; i < 256; ++i) {
|
|
634
|
-
array.
|
|
636
|
+
array[array.length] = '%' + ((i < 16 ? '0' : '' + i.toString(16)).toUpperCase());
|
|
635
637
|
}
|
|
636
638
|
|
|
637
639
|
return array;
|
|
@@ -647,7 +649,7 @@ var compactQueue = function compactQueue(queue) {
|
|
|
647
649
|
|
|
648
650
|
for (var j = 0; j < obj.length; ++j) {
|
|
649
651
|
if (typeof obj[j] !== 'undefined') {
|
|
650
|
-
compacted.
|
|
652
|
+
compacted[compacted.length] = obj[j];
|
|
651
653
|
}
|
|
652
654
|
}
|
|
653
655
|
|
|
@@ -675,7 +677,7 @@ var merge = function merge(target, source, options) {
|
|
|
675
677
|
|
|
676
678
|
if (typeof source !== 'object') {
|
|
677
679
|
if (isArray(target)) {
|
|
678
|
-
target.
|
|
680
|
+
target[target.length] = source;
|
|
679
681
|
} else if (target && typeof target === 'object') {
|
|
680
682
|
if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
|
|
681
683
|
target[source] = true;
|
|
@@ -703,7 +705,7 @@ var merge = function merge(target, source, options) {
|
|
|
703
705
|
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
704
706
|
target[i] = merge(targetItem, item, options);
|
|
705
707
|
} else {
|
|
706
|
-
target.
|
|
708
|
+
target[target.length] = item;
|
|
707
709
|
}
|
|
708
710
|
} else {
|
|
709
711
|
target[i] = item;
|
|
@@ -823,8 +825,8 @@ var compact = function compact(value) {
|
|
|
823
825
|
var key = keys[j];
|
|
824
826
|
var val = obj[key];
|
|
825
827
|
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
826
|
-
queue.
|
|
827
|
-
refs.
|
|
828
|
+
queue[queue.length] = { obj: obj, prop: key };
|
|
829
|
+
refs[refs.length] = val;
|
|
828
830
|
}
|
|
829
831
|
}
|
|
830
832
|
}
|
|
@@ -854,7 +856,7 @@ var maybeMap = function maybeMap(val, fn) {
|
|
|
854
856
|
if (isArray(val)) {
|
|
855
857
|
var mapped = [];
|
|
856
858
|
for (var i = 0; i < val.length; i += 1) {
|
|
857
|
-
mapped.
|
|
859
|
+
mapped[mapped.length] = fn(val[i]);
|
|
858
860
|
}
|
|
859
861
|
return mapped;
|
|
860
862
|
}
|
|
@@ -879,112 +881,242 @@ module.exports = {
|
|
|
879
881
|
},{}],7:[function(require,module,exports){
|
|
880
882
|
'use strict';
|
|
881
883
|
|
|
884
|
+
var bind = require('function-bind');
|
|
885
|
+
|
|
886
|
+
var $apply = require('./functionApply');
|
|
887
|
+
var $call = require('./functionCall');
|
|
888
|
+
var $reflectApply = require('./reflectApply');
|
|
889
|
+
|
|
890
|
+
/** @type {import('./actualApply')} */
|
|
891
|
+
module.exports = $reflectApply || bind.call($call, $apply);
|
|
892
|
+
|
|
893
|
+
},{"./functionApply":8,"./functionCall":9,"./reflectApply":11,"function-bind":24}],8:[function(require,module,exports){
|
|
894
|
+
'use strict';
|
|
895
|
+
|
|
896
|
+
/** @type {import('./functionApply')} */
|
|
897
|
+
module.exports = Function.prototype.apply;
|
|
898
|
+
|
|
899
|
+
},{}],9:[function(require,module,exports){
|
|
900
|
+
'use strict';
|
|
901
|
+
|
|
902
|
+
/** @type {import('./functionCall')} */
|
|
903
|
+
module.exports = Function.prototype.call;
|
|
904
|
+
|
|
905
|
+
},{}],10:[function(require,module,exports){
|
|
906
|
+
'use strict';
|
|
907
|
+
|
|
908
|
+
var bind = require('function-bind');
|
|
909
|
+
var $TypeError = require('es-errors/type');
|
|
910
|
+
|
|
911
|
+
var $call = require('./functionCall');
|
|
912
|
+
var $actualApply = require('./actualApply');
|
|
913
|
+
|
|
914
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
915
|
+
module.exports = function callBindBasic(args) {
|
|
916
|
+
if (args.length < 1 || typeof args[0] !== 'function') {
|
|
917
|
+
throw new $TypeError('a function is required');
|
|
918
|
+
}
|
|
919
|
+
return $actualApply(bind, $call, args);
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
},{"./actualApply":7,"./functionCall":9,"es-errors/type":20,"function-bind":24}],11:[function(require,module,exports){
|
|
923
|
+
'use strict';
|
|
924
|
+
|
|
925
|
+
/** @type {import('./reflectApply')} */
|
|
926
|
+
module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
|
|
927
|
+
|
|
928
|
+
},{}],12:[function(require,module,exports){
|
|
929
|
+
'use strict';
|
|
930
|
+
|
|
882
931
|
var GetIntrinsic = require('get-intrinsic');
|
|
883
932
|
|
|
884
|
-
var
|
|
933
|
+
var callBindBasic = require('call-bind-apply-helpers');
|
|
885
934
|
|
|
886
|
-
|
|
935
|
+
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
|
936
|
+
var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
|
|
887
937
|
|
|
938
|
+
/** @type {import('.')} */
|
|
888
939
|
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
889
|
-
|
|
940
|
+
/* eslint no-extra-parens: 0 */
|
|
941
|
+
|
|
942
|
+
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
|
890
943
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
891
|
-
return
|
|
944
|
+
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
|
892
945
|
}
|
|
893
946
|
return intrinsic;
|
|
894
947
|
};
|
|
895
948
|
|
|
896
|
-
},{"
|
|
949
|
+
},{"call-bind-apply-helpers":10,"get-intrinsic":25}],13:[function(require,module,exports){
|
|
897
950
|
'use strict';
|
|
898
951
|
|
|
899
|
-
var
|
|
900
|
-
var
|
|
952
|
+
var callBind = require('call-bind-apply-helpers');
|
|
953
|
+
var gOPD = require('gopd');
|
|
954
|
+
|
|
955
|
+
var hasProtoAccessor;
|
|
956
|
+
try {
|
|
957
|
+
// eslint-disable-next-line no-extra-parens, no-proto
|
|
958
|
+
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
|
959
|
+
} catch (e) {
|
|
960
|
+
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
|
961
|
+
throw e;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
901
964
|
|
|
902
|
-
|
|
903
|
-
var
|
|
904
|
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
965
|
+
// eslint-disable-next-line no-extra-parens
|
|
966
|
+
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
|
905
967
|
|
|
906
|
-
var $
|
|
907
|
-
var $
|
|
908
|
-
|
|
968
|
+
var $Object = Object;
|
|
969
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
|
970
|
+
|
|
971
|
+
/** @type {import('./get')} */
|
|
972
|
+
module.exports = desc && typeof desc.get === 'function'
|
|
973
|
+
? callBind([desc.get])
|
|
974
|
+
: typeof $getPrototypeOf === 'function'
|
|
975
|
+
? /** @type {import('./get')} */ function getDunder(value) {
|
|
976
|
+
// eslint-disable-next-line eqeqeq
|
|
977
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
|
978
|
+
}
|
|
979
|
+
: false;
|
|
980
|
+
|
|
981
|
+
},{"call-bind-apply-helpers":10,"gopd":30}],14:[function(require,module,exports){
|
|
982
|
+
'use strict';
|
|
909
983
|
|
|
984
|
+
/** @type {import('.')} */
|
|
985
|
+
var $defineProperty = Object.defineProperty || false;
|
|
910
986
|
if ($defineProperty) {
|
|
911
987
|
try {
|
|
912
988
|
$defineProperty({}, 'a', { value: 1 });
|
|
913
989
|
} catch (e) {
|
|
914
990
|
// IE 8 has a broken defineProperty
|
|
915
|
-
$defineProperty =
|
|
991
|
+
$defineProperty = false;
|
|
916
992
|
}
|
|
917
993
|
}
|
|
918
994
|
|
|
919
|
-
module.exports =
|
|
920
|
-
var func = $reflectApply(bind, $call, arguments);
|
|
921
|
-
if ($gOPD && $defineProperty) {
|
|
922
|
-
var desc = $gOPD(func, 'length');
|
|
923
|
-
if (desc.configurable) {
|
|
924
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
925
|
-
$defineProperty(
|
|
926
|
-
func,
|
|
927
|
-
'length',
|
|
928
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
929
|
-
);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
return func;
|
|
933
|
-
};
|
|
995
|
+
module.exports = $defineProperty;
|
|
934
996
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
};
|
|
997
|
+
},{}],15:[function(require,module,exports){
|
|
998
|
+
'use strict';
|
|
938
999
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1000
|
+
/** @type {import('./eval')} */
|
|
1001
|
+
module.exports = EvalError;
|
|
1002
|
+
|
|
1003
|
+
},{}],16:[function(require,module,exports){
|
|
1004
|
+
'use strict';
|
|
1005
|
+
|
|
1006
|
+
/** @type {import('.')} */
|
|
1007
|
+
module.exports = Error;
|
|
1008
|
+
|
|
1009
|
+
},{}],17:[function(require,module,exports){
|
|
1010
|
+
'use strict';
|
|
1011
|
+
|
|
1012
|
+
/** @type {import('./range')} */
|
|
1013
|
+
module.exports = RangeError;
|
|
1014
|
+
|
|
1015
|
+
},{}],18:[function(require,module,exports){
|
|
1016
|
+
'use strict';
|
|
1017
|
+
|
|
1018
|
+
/** @type {import('./ref')} */
|
|
1019
|
+
module.exports = ReferenceError;
|
|
1020
|
+
|
|
1021
|
+
},{}],19:[function(require,module,exports){
|
|
1022
|
+
'use strict';
|
|
1023
|
+
|
|
1024
|
+
/** @type {import('./syntax')} */
|
|
1025
|
+
module.exports = SyntaxError;
|
|
1026
|
+
|
|
1027
|
+
},{}],20:[function(require,module,exports){
|
|
1028
|
+
'use strict';
|
|
1029
|
+
|
|
1030
|
+
/** @type {import('./type')} */
|
|
1031
|
+
module.exports = TypeError;
|
|
944
1032
|
|
|
945
|
-
},{
|
|
1033
|
+
},{}],21:[function(require,module,exports){
|
|
1034
|
+
'use strict';
|
|
1035
|
+
|
|
1036
|
+
/** @type {import('./uri')} */
|
|
1037
|
+
module.exports = URIError;
|
|
1038
|
+
|
|
1039
|
+
},{}],22:[function(require,module,exports){
|
|
1040
|
+
'use strict';
|
|
1041
|
+
|
|
1042
|
+
/** @type {import('.')} */
|
|
1043
|
+
module.exports = Object;
|
|
1044
|
+
|
|
1045
|
+
},{}],23:[function(require,module,exports){
|
|
946
1046
|
'use strict';
|
|
947
1047
|
|
|
948
1048
|
/* eslint no-invalid-this: 1 */
|
|
949
1049
|
|
|
950
1050
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
951
|
-
var slice = Array.prototype.slice;
|
|
952
1051
|
var toStr = Object.prototype.toString;
|
|
1052
|
+
var max = Math.max;
|
|
953
1053
|
var funcType = '[object Function]';
|
|
954
1054
|
|
|
1055
|
+
var concatty = function concatty(a, b) {
|
|
1056
|
+
var arr = [];
|
|
1057
|
+
|
|
1058
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
1059
|
+
arr[i] = a[i];
|
|
1060
|
+
}
|
|
1061
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
1062
|
+
arr[j + a.length] = b[j];
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
return arr;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
var slicy = function slicy(arrLike, offset) {
|
|
1069
|
+
var arr = [];
|
|
1070
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
1071
|
+
arr[j] = arrLike[i];
|
|
1072
|
+
}
|
|
1073
|
+
return arr;
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
var joiny = function (arr, joiner) {
|
|
1077
|
+
var str = '';
|
|
1078
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
1079
|
+
str += arr[i];
|
|
1080
|
+
if (i + 1 < arr.length) {
|
|
1081
|
+
str += joiner;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
return str;
|
|
1085
|
+
};
|
|
1086
|
+
|
|
955
1087
|
module.exports = function bind(that) {
|
|
956
1088
|
var target = this;
|
|
957
|
-
if (typeof target !== 'function' || toStr.
|
|
1089
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
958
1090
|
throw new TypeError(ERROR_MESSAGE + target);
|
|
959
1091
|
}
|
|
960
|
-
var args =
|
|
1092
|
+
var args = slicy(arguments, 1);
|
|
961
1093
|
|
|
962
1094
|
var bound;
|
|
963
1095
|
var binder = function () {
|
|
964
1096
|
if (this instanceof bound) {
|
|
965
1097
|
var result = target.apply(
|
|
966
1098
|
this,
|
|
967
|
-
args
|
|
1099
|
+
concatty(args, arguments)
|
|
968
1100
|
);
|
|
969
1101
|
if (Object(result) === result) {
|
|
970
1102
|
return result;
|
|
971
1103
|
}
|
|
972
1104
|
return this;
|
|
973
|
-
} else {
|
|
974
|
-
return target.apply(
|
|
975
|
-
that,
|
|
976
|
-
args.concat(slice.call(arguments))
|
|
977
|
-
);
|
|
978
1105
|
}
|
|
1106
|
+
return target.apply(
|
|
1107
|
+
that,
|
|
1108
|
+
concatty(args, arguments)
|
|
1109
|
+
);
|
|
1110
|
+
|
|
979
1111
|
};
|
|
980
1112
|
|
|
981
|
-
var boundLength =
|
|
1113
|
+
var boundLength = max(0, target.length - args.length);
|
|
982
1114
|
var boundArgs = [];
|
|
983
1115
|
for (var i = 0; i < boundLength; i++) {
|
|
984
|
-
boundArgs
|
|
1116
|
+
boundArgs[i] = '$' + i;
|
|
985
1117
|
}
|
|
986
1118
|
|
|
987
|
-
bound = Function('binder', 'return function (' + boundArgs
|
|
1119
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
988
1120
|
|
|
989
1121
|
if (target.prototype) {
|
|
990
1122
|
var Empty = function Empty() {};
|
|
@@ -996,21 +1128,37 @@ module.exports = function bind(that) {
|
|
|
996
1128
|
return bound;
|
|
997
1129
|
};
|
|
998
1130
|
|
|
999
|
-
},{}],
|
|
1131
|
+
},{}],24:[function(require,module,exports){
|
|
1000
1132
|
'use strict';
|
|
1001
1133
|
|
|
1002
1134
|
var implementation = require('./implementation');
|
|
1003
1135
|
|
|
1004
1136
|
module.exports = Function.prototype.bind || implementation;
|
|
1005
1137
|
|
|
1006
|
-
},{"./implementation":
|
|
1138
|
+
},{"./implementation":23}],25:[function(require,module,exports){
|
|
1007
1139
|
'use strict';
|
|
1008
1140
|
|
|
1009
1141
|
var undefined;
|
|
1010
1142
|
|
|
1011
|
-
var $
|
|
1143
|
+
var $Object = require('es-object-atoms');
|
|
1144
|
+
|
|
1145
|
+
var $Error = require('es-errors');
|
|
1146
|
+
var $EvalError = require('es-errors/eval');
|
|
1147
|
+
var $RangeError = require('es-errors/range');
|
|
1148
|
+
var $ReferenceError = require('es-errors/ref');
|
|
1149
|
+
var $SyntaxError = require('es-errors/syntax');
|
|
1150
|
+
var $TypeError = require('es-errors/type');
|
|
1151
|
+
var $URIError = require('es-errors/uri');
|
|
1152
|
+
|
|
1153
|
+
var abs = require('math-intrinsics/abs');
|
|
1154
|
+
var floor = require('math-intrinsics/floor');
|
|
1155
|
+
var max = require('math-intrinsics/max');
|
|
1156
|
+
var min = require('math-intrinsics/min');
|
|
1157
|
+
var pow = require('math-intrinsics/pow');
|
|
1158
|
+
var round = require('math-intrinsics/round');
|
|
1159
|
+
var sign = require('math-intrinsics/sign');
|
|
1160
|
+
|
|
1012
1161
|
var $Function = Function;
|
|
1013
|
-
var $TypeError = TypeError;
|
|
1014
1162
|
|
|
1015
1163
|
// eslint-disable-next-line consistent-return
|
|
1016
1164
|
var getEvalledConstructor = function (expressionSyntax) {
|
|
@@ -1019,14 +1167,8 @@ var getEvalledConstructor = function (expressionSyntax) {
|
|
|
1019
1167
|
} catch (e) {}
|
|
1020
1168
|
};
|
|
1021
1169
|
|
|
1022
|
-
var $gOPD =
|
|
1023
|
-
|
|
1024
|
-
try {
|
|
1025
|
-
$gOPD({}, '');
|
|
1026
|
-
} catch (e) {
|
|
1027
|
-
$gOPD = null; // this is IE 8, which has a broken gOPD
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1170
|
+
var $gOPD = require('gopd');
|
|
1171
|
+
var $defineProperty = require('es-define-property');
|
|
1030
1172
|
|
|
1031
1173
|
var throwTypeError = function () {
|
|
1032
1174
|
throw new $TypeError();
|
|
@@ -1050,17 +1192,23 @@ var ThrowTypeError = $gOPD
|
|
|
1050
1192
|
|
|
1051
1193
|
var hasSymbols = require('has-symbols')();
|
|
1052
1194
|
|
|
1053
|
-
var getProto =
|
|
1195
|
+
var getProto = require('get-proto');
|
|
1196
|
+
var $ObjectGPO = require('get-proto/Object.getPrototypeOf');
|
|
1197
|
+
var $ReflectGPO = require('get-proto/Reflect.getPrototypeOf');
|
|
1198
|
+
|
|
1199
|
+
var $apply = require('call-bind-apply-helpers/functionApply');
|
|
1200
|
+
var $call = require('call-bind-apply-helpers/functionCall');
|
|
1054
1201
|
|
|
1055
1202
|
var needsEval = {};
|
|
1056
1203
|
|
|
1057
|
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
|
1204
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
|
|
1058
1205
|
|
|
1059
1206
|
var INTRINSICS = {
|
|
1207
|
+
__proto__: null,
|
|
1060
1208
|
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
|
1061
1209
|
'%Array%': Array,
|
|
1062
1210
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
|
1063
|
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
|
1211
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
|
1064
1212
|
'%AsyncFromSyncIteratorPrototype%': undefined,
|
|
1065
1213
|
'%AsyncFunction%': needsEval,
|
|
1066
1214
|
'%AsyncGenerator%': needsEval,
|
|
@@ -1068,6 +1216,8 @@ var INTRINSICS = {
|
|
|
1068
1216
|
'%AsyncIteratorPrototype%': needsEval,
|
|
1069
1217
|
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
|
1070
1218
|
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
|
1219
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
|
1220
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
|
1071
1221
|
'%Boolean%': Boolean,
|
|
1072
1222
|
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
|
1073
1223
|
'%Date%': Date,
|
|
@@ -1075,9 +1225,10 @@ var INTRINSICS = {
|
|
|
1075
1225
|
'%decodeURIComponent%': decodeURIComponent,
|
|
1076
1226
|
'%encodeURI%': encodeURI,
|
|
1077
1227
|
'%encodeURIComponent%': encodeURIComponent,
|
|
1078
|
-
'%Error%': Error,
|
|
1228
|
+
'%Error%': $Error,
|
|
1079
1229
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
1080
|
-
'%EvalError%': EvalError,
|
|
1230
|
+
'%EvalError%': $EvalError,
|
|
1231
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
|
|
1081
1232
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
|
1082
1233
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
|
1083
1234
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
|
@@ -1088,26 +1239,27 @@ var INTRINSICS = {
|
|
|
1088
1239
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
|
1089
1240
|
'%isFinite%': isFinite,
|
|
1090
1241
|
'%isNaN%': isNaN,
|
|
1091
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
1242
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
1092
1243
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
|
1093
1244
|
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
|
1094
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
1245
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
1095
1246
|
'%Math%': Math,
|
|
1096
1247
|
'%Number%': Number,
|
|
1097
|
-
'%Object%': Object,
|
|
1248
|
+
'%Object%': $Object,
|
|
1249
|
+
'%Object.getOwnPropertyDescriptor%': $gOPD,
|
|
1098
1250
|
'%parseFloat%': parseFloat,
|
|
1099
1251
|
'%parseInt%': parseInt,
|
|
1100
1252
|
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
|
1101
1253
|
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
|
1102
|
-
'%RangeError%': RangeError,
|
|
1103
|
-
'%ReferenceError%': ReferenceError,
|
|
1254
|
+
'%RangeError%': $RangeError,
|
|
1255
|
+
'%ReferenceError%': $ReferenceError,
|
|
1104
1256
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
|
1105
1257
|
'%RegExp%': RegExp,
|
|
1106
1258
|
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
|
1107
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
1259
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
1108
1260
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
|
1109
1261
|
'%String%': String,
|
|
1110
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
|
1262
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
|
|
1111
1263
|
'%Symbol%': hasSymbols ? Symbol : undefined,
|
|
1112
1264
|
'%SyntaxError%': $SyntaxError,
|
|
1113
1265
|
'%ThrowTypeError%': ThrowTypeError,
|
|
@@ -1117,12 +1269,35 @@ var INTRINSICS = {
|
|
|
1117
1269
|
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
|
1118
1270
|
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
|
1119
1271
|
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
|
1120
|
-
'%URIError%': URIError,
|
|
1272
|
+
'%URIError%': $URIError,
|
|
1121
1273
|
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
|
1122
1274
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
1123
|
-
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
1275
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
|
|
1276
|
+
|
|
1277
|
+
'%Function.prototype.call%': $call,
|
|
1278
|
+
'%Function.prototype.apply%': $apply,
|
|
1279
|
+
'%Object.defineProperty%': $defineProperty,
|
|
1280
|
+
'%Object.getPrototypeOf%': $ObjectGPO,
|
|
1281
|
+
'%Math.abs%': abs,
|
|
1282
|
+
'%Math.floor%': floor,
|
|
1283
|
+
'%Math.max%': max,
|
|
1284
|
+
'%Math.min%': min,
|
|
1285
|
+
'%Math.pow%': pow,
|
|
1286
|
+
'%Math.round%': round,
|
|
1287
|
+
'%Math.sign%': sign,
|
|
1288
|
+
'%Reflect.getPrototypeOf%': $ReflectGPO
|
|
1124
1289
|
};
|
|
1125
1290
|
|
|
1291
|
+
if (getProto) {
|
|
1292
|
+
try {
|
|
1293
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
1294
|
+
} catch (e) {
|
|
1295
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
1296
|
+
var errorProto = getProto(getProto(e));
|
|
1297
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1126
1301
|
var doEval = function doEval(name) {
|
|
1127
1302
|
var value;
|
|
1128
1303
|
if (name === '%AsyncFunction%') {
|
|
@@ -1138,7 +1313,7 @@ var doEval = function doEval(name) {
|
|
|
1138
1313
|
}
|
|
1139
1314
|
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1140
1315
|
var gen = doEval('%AsyncGenerator%');
|
|
1141
|
-
if (gen) {
|
|
1316
|
+
if (gen && getProto) {
|
|
1142
1317
|
value = getProto(gen.prototype);
|
|
1143
1318
|
}
|
|
1144
1319
|
}
|
|
@@ -1149,6 +1324,7 @@ var doEval = function doEval(name) {
|
|
|
1149
1324
|
};
|
|
1150
1325
|
|
|
1151
1326
|
var LEGACY_ALIASES = {
|
|
1327
|
+
__proto__: null,
|
|
1152
1328
|
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1153
1329
|
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1154
1330
|
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
@@ -1203,11 +1379,12 @@ var LEGACY_ALIASES = {
|
|
|
1203
1379
|
};
|
|
1204
1380
|
|
|
1205
1381
|
var bind = require('function-bind');
|
|
1206
|
-
var hasOwn = require('
|
|
1207
|
-
var $concat = bind.call(
|
|
1208
|
-
var $spliceApply = bind.call(
|
|
1209
|
-
var $replace = bind.call(
|
|
1210
|
-
var $strSlice = bind.call(
|
|
1382
|
+
var hasOwn = require('hasown');
|
|
1383
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
1384
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
1385
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
1386
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
1387
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
1211
1388
|
|
|
1212
1389
|
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1213
1390
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
@@ -1263,6 +1440,9 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
1263
1440
|
throw new $TypeError('"allowMissing" argument must be a boolean');
|
|
1264
1441
|
}
|
|
1265
1442
|
|
|
1443
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
1444
|
+
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
1445
|
+
}
|
|
1266
1446
|
var parts = stringToPath(name);
|
|
1267
1447
|
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1268
1448
|
|
|
@@ -1335,12 +1515,79 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
1335
1515
|
return value;
|
|
1336
1516
|
};
|
|
1337
1517
|
|
|
1338
|
-
},{"
|
|
1518
|
+
},{"call-bind-apply-helpers/functionApply":8,"call-bind-apply-helpers/functionCall":9,"es-define-property":14,"es-errors":16,"es-errors/eval":15,"es-errors/range":17,"es-errors/ref":18,"es-errors/syntax":19,"es-errors/type":20,"es-errors/uri":21,"es-object-atoms":22,"function-bind":24,"get-proto":28,"get-proto/Object.getPrototypeOf":26,"get-proto/Reflect.getPrototypeOf":27,"gopd":30,"has-symbols":31,"hasown":33,"math-intrinsics/abs":34,"math-intrinsics/floor":35,"math-intrinsics/max":37,"math-intrinsics/min":38,"math-intrinsics/pow":39,"math-intrinsics/round":40,"math-intrinsics/sign":41}],26:[function(require,module,exports){
|
|
1519
|
+
'use strict';
|
|
1520
|
+
|
|
1521
|
+
var $Object = require('es-object-atoms');
|
|
1522
|
+
|
|
1523
|
+
/** @type {import('./Object.getPrototypeOf')} */
|
|
1524
|
+
module.exports = $Object.getPrototypeOf || null;
|
|
1525
|
+
|
|
1526
|
+
},{"es-object-atoms":22}],27:[function(require,module,exports){
|
|
1527
|
+
'use strict';
|
|
1528
|
+
|
|
1529
|
+
/** @type {import('./Reflect.getPrototypeOf')} */
|
|
1530
|
+
module.exports = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
|
|
1531
|
+
|
|
1532
|
+
},{}],28:[function(require,module,exports){
|
|
1533
|
+
'use strict';
|
|
1534
|
+
|
|
1535
|
+
var reflectGetProto = require('./Reflect.getPrototypeOf');
|
|
1536
|
+
var originalGetProto = require('./Object.getPrototypeOf');
|
|
1537
|
+
|
|
1538
|
+
var getDunderProto = require('dunder-proto/get');
|
|
1539
|
+
|
|
1540
|
+
/** @type {import('.')} */
|
|
1541
|
+
module.exports = reflectGetProto
|
|
1542
|
+
? function getProto(O) {
|
|
1543
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1544
|
+
return reflectGetProto(O);
|
|
1545
|
+
}
|
|
1546
|
+
: originalGetProto
|
|
1547
|
+
? function getProto(O) {
|
|
1548
|
+
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
|
|
1549
|
+
throw new TypeError('getProto: not an object');
|
|
1550
|
+
}
|
|
1551
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1552
|
+
return originalGetProto(O);
|
|
1553
|
+
}
|
|
1554
|
+
: getDunderProto
|
|
1555
|
+
? function getProto(O) {
|
|
1556
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1557
|
+
return getDunderProto(O);
|
|
1558
|
+
}
|
|
1559
|
+
: null;
|
|
1560
|
+
|
|
1561
|
+
},{"./Object.getPrototypeOf":26,"./Reflect.getPrototypeOf":27,"dunder-proto/get":13}],29:[function(require,module,exports){
|
|
1562
|
+
'use strict';
|
|
1563
|
+
|
|
1564
|
+
/** @type {import('./gOPD')} */
|
|
1565
|
+
module.exports = Object.getOwnPropertyDescriptor;
|
|
1566
|
+
|
|
1567
|
+
},{}],30:[function(require,module,exports){
|
|
1568
|
+
'use strict';
|
|
1569
|
+
|
|
1570
|
+
/** @type {import('.')} */
|
|
1571
|
+
var $gOPD = require('./gOPD');
|
|
1572
|
+
|
|
1573
|
+
if ($gOPD) {
|
|
1574
|
+
try {
|
|
1575
|
+
$gOPD([], 'length');
|
|
1576
|
+
} catch (e) {
|
|
1577
|
+
// IE 8 has a broken gOPD
|
|
1578
|
+
$gOPD = null;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
module.exports = $gOPD;
|
|
1583
|
+
|
|
1584
|
+
},{"./gOPD":29}],31:[function(require,module,exports){
|
|
1339
1585
|
'use strict';
|
|
1340
1586
|
|
|
1341
1587
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
1342
1588
|
var hasSymbolSham = require('./shams');
|
|
1343
1589
|
|
|
1590
|
+
/** @type {import('.')} */
|
|
1344
1591
|
module.exports = function hasNativeSymbols() {
|
|
1345
1592
|
if (typeof origSymbol !== 'function') { return false; }
|
|
1346
1593
|
if (typeof Symbol !== 'function') { return false; }
|
|
@@ -1350,14 +1597,16 @@ module.exports = function hasNativeSymbols() {
|
|
|
1350
1597
|
return hasSymbolSham();
|
|
1351
1598
|
};
|
|
1352
1599
|
|
|
1353
|
-
},{"./shams":
|
|
1600
|
+
},{"./shams":32}],32:[function(require,module,exports){
|
|
1354
1601
|
'use strict';
|
|
1355
1602
|
|
|
1603
|
+
/** @type {import('./shams')} */
|
|
1356
1604
|
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
1357
1605
|
module.exports = function hasSymbols() {
|
|
1358
1606
|
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
1359
1607
|
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
1360
1608
|
|
|
1609
|
+
/** @type {{ [k in symbol]?: unknown }} */
|
|
1361
1610
|
var obj = {};
|
|
1362
1611
|
var sym = Symbol('test');
|
|
1363
1612
|
var symObj = Object(sym);
|
|
@@ -1376,7 +1625,7 @@ module.exports = function hasSymbols() {
|
|
|
1376
1625
|
|
|
1377
1626
|
var symVal = 42;
|
|
1378
1627
|
obj[sym] = symVal;
|
|
1379
|
-
for (
|
|
1628
|
+
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
1380
1629
|
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
1381
1630
|
|
|
1382
1631
|
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
@@ -1387,21 +1636,83 @@ module.exports = function hasSymbols() {
|
|
|
1387
1636
|
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
1388
1637
|
|
|
1389
1638
|
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
1390
|
-
|
|
1639
|
+
// eslint-disable-next-line no-extra-parens
|
|
1640
|
+
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
|
|
1391
1641
|
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
1392
1642
|
}
|
|
1393
1643
|
|
|
1394
1644
|
return true;
|
|
1395
1645
|
};
|
|
1396
1646
|
|
|
1397
|
-
},{}],
|
|
1647
|
+
},{}],33:[function(require,module,exports){
|
|
1398
1648
|
'use strict';
|
|
1399
1649
|
|
|
1650
|
+
var call = Function.prototype.call;
|
|
1651
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
1400
1652
|
var bind = require('function-bind');
|
|
1401
1653
|
|
|
1402
|
-
|
|
1654
|
+
/** @type {import('.')} */
|
|
1655
|
+
module.exports = bind.call(call, $hasOwn);
|
|
1656
|
+
|
|
1657
|
+
},{"function-bind":24}],34:[function(require,module,exports){
|
|
1658
|
+
'use strict';
|
|
1659
|
+
|
|
1660
|
+
/** @type {import('./abs')} */
|
|
1661
|
+
module.exports = Math.abs;
|
|
1662
|
+
|
|
1663
|
+
},{}],35:[function(require,module,exports){
|
|
1664
|
+
'use strict';
|
|
1665
|
+
|
|
1666
|
+
/** @type {import('./floor')} */
|
|
1667
|
+
module.exports = Math.floor;
|
|
1668
|
+
|
|
1669
|
+
},{}],36:[function(require,module,exports){
|
|
1670
|
+
'use strict';
|
|
1671
|
+
|
|
1672
|
+
/** @type {import('./isNaN')} */
|
|
1673
|
+
module.exports = Number.isNaN || function isNaN(a) {
|
|
1674
|
+
return a !== a;
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
},{}],37:[function(require,module,exports){
|
|
1678
|
+
'use strict';
|
|
1679
|
+
|
|
1680
|
+
/** @type {import('./max')} */
|
|
1681
|
+
module.exports = Math.max;
|
|
1403
1682
|
|
|
1404
|
-
},{
|
|
1683
|
+
},{}],38:[function(require,module,exports){
|
|
1684
|
+
'use strict';
|
|
1685
|
+
|
|
1686
|
+
/** @type {import('./min')} */
|
|
1687
|
+
module.exports = Math.min;
|
|
1688
|
+
|
|
1689
|
+
},{}],39:[function(require,module,exports){
|
|
1690
|
+
'use strict';
|
|
1691
|
+
|
|
1692
|
+
/** @type {import('./pow')} */
|
|
1693
|
+
module.exports = Math.pow;
|
|
1694
|
+
|
|
1695
|
+
},{}],40:[function(require,module,exports){
|
|
1696
|
+
'use strict';
|
|
1697
|
+
|
|
1698
|
+
/** @type {import('./round')} */
|
|
1699
|
+
module.exports = Math.round;
|
|
1700
|
+
|
|
1701
|
+
},{}],41:[function(require,module,exports){
|
|
1702
|
+
'use strict';
|
|
1703
|
+
|
|
1704
|
+
var $isNaN = require('./isNaN');
|
|
1705
|
+
|
|
1706
|
+
/** @type {import('./sign')} */
|
|
1707
|
+
module.exports = function sign(number) {
|
|
1708
|
+
if ($isNaN(number) || number === 0) {
|
|
1709
|
+
return number;
|
|
1710
|
+
}
|
|
1711
|
+
return number < 0 ? -1 : +1;
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
},{"./isNaN":36}],42:[function(require,module,exports){
|
|
1715
|
+
(function (global){(function (){
|
|
1405
1716
|
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
1406
1717
|
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
1407
1718
|
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
@@ -1473,10 +1784,21 @@ var utilInspect = require('./util.inspect');
|
|
|
1473
1784
|
var inspectCustom = utilInspect.custom;
|
|
1474
1785
|
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
1475
1786
|
|
|
1787
|
+
var quotes = {
|
|
1788
|
+
__proto__: null,
|
|
1789
|
+
'double': '"',
|
|
1790
|
+
single: "'"
|
|
1791
|
+
};
|
|
1792
|
+
var quoteREs = {
|
|
1793
|
+
__proto__: null,
|
|
1794
|
+
'double': /(["\\])/g,
|
|
1795
|
+
single: /(['\\])/g
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1476
1798
|
module.exports = function inspect_(obj, options, depth, seen) {
|
|
1477
1799
|
var opts = options || {};
|
|
1478
1800
|
|
|
1479
|
-
if (has(opts, 'quoteStyle') && (
|
|
1801
|
+
if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) {
|
|
1480
1802
|
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
1481
1803
|
}
|
|
1482
1804
|
if (
|
|
@@ -1606,16 +1928,20 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
1606
1928
|
}
|
|
1607
1929
|
if (isMap(obj)) {
|
|
1608
1930
|
var mapParts = [];
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1931
|
+
if (mapForEach) {
|
|
1932
|
+
mapForEach.call(obj, function (value, key) {
|
|
1933
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1612
1936
|
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
1613
1937
|
}
|
|
1614
1938
|
if (isSet(obj)) {
|
|
1615
1939
|
var setParts = [];
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1940
|
+
if (setForEach) {
|
|
1941
|
+
setForEach.call(obj, function (value) {
|
|
1942
|
+
setParts.push(inspect(value, obj));
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1619
1945
|
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
1620
1946
|
}
|
|
1621
1947
|
if (isWeakMap(obj)) {
|
|
@@ -1639,6 +1965,17 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
1639
1965
|
if (isString(obj)) {
|
|
1640
1966
|
return markBoxed(inspect(String(obj)));
|
|
1641
1967
|
}
|
|
1968
|
+
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
1969
|
+
/* eslint-env browser */
|
|
1970
|
+
if (typeof window !== 'undefined' && obj === window) {
|
|
1971
|
+
return '{ [object Window] }';
|
|
1972
|
+
}
|
|
1973
|
+
if (
|
|
1974
|
+
(typeof globalThis !== 'undefined' && obj === globalThis)
|
|
1975
|
+
|| (typeof global !== 'undefined' && obj === global)
|
|
1976
|
+
) {
|
|
1977
|
+
return '{ [object globalThis] }';
|
|
1978
|
+
}
|
|
1642
1979
|
if (!isDate(obj) && !isRegExp(obj)) {
|
|
1643
1980
|
var ys = arrObjKeys(obj, inspect);
|
|
1644
1981
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
@@ -1656,7 +1993,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
1656
1993
|
};
|
|
1657
1994
|
|
|
1658
1995
|
function wrapQuotes(s, defaultStyle, opts) {
|
|
1659
|
-
var
|
|
1996
|
+
var style = opts.quoteStyle || defaultStyle;
|
|
1997
|
+
var quoteChar = quotes[style];
|
|
1660
1998
|
return quoteChar + s + quoteChar;
|
|
1661
1999
|
}
|
|
1662
2000
|
|
|
@@ -1664,13 +2002,16 @@ function quote(s) {
|
|
|
1664
2002
|
return $replace.call(String(s), /"/g, '"');
|
|
1665
2003
|
}
|
|
1666
2004
|
|
|
1667
|
-
function
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
function
|
|
1671
|
-
function
|
|
1672
|
-
function
|
|
1673
|
-
function
|
|
2005
|
+
function canTrustToString(obj) {
|
|
2006
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
2007
|
+
}
|
|
2008
|
+
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
2009
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
2010
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
2011
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
2012
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
2013
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
2014
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
1674
2015
|
|
|
1675
2016
|
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
1676
2017
|
function isSymbol(obj) {
|
|
@@ -1814,8 +2155,10 @@ function inspectString(str, opts) {
|
|
|
1814
2155
|
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
1815
2156
|
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
1816
2157
|
}
|
|
2158
|
+
var quoteRE = quoteREs[opts.quoteStyle || 'single'];
|
|
2159
|
+
quoteRE.lastIndex = 0;
|
|
1817
2160
|
// eslint-disable-next-line no-control-regex
|
|
1818
|
-
var s = $replace.call($replace.call(str,
|
|
2161
|
+
var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
1819
2162
|
return wrapQuotes(s, 'single', opts);
|
|
1820
2163
|
}
|
|
1821
2164
|
|
|
@@ -1915,131 +2258,322 @@ function arrObjKeys(obj, inspect) {
|
|
|
1915
2258
|
return xs;
|
|
1916
2259
|
}
|
|
1917
2260
|
|
|
1918
|
-
},
|
|
2261
|
+
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
2262
|
+
},{"./util.inspect":6}],43:[function(require,module,exports){
|
|
1919
2263
|
'use strict';
|
|
1920
2264
|
|
|
1921
|
-
var GetIntrinsic = require('get-intrinsic');
|
|
1922
|
-
var callBound = require('call-bind/callBound');
|
|
1923
2265
|
var inspect = require('object-inspect');
|
|
1924
2266
|
|
|
1925
|
-
var $TypeError =
|
|
1926
|
-
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
1927
|
-
var $Map = GetIntrinsic('%Map%', true);
|
|
1928
|
-
|
|
1929
|
-
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
1930
|
-
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
1931
|
-
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
1932
|
-
var $mapGet = callBound('Map.prototype.get', true);
|
|
1933
|
-
var $mapSet = callBound('Map.prototype.set', true);
|
|
1934
|
-
var $mapHas = callBound('Map.prototype.has', true);
|
|
2267
|
+
var $TypeError = require('es-errors/type');
|
|
1935
2268
|
|
|
1936
2269
|
/*
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
var listGetNode = function (list, key) {
|
|
1945
|
-
|
|
2270
|
+
* This function traverses the list returning the node corresponding to the given key.
|
|
2271
|
+
*
|
|
2272
|
+
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
2273
|
+
* By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
2274
|
+
*/
|
|
2275
|
+
/** @type {import('./list.d.ts').listGetNode} */
|
|
2276
|
+
// eslint-disable-next-line consistent-return
|
|
2277
|
+
var listGetNode = function (list, key, isDelete) {
|
|
2278
|
+
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
|
|
2279
|
+
var prev = list;
|
|
2280
|
+
/** @type {(typeof list)['next']} */
|
|
2281
|
+
var curr;
|
|
2282
|
+
// eslint-disable-next-line eqeqeq
|
|
2283
|
+
for (; (curr = prev.next) != null; prev = curr) {
|
|
1946
2284
|
if (curr.key === key) {
|
|
1947
2285
|
prev.next = curr.next;
|
|
1948
|
-
|
|
1949
|
-
|
|
2286
|
+
if (!isDelete) {
|
|
2287
|
+
// eslint-disable-next-line no-extra-parens
|
|
2288
|
+
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
|
|
2289
|
+
list.next = curr; // eslint-disable-line no-param-reassign
|
|
2290
|
+
}
|
|
1950
2291
|
return curr;
|
|
1951
2292
|
}
|
|
1952
2293
|
}
|
|
1953
2294
|
};
|
|
1954
2295
|
|
|
2296
|
+
/** @type {import('./list.d.ts').listGet} */
|
|
1955
2297
|
var listGet = function (objects, key) {
|
|
2298
|
+
if (!objects) {
|
|
2299
|
+
return void undefined;
|
|
2300
|
+
}
|
|
1956
2301
|
var node = listGetNode(objects, key);
|
|
1957
2302
|
return node && node.value;
|
|
1958
2303
|
};
|
|
2304
|
+
/** @type {import('./list.d.ts').listSet} */
|
|
1959
2305
|
var listSet = function (objects, key, value) {
|
|
1960
2306
|
var node = listGetNode(objects, key);
|
|
1961
2307
|
if (node) {
|
|
1962
2308
|
node.value = value;
|
|
1963
2309
|
} else {
|
|
1964
2310
|
// Prepend the new node to the beginning of the list
|
|
1965
|
-
objects.next = { // eslint-disable-line no-param-reassign
|
|
2311
|
+
objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
|
|
1966
2312
|
key: key,
|
|
1967
2313
|
next: objects.next,
|
|
1968
2314
|
value: value
|
|
1969
|
-
};
|
|
2315
|
+
});
|
|
1970
2316
|
}
|
|
1971
2317
|
};
|
|
2318
|
+
/** @type {import('./list.d.ts').listHas} */
|
|
1972
2319
|
var listHas = function (objects, key) {
|
|
2320
|
+
if (!objects) {
|
|
2321
|
+
return false;
|
|
2322
|
+
}
|
|
1973
2323
|
return !!listGetNode(objects, key);
|
|
1974
2324
|
};
|
|
2325
|
+
/** @type {import('./list.d.ts').listDelete} */
|
|
2326
|
+
// eslint-disable-next-line consistent-return
|
|
2327
|
+
var listDelete = function (objects, key) {
|
|
2328
|
+
if (objects) {
|
|
2329
|
+
return listGetNode(objects, key, true);
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
1975
2332
|
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2333
|
+
/** @type {import('.')} */
|
|
2334
|
+
module.exports = function getSideChannelList() {
|
|
2335
|
+
/** @typedef {ReturnType<typeof getSideChannelList>} Channel */
|
|
2336
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
2337
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
2338
|
+
|
|
2339
|
+
/** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o;
|
|
2340
|
+
|
|
2341
|
+
/** @type {Channel} */
|
|
1980
2342
|
var channel = {
|
|
1981
2343
|
assert: function (key) {
|
|
1982
2344
|
if (!channel.has(key)) {
|
|
1983
2345
|
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1984
2346
|
}
|
|
1985
2347
|
},
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
} else if ($Map) {
|
|
1992
|
-
if ($m) {
|
|
1993
|
-
return $mapGet($m, key);
|
|
1994
|
-
}
|
|
1995
|
-
} else {
|
|
1996
|
-
if ($o) { // eslint-disable-line no-lonely-if
|
|
1997
|
-
return listGet($o, key);
|
|
1998
|
-
}
|
|
2348
|
+
'delete': function (key) {
|
|
2349
|
+
var root = $o && $o.next;
|
|
2350
|
+
var deletedNode = listDelete($o, key);
|
|
2351
|
+
if (deletedNode && root && root === deletedNode) {
|
|
2352
|
+
$o = void undefined;
|
|
1999
2353
|
}
|
|
2354
|
+
return !!deletedNode;
|
|
2355
|
+
},
|
|
2356
|
+
get: function (key) {
|
|
2357
|
+
return listGet($o, key);
|
|
2000
2358
|
},
|
|
2001
2359
|
has: function (key) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2360
|
+
return listHas($o, key);
|
|
2361
|
+
},
|
|
2362
|
+
set: function (key, value) {
|
|
2363
|
+
if (!$o) {
|
|
2364
|
+
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
2365
|
+
$o = {
|
|
2366
|
+
next: void undefined
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
// eslint-disable-next-line no-extra-parens
|
|
2370
|
+
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
2374
|
+
return channel;
|
|
2375
|
+
};
|
|
2376
|
+
|
|
2377
|
+
},{"es-errors/type":20,"object-inspect":42}],44:[function(require,module,exports){
|
|
2378
|
+
'use strict';
|
|
2379
|
+
|
|
2380
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
2381
|
+
var callBound = require('call-bound');
|
|
2382
|
+
var inspect = require('object-inspect');
|
|
2383
|
+
|
|
2384
|
+
var $TypeError = require('es-errors/type');
|
|
2385
|
+
var $Map = GetIntrinsic('%Map%', true);
|
|
2386
|
+
|
|
2387
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => V} */
|
|
2388
|
+
var $mapGet = callBound('Map.prototype.get', true);
|
|
2389
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K, value: V) => void} */
|
|
2390
|
+
var $mapSet = callBound('Map.prototype.set', true);
|
|
2391
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
2392
|
+
var $mapHas = callBound('Map.prototype.has', true);
|
|
2393
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
2394
|
+
var $mapDelete = callBound('Map.prototype.delete', true);
|
|
2395
|
+
/** @type {<K, V>(thisArg: Map<K, V>) => number} */
|
|
2396
|
+
var $mapSize = callBound('Map.prototype.size', true);
|
|
2397
|
+
|
|
2398
|
+
/** @type {import('.')} */
|
|
2399
|
+
module.exports = !!$Map && /** @type {Exclude<import('.'), false>} */ function getSideChannelMap() {
|
|
2400
|
+
/** @typedef {ReturnType<typeof getSideChannelMap>} Channel */
|
|
2401
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
2402
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
2403
|
+
|
|
2404
|
+
/** @type {Map<K, V> | undefined} */ var $m;
|
|
2405
|
+
|
|
2406
|
+
/** @type {Channel} */
|
|
2407
|
+
var channel = {
|
|
2408
|
+
assert: function (key) {
|
|
2409
|
+
if (!channel.has(key)) {
|
|
2410
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
2411
|
+
}
|
|
2412
|
+
},
|
|
2413
|
+
'delete': function (key) {
|
|
2414
|
+
if ($m) {
|
|
2415
|
+
var result = $mapDelete($m, key);
|
|
2416
|
+
if ($mapSize($m) === 0) {
|
|
2417
|
+
$m = void undefined;
|
|
2013
2418
|
}
|
|
2419
|
+
return result;
|
|
2420
|
+
}
|
|
2421
|
+
return false;
|
|
2422
|
+
},
|
|
2423
|
+
get: function (key) { // eslint-disable-line consistent-return
|
|
2424
|
+
if ($m) {
|
|
2425
|
+
return $mapGet($m, key);
|
|
2426
|
+
}
|
|
2427
|
+
},
|
|
2428
|
+
has: function (key) {
|
|
2429
|
+
if ($m) {
|
|
2430
|
+
return $mapHas($m, key);
|
|
2014
2431
|
}
|
|
2015
2432
|
return false;
|
|
2016
2433
|
},
|
|
2017
2434
|
set: function (key, value) {
|
|
2018
|
-
if (
|
|
2019
|
-
|
|
2020
|
-
|
|
2435
|
+
if (!$m) {
|
|
2436
|
+
// @ts-expect-error TS can't handle narrowing a variable inside a closure
|
|
2437
|
+
$m = new $Map();
|
|
2438
|
+
}
|
|
2439
|
+
$mapSet($m, key, value);
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
// @ts-expect-error TODO: figure out why TS is erroring here
|
|
2444
|
+
return channel;
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
},{"call-bound":12,"es-errors/type":20,"get-intrinsic":25,"object-inspect":42}],45:[function(require,module,exports){
|
|
2448
|
+
'use strict';
|
|
2449
|
+
|
|
2450
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
2451
|
+
var callBound = require('call-bound');
|
|
2452
|
+
var inspect = require('object-inspect');
|
|
2453
|
+
var getSideChannelMap = require('side-channel-map');
|
|
2454
|
+
|
|
2455
|
+
var $TypeError = require('es-errors/type');
|
|
2456
|
+
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
2457
|
+
|
|
2458
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */
|
|
2459
|
+
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
2460
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */
|
|
2461
|
+
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
2462
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
2463
|
+
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
2464
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
2465
|
+
var $weakMapDelete = callBound('WeakMap.prototype.delete', true);
|
|
2466
|
+
|
|
2467
|
+
/** @type {import('.')} */
|
|
2468
|
+
module.exports = $WeakMap
|
|
2469
|
+
? /** @type {Exclude<import('.'), false>} */ function getSideChannelWeakMap() {
|
|
2470
|
+
/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
|
|
2471
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
2472
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
2473
|
+
|
|
2474
|
+
/** @type {WeakMap<K & object, V> | undefined} */ var $wm;
|
|
2475
|
+
/** @type {Channel | undefined} */ var $m;
|
|
2476
|
+
|
|
2477
|
+
/** @type {Channel} */
|
|
2478
|
+
var channel = {
|
|
2479
|
+
assert: function (key) {
|
|
2480
|
+
if (!channel.has(key)) {
|
|
2481
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
2021
2482
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
if (
|
|
2025
|
-
|
|
2483
|
+
},
|
|
2484
|
+
'delete': function (key) {
|
|
2485
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2486
|
+
if ($wm) {
|
|
2487
|
+
return $weakMapDelete($wm, key);
|
|
2488
|
+
}
|
|
2489
|
+
} else if (getSideChannelMap) {
|
|
2490
|
+
if ($m) {
|
|
2491
|
+
return $m['delete'](key);
|
|
2492
|
+
}
|
|
2026
2493
|
}
|
|
2027
|
-
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2494
|
+
return false;
|
|
2495
|
+
},
|
|
2496
|
+
get: function (key) {
|
|
2497
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2498
|
+
if ($wm) {
|
|
2499
|
+
return $weakMapGet($wm, key);
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
return $m && $m.get(key);
|
|
2503
|
+
},
|
|
2504
|
+
has: function (key) {
|
|
2505
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2506
|
+
if ($wm) {
|
|
2507
|
+
return $weakMapHas($wm, key);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return !!$m && $m.has(key);
|
|
2511
|
+
},
|
|
2512
|
+
set: function (key, value) {
|
|
2513
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2514
|
+
if (!$wm) {
|
|
2515
|
+
$wm = new $WeakMap();
|
|
2516
|
+
}
|
|
2517
|
+
$weakMapSet($wm, key, value);
|
|
2518
|
+
} else if (getSideChannelMap) {
|
|
2519
|
+
if (!$m) {
|
|
2520
|
+
$m = getSideChannelMap();
|
|
2521
|
+
}
|
|
2522
|
+
// eslint-disable-next-line no-extra-parens
|
|
2523
|
+
/** @type {NonNullable<typeof $m>} */ ($m).set(key, value);
|
|
2036
2524
|
}
|
|
2037
|
-
listSet($o, key, value);
|
|
2038
2525
|
}
|
|
2526
|
+
};
|
|
2527
|
+
|
|
2528
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
2529
|
+
return channel;
|
|
2530
|
+
}
|
|
2531
|
+
: getSideChannelMap;
|
|
2532
|
+
|
|
2533
|
+
},{"call-bound":12,"es-errors/type":20,"get-intrinsic":25,"object-inspect":42,"side-channel-map":44}],46:[function(require,module,exports){
|
|
2534
|
+
'use strict';
|
|
2535
|
+
|
|
2536
|
+
var $TypeError = require('es-errors/type');
|
|
2537
|
+
var inspect = require('object-inspect');
|
|
2538
|
+
var getSideChannelList = require('side-channel-list');
|
|
2539
|
+
var getSideChannelMap = require('side-channel-map');
|
|
2540
|
+
var getSideChannelWeakMap = require('side-channel-weakmap');
|
|
2541
|
+
|
|
2542
|
+
var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
|
|
2543
|
+
|
|
2544
|
+
/** @type {import('.')} */
|
|
2545
|
+
module.exports = function getSideChannel() {
|
|
2546
|
+
/** @typedef {ReturnType<typeof getSideChannel>} Channel */
|
|
2547
|
+
|
|
2548
|
+
/** @type {Channel | undefined} */ var $channelData;
|
|
2549
|
+
|
|
2550
|
+
/** @type {Channel} */
|
|
2551
|
+
var channel = {
|
|
2552
|
+
assert: function (key) {
|
|
2553
|
+
if (!channel.has(key)) {
|
|
2554
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
'delete': function (key) {
|
|
2558
|
+
return !!$channelData && $channelData['delete'](key);
|
|
2559
|
+
},
|
|
2560
|
+
get: function (key) {
|
|
2561
|
+
return $channelData && $channelData.get(key);
|
|
2562
|
+
},
|
|
2563
|
+
has: function (key) {
|
|
2564
|
+
return !!$channelData && $channelData.has(key);
|
|
2565
|
+
},
|
|
2566
|
+
set: function (key, value) {
|
|
2567
|
+
if (!$channelData) {
|
|
2568
|
+
$channelData = makeChannel();
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
$channelData.set(key, value);
|
|
2039
2572
|
}
|
|
2040
2573
|
};
|
|
2574
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
2041
2575
|
return channel;
|
|
2042
2576
|
};
|
|
2043
2577
|
|
|
2044
|
-
},{"
|
|
2578
|
+
},{"es-errors/type":20,"object-inspect":42,"side-channel-list":43,"side-channel-map":44,"side-channel-weakmap":45}]},{},[2])(2)
|
|
2045
2579
|
});
|