scratch-storage 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/node/chunks/{fetch-worker.eefe62e3c8ee125d3436.js → fetch-worker.3bf90a691c26a60b5752.js} +158 -52
- package/dist/node/chunks/fetch-worker.3bf90a691c26a60b5752.js.map +1 -0
- package/dist/node/scratch-storage.js +155 -78
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/web/chunks/fetch-worker.42ee2f0bc3b8de590472.js +2 -0
- package/dist/web/chunks/{fetch-worker.85da71862ab8ee15f1cd.js.map → fetch-worker.42ee2f0bc3b8de590472.js.map} +1 -1
- package/dist/web/chunks/{fetch-worker.ba5eddd48c8ae259073b.js → fetch-worker.cd3a909d7b876aabf94a.js} +158 -52
- package/dist/web/chunks/fetch-worker.cd3a909d7b876aabf94a.js.map +1 -0
- package/dist/web/scratch-storage.js +153 -52
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1 -1
- package/package.json +3 -3
- package/src/scratchFetch.js +10 -13
- package/webpack.config.js +8 -5
- package/dist/node/chunks/fetch-worker.eefe62e3c8ee125d3436.js.map +0 -1
- package/dist/web/chunks/fetch-worker.85da71862ab8ee15f1cd.js +0 -2
- package/dist/web/chunks/fetch-worker.ba5eddd48c8ae259073b.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.1](https://github.com/scratchfoundation/scratch-storage/compare/v3.0.0...v3.0.1) (2024-10-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix web worker usage in scratch-vm integration tests ([78b2c66](https://github.com/scratchfoundation/scratch-storage/commit/78b2c66140dbee8f8cbde9dc546ccd075642858b))
|
|
12
|
+
|
|
6
13
|
# [3.0.0](https://github.com/scratchfoundation/scratch-storage/compare/v2.3.284...v3.0.0) (2024-10-23)
|
|
7
14
|
|
|
8
15
|
|
|
@@ -2,27 +2,39 @@
|
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
4
|
/***/ 945:
|
|
5
|
-
/***/ (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
5
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
6
|
+
|
|
7
|
+
// Save global object in a variable
|
|
8
|
+
var __global__ =
|
|
9
|
+
(typeof globalThis !== 'undefined' && globalThis) ||
|
|
10
|
+
(typeof self !== 'undefined' && self) ||
|
|
11
|
+
(typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g);
|
|
12
|
+
// Create an object that extends from __global__ without the fetch function
|
|
13
|
+
var __globalThis__ = (function () {
|
|
9
14
|
function F() {
|
|
10
15
|
this.fetch = false;
|
|
11
|
-
this.DOMException =
|
|
16
|
+
this.DOMException = __global__.DOMException
|
|
12
17
|
}
|
|
13
|
-
F.prototype =
|
|
18
|
+
F.prototype = __global__; // Needed for feature detection on whatwg-fetch's code
|
|
14
19
|
return new F();
|
|
15
20
|
})();
|
|
16
|
-
|
|
21
|
+
// Wraps whatwg-fetch with a function scope to hijack the global object
|
|
22
|
+
// "globalThis" that's going to be patched
|
|
23
|
+
(function(globalThis) {
|
|
17
24
|
|
|
18
25
|
var irrelevant = (function (exports) {
|
|
19
26
|
|
|
27
|
+
var global =
|
|
28
|
+
(typeof globalThis !== 'undefined' && globalThis) ||
|
|
29
|
+
(typeof self !== 'undefined' && self) ||
|
|
30
|
+
(typeof global !== 'undefined' && global);
|
|
31
|
+
|
|
20
32
|
var support = {
|
|
21
|
-
searchParams: 'URLSearchParams' in
|
|
22
|
-
iterable: 'Symbol' in
|
|
33
|
+
searchParams: 'URLSearchParams' in global,
|
|
34
|
+
iterable: 'Symbol' in global && 'iterator' in Symbol,
|
|
23
35
|
blob:
|
|
24
|
-
'FileReader' in
|
|
25
|
-
'Blob' in
|
|
36
|
+
'FileReader' in global &&
|
|
37
|
+
'Blob' in global &&
|
|
26
38
|
(function() {
|
|
27
39
|
try {
|
|
28
40
|
new Blob();
|
|
@@ -31,8 +43,8 @@ var irrelevant = (function (exports) {
|
|
|
31
43
|
return false
|
|
32
44
|
}
|
|
33
45
|
})(),
|
|
34
|
-
formData: 'FormData' in
|
|
35
|
-
arrayBuffer: 'ArrayBuffer' in
|
|
46
|
+
formData: 'FormData' in global,
|
|
47
|
+
arrayBuffer: 'ArrayBuffer' in global
|
|
36
48
|
};
|
|
37
49
|
|
|
38
50
|
function isDataView(obj) {
|
|
@@ -63,8 +75,8 @@ var irrelevant = (function (exports) {
|
|
|
63
75
|
if (typeof name !== 'string') {
|
|
64
76
|
name = String(name);
|
|
65
77
|
}
|
|
66
|
-
if (/[^a-z0-9\-#$%&'*+.^_
|
|
67
|
-
throw new TypeError('Invalid character in header field name')
|
|
78
|
+
if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {
|
|
79
|
+
throw new TypeError('Invalid character in header field name: "' + name + '"')
|
|
68
80
|
}
|
|
69
81
|
return name.toLowerCase()
|
|
70
82
|
}
|
|
@@ -228,6 +240,17 @@ var irrelevant = (function (exports) {
|
|
|
228
240
|
this.bodyUsed = false;
|
|
229
241
|
|
|
230
242
|
this._initBody = function(body) {
|
|
243
|
+
/*
|
|
244
|
+
fetch-mock wraps the Response object in an ES6 Proxy to
|
|
245
|
+
provide useful test harness features such as flush. However, on
|
|
246
|
+
ES5 browsers without fetch or Proxy support pollyfills must be used;
|
|
247
|
+
the proxy-pollyfill is unable to proxy an attribute unless it exists
|
|
248
|
+
on the object before the Proxy is created. This change ensures
|
|
249
|
+
Response.bodyUsed exists on the instance, while maintaining the
|
|
250
|
+
semantic of setting Request.bodyUsed in the constructor before
|
|
251
|
+
_initBody is called.
|
|
252
|
+
*/
|
|
253
|
+
this.bodyUsed = this.bodyUsed;
|
|
231
254
|
this._bodyInit = body;
|
|
232
255
|
if (!body) {
|
|
233
256
|
this._bodyText = '';
|
|
@@ -280,7 +303,20 @@ var irrelevant = (function (exports) {
|
|
|
280
303
|
|
|
281
304
|
this.arrayBuffer = function() {
|
|
282
305
|
if (this._bodyArrayBuffer) {
|
|
283
|
-
|
|
306
|
+
var isConsumed = consumed(this);
|
|
307
|
+
if (isConsumed) {
|
|
308
|
+
return isConsumed
|
|
309
|
+
}
|
|
310
|
+
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
|
311
|
+
return Promise.resolve(
|
|
312
|
+
this._bodyArrayBuffer.buffer.slice(
|
|
313
|
+
this._bodyArrayBuffer.byteOffset,
|
|
314
|
+
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
315
|
+
)
|
|
316
|
+
)
|
|
317
|
+
} else {
|
|
318
|
+
return Promise.resolve(this._bodyArrayBuffer)
|
|
319
|
+
}
|
|
284
320
|
} else {
|
|
285
321
|
return this.blob().then(readBlobAsArrayBuffer)
|
|
286
322
|
}
|
|
@@ -326,6 +362,10 @@ var irrelevant = (function (exports) {
|
|
|
326
362
|
}
|
|
327
363
|
|
|
328
364
|
function Request(input, options) {
|
|
365
|
+
if (!(this instanceof Request)) {
|
|
366
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
|
367
|
+
}
|
|
368
|
+
|
|
329
369
|
options = options || {};
|
|
330
370
|
var body = options.body;
|
|
331
371
|
|
|
@@ -362,6 +402,21 @@ var irrelevant = (function (exports) {
|
|
|
362
402
|
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
363
403
|
}
|
|
364
404
|
this._initBody(body);
|
|
405
|
+
|
|
406
|
+
if (this.method === 'GET' || this.method === 'HEAD') {
|
|
407
|
+
if (options.cache === 'no-store' || options.cache === 'no-cache') {
|
|
408
|
+
// Search for a '_' parameter in the query string
|
|
409
|
+
var reParamSearch = /([?&])_=[^&]*/;
|
|
410
|
+
if (reParamSearch.test(this.url)) {
|
|
411
|
+
// If it already exists then set the value with the current time
|
|
412
|
+
this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());
|
|
413
|
+
} else {
|
|
414
|
+
// Otherwise add a new '_' parameter to the end with the current time
|
|
415
|
+
var reQueryString = /\?/;
|
|
416
|
+
this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
365
420
|
}
|
|
366
421
|
|
|
367
422
|
Request.prototype.clone = function() {
|
|
@@ -389,20 +444,31 @@ var irrelevant = (function (exports) {
|
|
|
389
444
|
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
390
445
|
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
391
446
|
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
447
|
+
// Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill
|
|
448
|
+
// https://github.com/github/fetch/issues/748
|
|
449
|
+
// https://github.com/zloirock/core-js/issues/751
|
|
450
|
+
preProcessedHeaders
|
|
451
|
+
.split('\r')
|
|
452
|
+
.map(function(header) {
|
|
453
|
+
return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header
|
|
454
|
+
})
|
|
455
|
+
.forEach(function(line) {
|
|
456
|
+
var parts = line.split(':');
|
|
457
|
+
var key = parts.shift().trim();
|
|
458
|
+
if (key) {
|
|
459
|
+
var value = parts.join(':').trim();
|
|
460
|
+
headers.append(key, value);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
400
463
|
return headers
|
|
401
464
|
}
|
|
402
465
|
|
|
403
466
|
Body.call(Request.prototype);
|
|
404
467
|
|
|
405
468
|
function Response(bodyInit, options) {
|
|
469
|
+
if (!(this instanceof Response)) {
|
|
470
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
|
471
|
+
}
|
|
406
472
|
if (!options) {
|
|
407
473
|
options = {};
|
|
408
474
|
}
|
|
@@ -410,7 +476,7 @@ var irrelevant = (function (exports) {
|
|
|
410
476
|
this.type = 'default';
|
|
411
477
|
this.status = options.status === undefined ? 200 : options.status;
|
|
412
478
|
this.ok = this.status >= 200 && this.status < 300;
|
|
413
|
-
this.statusText =
|
|
479
|
+
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
|
414
480
|
this.headers = new Headers(options.headers);
|
|
415
481
|
this.url = options.url || '';
|
|
416
482
|
this._initBody(bodyInit);
|
|
@@ -443,7 +509,7 @@ var irrelevant = (function (exports) {
|
|
|
443
509
|
return new Response(null, {status: status, headers: {location: url}})
|
|
444
510
|
};
|
|
445
511
|
|
|
446
|
-
exports.DOMException =
|
|
512
|
+
exports.DOMException = global.DOMException;
|
|
447
513
|
try {
|
|
448
514
|
new exports.DOMException();
|
|
449
515
|
} catch (err) {
|
|
@@ -479,22 +545,38 @@ var irrelevant = (function (exports) {
|
|
|
479
545
|
};
|
|
480
546
|
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
481
547
|
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
482
|
-
|
|
548
|
+
setTimeout(function() {
|
|
549
|
+
resolve(new Response(body, options));
|
|
550
|
+
}, 0);
|
|
483
551
|
};
|
|
484
552
|
|
|
485
553
|
xhr.onerror = function() {
|
|
486
|
-
|
|
554
|
+
setTimeout(function() {
|
|
555
|
+
reject(new TypeError('Network request failed'));
|
|
556
|
+
}, 0);
|
|
487
557
|
};
|
|
488
558
|
|
|
489
559
|
xhr.ontimeout = function() {
|
|
490
|
-
|
|
560
|
+
setTimeout(function() {
|
|
561
|
+
reject(new TypeError('Network request failed'));
|
|
562
|
+
}, 0);
|
|
491
563
|
};
|
|
492
564
|
|
|
493
565
|
xhr.onabort = function() {
|
|
494
|
-
|
|
566
|
+
setTimeout(function() {
|
|
567
|
+
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
568
|
+
}, 0);
|
|
495
569
|
};
|
|
496
570
|
|
|
497
|
-
|
|
571
|
+
function fixUrl(url) {
|
|
572
|
+
try {
|
|
573
|
+
return url === '' && global.location.href ? global.location.href : url
|
|
574
|
+
} catch (e) {
|
|
575
|
+
return url
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
xhr.open(request.method, fixUrl(request.url), true);
|
|
498
580
|
|
|
499
581
|
if (request.credentials === 'include') {
|
|
500
582
|
xhr.withCredentials = true;
|
|
@@ -502,13 +584,27 @@ var irrelevant = (function (exports) {
|
|
|
502
584
|
xhr.withCredentials = false;
|
|
503
585
|
}
|
|
504
586
|
|
|
505
|
-
if ('responseType' in xhr
|
|
506
|
-
|
|
587
|
+
if ('responseType' in xhr) {
|
|
588
|
+
if (support.blob) {
|
|
589
|
+
xhr.responseType = 'blob';
|
|
590
|
+
} else if (
|
|
591
|
+
support.arrayBuffer &&
|
|
592
|
+
request.headers.get('Content-Type') &&
|
|
593
|
+
request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
|
|
594
|
+
) {
|
|
595
|
+
xhr.responseType = 'arraybuffer';
|
|
596
|
+
}
|
|
507
597
|
}
|
|
508
598
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
599
|
+
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
|
|
600
|
+
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
|
601
|
+
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
|
602
|
+
});
|
|
603
|
+
} else {
|
|
604
|
+
request.headers.forEach(function(value, name) {
|
|
605
|
+
xhr.setRequestHeader(name, value);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
512
608
|
|
|
513
609
|
if (request.signal) {
|
|
514
610
|
request.signal.addEventListener('abort', abortXhr);
|
|
@@ -527,11 +623,11 @@ var irrelevant = (function (exports) {
|
|
|
527
623
|
|
|
528
624
|
fetch.polyfill = true;
|
|
529
625
|
|
|
530
|
-
if (!
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
626
|
+
if (!global.fetch) {
|
|
627
|
+
global.fetch = fetch;
|
|
628
|
+
global.Headers = Headers;
|
|
629
|
+
global.Request = Request;
|
|
630
|
+
global.Response = Response;
|
|
535
631
|
}
|
|
536
632
|
|
|
537
633
|
exports.Headers = Headers;
|
|
@@ -539,18 +635,15 @@ var irrelevant = (function (exports) {
|
|
|
539
635
|
exports.Response = Response;
|
|
540
636
|
exports.fetch = fetch;
|
|
541
637
|
|
|
542
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
543
|
-
|
|
544
638
|
return exports;
|
|
545
639
|
|
|
546
640
|
})({});
|
|
547
|
-
})(
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
delete
|
|
551
|
-
// Choose between native implementation (
|
|
552
|
-
|
|
553
|
-
var ctx = __self__; // this line disable service worker support temporarily
|
|
641
|
+
})(__globalThis__);
|
|
642
|
+
// This is a ponyfill, so...
|
|
643
|
+
__globalThis__.fetch.ponyfill = true;
|
|
644
|
+
delete __globalThis__.fetch.polyfill;
|
|
645
|
+
// Choose between native implementation (__global__) or custom implementation (__globalThis__)
|
|
646
|
+
var ctx = __global__.fetch ? __global__ : __globalThis__;
|
|
554
647
|
exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
|
|
555
648
|
exports["default"] = ctx.fetch // For TypeScript consumers without esModuleInterop.
|
|
556
649
|
exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'
|
|
@@ -582,13 +675,26 @@ module.exports = exports
|
|
|
582
675
|
/******/ };
|
|
583
676
|
/******/
|
|
584
677
|
/******/ // Execute the module function
|
|
585
|
-
/******/ __webpack_modules__[moduleId]
|
|
678
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
586
679
|
/******/
|
|
587
680
|
/******/ // Return the exports of the module
|
|
588
681
|
/******/ return module.exports;
|
|
589
682
|
/******/ }
|
|
590
683
|
/******/
|
|
591
684
|
/************************************************************************/
|
|
685
|
+
/******/ /* webpack/runtime/global */
|
|
686
|
+
/******/ (() => {
|
|
687
|
+
/******/ __webpack_require__.g = (function() {
|
|
688
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
689
|
+
/******/ try {
|
|
690
|
+
/******/ return this || new Function('return this')();
|
|
691
|
+
/******/ } catch (e) {
|
|
692
|
+
/******/ if (typeof window === 'object') return window;
|
|
693
|
+
/******/ }
|
|
694
|
+
/******/ })();
|
|
695
|
+
/******/ })();
|
|
696
|
+
/******/
|
|
697
|
+
/************************************************************************/
|
|
592
698
|
var __webpack_exports__ = {};
|
|
593
699
|
/* eslint-env worker */
|
|
594
700
|
|
|
@@ -662,4 +768,4 @@ self.addEventListener('message', onMessage);
|
|
|
662
768
|
module.exports = __webpack_exports__;
|
|
663
769
|
/******/ })()
|
|
664
770
|
;
|
|
665
|
-
//# sourceMappingURL=fetch-worker.
|
|
771
|
+
//# sourceMappingURL=fetch-worker.3bf90a691c26a60b5752.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/fetch-worker.3bf90a691c26a60b5752.js","mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;AAEA;AAEA;AACA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA","sources":["webpack://scratch-storage/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://scratch-storage/webpack/bootstrap","webpack://scratch-storage/webpack/runtime/global","webpack://scratch-storage/./src/FetchWorkerTool.worker.js"],"sourcesContent":["// Save global object in a variable\nvar __global__ =\n(typeof globalThis !== 'undefined' && globalThis) ||\n(typeof self !== 'undefined' && self) ||\n(typeof global !== 'undefined' && global);\n// Create an object that extends from __global__ without the fetch function\nvar __globalThis__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = __global__.DOMException\n}\nF.prototype = __global__; // Needed for feature detection on whatwg-fetch's code\nreturn new F();\n})();\n// Wraps whatwg-fetch with a function scope to hijack the global object\n// \"globalThis\" that's going to be patched\n(function(globalThis) {\n\nvar irrelevant = (function (exports) {\n\n var global =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n (typeof global !== 'undefined' && global);\n\n var support = {\n searchParams: 'URLSearchParams' in global,\n iterable: 'Symbol' in global && 'iterator' in Symbol,\n blob:\n 'FileReader' in global &&\n 'Blob' in global &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in global,\n arrayBuffer: 'ArrayBuffer' in global\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n this.bodyUsed = this.bodyUsed;\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this);\n if (isConsumed) {\n return isConsumed\n }\n if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/;\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/;\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();\n }\n }\n }\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText;\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = global.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n setTimeout(function() {\n resolve(new Response(body, options));\n }, 0);\n };\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n }, 0);\n };\n\n function fixUrl(url) {\n try {\n return url === '' && global.location.href ? global.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob';\n } else if (\n support.arrayBuffer &&\n request.headers.get('Content-Type') &&\n request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1\n ) {\n xhr.responseType = 'arraybuffer';\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]));\n });\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!global.fetch) {\n global.fetch = fetch;\n global.Headers = Headers;\n global.Request = Request;\n global.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n})({});\n})(__globalThis__);\n// This is a ponyfill, so...\n__globalThis__.fetch.ponyfill = true;\ndelete __globalThis__.fetch.polyfill;\n// Choose between native implementation (__global__) or custom implementation (__globalThis__)\nvar ctx = __global__.fetch ? __global__ : __globalThis__;\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","/* eslint-env worker */\n\nconst crossFetch = require('cross-fetch').default;\n\nlet jobsActive = 0;\nconst complete = [];\n\nlet intervalId = null;\n\n/**\n * Register a step function.\n *\n * Step checks if there are completed jobs and if there are sends them to the\n * parent. Then it checks the jobs count. If there are no further jobs, clear\n * the step.\n */\nconst registerStep = function () {\n intervalId = setInterval(() => {\n if (complete.length) {\n // Send our chunk of completed requests and instruct postMessage to\n // transfer the buffers instead of copying them.\n postMessage(\n complete.slice(),\n // Instruct postMessage that these buffers in the sent message\n // should use their Transferable trait. After the postMessage\n // call the \"buffers\" will still be in complete if you looked,\n // but they will all be length 0 as the data they reference has\n // been sent to the window. This lets us send a lot of data\n // without the normal postMessage behaviour of making a copy of\n // all of the data for the window.\n complete.map(response => response.buffer).filter(Boolean)\n );\n complete.length = 0;\n }\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }, 1);\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param {object} options.job A job id, url, and options descriptor to perform.\n */\nconst onMessage = ({data: job}) => {\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n\n crossFetch(job.url, job.options)\n .then(result => {\n if (result.ok) return result.arrayBuffer();\n if (result.status === 404) return null;\n return Promise.reject(result.status);\n })\n .then(buffer => complete.push({id: job.id, buffer}))\n .catch(error => complete.push({id: job.id, error: (error && error.message) || `Failed request: ${job.url}`}))\n .then(() => jobsActive--);\n};\n\n// crossFetch means \"fetch\" is now always supported\npostMessage({support: {fetch: true}});\nself.addEventListener('message', onMessage);\n"],"names":[],"sourceRoot":""}
|