mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
feat(es/minifier): Inline vars initialized before the declaration (#6027)
This commit is contained in:
parent
8e67fcc357
commit
c4850997a2
@ -2,13 +2,13 @@
|
||||
let ka, other, complex, overEmit;
|
||||
import _extends from "@swc/helpers/src/_extends.mjs";
|
||||
import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
|
||||
_object_without_properties((_complex = complex).x, [
|
||||
_object_without_properties(complex.x, [
|
||||
"ka"
|
||||
]), _object_without_properties(_complex, [
|
||||
]), _object_without_properties(complex, [
|
||||
"x",
|
||||
"y"
|
||||
]), { x: { ka } , y: other } = _complex;
|
||||
var _complex, { a: [{}, ...y] , b: { z } } = overEmit;
|
||||
]), { x: { ka } , y: other } = complex;
|
||||
var { a: [{}, ...y] , b: { z } } = overEmit;
|
||||
_extends({}, overEmit.a[0]), _object_without_properties(overEmit.b, [
|
||||
"z"
|
||||
]), _object_without_properties(overEmit, [
|
||||
|
@ -10,16 +10,16 @@ function curry(f) {
|
||||
return f.apply(void 0, _to_consumable_array(_$a).concat(_to_consumable_array(b)));
|
||||
};
|
||||
}
|
||||
u = [
|
||||
10,
|
||||
!0
|
||||
], [
|
||||
[
|
||||
1
|
||||
].concat(_to_consumable_array([
|
||||
"hello"
|
||||
]), [
|
||||
2
|
||||
], _to_consumable_array(u), [
|
||||
], _to_consumable_array([
|
||||
10,
|
||||
!0
|
||||
]), [
|
||||
3
|
||||
]), concat([], []), concat([
|
||||
"hello"
|
||||
@ -33,15 +33,15 @@ u = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]), u1 = [
|
||||
4,
|
||||
5,
|
||||
6
|
||||
], _to_consumable_array([
|
||||
]), _to_consumable_array([
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]).concat(_to_consumable_array(u1)), ft1([
|
||||
]).concat(_to_consumable_array([
|
||||
4,
|
||||
5,
|
||||
6
|
||||
])), ft1([
|
||||
"hello",
|
||||
42
|
||||
]), ft2([
|
||||
@ -67,7 +67,7 @@ u = [
|
||||
"def"
|
||||
]
|
||||
]);
|
||||
var u, u1, fn1 = function(a1, b, c, d) {
|
||||
var fn1 = function(a1, b, c, d) {
|
||||
return 0;
|
||||
};
|
||||
curry(fn1), curry(fn1, 1), curry(fn1, 1, "abc"), curry(fn1, 1, "abc", !0), curry(fn1, 1, "abc", !0, [
|
||||
|
@ -146,7 +146,7 @@ impl Storage for ProgramData {
|
||||
.vars
|
||||
.entry(i.to_id())
|
||||
.and_modify(|v| {
|
||||
if has_init && v.declared {
|
||||
if has_init && (v.declared || v.var_initialized) {
|
||||
trace_op!("declare_decl(`{}`): Already declared", i);
|
||||
|
||||
v.mutated = true;
|
||||
@ -224,9 +224,11 @@ impl ProgramData {
|
||||
let e = self.vars.entry(i.clone()).or_insert_with(|| {
|
||||
// trace!("insert({}{:?})", i.0, i.1);
|
||||
|
||||
let simple_assign = ctx.is_exact_reassignment && !ctx.is_op_assign;
|
||||
|
||||
VarUsageInfo {
|
||||
is_fn_local: true,
|
||||
used_above_decl: true,
|
||||
used_above_decl: !simple_assign,
|
||||
..Default::default()
|
||||
}
|
||||
});
|
||||
|
@ -4417,7 +4417,7 @@
|
||||
target.registerClass = function(clz) {
|
||||
var componentFullType = clz.type || clz.prototype.type;
|
||||
if (componentFullType) {
|
||||
componentType = componentFullType, assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType "' + componentType + '" illegal'), clz.prototype.type = componentFullType;
|
||||
assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentFullType), 'componentType "' + componentFullType + '" illegal'), clz.prototype.type = componentFullType;
|
||||
var componentTypeInfo, container, componentType, componentTypeInfo1 = parseClassType(componentFullType);
|
||||
componentTypeInfo1.sub ? componentTypeInfo1.sub !== IS_CONTAINER && (((container = storage[(componentTypeInfo = componentTypeInfo1).main]) && container[IS_CONTAINER] || ((container = storage[componentTypeInfo.main] = {})[IS_CONTAINER] = !0), container)[componentTypeInfo1.sub] = clz) : (storage[componentTypeInfo1.main] && console.warn(componentTypeInfo1.main + ' exists.'), storage[componentTypeInfo1.main] = clz);
|
||||
}
|
||||
@ -16744,7 +16744,7 @@
|
||||
var displayable = list[i], svgProxy = getSvgProxy(displayable), svgElement = getSvgElement(displayable);
|
||||
!displayable.invisible && ((displayable.__dirty || !svgElement) && (svgProxy && svgProxy.brush(displayable), (svgElement = getSvgElement(displayable)) && displayable.style && (gradientManager.update(displayable.style.fill), gradientManager.update(displayable.style.stroke), patternManager.update(displayable.style.fill), patternManager.update(displayable.style.stroke), shadowManager.update(svgElement, displayable)), displayable.__dirty = 0), svgElement && newVisibleList.push(displayable));
|
||||
}
|
||||
for(var diff = (oldArr = visibleList, newArr = newVisibleList, function(oldArr, newArr, equals) {
|
||||
for(var diff = function(oldArr, newArr, equals) {
|
||||
equals || (equals = function(a, b) {
|
||||
return a === b;
|
||||
}), oldArr = oldArr.slice();
|
||||
@ -16797,7 +16797,7 @@
|
||||
}();
|
||||
if (ret) return ret;
|
||||
}
|
||||
}(oldArr, newArr, void 0)), i = 0; i < diff.length; i++){
|
||||
}(visibleList, newVisibleList, void 0), i = 0; i < diff.length; i++){
|
||||
var item = diff[i];
|
||||
if (item.removed) for(var k = 0; k < item.count; k++){
|
||||
var oldArr, newArr, child, parent, child1, displayable = visibleList[item.indices[k]], svgElement = getSvgElement(displayable);
|
||||
|
@ -16569,7 +16569,7 @@
|
||||
function VictoryTransition(props, context) {
|
||||
!function(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function");
|
||||
}(this, VictoryTransition), self1 = this, (_this = (call = (VictoryTransition.__proto__ || Object.getPrototypeOf(VictoryTransition)).call(this, props, context)) && ("object" == typeof call || "function" == typeof call) ? call : _assertThisInitialized(self1)).state = {
|
||||
}(this, VictoryTransition), (_this = (call = (VictoryTransition.__proto__ || Object.getPrototypeOf(VictoryTransition)).call(this, props, context)) && ("object" == typeof call || "function" == typeof call) ? call : _assertThisInitialized(this)).state = {
|
||||
nodesShouldLoad: !1,
|
||||
nodesDoneLoad: !1
|
||||
};
|
||||
@ -16783,7 +16783,7 @@
|
||||
function addEvents(props) {
|
||||
!function(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function");
|
||||
}(this, addEvents), self1 = this, _this = (call = (addEvents.__proto__ || Object.getPrototypeOf(addEvents)).call(this, props)) && ("object" == typeof call || "function" == typeof call) ? call : _assertThisInitialized(self1);
|
||||
}(this, addEvents), _this = (call = (addEvents.__proto__ || Object.getPrototypeOf(addEvents)).call(this, props)) && ("object" == typeof call || "function" == typeof call) ? call : _assertThisInitialized(this);
|
||||
var self1, call, _this, getScopedEvents = _events__WEBPACK_IMPORTED_MODULE_10__.default.getScopedEvents.bind(_assertThisInitialized(_this)), boundGetEvents = _events__WEBPACK_IMPORTED_MODULE_10__.default.getEvents.bind(_assertThisInitialized(_this));
|
||||
_this.state = {}, _this.getEvents = function(p, target, eventKey) {
|
||||
return boundGetEvents(p, target, eventKey, getScopedEvents);
|
||||
|
@ -9783,8 +9783,8 @@
|
||||
if (ok) {
|
||||
var path = createPath(location), encodedPath = encodePath(basename + path);
|
||||
if (getHashPath() !== encodedPath) {
|
||||
ignorePath = path, path1 = encodedPath, window.location.hash = path1;
|
||||
var path1, prevIndex = allPaths.lastIndexOf(createPath(history.location)), nextPaths = allPaths.slice(0, prevIndex + 1);
|
||||
ignorePath = path, window.location.hash = encodedPath;
|
||||
var prevIndex = allPaths.lastIndexOf(createPath(history.location)), nextPaths = allPaths.slice(0, prevIndex + 1);
|
||||
nextPaths.push(path), allPaths = nextPaths, setState({
|
||||
action: action,
|
||||
location: location
|
||||
|
@ -2563,9 +2563,9 @@
|
||||
}(view.dom, coords, box))) return null;
|
||||
}
|
||||
if (result.safari) for(var p = elt; node && p; p = parentNode(p))p.draggable && (node = offset = null);
|
||||
if (dom = elt, coords1 = coords, elt = (parent = dom.parentNode) && /^li$/i.test(parent.nodeName) && coords1.left < dom.getBoundingClientRect().left ? parent : dom, node) {
|
||||
if (elt = (parent = (dom = elt).parentNode) && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left ? parent : dom, node) {
|
||||
if (result.gecko && 1 == node.nodeType && (offset = Math.min(offset, node.childNodes.length)) < node.childNodes.length) {
|
||||
var dom, coords1, parent, box$1, next = node.childNodes[offset];
|
||||
var dom, parent, box$1, next = node.childNodes[offset];
|
||||
"IMG" == next.nodeName && (box$1 = next.getBoundingClientRect()).right <= coords.left && box$1.bottom > coords.top && offset++;
|
||||
}
|
||||
node == view.dom && offset == node.childNodes.length - 1 && 1 == node.lastChild.nodeType && coords.top > node.lastChild.getBoundingClientRect().bottom ? pos = view.state.doc.content.size : (0 == offset || 1 != node.nodeType || "BR" != node.childNodes[offset - 1].nodeName) && (pos = function(view, node, offset, coords) {
|
||||
|
@ -7842,46 +7842,8 @@
|
||||
for(i = payload.length; i--;)size += payload[i].byteLength;
|
||||
for(result = new Uint8Array(size + 8), new DataView(result.buffer, result.byteOffset, result.byteLength).setUint32(0, result.byteLength), result.set(type, 4), i = 0, size = 8; i < payload.length; i++)result.set(payload[i], size), size += payload[i].byteLength;
|
||||
return result;
|
||||
}, dinf = function() {
|
||||
return box(types.dinf, box(types.dref, DREF));
|
||||
}, esds = function(track) {
|
||||
return box(types.esds, new Uint8Array([
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x03,
|
||||
0x19,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x04,
|
||||
0x11,
|
||||
0x40,
|
||||
0x15,
|
||||
0x00,
|
||||
0x06,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xda,
|
||||
0xc0,
|
||||
0x00,
|
||||
0x00,
|
||||
0xda,
|
||||
0xc0,
|
||||
0x05,
|
||||
0x02,
|
||||
track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
|
||||
track.samplingfrequencyindex << 7 | track.channelcount << 3,
|
||||
0x06,
|
||||
0x01,
|
||||
0x02
|
||||
]));
|
||||
}, ftyp = function() {
|
||||
return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
|
||||
}, hdlr = function(type) {
|
||||
return box(types.hdlr, HDLR_TYPES[type]);
|
||||
}, mdat = function(data) {
|
||||
return box(types.mdat, data);
|
||||
}, mdhd = function(track) {
|
||||
@ -7913,7 +7875,8 @@
|
||||
]);
|
||||
return track.samplerate && (result[12] = track.samplerate >>> 24 & 0xff, result[13] = track.samplerate >>> 16 & 0xff, result[14] = track.samplerate >>> 8 & 0xff, result[15] = 0xff & track.samplerate), box(types.mdhd, result);
|
||||
}, mdia = function(track) {
|
||||
return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
|
||||
var type;
|
||||
return box(types.mdia, mdhd(track), (type = track.type, box(types.hdlr, HDLR_TYPES[type])), minf(track));
|
||||
}, mfhd = function(sequenceNumber) {
|
||||
return box(types.mfhd, new Uint8Array([
|
||||
0x00,
|
||||
@ -7926,7 +7889,7 @@
|
||||
0xff & sequenceNumber
|
||||
]));
|
||||
}, minf = function(track) {
|
||||
return box(types.minf, "video" === track.type ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
|
||||
return box(types.minf, "video" === track.type ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), box(types.dinf, box(types.dref, DREF)), stbl(track));
|
||||
}, moof = function(sequenceNumber, tracks) {
|
||||
for(var trackFragments = [], i = tracks.length; i--;)trackFragments[i] = traf(tracks[i]);
|
||||
return box.apply(null, [
|
||||
@ -8220,7 +8183,39 @@
|
||||
0xff & track.samplerate,
|
||||
0x00,
|
||||
0x00
|
||||
]), esds(track));
|
||||
]), box(types.esds, new Uint8Array([
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x03,
|
||||
0x19,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x04,
|
||||
0x11,
|
||||
0x40,
|
||||
0x15,
|
||||
0x00,
|
||||
0x06,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xda,
|
||||
0xc0,
|
||||
0x00,
|
||||
0x00,
|
||||
0xda,
|
||||
0xc0,
|
||||
0x05,
|
||||
0x02,
|
||||
track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
|
||||
track.samplingfrequencyindex << 7 | track.channelcount << 3,
|
||||
0x06,
|
||||
0x01,
|
||||
0x02
|
||||
])));
|
||||
}, tkhd = function(track) {
|
||||
var result = new Uint8Array([
|
||||
0x00,
|
||||
@ -9318,7 +9313,7 @@
|
||||
};
|
||||
};
|
||||
TimestampRolloverStream$1.prototype = new Stream();
|
||||
var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, timestampRolloverStream = {
|
||||
var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, timestampRolloverStream = {
|
||||
TimestampRolloverStream: TimestampRolloverStream$1,
|
||||
handleRollover: handleRollover$1
|
||||
}, percentEncode$1 = function(bytes, start, end) {
|
||||
|
@ -95,11 +95,11 @@
|
||||
return e = error, this.trigger("error", e), null;
|
||||
}
|
||||
}
|
||||
}, DLList$1 = DLList, Events$1 = Events, Queues = class {
|
||||
}, Queues = class {
|
||||
constructor(num_priorities){
|
||||
this.Events = new Events$1(this), this._length = 0, this._lists = (function() {
|
||||
this.Events = new Events(this), this._length = 0, this._lists = (function() {
|
||||
var j, results;
|
||||
for(results = [], j = 1; 1 <= num_priorities ? j <= num_priorities : j >= num_priorities; 1 <= num_priorities ? ++j : --j)results.push(new DLList$1(()=>this.incr(), ()=>this.decr()));
|
||||
for(results = [], j = 1; 1 <= num_priorities ? j <= num_priorities : j >= num_priorities; 1 <= num_priorities ? ++j : --j)results.push(new DLList(()=>this.incr(), ()=>this.decr()));
|
||||
return results;
|
||||
}).call(this);
|
||||
}
|
||||
@ -129,21 +129,21 @@
|
||||
return this.getFirst(this._lists.slice(priority).reverse()).shift();
|
||||
}
|
||||
}, BottleneckError = class extends Error {
|
||||
}, NUM_PRIORITIES = 10, DEFAULT_PRIORITY = 5, parser$1 = parser, BottleneckError$1 = BottleneckError, Job = class {
|
||||
}, Job = class {
|
||||
constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise1){
|
||||
this.task = task, this.args = args, this.rejectOnDrop = rejectOnDrop, this.Events = Events, this._states = _states, this.Promise = Promise1, this.options = parser$1.load(options, jobDefaults), this.options.priority = this._sanitizePriority(this.options.priority), this.options.id === jobDefaults.id && (this.options.id = `${this.options.id}-${this._randomIndex()}`), this.promise = new this.Promise((_resolve, _reject)=>{
|
||||
this.task = task, this.args = args, this.rejectOnDrop = rejectOnDrop, this.Events = Events, this._states = _states, this.Promise = Promise1, this.options = parser.load(options, jobDefaults), this.options.priority = this._sanitizePriority(this.options.priority), this.options.id === jobDefaults.id && (this.options.id = `${this.options.id}-${this._randomIndex()}`), this.promise = new this.Promise((_resolve, _reject)=>{
|
||||
this._resolve = _resolve, this._reject = _reject;
|
||||
}), this.retryCount = 0;
|
||||
}
|
||||
_sanitizePriority(priority) {
|
||||
var sProperty;
|
||||
return (sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority) < 0 ? 0 : sProperty > NUM_PRIORITIES - 1 ? NUM_PRIORITIES - 1 : sProperty;
|
||||
return (sProperty = ~~priority !== priority ? 5 : priority) < 0 ? 0 : sProperty > 9 ? 9 : sProperty;
|
||||
}
|
||||
_randomIndex() {
|
||||
return Math.random().toString(36).slice(2);
|
||||
}
|
||||
doDrop({ error , message ="This job has been dropped by Bottleneck" } = {}) {
|
||||
return !!this._states.remove(this.options.id) && (this.rejectOnDrop && this._reject(null != error ? error : new BottleneckError$1(message)), this.Events.trigger("dropped", {
|
||||
return !!this._states.remove(this.options.id) && (this.rejectOnDrop && this._reject(null != error ? error : new BottleneckError(message)), this.Events.trigger("dropped", {
|
||||
args: this.args,
|
||||
options: this.options,
|
||||
task: this.task,
|
||||
@ -152,7 +152,7 @@
|
||||
}
|
||||
_assertStatus(expected) {
|
||||
var status;
|
||||
if (!((status = this._states.jobStatus(this.options.id)) === expected || "DONE" === expected && null === status)) throw new BottleneckError$1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`);
|
||||
if (!((status = this._states.jobStatus(this.options.id)) === expected || "DONE" === expected && null === status)) throw new BottleneckError(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`);
|
||||
}
|
||||
doReceive() {
|
||||
return this._states.start(this.options.id), this.Events.trigger("received", {
|
||||
@ -193,7 +193,7 @@
|
||||
args: this.args,
|
||||
options: this.options,
|
||||
retryCount: this.retryCount
|
||||
}, error = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`), this._onFailure(error, eventInfo, clearGlobalState, run, free);
|
||||
}, error = new BottleneckError(`This job timed out after ${this.options.expiration} ms.`), this._onFailure(error, eventInfo, clearGlobalState, run, free);
|
||||
}
|
||||
async _onFailure(error, eventInfo, clearGlobalState, run, free) {
|
||||
var retry, retryAfter;
|
||||
@ -202,9 +202,9 @@
|
||||
doDone(eventInfo) {
|
||||
return this._assertStatus("EXECUTING"), this._states.next(this.options.id), this.Events.trigger("done", eventInfo);
|
||||
}
|
||||
}, parser$2 = parser, BottleneckError$2 = BottleneckError, LocalDatastore = class {
|
||||
}, LocalDatastore = class {
|
||||
constructor(instance, storeOptions, storeInstanceOptions){
|
||||
this.instance = instance, this.storeOptions = storeOptions, this.clientId = this.instance._randomIndex(), parser$2.load(storeInstanceOptions, storeInstanceOptions, this), this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(), this._running = 0, this._done = 0, this._unblockTime = 0, this.ready = this.Promise.resolve(), this.clients = {}, this._startHeartbeat();
|
||||
this.instance = instance, this.storeOptions = storeOptions, this.clientId = this.instance._randomIndex(), parser.load(storeInstanceOptions, storeInstanceOptions, this), this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(), this._running = 0, this._done = 0, this._unblockTime = 0, this.ready = this.Promise.resolve(), this.clients = {}, this._startHeartbeat();
|
||||
}
|
||||
_startHeartbeat() {
|
||||
var base;
|
||||
@ -229,7 +229,7 @@
|
||||
return null != (ref = this.storeOptions.penalty) ? ref : 15 * this.storeOptions.minTime || 5000;
|
||||
}
|
||||
async __updateSettings__(options) {
|
||||
return await this.yieldLoop(), parser$2.overwrite(options, options, this.storeOptions), this._startHeartbeat(), this.instance._drainAll(this.computeCapacity()), !0;
|
||||
return await this.yieldLoop(), parser.overwrite(options, options, this.storeOptions), this._startHeartbeat(), this.instance._drainAll(this.computeCapacity()), !0;
|
||||
}
|
||||
async __running__() {
|
||||
return await this.yieldLoop(), this._running;
|
||||
@ -283,7 +283,7 @@
|
||||
}
|
||||
async __submit__(queueLength, weight) {
|
||||
var blocked, now, reachedHWM;
|
||||
if (await this.yieldLoop(), null != this.storeOptions.maxConcurrent && weight > this.storeOptions.maxConcurrent) throw new BottleneckError$2(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`);
|
||||
if (await this.yieldLoop(), null != this.storeOptions.maxConcurrent && weight > this.storeOptions.maxConcurrent) throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`);
|
||||
return now = Date.now(), reachedHWM = null != this.storeOptions.highWater && queueLength === this.storeOptions.highWater && !this.check(weight, now), (blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now))) && (this._unblockTime = now + this.computePenalty(), this._nextRequest = this._unblockTime + this.storeOptions.minTime, this.instance._dropAllQueued()), {
|
||||
reachedHWM,
|
||||
blocked,
|
||||
@ -295,7 +295,7 @@
|
||||
running: this._running
|
||||
};
|
||||
}
|
||||
}, BottleneckError$3 = BottleneckError, States = class {
|
||||
}, States = class {
|
||||
constructor(status1){
|
||||
this.status = status1, this._jobs = {}, this.counts = this.status.map(function() {
|
||||
return 0;
|
||||
@ -319,16 +319,16 @@
|
||||
statusJobs(status) {
|
||||
var k, pos, ref, results;
|
||||
if (null == status) return Object.keys(this._jobs);
|
||||
if ((pos = this.status.indexOf(status)) < 0) throw new BottleneckError$3(`status must be one of ${this.status.join(', ')}`);
|
||||
if ((pos = this.status.indexOf(status)) < 0) throw new BottleneckError(`status must be one of ${this.status.join(', ')}`);
|
||||
for(k in ref = this._jobs, results = [], ref)ref[k] === pos && results.push(k);
|
||||
return results;
|
||||
}
|
||||
statusCounts() {
|
||||
return this.counts.reduce((acc, v, i)=>(acc[this.status[i]] = v, acc), {});
|
||||
}
|
||||
}, DLList$2 = DLList, Sync = class {
|
||||
}, Sync = class {
|
||||
constructor(name, Promise1){
|
||||
this.schedule = this.schedule.bind(this), this.name = name, this.Promise = Promise1, this._running = 0, this._queue = new DLList$2();
|
||||
this.schedule = this.schedule.bind(this), this.name = name, this.Promise = Promise1, this._running = 0, this._queue = new DLList();
|
||||
}
|
||||
isEmpty() {
|
||||
return 0 === this._queue.length;
|
||||
@ -365,12 +365,12 @@
|
||||
version: version
|
||||
}
|
||||
}), require$$2 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$3 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$4 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.');
|
||||
parser$3 = parser, Events$2 = Events, RedisConnection$1 = require$$2, IORedisConnection$1 = require$$3, Scripts$1 = require$$4, Group = (function() {
|
||||
Group = (function() {
|
||||
class Group {
|
||||
constructor(limiterOptions = {}){
|
||||
this.deleteKey = this.deleteKey.bind(this), this.limiterOptions = limiterOptions, parser$3.load(this.limiterOptions, this.defaults, this), this.Events = new Events$2(this), this.instances = {}, this.Bottleneck = Bottleneck_1, this._startAutoCleanup(), this.sharedConnection = null != this.connection, null == this.connection && ("redis" === this.limiterOptions.datastore ? this.connection = new RedisConnection$1(Object.assign({}, this.limiterOptions, {
|
||||
this.deleteKey = this.deleteKey.bind(this), this.limiterOptions = limiterOptions, parser.load(this.limiterOptions, this.defaults, this), this.Events = new Events(this), this.instances = {}, this.Bottleneck = Bottleneck_1, this._startAutoCleanup(), this.sharedConnection = null != this.connection, null == this.connection && ("redis" === this.limiterOptions.datastore ? this.connection = new require$$2(Object.assign({}, this.limiterOptions, {
|
||||
Events: this.Events
|
||||
})) : "ioredis" === this.limiterOptions.datastore && (this.connection = new IORedisConnection$1(Object.assign({}, this.limiterOptions, {
|
||||
})) : "ioredis" === this.limiterOptions.datastore && (this.connection = new require$$3(Object.assign({}, this.limiterOptions, {
|
||||
Events: this.Events
|
||||
}))));
|
||||
}
|
||||
@ -389,7 +389,7 @@
|
||||
var deleted, instance;
|
||||
return instance = this.instances[key], this.connection && (deleted = await this.connection.__runCommand__([
|
||||
'del',
|
||||
...Scripts$1.allKeys(`${this.id}-${key}`)
|
||||
...require$$4.allKeys(`${this.id}-${key}`)
|
||||
])), null != instance && (delete this.instances[key], await instance.disconnect()), null != instance || deleted > 0;
|
||||
}
|
||||
limiters() {
|
||||
@ -432,7 +432,7 @@
|
||||
}, this.timeout / 2)).unref ? base.unref() : void 0;
|
||||
}
|
||||
updateSettings(options = {}) {
|
||||
if (parser$3.overwrite(options, this.defaults, this), parser$3.overwrite(options, options, this.limiterOptions), null != options.timeout) return this._startAutoCleanup();
|
||||
if (parser.overwrite(options, this.defaults, this), parser.overwrite(options, options, this.limiterOptions), null != options.timeout) return this._startAutoCleanup();
|
||||
}
|
||||
disconnect(flush = !0) {
|
||||
var ref;
|
||||
@ -445,10 +445,10 @@
|
||||
Promise: Promise,
|
||||
id: "group-key"
|
||||
}, Group;
|
||||
}).call(commonjsGlobal), parser$4 = parser, Events$3 = Events, Batcher = (function() {
|
||||
}).call(commonjsGlobal), Batcher = (function() {
|
||||
class Batcher {
|
||||
constructor(options = {}){
|
||||
this.options = options, parser$4.load(this.options, this.defaults, this), this.Events = new Events$3(this), this._arr = [], this._resetPromise(), this._lastFlush = Date.now();
|
||||
this.options = options, parser.load(this.options, this.defaults, this), this.Events = new Events(this), this._arr = [], this._resetPromise(), this._lastFlush = Date.now();
|
||||
}
|
||||
_resetPromise() {
|
||||
return this._promise = new this.Promise((res, rej)=>this._resolve = res);
|
||||
@ -467,7 +467,7 @@
|
||||
Promise: Promise
|
||||
}, Batcher;
|
||||
}).call(commonjsGlobal);
|
||||
var DLList, Events, DLList$1, Events$1, Queues, BottleneckError, BottleneckError$1, DEFAULT_PRIORITY, Job, NUM_PRIORITIES, parser$1, BottleneckError$2, LocalDatastore, parser$2, BottleneckError$3, States, DLList$2, Sync, Events$2, Group, IORedisConnection$1, RedisConnection$1, Scripts$1, parser$3, Batcher, Events$3, parser$4, require$$4$1 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$8 = version$2 && version$2.default || version$2, splice = [].splice, Bottleneck_1 = (function() {
|
||||
var DLList, Events, Queues, BottleneckError, Job, LocalDatastore, States, Sync, Group, Batcher, require$$4$1 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$8 = version$2 && version$2.default || version$2, splice = [].splice, Bottleneck_1 = (function() {
|
||||
class Bottleneck {
|
||||
constructor(options = {}, ...invalid){
|
||||
var storeInstanceOptions, storeOptions;
|
||||
|
@ -5111,8 +5111,8 @@
|
||||
}), fold.collapseChildren = this.collapseChildren, fold;
|
||||
}, this.addSubFold = function(fold) {
|
||||
if (!this.range.isEqual(fold)) {
|
||||
range = fold, anchor = this.start, consumePoint(range.start, anchor), consumePoint(range.end, anchor);
|
||||
for(var range, anchor, row = fold.start.row, column = fold.start.column, i = 0, cmp = -1; i < this.subFolds.length && 1 == (cmp = this.subFolds[i].range.compare(row, column)); i++);
|
||||
anchor = this.start, consumePoint(fold.start, anchor), consumePoint(fold.end, anchor);
|
||||
for(var anchor, row = fold.start.row, column = fold.start.column, i = 0, cmp = -1; i < this.subFolds.length && 1 == (cmp = this.subFolds[i].range.compare(row, column)); i++);
|
||||
var afterStart = this.subFolds[i], firstConsumed = 0;
|
||||
if (0 == cmp) {
|
||||
if (afterStart.range.containsRange(fold)) return afterStart.addSubFold(fold);
|
||||
|
@ -2291,17 +2291,17 @@
|
||||
return t.type === e;
|
||||
};
|
||||
}, tL = tN(T.Svg), tU = tN(T.Text), tz = function e(t, r) {
|
||||
if (n = t, tU(n) && !n.lines) {
|
||||
var n, i = t.box.width - (t.box.paddingRight + t.box.paddingLeft), o = t.box.height - (t.box.paddingTop + t.box.paddingBottom);
|
||||
t.lines = tM(t, i, o, r);
|
||||
if (tU(t) && !t.lines) {
|
||||
var n = t.box.width - (t.box.paddingRight + t.box.paddingLeft), i = t.box.height - (t.box.paddingTop + t.box.paddingBottom);
|
||||
t.lines = tM(t, n, i, r);
|
||||
}
|
||||
if (!tL(t) && !tU(t)) {
|
||||
if (!t.children) return t;
|
||||
var a = function(t) {
|
||||
var o = function(t) {
|
||||
return e(t, r);
|
||||
}, u = t.children.map(a);
|
||||
}, a = t.children.map(o);
|
||||
return Object.assign({}, t, {
|
||||
children: u
|
||||
children: a
|
||||
});
|
||||
}
|
||||
return t;
|
||||
@ -2605,11 +2605,11 @@
|
||||
return a.isNil(e) ? null : a.compose(rG, rq, rW, rz, function e(t, r) {
|
||||
return function(n) {
|
||||
var i = q.default.Node.createWithConfig(rO), o = Object.assign({}, n);
|
||||
if (o[rT] = i, rL(o), u = n, !rF(u) && !rR(u) && !rP(u) && n.children) {
|
||||
var u, l = a.compose(function(e) {
|
||||
if (o[rT] = i, rL(o), !rF(n) && !rR(n) && !rP(n) && n.children) {
|
||||
var u = a.compose(function(e) {
|
||||
return i.insertChild(e[rT], i.getChildCount()), e;
|
||||
}, e(t, r));
|
||||
o.children = n.children.map(l);
|
||||
o.children = n.children.map(u);
|
||||
}
|
||||
return rU(o, t, r), o;
|
||||
};
|
||||
@ -15994,12 +15994,12 @@
|
||||
}), r > 2) ? "one of ".concat(t, " ").concat(e.slice(0, r - 1).join(", "), ", or ") + e[r - 1] : 2 === r ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0]);
|
||||
}
|
||||
s("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError), s("ERR_INVALID_ARG_TYPE", function(e, t, i) {
|
||||
if ((void 0 === a && (a = r(313)), a("string" == typeof e, "'name' must be a string"), "string" == typeof t && (o = "not ", t.substr(!u || u < 0 ? 0 : +u, o.length) === o)) ? (p = "must not be", t = t.replace(/^not /, "")) : p = "must be", l = e, s = " argument", (void 0 === f || f > l.length) && (f = l.length), l.substring(f - s.length, f) === s) h = "The ".concat(e, " ").concat(p, " ").concat(c(t, "type"));
|
||||
if ((void 0 === a && (a = r(313)), a("string" == typeof e, "'name' must be a string"), "string" == typeof t && (o = "not ", t.substr(!u || u < 0 ? 0 : +u, o.length) === o)) ? (d = "must not be", t = t.replace(/^not /, "")) : d = "must be", l = " argument", (void 0 === s || s > e.length) && (s = e.length), e.substring(s - l.length, s) === l) p = "The ".concat(e, " ").concat(d, " ").concat(c(t, "type"));
|
||||
else {
|
||||
var o, u, l, s, f, d, p, h, y = ("number" != typeof d && (d = 0), d + 1 > e.length || -1 === e.indexOf(".", d)) ? "argument" : "property";
|
||||
h = 'The "'.concat(e, '" ').concat(y, " ").concat(p, " ").concat(c(t, "type"));
|
||||
var o, u, l, s, f, d, p, h = ("number" != typeof f && (f = 0), f + 1 > e.length || -1 === e.indexOf(".", f)) ? "argument" : "property";
|
||||
p = 'The "'.concat(e, '" ').concat(h, " ").concat(d, " ").concat(c(t, "type"));
|
||||
}
|
||||
return h + ". Received type ".concat(n(i));
|
||||
return p + ". Received type ".concat(n(i));
|
||||
}, TypeError), s("ERR_INVALID_ARG_VALUE", function(e, t) {
|
||||
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "is invalid";
|
||||
void 0 === u && (u = r(650));
|
||||
|
@ -4868,11 +4868,11 @@
|
||||
}));
|
||||
}, s;
|
||||
}(function qe(e, t, n) {
|
||||
var o = N(e), i = !ke(e), a = t.attrs, c = void 0 === a ? w : a, d = t.componentId, h = void 0 === d ? (e1 = t.displayName, t1 = t.parentComponentId, Ye[n1 = "string" != typeof e1 ? "sc" : Te(e1)] = (Ye[n1] || 0) + 1, r = n1 + "-" + xe("5.3.5" + n1 + Ye[n1]), t1 ? t1 + "-" + r : r) : d, p = t.displayName, f = void 0 === p ? (e2 = e, ke(e2) ? "styled." + e2 : "Styled(" + _(e2) + ")") : p, g = t.displayName && t.componentId ? Te(t.displayName) + "-" + t.componentId : t.componentId || h, S = o && e.attrs ? Array.prototype.concat(e.attrs, c).filter(Boolean) : c, A = t.shouldForwardProp;
|
||||
var o = N(e), i = !ke(e), a = t.attrs, c = void 0 === a ? w : a, d = t.componentId, h = void 0 === d ? (e1 = t.displayName, t1 = t.parentComponentId, Ye[n1 = "string" != typeof e1 ? "sc" : Te(e1)] = (Ye[n1] || 0) + 1, r = n1 + "-" + xe("5.3.5" + n1 + Ye[n1]), t1 ? t1 + "-" + r : r) : d, p = t.displayName, f = void 0 === p ? ke(e) ? "styled." + e : "Styled(" + _(e) + ")" : p, g = t.displayName && t.componentId ? Te(t.displayName) + "-" + t.componentId : t.componentId || h, S = o && e.attrs ? Array.prototype.concat(e.attrs, c).filter(Boolean) : c, A = t.shouldForwardProp;
|
||||
o && e.shouldForwardProp && (A = t.shouldForwardProp ? function(n, r, o) {
|
||||
return e.shouldForwardProp(n, r, o) && t.shouldForwardProp(n, r, o);
|
||||
} : e.shouldForwardProp);
|
||||
var e1, t1, n1, r, e2, C, I = new se(n, g, o ? e.componentStyle : void 0), P = I.isStatic && 0 === c.length, O = function(e, t) {
|
||||
var e1, t1, n1, r, C, I = new se(n, g, o ? e.componentStyle : void 0), P = I.isStatic && 0 === c.length, O = function(e, t) {
|
||||
return function(e, t, n, r) {
|
||||
var e1, r1, o, o1, s, o2 = e.attrs, i = e.componentStyle, a = e.defaultProps, c = e.foldedComponentIds, d = e.shouldForwardProp, h = e.styledComponentId, p = e.target, f = (void 0 === (e1 = Re(t, (0, react.useContext)(Ge), a) || E) && (e1 = E), r1 = v({}, t, {
|
||||
theme: e1
|
||||
|
@ -0,0 +1,20 @@
|
||||
export function foo() {
|
||||
b = 1;
|
||||
console.log(2);
|
||||
console.log(b);
|
||||
|
||||
for (var b, c = 0; c < 10; c++) {
|
||||
console.log(c);
|
||||
}
|
||||
}
|
||||
|
||||
export function bar() {
|
||||
function x() {
|
||||
b = 1;
|
||||
}
|
||||
|
||||
for (var b = 10, c = 0; c < 10; c++) {
|
||||
/*#__NOINLINE__*/ x();
|
||||
console.log(b, c);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
export function foo() {
|
||||
console.log(2), console.log(1);
|
||||
for(var c = 0; c < 10; c++)console.log(c);
|
||||
}
|
||||
export function bar() {
|
||||
function x() {
|
||||
b = 1;
|
||||
}
|
||||
for(var b = 10, c = 0; c < 10; c++)x(), console.log(b, c);
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user