@parcel/utils 2.0.0-nightly.1256 → 2.0.0-nightly.1266
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/lib/index.js +103 -0
- package/lib/index.js.map +1 -1
- package/package.json +10 -8
- package/src/BitSet.js +126 -0
- package/src/index.js +2 -0
- package/test/BitSet.test.js +119 -0
package/lib/index.js
CHANGED
|
@@ -3475,6 +3475,8 @@ $parcel$export(module.exports, "matchSourceMappingURL", () => $46fc74961fdcfe31$
|
|
|
3475
3475
|
$parcel$export(module.exports, "loadSourceMapUrl", () => $46fc74961fdcfe31$export$527a92fa675f5e93);
|
|
3476
3476
|
$parcel$export(module.exports, "loadSourceMap", () => $46fc74961fdcfe31$export$c500fecaca54de65);
|
|
3477
3477
|
$parcel$export(module.exports, "remapSourceLocation", () => $46fc74961fdcfe31$export$2fed780245c466c1);
|
|
3478
|
+
$parcel$export(module.exports, "BitSet", () => $2c32463ab90dab73$export$33dc8f3f7b9e35df);
|
|
3479
|
+
$parcel$export(module.exports, "stripAnsi", () => (/*@__PURE__*/$parcel$interopDefault($f709bcec854d2334$exports)));
|
|
3478
3480
|
function $fddc9169ba2fd655$export$2e2bcd8739ae039(string, startIndex = 0) {
|
|
3479
3481
|
let lines = 1;
|
|
3480
3482
|
for(let i = startIndex; i < string.length; i++)if (string.charAt(i) === "\n") lines++;
|
|
@@ -36823,5 +36825,106 @@ function $46fc74961fdcfe31$export$2fed780245c466c1(loc, originalMap) {
|
|
|
36823
36825
|
|
|
36824
36826
|
|
|
36825
36827
|
|
|
36828
|
+
// have been hoisted to keep the flow errors to a minimum. This can be removed
|
|
36829
|
+
// if we upgrade to a flow version that supports BigInt's
|
|
36830
|
+
// $FlowFixMe
|
|
36831
|
+
// $FlowFixMe
|
|
36832
|
+
const $2c32463ab90dab73$var$BIGINT_ZERO = 0n; // $FlowFixMe
|
|
36833
|
+
const $2c32463ab90dab73$var$BIGINT_ONE = 1n; // $FlowFixMe
|
|
36834
|
+
let $2c32463ab90dab73$var$numberToBigInt = (v)=>BigInt(v);
|
|
36835
|
+
let $2c32463ab90dab73$var$bitUnion = (a, b)=>a | b;
|
|
36836
|
+
class $2c32463ab90dab73$export$33dc8f3f7b9e35df {
|
|
36837
|
+
constructor({ initial: initial , items: items , lookup: lookup }){
|
|
36838
|
+
if (initial instanceof $2c32463ab90dab73$export$33dc8f3f7b9e35df) this._value = initial === null || initial === void 0 ? void 0 : initial._value;
|
|
36839
|
+
else if (initial) this._value = initial;
|
|
36840
|
+
else this._value = $2c32463ab90dab73$var$BIGINT_ZERO;
|
|
36841
|
+
this._items = items;
|
|
36842
|
+
this._lookup = lookup;
|
|
36843
|
+
}
|
|
36844
|
+
static from(items) {
|
|
36845
|
+
let lookup = new Map();
|
|
36846
|
+
for(let i = 0; i < items.length; i++)lookup.set(items[i], $2c32463ab90dab73$var$numberToBigInt(i));
|
|
36847
|
+
return new $2c32463ab90dab73$export$33dc8f3f7b9e35df({
|
|
36848
|
+
items: items,
|
|
36849
|
+
lookup: lookup
|
|
36850
|
+
});
|
|
36851
|
+
}
|
|
36852
|
+
static union(a, b) {
|
|
36853
|
+
return new $2c32463ab90dab73$export$33dc8f3f7b9e35df({
|
|
36854
|
+
initial: $2c32463ab90dab73$var$bitUnion(a._value, b._value),
|
|
36855
|
+
lookup: a._lookup,
|
|
36856
|
+
items: a._items
|
|
36857
|
+
});
|
|
36858
|
+
}
|
|
36859
|
+
#getIndex(item) {
|
|
36860
|
+
return (0, (/*@__PURE__*/$parcel$interopDefault($812806c6461f2963$exports)))(this._lookup.get(item), "Item is missing from BitSet");
|
|
36861
|
+
}
|
|
36862
|
+
add(item) {
|
|
36863
|
+
this._value |= $2c32463ab90dab73$var$BIGINT_ONE << this.#getIndex(item);
|
|
36864
|
+
}
|
|
36865
|
+
delete(item) {
|
|
36866
|
+
this._value &= ~($2c32463ab90dab73$var$BIGINT_ONE << this.#getIndex(item));
|
|
36867
|
+
}
|
|
36868
|
+
has(item) {
|
|
36869
|
+
return Boolean(this._value & $2c32463ab90dab73$var$BIGINT_ONE << this.#getIndex(item));
|
|
36870
|
+
}
|
|
36871
|
+
intersect(v) {
|
|
36872
|
+
this._value = this._value & v._value;
|
|
36873
|
+
}
|
|
36874
|
+
union(v) {
|
|
36875
|
+
this._value = $2c32463ab90dab73$var$bitUnion(this._value, v._value);
|
|
36876
|
+
}
|
|
36877
|
+
clear() {
|
|
36878
|
+
this._value = $2c32463ab90dab73$var$BIGINT_ZERO;
|
|
36879
|
+
}
|
|
36880
|
+
cloneEmpty() {
|
|
36881
|
+
return new $2c32463ab90dab73$export$33dc8f3f7b9e35df({
|
|
36882
|
+
lookup: this._lookup,
|
|
36883
|
+
items: this._items
|
|
36884
|
+
});
|
|
36885
|
+
}
|
|
36886
|
+
clone() {
|
|
36887
|
+
return new $2c32463ab90dab73$export$33dc8f3f7b9e35df({
|
|
36888
|
+
lookup: this._lookup,
|
|
36889
|
+
items: this._items,
|
|
36890
|
+
initial: this._value
|
|
36891
|
+
});
|
|
36892
|
+
}
|
|
36893
|
+
values() {
|
|
36894
|
+
let values = [];
|
|
36895
|
+
let tmpValue = this._value;
|
|
36896
|
+
let i; // This implementation is optimized for BitSets that contain a very small percentage
|
|
36897
|
+
// of items compared to the total number of potential items. This makes sense for
|
|
36898
|
+
// our bundler use-cases where Sets often contain <1% coverage of the total item count.
|
|
36899
|
+
// In cases where Sets contain a larger percentage of the total items, a regular looping
|
|
36900
|
+
// strategy would be more performant.
|
|
36901
|
+
while(tmpValue > $2c32463ab90dab73$var$BIGINT_ZERO){
|
|
36902
|
+
// Get last set bit
|
|
36903
|
+
i = tmpValue.toString(2).length - 1;
|
|
36904
|
+
values.push(this._items[i]); // Unset last set bit
|
|
36905
|
+
tmpValue &= ~($2c32463ab90dab73$var$BIGINT_ONE << $2c32463ab90dab73$var$numberToBigInt(i));
|
|
36906
|
+
}
|
|
36907
|
+
return values;
|
|
36908
|
+
}
|
|
36909
|
+
}
|
|
36910
|
+
|
|
36911
|
+
|
|
36912
|
+
var $f709bcec854d2334$exports = {};
|
|
36913
|
+
"use strict";
|
|
36914
|
+
var $55a853fa49f658b3$exports = {};
|
|
36915
|
+
"use strict";
|
|
36916
|
+
$55a853fa49f658b3$exports = ({ onlyFirst: onlyFirst = false } = {})=>{
|
|
36917
|
+
const pattern = [
|
|
36918
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
36919
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
36920
|
+
].join("|");
|
|
36921
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
36922
|
+
};
|
|
36923
|
+
|
|
36924
|
+
|
|
36925
|
+
$f709bcec854d2334$exports = (string)=>typeof string === "string" ? string.replace($55a853fa49f658b3$exports(), "") : string;
|
|
36926
|
+
|
|
36927
|
+
|
|
36928
|
+
|
|
36826
36929
|
|
|
36827
36930
|
//# sourceMappingURL=index.js.map
|